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
1,865,515
1,865,516
how to replace string when Javascript string variable may contain forward slash?
<p>I'm trying to sort out how to replace a substring in a string when the substring to be found/replaced is a variable that may have one or more occurrences of a forward slash. I suspect the issue is in escaping the incoming string properly....but I'm kind of lost on the syntax to insert the escapes correctly. </p> <pre><code>var incomingStr = 'some text/take / out/ and yet more.'; var removethis = '/take / out/'; newStr = incomingStr.replace(removethis," "); newStr should be: 'some text and yet more.' </code></pre>
javascript
[3]
1,284,232
1,284,233
How To loop the names in C#
<p>I have 10 text boxes namely TB1, TB2, TB3, TB4 and so on.. to TB10</p> <p>I want to store them into a single string value named toBeStored.</p> <p>Now I m doing the manual way</p> <pre><code>String toBeStored=null; tobeStored=TB1.text.toString(); tobeStored+=TB2.text.toString(); </code></pre> <p>and so on..</p> <p>I want to make a for loop and add them</p> <p>something like this..</p> <pre><code>for(int i=1;i&lt;11;i++) { toBeStored+=TB+i+.text.ToString()+" "; } </code></pre> <p>I know that is wrong.. anything to make it right?</p>
c#
[0]
141,284
141,285
How to Support GESTURE, left/right slip, many transition effect in Android application
<p>In My application i want to flip the view.. I have seen such animation in Go SMS pro in Android. And Same thing i want in to my android application.</p> <p>I want to flip the whole activity view. is it possible ? I have seen some example for the flip in android. But in that all example the view is in the same activity. Is it possible to set such view for the different activity. or to do such effect while going from one activity to another ?</p> <p>Please see the snap for the Flip effect in Android<img src="http://i.stack.imgur.com/XnZJ8.jpg" alt="enter image description here">:</p> <p>If Yes then please give reference to any demo example or code.</p>
android
[4]
3,035,040
3,035,041
jQuery: how to replace .live with .on?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/8021436/jquery-1-7-turning-live-into-on">jQuery 1.7 - Turning live() into on()</a> </p> </blockquote> <p>According to the jQuery API (http://api.jquery.com/on/) the function 'live' is deprecated, it is recommended to use 'on' instead. But when I replace 'live' with 'on' in my code, jQuery can't find later added elements anymore:</p> <p>This works (but is deprecated):</p> <pre><code>$('li.bibeintrag').live('click', function(){ alert('myattribute =' + $(this).attr('myattribute')); }); </code></pre> <p>This is an example from the API for 'on':</p> <pre><code>$("#dataTable tbody tr").on("click", function(event){ alert($(this).text()); }); </code></pre> <p>When I change my code to this ('live' replaced with 'on') it does not work anymore (jQuery will not find later added elements (e.g. with append)):</p> <pre><code>$('li.bibeintrag').on('click', function(){ alert('myattribute =' + $(this).attr('myattribute')); }); </code></pre> <p>What am I doing wrong? Can someone help, please?</p>
jquery
[5]
4,371,682
4,371,683
Javascript setHours have unexpected behaviour for UTC+2 timezones
<p>I have following javascript function</p> <pre><code>function DateIncrement(_Date,_Inc) { return (new Date((new Date(_Date)).setHours(_Inc*24,0,0,0))) } </code></pre> <p>The purpose is to increment _Date by _Inc days. This works fine for all the timezone except <strong>UTC+2</strong> time zones <strong>(Amman, Cairo, Beirut etc.)</strong> For <strong>UTC+2</strong> time zones it does not return next day. It set hours in _Date to 24.</p> <p>Thanks in advance.</p>
javascript
[3]
2,600,391
2,600,392
Does a two-dimensional array of character pointers need to be terminated by two null?
<p>The other day, I was reading a book where I found this code:</p> <pre><code>char *words[][40] = {"Goat", "A herbivore", "Dog", "An omnivore", "Fox", "A carnivore", "Bear", "An omnivore" "", ""}; </code></pre> <p>And the book said, "notice, the list must be terminated by two nulls". But when I compiled this code without the nulls, it compiled and worked just as desired. Please explain if the nulls are of any use. I am quite new to C(++), so please elaborate.</p>
c++
[6]
1,814,072
1,814,073
What are unused variables set to?
<p>Particularly for <code>localStorage.foo</code></p> <p>For Safari it is set to:</p> <pre><code>undefined </code></pre> <p>For Firefox it is set to:</p> <pre><code>null </code></pre> <p>Does anyone know the values for Chrome and IE?</p> <p>Why is it different? Just random choices by browser programmers?</p>
javascript
[3]
5,584,589
5,584,590
Python syntax and other things checking?
<p>I wrote a nice little script to do some lightweight work. I set it to run all night, and when I eagerly checked it this morning, I found that I had left a module name prefix out of one of its variables. Is there any way to check for this kind of chicanery statically? The trouble is that this thing sleeps a lot, so running it isn't the best way to find out. </p>
python
[7]
1,502,681
1,502,682
jQuery - .prepend() for each element in list of input's?
<p>Is it possible to use <code>prepend</code> for each element in a list of <code>input</code>'s within a <code>form</code>? The prepend below only prepends the first element - is it possible to prepend the label for all items: </p> <pre><code>&lt;script&gt; $(document).ready(function(){ $("#sg1").each(function(){ $(this).prepend("&lt;label for=\""+$(this).attr("id")+"\"&gt;"+$(this).attr("id")+"&lt;/label&gt;"); }); }); &lt;/script&gt; &lt;form id="sg1"&gt; &lt;input name="member1" id="member1" value="jack" /&gt; &lt;input name="member2" id="member2" value="carter" /&gt; &lt;input name="member3" id="member3" value="jackson" /&gt; &lt;input name="member4" id="member4" value="tielk" /&gt; &lt;/form&gt; </code></pre> <p><a href="http://jsfiddle.net/RM5wG/" rel="nofollow">http://jsfiddle.net/RM5wG/</a></p>
jquery
[5]
1,030,807
1,030,808
How to access values from "strings.xml" dynamically in android?
<p>App version 2.3.3</p> <p>Here is what i am looking for...</p> <p>I have few strings in "values/strings.xml". I wish to retrieve the values depending on the string's "name" attribute and use it my application. The input to which string in the xml should be used comes dynamically. Here is an example...</p> <p>My input from other file :: "A" => This value changes. It can be any value in A,B,C,D.</p> <p>I have different strings in strings.xml, like...</p> <pre><code> &lt;string name="A"&gt;AforApple&lt;/string&gt; &lt;string name="B"&gt;BforBall&lt;/string&gt; &lt;string name="C"&gt;CforCat&lt;/string&gt; &lt;string name="D"&gt;DforDog&lt;/string&gt; </code></pre> <p>Now, how do i programmatically get the value(AforApple) of the String with name="A".</p> <p>Thanks...</p>
android
[4]
5,565,505
5,565,506
C# static method from object
<p>I have various objects of different types. For all of them, I want to call a static method of their class. All the classes share the same method. How can I call this static method without explicitly calling the class?</p>
c#
[0]
2,993,228
2,993,229
C++ tutorial from softlookup.com
<p>Few years back, I read the C++ tutorial on softlookup.com. Now I guess they have removed it. It was one of the best tutorials I have read so far. Does any one have an idea where I can find that tutorial?</p>
c++
[6]
2,608,124
2,608,125
ASP.Net Extensionless URL
<p>I have an online store in which I have certain URL's such as </p> <p>www.giveindia.org/iGive-XYZ. </p> <p>The "XYZ" can be variable. </p> <p>This is redirected to a page such as </p> <p>www.giveindia.org/Donatefromigivepage.aspx?id=XYZ. </p> <p>This use to be working fine until two weeks back. Despite all our efforts we are not able to figure out why its not working anymnore. The error we get is "The specified request cannot be executed from current Application Pool". I have tried everything such as recycling the APP Pool, reinstalling and updating the script maps using aspnet_regiis, etc.</p> <p>Does anyone know what the problem could be?</p>
asp.net
[9]
5,579,255
5,579,256
change href jquery
<p>On a search results page I have links. I would like to change the href of certain href from <code>DispForm.aspx?ID=n</code> to <code>AllItems.aspx?ID=n</code> but just for the href that have <code>/R/I/P/</code> in the url.</p> <p>I would like to use jQuery to change those href. Any suggestions?</p> <pre><code>&lt;a title="" href="http://win/R/I/P/IL/F/DispForm.aspx?ID=n" id="S"&gt;link one&lt;/a&gt; &lt;a title="" href="http://win/R/I/P/L/PN/DispForm.aspx?ID=n" id="S"&gt;link two&lt;/a&gt; &lt;a title="" href="http://win/L/L/DispForm.aspx?ID=n" id="S"&gt;link three&lt;/a&gt; </code></pre>
jquery
[5]
1,704,362
1,704,363
help me understand python
<p>Initialize an array of arrays:</p> <pre><code>M = [[]]*(24*60/5) </code></pre> <p>Append the number 2 to the 51st array in <code>M</code></p> <pre><code>M[50].append(2) </code></pre> <p>What is in M?</p> <pre><code>... [2] [2] [2] [2] [2] [2] [2] [2] ... </code></pre> <p>Every element in M is the array <code>[2]</code></p> <p>What am I missing? I suspect that every <code>[]</code> that I initially initialize is a reference to the same space in memory.</p>
python
[7]
3,388,922
3,388,923
Passing args from main class
<p>I'd like to ask easy question for somebody else but not me - 'cause i'm beginner. I have a bit problem with passing arguments from 'main' to variable "server" under "public JavaApplication6()" Simple code to make it clear:</p> <pre><code>public final class JavaApplication6 { String server; public static void main(String[] args) throws IOException { } public JavaApplication6() { server=main(args[0]); ?? //here is the problem - how to pass ? } } </code></pre> <p>for example if i run this appplication with arguments "java JavaApplication6 someargument" under cmd i'd like to assign string someargument to variable 'server' so it would be : server==someargument and then for example with System.out.println(server) display string 'someargument'.</p> <p>Thank you in advance</p>
java
[1]
4,637,619
4,637,620
How to detect The movement of the device?
<p>I want to detect a movement like a Moo Box, I reverse the phone and when I turn it back it fire an action... For Android. What is the best way</p> <p>It is possible to custom an event listenner</p>
android
[4]
3,633,817
3,633,818
Arbitrary image resizing in PHP
<p>What would be the best way to resize images, which could be of any dimension, to a fixed size, or at least to fit within a fixed size?</p> <p>The images come from random urls that are not in my control, and I must ensure the images do not go out of an area roughly 250px x 300px, or 20% by 50% of a layer.</p> <p>I would think that I would first determine the size, and if it fell outside the range, resize by a factor, but I am unsure how to work out the logic to resize if the image size could be anything.</p> <p>edit:I do not have local access to the image, and the image url is in a variable with is output with img src=..., I need a way to specify the values of width and height tags.</p>
php
[2]
2,142,202
2,142,203
How do I make this JQuery code more efficient
<p>(new to JQuery) I have a list of around 20 or so elements that need to be disabled when the page loads. The list of elements contains the full range of HTML &lt;input&gt; elements, each having distinct IDs that follow a general naming convention.</p> <pre><code> $('#rmX\\.val').prop("disabled",true); $('#rmX\\.unit').prop("disabled",true); $('#rmX\\.ba').prop("disabled",true); $('#rmX\\.sms\\.opt').prop("disabled",true); $('#rmX\\.sms\\.val').prop("disabled",true); $('#rmX\\.sms\\.car').prop("disabled",true); $('#rmX\\.em\\.opt').prop("disabled",true); $('#rmX\\.em\\.val').prop("disabled",true); $('#rmX\\.off\\.opt1').prop("disabled",true); $('#rmX\\.off\\.opt2').prop("disabled",true); $('#rmX\\.off\\.val').prop("disabled",true); $('#rmZ\\.end\\.vald').prop("disabled",true); $('#rmZ\\.end\\.valw').prop("disabled",true); $('#rmZ\\.end\\.valm').prop("disabled",true); $('#rmZ\\.end\\.valy').prop("disabled",true); $('#rmZ\\.date').prop("disabled",true); $('#rmZ\\.time').prop("disabled",true); $('#rmZ\\.ap').prop("disabled",true); $('#evt\\.sec\\.opt2').prop("disabled",true); $('#evt\\.sec\\.val21').prop("disabled",true); $('#evt\\.sec\\.val22').prop("disabled",true); </code></pre> <p>Is there a way to make this list more efficient or is this just the way ya'll do it.</p> <p>(PS. surprised there isn't a "best-practices" tag available.)</p> <p>EDIT: Changed "hidden" from original question to "disabled" as is displayed in my code.</p>
jquery
[5]
2,862,760
2,862,761
jQuery Hover Problem
<p>I am trying to get an element on my page to disappear and reappear when a user clicks on another element. My code looks like the following:</p> <pre><code>&lt;script type="text/javascript"&gt; $('.affordable').hover(function () { $('#reason-a').toggle(); }); &lt;/script&gt; &lt;span class="affordable"&gt;Affordable&lt;/span&gt; &lt;span class="turnaround"&gt;Fast Turnaround&lt;/span&gt; &lt;span class="communication"&gt;Communication&lt;/span&gt; &lt;div id="reason-a"&gt;Affordable information&lt;/div&gt; </code></pre> <p>I want the user to be able to hover on the affordable class, and then the affordable information is shown. And then when the user hovers off the word, the information should disappear.</p> <p>Many thanks</p>
jquery
[5]
716,229
716,230
Is there any way to insert own items in history in Javascript?
<p>I want to add some items in history using javascript? Is there any way to do it?</p> <p>Thanks in Advance !</p> <p>Uday</p>
javascript
[3]
5,291,129
5,291,130
C++ dynamic 2D array
<p>I am using the following code to create dynamic 2D array.</p> <pre><code>uint32_t** arrays = new uint32_t*[10]; uint32_t number = take input from console ; arrays[0] = new uint32_t[number]; number = take input from console ; arrays[1] = new uint32_t[number]; delete arrays[0] ; number = take input from console ; arrays[0] = new uint32_t[number] ; </code></pre> <p>Can any one help me how to know the size of the 2nd dimension without knowing the input values ? Means how to find the array size on arrays[0], arrays[1] and so on ?</p>
c++
[6]
2,209,778
2,209,779
How can I help Google's Closure Compiler optimize my JavaScript code?
<p>I've been tinkering with Google's Closure Compiler and was able to get everything compiling perfectly using the advanced compilation option. How can I get the best compilation results from my code?</p>
javascript
[3]
478,954
478,955
How set the number phone for Emulator Android?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4867286/change-phone-number-in-emulator-android-development">Change phone number in emulator - Android development</a> </p> </blockquote> <p>I'm running 2 emulator (A and B). </p> <p>(A) has number default 5554 and (B) has default 5556 and I want to set (B) has number: 8701 or some thing like that and from (A) can send sms to (B). </p> <p>Any idea for me?</p>
android
[4]
305,861
305,862
Start system_server before class preloading
<p>I was wondering what will happen if the system_server is started in parallel to class preloading in zygote?</p> <p>I experimented with that a bit but didn't see any problem with activities getting slow. There is a good reason for that but I don't know why this is happening.</p> <p>Can anyone share some info?</p> <p>Any help is appreciated. </p>
android
[4]
4,403,051
4,403,052
Automate login to a site and click a button
<p>To need to login to a site, go to a particular page (eg. local router page) and click a button to do an operation(eg Connect). Since I do it almost everyday, I thought of automating it through small C# application. I don't have any idea how to do it.Any pointers?</p>
c#
[0]
3,672,578
3,672,579
How to force-stop the application programatically-Android
<p>I want to force-stop an application from my android app, (Instead of doing manually by Man apps->force-stop). How to achieve this.</p>
android
[4]
3,710,391
3,710,392
What is the easiest way to provide additional installable component for my Android app?
<p>I have an additional component that I can not distribute inside my app. The component is a third-party viewer for a proprietary format, and it is not distributed through Android Market.</p> <p>So, when a user clicks on a file of that type, I'd like to provide a way to install that third-party viewer with the least effort. By install I mean - download APK, install it and launch through an Intent.</p> <p>What is the best way to do this?</p>
android
[4]
4,666,843
4,666,844
keep getting this error message when submitting, compiles fine, but marking software says its incorrect
<p>we're meant to be making a moving bike, everything compiles but we keep getting this error message:</p> <pre><code>% java Main == Benchmark program's output == | == Your program's output == The starting position of the bike is 0 | 0.0 Pedalling three times... | 471.23889803846896 The final position of the bike is 471 &lt; The first line of output that differs is shown below: &lt; The starting position of the bike is 0 --- &gt; 0.0 </code></pre>
java
[1]
4,389,940
4,389,941
Android: List View Selected item -1
<p>Im getting a -1 value when i try to get the selected item position on my listview that is already populated.</p> <pre><code>list.setOnItemClickListener ( new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView adapterView, View view,int arg2, long arg3) { int selectedPosition = adapterView.getSelectedItemPosition(); ShowAlert(String.valueOf(selectedPosition)); } } ); </code></pre> <p>To fill my list view i use the following code:</p> <pre><code>SimpleAdapter mSchedule = new SimpleAdapter( this, mylist, R.layout.listviewtest, new String[] {"test1", "test2", "test3"}, new int[] {R.id.TextView_websitename, R.id.TextView_keywords, R.id.TextView_backlink}); </code></pre> <p>Any idea?</p> <p>Thanks in advance.</p> <p>Best Regards.</p> <p>Jose.</p>
android
[4]
6,021,387
6,021,388
Trim a String to last '.'?
<p>say I have String <code>xxx.yyy.zzz</code></p> <p>I only want zzz. What string operation can do this?</p> <p>Thanks</p>
java
[1]
5,168,865
5,168,866
Android Object Models
<p>I've worked in software development for a number of years (10+) and am just starting to have a proper look at Android. From my current understanding, a GUI is built up of Activities (replacing Forms, etc) and each of those is treated almost like its own mini program since passing references to data is not the simplest approach, and those that are available aren't particularly nice.</p> <p>Anyway, my current favoured approach to GUI development is to create an object model that contains all of the functions I want to provide and then I can build the GUI (or console, or server access, or whatever) to talk to that model via Interfaces. Individual forms may be passed cut down interfaces, and only partial parts of the model, that are used for that particular form. For me, this keeps the front end separate from the functionality and also abstracts away the implementation of the Object Model from the GUI. One advantage for me is that I can write a library to do something then stick on a java GUI, an android GUI, a console, whatever. In fact, I sometimes develop the functionality prior to developing any GUI.</p> <p>Now, in Android this appears to be a trickier approach to take. I think I could achieve the same by serialising the model, and parts of it, and passing these around as strings but I'm not sure this is practical. I also can see that this wouldn't work if part of the model needed to callback to another part of the model that won't exist because it wasn't in the serialised section. ie, I have an object model that holds a list of data objects. I want to pass a data object to another Activity and if it gets edited at all, call back to the object model to enable it to do something else.</p> <p>Am I able to write something to reuse my object models or does this approach just not work well with Android? If it does work, how? If not, what suitable alternatives can I use?</p>
android
[4]
1,409,750
1,409,751
Addin FOrm with steps
<p>HI, i want to make a step by step form.</p> <p>I've made a very basic example in JS. On Each step, i would validate it and then save the stuff into a JS array and save it to DB. Or should i save it into session and use URL parameters? I have a session for sure.</p> <p>Here the JS example: <a href="http://pastebin.com/tApnnqeS" rel="nofollow">http://pastebin.com/tApnnqeS</a></p> <p>On this example, i have to set it back to 0 since it gets cached. Can i do it in the JS way, or is it somehow stupid?</p>
php
[2]
1,230,449
1,230,450
How do I detect the FIXED keyboard on Droid Pro?
<p>I use getResources().getConfiguration().hardKeyboardHidden to detect if a device has a sliding keyboard drawer open (like on the G1).</p> <p>Now I have a Droid Pro, and it returns 1 always, so my app thinks it has a slider open.</p> <p>Is there a way I can tell the device has a keyboard, and that it's ALWAYS open ?</p> <p>TIA</p>
android
[4]
5,513,345
5,513,346
How can we play a .m3u8 file in android 2.2 or android 2.3?
<p>How can we play a .m3u8 (m3u file that uses unicode) file in Android 2.2 or 2.3? Is <code>Android</code> capable of playing files in this format?</p>
android
[4]
4,554,449
4,554,450
jQuery function queueing confusion
<p>I'm trying to understand exactly what it means when I put multiple calls in a row on jQuery, because I'm not getting the results I expect in similar situations.</p> <p>Example 1:</p> <pre><code>$(this).animate({opacity: 0.25}, 250).animate({opacity: 1.0}, 250); </code></pre> <p>As expected, this gives a quick flash of translucency before returning to full opacity.</p> <p>Example 2:</p> <pre><code>$(this).animate({opacity: 0.25}, 250).removeAttr("style"); </code></pre> <p>In this case, instead of a gradual return to opacity, I would expect the removeAttr("style") to cause it to jump back to opacity after the animation is complete. This is because the animate opacity function merely changes values for <code>opacity</code> and sets <code>display:block</code>, and I would expect that by removing these styles, everything returns to normal.</p> <p>Instead, it seems like the removeAttr is firing before the animation is complete, clears out the style, and then animation sets the opacity some more, leaving the item translucent. </p> <p>The fact that this is the sequence of events would seem to be confirmed by the fact that altering the removeAttr to use a completion callback works properly:</p> <pre><code>$(this).animate({opacity: 0.25}, 250, function(){$(this).removeAttr("style");}); </code></pre> <p><b>Why is it that animations appear to be processed serially, while at least some functions are processed in parallel with the animations?</b></p>
jquery
[5]
2,339,540
2,339,541
Is the behavior from (other question) a bug or expected from the JVM spec?
<p>Is the behavior of the code from this question expected?</p> <p><a href="http://stackoverflow.com/questions/3831341">http://stackoverflow.com/questions/3831341</a></p>
java
[1]
1,843,818
1,843,819
Android user interface on xml
<p>Hello i am trying to create a android app and I need some help to start, i would like to know if there is some software which i can use to create all the buttons and other stuff connected with the user interface on xml .</p> <p>thanks in advance.</p>
android
[4]
1,708,186
1,708,187
how to find the textbox value changed by setting val() function?
<p>I am trying to Implement an <strong>New AutoComplete Control</strong>. I have an textbox <code>$("#Code")</code>. When the values has been selected from the table I am assigning the selected value using </p> <pre><code>$("#Code").val(selectedValue); </code></pre> <p>Since I have to check the validation for the same I am trying to get the change event of the text box <code>$("#Code")</code>. The same is firing when I keypress on the textbox but the change event not firing when I assign using <code>$.val()</code> function.</p> <p>I have tried the following.</p> <pre><code>Entity="#Code"; //for example $(Entity).keypress(function (event) { firing on keypress.. // ok.. No Problem }); $(Entity).keydown(function (event) { firing on keydown.. // ok.. No Problem }); $(Entity).bind('input',function() { firing on keypress.. // ok.. No Problem }); $(Entity).change(function (event) { firing on keypress.. // ok.. No Problem }); </code></pre> <p>Could anyone please help how to detect the event of <code>val()</code>?</p>
jquery
[5]
4,424,315
4,424,316
iPhone: plist with NSDictionaries
<p>I have a pList in which I have 5 Dictionary items. I'm trying to read this dictionaries to array </p> <pre><code>NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"pListName" ofType:@"plist"]; NSArray *myArray = [NSArray dictionaryWithContentsOfFile:plistPath]; NSLog(@"%d", myArray.count); </code></pre> <p>But "myArray" all the time empty... What I do wrong ? Thanks in advance...</p>
iphone
[8]
2,592,940
2,592,941
Paste Function Not working for first time jquery
<pre><code>&lt;script type="text/javascript"&gt; $(document).ready( function() { $(".editableContent").bind('paste', function() { var value = $(this).text(); var string = value.replace(/(&lt;([^&gt;]+)&gt;)/ig,""); $(this).text(string); }); }); &lt;/script&gt; </code></pre> <p>Paste Function Does not work for first time but second time it works , why?</p>
jquery
[5]
1,270,225
1,270,226
Get child repeater textbox value using jquery to validate?
<p>I have a textbox inside child repeater, which i need to validate using jquery on button click, to check isnumeric and display an alert... the parent repeater is inside an update panel... when i try to loop through the parent repeater items and then child repeater items using .each function, and then finding the textbox id to validate... But its not working... </p> <p>My code:</p> <pre><code>$("#Button1").click(function() { //alert("Hello world!"); $('#Repeater1').each(function() { $('#Repeater2').each(function() { var sdg = $("input[id*='Text1']").val(); //alert(sdg); if (sdg == "") { alert("enter"); return; } }); }); });​ </code></pre> <p>Tell me an easier way to do this asap???</p>
jquery
[5]
5,709,005
5,709,006
android how to highlighted an text
<p>I have created a listview. and there I also did the drag n drop of items. I want on which item mouse touched that text should be highlighted.(For example U open the Google &amp; if put the mouse on Google then it highlit the text Google in small letters) I wanna same on my list items TextView items. How can I do it. Please answer me. Thanks</p>
android
[4]
817,556
817,557
Perference Dialog
<p>I created a Preference activity</p> <p>And I create a ListPreference</p> <pre><code>&lt;ListPreference android:key="my_list" android:title="@string/my_list_label" android:entries="@array/my_list_array" android:entryValues="@array/my_list_values" android:defaultValue="@string/default_size_limit" /&gt; </code></pre> <p>My question is when I click the ListPreferene, it pops up a dialog, and when I click an entry that, why the onResume() or onCreate() method of my Preference activity is not called? </p> <p>Thank you.</p>
android
[4]
4,863,379
4,863,380
Show/hide div when checkbox is selected
<p>I would like to show/hide a div when a single checkbox is selected. It currently works with "Select all" but I can't get it to work with a single checkbox. Here's the code for "Select All":</p> <p><strong>JS:</strong></p> <pre><code>&lt;script language='JavaScript'&gt; var checkboxcount = 1; function doCheckOne() { if(checkboxcount == 0) { with (document.messageform) { for (var i=0; i &lt; elements.length; i++) { if (elements[i].type == 'checkbox') { elements[i].checked = false; document.getElementById('mail_delete_button').style.display = "none"; } } checkboxcount = checkboxcount + 1; } } else with (document.messageform) { for (var i=0; i &lt; elements.length; i++) { if (elements[i].type == 'checkbox') { elements[i].checked = true; document.getElementById('mail_delete_button').style.display = "block"; } } checkboxcount = checkboxcount - 1; } } &lt;/script&gt; </code></pre> <p><strong>HTML:</strong></p> <pre><code>&lt;a href="javascript:void(0);" onclick="doCheckAll();this.blur();"&gt;Select all&lt;/a&gt; &lt;div id="mail_delete_button" style="display: none;"&gt;&lt;/div&gt; </code></pre> <p>I'd like to display the div "mail_delete_button" when a single checkbox is selected and hide it when there's nothing checked. Note: My html/input field is in the form "messageform" This is my input code:</p> <pre><code>&lt;input type='checkbox' name='delete_convos[]' value='{$pms[pm_loop].pmconvo_id}'&gt; </code></pre> <p>Any help would be greatly appreciated! Thanks! :)</p>
javascript
[3]
1,615,449
1,615,450
How to pass the array from one view to another view controller?
<p>Iam developing the one applciation.In that i want to pass the one two arrays from one view controller to another view controller.I think this is very simple question.But iam very new for this technology.SO iam asking this simple question.Please tell me.</p>
iphone
[8]
2,121,066
2,121,067
javascript toString converts long numbers to Infinity
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1685680/how-to-avoid-scientific-notation-for-large-numbers-in-javascript">How to avoid scientific notation for large numbers in javascript?</a> </p> </blockquote> <p>Hi All,</p> <p>Doing something like this</p> <pre><code>alert(999999999999999999999999999999999999999999999999); </code></pre> <p>results in this</p> <p><img src="http://i.stack.imgur.com/YQVoz.png" alt="Javascript Popup 1e+48"></p> <p>How to i stop converting a number to a string from saying 1e+XX or Infinity?</p>
javascript
[3]
1,782,995
1,782,996
android: how to create multiply views screen?
<p>I want to create an activity, which shows a question with 4 answers, and at the bottom of the screen i want to place a timer.</p> <p>I have already found timer example, and i created a question with the answers. the problem that they are 2 different projects and activities, and i am looking for the best way to implement it. i think i can't show 2 activities on one screen, but i can show 2 views or shell i use the ViewGroup, or maybe to copy-paste one of the activities code to another ( its the easiest way but probably the most ugliest way to implement it). please tell me what is the best way, that i will study and not to waste time to study all the ways and only then to choose one of them.</p>
android
[4]
3,357,557
3,357,558
Android BroadcstReciever
<p>I am creating an application in which i am using a broadcast receiver. I m new to android , so i am not sure how to add receiver in manifest file. My code is</p> <pre><code>&lt;receiver android:name="Reciever"&gt;&lt;/receiver&gt; </code></pre> <p>"Reciever" is name of class which extends "BroadcastReceiver".When user clicks on button then after 5 seconds i want to call this Receiver.So i have written this :</p> <pre><code>AlarmManager am= (AlarmManager) getSystemService(ALARM_SERVICE); am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, cal.getTimeInMillis(), sender); </code></pre> <p>Here "sender" is pending intent. But it's not working, Please suggest me ?</p>
android
[4]
6,005,538
6,005,539
How to play with devices like accelerometer and camera using C/C++?
<p>As you can see in architecture diagram below android platform has been built using different layers.</p> <ul> <li><code>Application</code> are developed in <code>Java</code></li> <li><code>Application Framework</code> is written using <code>Java</code> (according to my understanding)</li> <li><code>Libraries</code> are in <code>C/C++</code></li> </ul> <p><img src="http://i.stack.imgur.com/XjjzL.jpg" alt="enter image description here"></p> <p>For some insane reason I have to play/deal with devices like <code>accelerometer</code>, <code>compass</code> and <code>camera</code> using <code>C/C++</code> which means directly accessing them in 3rd layer i.e. <code>Libraries</code>. According to my understanding the <code>Application Framework</code> itself would be consuming <code>Libraries</code> for accessing these devices and then providing <code>APIs</code> for <code>Applications</code>. </p> <p>I am looking for any documentation/tutorials/demo which can help me in this regard i.e how to access and use these devices like camera, accelerometer and compass from <code>C/C++</code> code or in other words how to play with these devices directly from <code>Libraries</code> layer.</p> <p>My last option would be to get the android source code and dig deep into it to find out what I am looking for but I would like some easy way in form of a documentation/demo/tutorial/anything that can make this a bit easy for me.</p>
android
[4]
2,398,992
2,398,993
java callable statment .next help
<p>I have this right now:</p> <pre><code>public java.util.Vector getList() { java.util.Vector myuserList = new java.util.Vector(); DbUtil db = null; java.sql.CallableStatement cstmt = null; ResultSet rset = null; db = new DbUtil(); cstmt = db.prepareCall("{ call sample.user.get_user_list(?, ?, ?) }"); cstmt.registerOutParameter(1,OracleTypes.CHAR); cstmt.registerOutParameter(2,OracleTypes.VARCHAR); cstmt.registerOutParameter(3,OracleTypes.CURSOR); cstmt.execute(); } rset = (ResultSet) cstmt.getObject(3); if (rset != null) { while(rset.next()) { userBean myuser = new userBean(); myuser.setuserid(rset.getString(1).trim()); myuser.setuserName(rset.getString(2)); myuserList.addElement(myuser); } } return myuserList; } </code></pre> <p>I want to get one more string ssn under my while(rset.next()).. when i just add this <code>myuser.setuserSSN(rset.getString(3));</code> under <code>myuser.setuserName(rset.getString(2));</code> its giving me error.. i have already updated my procedure to get user SSN so how can i get that ssn number here.. what do i have to modify.. one more thing i am getting all three userid, username and userSSN by using cursor <code>cstmt.registerOutParameter(3,OracleTypes.CURSOR);</code> first two callable statment are for exceptions in the procedure.. please help</p> <p>here is the error i get..</p> <pre><code>compile: [exec] com\javabean\userBean.java:188: cannot resolve symbol [exec] symbol : variable myuser [exec] location: class com.javabean.userBean [exec] myuser.setuserSSN(rset.getString(3)); [exec] ^ [exec] 1 error </code></pre>
java
[1]
2,399,592
2,399,593
how to customize list view item spaces between them?
<p>I want to customize list view item spaces between different items. We generally display list item with default space between them to get viewed in list.I want to customize the space difference between them so that more data can be displayed in the list within the display part at a time.</p> <p>Please provide me some solution .</p> <p>Thanks in adv. Praween</p>
android
[4]
1,019,097
1,019,098
Use same JQuery function in differents pages with different parameters
<p>I have a several pages which has the same ul (unordered list) with the same content, bur differents links:</p> <pre><code>&lt;ul class='actions'&gt; &lt;li&gt;&lt;a href='...'&gt;1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href='...'&gt;2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href='...'&gt;3&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>The thing is that I made a jquery function wich according to some parameters will delete or not some of the li elments.</p> <p>My question is, if I have the same ul with the same class ("actions") in different pages, how can I configure differents parameters in my function.</p> <p>I guess that I can put some hidden field in the page and get the parameters from there, but I think it is not the best approach..</p> <p>Do you guys have a better idea?</p> <p>Thanks</p>
jquery
[5]
4,915,058
4,915,059
Data Layer, Model Layer and interfaces in Java
<p>Lets say we wish to represent a Person</p> <pre><code>public interface Person { String getFirstName(); String getLastName(); } </code></pre> <p>This is implemented with JPA (code I am missing out since it is pretty banal)</p> <p>Now, I wish to have a Model, the interface of which is an extension of the person interface with setter methods</p> <pre><code>public interface PersonModel extends Person { void setFirstName(String firstName); void setLastName(String lastName); } </code></pre> <p>and I implement a concrete implementation of the Model interface (which I am skipping since its pretty banal again)</p> <p>In doing this I realised that the PersonModel extending from Person doesn't really make that much sense since a "PersonModel is not a Person"</p> <p>It is also not "correct" to cast a PersonModel to Person.</p> <p>What is the correct way to implement this - PersonModel could just not inherit from Person and re-define the methods but that means extra maintenance.</p> <p>I could extract the methods to another base interface -> PersonBase(?) and extend both Person (no other methods defined) and PersonModel from that.</p> <p>If I am going down the above path, what would be the best way to name the base interface?</p> <p>One of the main reasons I am using interfaces (apart from the fact that it helps me in thinking through about how everything would work / fit together) is so that there can easily be different implementation layers (JPA2/NoSQL Driver etc.)</p> <p>This is not real code being used, so please excuse any syntax errors / typos - I just wrote it up for the purpose of this question.</p> <p>Thoughts / guidance / advice appreciated.</p> <p>Thanks,</p> <p>Shri</p>
java
[1]
3,628,761
3,628,762
C# - Casting a Reflection.PropertyInfo object to its Type
<p>In my application, I have a Reflection.PropertyInfo variable named 'property'. When I do a property.GetValue(myObject,null), the value is Master.Enterprise. Enterprise is a class in my application. So, 'property' contains a reference to a class in my app.</p> <p>At runtime, I would like to somehow cast 'property' to its type (Master.Enterprise) so I can use it as if it were the class type.</p> <p>I know this can be done because when I look at the code in the debugger, the debugger correctly casts 'property' to the type its referencing, and I can see all the properties of the Enterprise class in the debugger.</p> <p>How might I go about doing this?</p>
c#
[0]
5,399,848
5,399,849
Streaming mp3 music files with php and jquery
<p>I am working on (or at least plan to) an online music streaming website. I know a little bit of php, but don't know how to work with sounds or music files...so i just need some tips and advice,i.e a push in the right direction.</p>
php
[2]
5,761,074
5,761,075
Orientation change crashes my app
<p>I have a class for constructing AlertDialog that contains spinner widget. When spinner shows its popup, if I change phone's orientation, my app crashes with exception saying something about leaked window. This matter has been discussed many times before, but only in the context of multithreading. But I have one thread. So what am I doing wrong?</p> <pre><code>public class ExpenseDialog extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater factory = LayoutInflater.from(this.getActivity()); View content = factory.inflate(R.layout.expensedialog, null); Spinner spinner = (Spinner) content.findViewById(R.id.catspinner); ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource( this.getActivity(), R.array.cats, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); return new AlertDialog.Builder(this.getActivity()) .setView(content) .setPositiveButton("ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { //some code } }) .setNegativeButton("cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { //some code } }) .create(); } </code></pre> <p>}</p> <p>I show the dialog like this: (new ExpenseDialog()).show(getSupportFragmentManager(), "expensedialog");</p>
android
[4]
3,463,538
3,463,539
How can I make my view return the sum of a collection?
<p>I am trying to do this with the following code but it gives me many errors:</p> <pre><code>public abstract class BaseGridViewModel { protected BaseGridViewModel() { Events = new List&lt;ViewEvent&gt;(); Watch = Stopwatch.StartNew(); } public SelectList Statuses { get; set; } public IList&lt;ViewEvent&gt; Events { get; set; } public string Topics { get; set; } public SelectList Types { get; set; } public string View { get; set; } public Stopwatch Watch { get; set; } public void Event(string description) { if (Watch.IsRunning) { Events.Add(new ViewEvent(description, Watch.ElapsedMilliseconds)); } else { throw new Exception("Watch not running"); } } public long Elapsed { get { return Events.Sum(event =&gt; event.Elapsed) } } public class ViewEvent { public long Elapsed { get; private set; } public string Description { get; private set; } public string Message { get; private set; } public int Quantity { get; private set; } public ViewEvent(string description, long elapsedTime, int quantity = 0, string message = "") { this.Description = description; this.Elapsed = elapsedTime; this.Quantity = quantity; this.Message = message; } } </code></pre> <p>All 9 errors are for this line: "return Events.Sum(event => event.Elapsed)"</p> <p>Is there something wrong with my syntax for this?</p>
c#
[0]
4,263,463
4,263,464
How to get favicon's URL from a generic webpage?
<p>I need a way to get the favicon's URL from a generic webpage considering that the favicon is not always at the base url.</p> <p>P.s. without using an external service.</p>
php
[2]
1,310,610
1,310,611
How to get crash dialog with report button
<p>I purposely make my own application crash. I get the following dialog.</p> <p><img src="http://i.stack.imgur.com/Xvy0k.jpg" alt="enter image description here"></p> <p>However, I wish to get the following crash dialog with report button.</p> <p><img src="http://i.stack.imgur.com/y58Yi.png" alt="enter image description here"></p> <p>May I know how I can do so? I had signed my application. (But I transfer the APK locally to my phone, not through Android market). I still can't get the <code>Report</code> button.</p>
android
[4]
2,490,326
2,490,327
I am trying to ad a countdown timer to my maze game
<p>I am making a maze game </p> <p>I wrote this:</p> <pre><code> private int counter = 60; private void button1_Click(object sender, EventArgs e) { int counter = 60; timer1 = new System.Windows.Forms.Timer(); timer1.Tick += new EventHandler(timer1_Tick); timer1.Interval = 1000; //one second timer1.Start(); label1.Text = counter.ToString(); } private void label1_Click(object sender, EventArgs e) { } private void timer1_Tick(object sender, EventArgs e) { counter--; if (counter == 0) timer1.Stop(); label1.Text = counter.ToString(); } } } </code></pre> <p>After this I want a <code>Messagebox</code> to appear when the timer ends on <code>0</code>. When I click on the OK button I want the form to close.</p>
c#
[0]
1,441,319
1,441,320
Rgd: Vector Iterator to get Index Position
<p>This is my iterator position code</p> <pre><code>struct node { int nodeid; vector&lt;fingerTable&gt; fTable; vector&lt;string&gt; data; }; vector&lt;node&gt; cNode; vector&lt;node&gt;::iterator position = find(cNode.begin(),cNode.end(), id); </code></pre> <p>I got about 100 objects, i am trying to find the index/element/position of e.g nodeid "80" assuming that my object is all sorted in ascending order by nodeid.</p> <p>my concern is speed and memory usage, i was previously using </p> <pre><code>for(int i=0;i&lt;cNode.size();i++) { //if logic-- match nodeid with the nodeid input.. then assign the i to an integer.. } </code></pre> <p>but now i am trying to use and iterator, i heard its faster.. any suggestion on getting it fix or is there a better way to find my vector index by its value "nodeid"</p> <p>i know map is a good std container for my case but i a bit run out of time to do the changes so i got to stick with vector..</p> <pre><code>vector&lt;node&gt;::iterator position = find(cNode.begin(),cNode.end(), id); </code></pre> <p>Error output when i try compile the iterator line above.</p> <pre><code>In member function ‘void chord::removePeer(int)’: testfile.cpp:532:69: error: no matching function for call to ‘chord::find(std::vector&lt;chord::node&gt;::iterator, std::vector&lt;chord::node&gt;::iterator, int&amp;)’ testfile.cpp:532:69: note: candidate is: testfile.cpp:177:5: note: int chord::find(int, int, bool) testfile.cpp:177:5: note: no known conversion for argument 1 from ‘std::vector&lt;chord::node&gt;::iterator {aka __gnu_cxx::__normal_iterator&lt;chord::node*, std::vector&lt;chord::node&gt; &gt;}’ to ‘int’ </code></pre>
c++
[6]
2,195,526
2,195,527
how to display the tamil content website in default browser
<p>how to show tamil language characters in android ,i have simple webview apllication ,it loads the url of tamil news site which contains tamil characters ,but its showing [][][][ at place of those characters ,even the default android browser shows the same (not showing the hindi or tamil characters ) the android version is 2.1, text encoding is set on unicode(UTF-8) in default android browser .,is there is any way to get the support for tamil characters i hope my question is clear ,</p>
android
[4]
4,689,427
4,689,428
Create a jar file from the java code
<p>i want to create a jar file from java program i looked at some examples <a href="http://stackoverflow.com/questions/2977663/java-code-to-create-a-jar-file">Java code to create a JAR file</a> but it didnt impressed me as this will not create the proper package structure my original command was </p> <pre><code>jar -cfv formBuilder.jar .\com\accenture\* .\com\wysiwyg\util\XmlUtil.class .\com\wysiwyg\exception\ApplicationException.class .\com\wysiwyg\constants\*.class .\com\wysiwyg\util\FormBuilderUtill.class .\com\wysiwyg\util\SaveFormOnLocalUtil.class .\com\wysiwyg\logger\LogInfo.class .\com\wysiwyg\factory\Validation.class </code></pre> <p>now i want to do the same using java code but without ant, and proper package structures should be created, is this feasible?</p>
java
[1]
2,541,538
2,541,539
Is there a way to remove ShareIntent latency?
<p>I create a share intent in this way:</p> <pre><code>Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); String shareBody = "the share content body"; sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here"); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); startActivity(Intent.createChooser(sharingIntent, "Share via")); </code></pre> <p>it works fine, however dialog takes about 1-2 seconds to show (I think because it has to search for every app which can handle that intent), is there a way to remove this delay? I think there is because after the first, subsequent calls have no delay at all.</p> <p>I tried to preload the sharing intent and have my app just call startActivity but delay is the same...I think the overhead is on the startActivity call :(</p>
android
[4]
1,772,494
1,772,495
Syntax error on token ";" - really unexpected
<p>I got the problem with the following error:</p> <p>Syntax error on token ";", { expected after this token<br> Syntax error, insert "}" to complete EnumBody</p> <pre><code>public enum ImpNoise { INSTANCE; private int p[] = new int[512]; for(int i = 0; i &lt; 256; i++) { } } </code></pre> <p>I stripped the whole class down to the bare minimum as you can see above. I figured out that the for loop is causing the problem. But i really don't get it, it looks ok right?</p>
java
[1]
1,579,022
1,579,023
How short can this script be and still achieve the same thing - display a message "loading.." followed by an extra period every 1 second for 7 seconds
<pre><code>&lt;script&gt; var dot = "."; var counter = 0; var message = "Loading Page"; function writeLoadingMessage(){ if (counter &gt; 6) return; setTimeout('writeMessage();',1000); } function writeMessage(){ document.getElementById('loadingMessageSpan').innerHTML = message + dot; message += dot counter++ writeLoadingMessage(); } &lt;/script&gt; &lt;BODY&gt; &lt;span style="font-weight:bold;" id="loadingMessageSpan"&gt;&lt;/span&gt; &lt;SCRIPT&gt;writeLoadingMessage();&lt;/SCRIPT&gt; &lt;/BODY&gt; </code></pre>
javascript
[3]
3,274,295
3,274,296
Why can't my site access a linked JavaScript file?
<p>I run a sub-site at my work, and while my live site is on the same "main server" as the company's main site, my dev environment is hosted on a separate server. </p> <p>For some reason my dev site is unable to access a specific JavaScript file that is hosted on the "main server". All of the other JavaScript files, like jQuery, and jQueryTools can be accessed, but <code>main.js</code> cannot. My only guess would be because it is a custom JavaScript file created by our head web developer, but I don't know why that would make a difference. (<strong>Cross-site scripting limitations?</strong>)</p> <p>I link to it just like I do with all the other JavaScript files, right after our main wrapper (it's the 3rd from the bottom):</p> <pre><code>&lt;script type="text/javascript" src="ui/2009/js/jquery-1.4.2.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="ui/2009/js/jquerytools/1.2.2/jquery.tools.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="ui/2009/js/jquery.cycle.all.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="ui/2009/js/main.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="ui/2009/js/jquery.jgfeed-min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="ui/2009/js/hr.js"&gt;&lt;/script&gt; </code></pre>
javascript
[3]
1,152,088
1,152,089
SMTPClIENT send through second lan port
<p>As of right now I have a server client program that is not connected to a gateway... one to one connection. However the user has the ability to send a log via email. The computer has 2 lan ports... first one being for the program and the second for if the user wants internet connectivity. How can I set the smtp object to send via the second lan and not the first?</p>
c#
[0]
775,426
775,427
Why preg_match fails to get the result?
<p>I have the below text displayed on the browser and trying to get the URL from the string. </p> <p>string 1 = voice-to-text from #switzerland: <a href="http://bit.ly/lnpDC12D" rel="nofollow">http://bit.ly/lnpDC12D</a></p> <p>When I try to use preg_match and trying to get the URL, but it fails</p> <pre><code>$urlstr = ""; preg_match('/\b((?#protocol)https?|ftp):\/\/((?#domain)[-A-Z0-9.]+)((?#file)\/[-A-Z0-9+&amp;@#\/%=~_|!:,.;]*)?((?#parameters)\?[A-Z0-9+&amp;@#\/% =~_|!:,.;]*)?/i', $urlstr, $match); echo $match[0]; </code></pre> <p>I think #switzerland: has one more http// ... will it be problem ?</p> <p>the above split works perfect for the below string,</p> <p>voice-to-text: <a href="http://bit.ly/jDcXrZg" rel="nofollow">http://bit.ly/jDcXrZg</a></p>
php
[2]
3,709,333
3,709,334
iPhone provisional vs distribution installation on device
<p>Is there a way to install a provisional app on the iPhone without it overwriting the distribution app? I would like to have both running since the provisional development app points to our test servers, while the distribution app, which is from the app store, points to our production servers.</p> <p>Any help would be wonderful. Thanks!</p>
iphone
[8]
14,062
14,063
How to check if iOS can open a specified binary filetype?
<p>I need to create an iPhone app that will connect to an Amazon S3 bucket, where it will download potentially <em>any</em> type of binary file. I am assuming that I could easily handle images, videos, web pages, and pdfs right from the app (or safari). But is there a way to see if there are other apps that can support the downloaded file content-type?</p> <p>And if iPhone has that application, then I could hand off the viewing to that other app. Is such a scenario possible? </p> <p>Thank you.</p>
iphone
[8]
4,217,713
4,217,714
Can I provide a download button for content in an iPhone app?
<p>I am working on an iPhone application called IYoga-Classic which will provide high quality videos for Yogs instructions. I want to add a download option to the videos so that the users can download their desired positions even when they are offline? Is there a way to do this?</p>
iphone
[8]
1,338,262
1,338,263
Count Number of Visitors in WebSite using ASP.Net and C#
<p>I want to keep track of the number of visitors to my site. </p> <p>I tried the following code in the Global.asax class,</p> <pre><code>&lt;script runat="server"&gt; public static int count = 0; void Application_Start(object sender, EventArgs e) { Application["myCount"] = count; } void Session_Start(object sender, EventArgs e) { count = Convert.ToInt32(Application["myCount"]); Application["myCount"] = count + 1; } &lt;/script&gt; </code></pre> <p>I am retrieving the value in the aspx page as follows:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { int a; a = Convert.ToInt32((Application["myCount"])); Label4.Text = Convert.ToString(a); if (a &lt; 10) Label4.Text = "000" + Label4.Text ; else if(a&lt;100) Label4.Text = "00" + Label4.Text; else if(a&lt;1000) Label4.Text = "0" + Label4.Text; } </code></pre> <p>The above coding works fine. It generates the Visitors properly but the problem is when I restart my system, the count variable again starts from 0 which logically wrong.</p> <p>I want the value of count to be incremented by 1 from the last count value.</p> <p>So can anyone tell me how to accomplish this task?</p> <p>Please help me out! Thanks in advance!</p>
asp.net
[9]
5,620,747
5,620,748
creation of object
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2103089/is-there-any-other-way-of-creating-an-object-without-using-new-keyword-in-java">is there any other way of creating an object without using &ldquo;new&rdquo; keyword in java</a> </p> </blockquote> <p>how many ways are there to create an object in java ?</p>
java
[1]
2,893,582
2,893,583
Getting functionality from two classes
<p>Say I have an abstract class A and an abstract class B:</p> <pre><code>abstract class A { public void doA(){ //some stuff } } abstract class B{ public void doB(){ //some stuff } } </code></pre> <p>Now I want to accomplish the following situation:</p> <p>class <code>C</code> has functionality of <strong>just</strong> <code>A</code><br> class <code>D</code> has functionality of <strong>just</strong> <code>B</code><br> class <code>E</code> has functionality of <strong>both</strong> <code>A</code> and <code>B</code>. </p> <p>How would I do that? Is that even possible in java, because one cannot extend multiple classes?</p>
java
[1]
2,008,299
2,008,300
How to read muliple values from a config file using config parser
<p>I have made a Config file and have multiple values for a keyword as:</p> <p>[section]</p> <p>database: mysql , sqlite</p> <p>and i want to access the values separately..How to go about it??</p>
python
[7]
3,574,462
3,574,463
Difference between assigning a property and adding a attribute in a asp.net control
<p>I am creating ASP.NET textbox controls dynamically. I want to know the difference between assigning the property of the control and adding it as an attribute. </p> <p>For ex: I can do:</p> <pre><code>TextBox txtBox = new TextBox(); txtBox.MaxLength = 100; </code></pre> <p>or I could do</p> <pre><code>txtBox.Attributes.Add("maxlength", "100); </code></pre>
asp.net
[9]
5,133,124
5,133,125
Java Average Temperature
<p>Program works, but my average temperature is 1 decimal place off. Can't seem to figure out where I'm going wrong. Should one of my variables be a float? Any help is greatly appreciated!</p> <p>Code:</p> <pre><code>import java.util.Scanner; public class NumberAboveAverage { public static void main(String[] args) { Scanner input = new Scanner(System.in); final int TotalTemps = 10; double[] numbers = new double[TotalTemps]; double sum = 0; double average = 0; double max = 0; for (int n = 0; n &lt; numbers.length; n++) { System.out.print("Enter a temperature: "); numbers[n] = input.nextInt(); if (numbers[n] &gt; max) { max = numbers[n]; } sum = numbers[n]; } for (int i = 0; i &lt; numbers.length; i++) { sum = numbers[i]; } average = sum / 10; System.out.println("Average temp = " + average); int count = 0; for (int i = 0; i &lt; numbers.length; i++) { if (numbers[i] &gt; average) { count++; } } System.out.println(count + " days were above average"); } } </code></pre>
java
[1]
2,298,417
2,298,418
on click on "ONLY" all input text unchecked and current one should get checked
<p>I hover on class <code>".airportdetails"</code> and text only is get appear now if i click on whole div input get checked bt i want i i click on only then all other get unchecked and only current will get check</p> <p>here is the fiddle</p> <p><a href="http://jsfiddle.net/VRE9n/4/" rel="nofollow">http://jsfiddle.net/VRE9n/4/</a></p> <pre><code>$(document).ready(function () { $(".airportdetails").mouseover(function() { $("li a", this).show(); }).mouseout(function(){ $("li a", this).hide(); }); }) $('.airportdetails').click( function() { var $newcheck = $(this).find(":checkbox"); if (!$newcheck.prop("checked") ) { $newcheck.prop("checked", true); } else { $newcheck.prop("checked", false); } }); $('.airportdetails input').click( function(event){ event.stopPropagation(); }); </code></pre>
jquery
[5]
2,792,389
2,792,390
how to use a value (which is get by .text() when a li is clicked) as a selector to hide some div
<p>i have a ul li list like</p> <pre><code>&lt;ul class="dropdown-menu" id="dropdown"&gt; &lt;li&gt;&lt;a id='l1' href='javascript:void(0);'&gt;batch1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a id='l2' href='javascript:void(0);'&gt;batch2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a id='l3' href='javascript:void(0);'&gt;batch3&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a id='l4' href='javascript:void(0);'&gt;batch4&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a id='l5' href='javascript:void(0);'&gt;batch5&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a id='l6' href='javascript:void(0);'&gt;batch6&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>now, i can get the text value of every li, the problem is, i cannot use the text value as selector.what i want to do is: i have some div(id are "batch1, batch2...batch6"),which i want to hide if a li is clicked(except clicked li). code are=</p> <p>html:</p> <pre><code>&lt;div id="batch1"&gt;&lt;/div&gt; &lt;div id="batch2"&gt;&lt;/div&gt; ...... </code></pre> <p>jquery:</p> <pre><code>$(document).ready(function(e) { $('body').click(function(event) { if($(event.target).is('#l1')) { var id = "'#"+$('#l2').text()+"'"; $(id).hide(); } }); }); </code></pre> <p>what should i do. i am trying about 24 hours but still in dark. and thanks in advance</p>
jquery
[5]
5,814,412
5,814,413
why my php code create unneccesary spaces?
<p>This my php code. this is creating to html codes that is below.</p> <pre><code>foreach($sorular-&gt;soruCek($_GET["kategori"]) as $data) { $kontrol = $sorular-&gt;cevapCek($data["id"]); if($kontrol) { echo $data["soru"] . '&lt;br/&gt;'; foreach(@$sorular-&gt;cevapCek($data["id"]) as $veri) { ?&gt; &lt;input type="radio" name="soru&lt;? echo $data["id"]; ?&gt;" value="&lt;? echo $veri["id"]; ?&gt;"/&gt;&lt;? echo $veri["cevap"]; ?&gt; &lt;? echo "&lt;br/&gt;"; } echo "&lt;br/&gt;"; } } </code></pre> <p>Result: <img src="http://i.stack.imgur.com/SoCnE.png" alt="enter image description here"></p>
php
[2]
4,899,556
4,899,557
How to get the exact href value only without their domain?
<p>I'm having trouble in getting the exact value of href only. Here is the code:</p> <pre><code>Link: &lt;a href="monthly"&gt;&lt;/a&gt; Script: 'a': function(target, process){ if(process == "stripe"){ document.location.href = "/accounts/stripe/payment"+target[0].href; }else{ ...... } }, </code></pre> <p>If I run this the output will be:</p> <pre><code>http://localhost:8000/accounts/stripe/paymenthttp://localhost:8000/monthly/ </code></pre> <p>Notice that the localhost is duplicating. How to get only the "monthly" in href without that localhost? I try target only but it's undefined. I try target[1] but it's not working.</p>
jquery
[5]
3,133,528
3,133,529
How can I use local and remote settings in the same PHP file?
<p>My basic thoughts would be to do something like:</p> <pre><code>$isLocal = // test here if ($isLocal) { // local settings here } else { // remote settings here } </code></pre> <p>I've tried $_SERVER['HTTP_HOST'] but when I debug in Netbeans, HTTP_HOST does not appear as a parameter. Basically I'm looking for a robust test for $isLocal</p>
php
[2]
4,167,275
4,167,276
Best way to list Alphabetical(A-Z) using PHP
<p>can any one please let me know, i need to print/list Alphabetical(A-Z) char to manage Excel cells. Is there any php function to list Alphabetic?</p> <p>I need result as</p> <pre><code>A1 B1 C1 D1 ... ... ... </code></pre> <p>OR</p> <pre><code>A B C ... ... </code></pre>
php
[2]
2,850,872
2,850,873
Switch Statement Survey
<p>I am having a few problems with this build. First it is not all it will not load the main class. Second I need the user to input their choice of music and then I need the compiler to print selection. Can someone help me with this code? Please excuse me but I am totally new to programming.</p> <pre><code>public class music { public static void music(String[] args) { System.out.println("What's your favorite kind music?: "); System.out.println("1. Country"); System.out.println("2. Rock"); System.out.println("3. Heavy Metal"); System.out.println("4. Folk"); try{ BufferedReader bufferRead = new BufferedReader(new InputStreamReader(System.in)); int s = Integer.parseInt(bufferRead.readLine()); switch(s){ case 1: System.out.println("Country"); break; case 2: System.out.println("Rock"); break; case 3: System.out.println("Heavy Metal"); break; case 4: System.out.println("Folk"); break; default: System.out.println("Country"); break; } }catch(IOException e){ e.printStackTrace(); } </code></pre>
java
[1]
4,397,379
4,397,380
Android - SMS BroadcastReceiver Working on Emulator but Not on Phone
<p>I just wanted to know why my simple sms receiver works on my emulator(2.3) but not working on my phone(2.3).</p> <p>My simple program will show a toast whenever I receive a new SMS. It is showing on the emulator, and again not on the phone.</p> <p>I tried two emulator and it works. </p> <p>Here are the codes.</p> <pre><code>public class SMSReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub System.out.println("A new message just arrived."); Toast.makeText(context, "weee", Toast.LENGTH_LONG).show(); } } </code></pre> <p>Manifest:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.smsreceiver" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" /&gt; &lt;uses-permission android:name="android.permission.RECEIVE_SMS" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name="com.example.smsreceiver.MainActivity" 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;receiver android:name=".SMSReceiver" android:exported="true"&gt; &lt;intent-filter&gt; &lt;action android:name="android.provider.Telephony.SMS_RECEIVED"/&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre>
android
[4]
153,690
153,691
Select particular dates from nsdictionary
<p>I have an <code>NSDictionary</code> which looks like.</p> <pre><code>dic is : { city = #; country = #; date = "2011-08-12 05:00:00 +0000"; "day_of_week" = Fri; high = 79; icon = "/ig/images/weather/chance_of_storm.gif"; low = 61; startdate = "2011-08-12 05:00:00 +0000"; state = #; } dic is : { city = #; country = #; date = "2011-08-13 05:00:00 +0000"; "day_of_week" = Fri; high = 79; icon = "/ig/images/weather/chance_of_storm.gif"; low = 61; startdate = "2011-08-12 05:00:00 +0000"; state = #; </code></pre> <p>} </p> <pre><code>dic is : { city = #; country = #; date = "2011-08-14 05:00:00 +0000"; "day_of_week" = Sat; high = 79; low = 58; startdate = "2011-08-12 05:00:00 +0000"; state = #; </code></pre> <p>} </p> <pre><code>if(( [dd1 earlierDate:startDate]) &amp;&amp;[dd1 earlierDate:endDate] ) { /*if([dd1 isEqualToDate:startDate] || [dd1 isEqualToDate:endDate] ) </code></pre> <p>I am passing <code>NSDate</code>s from test cases. Startdate and enddate are passed from the test cases and dd1 is passed from the parser which is the date. I am trying to get values between 2 dates but getting all 4 dates. What is the solution to get only the date values I wish?</p> <p>DD1 IS NSDATE OBJECT AND I AM GETTING IT FROM NSDICTIONARY.SO DD1 IS RUNNING INSIDE A FORLOOP WHERE I AM GETTING DATES AS 201-08-12,2011-08-13 ETC</p>
iphone
[8]
4,880,965
4,880,966
Weird line of c# code that works
<pre><code>return Json(new { ErrorMessage = scheduleBase.ErrorMessage }, JsonRequestBehavior.AllowGet); ; </code></pre> <p>Is this just a weird case of me not being able to correctly see what the other semi-colon relates to? This code compiles and actually works fine, but I'm stumped as to why.</p> <p>I found it in a co-workers code.</p>
c#
[0]
4,174,718
4,174,719
SimpleHTTPRequestHandler Override do_GET
<p>I want to extend SimpleHTTPRequestHandler and override the default behavior of <code>do_GET()</code>. I am returning a string from my custom handler but the client doesn't receive the response.</p> <p>Here is my handler class:</p> <pre><code>DUMMY_RESPONSE = """Content-type: text/html &lt;html&gt; &lt;head&gt; &lt;title&gt;Python Test&lt;/title&gt; &lt;/head&gt; &lt;body&gt; Test page...success. &lt;/body&gt; &lt;/html&gt; """ class MyHandler(CGIHTTPRequestHandler): def __init__(self,req,client_addr,server): CGIHTTPRequestHandler.__init__(self,req,client_addr,server) def do_GET(self): return DUMMY_RESPONSE </code></pre> <p>What must I change to make this work correctly?</p>
python
[7]
5,688,664
5,688,665
decompress an archive in android
<p>Does anybody knows how could one programmatically decompress an archive in android ?</p>
android
[4]
3,619,127
3,619,128
Javascript object creation?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6439579/what-does-var-foo-foo-mean-in-javascript">What does &ldquo;var FOO = FOO || {}&rdquo; mean in Javascript?</a> </p> </blockquote> <p>I am finding this kind of statement in javascript object creation repeatedly.</p> <pre><code> var MyObj = MyObj || {}; </code></pre> <p>Could some one could explain the significance of the above statement?</p> <p>why can't we create just </p> <pre><code>var MyObj = {}; </code></pre> <p>Thanks.</p>
javascript
[3]
1,731,019
1,731,020
jquery++ drop function
<p>Hi im trying to make a darg and drop question.</p> <p>I want top use this ++ code: <a href="http://jsfiddle.net/donejs/3NkZM/light/" rel="nofollow">http://jsfiddle.net/donejs/3NkZM/light/</a></p> <p>i want the box to turn green for correct and red for incorrect.</p> <p>Ie i am drag would be correct and drag me to to be incorrect</p> <p>i have tried a few different methods such as:</p> <pre><code> $('.drag').on('draginit', function(ev, drag) { // Create a ghost for this drag drag.ghost(); }); $('.drop').on({ 'dropover' : function(ev, drop, drag) { $(this).addClass('highlight'); }, 'dropout' : function(ev, drop, drag) { $(this).removeClass('highlight'); }, 'dropon' : function(ev, drop, drag) { if('#correct') { $(this).addClass('green') } else { $(this).addClass('red') }; }; }); </code></pre> <p>can anyone point me in the right direction ?</p>
jquery
[5]
819,359
819,360
How can I add a "copy to clipboard button" to copy the output of the following scripts (browser checks)
<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;JavaScript Flash HTML Generator Library&lt;/title&gt; &lt;script type="text/javascript" src="flash_detect.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="browser.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="pop.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; if(FlashDetect.installed){ document.write("Your Flash Player Version is "+ FlashDetect.major + " and your browser is " + BrowserDetect.browser + ' ' + BrowserDetect.version + ' ' + "your screen resolution is: " + screen.width + "x" + screen.height) } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>'("Your Flash Player Version is "+ FlashDetect.major + " and your browser is " + BrowserDetect.browser + ' ' + BrowserDetect.version + ' ' + "your screen resolution is: " + screen.width + "x" + screen.height)' The purpose of these are to detect browser capabilities. </p>
javascript
[3]
3,555,841
3,555,842
Javascript error : object required
<p>I am calling a javascript function in a button in aspx page like </p> <pre><code>OnClientClick= "printText(document.getElementById('PrintPayslipPart').innerHTML)" </code></pre> <p>and function is;</p> <pre><code>function printText(elem) { PrintPaySlip = window.open('RP_PrintPaySlip.html','PrintPaySlip','toolbar=no,menubar=yes,width=1000, Height = 700, resizable=yes,scrollbar=Yes'); PrintPaySlip.document.open(); PrintPaySlip.document.write("&lt;html&gt;&lt;head&gt;"); PrintPaySlip.document.write("&lt;/head&gt;&lt;body onload='print()'&gt;"); PrintPaySlip.document.write(elem); PrintPaySlip.document.write("&lt;/body&gt;&lt;/html&gt;"); PrintPaySlip.document.close(); } </code></pre> <p>I am using <code>.net 3.5</code> and <code>ajaxcontrolltoolkit 3.5.40412.2</code></p> <p>When clicking on button the error shows as "Microsoft JScript runtime error: Object required".</p>
javascript
[3]
4,313,638
4,313,639
passing parameters to a soap webservice in android
<p>I am working on an android application.I want to pass values to soap webservice.But i am not getting any response.Can anybody tell how should i pursue..</p> <p>Thanks in advance Tushar</p>
android
[4]
4,935,648
4,935,649
Exception Stack Trace difference between Debug and Release mode
<p>The code below generates different exception stack trace in both debug and release mode:</p> <pre><code>static class ET { public static void E1() { throw new Exception("E1"); } public static void E2() { try { E1(); } catch (Exception e) { throw; } } public static void Entry() { try { E2(); } catch (Exception e) { Console.WriteLine(e.StackTrace); } } } </code></pre> <p>Result in Debug Mode:</p> <blockquote> <p>at ET.E1() in D:\myStudio\CSharp\CSharp4.0\MyCSharp\ExceptionHandling.cs:line 47</p> <p>at ET.E2() in D:\myStudio\CSharp\CSharp4.0\MyCSharp\ExceptionHandling.cs:line 58</p> <p>at ET.Entry() in D:\myStudio\CSharp\CSharp4.0\MyCSharp\ExceptionHandling.cs:line 68</p> </blockquote> <p>Result in Release Mode:</p> <blockquote> <p>at ET.E2() in D:\myStudio\CSharp\CSharp4.0\MyCSharp\ExceptionHandling.cs:line 55</p> <p>at ET.Entry() in D:\myStudio\CSharp\CSharp4.0\MyCSharp\ExceptionHandling.cs:line 68</p> </blockquote> <p>Please note that the first line from the result in Release mode is missing. How to return the offending line in release mode.</p>
c#
[0]
3,628,553
3,628,554
Spinning iphone based on ground
<p>I am rotate iphone based on the ground</p> <p>But the UIAcceleration values of (x&amp;y&amp;z) are same . Can you tell me exactly what happens here ?</p> <p>Also i want know how to its calculate UIAcceleration values of(x&amp;y&amp;z) ?</p> <p>I am really interested to work with UIAcceleration values.</p> <p>Can anyone help me?</p> <p>Thanks in advance.....</p>
iphone
[8]
4,539,086
4,539,087
jQuery syntax error
<p>I am trying to set saveData when there is at least one field filled in:</p> <pre><code> $(document).ready(function () { $(":input").each(function() { if($(this).val() != "") window.setInterval(saveData, 5000); } }); </code></pre> <p>There is a syntax error <code>Expected ')'</code> in this code.</p> <p>What am I missing here?</p>
jquery
[5]
5,746,740
5,746,741
add a class to every other three lines in jquery?
<pre><code>&lt;ul id="test"&gt; &lt;li&gt;test&lt;/li&gt; &lt;li&gt;test&lt;/li&gt; &lt;li&gt;test&lt;/li&gt; // add a class to this li &lt;li&gt;test&lt;/li&gt; &lt;li&gt;test&lt;/li&gt; &lt;li&gt;test&lt;/li&gt; // add a class to this li &lt;li&gt;test&lt;/li&gt; &lt;li&gt;test&lt;/li&gt; &lt;li&gt;test&lt;/li&gt; // add a class to this li &lt;/ul&gt; </code></pre> <p>how to use jquery to add a class to the above li lines which i add a comment. thank you.</p>
jquery
[5]