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
429,642
429,643
How to echo all the folder names in a particular folder using php?
<p>I want to print the folder names in a particular folder. For example Folder 1,2,3 are in a folder named 'New' I want to print the folder names 1 2 3 using php. Is it possible ? is there any function in php to do that ? any kind of solutions or ideas are very much appreciated.</p>
php
[2]
5,374,113
5,374,114
How to place the vertical line inbetween on cell
<p>How to place the vertical line inbetween on cell</p>
iphone
[8]
2,223,583
2,223,584
NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:nil
<p>I have a 4465 characters String which contains Url links along with some junk.Here the problem is i am not able to separate all the URL links By using the following code from Junk :</p> <p>NSDataDetector *linkDetector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:nil]; NSArray *matches = [linkDetector matchesInString:string options:0 range:NSMakeRange(0, [string length])];</p> <p>I received final urlString with 83 characters,But it is not the full URL string.</p> <p>Actual Characters in URL String is 117. Please suggest me is there any alternative way than this to separate URLs from Junk.</p>
iphone
[8]
5,125,793
5,125,794
UItextView hide in UIScrollview on tap
<p>I have an UIScrollView (with 40+ pages) with UITextview added as subview on every page. What i want to do is that on single tap, i want to hide the UITextField on all pages? How should I do it? I am trying to do like this in hadle tap method:</p> <p><code>textview.hidden = YES;</code></p> <p>But it is hiding text view only on last page, not on all pages.</p> <p>Any help is appreciated</p>
iphone
[8]
4,982,458
4,982,459
Specify image url for canvas
<p>I have the following code:</p> <pre><code>canvas.drawBitmap (mBitmap, 0, 0,null); </code></pre> <p>how to I make <code>mBitmap</code> as PATH or an image from the SD card? so when I save the canvas, it will save the image from that URL?</p> <p>Thanks a lot for any help! :)</p>
android
[4]
5,426,496
5,426,497
PHP link/page refferer
<p>I don't know how to properly explain this so please bear with me:</p> <ol> <li>When a new clicks on create new post/thread/reply .etc, and they are taken to the create new xzy page, they then fill this out the form.</li> <li>When they fill this out, this are taken to a login/register form.</li> <li>After they have register/logged-in, they are taken back to the page whence they came (create new xyz or other). How would this be done in php? A link referrer of sorts.</li> </ol>
php
[2]
4,235,552
4,235,553
Which of these two snippets uses more memory?
<pre><code>string Name = ""; for(int i; i &lt; 10; i++) { Name = NameList[i] + "what?"; Console.WriteLine(Name); } //Or this one: for(int i; i &lt; 10; i++) { string Name = NameList[i] + "what?"; Console.WriteLine(Name); } </code></pre> <p>Which one would use less memory? Someone asked this in the comments of this question and I wasn't sure myself. Thanks!</p> <p><a href="http://stackoverflow.com/questions/3979493/scope-of-variables-in-c">http://stackoverflow.com/questions/3979493/scope-of-variables-in-c</a></p>
c#
[0]
353,628
353,629
how to make RequiredFieldValidator control two validate two control
<pre><code> Are you required applicant? &lt;asp:CheckBox ID="CheckBox1" runat="server" Text="Yes" /&gt; &lt;asp:CheckBox ID="CheckBox2" runat="server" Text="No" /&gt; </code></pre> <p>Actually this is code, i do not know why they use two Checkbox instead of Checkboxlist, but they told me do not change it. and make the two checkbox required(using RequiredFieldValidator). I know how to use RequiredFieldValidator, but how can i make RequiredFieldValidator control two Checkbox, only pass if one of them selected</p>
asp.net
[9]
1,686,678
1,686,679
Merge audio file with some other File in android?
<p>I am merging a song with another file this file can be an image or a text file.I referred to number of links to get some help: <a href="http://stackoverflow.com/questions/11375291/android-merge-two-audio-files-into-one-file">Merging audio files</a> <a href="http://stackoverflow.com/questions/11452464/merging-two-or-more-wav-files-in-android">Merging Audio files</a>. Using outputStream.write(Text_files.fileContent);<code>where</code>Text_files.fileContent` is the byte array of the file to append to audio file.I have written the byte data into the temp file and played the temporary created file.However when i play the file it just plays till the actual length of the audio file and does not play the bytes that has been written after it.I expect there should be some sound of the bytes may be some weird sound.I have 2 questions Do we need to specify the length of the audio file in the Header section of the song?If yes why dint the file get corrupt?Since i am able to play the File.</p>
android
[4]
3,003,916
3,003,917
parsing the date object in javascript
<pre><code>Date.parseWeird=Date.prototype.parseWeird=function(d) { return new Date(Date.parse(d)); }; var d = /Date(-65424600000)/ </code></pre> <p>How can i parse this date and show in MM/DD/YY format. </p> <pre><code>16/09/1956 </code></pre>
javascript
[3]
4,782,713
4,782,714
How to run an application before any other application in android?
<p>I want to write a program in that if somebody wants to open a application (like Contacts Application) , first my program starts and user enter a password and if password is correct , let contacts program to open.</p> <p>i know it s possible because <a href="https://market.android.com/details?id=com.cc.applock&amp;feature=search_result" rel="nofollow">App Lock</a> program does it.</p> <p>should i run a service?</p>
android
[4]
2,735,979
2,735,980
Generate form dynamically and submit it by jquery
<p>i was searching google just to have way out to generate &amp; submit form by jquery and i found code snippet but few things was not clear to me.</p> <pre><code>function submitValues(url, params) { var form = [ '&lt;form method="POST" action="', url, '"&gt;' ]; for(var key in params) form.push('&lt;input type="hidden" name="', key, '" value="', params[key], '"/&gt;'); form.push('&lt;/form&gt;'); jQuery(form.join('')).appendTo('body')[0].submit(); } </code></pre> <p>why [] this third bracket is used like </p> <pre><code>var form = [ '&lt;form method="POST" action="', url, '"&gt;' ]; </code></pre> <p>what is the meaning of the line <strong>jQuery(form.join('')).appendTo('body')[0].submit();</strong> why <strong>form.join('')</strong> has been used and why write like <strong>appendTo('body')[0]</strong> why <strong>[0]</strong></p> <p>please guide me in detail for those above bold syntax. thanks</p>
jquery
[5]
4,320,375
4,320,376
C# way to set a float buffer in memory
<p>I am an usual Java developer but now I'm trying to create some OpenGL stuff in C#.</p> <p>However, in Java I do it like this:</p> <pre><code>private FloatBuffer verticesBuffer; private float[] vertices = new float[]{... some vertices ...}; ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length * 4); vbb.order(ByteOrder.nativeOrder()); verticesBuffer = vbb.asFloatBuffer(); verticesBuffer.put(vertices); verticesBuffer.position(0); </code></pre> <p>How should I become same thing in C#?</p>
c#
[0]
3,540,764
3,540,765
ASP.net: Why disable AutoEventWireup improve ASP.net perfomance?
<p>I was reading this <a href="http://wiki.asp.net/page.aspx/667/improve-perfomance-in-aspnet/" rel="nofollow">wiki entry</a></p> <p>On point 10, it stated to disable AutoEventWireup for perfomance improvement but didn't give any reason. Isn't AutoEvenWireup is delegating? How does it improve the ASP.net performance by disable/false? </p> <p>Does anyone know why?</p>
asp.net
[9]
1,651,797
1,651,798
android listview Keep scrolled position and selected highlited position
<p>i have listview in one activity when user scroll and click the listview ,go to next activity,my problem is when user hit back button ,user needs to see the listview in same style,ie it should selected and maintain scroll position . it possible to maintain scrolled position ,but when am trying to select an item through java ,then the item scrolled to top , how can i maintain scrolled position and selection ? . Please help me</p> <p>//// i need to maintain scrolled position and selected position </p>
android
[4]
886,120
886,121
compare two Lists of objects and return a list which has common objects in two
<p>I have two lists -</p> <pre><code>ArrayList&lt;MyObject&gt; list1 -&gt; [obj1, obj2, obj3, obj4, obj5, obj6] ArrayList&lt;MyObject&gt; list2 -&gt; [obj1, obj6, obj7, obj8] </code></pre> <p>Is there any utility method already existing in java api which can give a list of only common records of two?</p> <p>expected list -> <code>[obj1, obj6]</code></p> <p>MyObject looks like this -</p> <pre><code>class MyObject { public Integer number; public String name; public Integer parent; public String parentName; } </code></pre> <p>I only need to use <code>number</code> and <code>name</code> to do the comparison.</p> <hr> <p>i am aware of approach using <code>retainAll</code> or <code>removeAll</code> to get the desired list. The problem however is, <strong>I cannot override <code>equals</code> method of <code>MyObject</code> as it is used for some different purpose</strong>. And the <code>retainAll</code> or <code>removeAll</code> method doesn't seems to accept <code>Comparator</code> object.</p> <p>I know another solution is to iterate through the lists and find the common ones. I am looking if there is already some method which do it.</p> <p>Thanks.</p>
java
[1]
1,624,585
1,624,586
How can I embed a website in my app
<p>I am currently creating an app, only now I have got to a point where I would like to be able to embed a website into the actual app itself. The thing is I would like to be able to view the website without leaving the app, so it is embedded into the app somehow. I am realising that this might not be as easy as it sounds as it almost needs a browser, though I don't really need to do any browsing as such, I only need to load the site and then display it. Is this even possible (isn't anything possible?)</p> <p>Thanks!</p>
android
[4]
534,408
534,409
Reversing a string without creating extra memory
<p>I have a string which is of about 1mb size. The requirement is to reverse the string without allocating another temp string of size 1 MB. I tried the following code</p> <pre><code>string name = "abcde"; string target = ""; for(int i = name.Length - 1; i &gt;=0; i--) { target += name[i]; name = name.Remove(i); int n = name.Length; } </code></pre> <p>but my friend says if we use the function <code>name.Remove(i)</code> it will return a new string but it is not guaranteed that the old string will be deleted from memory and so there is no guarantee that the size will be reduced. is it true? if so is there any other option available to reverse a string without allocating extra memory?</p>
c#
[0]
3,533,012
3,533,013
How to apply a variable filter to this model?
<p><strong>I have this view how do I only iterate this unit model when the $wprice is > 1</strong></p> <pre><code>&lt;?php $model-&gt;getFeaturedVehicles(10, 0, unserialize($vtype), unserialize($makes), $p1range, $p2range, $filters) ?&gt; &lt;div id="adspecials"&gt;&lt;?php while ($unit = $model-&gt;iterate()): ?&gt; &lt;div class="adwrapper"&gt; &lt;div class="ad"&gt; &lt;h1 class="cufon"&gt;&lt;?php echo $unit-&gt;wprice,'&lt;/h1&gt;&lt;h4&gt;Preferred Club Pricing&lt;/h4&gt;' ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;&lt;?php endwhile; ?&gt; &lt;/div&gt; </code></pre>
php
[2]
2,707,492
2,707,493
How to search for text in iframe and get its element?
<p>How to search for some text in iframe and upon match get its element or append css class to it.</p> <p>i have tried with :</p> <pre><code>$('#my_iframe').contents().find().text('my text'); </code></pre> <p>but it is not working also i have read some articles with <strong>:contains</strong> but am not sure how to make it working for iframe.</p> ######### Edited <p>Even tried this but it gives me "Undefined"</p> <pre><code>alert($('#my_iframe:contains("'+data+'")').first().tagName); </code></pre> <p><strong>Note :</strong> <em>Do not tell me how to use find method of Jquery, just answer my question of how to search for specific text and get its element.</em></p>
jquery
[5]
5,247,871
5,247,872
Mass mailing queue (possibly with PHP interprocess communication)
<p>I am building a website where users will be able to send newsletters. They will need to track the sending process and also to stop it if required. Since they may have lots of emails the actual sending will be delegated to a script which will run in the background and will be executed by the user. This script will handle all users' newsletters, only the arguments to it will be different.</p> <p>For the user to be able to see how many mails have been sent and to stop the sending process I was thinking of implementing some sort of interprocess communication between the website and the scripts running in the background but I'm not sure how to do it.</p> <p>Any help will be much appreciated.</p>
php
[2]
5,706,535
5,706,536
How to insert an item at the beginning of an ObservableCollection?
<p>How can I do that? I need a list (of type <code>ObservableCollection</code>) where the latest item is first.</p>
c#
[0]
3,780,078
3,780,079
Why is document.body null in my javascript?
<p>Here is my brief HTML document. Why is Chrome Console noting this error: "Uncaught TypeError: Cannot call method 'appendChild' of null"?</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Javascript Tests&lt;/title&gt; &lt;script type="text/javascript"&gt; var mySpan = document.createElement("span"); mySpan.innerHTML = "This is my span!"; mySpan.style.color = "red"; document.body.appendChild(mySpan); alert("Why does the span change after this alert? Not before?"); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript
[3]
2,106,342
2,106,343
Adding Intent putextra method taking time
<p>I am adding some large serializable object (say data) to the Intent's putextra() method:</p> <pre><code>Intent intent = new Intent(currentScreen, newScreen.getClass()); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Bundle bundle = new Bundle(); intent.putExtra("DATA", data); intent.putExtras(bundle); currentScreen.startActivity(intent); </code></pre> <p>newScreen taking much time to start and display.</p> <p>Please let me know how to overcome the issue.</p> <p>Thanks Android_IT</p>
android
[4]
2,373,738
2,373,739
Android AudioTrack cannot be INITIALIZED
<p>I have a problem with initializing android AudioTrack. I have Nexus One with android 2.3.3.</p> <p>Here is my code:</p> <p>int _rate = AudioTrack.getNativeOutputSampleRate(AudioManager.STREAM_SYSTEM);</p> <p>int buffersize = AudioRecord.getMinBufferSize(_rate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT);</p> <p>AudioTrack atrack = new AudioTrack(AudioManager.STREAM_VOICE_CALL, _rate, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, buffersize, AudioTrack.MODE_STREAM);</p> <p>if (atrack.getState() == AudioTrack.STATE_UNINITIALIZED) ...</p> <p>So the state of the atrack is always AudioTrack.STATE_UNINITIALIZED</p> <p>The application manifest is </p> <p> </p> <pre><code>&lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt; &lt;activity android:name="BigLeftEarActivity" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"&gt;&lt;/uses-permission&gt; &lt;uses-permission android:name="android.permission.BLUETOOTH"&gt;&lt;/uses-permission&gt; &lt;uses-permission android:name="android.permission.RECORD_AUDIO"&gt;&lt;/uses-permission&gt; &lt;uses-sdk android:minSdkVersion="10" /&gt; </code></pre> <p></p> <p>Could you help me? What could be wrong?</p> <p>Thanks!</p>
android
[4]
4,551,183
4,551,184
Average with small types
<p>I want to write a generic averaging algorithm. That is, for any type T that has an operator+ (T) and an operator/(float), I would like to find the average of T's in a container:</p> <p>Something like this works fine for float-ish types:</p> <pre><code>template&lt;typename T&gt; typename T::value_type RunningAverage(const T&amp; v) { typename T::value_type vectorRunningAverage = 0; for(unsigned int i = 0; i &lt; v.size(); ++i) { vectorRunningAverage = (v[i] + i*vectorRunningAverage)/(i+1); } return vectorRunningAverage; } </code></pre> <p>I could change</p> <pre><code> typename T::value_type vectorRunningAverage = 0; </code></pre> <p>to</p> <pre><code>float vectorRunningAverage = 0; </code></pre> <p>and then it would work with a type like unsigned char (can't add more than a few unsigned chars and store the result in an unsigned char without overflow) because it can be implicitly converted to float. However, if I have some more complicated types (say I want to average the components in a <code>std::vector&lt;std::vector&lt;unsigned char&gt; &gt;</code>, this doesn't work. Is there something I'm missing? Or does it just not make sense to do this?</p>
c++
[6]
3,695,119
3,695,120
How to add a class in document.write() method in javascript
<p>I am adding a class in document.write but it is not showing, below is my code. </p> <pre><code>new_window = open("","hoverwindow","width=600,height=300,left=10,top=10"); new_window.document.open(); new_window.document.write("&lt;li&gt;Dowload &lt;a href=www.anylink.com class='help'&gt;&lt;/a&gt;&lt;/li&gt;"); </code></pre> <p>"help" is defined in my css file. Is the above syntax is correct for applying the class.</p>
javascript
[3]
5,018,647
5,018,648
Determine referenced dll file version in C#
<p>I have a C# solution, which references a dll I created from a different C# solution.</p> <p>It is easy enough to determine my solution's product version with Application.ProductVersion. However, what I really need is a way to determine the file version of the exe and the dll separately, within my program. I want to display the dll and exe's file versions in my About dialog. What would the code look like to do this?</p>
c#
[0]
1,433,319
1,433,320
Show up value of select option in IE
<p>I have a problem with a html select object and its options in IE.</p> <p>My html</p> <pre><code>&lt;select id="Select1" onchange="closeMenu1(this.value)"&gt; &lt;option&gt;&lt;/option&gt; &lt;option&gt;1&lt;/option&gt; &lt;option&gt;2&lt;/option&gt; </code></pre> <p>And the javascript</p> <pre><code> function closeMenu1 (x) { var show = document.getElementById("divID"); show.innerHTML = x; } </code></pre> <p>Now, in every browser except the IEs the divID will show up the value which I selected in the select object. But IE doesn’t. Can somebody please tell me a way around that?</p> <p>Thanks.</p>
javascript
[3]
2,581,474
2,581,475
want to show icon for settings on UIToolbar
<p>Want to show icon for settings UIBarButtonItem on UIToolbar than text button </p> <pre><code>UIBarButtonItem *settingsButton = [[UIBarButtonItem alloc] initWithTitle:@"Settings" style:UIBarButtonItemStyleBordered target:self action:@selector(settingsButtonTapped)]; </code></pre> <p>Anyone know how to show icon for settings UIBarButtonItem?</p> <p>Will appreciate any help.</p> <p>Thanks so much in advance.</p>
iphone
[8]
3,263,203
3,263,204
Easyphp Web Setup
<p>I've tried to setup an EasyPHP in local and make it visible from the Web via DynDNS, which I've already successed many times before, but now this just doesn't work, maybe I've forgotten something...</p> <p>*The "server" is a common workstation.</p> <p>Here is what I have done :</p> <p>1) Installed EasyPhp (with a index.php/html file in WWW folder) 2) Changed the port in the config to port 80 3) Forwarded port 80 to the server IP in my router configuration 4) Added the server to the router DMZ</p> <p>*Also tried removing antivirus/firewall</p> <p>I've installed PortListener, pointed it on port 80, and when I access "myname.dyndns.com" it says</p> <blockquote> <p>Client connected GET / HTTP/1.1 Host: xyz.dyndns-remote.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 (.NET CLR 3.5.30729) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,<em>/</em>;q=0.8 Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive</p> </blockquote> <p>So the server is accessible via Web, receive the connection successfully, but in my browser it says that the connection failed and show nothing...</p>
php
[2]
3,863,075
3,863,076
Java Text file parsing error
<p>If the file has a blank line as the last line of the file, it blows out after the while statement. Can someone help?</p> <pre><code>while(in.hasNext()) { tempPropID = in.nextInt(); tempPropType = in.next().toUpperCase(); tempPropCost = in.nextDouble(); tempAgentID = in.nextByte(WIDTH); } </code></pre>
java
[1]
1,853,762
1,853,763
Good Free PHP debugger?
<p>what is the best PHP debugger that is for free.</p>
php
[2]
4,794,345
4,794,346
Select All/None Checkboxes but not affect Raido Buttons?
<p>Rails 2.3.5, just using Prototype in this project so far.</p> <p>I have a form with Check Boxes and Radio buttons. I've been trying several scripts trying to find a way to provide a "Select All" / "Select None" functionality for the checkboxes where the Radio Buttons are not affected. Even scripts where you specifically include the id of the checkboxes will still cause the Radio Buttons to toggle.</p> <p>Like the top answer (Prototype based) from this question: <a href="http://stackoverflow.com/questions/888173/select-all-checkboxes">Select all checkboxes</a></p> <p>Even though the function takes the id of the checkboxes, It will affect the radio buttons in the form (the last radio button will end up being selected).</p> <p>A couple of scripts I tried went by the name of the checkboxes, but the name of them in my case is <strong>name="selected_contacts[]"</strong> for an array, and I couldn't figure out how to get Javascript to accecpt a name with brackets in the function.</p> <p>I haven't had any luck w/ Google so far. Is it possible to toggle checkboxes w/o affecting radio buttons in the same form?</p> <p>Thank You!</p>
jquery
[5]
2,459,090
2,459,091
ReflectionClass of static in PHP?
<p>I'm aware that I cannot have <code>new ReflectionClass(static)</code> in PHP (5.3) as I just tried it. Is there any other way to get around this restriction?</p> <p>Passing in a string is not an option, although somehow getting the string of the class name is acceptable. However, idk if it'd work as I'm working with namespaces as well.</p> <p>Thanks </p>
php
[2]
322,864
322,865
Pointing to wrong UI from posted Runnable after screen orintation changes
<p>This is my little test program. My problem is that from <strong>run()</strong> method I access to fields of wrong (old) Activity, which was destroyed after screen orientation changed. What's the way to handle this situation? And, by the way, I must have my activity been recreated, because in real application I have different layouts for portrait and landscape modes!</p> <pre><code>public class MainActivity extends Activity { private EditText edit; private Button button; private ProgressDialog progressDialog; private boolean isLoginInProgress = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); edit = (EditText) findViewById(R.id.edit_timer); button = (Button) findViewById(R.id.btn_start); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { if (edit.getText().toString().length() == 0) throw new Exception(); long dTime = Long.parseLong(edit.getText().toString()); new Handler().postDelayed(new Runnable() { @Override public void run() { MainActivity.this.isLoginInProgress = false; progressDialog.dismiss(); } }, dTime); progressDialog.show(); isLoginInProgress = true; } catch (Exception e) { Toast.makeText(MainActivity.this, "bad time value", Toast.LENGTH_SHORT).show(); } } }); progressDialog = new ProgressDialog(this); progressDialog.setMessage("loading"); if (savedInstanceState != null) { // activity is restarted isLoginInProgress = savedInstanceState.getBoolean("fl_login"); edit.setText(savedInstanceState.getString("edit")); } if (isLoginInProgress) { // Show dialog again progressDialog.show(); } } @Override protected void onSaveInstanceState(Bundle outState) { outState.putBoolean("fl_login", isLoginInProgress); outState.putString("edit", edit.getText().toString()); } @Override public void onDestroy(){ super.onDestroy(); progressDialog.dismiss(); } } </code></pre>
android
[4]
4,439,963
4,439,964
In PHP settings, should memory_limit > upload_max_filesize?
<p>I'm trying to allow users to upload large files (64MB) and am planning to change:</p> <pre><code> upload_max_filesize to 64MB </code></pre> <p>However, should I also change </p> <pre><code> memory_limit to 64MB or larger? </code></pre> <p>Is memory_limit connected to max_filesize?</p>
php
[2]
6,019,685
6,019,686
Why is '==' not working in PHP?
<p>Both values are '2' but I am not getting a true. Why? </p> <pre><code> echo $getuser. "&lt;br /&gt;"; echo $userurl. "&lt;br /&gt;"; if ($getuser == $userurl) { echo "true &lt;br /&gt;"; } </code></pre> <p>Result</p> <pre><code>2 2 </code></pre>
php
[2]
4,782,177
4,782,178
failed to open stream: HTTP request failed! HTTP/1.1 407 Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request
<p>I am strugling with this code:</p> <pre><code>$auth = base64_encode('domain\username:password'); $aContext = array( 'http' =&gt; array( 'proxy' =&gt; 'tcp://proxy:80', 'request_fulluri' =&gt; true, 'header' =&gt; "Proxy-Authorization: Basic $auth", ), ); $cxContext = stream_context_create($aContext); $sFile = file_get_contents("http://www.codecraft.gr", false, $cxContext); echo $sFile; </code></pre> <p>i keep getting the following message</p> <blockquote>Warning: file_get_contents(http://www.codecraft.gr) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 407 Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web P in C:\wamp\www\test17\tarantula.php on line 17</blockquote> <p>the thing is that myusername and password are correct, and i realy cant find something to help me with that ISA server :S any suggestions?</p>
php
[2]
798,017
798,018
Nested python list assignment
<p>What I want to do is assign a nested list to another list. For example, from alist to blist.</p> <pre><code>alist = [[0], [1], [2], [3]] blist = alist[:] blist[0].append(1) </code></pre> <p>In this way, <code>id(alist[0])</code> equals <code>id(alist[1])</code>, so alist also changes to <code>[[0,1], [1], [2], [3]]</code>, that's not what I want.</p> <p>The workaround I have is:</p> <pre><code>alist = [[0], [1], [2], [3]] blist = [] for item in alist: blist.append(item[:]) blist[0].append(1) </code></pre> <p>In this workaround, alist won't be influenced by changing blist's items. However, it seems not so pythonic, is there any better resolution? That could resolve the deep copy of more the 2 level nested list. eg: <code>alist = [[[1], 10], [[2], 20], [[3], 30]]</code></p>
python
[7]
4,773,811
4,773,812
"There was an error parsing the package" but only when downloading from GitHub
<p>So I've been developing my first few Android applications and I've now got to a stage where I want to test one out on my own phone. I first thought that I would check the APK in to GitHub with my source code, I can then download it onto my phone (the USB cable is currently at work).</p> <p>I tried this and when I attempted to install it I was unable to with a "The was an problem parsing the package". I looked into this attempted all the fixes that I found, compiling with lower min SDK versions etc. After a while I just gave up and decided to try one last thing and transferred it over my own network, here the application installed correctly and now works fine. The name is the same and its the same APK. Does anyone have any idea why this might happen?</p> <p>Its a signed APK file and the application consists of one Activity and one Widget, all they do is silence and unsilence the phone </p>
android
[4]
5,984,468
5,984,469
hide a header of a column with binding data in asp.net
<p>would it be possible to do it like this?</p> <pre><code>&lt;asp:TemplateField HeaderText="Export" Visible='&lt;%# Bind("isExported") %&gt;'&gt; &lt;/asp:TemplateField&gt; </code></pre> <p>I tried it and I got this problem:</p> <pre><code>The TemplateField control with a two-way databinding to field deviceExport must have an ID </code></pre>
asp.net
[9]
5,668,180
5,668,181
Limit array results and increment through when button is clicked
<p>What I am hoping to do is display the first 5 items (Stage1 - Stage5) from the array when the page is loaded. To the side I will have two images one arrow pointing up and one arrow down. If the down arrow is clicked the array is incremented to display (Stage2 - Stage6). Another click on the down arrow the screen would display (Stage3 - Stage7). Then the up arrow does the same but the opposite direction.</p> <p>With the code I have below I can manually add "1" to $var1 and $var2 or subtract 1 when needed, save and refresh the browser to get the effect I am looking for. I just can't seem to figure out how to do the increments of $var1 and $var2 and then refresh the page, all automatically when the arrow images are clicked.</p> <p>I am new so I could be completely off with what I have but hopefully it at least helps show what I want to do.</p> <pre><code>&lt;?php $stage_name=array ("Stage1","Stage2","Stage3","Stage4", "Stage5","Stage6","Stage7","Stage8", "Stage9","Stage10","Stage11","Stage12", "Stage13","Stage14","Stage15","Stage16"); ?&gt; &lt;html&gt; &lt;body&gt; &lt;?php $var1=0; $var2=5; for($list=$var1; $list&lt;$var2; $list++) { foreach($stage_name as $stage_index =&gt; $stage_item) { if ($stage_index==$list) print("$stage_item&lt;br /&gt;"); } } ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Thanks</p>
php
[2]
5,818,803
5,818,804
adding where clause in javascript
<p>var PicLibraryURL = "/SC/SW/_vti_bin/owssvr.dll?Cmd=Display&amp;XMLDATA=TRUE&amp;List=%7B9D30BD4A%2DBA0F%4ED2VM%2DBEBB%2D8CEC5D74A29B%7D";</p> <p>How do I add a where clause to above javascript? I have a flag y/n column "ShowInRotator" in the pic libray and like to only fetch record where "ShowInRotator=Yes" (or true or 1, whatever it is).</p> <p>I would also like to add additional text with the image rotator (the comments column in piclibrary has the text that I like display during image rotator. </p> <p><a href="http://www.pathtosharepoint.com/Pages/ImageRotator.aspx" rel="nofollow">http://www.pathtosharepoint.com/Pages/ImageRotator.aspx</a></p>
javascript
[3]
3,660,855
3,660,856
Custom jQuery Gallery Settings
<p>Im using jQuery to create button that will show Photos with absolute position. However, i tried to configure the code with this.</p> <pre><code>$('#thumbsets li').each(function (i) { i = i+1; $(this).addClass('ts'+i); }); $('#web_overview details').each(function (i) { i = i+1; $(this).addClass('panels'+i).hide(); }); </code></pre> <p>After that, i will create now the main button since i have all specified classes in each class.</p> <pre><code>$('#web_overview details').each(function (i) { i = i+1; $(this).addClass('panels'+i).hide(); //Hide all main photos // Create button command $('.ts'+i).bind({ click: function() { $('.panels'+i).show(); //If clicked photos will show up //Fallback for the other photos } }); }); </code></pre> <p>Now my issue here is, how can i load back again the previous photo if i click .ts1 since .panels2 stuck over the .panels1 </p> <p>Here's my sample output:</p> <p>.ts1 -> .panels1 | .ts2 -> .panels2 | .ts1 -> .panels1 (if i click again the .ts1 to load it back on the framebox .panels2 will remain at the top of .panels1.)</p> <p>Thanks in advance if someone can give me idea on how to fix this.</p>
jquery
[5]
317,140
317,141
Adding TD Dynamically Using jQuery
<p>I have a method that adds an image to a TD and attaches the click event to the image. I am dynamically building a row and wanted to attach the TD image column to my row. </p> <pre><code>$("&lt;tr&gt;&lt;/tr&gt;").append(addActionColumn($("&lt;td&gt;&lt;/td&gt;"))); </code></pre> <p>And here is my addActionColumn method: </p> <pre><code>function addActionColumn(td) { var actionImage = document.createElement("img"); $(actionImage).attr("src", "../Images/cross_red.JPG"); // delete the row $(actionImage).click(function() { $(td).parent().remove(); }); $(td).append(actionImage); } </code></pre> <p>For some reason the TR never gets the image column attached to it. </p>
jquery
[5]
1,499,648
1,499,649
What is a convenient way to store and retrieve boolean values in a CSV file
<p>If I store a boolean value using the CSV module it gets converted to the strings 'True' or 'False' by the str() function. However when I load those values, a string of 'False' evaluates to being True because it's a non-empty string.</p> <p>I can work around it by 'manualy' checking the string at read time with an IF statement to see what the string is, but it's somewhat less than elegant. Any better ideas, or is this just one of those things in the programming world?</p>
python
[7]
809,170
809,171
Get the name of all attributes in a XML-File
<p>Hey I have an XML file and I would like to navigate to a given node and grab the name of all Attributes to that node. </p> <p>For example: (XML File)</p> <pre><code>&lt;RootName&gt; &lt;SubNode&gt; &lt;Attribute1&gt;Value 1&lt;/Attribute1&gt; &lt;Attribute2&gt;Value 2&lt;/Attribute2&gt; &lt;/SubNode&gt; &lt;/RootName&gt; </code></pre> <p>Here is my code so far: (Java Code)</p> <pre><code>File file = new File("data.xml"); try { /* Parse File */ DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.parse(file); /* Find Starting Tag */ NodeList nodes = doc.getElementsByTagName(StartTag); for (int i = 0; i &lt; nodes.getLength(); i++) { Element element = (Element) nodes.item(i); System.out.println(element); } </code></pre> <p>Now I know you can find a specific attribute given the name</p> <pre><code>String name = element.getAttribute("Attribute1"); </code></pre> <p>But I would like to find all these names dynamically.</p> <p>Thanks in advance</p> <p>-Scott</p>
java
[1]
4,567,679
4,567,680
using pyserial flush method
<p>I've read somewhere that the use of flush is necessary to reduce lag. Is this true? </p> <p>I'm not really sure about using it. Please help me understand what it does exactly. </p> <p>I've checked pyserial docs but it didnt give me much information. All it said was: </p> <blockquote> <p>flush() Flush of file like objects. It’s a no-op in this class, may be overridden.</p> </blockquote>
python
[7]
4,846,885
4,846,886
Check to see if string contains quotes, and if it does, place an escape '\' before
<p>I need to parse strings for single and double quotes, and if the string does contain them, I need to add an escape slash before. What would be the most efficient way? Is there a way to use a regex to check this through a function?</p>
javascript
[3]
855,950
855,951
Extend a jQuery plugin
<p>Say I have a jQuery plugin like $.abc = function() {}. Now I want to provide an extra module which uses the same scope as $.abc and extends its functionality. For e.g. in my abc plugin I will check if say a variable mod1 = true; if its true, then I will automatically call thoso functions of mod1.</p> <p>My question is how do I write mod1 so that it can share the same namespace as my base plugin and I am able to call it from my plugin e.g. mod1.getFiles();</p> <p>Thankyou for your time. Sorry if this is not very clear. I will explain again if you have any questions.</p> <p>UPDATE: How do I call function test of pluginbar?</p> <pre><code>$.fn.pluginFoo = function() { ... CALL FUNCTION TEST OF PLUGINBAR ... }; $.fn.pluginBar = function() { ... function test() { alert('this is a test'); } ... }; </code></pre>
jquery
[5]
104,217
104,218
Method hiding in C# classes
<p>I'm looking at <code>LinkedList</code> class implementation in C# and I cannot understand how Add method is hidden.</p> <p><code>LinkedList</code> implements <code>ICollection</code> which has an <code>Add</code> method. In the <code>LinkedList</code> class code the <code>Add</code> method is declared as:</p> <pre><code>void ICollection&lt;T&gt;.Add(T value); </code></pre> <p>How it is possible to have internal method which is declared in the interface?</p>
c#
[0]
1,000,986
1,000,987
Need something other than touchup inside
<p>I have a button in my iphone app, when I click the button it calls a linked method, that I have done as: </p> <pre><code>[myButton addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside]; </code></pre> <p>all working well, but i want if user tap the button for say 5 second continuously then he will be shown a message that will be there and gone away after some time and button does not get clicked, how can I do that, please help me.</p> <p>Many Thanks in advance. Regards iPhone Developer11</p>
iphone
[8]
519,705
519,706
Append data to each class
<p>I am creating an event calendar and right now i want to display data from server to each date and time. My code is working if only one entry exists into data base but not for more than one. Here is my code.</p> <pre><code> $.each($(".hour"), function(){ if($(this).attr("data-date") == data.dDate &amp;&amp; $(this).attr("data-time") == data.fromHour) { $(this).append(data.dDate); } }); </code></pre> <p>Any suggestions? Thanks</p>
jquery
[5]
5,564,143
5,564,144
How to close all active applications from my Android app?
<p>I have a my Android app, and I would like to close all other active applications from my app. Is there a way to do it in android? </p>
android
[4]
115,633
115,634
python exception handling
<p>In the below python the message RSU is not supported on single node machine** is not getting printed. can anyone help please??</p> <pre><code>#! /usr/bin/env python import sys class SWMException(Exception): def __init__(self, arg): print "inside exception" Exception.__init__(self, arg) class RSUNotSupported(SWMException): def __init__(self): SWMException.__init__(self, "**RSU is not supported on single node machine**") def isPrepActionNeeded(): if 1==1: raise RSUNotSupported() try: isPrepActionNeeded() except: sys.exit(1) </code></pre>
python
[7]
1,057,302
1,057,303
android: how do I use tabhost/tabwidget (genrally tabs) putting different activities on tabcontents
<p>Firstly!, I've used the generated <code>Activity</code> using the tab navigation type. I just used it to automatically generate <code>Tab</code> control on the <code>Activity</code>. Its on the latest <em>ADT</em>.I think :(,, Now my question is how do I use the <code>Fragments</code> from other <code>Activity</code> in to the <code>Tab</code> contents</p> <p>secondly, Is there any other way to put another <code>Activity</code> inside the <code>Tab</code> content which on the, lets say its MainACtivity.class?....</p> <p>Planning to have 3 <code>Tab</code>s with 3 different <code>Activity</code>s, each of which contains 1 <code>Activity</code> per <code>tab</code> content</p> <p>Really need ur help guys I have run out of ideas and sources :( :( ... Kind of new to android development so be gentle. :) </p>
android
[4]
231,518
231,519
When to reset a callbackhandler for a Service
<p>i have two Activities A and B and one Service C. A starts B. </p> <p>A and B: </p> <ul> <li>are binding and unbinding to the Service in <code>onStart()/onStop()</code>. </li> <li>are implementing a <code>Handler</code>-Object that works with Messages. The Handler is needed, so if C is doing Work and the Result is there, it will give back a result or message to A or B. </li> <li>are implementing a <code>ServiceConnection</code>-Object. In the Method <code>onServiceConnected</code> from the <code>ServiceConnection</code>-Object, the Handler will be given to the Service C. </li> <li>If i leave A or B, the Handler for the Service will be set to Null in <code>onStop()</code>. This is because the Activity is not active anymore, so it can not use the Result to do something for example showing a Dialog.</li> </ul> <p>I have following Problem: </p> <ul> <li>If i start A and use a function from C everything works fine. Resultdialog is showing up.</li> <li>If i start B from A, also everything works fine. Resultdialog is showing up.</li> <li>Now if i press Back to go back to A, then C cannot contact A, cause the handler is still set to null. No Handler created Dialog is showing up.</li> </ul> <p>I think it has to do something with the order of the lifecycle-methodcalls. <code>onStart()</code> for the new Activity is getting called before <code>onStop()</code> from the old activity.</p>
android
[4]
4,025,865
4,025,866
Is the order guaranteed for the return of keySet() of a LinkedHashMap object?
<p>I know LinkedHashMap object has a predictable iteration order for elements in it. Then, does the return of keySet() call on a LinkedHashMap object has the same iteration order as the LinkedHashMap object?</p> <p>Thanks.</p>
java
[1]
5,133,862
5,133,863
anyone using perfectomobile for testing?
<p>I have completed my first android app and am trying to test it on 'perfectomobile' web site which allows download to actual phones. I have selected the HTC Wildfire which is said to haqve Android 2.1 (Eclair) os. I am using Eclipse and have exported the app which is targeted to Android 2.1 update 1. Downloaded it to the sd card on the Wildfire and when I click on it in the Anddev list on the phone screen I get the 'Parse error' message.</p> <p>The app runs fine on the emulator on my pc? Is the parse error referring to something in the XML files or might it be in the code?</p> <p>I've done a lot of googling re parse error without enlightment so I am wondering if anyone on here can suggest how to track down the item causing the error. Thanks Ron</p>
android
[4]
5,213,269
5,213,270
asp.net failed to run in dot net 4.0
<p>The website was developed in dot net 3.5 SP1 and running ok within dot net 3.5 SP1. But, after recompiled it into dot net 4.0 and changed the app pool to "integrated", it failed to run. The symptom is that the website was running ok for few minutes. Then, the following message will appear:</p> <blockquote> <p>[NullReferenceException: Object reference not set to an instance of an object.]<br> System.Web.PipelineStepManager.ResumeSteps(Exception error) +197<br> System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb) +89<br> System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +189</p> </blockquote> <p>If we recycle the app pool, it will work for a few minutes and then same error appear.</p> <p>Any help is appreciated.</p> <p>Lau.</p>
asp.net
[9]
5,447,305
5,447,306
Rounding up values and putting it in another element
<p>my code below does what its suppose to do with one little problem. i have sat up for hours trying to fix it. could anyone help me out please. </p> <pre><code>var price = new Array(12.121212, 45.334, 2.34, 0); for (var i=0;i&lt;price.length;i++){ roundPrice[i] = Math.round(price[i]*100)/100; } var s = document.getElementsByTagName('input'); for (var i=0;i&lt;s.length;i++) { if (s[i].className == 'price') {//changed this to get class instead s[i].value = roundPrice[0]; } } </code></pre> <p>the line that is giving me a headache is </p> <pre><code>s[i].value = roundPrice[1]; </code></pre> <p>if i state the actual index of the array, it puts that single value into all the input element specified.</p> <p>on the other hand, if i use this line of code (below), i get 'undefined ' as a result in all the element specified.</p> <pre><code>s[i].value = roundPrice[i]; </code></pre> <p>Thank you</p>
javascript
[3]
2,116,414
2,116,415
jQuery API Browser using raw XML from jquery site and XSLT. How to generate and embed runnable code?
<p>I have developed a jQuery API browser from the raw XML available from <a href="http://api.jquery.com/api/" rel="nofollow">http://api.jquery.com/api/</a> they also have a Dynamic API browser which is built from this XML i guess <a href="http://api.jquery.com/browser/" rel="nofollow">http://api.jquery.com/browser/</a> but it is slightly difficult to navigate because you do not get to see all the API of one type together, you can only see the details when you click on one of the links. So to overcome this difficulty i have built my own API browser with this raw XML. This is what I have <a href="http://samarjit.net78.net/jquerybrowser/jquery.apitest2.xml" rel="nofollow">http://samarjit.net78.net/jquerybrowser/jquery.apitest2.xml</a>. build with XSLT mostly and 4 javascript functions. I did the navigation simplistic and with minimum code and minimum javascript parsing as this XML is big. Left side is menu right side is snapshot of similar APIs and middle is details description. The pages gets loaded only once and hence its fast.</p> <p>This is what I wanted to share. There is a possibility to create dynamically, demo sections. I couldn't figure out how to create sample executable code dynamically from snippets of <code>&lt;css&gt;, &lt;code&gt; and &lt;html&gt;</code> dynamically. The codes look so different some methods needs to be called on <code>$(document).ready()</code> but some are normal functions which should be outside closures.</p> <p>I would also like to learn some scalable implementation methods, given that generated HTML is quite big. I do not want to create many <code>&lt;iframes/&gt;</code> which will download lot of files while initial loading. </p>
jquery
[5]
2,652,744
2,652,745
how to get the image size using php
<p>hi guys i am using <code>&lt;input type='file' name='filett' size='filett'&gt;</code> and move the file into the temporary location. Just i wants to know how to get the image size using php . i am using <code>$rect = thegetimagesize("img/flag.jpg");</code> but if i echo the variable <code>$rect</code> it shows the error</p>
php
[2]
5,068,646
5,068,647
In android, How can I force open a URI using a specific browser, without popping up the 'choose browser' list?
<p>I have multiple browsers on my android device. I can use the following code to open a URI using the default android browser:</p> <pre><code> String packageName = "com.android.browser"; String className = "com.android.browser.BrowserActivity"; Intent internetIntent = new Intent(Intent.ACTION_VIEW); internetIntent.addCategory(Intent.CATEGORY_LAUNCHER); internetIntent.setClassName(packageName, className); startActivity(internetIntent); </code></pre> <p>How can I accomplish the same using a specified browser that is installed on my device, say Opera.</p> <p>Thanks very much.</p>
android
[4]
2,758,286
2,758,287
How to replace this html using jquery?
<p>I have this html.</p> <pre><code>&lt;div&gt; &lt;input type="password" id="user_password" name="user_password" class="password"&gt; &lt;div class="passwordstrength s_1" style="display: block;"&gt;bad&lt;/div&gt; &lt;input type="password" id="user_password_confirm" name="user_password_confirm" class="password" style="display: inline-block;"&gt; &lt;/div&gt; </code></pre> <p>i want to reset and replace it back to</p> <pre><code>&lt;div&gt; &lt;input type="password" id="user_password" name="user_password" class="password"&gt; &lt;div class="passwordstrength" style="display: none;"&gt;&lt;/div&gt; &lt;input type="password" id="user_password_confirm" name="user_password_confirm" class="password" style="display: none;"&gt; &lt;/div&gt; </code></pre> <p>how do i do this using jQuery?</p>
jquery
[5]
4,054,955
4,054,956
Finding the Length of a String within an ArrayList
<p>I am writing a CSVParser program that seperates words at commas. I am currently trying to find and record the longest word that appears in the file. Here is my class.</p> <pre><code>import csv.CSVParser; import java.io.*; import java.util.*; public class RecordFormatter { public static void main (String[] args) { CSVParser parser = new CSVParser(new File (args[0])); while (parser.hasNextLine()) { ArrayList&lt;String&gt; ls = parser.getNextLine(); for (int i = 0; i&lt;ls.size(); i++) { System.out.print("|" + ls.get(i) + " "); } System.out.print("|"); System.out.println(); } CSVParser parser1 = new CSVParser(new File (args[0])); ArrayList&lt;Integer&gt; maxCol = new ArrayList&lt;Integer&gt;(); while (parser1.hasNextLine()) { ArrayList&lt;String&gt; ls1 = parser1.getNextLine(); for (int i = 0; i&lt;ls1.size(); i++) { maxCol.add(ls1.get(i)); //Here is where my bug occurs. } } } } </code></pre> <p>I have created two CSVParsers and am trying to use the second of the two to record the length. I tried (as you can see above) storing the int length value of each word into another Arraylist, but I can't seem to get it to work. Any help would be much appreciated.</p>
java
[1]
5,094,425
5,094,426
Simulate an attack while+array+objects
<pre><code>class Gunner { public $health; public $attack; function __construct($health, $attack) { $this-&gt;health = $health; $this-&gt;attack = $attack; } } $player = array(); $player[] = new Gunner(100, 20); $player[] = new Gunner(100, 20); $player[] = new Gunner(100, 20); $enemy = array(); $enemy[] = new Gunner(100, 20); $enemy[] = new Gunner(100, 20); </code></pre> <p>I want to have some while loop that run through as long as the both arrays has "entities" / objects. How do I do that? I want to fight each and every entity, like $player[0] would be fighting (aka do a rand(1,20)) and then remove from the opposites health until its 0. And when its 0 or less I would remove the entity (object) from the array.</p> <p>I am not sure how the while loop or the delete from array would look like.</p> <pre><code>while ((count($attacker) &gt; 0) &amp;&amp; (count($defender) &gt; 0)) { $attacker_attack = rand(1, 25); $defender[0]-&gt;health -= $attacker_attack; if (!$defender[0]-&gt;IsAlive()) { unset($defender[0]); array_values($defender); } $defender_attack = rand(1, 20); $attacker[0]-&gt;health -= $defender_attack; if (!$attacker[0]-&gt;IsAlive()) { unset($attacker[0]); array_values($attacker); } } </code></pre>
php
[2]
1,029,916
1,029,917
Snake game - Getting collision to work with images
<p>This works when I used a rectangle as the food but now I'm trying to use my own image for the food but can't get it to work correctly. I keep getting the error of "Cannot convert Image to Rectangle" when using <code>IntersectsWith</code> so I'm stuck there and not sure what to do. </p> <p>My error is on this part of the code:<code>if (snake.SnakeRec[i].IntersectsWith(food.foodRec))</code></p> <pre><code>for (int i = 0; i &lt; snake.SnakeRec.Length; i++) { if (snake.SnakeRec[i].IntersectsWith(food.foodRec)) { score += 10; snake.growSnake(); food.foodLocation(randFood); } } collision(); this.Invalidate(); </code></pre> <p>In the Food.cs class</p> <pre><code>public void drawFood(Graphics paper) { Image foodRec = Image.FromFile(@"C:\food.bmp"); Rectangle rectangleAreaToDrawImage = new Rectangle(x, y, width, height); paper.DrawImage(foodRec, rectangleAreaToDrawImage); } </code></pre> <p>If you need more code let me know.</p> <p>Edit: Solved</p> <p>I had to change:</p> <p><code>if (snake.SnakeRec[i].IntersectsWith(food.foodRec))</code></p> <p><code>Rectangle rectangleAreaToDrawImage = new Rectangle(x, y, width, height);</code></p> <p>to:</p> <p><code>if (snake.SnakeRec[i].IntersectsWith(food.rectangleAreaToDrawImage))</code></p> <p><code>rectangleAreaToDrawImage = new Rectangle(x, y, width, height);</code></p>
c#
[0]
4,263,566
4,263,567
how to run .jar file on IIS
<p>I've opened a webserver using IIS on my computer in order to host my multiplayer game. I've build the server in java and wish to run it on my server so users from different computer can play on it for testing. Do I need to run it in a webhost or just run as is from netbeans?</p>
java
[1]
5,689,305
5,689,306
Is it a bad idea to remove the Status Bar in an application?
<p>I am not sure, but I guess:</p> <ul> <li><p>if you make a game, don't have a Status Bar. Looks just not good.</p></li> <li><p>if you have an app, leave the Status Bar where it is. Might be useful.</p></li> </ul> <p>Is there any guideline by Apple when or when not to remove the Status Bar?</p>
iphone
[8]
1,426,825
1,426,826
Differences with jQuery 1.4.2 and 1.7.1?
<p>I build my site on jQuery version 1.4.2 (not realizing about any updates) but now it doesn't seem to work in IE8. When searching for a solution i thought about an update. When i use jQuery 1.7.1. however, some strange things occur. For example this example on jsFiddle</p> <p><a href="http://jsfiddle.net/64d2T/" rel="nofollow">http://jsfiddle.net/64d2T/</a></p> <p>When running this example in 1.4.4 it works fine, but when i run the code in 1.7.1 the format is messed up.</p> <p>Does anybody know this problem and i'm a doing some basic stuff wrong?</p>
jquery
[5]
884,556
884,557
Bar Code Scanner API
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2607858/android-barcode-scanning-options-zxing">Android - Barcode Scanning, Options? Zxing?</a><br> <a href="http://stackoverflow.com/questions/2739550/android-is-there-a-way-to-implement-the-barcode-scanner-into-an-app">Android: Is there a way to implement the barcode scanner into an app?</a> </p> </blockquote> <p>I am planning to integrate a barcode reader to my application. Is there already an android API for that?</p>
android
[4]
3,038,986
3,038,987
Why is my app not available to Galaxy Nexus users, even though it was in the past?
<p>After a recent update I have gotten a number of users complaining that they are unable to download my application from the market since their device "galaxy nexus" is not compatible in the bar. I have a galaxy nexus myself and have tested the app on the device. These same users were able to use the previous version, and I have not made any changes in the manifest in the new update. </p> <p>Is there anything I can do to make my application available to these users? </p> <p>I do have a tablet and a phone build though the market filtering has been good in the past to send the phone build to phones and the tablet build to tablets based on reported screen density and OS version.</p>
android
[4]
1,296,286
1,296,287
How to obtain the container class of an Actionsheet?
<p>I am a green hand of iPhone development, and I just get confused about a method UIActionsheet,which is the "showInView". So what is the relation between the view who called the actionsheet and the actionsheet it self.<br> Actually, I wannt to customize the button in an actionsheet, so I create a class for it and overide the methods, and I want really call the methods in the superview, anybody got a solution?</p> <p>Thank you!<br> (btw, I tried the following code, but it doesn't work.)</p> <pre><code>- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated {........ else if (buttonIndex==sharers.count+1) { AddCommentViewController *parentController=(AddCommentViewController *)[self.superview nextResponder]; } </code></pre>
iphone
[8]
4,946,435
4,946,436
Getting My *.DLL going in PHP
<p>I have a *.DLL that cuts the data in a picture down to a set file size and height, widths.</p> <p>It contains a function <code>FuncName( PChar, PChar, int, Int, Int)</code> and returns a <code>int</code></p> <p>If there is a better way show me. At the moment I'm thinking somehow install it into Java and accessing it through a *.PHP file containing Java code.</p> <p>Can someone show me an article, video or have an example I could follow?</p> <p>Is there any install software I need to be aware of for the *.DLL?</p>
php
[2]
1,619,466
1,619,467
c# by reference or by value
<p>Let's say I have a list of objects and that I'm extracting and modifying an item from the list like this:</p> <pre><code>List&lt;MyObject&gt; TheListOfObjects = new List&lt;MyObject&gt;(); MyObject TheObject = new MyObject(); TheListOfObjects = //some json deserialization result TheObject = (from o in TheListOfObject where o.ID == SomeParameter select o).SingleOrDefault(); TheObject.SomeProperty = SomeValue; </code></pre> <p>When I write <code>TheObject.SomeProperty = SomeValue;</code> am I:</p> <ol> <li>modifying the item in the list and in which case I'm done or</li> <li>modifying a new item and I must replace the original item in the list with the item I just modified.</li> </ol>
c#
[0]
4,142,365
4,142,366
How to force character casing (capitalized) in a ComboBox C#? Is it possible?
<p>I'm using a ComboBox control (windows forms) with auto complete, and I found out that there is no CharacterCasing Property on it. What I'm trying to accomplish is to echo upper case letters on the ComboBox.</p> <hr> <p>comboBox1.DropDownStyle = DropDownStyle.DropDown;</p> <p>//comboBox1.CharacterCasing = CharacterCasing.Upper ???</p> <p>Here's how I populate the comboBox:</p> <pre><code>ComboBox cb = (ComboBox)sender; pl.cmd = new SqlCommand("LOOKUP", pl.ConnOpen()); pl.cmd.CommandType = CommandType.StoredProcedure; pl.cmd.Parameters.Add(new SqlParameter("@TABLENAME", (object)tableName)); pl.da = new SqlDataAdapter(pl.cmd); dt = new DataTable("dt"); pl.da.Fill(dt); cb.DataSource = dt; cb.ValueMember = valueMember; cb.DisplayMember = displayMember; </code></pre>
c#
[0]
3,488,017
3,488,018
How can I delete the contents of a folder with PHP?
<p>I can't seem to get this function to delete all my files and folders in a specific directory can someone help me fix this problem?</p> <p>Here is my code.</p> <pre><code>$apps = 9; $dirname = './members/' . $apps . '/'; function delete_directory($dirname) { if (is_dir($dirname)) $dir_handle = opendir($dirname); if (!$dir_handle) return false; while($file = readdir($dir_handle)) { if ($file != "." &amp;&amp; $file != "..") { if (!is_dir($dirname."/".$file)) unlink($dirname."/".$file); else delete_directory($dirname.'/'.$file); } } closedir($dir_handle); rmdir($dirname); return true; } </code></pre>
php
[2]
5,032,734
5,032,735
Assigning the whole array values to another variable in c#?
<p>I have an array and i want to assign it to another array variable. Here is the code</p> <pre><code>for (int i = 0; i &lt; length; i++) { arr1[i] = Convert.ToByte(Tag_uid.Substring(2 * i, 2), 16); } //Create an array to hold the Command Packet byte[] CommandPacket = new byte[9]; CommandPacket[0] = arr1; //ERROR: cannot convert type byte[] to byte </code></pre> <p>How can i assign the whole array values to <code>commandpacket[0]</code>?</p>
c#
[0]
1,886,388
1,886,389
Is there a way to see the uninstall history of an android device?
<p>Just want to know how to track what applications a user has uninstalled from their device in the past.</p>
android
[4]
2,384,503
2,384,504
Javascript document.getSelection
<p>I'm trying to use the document.getSelection to select text I have entered in an text area for a WYSIWYG editor. It only works if you select text outside the text area though. I don't know if there is a way you can make it select text inside the text area?</p> <p>Below is the text area for a WYSIWYG text editor:</p> <pre><code>&lt;iframe id="editor" width="100%" height="400px" contentEditable="true"&gt;&lt;/iframe&gt; </code></pre>
javascript
[3]
813,961
813,962
Can we see the template instantiated code by C++ compiler
<p>is there a way to know the compiler instantiated code for a template function or a class in C++</p> <p>Assume I have the following piece of code</p> <pre><code>template &lt; class T&gt; T add(T a, T b){ return a+b; } </code></pre> <p>now when i call</p> <pre><code>add&lt;int&gt;(10,2); </code></pre> <p>I would like to know the function that compiler creates for int specific version.</p> <p>I am using G++, VC++. It will be helpful if some can help me point out the compiler options to achieve this.</p> <p>Hope the question is clear. Thanks in advance.</p>
c++
[6]
1,254,456
1,254,457
Get the number of milliseconds since some date
<p>How to get the number of milliseconds from October 15th 2011 1:52:34 P.M.</p> <p>I can get the number of milliseconds from the current time.</p> <pre><code>Date date = new Date(); long currentTime = date.getTime(); System.out.println("Current time in long: " + currentTime); </code></pre>
java
[1]
615,666
615,667
getting an error while uploading the file
<p>I am trying to upload a 305968 kb file, I keep getting an error that file is too big, maximum file size exceeded. I did the below changes in web.config file , but I keep getting an error</p> <pre><code> &lt;httpRuntime requestValidationMode="2.0" executionTimeout="7200" maxRequestLength="102400" minFreeThreads="88" minLocalRequestFreeThreads="76" appRequestQueueLimit="200"/&gt; &lt;compilation debug="true" targetFramework="4.0"&gt; </code></pre> <p>I also made this change in web.config file</p> <pre><code>&lt;security&gt; &lt;requestFiltering&gt; &lt;requestLimits maxQueryString="10000" maxUrl="10000" maxAllowedContentLength="3072000000"&gt;&lt;/requestLimits&gt; &lt;/requestFiltering&gt; &lt;/security&gt; </code></pre>
asp.net
[9]
2,272,793
2,272,794
Python - can't convert to int
<p>My entire code is below (didn't want to miss anything). For some reason I keep getting an error where I can't convert a float to an int?</p> <pre><code>import math def getRange(input): if (1 &lt;= input &lt; 10): return [1,1,9] elif (10 &lt;= input &lt; 190): return [2,10,99] elif (190 &lt;= input &lt; 2890): return [3,100,999] elif (2890 &lt;= input &lt; 38890): return [4,1000,9999] elif (38890 &lt;= input &lt; 488890): return [5,10000,99999] elif (488890 &lt;= input &lt; 5888889): return [6,100000,999999] def getDigit(input): workingRange=getRange(input) multi_digit_dec = ((input-workingRange[1])/workingRange[0])+workingRange[1] multi_digit_float = math.floor((input-workingRange[1])/workingRange[0])+workingRange[1] print multi_digit_float multi_digit_int = input(multi_digit_float) decimal_remainder = multi_digit_int - multi_digit_dec ## digit_id = decimal_remainder * len(str(multi_digit_int)) ## actual_digit = str(multi_digit_dec)[digit_id] ## return actual_digit getDigit(100) </code></pre> <p>My error is:</p> <pre><code>Traceback (most recent call last): File "C:\Users\Samuel\Desktop\Python\concatenate string of variables and product values.py", line 29, in &lt;module&gt; getDigit(100) File "C:\Users\Samuel\Desktop\Python\concatenate string of variables and product values.py", line 22, in getDigit multi_digit_int = int(multi_digit_float) TypeError: 'int' object is not callable &gt;&gt;&gt; </code></pre> <p><strong>Code updated above to reflect change of variable called int to input</strong></p>
python
[7]
3,886,701
3,886,702
how to: PRODUCT_PACKAGE_OVERLAYS
<p>I heard that PRODUCT_PACKAGE_OVERLAYS can be used to add strings to native Android applications without having to actually edit the strings.xml of that application.</p> <p>I tried following the steps in <a href="http://www.kandroid.org/online-pdk/guide/build_new_device.html" rel="nofollow">this site</a> (I created /vendor/.., etc), but there were build errors when I tried to use the strings in my activities.</p> <p>How do I call in my activity a string (ex: R.string.x) which is declared in the overlay?</p> <p>Thank you.</p>
android
[4]
62,382
62,383
Stripping leading character from an alphanumeric string using php
<p>I've got several strings of the type id1, id2, id125, id1258, etc.</p> <p>What I want to achieve using php is to strip the word "id" from those strings and get only the numbers in <strong>integer format</strong> in php. How can I do this?</p>
php
[2]
2,242,350
2,242,351
NullPointerException when adding an Item to the list
<p>Helo All,</p> <p>I have a problem that I am facing NullPointerException when I want to add an item to the List, as shown below:</p> <pre><code>public List&lt;SearchResponse&gt; sortMPGListViewForNA(List&lt;SearchResponse&gt; response) { List&lt;SearchResponse&gt; list = response; List&lt;SearchResponse&gt; tempMPG = null, tempPrice = null, tempRating = null; for(int i=0;i&lt;response.size();i++) { if(response.get(i).years.get(0).mpg.equalsIgnoreCase("n/a")) { tempMPG.add(response.get(i)); list.remove(i); } if(response.get(i).years.get(0).price.equalsIgnoreCase("n/a")) { tempPrice.add(response.get(i)); list.remove(i); } if(response.get(i).years.get(0).rating.equalsIgnoreCase("n/a")) { tempRating.add(response.get(i));//NPE Occurs Here list.remove(i); } } response.addAll(tempMPG); response.addAll(tempPrice); response.addAll(tempRating); return response; } </code></pre> <p>Please suggest me any solution regarding to the same.</p> <p>Thanks in advance.</p>
android
[4]
4,856,411
4,856,412
jquery prepend change scroll position
<p>I have a problem when I prepend a new div with 780px height and after doing animation scrolling is change 2 time with 780px down can somebody help me?</p> <pre><code>function slide_up() { var str = document.URL; var list = str.split("Details"); var url = list[0] + "AddDetails"; $.ajax({ type: 'POST', url: url, data: { direction: "up", artikel_id: parseInt(artikel_id) }, success: function (result) { $("#details-list").prepend(result); } }); $("#scroll").animate({ scrollTop: '-=780px' }, 1000); } </code></pre>
jquery
[5]
5,797,231
5,797,232
how to get meta desciption value in wordpress
<p>I want meta description of currently executing page in the header.php file in wordpress.</p> <p>Wordpress function "get_post_meta" is not useful for this. It only returns custom meta tags.</p> <p>can anyone help me out.</p>
php
[2]
3,666,479
3,666,480
Why both hashCode() and equals() exist
<p>why java Object class has two methods hashcode() and equals()? One of them looks redundant and its percolated to the bottom most derived class?</p>
java
[1]
3,275,408
3,275,409
PHP fail to move file from temp folder to specified folder
<pre><code>&lt;?php error_reporting(E_ALL); include "func.php"; connectToDatabase("localhost","root","","test"); $fileName = $_FILES['name']; $fileSize = $_FILES['size']; $fileType = $_FILES['type']; $fileTempName = $_FILES['temp_name']; $uploaderID = $_SESSION['id']; $date = date("d/m-Y"); $uploadDir = "avatarStor/"; $filePath = $uploadDir . $fileName; if(!$fileName){ echo "Error: value 'fileName' was undefined&lt;br&gt;"; } $result = move_uploaded_file($fileTempName, $filePath); if (!$result) { echo "Error: File could not be uploadet: ".$fileName; exit; } if(!get_magic_quotes_gpc()){ $fileName = addslashes($fileName); $filePath = addslashes($filePath); } $result = mysql_query("UPDATE users SET profilepicture='$fileName' WHERE id='$uploaderID'") or die(mysql_error()); ?&gt; </code></pre> <p>I am unable to <code>move_uploaded_file();</code> in this uploading script. I went ahead and <code>chmod 777</code> the folder, but nevertheless, it failed. PHP provides no errors when running. <img src="http://i.stack.imgur.com/ERNM2.png" alt="Result"></p>
php
[2]
5,312,367
5,312,368
Not saving the leading zero from one table to another
<p>An error is thrown on a dropdown list that updates a table field. It claims the SelectedValue is invalid because it does not exist in the list of items. If I go into the table and add the zero to the ID the error is no longer thrown. </p> <p>The dropdown selects a teacherid which is the primary key from the Teacher table and saves the ID to the Classes table. The classes table saves any IDs that begin with zero without the leading zero.</p> <p>So if the tid is 0701234 in the Classes table it is saved as 701234 but both tables are nvarchar(255). I might add that the Classes table was using an int datatype for the tid. so I changed it to avoid this. The error above is still thrown after the change, since you cannot update a record that does not exist. </p> <p>Here is the control</p> <pre><code>&lt;asp:DropDownList ID="teacherdd1" runat="server" AutoPostBack="true" DataSourceID="SQLdatasourceTeacherList" DataTextField="fullname1" DataValueField="tid" &gt; &lt;/asp:DropDownList&gt; </code></pre> <p>I simply do not know what to do, or why this is happening. </p> <p>quite simple. i switched to a textbox to test and forgot to double check this. my oversight. </p> <p>thanks</p> <p>cmdUpdate.Parameters.Add("@TID1", SqlDbType.Int).Value = teacherdd1.SelectedValue.ToString() cmdUpdate.Parameters.Add("@TID2", SqlDbType.Int).Value = teacherdd2.SelectedValue.ToString() 'cmdUpdate.Parameters.Add("@tid1", SqlDbType.NVarChar).Value = txbteacher1.Text.ToString() 'cmdUpdate.Parameters.Add("@tid2", SqlDbType.NVarChar).Value = txbteacher2.Text.ToString()</p>
asp.net
[9]
5,584,690
5,584,691
Blob constructor not working in safari / opera?
<p>I'm trying to construct a Blob from an array buffer that original comes from a binary string. It works fine in Firefox &amp; Chrome, but I don't know whats wrong with Safari &amp; Opera</p> <p>This is a simplified version of my problem: <a href="http://plnkr.co/edit/sfEEHf?p=preview" rel="nofollow">http://plnkr.co/edit/sfEEHf?p=preview</a></p> <pre><code>// 1x1 red PNG pixle base64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIW2P8z8DwHwAFBQIAHl6u2QAAAABJRU5ErkJggg=="; byteString = atob(base64); // convert binary to array buff so we can construct a blob later arrayBuffer = new ArrayBuffer(byteString.length); intArray = new Uint8Array(arrayBuffer); for (i = 0; i &lt; byteString.length; i += 1) { intArray[i] = byteString.charCodeAt(i); } // construct blob blob = new Blob([intArray], {type: "image/png"}); console.log(blob.size); // suppose to be 70 (its 19 in safari) </code></pre>
javascript
[3]
4,276,612
4,276,613
Join function in Python
<p>I am writing code that reverses a string e.g. GOOD ---> DOOG w/o using the reverse() function. I'm almost there...</p> <pre><code>a = "hello" for i in range(1,len(a)+1): print a[-i], </code></pre> <p>When I complete the code with the join function, it doesn't work as I expect. Any ideas why? Driving me nuts. </p> <pre><code>a = "hello" for i in range(1,len(a)+1): print ""join.a([-i],) </code></pre>
python
[7]
4,330,575
4,330,576
How to calculate trends from text messages
<p>I'm working on a Hungarian twitter client and I would like to implement a trend system. So I have a database full of texts and dates (unix timestamps) that represent the creation date of the tweet.</p> <p>So how can I create some kind of php script that gives me about 10 "Trending topics"? I don't even know how to start working on this problem.</p>
php
[2]
4,662,296
4,662,297
Javascript as a general purpose language?
<p>In a weekend geek seminar I attended, several instructors extolled the virtues of Javascript. I've used Javascript to some extent, but their enthusiasm caused me to want to step a little closer.</p> <p>I've learned bits-and-pieces about Rhino &amp; SpiderMonkey. I know about server-side scripting &amp; the restrictions placed on local file access (and the reasons why).</p> <p>I wondered if Javascript would ever take it's place alongside perl and python as a general purpose language? Not b/c there is any lacking in the languages that exist, but simply for those skilled in its use to broaden the scope of their reach.</p> <p>I'm not so interested in a prediction of the future as I am about the current possibilities, the barriers in the way, and what's on the near-term table that might make this more of a reality.</p> <p>Are some of you perhaps using the language in such way now? Shell scripting, local apps, etc.?</p> <p>If so, how are you working around the issues of local file access and other things, such as databases?</p>
javascript
[3]
4,386,370
4,386,371
object returns not defined in javascript
<p>Hi i am trying to get my head around some basic stuff in javascript, i want to create the equivalent to a class see below:</p> <pre><code>var myTest = { myTester:"testing", testCode:function(){ return myTester; } }; </code></pre> <p>when i call <code>alert(myTest.testCode());</code> i get error myTester is undefined;</p> <p>i also have similar trouble when trying to set the value of myTester too, what i am trying to achieve here is something along the lines of this:</p> <pre><code>var myObj = myTest.testCode(); var tester = myObj.myTester; </code></pre> <p>as myObj is an object i should once created be able to access its values but i dont usually do javascript just jQuery and i am trying to create an application in pure javascript just for brain feed and would appreciate a little guidence, especially on what do you actually call this, is it a class????</p> <p>thanks</p>
javascript
[3]
1,120,393
1,120,394
error while executting the marshalling program?
<blockquote> <p>how to resolve the exception while excuting a marshalling program "The method marshal(Book, > FileWriter) is undefined for the type Pool.Marshaller".</p> </blockquote> <pre><code> import java.io.FileWriter; import java.util.ArrayList; import java.util.List; import com.sun.xml.internal.ws.util.Pool.Marshaller; public class BookMarshaller { public static void main(String[] args) { try { Book book = new Book("9780312347482", "Power Play", "Joseph Finder"); FileWriter writer = new FileWriter("book.xml"); Marshaller.marshal(book, writer); List book2Authors = new ArrayList(); book2Authors.add("Douglas Preston"); book2Authors.add("Lincoln Child"); Book book2 = new Book("9780446618502", "The Book of the Dead", book2Authors); writer = new FileWriter("book2.xml"); Marshaller.marshal(book2, writer); } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(System.err); } } } </code></pre>
java
[1]