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
2,902,571
2,902,572
C# - display information about custom objects in VS during debugging
<p>I have a set of C# classes, extending an abstract class. There is an abstract method <code>void Show()</code> on the parent. The extending classes are part of a graph with cycles. The implementations of Show invoke many times <code>Console.Write()</code>. Between the console writes there are recursive and other calls.</p> <p>My problem - it is very hard to debug without an easy way to see the state of the graph. I've tried to make that method <code>string Show()</code>, but it is very hard to do properly with all the recursion and cycles. Can you suggest a better approach?</p> <p>Thanks, Sam</p>
c#
[0]
5,109,177
5,109,178
code to view current online users is not giving proper output
<p>i have written a code to view online users in asp.net(vb) but when page gets run it doesn't show proper output,it only shows 3 users online,if more pages are open then also it shows same.i have pasted the code below.please help me.</p> <pre><code>Public Class Global_asax Inherits System.Web.HttpApplication Dim i As Integer Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) ' Fires when the application is started Application("hitcount") = 0 End Sub Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) ' Fires when the session is started i = Application("hitcount") Application.Lock() i = i + 1 Application("hitcount") = Application("hitcount") + 1 Application.UnLock() End Sub Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) ' Fires when the session ends Application.Lock() If Application("hitcount") &gt; 0 Then Application("hitcount") = Application("hitcount") - 1 Application.UnLock() End If End Sub Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) ' Fires when the application ends 'Application.UnLock() End Sub End Class </code></pre>
asp.net
[9]
4,965,651
4,965,652
Linking an existing folder to a solution in Visual C# Express
<p>Note that these are my first steps to the world of C# so I may be asking something really basic here, however neither Google nor Visual C# Express' help helped me so I'm forced to ask this here.</p> <p>I have a set of .cs files in a folder (and its subfolders) I have checked out from SVN repository using TortoiseSVN. I would like to see those files with the same folder structure in Visual C# Express 2008 I'm running, however I can't find the correct import or dynamic linking wizard and drag'n'drop apparently clones the files to the solution instead of just linking them.</p> <p>So, what am I missing, coming from Java world and being an Eclipse user I've used to this kind of functionality, but with VC#E I feel stumped already and I haven't even managed to open a single source file.</p> <p>The reason for this setup is that we have a collaborative project with a couple of friends and not everyone of us uses VC#E, in fact not all of us even use Windows either.</p>
c#
[0]
1,226,856
1,226,857
Rounded Inner corners with transparent inside frame
<p>I am trying to make a frame from code so that I can apply it to make rounded inner corners with a solid fill outside and transparent inside. <strong><em>Just like a solid rectangle with transparent oval inside.</em></strong> picture attached. I have tried few shape combinations all that available online displays the corners outside. </p> <p><img src="http://i.stack.imgur.com/UEvOq.png" alt="enter image description here"></p> <p>The inside should be transparent not white. The image is taken from this <a href="http://stackoverflow.com/questions/4328166/android-xml-rounded-clipped-corners">post</a> but the solution presented here is not what I am looking for I dont want to use a 9 patch drawable but would like to be created in code.</p> <p>Please valid answers only.</p>
android
[4]
2,629,235
2,629,236
Mixed ListActivity
<p>I want to create a ListActivity that has both checkboxs and single selection groups. Like in the Sound Settins in the "Settings" application of android.</p> <p>Anyone has link to a sample ?</p> <p><img src="http://i.stack.imgur.com/tHVwa.png" alt="enter image description here"></p>
android
[4]
1,109,625
1,109,626
How can I change this 24h clock to a 12h clock?
<p>I currently have a 24 hour clock. it displays hours, then minutes. I am trying to change it so that it it displays a 12h version but displays either AM, or PM. For example if you input 17:34. It would display 5:34AM. Here is my code. (I have two classes 'clockDisplay' and 'numberdisplay').</p> <pre><code>public class ClockDisplay { public static final int HOURS_PER_DAY = 24; public static final int MINUTES_PER_HOUR = 60; private NumberDisplay hours; private NumberDisplay minutes; private String displayString; // simulates the actual display /** * Constructor for ClockDisplay objects. This constructor * creates a new clock set at 00:00. */ public ClockDisplay() { hours = new NumberDisplay(HOURS_PER_DAY); minutes = new NumberDisplay(MINUTES_PER_HOUR); updateDisplay(); } /** * Constructor for ClockDisplay objects. This constructor * creates a new clock set at the time specified by the * parameters. * @param hour the hour to set * @param minute the minute to set */ public ClockDisplay(int hour, int minute) { hours = new NumberDisplay(HOURS_PER_DAY); minutes = new NumberDisplay(MINUTES_PER_HOUR); setTime(hour, minute); } /** * This method should get called once every minute - it makes * the clock display go one minute forward. */ public void timeTick() { minutes.increment(); if(minutes.getValue() == 0) { // it just rolled over! hours.increment(); } updateDisplay(); } /** * Set the time of the display to the specified hour and * minute. * @param hour the hour to set * @param minute the minute to set */ public void setTime(int hour, int minute) { hours.setValue(hour); minutes.setValue(minute); updateDisplay(); } /** * Return the current time of this display in the format HH:MM. * @return current time as a String */ public String getTime() { return displayString; } /** * Update the internal string that represents the display. */ private void updateDisplay() { displayString = hours.getDisplayValue() + ":" + minutes.getDisplayValue(); } </code></pre> <p>}</p>
java
[1]
1,590,215
1,590,216
error for Display MapView into Android
<p>this video showing the error for this Displaying map </p> <p><a href="http://www.youtube.com/watch?v=OMzOB-OLtF0" rel="nofollow">http://www.youtube.com/watch?v=OMzOB-OLtF0</a> ![enter image description here][1]</p> <p>now I'm generate Map API Key but it long ,now I'm using windows Xp and when you entered is said not valid ?</p> <p>Key :C0:4E:4B:2C:F8:02:D9:CF:1C:DD:C2:1C:2D:0B:DC:8E:AB:8D:47:46</p>
android
[4]
4,328,192
4,328,193
JavaScript: Image doesn't scale in IE when dynamically added
<p>when I dynamically add an image to a div the image doesn't scale when you resize the window in Internet Explorer.</p> <p>I think it's more clear if I show two really simple examples:</p> <p>The following example doesn't use JavaScript it's just plain html and it does what I want.<br> <a href="http://www.friendly-stranger.com/halp/ie-width/index.html" rel="nofollow">http://www.friendly-stranger.com/halp/ie-width/index.html</a></p> <p>The next one uses JavaScript and if you resize the width of your browser window the image doesn't scale only the width gets smaller.<br> <a href="http://www.friendly-stranger.com/halp/ie-width/bad.html" rel="nofollow">http://www.friendly-stranger.com/halp/ie-width/bad.html</a></p> <p>This is a screenshot of both examples: <img src="http://www.friendly-stranger.com/halp/ie-width/koala-squash.jpg" /></p> <p>The JavaScript code I use: </p> <pre><code>&lt;script type="text/javascript"&gt; $(function(){ var img = new Image(); img.src = 'Koala.jpg'; $('div').append(img); }); &lt;/script&gt; </code></pre>
javascript
[3]
1,015,995
1,015,996
What is the better Way to Store fixed no of data in Java? (Array vs ArrayList)
<p>I believe Array and ArrayList both are non-Synchronised;behave same in multiThreaded env. And both are Index based. Only Adavantage is ArrayList has utility methods and flexible. <BR> Apart from those Utility methods only to get and set fixed no of Objects which is best in java? Is there any overhead in using Arraylist than Array? Pls explain.</p> <p>Let us consider Scenario like </p> <p>1) 1,00,000 Objects to be stored. 2) 1,00,000 primitives to be stored </p>
java
[1]
1,611,495
1,611,496
Can we have a static class in C++?
<p>I was just wondering whether we can have static classes in C++. What I mean is can we declare a class as static in C++ like <code>static class foo</code>? I know we can have static member variables and static member functions in C++ but I am not sure about static classes.</p> <p>Edit:</p> <p>I intended to ask what does it mean for a class to be static.</p>
c++
[6]
3,515,570
3,515,571
logout and redirecting session in php
<p>the below one is the link in my php site.. after clicking this button the user's session should be terminated and he should be redirected again to the home page.. i have written the coding for this concept as follows but it shows me only a blank page(it is not redirected to the home page).. please correct my codings</p> <pre><code>&lt;a href="Logout.php"&gt; click here to log out&lt;/a&gt; </code></pre> <p>codings in the Logout.php a follows</p> <pre><code>&lt;? session_start(); session_unset(); session_destroy(); ob_start(); header("location:home.php"); ob_end_flush(); include 'home.php'; //include 'home.php'; exit(); ?&gt; </code></pre>
php
[2]
4,484,268
4,484,269
Showing loading animation in center of page while making a call to Action method in ASP .NET MVC
<p>My application makes several calls to an Action method (ASP .NET MVC) which returns a Json object. When the application is waiting for this method to return its data I want to display a loading animation in the center of the page. How would I accomplish this? I know that I should use JQuery but that's all I know.</p>
jquery
[5]
5,531,683
5,531,684
Access a local file with file:// in Android
<p>I want to link to a local file in my Android device from my app. It can be by just opening it with file:// from the browser. Is this possible in Android, if so what is the path I need to put, just trying file:// does not show anything in the chrome browser.</p>
android
[4]
1,772,213
1,772,214
Count total month
<p>I have to find total months between two dates in Unix timestamp formats. I want to create a PHP function for that. I've tried this:</p> <pre><code>get_total_month($startunixdate, $endunixdate) { $monthdiff = $endunixdate-$startunixdate; $monthdiff = $monthdiff / 60*60*24*31; return $monthdiff; } </code></pre> <p>Does this function consider leap years as well as month with 30 and 31 separately, or it will just count an approximate month?</p>
php
[2]
1,775,940
1,775,941
Converting a string to byte[] such that the contents remain same
<p>I have a String say <code>String a = "abc";</code>. Now I want to convert it into a byte array say <code>byte b[];</code>, so that when I print <code>b</code> it should show "abc".</p> <p>How can I do that? <code>getBytes()</code> method is giving different result.</p> <p>My program looks like that so far:</p> <pre><code>String a="abc"; byte b[]=a.getBytes(); </code></pre> <p>what I want is I have two methods made in a class one is public byte[] encrypt(String a) and another is public String decrypt(byte[] b) after doing encryption i saved the data into database but when i am getting it back then byte methods are not giving the correct output but i got the same data using String method but now I have to pass it into decrypt(byte[] b) How to do it this is the real scenario. </p>
java
[1]
5,676,197
5,676,198
How can i make image process on video stream in android ?
<p>I want to take ( in real time ) video stream and make some simple image process on the images. For example - i want to make histogram on all the images that make the video stream ( that mean that i need to make histogram for all the images that make the video ) </p> <p>The question: How can i take the real Time video ? How to access in real Time to the device video and make the separation of the images that makes the video ? </p>
android
[4]
922,986
922,987
How do I remove the last n characters from a string?
<p>If I have a string and want to remove the last 4 characters of it, how do I do that?</p> <p>So if I want to remove <code>.bmp</code> from <code>Forest.bmp</code> to make it just <code>Forest</code> How do I do that? Thanks.</p>
python
[7]
3,997,054
3,997,055
OpenFileDialog.ShowDialog() freezing application c#
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2201227/c-wpf-openfiledialog-does-not-appear">C#, WPF - OpenFileDialog does not appear</a> </p> </blockquote> <p>I'm trying to make the "JDEdit" application from John Hunt's Guide to C# and Object Orientation. However, I put in all the code like he did and my application is freezing up whenever I try to use ShowDialog(). I'm not getting any compiler complaints so I'm not sure what's going on.</p> <p>This is the method I'm trying to implement. It freezes when checking the conditional. I don't think the rest of the program should be necessary to post.</p> <pre><code>private void Open() { // still working if (ofd.ShowDialog() == DialogResult.OK) { // never makes it here string filename = ofd.FileName; Console.WriteLine("Open: {0}", filename); textArea.TextChanged -= new EventHandler (this.TextArea_TextChanged); textArea.LoadFile(filename); textArea.TextChanged += new EventHandler (this.TextArea_TextChanged); saveRequired = false; this.Text = title + ": " + filename; } } </code></pre> <p>Thanks!</p>
c#
[0]
1,871,072
1,871,073
Reading File in C++
<p>I am unable to figure out why my code is not able to open and read a file. What am i missing?</p> <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;string&gt; using namespace std; int main (int argc, char * const argv[]) { string line; ifstream myfile ("input_file_1.txt"); if (myfile.is_open()) { while (!myfile.eof()) { getline (myfile,line); cout &lt;&lt; line &lt;&lt; endl; } } else { cout &lt;&lt; "Was unable to open the file" &lt;&lt; endl; } return 0; } </code></pre> <p>The file "input_file_1.txt" is int he same directory as my .cpp file and it has read permissions. I even gave gave it 777 permissions and i was unable to read it.</p> <p>Can anyone tell me what i am doing wrong? I really cannot figure it out....</p>
c++
[6]
3,589,683
3,589,684
Android: launch new activity when it not exist
<p>I have a service that work in foreground, and when the Main activity launch it the notification is launched with the following code:</p> <pre><code>private void showNotification() { Log.i(TAG, LocalService.class.getName() + "showNotification()"); Intent notificationIntent = new Intent(getApplicationContext(), NotificationActivity.class); //notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, notificationIntent, 0); nm = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE); // Set the icon, scrolling text and timestamp int icontouse = R.drawable.icon; if (app.prefs.getBoolean("prefs_useprivacyicon", false)) { icontouse = R.drawable.icon_privacy; } n = new Notification(icontouse, getString(R.string.voice_pro_ready), System.currentTimeMillis()); n.contentView = getRemoteView(); n.contentIntent = contentIntent; startForeground(myID, n); nm.notify(myID, n); } </code></pre> <p>my problem is the PendingIntent, if the Main activity was in pause status, then this become in front when click on notify in statusbar, but if the Main activity was closed by finish() this don't become visible.</p> <p>I need to make possible that if the Activity is in memory than become visible, if not available in memory, then launch a new instance.</p>
android
[4]
2,378,951
2,378,952
iPhone volume changed event for volume already max
<p>I'm using </p> <p>AudioSessionAddPropertyListener(kAudioSessionProperty_CurrentHardwareOutputVolume, audioVolumeChangeListenerCallback, self);</p> <p>to detect volume changes so i can take a picture with the volume rockers but if the phone is already at 100% i don't get an event. Is there a way to detect volume rocker pressed when the volume doesn't actually change?</p>
iphone
[8]
5,111,886
5,111,887
gcm notifcation are not getting on android mobile, type mismatch error on server
<p>Guys i am having issues in implementation of GCM in my android application, in my application when first time implemented gcm i got notification from server but when i changed the debug key store which caused a new SHA1 and i deleted and recreated a new gcm api from that time i am unable to receive notifications from my custom server. At my server side , my custom server which i implemented in Microsoft dot net when i send notification to Google it is causing a type mismatch error , i have done all my best to find out what this type mismatch is.</p> <p>i made another test app and tried notifications there and it is working successfully but not not with my application</p> <p>Any help would be appreciated.</p>
android
[4]
4,695,711
4,695,712
Can a java Map return a size of -1?
<p>I have some code that creates a List, initialized with the size of a Map:</p> <pre><code>private Set&lt;String&gt; mKeys = new HashSet&lt;String&gt;(64); .... List&lt;String&gt; keyList = new ArrayList&lt;String&gt;(mKeys.size()); </code></pre> <p>I am seeing an exception: java.lang.IllegalArgumentException: Illegal Capacity: -1</p> <p>Can a Map return a size of -1? I am looking at the source code for HashSet, which backed by a HashMap. The source code for HashMap shows the internals where elementCount is always decremented on a removeEntry() call. Also, the methods for HashMap.empty() reply on elementCount being == 0, which would return false if elementCount was -1.</p> <p>Has anyone run into this before? I can code around it, but that feels like a hack, which makes me think I am doing something wrong with the current code.</p> <p>EDIT: I was trying to simplify the problem originally. The Set I'm using is actually defined as</p> <pre><code>private static Set&lt;String&gt; mKeys = Collections.synchronizedSet(new HashSet&lt;String&gt;(64)); </code></pre> <p>EDIT: The key here may be in the synchronizedSet. From the JavaDoc</p> <pre><code>It is imperative that the user manually synchronize on the returned set when iterating over it: Set s = Collections.synchronizedSet(new HashSet()); ... synchronized(s) { Iterator i = s.iterator(); // Must be in the synchronized block while (i.hasNext()) foo(i.next()); } Failure to follow this advice may result in non-deterministic behavior. </code></pre> <p>Non-deterministic behavior to me might include a size of -1. I need to go back and make sure I an synchronizing correctly when iterating over the set, but I suspect this is the problem.</p>
java
[1]
3,349,785
3,349,786
Android alert dialog query
<p>I have been working on android application and I have got stuck at a point.</p> <p>I have a method which shows a progress dialog to the user. Then after the code has run I am showing an alert dialog.</p> <p>Here I have got stuck. The progress dialog is not showing when method calls.</p> <p>Code:</p> <pre><code>progressDialog = ProgressDialog.show(NameOfYourActivity.this, "", "Loading. Please wait...", true); </code></pre> <p>Thanks</p>
android
[4]
814,808
814,809
Specific types in implementing class when using an interface
<p>Consider the following code sample:</p> <pre><code>interface IData { int Count(); } interface IOperations { IData Foo(); double Bar(IData a); } class Data1 : IData { public int Count() { return 37; } public double SomethingElse { get; set; } } class Ops1 : IOperations { public Data1 Foo() { return new Data1(); } // want to return specific type here public double Bar(Data1 x) { ... } // want to get specific type here // and not use operator as everywhere } // more definitions of classes Data2, Ops2, Data3, Ops3, ... // some code: Ops1 a = new Ops1(); Data1 data = a.Foo(); // want Data1 here not IData! double x = a.Bar(data); </code></pre> <p>I could of course just use <code>public IData Foo() { return new Data1(); }</code>:</p> <pre><code>// some code Ops1 a = new Ops1(); Data1 data = a.Foo() as Data1; </code></pre> <p>but with <code>as</code> everywhere, the code is quickly becoming confusing.</p> <p>I wonder if there is a good design pattern to achieve this in a clear and strong way?</p> <p><strong>Edit:</strong> Is is important, that Ops and Data share a common base class:</p> <pre><code>List&lt;IOperations&gt; ops = ...; List&lt;IData&gt; data = ...; List&lt;double&gt; result = ...; for(int i=0; i&lt;ops.Count; i++) result[i] = ops[i].Bar(data[i]); </code></pre> <p>So for the case with the return type, I wonder that this is forbidden, because I satisfy the requirement of the interface. In the case with parameters probably there is some additional (template) layer required.</p>
c#
[0]
1,035,090
1,035,091
PHP Class error
<p>I am getting the following error:</p> <p>Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}'</p> <p>The referenced lines are:</p> <pre><code>class Food { private $q = array(); private $nutrients = array(); ... </code></pre> <p>How can I fix this error?</p>
php
[2]
3,801,966
3,801,967
Getting time out error while installing application
<p>Hello everyone I have prepared my project using target <code>android 4.0.3</code>( api level 15). But in case of running the project sum times I get time out error I have also increased the time form DDMS to 60000 ms but still getting error</p> <pre><code>myProject.apk not installed :'timeout' </code></pre>
android
[4]
4,193,395
4,193,396
Understanding this line of jQuery
<p>Line 3906 of jQuery 1.7rc1 is</p> <p><code>expando = "sizcache" + (Math.random() + '').replace('.', ''),</code></p> <p>I don't understand the point of using <code>+ ''</code>. Isn't the above equivalent to</p> <p><code>expando = ("sizcache" + Math.random()).replace('.', ''),</code></p>
jquery
[5]
4,681,998
4,681,999
Is there a tool to monitor sqlite request in android?
<p>Is there a tool, a jar or something that can be plugged to the emulator in android to monitor all sqlite requests passed to the databases of the emulator ? </p> <p>Maybe an equivalent of P6Spy from java-hibernate ?</p>
android
[4]
642,624
642,625
Splitting tags using jquery
<p>I have html output and json output on the same page.</p> <p>What is the way to split the json output from the page?</p> <p>Examples are appreciated</p> <p>Dave</p>
jquery
[5]
4,521,553
4,521,554
javascript: sort an array a certain way with integers and characters
<p>I am trying to sort an array in a specific way and I'm trying to do it efficiently, preferably with the .sort() function. Here is as example of the kind of array I need to work with:</p> <pre><code>["10", "11", "12", "13", "2", "3", "4", "5", "6", "7", "8", "9", "2a", "2s", "3a"] </code></pre> <p>Here is what i am looking for after the sort:</p> <pre><code>["13", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "3a", "2s", "2", "2a"] </code></pre> <p>rules:</p> <p>sort integer values in descending order. integers that have an "a" appended have a lesser value. integers appended with an "s" have a greater value. Therefore, 2a would be inbetween 2 and 1, and 2s would be inbetween 3 and 2. 3a would be greater than 2s. </p> <p>please help!</p>
javascript
[3]
266,468
266,469
Is there any API to get Flight details of US Airways and Indian Airways using PHP
<p>Is there any API to get Flight details of US Airways and Indian Airways. Including Flight timings and everything which are all necessary. </p> <p>Any help will be appreciated...</p> <p>Thanks in Advance</p> <p>Fero</p>
php
[2]
5,154,271
5,154,272
filtering in c# using sql server as database
<p>filtering in c# using sql server as database</p> <p>for example choosing first what to filter in the combobox by choosing student number and in the textfield entering 1001 ...den only 1001 will appear in the datagrid...</p> <p>we are using ssql server</p>
c#
[0]
3,595,313
3,595,314
Creating multiple files dynamically and storing different message in each file
<pre><code>public static void record(Message message)//Message is a class { try { BufferedOutputStream buf=new BufferedOutputStream(new FileOutputStream("E:/kruthika/proj/a.bin")); byte[] b =serializer.serialize(message); buf.write(b); buf.flush(); } catch(Exception e){System.out.print(e);} } </code></pre> <p>this is a small code which serializes my message object(this object contains some text message) and writes it to a binary file. This works perfectly if the object carries only one word for a text but if many words are sent, obviously it is overwritten in the binary file. So how do i alter the snippet to create multiple files dynamically and then store different message in different file? </p>
java
[1]
3,575,042
3,575,043
How to get images size fixed in php?
<p><strong>How do I get images in certain fixed size, example I've attached the image and codes for your review</strong></p> <p><a href="http://i.imgur.com/6MZBi.png" rel="nofollow">Please click on this link (image) to understand my question</a></p> <pre><code> &lt;img src="&lt;?php echo $picfile; ?&gt;" border="0" width="&lt;?php echo $imgsize[0]; ?&gt;" height="&lt;?php echo $imgsize[1]; ?&gt;" align="left" style="border:1px solid black;margin-right:5px;"&gt; </code></pre>
php
[2]
1,287,923
1,287,924
C# Creating a text file contains the error logs
<p>I have created a text file to save the error in that created file. I have a button which, once pressed, generates an error which should be saved to the file. But if I press the button twice, it will overwrite the first error generated, because the contents of the file are overwritten. I want to generate a another separate file to save the new error. A new file should be generated for each new error.</p> <p>Thanks in advance</p>
c#
[0]
4,196,345
4,196,346
Is this an array or an object in Javascript?
<p>Could someone explain this block of code to me and what the type of 'arr' is. I know that an array is an object but</p> <ol> <li>Why does the <strong>[[Class]]</strong> show up as Array if it behaves like an Object</li> <li><p>arr.length returns 3. How?</p> <pre><code>var arr = [0, 1, 3]; arr.name = "asdf"; console.log(arr[1] + " " + arr.name + " " + arr.length); // Returns-&gt; 1 asdf 3 Object.prototype.toString.call(arr); // Returns-&gt; "[object Array]" </code></pre></li> </ol> <p>Whats the deal here?</p> <hr> <p>This has already been answered in good detail in this SO post </p> <p><a href="http://stackoverflow.com/questions/5048371/are-javascript-arrays-primitives-strings-objects">Are Javascript arrays primitives? Strings? Objects?</a></p>
javascript
[3]
2,346,836
2,346,837
subprocess.Popen: how to terminate subprocess and receive its output?
<p>I want to run a shell command from python and receive its output with subprocess.Popen. The problem is, when I close the process, sending Ctrl-C, I don't get any output. What am I doing wrong? Code:</p> <pre><code>&gt;&gt;&gt; import subprocess &gt;&gt;&gt; sub = subprocess.Popen(["xinput", "test", "8"], stdout=subprocess.PIPE) #receive mouse events &gt;&gt;&gt; output = sub.communicate()[0].read() ^CTraceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; File "/usr/lib/python2.6/subprocess.py", line 693, in communicate stdout = self.stdout.read() KeyboardInterrupt &gt;&gt;&gt; output Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; NameError: name 'output' is not defined </code></pre> <p>Inspired by this post by Jett:</p> <p><a href="http://stackoverflow.com/questions/12420999/reading-stdout-from-xinput-test-in-python">Reading stdout from xinput test in python</a></p>
python
[7]
3,893,316
3,893,317
C++ overloaded method pointer
<p>How do I get a method pointer to a particular overload of a method:</p> <pre><code>struct A { void f(); void f(int); void g(); }; </code></pre> <p>I know that</p> <pre><code>&amp;A::g </code></pre> <p>is a pointer to <code>g</code>. But how do I get a pointer to <code>f</code> or <code>f(int)</code>?</p>
c++
[6]
1,190,548
1,190,549
iphone app submitting fails
<p>I'm attempting to submit my app, and I'm getting no record found for the app on itunesconnect... I have added the app on itunesconnect, and have set up all the app ID, CRS, etc.</p> <p>Why could it be? </p> <p>Please help me out...</p>
iphone
[8]
3,479,227
3,479,228
cannot write to the registry key
<p>I am getting error cannot write to the registry key when i am trying to save my keys in the registry .</p> <p>//Here is my code . </p> <p>Note : I tried to run as an Administartor assuming some permission problems still getting the same error ....</p> <pre><code>private const string RegistryKeyName = "Skms"; private readonly RegistryKey SoftwareKey = Registry.LocalMachine.OpenSubKey("SOFTWARE"); public KeyManagementRegistryKeyChangeImpl(bool writeable) { this.writable = writeable; RegistryKey skms; if (Environment.Is64BitOperatingSystem == true) { skms = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(RegistryKeyName,true); } else { skms = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry32); } if (null == skms) { skms = SoftwareKey.CreateSubKey(RegistryKeyName, RegistryKeyPermissionCheck.ReadWriteSubTree); } if(skms == null) { throw new System.ArgumentException(string.Format(CultureInfo.InvariantCulture, @"Registry Key 'HKEY_LOCAL_MACHINE\SOFTWARE\{0}' not found or created", RegistryKeyName)); } Decryptor decryptor = Decryptor.Create(); </code></pre>
c#
[0]
4,203,031
4,203,032
Large data insertion
<p>I have a csv file uploaded and data read into an array .The valid data is stored in the array as associative array indexed from 0-4000 records</p> <pre><code>Array ( [0] =&gt; Array ( [uname] =&gt; uname1 [name] =&gt; fullname1 [email] =&gt; [email protected] ) [1] =&gt; Array ( [uname] =&gt; uname2 [name] =&gt; fullname2 [email] =&gt; uname2 ) [2] =&gt; Array ( [uname] =&gt; uname3 [name] =&gt; fullname3 [email] =&gt; uname3@email ) [3] =&gt; Array ( [uname] =&gt; uname3 [name] =&gt; fullname3 [email] =&gt; uname3@email ) .. ... [3999] =&gt; Array ( [uname] =&gt; uname3 [name] =&gt; fullname3 [email] =&gt; uname3@email ) ) </code></pre> <p>How can i insert so many records because the <code>$array</code> is stored in variable when i click the submit the <code>$array</code> is reset to null. How can I approach this without using database, any solution available?</p>
php
[2]
5,242,899
5,242,900
When to release row after reloading table data?
<p>This method below works, but I don't know when rowdata should be released.</p> <pre><code>-(void)refreshTable:(NSMutableArray *) tbdata{ rowdata=[tbdata retain]; [tabledata reloadData]; } </code></pre> <p>This version below causes an error:</p> <pre><code>-(void)refreshTable:(NSMutableArray *) tbdata{ rowdata=[[tbdata retain] autorelease]; [tabledata reloadData]; } </code></pre> <p>As does this version below:</p> <pre><code>-(void)refreshTable:(NSMutableArray *) tbdata{ rowdata=[tbdata retain]; [tabledata reloadData]; [rowdata release] } </code></pre> <p>When should I release rowdata? </p>
iphone
[8]
3,711,946
3,711,947
Script for identifying a country
<p>I'm in a bit of a trouble. I have developed a script, which finds a users country. The script returns the native version of the country; eg. Denmark (English) is Danmark (Danish) on the server. Is there a fast way to convert it to English?</p>
php
[2]
5,075,036
5,075,037
Visual C++ 6.0 Link Error
<p>Does anybody know about this linker error in Visual C++?</p> <blockquote> <p>PGPkeys.obj : error LNK2001: unresolved external symbol _<em>imp</em>_PGPclCloseClientPrefs</p> </blockquote>
c++
[6]
3,069,813
3,069,814
blur(); on middle mouse click
<p>I've searched google, this and other forums, but to no avail… sooooo, is it possible to have something like onMiddleClick="blur();" to hide the focus border of a link on middle mouse click?</p>
javascript
[3]
2,734,628
2,734,629
python for loop tuple index out of range
<p>I'm still trying to get the hang of python, so bear with me. please. I have this bit of code that I'm using from a book. The book does not properly show the white space in the code, so the spacing is my best guess. This code is supposed to break the results of a MySQL query into a more readable format. </p> <pre><code>if form is True: columns_query = """DESCRIBE %s""" % (table) print columns_query columns_command = cursor.execute(columns_query) headers = cursor.fetchall() column_list = [] for record in headers: column_list.append(record[0]) output="" for record in results: output = output + "===================================\n\n" for field_no in xrange(0, len(column_list)): output = output + column_list[field_no] + ": " + str(record[field_no]) + "\n" output = output + "\n" </code></pre> <p>When I try to run it, I get the following:</p> <pre><code>Traceback (most recent call last): File "odata_search.py", line 46, in &lt;module&gt; output = output + column_list[field_no] + ": " + str(record[field_no]) + "\n" IndexError: tuple index out of range </code></pre> <p>It has something to do with the <code>str(record[field_no])</code> portion of the code, but that's what it looks like in the book, so I'm not sure what else to try.</p>
python
[7]
5,107,040
5,107,041
Triggering click with jQuery to hit code-behind function not working in 1.4 - Worked fine in 1.3.2
<p>I have a gridview in an update panel and am using a jQuery dialog for adding entries. </p> <p>The dialog calls an AJAX/JSON function that adds the entry. On success of that function I have jQuery trigger a button click on a hidden button </p> <pre><code> ... success: function(msg) { $("[id$='_btnUpdateGrid']").trigger('click'); $("#new_dialog").dialog('close'); }, ... </code></pre> <p>which should hit an event handler in the code behind to update the datasource and refresh the gridview. </p> <pre><code>&lt;asp:Button ID="btnUpdateGrid" runat="server" OnClick="btnUpdateGrid_Click" Text=" " Width="1px" Height="1px" Style="background-color:#F5F3E5; border:none;" /&gt; </code></pre> <p>This has worked just fine with 1.3.2. Updated to 1.4.1 and it no longer hits the code-behind. The AJAX still works but I have to manually refresh the page to update the grid. </p> <p>Also, I can hit client side event handlers (e.g OnClientClick="alert('hello')") so I know the click is still happening just not the code-behind event handler. It's like jquery is somehow blocking the page from doing just that now. I have verified this by just changing the version number in the script reference path and seeing the functionality change.</p> <p>Is this a bug or s there another way I'm supposed to do this now? </p>
jquery
[5]
2,788,177
2,788,178
installing php 5.4 on mac, change version?? (returns older version?)
<p>Im trying to update php to 5.4, and I think ive installed it with <a href="http://php-osx.liip.ch/" rel="nofollow">http://php-osx.liip.ch/</a>. But when i do <code>php -v</code> it says that i have 5.3.15. But if i do <code>/usr/local/php5/bin/php -v</code> it says 5.4.9. Is there something i should change to get 5.4 as default?</p> <p>here's a pic of Terminal: <img src="http://i.stack.imgur.com/YzI2n.png" alt="enter image description here"></p> <p>(never done this before, sorry if its a stupid question.)</p>
php
[2]
1,985,704
1,985,705
Remove the Selection of text in textBox in C#
<p>I have a textbox.In that I have to allow the user to type some thing in that textbox and i also restrict the user not to select the typed text in that textbox.I have need not to allow the white space at the start of the text box and also i have need not allow the user to type more that 32 characters.Thsi is my code.</p> <pre><code> private void txtApplication_Title_KeyPress(object sender, KeyPressEventArgs e) { txtApplication_Title.Text = txtApplication_Title.Text.Remove(txtApplication_Title.SelectionStart, txtApplication_Title.SelectionLength); if (txtApplication_Title.Text.Length== 0) { e.Handled = (e.KeyChar == (char)Keys.Space); } int count_charac = txtApplication_Title.Text.Length + 1 ; if (count_charac &gt; 32) { lblApplication_name.Text = data_variables.RES_TXT_STRING_EXCEEDING_APPLICATION_NAME; timer1.Interval = 7000; timer1.Enabled = true; timer1.Tick += new System.EventHandler(OnTimerEvent_Application_name); } } public void OnTimerEvent_Application_name(object sender, EventArgs e) { lblApplication_name.Text = " "; timer1.Dispose(); } </code></pre> <p>Here in this code.I am able to restrict the user to 32 characters.And i try to press space at the start it does not allow me.It allows the selection of text using Shift+Arrow key. I do know how to block the selection.Another thing is suppose I try Hello and I select Hell and pressing the space directly it starts allowing the space in the text box.Can any one help me.Thanks in advance</p>
c#
[0]
5,383,312
5,383,313
Do I need to compile my php files?
<p>Hi i'm used to programming with ASP.Net but i got just landed a project doing PHP development.. My question is this, in ASP.Net if you make changes in the code behind you have to recompile the app before uploading. Is it the same with PHP? I know it's not a compiled language but I want to know if I can make changes to the PHP code in a single file and upload and see my changes?</p> <p>Thanks in advance!</p>
php
[2]
1,148,563
1,148,564
PHP Scrape Mp3 File
<p>I am embedding some mp3 files on my website. The problem is some of the names are different and my website does not know how to embed - unless I define all the files with the correct names.</p> <p>For example,</p> <p><code>http://example.com/chapter1/book-[some random name].001.mp3</code></p> <p>I have set up my website so it embeds like this</p> <p><code>http://example.com/chapter1/book.001.mp3</code></p> <p>Is there any possible solution that I can use with php so it auto fills the <code>[some random name]</code>.</p>
php
[2]
3,868,952
3,868,953
Need help developing an animated iPhone game
<p>I am developing a game in which several objects are moving. Here is an example of what I have so far: </p> <pre><code>NSArray * imageArray = [[NSArray alloc] initWithObjects:[UIImage imageNamed:@"1.png"], [UIImage imageNamed:@"2.png"], [UIImage imageNamed:@"3.png"], [UIImage imageNamed:@"4.png"], [UIImage imageNamed:@"5.png"], [UIImage imageNamed:@"6.png"], [UIImage imageNamed:@"7.png"], [UIImage imageNamed:@"8.png"], [UIImage imageNamed:@"9.png"], [UIImage imageNamed:@"10.png"], [UIImage imageNamed:@"11.png"], [UIImage imageNamed:@"12.png"], nil]; ryuJump = [[UIImageView alloc] initWithFrame:CGRectMake(100, 125, 150, 130)]; x=100; y=125; ryuJump.animationImages = imageArray; ryuJump.animationDuration = 1.1; ryuJump.contentMode = UIViewContentModeBottomLeft; [self.view addSubview:ryuJump]; [ryuJump startAnimating]; </code></pre> <p>However, I'm concerned that this will be very heavy, and may cause memory leaks if I create all my animations like this. Please help me decide which method I should use.</p>
iphone
[8]
1,387,121
1,387,122
Is there a difference between $().ready() and $(document).ready()
<p>I've seen some code where they just do this:</p> <pre><code>$().ready(function() { ... }); </code></pre> <p>This is shorter than doing a document selector but is it the same thing?</p>
jquery
[5]
4,921,606
4,921,607
How to determine which web service should be used alongside php to call the pastebin api?
<p>I want to develop an app using the api provided by pastebin.com , using php . What I am not able to figure out is which web service like SOAP , etc , should be used to do this work ?</p>
php
[2]
101,095
101,096
How to go back from google play to my app
<p>I want to call one app from another and if the app is not installed on device mean i get the control to google play store to install the app(these things are going well).But once download finished,i want to remove the googleplay activity and get back the control to my app.how will i do this one?thanks in advance....</p>
android
[4]
4,980,058
4,980,059
Parent.FrameName.FunctionName is not working in Mozilla
<p>This is what I am having in the page </p> <pre><code>&lt;frameset border="0" frameborder="0" frameSpacing="0"&gt; &lt;frame name="banner" src="one.aspx?tab=" marginwidth="0" marginheight="0"&gt; &lt;frame name="filter" src="two.aspx" marginwidth="0" marginheight="0"&gt; &lt;/frameset&gt; </code></pre> <p>and I am trying to call </p> <pre><code>Parent.filter.FuntionName. </code></pre> <p>This FuntionName is a javascript function which is in the one.aspx. </p> <p>The issue is, this is working fine in IE while it is not working in MOZILLA. Is there any alternative for this statement.</p>
javascript
[3]
1,881,009
1,881,010
C# loop statements, help needed for a newbie
<p>I’m quite a newbie at c# and need some help with some loop statements.</p> <p>I’m practising by designing a program that calculates cost per mile (which is 50p) and adds £30.00 every 1000 as a wear $ tear charge.</p> <p>I’m having problems getting my head around the logic, if anyone could give me a few tips that would be great.</p> <pre><code>namespace ConsoleApplication10 { class Program { static void Main(string[] args) { Console.WriteLine("Input start milleage:"); decimal StartMile = Convert.ToDecimal(Console.ReadLine()); Console.WriteLine("Input Finish milleage:"); decimal FinishMile = Convert.ToDecimal(Console.ReadLine()); decimal TotalMilleage = FinishMile - StartMile; if (TotalMilleage &lt; 1000) TotalMilleage = TotalMilleage / 2; Console.WriteLine("Total charge for hire:{0:C}", TotalMilleage); Theres the code Ive done so far :S </code></pre>
c#
[0]
132,561
132,562
PHP Cookie Set expiry time to none
<p>i am setting a cookie but having some issue , currently the cookie format is this</p> <pre><code>setcookie("company_id", $company_id, 0, '/'); </code></pre> <p>So expiry time is set to 0 means cookie will never expire , but when i tried to not to set any expiry time so i passes an empty argument in the third parameter like this </p> <pre><code>setcookie("company_id", $_POST["company_id"], "", '/'); </code></pre> <p>But this is not working , cookie is not getting, when i changed the empty argument to 0 it than start working, any suggestions ?? what i am doing wrong ?</p>
php
[2]
4,030,189
4,030,190
Php not handling logic of true and false correctly
<p>I'm trying to register a new username in an empty table in my database. So I pass in the username and UID and check to see if the user has that name registered already and accept the request or if nobody has the name I can accept it. If there name is registered to another user i reject the request.</p> <p>It always returns 'Fail' from this bit of code below.</p> <pre><code> if($name_found) { if ($udid_mismatch) { echo "Fail"; } </code></pre> <p>But the table of this DB is empty so it cannot be true that it finds the name or UID. Can anybody see my mistake? I'm running in circles at the moment.</p> <pre><code>// Localize the GET variables $udid = isset($_GET['udid']) ? $_GET['udid'] : ""; $name = isset($_GET['name']) ? $_GET['name'] : ""; // Protect against sql injections $udid = mysql_real_escape_string($udid); $name = mysql_real_escape_string($name); $udid_mismatch=false; $name_found=false; $result = mysql_query("SELECT udid FROM ir_usernames WHERE name='$name'"); while( $row = mysql_fetch_assoc($result) ){ $name_found=true; if($row['udid'] != $udid){ $udid_mismatch=true; } break; } if($name_found) { if ($udid_mismatch) { echo "Fail"; } else { echo "Success"; } } else { // Insert the username $retval = mysql_query("INSERT INTO $table( udid, name ) VALUES ( '$udid', '$name' )",$conn); if($retval) { echo "Success"; } else { echo "Fail_ret"; } } mysql_close($conn); </code></pre> <p>Many Thanks, -Code</p>
php
[2]
2,282,421
2,282,422
android mediaplayer bacgroung loading
<p>how can i load a file into mediaplayer while showing a splash screen in the foregroung ,i mean after splash sceen i want to display video on the screen directly without wait </p>
android
[4]
5,059,116
5,059,117
How to check if string is in column value of returned DataRow array in C#?
<p>I know this is very basic, but I can't seem to get it right. I have this datatable that I will fill with processed information from my database. </p> <p>After searching if the EmpRequestID has already been added in the Datatable, I want to be able to get the value of the column named "RequestedEmp" of the returned row and check if already contains the initials that my variable is currently hosting (it is in a loop). If it does not, append the initials in the variable in the existing initials in the row. </p> <pre><code>DataRow[] MyEmpReq_Row = MyEmpRequests_DataTable.Select("EmpRequestID='" + EmpRequestID + "'"); int SameReqID = MyEmpReq_Row.Length; if (MyEmpReq_Row &gt; 0) //REQ ID IN DT, MULTIPLE EMP 1 REQUEST { //INSERT HERE } else //ID NOT IN DT YET { MyEmpRequests_DataTable.Rows.Add(EmpRequestID, ActionBy, Requested_Initials, DateSubmitted, RequestStatus); } </code></pre> <p>I want to be able to do something like this</p> <pre><code>string RetrievedInitials = MyEmpReq_Row["RequestedEmp"].ToString(); if (RetrievedInitials LIKE '%" + Requested_Initials + "'") // but if statements doesnt have LIKE </code></pre> <p>or this and then know if the column contains the value or not. </p> <pre><code>MyEmpReq_Row.Select("RequestedEmp LIKE '%" + Requested_Initials + "'"); </code></pre>
c#
[0]
1,868,893
1,868,894
Why is this C# code kicking up an error?
<p>real newbie question but why doesn't this work? I am getting </p> <blockquote> <p>use of unassigned variable 'comparison'</p> </blockquote> <p>as the error</p> <pre><code> string comparison; Console.WriteLine("Enter the first number"); int firstNum = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter the second number"); int secondNum = Convert.ToInt32(Console.ReadLine()); if (firstNum == secondNum) comparison = "equals to"; if (firstNum &lt; secondNum) comparison = "less than"; if (firstNum &gt; secondNum) comparison = "greater than"; Console.WriteLine("{0}",comparison); </code></pre>
c#
[0]
2,342,218
2,342,219
C++ throw dereferenced pointer
<p>What is the type of the exception object in the following thrown:</p> <p>Question1> <code>range_error r("error"); throw r;</code></p> <p>Answer1> an object of range_error</p> <p>Question2> <code>exception *p = &amp;r; throw *p;</code></p> <p>Answer2> a sliced object of exception</p> <p>Question3> <code>exception *p = &amp;r; throw p;</code></p> <p>Answer3> a pointer pointing to range_error is thrown. The capture-handling can access the range_error member functions through dynamic binding.</p> <p>Do I get these question right?</p> <p>// Updated and Compiled and Run on VS2010</p> <pre><code>#include &lt;iostream&gt; using namespace std; class ExClassA { public: virtual void PrintMe() const { cout &lt;&lt; "ExClassA" &lt;&lt; endl; } }; class ExClassB : public ExClassA { public: virtual void PrintMe() const { cout &lt;&lt; "ExClassB" &lt;&lt; endl; } }; int main(int argc, char* argv[]) { ExClassB exClassB; ExClassA *p = &amp;exClassB; try { throw *p; } catch (const ExClassA&amp; e) { e.PrintMe(); } try { throw p; } catch (const ExClassA* e) { e-&gt;PrintMe(); } } </code></pre> <p>The first try-catch of above program prints "ExClassA"</p> <p>The second try-catch of above program prints "ExClassB"</p>
c++
[6]
770,400
770,401
change querystring value with jquery
<p>i am using a jquery Script to create a Tab Panel. Now, what i need is to change the querystring value on click on each tab. can we do this without page refresh.</p> <p>I am using below script for tab panel.</p> <pre><code>function tabPanel() { var tabContent = $('div.tabsBG &gt; div.tabsWrapper'); tabContent.hide().filter(':first').show(); $('ul#tabLinks li a').click(function(){ tabContent.hide(); tabContent.filter(this.hash).show(); $(this).parent('li').addClass('tabactive'); return false; }).filter(':first').click(); } </code></pre> <p>Dummy URL of the page: <a href="http://www.anyurl.com/tabpage.aspx?tabid=1" rel="nofollow">http://www.anyurl.com/tabpage.aspx?tabid=1</a></p> <p>So, i need to change the TabID on click on tabs.</p> <p>Thanks in advance.</p>
jquery
[5]
2,946,959
2,946,960
Modify URL in php
<p>I want to modify following url <a href="http://www.gonzaga.edu/../../../../Files/About/Images/300x200/baseball_panorama_hz.jpg" rel="nofollow">http://www.gonzaga.edu/../../../../Files/About/Images/300x200/baseball_panorama_hz.jpg</a> into <a href="http://www.gonzaga.edu/Files/About/Images/300x200/baseball_panorama_hz.jpg" rel="nofollow">http://www.gonzaga.edu/Files/About/Images/300x200/baseball_panorama_hz.jpg</a>.</p> <p>Thanks.</p>
php
[2]
6,001,981
6,001,982
jQuery: How do i trigger event / do something when select option is selected?
<p>Can anyone let me know the best way to trigger an event once a select option has been clicked on and chosen?</p> <p>I want to run some additional JavaScript once the user has selected their option.</p>
jquery
[5]
1,375,685
1,375,686
Corner radius for a navigation bar
<p>i have developed an iPad app. In that app i have 4 separate views embedded inside a single view controller and there is a navigation bar for each view.I want to set the corner radius of each navigation bar.</p> <p>i tried</p> <pre><code> customNavigationBar.layer.cornerRadius = 25; </code></pre> <p>but this piece of code is not working. Does anyone know how to set the corner radius for each navigation bar.</p>
iphone
[8]
2,474,373
2,474,374
Which is the best way to send email using PHP
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5994732/what-is-the-best-practice-to-send-emails-from-php-script">What is the best practice to send emails from PHP script?</a> </p> </blockquote> <p>I would like to setup an email application, which is the best method to use in sending emails through PHP and make sure that emails sent through the application is not considered SPAM?</p>
php
[2]
3,108,478
3,108,479
Iphone tableview time show in seconds
<p>In iphone application I have a table view having 5 rows. first row is for showing the decreasing digit like time in second. i.e 30,29,28.......0. this is for user to choose a action from table view within 30 seconds. how this will implement?</p> <p>Thanks, Aaryan</p>
iphone
[8]
3,655,116
3,655,117
What is the difference between AVAudioPlayer and MPMusicPlayerController?
<p>It looks like both of them can play audio file. What is the difference between AVAudioPlayer and MPMusicPlayerController?</p> <p>Welcome any comment</p> <p>Thanks interdev</p>
iphone
[8]
1,434,832
1,434,833
parse JSON function
<p>Can someone explain to me how this parse function actually works?</p> <pre><code>function parseFlickrJson(jsonstring){ var data=null; var jsonFlickrApi=function(d){ data = d; } eval(jsonstring); return data; } </code></pre>
javascript
[3]
2,428,294
2,428,295
How does getExternalCacheDir() work on Android?
<p>From what I understand, we cache the frequently accessed objects in a memory segment that is more easily accessible than normal disk reads.</p> <p>getExternalCacheDir(), as opposed to getCacheDir() points to the external filesystem - which seems to me as a normal getExternalFilesDir(). How does Android optimize access to ExternalCacheDiir ? Is it something like the "swap" space on Linux ?</p> <p>Thanks !</p>
android
[4]
6,008,051
6,008,052
How to control the orientation of the device in iphone / ipod?
<p>i have to do something on rotation the device on the portrait mode but when i use the </p> <pre><code>(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations //[[[UIApplication sharedApplication]keyWindow]subviews removeFromSuperview ]; // return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); return YES; } </code></pre> <p>following code and it work fine on the simulator but when i use to install the code in the device it make the device so much sensitive that if i just a little change the position in the device it execute this code and go to the view that i m showing on the rotation of the phone than pls anyone tell me that how can i control the sensitivity of the device i mean that i just want when user complete a 90' rotation in the position than my code should execute but it just execute if just shake the phone in the same position .</p> <p>thanks for any help </p> <p>Balraj verma </p>
iphone
[8]
2,782,410
2,782,411
How to make onmouseover events always on
<p>I have an image map that uses a third party script(mapper.netzgesta.de) to highlight the different areas of the image map. Basically the script adds onmouseover events to the areas via javascript. How can i have the areas already on when the page is loaded as opposed to any user based event?</p> <p>I already have onload events and cant interfere with those. All the other events depend on user interaction. The cms i am using currently doesnt work with jquery.</p> <p>any suggestions?</p>
javascript
[3]
1,271,253
1,271,254
if(objValue instanceof Date) objValue store string its work or not?
<pre><code>Object objValue = null; objValue = mapAcctProfParam.get(strKey).toString(); if(objValue instanceof Date){ objValue = DateUtilities.stringFromDate(new Date(((Date)objValue).getTime()), "dd/MM/yyyy HH:mm:ss"); debugLog(MODULE_NAME," going to DateUtilities"+objValue); } </code></pre> <p>if(objValue instanceof Date) is it always return false ,what is the solution for it.</p>
java
[1]
4,613,969
4,613,970
Device SERIAL ID in android 1.6
<p>how can i get serial number in API level 3?</p>
android
[4]
5,270,792
5,270,793
how to get cascading listboxes
<p>I have two listboxes on my page Say ListBox A and ListBox B. I am populating data into ListBox A using generic lists.</p> <p>I want to populate ListBox B based on ListBox A selection </p> <p>Could someone please guide me how to do that</p>
asp.net
[9]
2,735,218
2,735,219
Spliting to 2D array
<p>How I can split a string into 2D array. String is like</p> <pre><code>1c2c3r4c5c6r6c8c9 </code></pre> <p>array shld be like</p> <pre><code>[[1,2,3], [4,5,6], [7,8,9]] </code></pre>
javascript
[3]
2,988,661
2,988,662
How to distinguish Windows 7 and Windows 2008 R2
<p>I need to distinguish Windows 7 and Windows 2008 R2 but I don't know how to. The OS Version property return the same number "6.1.7600.0"</p> <p>Regards,</p> <p>Florian</p>
c#
[0]
1,628,919
1,628,920
Get returned by __enter__ in __exit__
<p>For example, i have this code:</p> <pre><code>with MyClass() as x: print 'I have only {0}'.format(x) with MyClass() as y: print 'I have {0} and {1}'.format(x, y) print 'Again only {0}'.format(x) </code></pre> <p><code>x</code> and <code>y</code> both should be de-initialized after exit of corresponding <code>with</code> blocks. Also <code>x</code> and <code>y</code> aren't instances of <code>MyClass</code>.</p> <p><code>__exit__</code> has only three arguments and each argument is None (if no exception supplied).</p> <p>How can i determine at <code>__exit__</code> which block is just exited and what value was returned by <code>__enter__</code>?</p> <p>(N.B. code should be thread-safe).</p> <hr> <p>Example:</p> <pre><code>class MyClass(object): def __enter__(self): if moon_phase &gt; 0: return 123 else: return 456 def __exit__(self): number = what_was_returned_by_enter() print 'End of block with', number with MyClass() as x: print x # 123 with MyClass() as y: print x, 'and', y # 123 and 456 # printed "End of block with 456" print x # 123 # printed "End of block with 123" </code></pre>
python
[7]
2,107,942
2,107,943
Method must have a return type
<pre><code> public writer (string name,string lastname,string number) { StreamWriter Wrt = new StreamWriter("D:\\Sample.txt",true); Wrt.WriteLine(name); Wrt.WriteLine(lastname); Wrt.WriteLine(number); Wrt.WriteLine("#"); Wrt.Close(); } </code></pre> <p>there an error that Method must have a return type! how do i fix it? what's wrong?</p>
c#
[0]
84,950
84,951
Javascript help, writing html elements
<p>How do I write this HTML using javascript.</p> <pre><code>&lt;div id="resizeControl"&gt; &lt;input type="image" src="resuce.png" /&gt; &lt;input type="image" src="enlarge.png" /&gt; &lt;/div&gt; </code></pre> <p>and append it to a slidegallery object..</p> <p>.net</p>
javascript
[3]
5,560,298
5,560,299
jQuery selector for the child of a parent's previous sibling
<p>For each stat block like the following:</p> <pre><code>&lt;div class="stats"&gt; &lt;div class="label"&gt; &lt;span class="goal"&gt;10 YEARS OF SOMETHING GOOD&lt;/span&gt; &lt;/div&gt; &lt;div class="stat"&gt; &lt;div class="tri"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I want to set the marginRight of <code>tri</code> to half the width of the previous <code>goal</code>. Which jQuery selector would I use to grab the previous 'goal' relative to each <code>tri</code> ?</p> <p>Something like..</p> <pre><code>$(function(){ $('.tri').css({marginRight: function() { return Math.floor($(this).something('.goal').width() / 2) + 'px'; }}) }) </code></pre>
jquery
[5]
3,387,217
3,387,218
Bringing my Alarm to the front
<p>I had a few problems with my alarm that are in a another thread <a href="http://stackoverflow.com/questions/9933732/alarm-manager-not-working-how-i-want">here</a> if anyone could help but anyway here is a new question. If I set an alarm using my app, say for 5 minutes from now, and then close the app, how would I code it so that my app activity comes back to the front? </p> <p>This is basically the same as the clock app already on most android phones. I'm doing this to allow the user to stop the alarm. Would I be right in saying that I would have to modify my existing code to, when the alarm is run, launch a new intent to bring the activity to the front? Or can I simplify this and only have an alertdialog or something open instead of opening the entire app?</p> <p>Any links would be appreciated</p> <p>Thanks</p>
android
[4]
3,249,111
3,249,112
get size of string pointed to by a position memory pointer
<p>I want to get characters of a string pointed by a position memory pointer in native C++:</p> <p>for an equivalent implementation in C#, it will be:</p> <pre><code>int positionMemory = getPosition(); long size = 10; string result = Marshal.PtrToStringAnsi(new IntPtr(positionMemory), size); </code></pre> <p>How can I produce the result in C++? </p> <p>Thanks in advance. </p>
c++
[6]
477,259
477,260
how do i get the attribute value with comparing another attribute?
<pre><code>&lt;tbody&gt; &lt;tr class="taskEditRow" rowid="1" level="0" taskid="-1" __template="TASKROW"&gt; &lt;tr class="taskEditRow" rowid="2" level="1" taskid="-2" __template="TASKROW"&gt; &lt;tr class="taskEditRow" rowid="3" level="2" taskid="-3" __template="TASKROW"&gt; &lt;tr class="taskEditRow" rowid="4" level="2" taskid="-4" __template="TASKROW"&gt; &lt;/tbody&gt; </code></pre> <p>here i want to get the rowid with comparing task id using jquery</p> <pre><code>var x=$(".taskEditRow").attr("taskid==-1"); var y=x.attr("rowid"); </code></pre> <p>like i want rowid with comparing of taskid</p>
jquery
[5]
2,664,262
2,664,263
Is the constructor of a class called if you declare a object of that class as an instance variable of another class?
<p>For example, if i have a class like this;</p> <pre><code>#import "B.h" class A { B object; }; </code></pre> <p>would B's constructor get called when I created a A object?</p>
c++
[6]
1,302,879
1,302,880
How a value will be rounded in Linux environment?
<p>I have a small program collect data from Oracle Database and show on GUI in Linux. At database: value = 4.25 But after I get value and show data on GUI with type double. I have value = 4.2</p> <p>In Linux machine, How a value will be rounded? (value greater than 0.005 will be rounded to 0.01 or value greater and equal 0.005 will be rounded to 0.01)</p> <p>Ex:</p> <pre><code>#1/ 4.25 will be rounded to 4.2 #2/ 4.25 will be rounded to 4.3 </code></pre> <p>Which one is true: #1 or #2?</p> <p>Please help me verify this problem.</p>
java
[1]
4,211,611
4,211,612
doubt in for loop
<p>i have the following code</p> <pre><code>public static void main(String[] args) { int x=0; int y=0; for(int z=0;z&lt;5;z++) if((++x&gt;2)||(++y&gt;2)) x++; System.out.println(x+" "+y); } </code></pre> <p>For this the output is 8 2</p> <pre><code>public static void main(String[] args) { // TODO Auto-generated method stub int x=0; int y=0; for(int z=0;z&lt;5;z++){ if((++x&gt;2)||(++y&gt;2)) x++; System.out.println(x+" "+y); } } </code></pre> <p>i can understand the second code that it prints everytime till the loop completes. For the first code when x becomes 3 in the if loop value will be incremented to 4 and after that what well happen will it go to sop or to for loop to complete the loop?</p>
java
[1]
4,451,621
4,451,622
logic of Garbage collector in java
<p>As we know Garbage collector is Thread in java. And every thread will have its logic to execute. So i wanted to know what logic does this Garbage collector use which maintains the memory so well.</p> <p>thanks</p>
java
[1]
872,968
872,969
Read/writing to a file which is definitely going to be in use at random times
<p>I need to read a text based log file to check for certain contents (the completion of a backup job). Obviously, the file is written to when the job completes. </p> <p>My question is, how can I (or how SHOULD I write the code to) read the file, taking into account the file may be locked, or locked by my process when it needs to be read, without causing any reliability concerns.</p>
c#
[0]
3,776,898
3,776,899
Python: get list indexes using regular expression?
<p>In Python, how do you get the position of an item in a list (using <code>list.index</code>) using fuzzy matching?</p> <p>For example, how do I get the indexes of all fruit of the form <code>*berry</code> in the following list?</p> <pre><code>fruit_list = ['raspberry', 'apple', 'strawberry'] # Is it possible to do something like the following? berry_fruit_at_positions = fruit_list.index('*berry') </code></pre> <p>Anyone have any ideas?</p>
python
[7]
3,895,116
3,895,117
How can I set dialog style in my custom theme?
<p>I tried in many ways but I can't change the AlertDialog style from xml.</p> <p>The result I would is to define an XML style for dialogs extending and overriding the default and then bind it in my theme, so all the alertDialogs will looks the same.</p> <p>I tried:</p> <pre><code>&lt;style name="AppTheme" parent="AppBaseTheme"&gt; &lt;!-- All customizations that are NOT specific to a particular API-level can go here. --&gt; &lt;item name="android:alertDialogStyle"&gt;@style/pippo&lt;/item&gt; &lt;/style&gt; &lt;style name="pippo" parent="@android:style/Theme.Dialog"&gt; &lt;item name="android:bottomBright"&gt;@android:color/holo_orange_dark&lt;/item&gt; &lt;item name="android:bottomDark"&gt;@android:color/holo_orange_dark&lt;/item&gt; &lt;item name="android:bottomMedium"&gt;@android:color/holo_orange_dark&lt;/item&gt; &lt;item name="android:centerBright"&gt;@android:color/holo_orange_dark&lt;/item&gt; &lt;item name="android:centerDark"&gt;@android:color/holo_orange_dark&lt;/item&gt; &lt;item name="android:centerMedium"&gt;@android:color/holo_orange_dark&lt;/item&gt; &lt;item name="android:fullBright"&gt;@android:color/holo_orange_dark&lt;/item&gt; &lt;item name="android:fullDark"&gt;@android:color/holo_orange_dark&lt;/item&gt; &lt;item name="android:topBright"&gt;@android:color/holo_blue_dark&lt;/item&gt; &lt;item name="android:topDark"&gt;@android:color/holo_blue_dark&lt;/item&gt; &lt;/style&gt; </code></pre> <p>and then I put in the manifest "AppTheme" as activity theme, but I still see normal alertdialogs.</p> <p>Where I do wrong?</p>
android
[4]
5,370,786
5,370,787
jquery dropdown only when current button is hovered
<p>I am new to jQuery and am not sure how to solve this jQuery dropdown problem I am having. </p> <p>When you hover over one of the links, the dropdown menu works fine, however I have added a second dropdown to the navigation, and now when you hover one of the links, both the dropdowns are revealed. I only want the current dropdown menu to be revealed. </p> <p>Here is my code, and a link to jsfiddle <a href="http://jsfiddle.net/K2Zzh/1/" rel="nofollow">http://jsfiddle.net/K2Zzh/1/</a>...</p> <pre><code>$('.dropdown ul').hide(); $('.dropdown').hover(function(){ $('.dropdown ul').stop().slideDown(500); },function(){ $('.dropdown ul').stop().slideUp(200); }); </code></pre> <p>I know why it is doing what it is doing, and I know I should be using a <code>this</code> somewhere but I am not sure where.</p>
jquery
[5]
4,725,491
4,725,492
Calculating difference between dates in arraylist, based on a condition
<p>My ArrayList() is populated with VO, which contains startDate(010112),endDate(310112),month(1,2,3 ...12) and criteria(A,B,C)</p> <p>I need to calculate the difference between startDate and endDate in my arralist for criteria A and B.</p> <p>Ex: ArraList1 - <strong>startDate(010112)</strong>,endDate(310112),month(1),criteria(A) ArraList2 - startDate(010212),endDate(260212),month(2),criteria(B) ArraList3 - startDate(260212),<strong>endDate(250312)</strong>,month(3),criteria(B) ArraList4 - startDate(250312),endDate(310412),month(4),criteria(C)</p> <p>output : difference between (<strong>startDate(010112),endDate(250312)</strong>) , Any help is much appreciated.</p>
java
[1]
5,339,632
5,339,633
Search box disappears when clicked
<p>I have a sliding image panel that uses </p> <pre><code>$('input').click(function() { $(this).parent().slideUp(); </code></pre> <p>Unfortunately the input part on the sliding panel causes the search box at the top of the page to disappear when clicked on because the search form uses "input type="text" etc. is there a way to get around this? Here is the code that makes the sliding panel work <a href="http://jsfiddle.net/pcD8D/7/" rel="nofollow">http://jsfiddle.net/pcD8D/7/</a></p> <p>and the code for the searchform is: </p> <pre><code> &lt;!--BEGIN #searchform--&gt; &lt;form class="searchform" method="get" action="&lt;?php bloginfo( 'url' ); ?&gt;"&gt; &lt;input type="text" class="textBox" name="s" onclick="this.value=''" value="Enter your search" tabindex="1" /&gt; &lt;img src="&lt;?php bloginfo('stylesheet_directory'); ?&gt;/images/clearBtn.png" width="17" height="17" class="cancelBtn" alt="ClearBtn" /&gt; &lt;!--END #searchform--&gt; &lt;/form </code></pre> <p>Thanks</p>
jquery
[5]
903,167
903,168
maximum number of simultaneous users for xampp in windows
<p>i am working on creating a web application with php and mysql in a xampp server in windows. I want to know the maximum number of users it can handle at a time. If i am using the wrong technology , please suggest a good one</p>
php
[2]
3,353,528
3,353,529
PHP How to pass variables through a link to the next php file
<pre><code>echo "&lt;td&gt;" . "&lt;a href='approve_mem.php?id=$row['member_id']'&gt;Approve&lt;/a&gt;" . " " . '&lt;a href="disapprove_mem.php?id=$row[member_id]"&gt;Disapprove&lt;/a&gt;' . "&lt;/td&gt;"; </code></pre> <p>This is my code but the value of id does not get passed instead it gets passed like id=$row['member_id'] as it is, and when I echoed the id variable it got printed like $row['member_id']</p>
php
[2]
3,124,608
3,124,609
TOGGLE for JQUERY
<p>here in this code. i have a file from xml that loads on jqgrid. </p> <p>in my xml i have a parTable (which is the parent table) and chTable (for the sub items) now here is my problem. If i click on the parTable(item) i want to expand all the details in the chTable(subitems). </p> <hr> <pre><code>$(function() { 'use strict'; $("#table1").jqGrid({ url: 'Cost Codes Internal.xml', datatype: "xml", height: 'auto', colModel: [ { name: 'Sample1', width: 150, xmlmap: function(obj) { return $(obj).find("Sample1").first().text(); } }, { name: 'Sample2', width: 800, xmlmap: function(obj) { return $(obj).find("Sample2").first().text(); } }, { name: 'Sample3', width: 100, xmlmap: function(obj) { return $(obj).find("Sample3").first().text(); } }, ], xmlReader: { root: "table1&gt;parTable", row: "Data", repeatitems: false, subgrid: { root: "table1&gt;parTable&gt;chTable", row: "Data", repeatitems: false } }, loadonce: true, rowNum: 1000 }); }); </code></pre> <hr> <p>i tried to use this for the toggle for my parTable</p> <pre><code> $("chTable span.expand").click(function() { $(this).parents("parTable.main").nextUntil("parTable.main").toggle(); </code></pre>
jquery
[5]