Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
5,834,560
5,834,561
Running an Activity a certain interval before going to sleep
<p>I am currently working on customizing an Android system and would like that, a few minutes before going to sleep, a given Activity is run, with the same premises as the sleep function (e.g. if the user performs any action, its timer gets reset).</p> <p>For instance, let's say that we set its timer to 5 minutes and the device is set to go to sleep after 10 minutes. This means that, as long as there is no user input (or wakelocks acquired etc.), after 5 minutes my Activity is started, and after another 5 minutes the device enters sleep mode (think of it similar to a screensaver).</p> <p>My initial searches have lead me to the PowerManagerService class, where the ACTION_SCREEN_OFF is broadcast, but the general idea of the code there has so far eluded me.</p> <p>Any help would be appreciated. Thank you.</p>
android
[4]
136,847
136,848
Turn a page like a Book with UIView?
<p>I am trying to switch between UIViews by making it look like you are turning a page in a book.</p> <p>The UIViewAnimationTransitionCurlUp is pretty close if I could get it to curl toward the Left or Right. Is this possible?</p> <p>I have tried to use the CATRansition but none of the animation types come close to a page turning.</p> <p>Any suggestions on how to create this page animation transition that would turn a page toward the left or right?</p> <p>Thank you</p>
iphone
[8]
1,104,703
1,104,704
Iterating through Struct members
<p>Lets say we have a struct</p> <pre><code>Struct myStruct { int var1; int var2; string var3; . . } </code></pre> <p>Is it possible to to iterate through the structure's members by maybe using foreach? I have read some things on reflection, but I am not sure how to apply that here.</p> <blockquote> <p>There are about 20 variables in the struct. I am trying to read values off a file and trying to assign them to the variables but don't want to call file.ReadLine() 20 times. I am trying to access the member variables through a loop</p> </blockquote>
c#
[0]
47,060
47,061
How can I send a date from one site to other sites?
<p>I'm not much of a php coder, mainly use VB. But I had a problem with one of my apps. To make it more secure I would need each php parameter to go through one site. Here is an example of what I mean:</p> <ul> <li>Application loads</li> <li>Sends ip and location to 2 servers (a.php &amp; b.php)</li> </ul> <p>The problem so far is that the PC is making direct connections to these pages. What I was trying to do is make it so that it only sends one command to <code>z.php</code> and the page <code>z.php</code> would send the data to <code>a.php</code> and <code>b.php</code>.</p> <p>My question is: How would I set up <code>z.php</code>?</p> <p>I hope this makes sense; I have looked everywhere and couldn't find an answer.</p>
php
[2]
1,519,863
1,519,864
User-facing numbers: implementing them efficient, "operational" and round-off safe?
<p>I have something similar to a <strong>spreadsheet column</strong> in mind. A spreadsheet column has transparent data typing: text or any kinds of numbers.</p> <p>But no matter how the typing is implemented internally, they allow <strong>roundoff-safe</strong> operations; eg adding up a column of hundreds of numbers with decimal points, and other arithmetic operations. And they do it efficiently too.</p> <p>What way of handling numbers can make them:</p> <ol> <li>transparent to the user</li> <li>round-off safe</li> <li>support efficient arithmetic, aggregation, sorting</li> <li>handled by datastores and applications with Java primitive types?</li> </ol> <hr> <p>I have in mind, using a 64b <code>long</code> datatype that is internally multiplied by 1000 to provide 3 decimal places. For example <code>123.456</code> is internally stored as <code>123456</code>, <code>`1</code> is stored as <code>1000</code>. Reinventing floating point numbers seems clunky; I have to reinvent multiplication, for example.</p> <hr> <p><strong>Miscellany:</strong> I actually have in mind a document tagging system. A number tag is conceptually similar to a spreadsheet column that is used to store numbers.</p> <p>I do want to know how spreadsheets handle it, and I would have titled the question as such.</p> <p>I am using two datastores that uses Java primitive types. Point #4 wasnt hypothetical.</p>
java
[1]
806,365
806,366
Round hundreds, thousands, lack in to H, T, L
<p>Is there any PHP function which convert</p> <p>100 = 1H 1000 = 10H 10000 = 10T 100000 = 1L</p> <p>and so on</p>
php
[2]
2,972,438
2,972,439
C# + PostScript
<p>Is there a way to implement PostScript like page display for text files in C#??</p> <p>ie a Print Preview for a bunch of text in a web page. The requirement is to show a Print Preview like in Google Docs for a text displayed inside a label.</p>
c#
[0]
5,160,927
5,160,928
Configuration Error on roleManager in web.config on subdirectory
<p>I am getting an error in my <code>web.config</code> file at <code>&lt;rolemanager enabled="false"&gt;</code> can any one tell how to resolve this</p> <p><img src="http://i.stack.imgur.com/EzTbC.png" alt="enter image description here"></p>
asp.net
[9]
396,778
396,779
Select class nearest clicked button
<p>I want to expand the nearest div with the class "divtoexpand" when clicking button1.</p> <p>How can I achieve this?</p> <p>HTML:</p> <pre><code>&lt;div class="test"&gt; &lt;div class="menu"&gt; &lt;div class="button1"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="divtoexpand"&gt;&lt;/div&gt; &lt;div class="test"&gt; &lt;div class="menu"&gt; &lt;div class="button1"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="divtoexpand"&gt;&lt;/div&gt; </code></pre>
jquery
[5]
3,142,214
3,142,215
how do I get a unique ID per object in Java?
<p>I made a vector set in order to avoid thrashing the GC with iterator allocations and the like ( you get a new/free each for both the set reference and the set iterator for each traversal of a HashSet's values or keys )</p> <p>anyway supposedly the <code>Object.hashCode()</code> method is a unique id per object. (would fail for a 64 bit version?) </p> <p>But in any case it is overridable and therefore not guaranteed unique, nor unique per object instance.</p> <p>If I want to create an "ObjectSet" how do I get a guaranteed unique ID for each instance of an object??</p> <p>I just found this: which answers it.</p> <p><a href="http://stackoverflow.com/questions/909843/java-how-to-get-the-unique-id-of-an-object-which-overrides-hashcode">Java: How to get the unique ID of an object which overrides hashCode()?</a></p>
java
[1]
4,167,199
4,167,200
"The type Main must implement the inherited abstract method TextWatcher.beforeTextChanged(charSequence,int,int,int)
<p>I'm trying to add a TextWatcher editbox.afterTextChanged listenering to my "Main" activity where I have already used an onFocusListener. I receive this error message on the line where I declare the Main class:</p> <pre><code>public class Main extends Activity implements OnFocusChangeListener, TextWatcher{ </code></pre> <p>the listener is set to an edittext box with:</p> <pre><code>etBox1.addTextChangedListener(this); </code></pre> <p>and the code to implement with the catch is:</p> <p>public void afterTextChanged(Editable s) { doMyCalcs(); } </p> <p>Any idea where I went wrong?</p>
android
[4]
1,950,305
1,950,306
Copying to an empty folder?
<p>When i use the command : </p> <pre><code>FILE.copy(source path , destination path) </code></pre> <p>it's perform the copy just if in the destination path there is a file in the same name as the file i want to copy from the source path. actualy- it's replace it.<br> how can i perform copying that will create the file by itself?- i want to copy file to an empty folder!</p>
c#
[0]
5,136,335
5,136,336
while trying to write data into text file it is showing server doesnot exist in this context
<p>Here i have code base like this:</p> <pre><code>class Program { static void Main(string[] args) { try { 'String str; 'str = Server.MapPath("/financila_csharp"); StreamReader reader = new StreamReader("selectedmdx.txt"); StreamWriter writer = new StreamWriter("selectedxmlmdx.txt"); string line = reader.ReadLine(); while (line != null) { XmlDocument dom = new XmlDocument(); dom.LoadXml("&lt;Result&gt;" + System.Security.SecurityElement.Escape(line) + "&lt;/Result&gt;"); writer.WriteLine(dom.DocumentElement.OuterXml); line = reader.ReadLine(); } Console.WriteLine("Completed"); reader.Close(); writer.Close(); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadLine(); } } </code></pre> <p>In console window it is showing "specified file does not exist", even if I have the "selectedmdx.txt" file in the same project directory.</p> <p>How can I fix it?</p>
c#
[0]
2,332,269
2,332,270
emulator does not open up home screen
<p>My emulator does not open up.</p> <p>I have seen other questions in stackoverflow similar to my question, but I didn't get any help. Also I replaced my 1GB RAM with 2GB. But its still the same. The emulator does not show the home screen. I am using P4 3.0 GHZ processor. I also tried assigning 1024 mib to sd for a avd. But it is still the same.</p> <p>I am using Android SDK 4.0 and Eclipse Juno.</p>
android
[4]
4,327,139
4,327,140
Is it a mistake to return a list if the return type is an enumerable
<p>I have often the case where I want to return an <code>Enumerable&lt;T&gt;</code> from a method or a property. To build the returning <code>Enumerable&lt;T&gt;</code>, I use a <code>List&lt;T&gt;</code>-instance. After filling the list, I return the list.</p> <p>I always thought that this is enough. But it exists the possibility that the caller casts the resulting <code>Enumerable&lt;T&gt;</code> back into the <code>List&lt;T&gt;</code> and begins to work further with it. If in a later time I change the implementation of my method, the caller’s code will fail. To avoid this, I could return list.ToArray or make a read-only list before returning it to the caller. But for me this seems to be a big overkill. What do you think?</p> <p>Please note, <strong>I never will return an internally used list</strong> so that the caller can change my objects internal state. The question is only about a short living list that is built temporary to hold the return values.</p> <pre><code>IEnumerable&lt;string&gt; GetAList() { List&lt;string&gt; aList = new List&lt;string&gt;(); aList.Add("a"); aList.Add("b"); return aList; } IEnumerable&lt;string&gt; GetAList() { List&lt;string&gt; aList = new List&lt;string&gt;(); aList.Add("a"); aList.Add("b"); return aList.ToArray&lt;string&gt;(); } </code></pre> <p>The examples are super-simple and in this case I would work from the beginning on with arrays, but it’s only to show explain the question.</p>
c#
[0]
3,324,143
3,324,144
python read next()
<p>next() in python does not work. what is an alternative to reading next line in python. here is a sample</p> <pre><code>filne = "D:/testtube/testdkanimfilternode.txt" f = open(filne, 'r+') while 1: lines = f.readlines() if not lines: break for line in lines: print line if (line[:5] == "anim "): print 'next() ' ne = f.next() print ' ne ',ne,'\n' break f.close() </code></pre> <p>Running this on a file does not show 'ne '</p> <p>Brgds,</p> <p>kNish </p>
python
[7]
2,406,041
2,406,042
C# get access to caller in parent constructor
<p>I have a child and a parent class, as such:</p> <pre><code>class B : A{ public B : base(){ // stuff } } class A{ public A(){ // how can I gain access here to the class that called me, // ie the instance of class B that's being instantiated. } } </code></pre> <p>As above, my question is whether I can see who called the parent constructor within the constructor of the parent class.</p> <p>One way to do this would be to have a separate function in <code>A</code> to which you pass <code>this</code> from within B. Is there anything simpler, ie can I do this during object initialization, or is that too early in the object construction process ? Does the whole object <code>B</code> need to be "ready" before I can access it from within <code>A</code> ?</p> <p>Thanks!</p>
c#
[0]
2,364,536
2,364,537
php doesn't disable functions
<p>I call php from the commandline, with the -c argument to load another php.ini file, like this:</p> <pre><code>php -c my_ini_file.ini test.php </code></pre> <p>So in <code>disabled_functions</code> I added the <code>echo</code> function.</p> <p>In test.php, echo works, and I don't know why. <code>phpinfo()</code> shows echo as a disabled function.</p>
php
[2]
1,035,433
1,035,434
Why do we have the output : S1S2 in this case?
<p>In the code below, the output is : S1S2. Why do we get the that result?</p> <pre><code> public class S1 { public static void main(String[] args) { new S2(); } S1(){ System.out.print("S1"); } } class S2 extends S1{ S2(){ System.out.print("S2"); } } </code></pre>
java
[1]
3,347,831
3,347,832
What does x(); refer to?
<pre><code>var y = new w(); var x = y.z; y.z= function() { doOneThing(); x(); } </code></pre> <p><em>where <code>w</code> does not contain a <code>z</code> object but contains other objects (e.g, <code>a</code>, <code>b</code>, <code>c</code>)</em></p> <p>What is <code>x();</code> possibly referring too? (Again, this is JavaScript)<br /> Is the function calling itself?</p>
javascript
[3]
2,820,996
2,820,997
compare array values for a if statement php
<p>im having a list of names james,steve,manson,charles in a array and im using the explode function to separate them.</p> <pre><code> $pieces = explode(",", $full); foreach ($pieces as $p ){ $piece[]=$p; } </code></pre> <p>the problem that im having is that i can access the variables as</p> <pre><code>$piece[0]; $piece[1]; </code></pre> <p>but the order differs time to time based on the input therefore i cant do a comparison. can someone suggest how to set the values so i can do the comparison as below</p> <pre><code> if ($piece==='manson'){ //do something; }else{ //do something } if ($piece==='steve'){ //do something; }else{ //do something } </code></pre>
php
[2]
609,154
609,155
How to separate four bytes of floats?
<p>Could anyone, please guide me as how to separate 4 bytes of folat in Visual Studio C#.Net, and retives each byte as a character.As i need to save each byte of float as hex value in a text(.hex) file.</p> <p>Regards Asad</p>
c#
[0]
3,923,594
3,923,595
How to set that data whole area in gridview?
<p>Hello, I am using the dataGridview control to display some data, but my problem is I have one or two columns of data, the columns will appear in a small part in gridview instead of filling all available space. I want the data to take up all available area in the datagrid. How can I do This? thank you!</p>
c#
[0]
1,765,375
1,765,376
updation in database related to a web service
<p>we can fetch data from xml file through a link but can we update that xml file data through link.. and make changes in database related to it???</p>
iphone
[8]
1,936,573
1,936,574
fixing many of headers and cookies problems
<p>i am still beginner in PHP but i found that one of the good things when you want to Avoid scripting headache is to turn output buffering on, specially that the script may work well in localhost but you face some troubles when you upload it to your site</p> <p>simply at the top of your code before any HTML code you have to write</p> <pre><code>&lt;?php ob_start(); ?&gt; </code></pre> <p>and in the bottom of your code end it using</p> <pre><code>&lt;?php ob_end_flush(); ?&gt; </code></pre> <p>i hope it can save many of scripting headache </p>
php
[2]
842,382
842,383
Augumented Reality Concept in iphone
<p>Thanks in advance. I want to know how to implement augument reality concept in iphone. I have seen the apis like wikitude , Layers and Unifeye sdk but i am not that much clear about the concept. If any one know please suggest me which api have to follow to develop and if possible provide me some documentation.</p>
iphone
[8]
2,004,093
2,004,094
android - how to get html code of a webpage in android?
<p>i want to get the html code of a webpage in android. The webpage url will be given in a edit textbox then when the user will click the button a text view will show the code of that webpage. Please explain and give the code!</p> <p>Any help would be appreciated!</p>
android
[4]
5,346,120
5,346,121
php what is the best way to distinguish users
<p>I'm building a PHP voting system, and I want to limit the number of votes per user.</p> <p>So what is the best way to distinguish users on my website?</p> <p>I can track them by cookies or sessions but this doesn't seem efficient because if a user deletes his cookies he will pass the security test. I know there will not be a 100% solution but I want to follow the best practice here.</p> <p>Any help?</p>
php
[2]
3,875,130
3,875,131
About android international language
<p>Now, I'm doing a project, I would like to implement this software supports multiple languages ,My idea is to change the configuration file through xml,but I don's konw how to do that. </p>
android
[4]
2,063,844
2,063,845
How to start an activity Dialog
<p>I have one activity which i am using for displaying Dialogs and as a normal layout.<br> So what i want to do is, sometimes i want to start activity as Theme Dialog and some times using setContentView. </p> <p>I can't use <code>&lt;activity android:theme="@android:style/Theme.Dialog"&gt;</code> in manifest file as it will always display activity as dialog. </p> <p>So can we do it programmatic, i have also tried <code>setTheme()</code> method but it did't work.</p> <p>Thanks,<br> PP.</p>
android
[4]
3,861,858
3,861,859
Using ASIHTTPRequest and json-framework on the iPhone
<p>I'm planning on using both these libraries (or wrappers?) in my upcoming iPhone app. I see one of the top reason applications get refused, is due to using private frameworks/API calls. Is ASIHTTPRequest and json-framework considered such, or can I safely use these? </p>
iphone
[8]
819,519
819,520
How to maintain transactions in two different databases
<p>I have to maintain transactions between two different databases. I need to rollback if there is any error occurred in Database1 then all changes in database2 should be rollback.</p> <p>I have two connection string in my web.config file.</p>
asp.net
[9]
2,439,138
2,439,139
How to create named lock in java?
<p><strong> We can achive it in c# as follows- </strong></p> <pre> void readFile(File file) { Mutex mutexForFile = null; bool mutexCreateFlag; // Return true/false based on whether mutext is already exist or it is created as part of current call mutexForFile = new Mutex(false, file.FullName.GetHashCode().ToString(), out mutexCreateFlag); if (!mutexCreateFlag) throw new Exception("File UsedByOtherProcess"); else { mutexForFile .WaitOne(); // synchronized access to resource ProcessFile(fileInfo: file); mutexForFile .ReleaseMutex(); } } </pre> <p>Don't think about relevance of the code, just for example i have given</p> <p>will somthing like this be possible in Java?</p>
java
[1]
1,219,112
1,219,113
To detect service idle
<p>How to programmatically detect either my Apache webserver is idle using C#? I already have an open source program that monitors mouse movement. But how can I monitor either the targeted server is idle/up/down?</p>
c#
[0]
5,454,492
5,454,493
Asyc Task return Arraylist retrieve it?
<pre><code>new DownloadFilesTask().execute(myPrefs.getString("IP", ""), null, null); </code></pre> <p>I returns an Arraylist from the dobackground method..how to put it into my arraylist?</p> <pre><code>Arraylist al=null; al=new DownloadFilesTask().execute(myPrefs.getString("IP", ""), null, null); </code></pre> <p>not working.</p>
android
[4]
4,283,489
4,283,490
Reading a text file and pulling out specific columns
<p>What i need to do is read a specific text file and pull out the entire column based on a string.</p> <p>So if my string was parkingfee I would pull out whatever column in my | delimited file that header row matched the word parkingfee</p>
c#
[0]
2,276,367
2,276,368
How can I have my activity display in android contact menu, like i.e. facebook app?
<p>I would like to launch my android application from a contact menu which is displayed after clicking on a contact shortcut on android desktop, like on attached graphic.</p> <p>I couldn't find any materials on this in docs, but I think it should be possible, as i.e. facebook application puts it's icon in this menu. I tried to find something in it's AndroidManifest.xml file but with no effect (I'm not familiar with android development so I don't even know what to look for - Activity, intent, intent-filter, provider?</p> <p>I would appreciate link to docs or at least hint on terminology to google for.</p> <p>//edit</p> <p>It seems that my question is duplicate of : <a href="http://stackoverflow.com/questions/8858819/how-to-integrate-your-app-in-quick-contact-on-the-native-contact-app-on-android">How to integrate your app in QUICK CONTACT on the native contact app on android?</a> which has some helpful resources.</p> <p><img src="http://i.stack.imgur.com/DkJwn.png" alt="screenshot showing the menu"></p>
android
[4]
3,327,027
3,327,028
php input file line by line make first line header one tag
<pre><code> &lt;?php foreach (glob("POSTS/*.txt") as $filename) { $file = fopen($filename, 'r') or exit("Unable to open file!"); //Output a line of the file until the end is reached echo date('D, M jS, Y H:i a', filemtime($filename))."&lt;br&gt;"; while(!feof($file)) { echo fgets($file). "&lt;br&gt;"; } echo "&lt;hr/&gt;"; } fclose($file); ?&gt; </code></pre> <p>so this php code reads from a folder all the files and each file line by line, i want it so that the file when being read will: for the first line add an html tag to make the first line a big heading and the next lines normal? how do i do this, thanks</p>
php
[2]
235,616
235,617
Audio file and progress bar
<p>I am trying to design an audio player. I need help regarding the progress bar. I want the status of progress bar to change as the audio progresses. I want progress bar to pause as I press Pause button and start again as I press start button. Please help... Thanks in advance...</p>
iphone
[8]
2,895,095
2,895,096
Javascript function arguments has to be a string?
<p>I'm new to javascript so I'm not sure why it's behaving like this.</p> <p>I have a clock function:</p> <pre><code>function updateClock() { var currentTime = new Date(); var currentHours = currentTime.getHours(); var currentMinutes = currentTime.getMinutes(); var currentSeconds = currentTime.getSeconds(); var currentMilliseconds = currentTime.getMilliseconds(); // Pad the minutes and seconds with leading zeros, if required currentMinutes = ( currentMinutes &lt; 10 ? "0" : "" ) + currentMinutes; currentSeconds = ( currentSeconds &lt; 10 ? "0" : "" ) + currentSeconds; // Choose either "AM" or "PM" as appropriate var timeOfDay = ( currentHours &lt; 12 ) ? "AM" : "PM"; // Convert the hours component to 12-hour format if needed currentHours = ( currentHours &gt; 12 ) ? currentHours - 12 : currentHours; // Convert an hours component of "0" to "12" currentHours = ( currentHours == 0 ) ? 12 : currentHours; // Update the time display document.getElementById("clock").innerHTML = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay; } </code></pre> <p>which is in a separate <code>clock.js</code> file. I include that file in the head.</p> <p>I place this under the <code>clock div</code>:</p> <pre><code>&lt;script type="text/javascript"&gt; setInterval("updateClock()", 1000); &lt;/script&gt; </code></pre> <p>And it works. But if I change it to <code>setInterval(updateClock(), 1000);</code>, it won't work. I spent a while trying to figure out why the function only executed once until I found out I needed to put quotes around the function call.</p> <p>Coming from different languages background, I don't know why you need to put quotes around it? It looks like I'm passing a string <code>"updateClock()"</code> to the function instead of another function. I see other people's code where they just define the whole function as a parameter such as <code>setInterval(function(){ ... }, 1000)</code>.</p>
javascript
[3]
1,867,339
1,867,340
Passing form name and form object names to functions
<p>I'm having trouble understanding the workings of Javascript...I want to pass a form name and the submit button name so that the function can evaluate a passed value and either enable or disable the submit button. </p> <p>It works if I explicitly use the names but I'd like it to work dynamically. Unfortunately I just am not understanding how to correctly use these arguments.</p> <p>Right now the first document statement works (form name and button name are used), why doesn't the second, where arguments are used? I know from the alert that the form name isn't correct and can't be used as is but this won't work even if I explicitly name the form but use the passed button name which does appear correct.</p> <p>I know this must be javascript 101 but I run into this time and again and am just not getting what's what. Anyone willing to explain this to me?</p> <pre><code>&lt;script type="text/javascript"&gt; function aTest(formName,objName,val){ if (val&lt;5){ document.aForm.aBtn.disabled=false; alert(formName+" - "+objName); } else { document.formName.objName.disabled=true; } }//end function aTest(formName,objName) &lt;/script&gt; &lt;form name="aForm"&gt; &lt;input name="testFld" type="text" onBlur="aTest(this.form,'aBtn',this.value)"&gt; &lt;input name="aBtn" type="submit" value='submit'&gt;&lt;/form&gt; </code></pre> <p>Thank you for your kind attention!</p>
javascript
[3]
1,332,471
1,332,472
JQuery tab and JScrollPane combination is not working properly
<p>I'm using a jQuery tab and inside the I've used a jScroll Pane, tab code is below</p> <pre><code>$(function(){$('.tabs').each(function(){var currentTab, ul=$(this);$(this).find('a').each(function(i){ var a=$(this).bind('click', function(){ if(currentTab){ ul.find('a.active').removeClass('active'); $(currentTab).hide(); } currentTab=$(this).addClass('active').attr('href'); $(currentTab).show().jScrollPane(); return false; } ); $(a.attr('href')).hide();});});});&lt;/script&gt; </code></pre> <p>but initially my first tab is not showing, but the first tab should show initially. <strong>Can any body solve this?</strong></p>
jquery
[5]
3,416,108
3,416,109
MGTwitterEngine
<p><br> I am using mgtwitterEngine to integrate twitter functionality.In my application i want response in XML format so i have done all the changes as metion in readme of mgtwiiter for example i have done</p> <pre><code>#define YAJL_AVAILABLE 0 </code></pre> <p>in MGTwitterEngineGlobalHeader.h and </p> <pre><code>#define USE_LIBXML 1 </code></pre> <p>in MGTwitterEngine.m file and i am checking that API_FORMAT is xml too but whenever i am getting response i am getting in json format.<br> Please can any one tell me what am i missing? any help would be appreciated.</p> <p>Thaks</p>
iphone
[8]
2,311,837
2,311,838
Compiling php with modules vs using shared modules?
<p>Is there a difference between compiling php with the parameter:</p> <pre><code>--with-[extension name] </code></pre> <p>as opposed to just compiling it as a shared module and including it that way? Is there any performance benefit? If not, why would you want to do this?</p>
php
[2]
4,748,448
4,748,449
Doc, ppt, xls mime type
<p>I try to open <strong>doc, ppt, xls</strong> and <strong>pfg</strong> files with app installed via intent. For <strong>pdf</strong> I use <code>i.setDataAndType(Uri.fromFile(file), "application/pdf");</code> but if I do following:</p> <pre><code>i.setDataAndType(Uri.fromFile(file), "application/doc"); </code></pre> <p>I receive exception, saying that there are no apps, that can handle intent. What am I doing wrong? I've got QuickOffice installed, so I think it could open file.</p>
android
[4]
4,472,646
4,472,647
PHP file input, accessing the content of the file
<p>I am making a file input that takes in a txt file. How do I access the contents of the file that just got uploaded using PHP?</p>
php
[2]
1,921,002
1,921,003
Allowing user to change default screen
<p>My app lets the user choose a default screen for each time the app starts up, and I use SharedPreferences to do it. The app prompts them to choose a screen when it's launched for the first time after being installed, and that part works. However, inside the app where it allows the user to change the default screen, I use the same code and it never stores the change. What do I need to change in order to get it to save properly?</p> <pre><code> AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Choose a Default Screen"); builder.setItems(R.array.openChoices, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { SharedPreferences settings = getPreferences(0); SharedPreferences.Editor editor = settings.edit(); editor.putInt("start", item); editor.commit(); //Mech = 0, E&amp;M = 1 int choice = getPreferences(0).getInt("start", 3); if(choice == 0){ Toast.makeText(setscreen.this, "Mechanics is now the default screen", Toast.LENGTH_SHORT).show(); Intent myIntent = new Intent(setscreen.this, physics.class); startActivity(myIntent); } else if(choice == 1){ Toast.makeText(setscreen.this, "E&amp;M is now the default screen", Toast.LENGTH_SHORT).show(); Intent myIntent = new Intent(setscreen.this, physicsem.class); startActivity(myIntent); } } }); </code></pre>
android
[4]
792,243
792,244
python cpu consumption
<p>I wrote a simple python program that looks to me like it should be cpu intensive:</p> <pre><code>for a in range(0,1500): for b in range (0,a): for c in range(0,b): x = a+b+c print x </code></pre> <p>What happens is that it takes a really long time on solving it, but cpu consumption stays at around 25%. Why does this happens insead of using more cpu for a shorter time?</p>
python
[7]
761,928
761,929
Java sets: why there is no T get(Object o)?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/861296/why-does-the-java-util-setv-interface-not-provide-a-getobject-o-method">Why does the java.util.Set&lt;V&gt; interface not provide a get(Object o) method?</a> </p> </blockquote> <p>Why Java sets don't have methods for retrieving an element that is equal to provided?</p> <p>For example, I need to create an object pool, something like String.intern() method (yes, I know that this is usually done with weak references), so I need to create a Map and do map.put(o,o) to put my unique object if they are not present in the map. But a set is more appropriate in this case I think.</p>
java
[1]
2,904,202
2,904,203
detect change to window.name
<p>I'm trying to find a good way to detect when the window's name has changed. It is easy enough to do with <code>setInterval</code> like this:</p> <pre><code>var old_name = window.name; var check_name = function() { if(window.name != old_name) { console.log("window name changed to "+window.name); old_name = window.name; } } setInterval(check_name, 1000); </code></pre> <p>However, <code>setInterval</code> is more than a little hacky and may come with a significant (1s in this case) time delay before detecting changes. Is there any kind of event or clever bit of JS that can fire a function when the window name changes?</p> <p>Thanks! Joseph Mastey</p> <hr> <p>EDIT:</p> <p>Unfortunately, I don't have control over the code that will be changing the window name, which is in a way the entire point of the exercise. Having looked at <a href="http://samy.pl/evercookie" rel="nofollow">evercookie</a> and other posts about storing data in the window name as a way to track users, I've decided that this isn't really acceptable to me. So, I'm creating a Greasemonkey script (actually, the Chromium version of a greasemonkey script) to prevent this sort of data leakage.</p> <p>As an aside, I did find some magic functionality that Chromium implements that goes a long way towards what I want. JS provides magic getters and setters that can be used like this:</p> <pre><code>window.__defineSetter__("name", function(nm) { console.log("intercepted window.name attempt: "+nm); }); window.__defineGetter__("name", function() { return ""; }); </code></pre> <p>If I run this on the console, I can successfully hijack sets of the window name. However, running this code as a Chromium script (at least any variant I've tried so far) does not seem to be able to override the window behavior.</p>
javascript
[3]
3,184,450
3,184,451
MyLinearLayout.getDrawingCache() gives a NullPointerException
<p>edit:</p> <p><strong>Nevermind, got it working that way</strong></p> <pre><code>TopRatedPage.setDrawingCacheEnabled(true); TopRatedPage.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); TopRatedPage.layout(0, 0, TopRatedPage.getMeasuredWidth(), TopRatedPage.getMeasuredHeight()); TopRatedPage.buildDrawingCache(true); Bitmap screenshot = Bitmap.createBitmap(TopRatedPage.getDrawingCache()); TopRatedPage.setDrawingCacheEnabled(false); </code></pre> <hr> <p>old:</p> <p>I'm trying to take a screenshot from a layout, like so.</p> <pre><code>LinearLayout TopRatedPage = (LinearLayout)inflater.inflate(R.layout.toprated, null); ... Bitmap screenshot; TopRatedPage.setDrawingCacheEnabled(true); screenshot = Bitmap.createBitmap(TopRatedPage.getDrawingCache()); // Caused by: java.lang.NullPointerException TopRatedPage.setDrawingCacheEnabled(false); </code></pre> <p>Any ideas what I have done wrong?</p> <p>Thanks!</p> <p>edit: also tried like this, it doesn't throw an error, but given an empty bitmap.</p> <pre><code>Bitmap screenshot = TopRatedPage.getDrawingCache(); </code></pre>
android
[4]
4,798,701
4,798,702
I wonder what is happening in this Java code block
<pre><code>Objectname.methodone() .methodtwo() .methodthree() .methodfour(); </code></pre> <p>Are these statements above same as</p> <pre><code>Objectname.methodone(); Objectname.methodtwo(); Objectname.methodthree(); Objectname.methodfour(); </code></pre> <p>Thanks,</p>
java
[1]
5,282,695
5,282,696
What does the following code do if there is no GPS fix..?
<p>If there is no GPS FIX (because the person is in a metal building or something)....does it just stay in the Looper..?? OR does it keep trying for a fix via requestLocationUpdates..?? </p> <p>If I do have a good GPS FIX....my code works fine...and in onLocationChanged()...I update the current location to the database.</p> <p>Also...when is onLocationChanged() called..?? Is it only called when there is a GPS FIX..?? Just wondering..</p> <pre><code> public void run() { Looper.prepare(); LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); LocationListener ll = new mylocationlistener(); lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ll); Looper.loop(); } </code></pre>
android
[4]
3,751,247
3,751,248
Need to rename an image after upload
<p>i have this code here which outputs me an image.. I need to change it because for the moment it gives me something like : test.jpg, what i need is for it to give me test_s.jpg</p> <p>Using the rename function i guess!</p> <pre><code>$tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/'; $targetPath = str_replace('//','/',$targetPath); $targetFile = $targetPath . $_FILES['Filedata']['name']; tamano_nuevo_foto($stempFile, 420, $stargetFile); </code></pre>
php
[2]
2,585,776
2,585,777
weird select drop down box error. content spilling out on page
<p>Weird issue the country names are no longer being listed in the select dropdown box they're just spilling out all over the page. can anyone spot the coding error that is causing it?</p> <pre><code>echo "&lt;select name=recordcountry style='width: 136px;'&gt;"; //echo "&lt;option value=$country selected=selected&gt;-- Select --&lt;/option&gt;"; echo "&lt;option ". ($data['recordcountry'] == "" ? 'selected=selected&gt;-- Select --&lt;/option&gt;' : 'value="' .$data['recordcountry']. '" selected=selected'); $group1 = '&lt;optgroup label=Common&gt;'; $group2 = '&lt;optgroup label=Alphabetically&gt;'; $group = mysql_query("SELECT country, grouping, p_order FROM mast_country WHERE grouping IN ('1','2') ORDER BY p_order"); while($row = mysql_fetch_array($group)) { if ($row['grouping'] == '1') { $group1 .= '&lt;option value="'.$row['country'].'"&gt;'. $row['country'].'&lt;/option&gt;'; } else { $group2 .= '&lt;option value="'.$row['country'].'"&gt;'. $row['country'].'&lt;/option&gt;'; } $group1 .= '&lt;/otpgroup&gt;'; $group2 .= '&lt;/otpgroup&gt;'; echo $group1; echo $group2; echo "&lt;/select&gt;"; } </code></pre>
php
[2]
5,313,820
5,313,821
autoboxing and generics
<p>I am actually confused on the both the topics, can anyone explain me. </p> <pre><code>ArrayList&lt;Long&gt; queryParms = new ArrayList&lt;Long&gt;(); </code></pre> <ol> <li>Is the above one called generics or autoboxing and what is unboxing?</li> <li>Is it a best practice?</li> <li>Some say Autoboxing is evil thing.</li> <li>If i use generics, can i avoid autoboxing and unboxing?</li> </ol>
java
[1]
1,857,045
1,857,046
jQuery context selection
<p>If I do this</p> <pre><code>var domElement = $("#id"); </code></pre> <p>and the returned element is a div tag,</p> <p>How can I then do something like </p> <pre><code>domElement.$('div a:nth-child(3)').after(somehtml); </code></pre> <p>This is an example where I want to add some HTML after the third link under that "domElement" div.</p> <p>The above doesn't seem to work. I have numerous examples where I have already selected a certain element from the entire page HTML and I then want to work inside the "context" of that element.</p> <p>In 90% of cases I want to continue jQuery selection, traversion and manipulation from a previously selected DOM element from a page not from the whole page like $(..) does.</p>
jquery
[5]
3,600,245
3,600,246
how to handle screen orientation?
<p>In my program I set my layout orientation as vertical but if I am rotating my phone as horizontally than the screen is not appearing properly because the size of horizontal screen is less as compare to vertical so on keeping it on landscape mode the bottom part is not showing ,so how to fix all these problems?? </p> <p>Please tell me that i want that on keeping it horizontal the screen will appear like as on vertical in the center of screen,please help me??</p>
android
[4]
2,102,809
2,102,810
how to add cursor type on a table row using javascript?
<pre><code> var tbl = document.getElementById(TABLE_NAME); var nextRow = tbl.tBodies[0].rows.length; row.setAttribute('style', "cursor: pointer;"); </code></pre> <p>This will add double click event on table row.right..!!!But i m facing problem in internet explorer.working perfect in all other browsers. For adding style i am handling this:</p> <pre><code>var cell2 = row.insertCell(1); var browser=navigator.appName; if(browser == "Microsoft Internet Explorer") { cell2.style.setAttribute("cssText", "color:black; width:300px;"); } else { cell2.setAttribute("style", "color:black; width:300px;"); } </code></pre> <p>how to add double click event which will work on internet explorer too...</p>
javascript
[3]
5,219,059
5,219,060
What is "error C2061: syntax error : identifier "?
<p>When I start compile it has an error call "error C2061: syntax error : identifier 'Player' "</p> <p>I can't figure out what is wrong with my code. Here is my code</p> <blockquote> <pre><code>#include "Platform.h" #include "Player.h" class Collision { public: Collision(void); ~Collision(void); static bool IsCollision(Player &amp;player, Platform&amp; platform); }; </code></pre> </blockquote> <p>It has an error in "IsCollision" method.</p> <p>Player.h</p> <pre><code>#include &lt;SFML/Graphics.hpp&gt; #include "rapidxml.hpp" #include &lt;fstream&gt; #include &lt;iostream&gt; #include "Collision.h" using namespace rapidxml; class Player { private: sf::Texture playerTexture; sf::Sprite playerSprite; sf::Vector2u position; sf::Vector2u source; sf::Vector2u size; int frameCounter, switchFrame, frameSpeed; int walkSpriteWidth; float velocity; bool isWalk; bool isStand; bool isFaceRight; public: Player(void); ~Player(void); void Init(); void Draw(sf::RenderWindow *window); void MoveForward(); void MoveBackward(); void Update(sf::Clock *clock); void SetSourceY(int value); void SetWalk(bool value); void SetFacing(std::string value); void SetStand(bool value); void Stand(); std::string GetStatus(); void PrintStatus(); sf::Vector2f GetPosition(); int GetWidth(); int GetHeight(); }; </code></pre>
c++
[6]
500,976
500,977
Is it possible to use variables as dom elements?
<p>I have a several input fields in a form each having a unique name. For example, to change the color I would do:</p> <pre><code>testForm.username.style.background = "yellow"; </code></pre> <p><code>username</code> being the name of the input and <code>testform</code> being the form name</p> <p>I want to do this: replace <code>username</code> with a variable <code>elem</code> so that when I call the function to change the background color I don't need to have a separate function for every unique field. I would just send the <code>elem</code> name and that function would work for every field. </p> <pre><code>testForm.elem.style.background = "yellow"; </code></pre> <p>My problem is it doesn't work. For example it passed the <code>elem</code> into the function fine, but it says that <code>testForm.elem.style</code> is <code>null</code>. For some reason javascript doesn't like variables for element names I'm guessing?</p>
javascript
[3]
135,390
135,391
Javascript Image shrinking for specific users
<p>I have a javascript function for shrinking images but I dont want the shrinking function to work if an administrator logs in.</p> <p>Here is part of the code</p> <pre><code> function shrinkImages(){ var i=0, maxWidth; //if (/^(?:artistnews|albums|news|exitnews|reviews)$/.test(arg(0))) maxWidth=236; if(typeof homepage != 'undefined') maxWidth=530; else maxWidth=236; var first = getElementsByClassName('first'); if(first.length&gt;1) first = first[0].getElementsByTagName('img'); var imgs = document.getElementsByTagName('img'); while(imgs[i]) { if(imgs[i].width &gt; maxWidth &amp;&amp; imgs[i].name!="shadow") { if (has(imgs[i], first) &amp;&amp; maxWidth==236) { imgs[i].height = Math.round(521 * imgs[i].height / imgs[i].width); imgs[i].width = 521; i++; continue; } imgs[i].height = Math.round(maxWidth * imgs[i].height / imgs[i].width); imgs[i].width = maxWidth; } i++; } imgs = null; </code></pre>
javascript
[3]
181,630
181,631
Default constructor not getting called
<p>Why default constructor(same class) is not getting called while calling the default constructor but the default constructor of parent class is getting called - Why?</p> <pre><code>class A{ A(){ System.out.println("A()"); } } class B extends A{ B(){ System.out.println("B()"); } } class C extends B{ C(){ System.out.println("C()"); } C(int i){ System.out.println("&lt;------&gt;"+i); } } public class sample { public static void main(String[] args) { C c = new C(8); } } </code></pre> <p>Output:</p> <pre><code>A() B() &lt;------&gt;8 </code></pre>
java
[1]
5,858,377
5,858,378
thorowing error on else if
<p>I have given 2 option(upload icon/select icon) in form, but when i am checking it with php its throwing error...</p> <p><strong>html</strong></p> <pre><code>&lt;label class="tagslabel"&gt;Upload Icon&lt;/label&gt; &lt;input name="uploadicon" type="file" /&gt; &lt;span&gt;or&lt;/span&gt; &lt;ul class="icons clearfix"&gt; &lt;li&gt; &lt;input type="radio" value="123456" name="selecticon"/&gt; &lt;label for="selecticon"&gt; &lt;img src="pics/123456.jpg" alt="123456" width="34" height="34" /&gt; &lt;/label&gt; &lt;/li&gt; &lt;li&gt; &lt;input type="radio" value="654321" name="selecticon" /&gt; &lt;label for="selecticon"&gt; &lt;img src="pics/654321.jpg" alt="654321" width="34" height="34" /&gt; &lt;/label&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p><strong>php</strong></p> <pre><code>if (!empty($_FILES['uploadicon']['name'])) { //do image processing and validation } else { if($_POST['selecticon'] == '') $errors['selecticon'] = 'Please Select An Icon or upload Icon!'; } </code></pre> <p>but its throwing following error, if i upload image instead of selecting one.</p> <pre><code>Notice: Undefined index: selecticon </code></pre>
php
[2]
5,296,613
5,296,614
assigning value to a select box
<p>Hello i have a variable in jquery with the string "tuesday" in it, i also have a selectbox with all the days of the week in it, how can i assign my variable so that the selectbox automaticly selects my variable?</p>
jquery
[5]
4,971,718
4,971,719
Variables, different contexts in a single page
<p>Hi I'm tring to use same variable in two different contexts in a single page.</p> <pre><code>some html &lt;?php $variable1="sample" ?&gt; some html &lt;?php $variable2=variable1 ?&gt; some html </code></pre> <p>I know creating session is a solution. But I'm not sure if its suitable to create a session for this.</p>
php
[2]
2,384,332
2,384,333
How to find UILabel's number of Lines
<p>I displayed the text in UILabel by using wrap method. Now I want to need to find the how many number of line is there in UILabel.</p> <p>If there is any possible way to find the UILabel's number of lines count.</p> <p>Thanks.</p>
iphone
[8]
2,153,452
2,153,453
Combining frame and tween animations
<p>I'm new to the android development, and working my way through android tutorials available on Android website more specifically relating to animation. Now I know how to apply tween and frame by frame animations, but I can't figure out how to combine these two animations to run simultaneously example of which could be an animating character(frame by frame) walk across the screen(translate).</p> <p>I tried putting the both the animation-list for frame by frame animation and translate animation under the Set tag of my animation.xml, file and running using the following code.</p> <pre><code>ImageView iv = (ImageView) findViewById(R.id.imageView1); iv.setBackgroundResource(R.anim.animation); //where animation is the name of my animation xml AnimationDrawable anim = (AnimationDrawable) iv.getBackground(); anim.start(); </code></pre> <p>But it throughs an exception at setBackgroudResource.</p>
android
[4]
896,082
896,083
Empty ArrayList equals null
<p>Is an empty Arraylist (with nulls as its items) be considered as null? So, essentially would the below statement be true: </p> <pre><code>if (arrayList != null) </code></pre> <p>thanks</p>
java
[1]
4,715,154
4,715,155
ios self signed certificates
<p>Is there a way to create a self signed certificate from your own ios application?</p>
iphone
[8]
88,574
88,575
jQuery Insert/Delete a grid
<p>If the user clicks on "Add", I need to temporarily disable all the add/delete listeners until myid loses the focus.</p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;script src="http://www.google.com/jsapi"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function OnLoad() { var myCounter = 0; $('.insert').live('click', function() { var currentRow = $(this).parents("tr:first"); var newRow = currentRow.clone(true); newRow.children('td:last').empty().append('&lt;input name="myid"&gt;'); currentRow.after(newRow); document.myForm.myid.focus(); }); $('.delete').live('click', function() { if(confirm("Are you sure?")){ $(this).parents("tr").remove(); } }); } google.load("jquery", "1"); google.setOnLoadCallback(OnLoad); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name="myForm"&gt; &lt;table border="1"&gt; &lt;tr&gt; &lt;td class="insert"&gt;Add&lt;/td&gt; &lt;td class="delete"&gt;Erase&lt;/td&gt; &lt;td&gt;Sample data goes here&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>In other words, I don't want them to click "Add" and then "Add" again.</p>
jquery
[5]
3,853,810
3,853,811
ASP.NET error page does not work remotly
<p>I have problem with ASP.NET error page within my ASP.NET MVC application. When I browser to my application and exception happen then I just get this:</p> <blockquote> <p>Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.</p> <p>Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".</p> </blockquote> <p>But I have in my Web.config so seems that this is not a solution, so what's the correct solution to have entire stack trace displayed on the page? I don't really want to implement at this point my own error page.</p>
asp.net
[9]
3,093,360
3,093,361
A connection attempt failed because the connected party did not properly respond after a period of time....Exception in .net remoting
<p>We have an .Net remoting application using an remoting object we are trying to connect to an windowsa services however I am getting an exception as "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"</p> <p>Can someone please help me with this stuff.</p> <p>Thanks.</p>
c#
[0]
1,576,389
1,576,390
how to get last inserted date in php MYSQL
<p>I have two tables, and I want to get the last enterd date.</p> <p>The first table is <code>seeker</code>:</p> <pre><code>seeker_nic-----username 111-------------ali 222-------------umer 333-------------raza </code></pre> <p>The second one is <code>requestblood</code>:</p> <pre><code>id-------seeker_nic-----requireddate 1------- 111 ----------2012/10/9 2 ------- 222-----------2012/5/8 3 ------ 111-----------2012/12/12 4 ------- 111-----------2012/11/12 5---------111-----------2012/09/09 6 ------- 222-----------2012/7/9 7 ------- 333 ----------2012/4/4 </code></pre> <p>Now, I want to list the users one time with their last inserted date like..</p> <pre><code>s.no---- username----- requireddate 1------- ali---------- 2012/09/09 2------- umer--------- 2012/7/9 3------- raza--------- 2012/4/4 </code></pre> <p>I am using this query, but it shows maximum date not the latest one.</p> <pre><code>SELECT seeker.username, MAX(bloodrequest.requireddate) AS requireddate, COUNT(bloodrequest.requireddate) AS total FROM seeker JOIN bloodrequest ON seeker.seeker_nic = bloodrequest.seeker_nic GROUP BY seeker.username </code></pre> <p>This shows the maximum date, and it shows total dates. For example, 111 has total "4", but I don't know how to show the last inserted date... I am new in PHP, please help me. :(</p> <p>Thanks in advance!</p>
php
[2]
4,545,410
4,545,411
text box disappers
<p>I have some ids to be searched. I want to display two text boxes and where i give two values.As soon as i click find only one text box appears and another one disappears. Here is my code.</p> <pre><code>if(op.value == 2){ alert("value is 3"); document.getElementById('test_name').style.display=""; //valueOfop(op); }else{ document.getElementById('test_name').style.display="none"; } </code></pre> <p>only for a particular option i have to show two text boxes and hence i cannot remove the else part. Any suggestions to retain the value of the text box ?</p>
javascript
[3]
1,950,113
1,950,114
xmlrpclib connection gives timeout error even with setglobaltimeout(None)
<p>Most of what I've seen on here is people trying to add timeouts to their connections - I actually have the opposite problem. I'm calling socket.setglobaltimeout(None) and making a custom transport with no timeout:</p> <pre><code>class TimeoutTransport(xmlrpclib.Transport): timeout = None def set_timeout(self, timeout): self.timeout = timeout def make_connection(self, host): h = httplib.HTTPConnection(host, timeout=self.timeout) return h </code></pre> <p>(I'm not actually sure this is right, I saw conflicting things online)</p> <p>Despite this, I'm still seeing timeout errors on long xmlrpc calls (it's doing a recursive search through hosts). Am I missing something? There's probably a more elegant solution than leaving xmlrpc calls hanging, but I'm running short on time, and can't do a major rework.</p> <p>Thanks!</p>
python
[7]
5,881,453
5,881,454
TouchListView : OnClickListener
<p>Whenever I am setting OnClickListener for TouchListView then DropListener and DragListener are not working.<br> I downloaded the demo of the CWAC: TouchListView.<br> So how should I implement the OnClickListener for the TouchListView.<br> Please Help.<br> Thanks. </p>
android
[4]
605,262
605,263
How to compare 2 lists of objects and remove the items that are not common?
<p>I've got 2 generic lists that do not contain the all fields of the same type</p> <pre><code>IList&lt;Category&gt; and List&lt;CategoriesRow&gt;Categories categoryList = IList&lt;Category&gt; </code></pre> <p>but both have common fields Name and ID.</p> <p>I want to compare list Categories with categoryList and find those from categoryList where categoryList[index].ID does not exist in the list of all Categories of ID. For all those that do not exist in Categories, I will have to remove them from CatgoryList.</p> <p>I had a previous post in which I was given examples of LINQ, but the problem is I have to use Dynamic, implying that I am passing categoryList and Categories as Dynamic.</p> <p>Can anyone give me an example how to go about the above as I have no idea how to do it.</p>
c#
[0]
5,320,886
5,320,887
Input text behaves stranges with edittext android
<p>for some reason android doens't put the text input above the 'keyboard'. Becaus of this you can't see what your typing. i have tried various things but without result does anyway have clue?</p> <p>this is the code:</p> <pre><code>&lt;EditText android:id="@+id/comment" android:layout_width="fill_parent" android:layout_height="wrap_content"/&gt; </code></pre> <p>i hope someone can help me thanks in advanced Happylifes</p>
android
[4]
5,820,791
5,820,792
How to save RatingBar Rating?
<p>I would like to save the rating bar rating for the user. I was wondering is it possible i could save the value inside of the SQL database or is there a better way?</p>
android
[4]
1,376,661
1,376,662
I have multiple list objects in one list, how can i get the items that exist in every child list?
<p>Starting with a basic class:</p> <pre><code>public class Car { public string Name {get;set;} } </code></pre> <p>I can then create a list of these cars</p> <pre><code>List&lt;Car&gt; cars = new List&lt;Car&gt;(); </code></pre> <p>The new step is to have a List of this List, like this:</p> <pre><code>List&lt;List&lt;Car&gt;&gt; allListsOfCars = new List&lt;List&lt;Car&gt;&gt;(); </code></pre> <p>After populating allListsOfCars, I want to pass it to a function which will return me the cars which exist in every List list. </p> <p>I know it sounds confusing, so I'll try explain a bit more. </p> <p>If I have ListA, ListB, ListC all of type List - and now combine these into 1 holding list(The list of a list), then how can I get back all the cars that exist in every list? For example if a car only exists in ListA, then I'm not interested, it needs to exist in ListA AND ListB AND ListC, then I want it added to the result set and returned. </p> <p>Thanks in advance.</p>
c#
[0]
2,295,555
2,295,556
Get City, State, Country from Latitude and Longitude
<p>how can i Get City, State, Country from Latitude and Longitude using javascript. </p>
javascript
[3]
5,819,767
5,819,768
Javascript Form Validation
<p>I have a form in an asp page that has the following code to verify it when it is posted.</p> <pre><code>&lt;% sSubmitAction = "" sSubmitAction = sSubmitAction &amp; "if (this.CheckValue.value != this.OrderTotal.value){confirm('The values do not match.'); this.CheckValue.focus(); return(false);}" sSubmitAction = sSubmitAction &amp; "if (this.Authorisation.value.length &lt; 1){alert('You must enter the authorisation number to proceed.'); this.Authorisation.focus(); return(false);}" %&gt; </code></pre> <p>I want to replace that code with a javascript function that is called when the form is posted.</p> <p>The Authorisation is a required field and I want the user to have the option to continue or cancel after they have been alerted that the CheckValue and OrderTotal fields do not match.</p>
javascript
[3]
4,189,334
4,189,335
Calendar Conversion between Different TimeZones in Java
<p>I want to convert the calendar object between two time zones in java.I shall the pass the first calendar object and want the output to be the modified calendar object with the different timezone.</p> <p>Can someone provide me a way on how to do it ?</p> <p>This is what i have done ...</p> <pre><code>DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); GregorianCalendar pst = new GregorianCalendar(); GregorianCalendar est = new GregorianCalendar(); pst.setTime(maintWindow); int year = pst.get(Calendar.YEAR); int month = pst.get(Calendar.MONTH); int day = pst.get(Calendar.DAY_OF_MONTH); format.setTimeZone(timeZone); pst.set(year, month, day, hour, min); Date date = pst.getTime(); logger.info(date); logger.info(format.format(date)); logger.info(pst.getTime()); est.setTimeInMillis(date.getTime()); logger.info(est.getTime()); </code></pre>
java
[1]
608,752
608,753
Json encode data looping in js
<p>I have data that php returned to JS but i dunno how to loop it to access the information... i have this:</p> <pre><code> result = call_data('get_chat.php'); console.log(result); for(var data in result){ alert(result[data]["id"]); //says undefined } </code></pre> <p>Console Log shows:</p> <pre><code> [{"eventtime":"0000-00-00 00:00:00","message":"test2","bywho":"dave","id":"2"}, {"eventtime":"0000-00-00 00:00:00","message":"testttt","bywho":"dave","id":"1"}] </code></pre> <p>So i want to loop each data from it but how do i do it im really confused!! It just says undefined each time.</p>
javascript
[3]
263,002
263,003
Apache HttpComponents and Java NIO
<p>I read something about Java NIO, so i now know there is thing called selector, where i can register channels and let selector check for some events on those channels. One of event is OP_WRITE. If selector detect OP_WRITE key on some channel, it tell me that channel is ready for writing to it. </p> <p>I need to do one application, which will be used through HTTP protocol, so i am studying Apache HTTP Components library now. In this library is interface called HttpAsyncExchange and it is implemented by class Exchange. Instance of Exchange class have method called submitResponse and if this method is invoked, then underlying socketChannel will be marked as OP_WRITE. So instead of sending response directly to client after resolving request, the response is sended later when selector return me that underlying socketChannel because of event OP_WRITE on it. </p> <p>I dont understand where is benefit of "marking" socketChannel as OP_WRITE and sending response later, instead of sending response directly, can anyone explain me? Sorry for my bad english.</p>
java
[1]
1,258,921
1,258,922
Remove from string
<p>I have the following that I need removed from string in loop. </p> <pre><code>&lt;comment&gt;Some comment here&lt;/comment&gt; </code></pre> <p>The result is from a database so the the content inside the comment tag is different.<br> Thanks for the help.</p> <p>Figured it out. The following seems to do the trick. </p> <p><code>echo preg_replace('~\&lt;comment&gt;.*?\&lt;/comment&gt;~', '', $blog-&gt;comment);</code></p>
php
[2]
1,529,209
1,529,210
Is it possible to clear MPMediaItemCollection using codes?
<p>I store all audios to a MPMediaItemCollection. Later, I hope to clear all items in the MpMediaItemCollection. Is it possible to clear MPMediaItemCollection using codes?</p> <p>Thanks interdev</p>
iphone
[8]
3,226,330
3,226,331
What is the use readObjectNoData in Serialization in java? Please explain with an example?
<p>What is the use <code>readObjectNoData</code> in Serialization in java? Please explain with an example? The java docs are not clear.</p>
java
[1]
1,479,637
1,479,638
Python - how to handle outcome variables that are conditional set correctly
<p>Consider the following:</p> <pre><code> def funcA(): some process = dynamicVar if dynamicVar == 1: return dynamicVar else: print "no dynamicVar" def main(): outcome = funcA() </code></pre> <p>If the 'some process' part results in a 1, the var dynamicVar is passed back as <code>outcome</code> to the main func. If dynamicVar is anything but 1, the routine fails as no arguments are being return. </p> <p>I could wrap the outcome as a list:</p> <pre><code> def funcA(): outcomeList = [] some process = dynamicVar if dynamicVar == 1: outcomeList.append(dynamicVar) return outcomeList else: print "no dynamicVar" return outcomeList def main(): outcome = funcA() if outcome != []: do something using dynamicVar else: do something else! </code></pre> <p>or maybe as a dictionary item. Each of the 2 solutions I can think of involve another set of processing in the main / requesting func. </p> <p>Is this the 'correct' way to handle this eventuality? or is there a better way? </p> <p>What is the proper way of dealing with this. I was particularly thinking about trying to catch <code>try:</code> / <code>except:</code> errors, so in that example the uses are reversed, so something along the lines of:</p> <pre><code> def funcA(): some process = dynamicVar if dynamicVar == 1: return else: outcome = "no dynamicVar" return outcome def main(): try: funcA() except: outcome = funcA.dynamicVar </code></pre>
python
[7]
1,667,277
1,667,278
Python passed values from a list not adding correctly
<p>In my Code below I am having issues with 2 things. For one The math in the function on lines 40 (examPoints) and 47 (hwkPoints) is being passed a range of values in a list on line 94. It should be taking the scores and adding them up but for some reason it isn't adding the last number on each range passed. </p> <p>ex: for myValues[11:13] it is being passed the numbers 75, 95, and 97 but it only adds the first 2 and not the last.</p> <p><a href="https://gist.github.com/ejaudon/5410370" rel="nofollow">Here is a link to my code</a></p> <p>Edit: Sorry for the link I was having problems getting the code to look right on here.</p>
python
[7]
2,214,843
2,214,844
Android: TabLayout not working
<p>I was trying the TabLayout Tutorial from official developers site. I didnt copy paste it as such and some minor changes and corrections to typos in the tut.</p> <pre><code>package com.org.example; import android.app.TabActivity; import android.content.Intent; import android.content.res.Resources; import android.os.Bundle; import android.widget.TabHost; public class HalloTabLayout extends TabActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Intent intent; TabHost tabhost = getTabHost(); TabHost.TabSpec tabspec; Resources res = getResources(); //For the Family Tab //Intent intent = new Intent().setClass(this, FamilyLayout.class); //Setting the tab tabspec = tabhost.newTabSpec("family").setIndicator("Family", res.getDrawable(R.drawable.tab_spec)).setContent(intent); tabhost.addTab(tabspec); //Default tab to display tabhost.setCurrentTabByTag("family"); } </code></pre> <p>}</p> <p>As a first step and make sure the code is right, I wanted to have a Single tab displayed.</p> <p>I added the FamilyLayout activity to AndroidManifest.xml file and also made changes suggested in here. <a href="http://stackoverflow.com/questions/2209406/issues-with-android-tabhost-example">http://stackoverflow.com/questions/2209406/issues-with-android-tabhost-example</a></p> <p>But the application keeps crashing on run time in the emulator. Any help would be much appreciated. </p> <p><strong>[Solution:]</strong> I used a .jpeg of high resolution and size(3.5mb) which was cause of trouble. I changed it into a lower resolution, size pic and it worked without troubles. I found out via trial and error that images beyond 1600*900 will make apps crash. Not an exact statistic, but it may help.</p>
android
[4]
5,853,220
5,853,221
Should I learn C# or PHP?
<p>I pretty much have been in I.T. for about 10 years. I started with a lot of telecommunications programming and some basic help desk skills. The last job I had before I was laid off in May of last year involved monitoring and testing web applications using HP Mercury tools like BAC, and Mercury Loadrunner. I used to test C++ based scripts making basic quick fixes to the scripts. I really didnt do any test case building or anything just monitoring and testing. I also worked with one of the developers on my team on an application he developed basically keeping it updating it or maybe recreating and relaunching it to people in the company if needed. Anyway I kind of got the programmer bug to go that route. Everything was all about the web there and web applications for customers to use. I have taken an online intro to C++ course and I'm wondering what should be the best language to learn next based on my background to build on what I already know. I live in the San Diego area and I see a lot of C# Java and PHP developer jobs. I'm really trying to decide between C# and PHP. A lot of people say PHP isnt a real progeramming language and all that but recruiters are always asking me about it and suggesting I learn it. On the other side of the coin is the job security thing. Anyway I know I'm a bit long winded here but just wanted to get some advice if I could. </p>
c#
[0]
382,001
382,002
Do apple native media player play Play-ready media files
<p>I have been researching on whether we can create an app which will play Play-ready protected DRM video files in apple's native media player. But what I could collect is that apple will not allow DRM protected video files to be streamed or played through media player. However if this the case, how there exists solutions which can decrypt the files and play them from within the app? Also as per my R&amp;D, the device should support play-ready file format. Hence now OEM's are launching phones like HTC, nokia with play-ready support. But how will we provide support on apple devices? Please, any inputs or thoughts on this will surely be helpful.</p>
iphone
[8]
5,827,265
5,827,266
Using ItemType for strongly typed repeater control?
<p>Okay, so I looked up some cool stuff about strongly typed repeater controls... the only issue is that it won't work. I have a <code>List&lt;Entry&gt;</code> that I've bound my repeater to. I just want to display the data. Normally I use <code>((Entry)(Container.DataItem))</code>, but from what I've read I can just declare the type in the ItemType. </p> <p>Well... that's what I tried to do, but I get nothing. What am I messing up here?</p> <pre><code>&lt;asp:Repeater ID="UserRptr" ItemType="HROpenEnrollment.Classes.Entry" runat="server"&gt; &lt;ItemTemplate&gt; &lt;ul class="UserList"&gt; &lt;li class="CompoundField"&gt; &lt;%# ???? I can't use Item here. %&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; </code></pre> <p>I would guess that it's not finding my entry class... how do I get that in there? It's in the same namespace, in a separate folder.</p>
asp.net
[9]
1,078,218
1,078,219
Can you access the web server logs from an ASP.NET web application?
<p>Is there a way to access referrer information from the server log in a ASP.NET web application?</p> <p>I would like to know if a customer comes to my web app from a specific site and change the app's behavior accordingly. I could have the webmaster of the other site include a query string, but to my knowledge this wouldn't work because as soon as Tom, Dick or Harry posted the link somewhere else, the query string would be unreliable. </p> <p>Is there a sure fire way for a web app to know where the user came from?</p>
asp.net
[9]
5,405,301
5,405,302
Using $this when not in object context ... stack issue?
<p>I'm getting the error <strong>Using $this when not in object context</strong> when using the code below. Is this because the function is on the stack and has no access to the object?</p> <pre><code>array_walk($pins, function (&amp;$array) { $array-&gt;timestamp = $this-&gt;convertTime(strtotime($array-&gt;timestamp)); }); </code></pre> <p>What's the best way to get around this? I was thinking of using a foreach, but wanted to learn more of PHP's lesser used functions that suit the purpose.</p> <p>Solved it with</p> <pre><code>foreach($pins as $pin) { $pin-&gt;timestamp = $this-&gt;convertTime(strtotime($pin-&gt;timestamp)); } </code></pre> <p>But I would still like to know how to get around the issue with array_walk.</p>
php
[2]
4,490,407
4,490,408
How to Place Button In center
<p>I am new to android , How to place a button in Center horizontally. I use left margin , but it doesnt work for all resolution types. I write following code</p> <pre><code> &lt;ImageButton android:id="@+id/setPasswordImgBTN" android:src="@drawable/password" android:layout_width="110dip" android:layout_height="110dip" android:layout_marginLeft="90dip" android:layout_marginTop="60dip"&gt; </code></pre>
android
[4]
5,535,280
5,535,281
How to create a splash screen with percentage progress bar?
<p>I want to show a splash screen for my application at start through a progress bar with <code>actual</code> load % of the application.</p> <p>I have following requirement/queries -</p> <ol> <li>Which component I should use to show progress bar</li> <li>How to calculate the % load if splash screen itself is a part of application</li> <li>On touch of splash screen I want to highlight the progress bar</li> </ol>
android
[4]
6,004,904
6,004,905
Need to pass two parameters to function
<p>Currently I am passing one value to a function:</p> <pre><code>function interfaceName(x,y,z){ var z = z[0]; return "&lt;div class='iconRow2 linkrow'&gt;&lt;a href=\"javascript:mcrloadgraphdata('"+x+"')\"&gt;"+x+"&lt;/a&gt;&lt;/div&gt;"; } </code></pre> <p>Now I need to pass the value z too, please tell me how to pass.</p>
javascript
[3]