Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
5,812,164
5,812,165
what is the most straightforward way of writing the content of a variable to page?
<p>I have a <code>&lt;p&gt;&lt;/p&gt;</code> and I want to put a text inside it a text that a JS variable holds, is it possible to put a <code>&lt;script&gt;</code> inside the <code>&lt;p&gt;</code> and just write it there, without using any kind of DOM searching (not even innerHTML)?</p>
javascript
[3]
2,693,337
2,693,338
Loading an Array with Stack of Cards
<p>I want a way to load 52 cards in an Array without having to hard code it. I have an array <code>suits</code> which contains "H" , "C" , "S" , "D" prefixes for each suit. I need to have a single array <code>cards[52]</code> with values H1-H13,S1-S13 etc. The problem i am facing is i can load <code>cards[0]</code> to <code>cards[12]</code> fairly easily, but how do i load the next card in <code>cards[13]</code> ? </p>
javascript
[3]
1,660,242
1,660,243
insert terms and condition page in iphone application code that is loaded when application is installed
<p>i have developed an iphone application where i have generated a terms and condition page and i wand that page to load only at that time of installation and not everytime application is run on iphone. Is there any any way to do this... i am done with this.... should i insert it into the application bundle and show it into settings...</p> <p>Thanx in advance... </p>
iphone
[8]
4,336,838
4,336,839
JavaScript and leaking global variables
<p>In JavaScript, if you do:</p> <pre><code>var myvar = 5; </code></pre> <p>Then it will be local to that file, however if you accidentally forget <code>var</code> and just do:</p> <pre><code>myvar = 5; </code></pre> <p>Then it becomes global.</p> <p>Is there any good solution to fixing this, it seems to me that the default should have been that it is local, and you should do something like <code>global myvar = 5</code> in order to get a global.</p> <p>There is <code>"use strict";</code> that I discovered to warn you but I was hoping for a more elegant solution and thought it must exist?</p>
javascript
[3]
5,872,693
5,872,694
How to use default account parameters (login/pwd) in Android phone?
<p>I want to use default user login/pwd in my app. </p> <p>Do you know how can I have access to this data?</p> <p>best, Patrick</p>
android
[4]
3,424,020
3,424,021
What is return function used for in JavaScript
<p>I have this incredibly simple example that works without return function and fails with it:</p> <pre><code> function hello() { alert('hello'); } function hi() { return function() { alert('hi'); } } </code></pre> <p>I know that by doing <code>hi()();</code> I am able to run the second function but I rarely ever see this in code. How can I do return function without doing that as I see people do that all the time.</p>
javascript
[3]
2,354,953
2,354,954
I want to put the TimerThread inside of Timer into a ThreadGroup
<p>Without using any sort of any nasty reflection. Any quick/easy way to do it (w/o copying and pasting the Timer code)?</p>
java
[1]
5,883,298
5,883,299
warning to avoid time in future in Java
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4650753/warning-message-pop-out-for-date-time">warning message/pop out for date/time</a> </p> </blockquote> <p>I have a form where a user need to enter date and time (2 different fields) and the time cannot be in future. It can either be current time or time in past only to 12 hours before. So I want to add a warning message when the time is older than 12 hours. How will be the calculation of this in Java. Please help me out!</p>
java
[1]
687,239
687,240
Advantages of paid Java Application Servers?
<p>What are the advantages of Weblogic or Websphere over Glassfish or JBoss, since they may reach costs of millions of dollars?</p> <p>Edit: Is there additional functionality? The all are Java EE Full Certified.</p> <p><strong>The question is about technology, not business or marketing. From the technological POV how are the servers different?</strong></p>
java
[1]
4,521,382
4,521,383
jQuery return false weird behavior
<p>I have a piece of jQuery code that toggles a description paragraph for a given td when users click on an anchor tag, see code below. My problem is that if I put the return false statement as shown, the code works fine in IE but in FF it would not show the description at all, which is expected. When I put the return false after the toggling it works fine in FF but in IE it would show the description and then hides it right away. Is there any way to get it to work properly in both??</p> <p>Thanks in advance.</p> <pre><code>$(".name").click(function(){ return false; $(this).parent() .parent() .find(".description") .animate({ opacity: "toggle", "slow"); }); </code></pre>
jquery
[5]
2,276,498
2,276,499
Multiple functions in jquery .live
<p>I am wondering if it is possible to bind multiple function to one live event.</p> <pre><code>$('.block a.submit').live("click", function(){ $(this).text('Save').parent().each(function(){ $(".value", this).hide(); $(".edit", this).show(); $(this).find('.edit :first').focus(); //focuses on first form element - less clicks $('thead').show(); }); }, function(){ $(this).text('Edit').parent().each(function(){ $(".edit", this).hide(); $(".value", this).show(); $('thead').hide(); }); } ); </code></pre>
jquery
[5]
643,799
643,800
main function stack size
<p>Max function stack size is limited and can be quickly exhausted if we use big stack variables or get careless with recursive functions.</p> <p>But main's stack isn't really a stack. main is always called exactly once and never recursively. By all means main's stack is static storage allocated at the very beginning and it lives until the very end. Does it mean I can allocate big arrays in main's stack?</p> <pre><code>int main() { double a[5000000]; } </code></pre>
c++
[6]
3,471,948
3,471,949
Starting other Applications with Java
<p>Is it possible to start other application that are installed on the system with my java app and pass a file as a parameter to them? I have a client which receives videos from a server and I want my client program to start, lets say the VLC player with the file that I received. How do I manage to do that?</p>
java
[1]
4,619,838
4,619,839
How is long long implemented in C++?
<p>In C++, as far as I know, all data types are implemented as classes. ( Don't know if it is right, but I read it as a justification for statements such as <code>int a(5);</code> which calls the parametric constructor of int. )</p> <p>If so, how are long and short implemented? I just found out that <code>long long</code> and <code>short short</code> are valid types but <code>short long</code> and <code>long short</code> are not (Checked the latter ones just because it sounds funny!)</p> <p>Similarly, how are signed and unsigned implemented?</p> <p>PS. By implemented, what I mean is "Is written using C/C++ features or is it written at a lower level in the compiler itself".</p> <hr> <p>So the equivalent parts of declaration of variable of a basic type and a userdefined object or variable is (read downwards)</p> <pre><code>auto|register|static|extern &lt;=&gt; auto|register|static|extern const &lt;=&gt; const (signed|unsigned)(long|short)datatype &lt;=&gt; class name etc variable name &lt;=&gt; object/variable name </code></pre> <p>? Is that assusmption correct?</p>
c++
[6]
1,193,672
1,193,673
Why does Python make self explicit?
<p>Why does Python need an explicit <code>self</code> parameter in every argument list?</p> <p>For example in the class Complex given in the documentation</p> <pre><code>class Complex: def __init__(self, realpart, imagpart): self.r = realpart self.i = imagpart def conjugate(self): self.i = -self.i x = Complex(3.0, -4.5) # 2 instead of 3? x.conjugate() # No parameters? </code></pre> <p>I initially found it profoundly confusing, that <code>__init__( )</code> seems to require 3 arguments, but you call <code>Complex( )</code> with only 2.</p> <p>What is the reason the <code>self</code> parameter is explicit and not implicit?</p>
python
[7]
103,888
103,889
Redefinition Error
<p>I am converting an MFC application for deadlock detection in to Simple console application. During this process I found many errors saying like</p> <p>error C2365: 'CmdLockMutex' : redefinition; previous definition was 'enumerator'</p> <p>I am unable to remove this error. Kindly if someone could help me in this regard. </p>
c++
[6]
3,032,875
3,032,876
Handling old data in new app versions in ANDROID...!
<p>Handling old data in new app versions,</p> <p>e.g.: in Internal or External storage's data, if I changed some App's generated folder's name then data would we copied into new folder.</p> <p>For databases you can use the built in SQLiteOpenHelper class it has the onUpgrade method.</p> <p>Is there any to do for Internal or External storage's data ???</p> <p>thanks...!</p>
android
[4]
1,313,773
1,313,774
Javascript code to select check boxes not working in IE8
<p>I've got the following code to that toggles selecting all checkboxes with a certain name.</p> <p>The code works great in webkit based browsers but doesn't work at all in IE8.</p> <p>Selecting toggle all, doesn't select anything.</p> <pre><code>&lt;label class="checkbox"&gt; &lt;input name="product" type="checkbox" id="7553" value="true" title="option1"&gt; option1 &lt;/label&gt; &lt;label class="checkbox"&gt; &lt;input name="product" type="checkbox" id="65693" value="true" title="option2"&gt; option2 &lt;/label&gt; &lt;label class="checkbox"&gt; &lt;input type="checkbox" onClick="toggle(this)"&gt;&lt;strong&gt;Select all&lt;/strong&gt; &lt;/label&gt; </code></pre> <p>Here's the JS</p> <pre><code>&lt;script type="text/javascript"&gt; function toggle(source) { checkboxes = document.getElementsByName('product'); for(var i in checkboxes) checkboxes[i].checked = source.checked; } &lt;/script&gt; </code></pre> <p>Can anyone see why the above doesn't work in IE8?</p> <p>Thanks</p>
javascript
[3]
3,506,552
3,506,553
blob storage of image type
<p>I would like to retrieve an image saved as a blobtyped data in a database. How can I get it and save it into an Image/Bitmap object ? </p>
c#
[0]
5,706,617
5,706,618
Remove all before certain delimiter starting at end of string PHP
<p>Hey, I need help isolating part of a url in PHP.</p> <p>say I have</p> <p><a href="http://www.test.com/something/something/important/" rel="nofollow">http://www.test.com/something/something/important/</a></p> <p>How could I isolate the "important"</p> <p>Thanks!</p>
php
[2]
4,205,479
4,205,480
How to disable an item in a Spinner
<p>Is it possible to display particular entries in a Spinner list as disabled? i.e. I want to always display a spinner with 4 entries (North, South, East and West, say), but I want to be able to disable any one of these so that is appears greyed out and not selectable.</p> <p>Is this possible, or will I have to recreate the list each time, leaving out the invalid entries?</p> <ul> <li>Frink</li> </ul>
android
[4]
5,342,331
5,342,332
detail disclosure with number
<p>is it possible to implement a detail disclosure button on a table view cell that displays the number of items in that category or do i need to make a custom cell for that?</p>
iphone
[8]
740,290
740,291
Parse: Retrieving Child from Parent
<p>I am using <a href="https://www.parse.com/" rel="nofollow">Parse</a> and created a one-to-one relationship between two models (a location has a queue). How can I retrieve an attribute of the queue using just the location?</p>
android
[4]
1,897,597
1,897,598
PYTHON - Add on to list
<p>What can I write that will add on whatever the user inputs (raw_input / input) to an already existing list? Also, this will have to continue on. For example, if the user adds one item to a list, it will ask if they would like to add another. And if the answer is yes, then it will add another item to the list.</p> <p>Thanks for any help!</p>
python
[7]
1,174,142
1,174,143
Multilanguage website with PHP
<p>I am currently working on a website which will be international, so it needs to come with different languages.</p> <p>I have a folder named "lang" with files such as en.php, no.php, and so on.. The files consist of an array with different words.</p> <p>My question is how i should use this. Should i save the language in the persons computer with cookies? Or should I save the ip adress and assign a language to it and save it in the database, or should i pass a &amp;land=en parameter in the url all over the website?</p> <p>Any ideas and thoughts about how one should handle multilanguage websites?</p> <p>Best of regarsds, Alexander</p>
php
[2]
4,095,308
4,095,309
Printing multiple messages in Android software
<p>I have been searching other stackoverflow questions and also looking through the android developer guide but I have not found an solution yet.. In my program I ask the user to enter in a homework assignment that they have just received. From there I take that message and I print it on a new screen. What I want to be able to do is save the previous messages entered in and print those out each time along with the new message. What I am having trouble is printing more than one message at a time. I used setContentView but it only prints one message. Does anyone have any advice? I have posted my code at the bottom:</p> <pre><code> public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_message); getActionBar().setDisplayHomeAsUpEnabled(true); // Get the message from the intent Intent intent = getIntent(); String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); // Create the text view TextView textView = new TextView(this); textView.setTextSize(40); textView.setText(message); saveHomework(message); // Set the text view as the activity layout setContentView(textView); } public void saveHomework(String message) { String message2 = message; TextView textView2 = new TextView(this); textView2.setTextSize(40); textView2.setText(message2); setContentView(textView2); } </code></pre>
android
[4]
546,250
546,251
dynamically configuring views for a ViewPager widget?
<p>First let me say that I'm very new to android development (although I have a good understanding of the basics of java), and I am building a magazine reader app for a campus publication I work for. </p> <p>I want to display each article using a ViewPager widget. I'm going to build a java program which enables the magazine editor to post articles in .txt format onto a server, along with images associated with each, and have the android app periodically download these articles to a local folder. </p> <p>I'm a little confused about how to construct the views for each ViewPager from the text files. Somehow my logic needs to determine the size of the screen running the app, in order to know how many words can fit on each screen. </p> <p>Is this right, or am I fundamentally misunderstanding ViewPager somehow? If so, how might I structure the program to configure the views dynamically based on the txt + images given to it?</p>
android
[4]
5,160,374
5,160,375
jQuery slider breaks if user clicks next before it can hide the button
<p><strong>Before I start, I am well aware of all the different Slideshow plugins available for jQuery but I have chosen to build a custom version myself for various reasons.</strong> So please don't link to plugins etc as I have seen them all before and don't wish to use them.</p> <p>The following slideshow DEMO >> <a href="http://jsfiddle.net/mm7sx/" rel="nofollow">http://jsfiddle.net/mm7sx/</a></p> <p>Everything works fine apart from if a user clicks the next button too fast and they get to the last div in the slideshow they can call the next div (which doesn't exist) before the next button can disappear.</p> <p>Any ideas on how to fix this? I'm not sure what the exact problem is, but I'm guessing that the problem is related to me NOT checking if a next div exists before trying to load the next div... Does anyone have any suggestions? Ideas for improvements to get around this issue?</p> <p>I've tried doing an if statement checking if the length of next is greater than zero or not but that didn't fix the problem either.</p> <p>Thanks</p>
jquery
[5]
940,855
940,856
how to make full row clickable in listview android
<p>I have a ListView with contents as suppose android in 1st row,blackberry in second row and iphone in 3rd row so on now I want to make ListView's whole row clickable but when I click above content of listview row then it performs only click event but I want if I click any where in a row then a click action should be performed.My code for making listview clickable is below:</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.listartistspacedetailview); setListAdapter(new ArrayAdapter(this,R.layout.listitem_layout,R.id.barrio, keywordxmlparsing.array_artistname)); } @Override protected void onListItemClick(ListView l, View v, int position, long thisID) { Intent i = new Intent(Artistspacedetailview.this, Loadingimagetab.class); startActivity(i); } </code></pre> <p>and ListView tag in xml file is :</p> <pre><code>&lt;ListView android:clickable="true" android:layout_marginLeft="10dip" android:layout_marginRight="10dip" android:id="@+id/android:list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:layout_below="@id/horizontolline" android:cacheColorHint="#00000000" android:drawSelectorOnTop="false" /&gt; </code></pre>
android
[4]
2,991,805
2,991,806
Double template<> statements
<p>There is such function definition:</p> <pre><code>template&lt;&gt; template&lt;&gt; void object::test&lt;1&gt;() { } </code></pre> <p>What does it mean that there are double template&lt;>?</p> <p>EDIT:</p> <p>I extracted code which is valid for this example:</p> <pre><code>#include &lt;iostream&gt; template &lt;class U&gt; class A { template &lt;int n&gt; void test() { } }; template &lt;class T&gt; class B { public: typedef A&lt;T&gt; object; }; typedef B&lt;int&gt;::object object; template&lt;&gt; template&lt;&gt; void object::test &lt; 1 &gt; () { } int main() { return 0; } </code></pre> <p>This code compiles under g++.</p> <p>Source: <a href="http://tut-framework.sourceforge.net/doxygen/basic_2test__vector_8cpp-example.html">TUT test framework</a></p>
c++
[6]
129,194
129,195
Constructing a random string
<p>How to construct a string to have more than 5 characters and maximum of 15 characters using random function in python</p> <pre><code> import string letters = list(string.lowercase) </code></pre>
python
[7]
3,829,086
3,829,087
How to Convert 2-D array into Image in c#
<p>I have a 2D array of integers in c#. </p> <p>Each entry in the 2-D array correspond to a pixel value</p> <p>How can i make this 2-D array into an image file (in C#)</p> <p>Thanks</p>
c#
[0]
2,033,329
2,033,330
Which licenses are required for developing an iPhone application?
<p>I see two possible licenses you might need for iPhone application development. The Company Developer and the Enterprise Developer. When might I need one or the other or both?</p>
iphone
[8]
1,991,945
1,991,946
Element to use where a taller toolbar is needed (Google maps style with 2 textfields)
<p>I am wondering what element can be used where the usual 44px won't do. There doesn't seem to be an obvious option.</p>
iphone
[8]
5,433,198
5,433,199
How to open a pdf file new browser window in javascript
<p>I need to open a pdf file in new browser tab. How to do this. I was using </p> <pre><code>var docLocation = '../downloads/doc.pdf'; window.open(docLocation,"resizeable,scrollbar"); </code></pre> <p>But it opens a download dialog box of the browser. How to achieve this ?</p>
javascript
[3]
137,336
137,337
Find calling iframe id
<p>I have a number of iframes calling a function in my main page. Is there a way to find out the ID of the iframe which called the function?</p> <p>There are all part of same domain so that should not be an issue.</p> <p>Thank you for your time.</p>
javascript
[3]
5,588,131
5,588,132
request error Error Domain=SKErrorDomain Code=0 "Operation could not be completed. (SKErrorDomain error 0.)"
<p>I am working on IN App purchase, storekit.</p> <p>I am getting this error:</p> <blockquote> <p>request error Error Domain=SKErrorDomain Code=0 "Operation could not be completed. (SKErrorDomain error 0.)"</p> </blockquote> <p>What does this means?</p>
iphone
[8]
3,411,250
3,411,251
parse json data with javascript
<p>I have a proxy script that outputs json data via php, and I want to be able to manipulate this data using javascript. I have the following code, but it only gets the entire json string outputted by the php script. How do I take the data and be able to access the individual objects with in this json data?</p> <pre><code>var xmlhttp; function loadXMLDoc(url, cfunc) { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = cfunc; xmlhttp.open("GET", url, true); xmlhttp.send(); } loadXMLDoc("http://xxxxx.appspot.com/userbase_us.php?callback=userdata", function() { if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) { var json = xmlhttp.responseText; alert(json); } }); </code></pre>
javascript
[3]
1,783,304
1,783,305
ASP.NET MVC 3 Custom AuthorizeAttribute filter
<p>I created a custom AuthorizeAttribute to limit the access to some controllers, but the controllers are devided into modules depending on roles, so i need to get the directory of the controller and use it in my filter. is there a way to do this?</p>
asp.net
[9]
4,478,443
4,478,444
Can't execute Android project with importing existing project as library
<p>I'm trying to execute GDCatalog application (example of GreenDroid library). At the first I add GreenDroid library project, that's OK. But when I added GDCatalog application which is related to GreenDroid library, and there are some problems in xml:</p> <pre><code>&lt;resources&gt; &lt;style name="SeparatorItemView" parent="GreenDroid.Widget.ItemView.SeparatorItemView"&gt; &lt;item name="android:background"&gt;@drawable/separator_bg&lt;/item&gt; &lt;/style&gt; &lt;style name="TextAppearanceLarge" parent="@style/TextAppearance.Large"&gt; &lt;item name="android:textSize"&gt;18sp&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>Errors: error: Error retrieving parent for item: No resource found that matches the given name 'GreenDroid.Widget.ItemView.SeparatorItemView'. error: Error retrieving parent for item: No resource found that matches the given name 'GreenDroid.Widget.ItemView.SeparatorItemView'.</p> <p>But I don't understand what these errors mean. Styles in GreenDroid library project exist. Please help me. </p>
android
[4]
2,669,443
2,669,444
Is it possible to avoid table view row selection in android titanium
<p>How to disable table view row selection into in titanium for android application? in iphone is possible by selectionStyle:Titanium.UI.iPhone.TableViewCellSelectionStyle.NONE and in android i tried Titanium.UI.createTableView({ allowsSelection: false }); and row.selectionStyle = 'none'; but it's not working.. if anyone have a solution please help it will much appreciate .</p> <p>Thanks in advanced..</p>
android
[4]
916,116
916,117
show or hide controls based on databound values
<p>I have a section in an edit form (using <code>&lt;asp:FormView&gt;</code>) which I would like to display in a different way depending on the value of a databound field.</p> <p>It currently looks something like this:</p> <pre><code>&lt;asp:Panel runat="server" Visible='&lt;%# Eval("ClosedBy") != null %&gt;'&gt; Closed by user &lt;%# Eval("ClosedBy") %&gt; on &lt;%# Eval("ClosedDate") %&gt; &lt;asp:Button runat="server" Text="Reopen" OnClick="Reopen" /&gt; &lt;/asp:Panel&gt; &lt;asp:Panel runat="server" Visible='&lt;%# Eval("ClosedBy") == null %&gt;'&gt; &lt;asp:Button runat="server" Text="Close" OnClick="Close" /&gt; &lt;/asp:Panel&gt; </code></pre> <p>(I have simplified this example slightly, there is a bit more content in both the Panels.)</p> <p>Is there a better way of dealing with this? Is there a way to avoid writing the display condition twice, once for the 'if' Panel and once for the 'else' Panel?</p>
asp.net
[9]
3,964,096
3,964,097
Is there any book in Java which explains the concept with diagrams. Like for C# there is illustrated C#.?
<p>I am interested in learning core java. Please suggest if there is any such book in java which explains the programming language and concepts with Diagram/Pictures. I have read a book in C# with diagrams which is called Illustrated C#.</p> <p>I am a professional programmer who has worked in C# and C++. Want to learn Core Java.</p> <p>Also suggest if you know good book to read for core java.</p> <p>Thanks.</p>
java
[1]
1,919,258
1,919,259
php variables question
<p>Is it possible to create a variable with a reg expression of some sort or some other type of code that might complete the below task?</p> <p>For instance, the data in var test = parta but could also be equal to partm. Note i don't want an array... </p> <p>I'm using this in a sql search, but I have 1000s of different models and series and only want to return certain series of models without returning series similar to the input... </p> <p>Is there something that will allow that fifth character to be a list of desired characters...?</p> <p>Another example i have model </p> <p>two models in same series</p> <p>515-n</p> <p>515m</p> <p>model in different series 1515</p> <p>I don't want to return the 1515 if im searching the 515 series...</p> <p>Note that this isn't the only combination... so the search cannot be specified to just this one... needs to be generic result.</p>
php
[2]
3,704,374
3,704,375
Why does this code raise: `Uncaught SyntaxError: Unexpected token catch`
<p>The following JavaScript snippet raises <code>SyntaxError: Unexpected token catch</code> immediately upon loading the script:</p> <pre><code>try { // Client error (e.g., form validation) if ((jqXHR.status === 400) &amp;&amp; data.errors) { // do something } // Server error (e.g., can't send email) else if ((jqXHR.status === 500) &amp;&amp; data.errors) { // do something else } // Unknown error else { throw; } } catch(e) { // Handle error } </code></pre> <p>Unlike the other <code>SyntaxError: Unexpected token</code> questions on SO, this problem is not caused by malformed JSON or simply forgetting a brace. There's something wrong with the syntax, but it's not immediately clear what it is.</p>
javascript
[3]
2,589,843
2,589,844
custom delete button uitableview iphone sdk
<p>I wanted swipe a custom view into a UITableViewCell. I can set and use the swipe delete button but I want to have the same effect with any view.</p>
iphone
[8]
969,978
969,979
Permission denied error while call webservice using HTTP in android application
<p>I'm working in android application. I create a web service in Java. Now i want to refer a web service using HTTP. But i got <code>Permission Denied</code> error while the debugger reached the last line. The Code is:</p> <pre><code>HttpClient httpClient = new DefaultHttpClient(); HttpContext localContext = new BasicHttpContext(); HttpGet httpGet = new HttpGet("http://192.168.0.102:8282/SampleWebProj/services/Converter"); response = httpClient.execute(httpGet, localContext); </code></pre> <p>Plz Give me a solution..</p>
android
[4]
402,403
402,404
Any possibility to get hold of parent calling child object?
<p>following piece of code:</p> <pre><code> class a{ public function __get($key) { if($key == 'obj') { if($b-&gt;obj == null) { //PSEUDO this is what I intend to do :) $obj = new Obj(); $b-&gt;obj = $obj } return $obj; } } } class b extends a{ private $obj = null; public function __get($key) { return parent::__get($key); } } </code></pre> <p>So the idea is to create objects on demand. But I don't know if it's possible to detect the class of the object that is calling the parent::_get method. Some operator like child is what I am looking for I guess :).</p> <p>What is possible but redundant is that for example I have one object called Country, so I define in my class User which has a Country object and another class Location with also has a Country object. Both classes extend class a. I could solve the problem by writing the if block from class a into each of the child classes. But that is what I do not want to do. So it would be easier to be able to check in class a which class called the __get function and to set the desired Country object directly into the child class. I hope my problem becomes clear and it's not too weird hehe. Though I am open for any other solutions... Thanks.</p>
php
[2]
4,851,674
4,851,675
Fullscreen UIView with Status bar and Navigation Bar overlay on the top
<p>What is the proper way to implement the status bar and navigation bar that go on top of an UIView?</p> <p><img src="http://img.skitch.com/20081217-t78sdixk37hqgdh1ia2fgec4st.png" alt="alt text" /></p>
iphone
[8]
2,604,343
2,604,344
how to make scrollable button in android
<p>Hello i'm trying to make an equalizer for my app but i can't figure out how to make the buttons. I don't really know how to explain myself so here is a picture that reveals more than my words: <img src="http://i.stack.imgur.com/FRyht.jpg" alt="enter image description here"></p> <p>Do i need animations? Can you guys point me in the right direction?</p> <p>Thanks in advance.</p>
android
[4]
902,226
902,227
Change Checkbox value without raising event
<p>I want to change Checkbox value without raising the onCheck event. I know there are work arounds like un registering ,changing the value then re- registering, Inside the event method based on flag either skip or evaluating the method statements or any other work arounds. I am looking for a cleaner ways for it.</p>
c#
[0]
5,011,881
5,011,882
removing backgroundcolor of a view in android
<p>Removing Background color in Android </p> <p>I have set backgroundColor like this in code,</p> <p>View.setBackgroundColor(0xFFFF0000);</p> <p>How to remove this background color on some event.?</p>
android
[4]
2,957,411
2,957,412
Android: How to encrypt your own database in Android
<p>I am trying to build an app that uses an already created db ... I already found a tutorial on </p> <p>how to copy it to the corect location so it can be used by a ContentProvider.But the problem </p> <p>is that I also need to protect that data ...I already found SQLCipher which is supposed to </p> <p>protected the db ... but none of the samples I found mentions on how to copy your own. I </p> <p>keep gettin an error the ContentProvider was not found .. .</p>
android
[4]
5,360,548
5,360,549
how to set range in text field for numeric up and down?
<p>how to set range in text field for numeric up and down?More over the value in the text box can be increase and decrease using up and down key also?</p> <p>i am using textbox with two images(up and down) like (for increment) and (for decrement) here how can i set range 0 to 100 (i am working in struts) </p>
javascript
[3]
580,571
580,572
JavaScript pass argument this.value to function
<p>Here is my javascript code, i want to pass current selected value of the option to my js function, in this code i used static number 6.</p> <pre><code>&lt;select name='project_name' class='required input_field' id='project_name' onchange="sendRequest('GET','getClientName.jsp?ProjectId=6')"&gt; &lt;option value=''&gt;-- Select --&lt;/option&gt; &lt;option value="1"&gt;Project 1&lt;/option&gt; &lt;option value="2"&gt;Project 2&lt;/option&gt; &lt;option value="3"&gt;Project 3&lt;/option&gt; &lt;/select&gt; </code></pre> <p>help me to solve this...</p>
javascript
[3]
4,992,495
4,992,496
How to call an activity from service with Notification Bar
<p>This is my sistuation</p> <p>A1 = Splash Screen Activity</p> <p>A2 = Main Activity</p> <p>A3 = Extra Activity</p> <p>S1 = GPS Service</p> <p>I start with A1 that creates intent to launch A2 and then A1 finish. Inside A2 I create and bind S1 (Inside S1 I make a Notification)</p> <pre><code>CharSequence text = getText(R.string.local_service_started); Notification notification = new Notification(R.drawable.notify_icon, text, System.currentTimeMillis()); Intent i = new Intent(); i.setClassName("xxx.yyy.zzz.kkk", "xxx.yyy.zzz.kkk.A2"); i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_UPDATE_CURRENT); notification.setLatestEventInfo(this, getText(R.string.local_service_label), text, contentIntent); mNM.notify(NOTIFICATION, notification); </code></pre> <p>Now I have my icon in the notification bar If I press HOME button inside my A2 activity and open another application and then I press my notification icon all is working correctly and I gate back my A2 activity(A2 is the top most activity), but if inside A2 I launch A3 and go back HOME and press the notification I have the problems, A2 is created as a new instance(A2 now isn't top most)! Is possible to have the effect like long press HOME and focus the last open activity inside my application? I don't want to open a specific activity, but bring to front my paused activity without a new instance of the activity.</p>
android
[4]
2,702,974
2,702,975
Widget to start Activity
<p>I have developed a widget. It contains image buttons. I can select a city name(in the button) and it will open another application developed by me which will display the above city in map. </p> <p>I have created the activity and the widget but don't know how to launch the application from the widget and how we can pass the city name to the application</p>
android
[4]
1,154,586
1,154,587
How to change only text node in element
<p>I have next html:</p> <pre><code>&lt;label for="user_name"&gt; &lt;abbr title="required"&gt;*&lt;/abbr&gt; Name &lt;/label&gt; </code></pre> <p>And I want to change label caption to <code>Title</code> with jquery. So I do</p> <pre><code>$('label[for=user_name]').html('Title') </code></pre> <p>And it replace all inner html (with <code>abbr</code> tag)</p> <p>So, what the easiest way to replace only <code>Name</code>?</p>
jquery
[5]
2,597,266
2,597,267
how to add icon in alert dialog before each item?
<p>i am using alert dialog with code below now i want to put image before each text</p> <p>for example email icon then text Email, facebook icon then text Facebook etc.. in alert dialog</p> <p>using following code please guide how to add icon before each text value?</p> <pre><code>final CharSequence[] items = { "Email", "Facebook","Twitter","LinkedIn"}; AlertDialog.Builder builder = new AlertDialog.Builder(More.this); builder.setTitle("Share Appliction"); builder.setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { if (item == 0) { } else if (item == 1) { }else if(item == 2) { } else if(item == 3) { } } }); AlertDialog alert = builder.create(); alert.show(); </code></pre>
android
[4]
5,952,266
5,952,267
Windows 7 Compatibility Issue in .NET
<p>When we create a SetUp &amp; Deployment project for our application in .net, the default folder for our application to be installed is being set as <code>C:\Program Files.....</code> Our application will run perfectly if we are using a Windows XP machine. But if we are using a Windows Vista or Windows 7 machine, the application wont run perfectly, especially if we are performing any file operations in our application...</p> <p>Can anyone find a solution for this problem? Is there any means to penetrate this User Account Control and File Access Controls of Windows 7? or can any1 give a choice to change the default installation folder from <code>[ProgramFilesFolder]\[Manufacturer]\[ProductName]</code> to some other folder?</p>
c#
[0]
1,979,597
1,979,598
Vbscript in Firefox
<p>Does firefox have VBScript &amp; Activex support?</p>
asp.net
[9]
2,951,502
2,951,503
Control precision/printing of exponential numbers
<p>What is the best way to control printing of 64-bit floating point numbers in Python?</p> <p>I can use the <code>%e</code> specifier to easily show all numbers in exponential format. However, I only want to use exponential format if the number has more than x amount of digits in it. For example, below is the raw 64-bit floating point number and what I would like it to look like as a string:</p> <pre><code>value what's printed 1.123456 1.123456 123456.1234 12345.6e4 1.0 1.0 .1234567 1.23456e-1 </code></pre> <p>Above I only want to see 7 digits total and then convert to exponential notation if there are more needed.</p> <p>Does this make any sense? Essentially I would like to be able to use exponential notation only when some threshold for the number is reached. I know <code>%e</code> allows specifiers like <code>%.3e</code> but this will always use exponential notation regardless of the number size.</p>
python
[7]
712,460
712,461
Why should ViewState be encrypted when post data is not?
<p>Exactly that. I don't understand it quite.</p> <p>ViewState encryption is provided in order to protect user-data privacy, but what is the point of setting ViewState to be encrypted if, e.g., using http (not https) posted form data is clearly visible for an interceptor from the http messsage body?</p> <p>Thanks for clarifying.</p>
asp.net
[9]
4,015,907
4,015,908
How the function will behave in case of difference in no. of arguments passed and no. of arguments defined in the function definition in PHP?
<p>I'm a newbie to PHP. I've a following function call:</p> <pre><code>UpdateUserTestStatus($user_id, $user_test['test_user_test_id'], $user_test['test_user_start_time'], $user_test_time); </code></pre> <p>The definition of function is as follows:</p> <pre><code>function UpdateUserTestStatus($user_id, $test_id, $user_test_start_time, $user_test_time, $test_pack_id) { if($user_id!='' &amp;&amp; $test_id!='') { $sql = " UPDATE ".TBL_TESTS_USERS." SET test_user_status='present', "; $sql .= " test_user_start_time=".$user_test_start_time.", test_user_time_used=".$user_test_time; $sql .= " WHERE test_user_user_id='".$user_id."' AND test_user_test_id=".$test_id; $sql .= " AND test_pack_id='".$test_pack_id."' "; $this-&gt;mDb-&gt;Query($sql); return true; } else return false; } </code></pre> <p>So my question is, does that work in PHP having different no. of arguments in function call and having different no. of arguments present in the function definition? Please guide me in this issue. Thanks in Advance. </p>
php
[2]
1,240,051
1,240,052
Android : Suggestion for displaying study contents
<p>I am developing an educational application in which I have to show various study material for student like for Engineering, Schoolers etc. In study contents there is combination of various things like Images, Text and sometimes animation.</p> <p>I will get all study contents via php server and my problem is that I am confused that in which format I should display all contents. I tried uploading data on php in PDF format and display it on android device but for this I have to download the pdf file on device.</p> <p>I also tried to use HTML data and show it on devie but the problem is that how user will upload its data in HTML format. A normal user don't know HTML.</p> <p>Is there any good way for both me and end user to show data in device?</p> <p>Please suggest me any other way by which I can display study contents on device.</p>
android
[4]
4,539,048
4,539,049
How To Convert double/binary and vice versa?
<p>I would like to convert 14.4689 or 13.3616 to binary data (bits) in php. How Can I do this?</p> <p>Thanks for helping</p> <p>Stephane</p>
php
[2]
4,844,928
4,844,929
How to assign velocities using a maxwell-boltzmann distribution in Java
<p>I am currently working on a model of gas particles in a container. When I initialise the particles I am currently giving them all the same magnitude of velocity (Varying +/- directions).. I need to find a way to change this so that the velocities follow a maxwell boltzmann distribution.</p> <p>Does anyone have any idea how to go about this? </p>
java
[1]
778,796
778,797
read INTs from .txt in CMD (formatted txt) java
<p>I have to write a program for a project. THe program itself works perfectly. But I have an additional requirement:</p> <p>The programm needs to be open over the console via java MyProgramm input.txt 2 3 (This is an example input statement, where input is a txt file that contains a single number followed by pairs of two numbers(ints). Pairs are separated by a line break, numbers of the pairs are separated by space).</p> <p>I need to read these numbers into an int and an int array[][] and two ints.</p> <p>How can I achieve this? I already solved a similar problem where all numbers where single ints each on a new line. But here I'm stuck.</p> <p>There are some solutions here, but none seems to suit my specific problem!?</p> <p>Thanks, Dave</p>
java
[1]
1,408,483
1,408,484
How to use non-standard (hidden) API classes?
<p>I'm fairly new to Android and have gone through the basic tutorials. I thought I'd dig a little deeper and downloaded the source code to some of the "native" Android apps, like IM, Email, Voice Dialer, etc.</p> <p>In importing the source of these native apps into Eclipse, I found that they reference classes that are not in the 2.1 API, i.e. classes such as android.content.Entity, android.net.http.DomainNameChecker, etc. As a result, I can't compile and play with this code.</p> <p>So is there is a "hidden" API that the native apps use that is not available to the regular app developers? Is there a "native" SDK I can use to import these classes?</p> <p>David</p>
android
[4]
4,083,166
4,083,167
Libgdx vs AndEngine vs Cocos2d vs Open GL ES- whats the difference
<p>I'm pretty new to game development on Android and wanted to know a bit more about these technologies. I'm not quite sure what the difference is between these technologies. All seem similar. Could anyone shed some light on these terms (Libgdx vs AndEngine vs Cocos2d vs Open GL ES)? Thanks.</p>
android
[4]
5,622,318
5,622,319
Implement a final class without the "final" keyword
<p>A friend of mine was asked that question in his on-phone job interview a couple of days a go. I don't have a clue. can anyone suggest a solution? (His job interview is over. just out of curiosity now ) 10x.</p>
java
[1]
4,905,279
4,905,280
iphone, can we set the option 'Send From' of the email when use MFMailComposeViewController?
<p>as topic.... I just want change the value 'Send From' when compose new email. but seem it is impossible......</p> <p>anyone can give tips ? </p> <p>many thanks.</p>
iphone
[8]
3,593,511
3,593,512
Random banner change and not displaying the first image whenever it complete the cycle
<p>Actually i have 10 banner and i want to change it random when page refresh. Banner change and complete its cycle of 10 banners before repeating it..</p> <p>I am using this code</p> <pre><code>$banners=$objCms-&gt;getbanners(); for($count=0;$count&lt;count($banners);$count++) { $image[$count]['path']= $banners[$count]['path']; $image[$count]['bid']= $banners[$count]['bid']; $image[$count]['bannerlink']=$banners[$count]['bannerlink']; $image[$count]['name']=$banners[$count]['banner_name']; $image[$count]['url']=$banners[$count]['bannerlink']; } $bannerAdTotals=count($image)-1; if($bannerAdTotals&gt;0) { //mt_srand((double)microtime() * 1234567); $bannerPicked = mt_rand(0,$bannerAdTotals); } else { $bannerPicked = 0; } ?&gt; </code></pre> <p>...................banner show here.................</p> <p>Please help me............</p>
php
[2]
1,961,361
1,961,362
Non-trivial selections using jQuery based on content of previous element
<p>Consider the following markup:</p> <pre><code>&lt;x&gt; &lt;y&gt;code1&lt;/y&gt; &lt;z&gt;stuff&lt;/z&gt; &lt;y&gt;code2&lt;/y&gt; &lt;z&gt;foobar&lt;/z&gt; &lt;/x&gt; </code></pre> <p>Using jQuery, how do I select the <code>&lt;z&gt;foobar&lt;/z&gt;</code> node in the given markup using the following rule: find the <code>z</code>-node that follows after a <code>y</code>-node which has a body containing <code>"code2"</code>?</p>
jquery
[5]
5,907,323
5,907,324
Wait for method to finish
<p>How can I wait for a method to finish using C#?</p>
c#
[0]
4,135,971
4,135,972
extend/append list
<p>I would like to either extend or append a list to the content of another list: I've got the following:</p> <pre><code>l = (('AA', 1.11,'DD',1.2), ('BB', 2.22, 'EE', 2.3), ('CC', 3.33, 'FF', 3.45)) ls = [('XX', 7.77), ('YY', 8.88), ('ZZ', 9.99)] m = ['first', 'second', 'third'] for i in range(len(l)): result = [] for n in m: if n == "first": r=[] for word, number in ls[i]: temp = [word, number] r.append(temp) for t in r: result.extend(t) print result </code></pre> <p>I would like to see the following result when the 'result' is printed out in the above code (each in newline):</p> <pre><code>['AA', 1.11, 'XX', 7.77] ['BB', 2.22, 'YY', 8.88] ['CC', 3.33, 'ZZ', 9.99] </code></pre> <p>Many thanks in advance.</p>
python
[7]
1,564,352
1,564,353
Iterator java nested loop
<p>I've a question: there is a way to increment an iterator directly into nested loop? Example</p> <pre><code>while(budgets.iterator().hasNext()){ if(budgets.iterator().next().getTipoBudget()!="I"){ if(budgets.size()&lt;maxInviate){ for(i=0; i&lt;maxInviate ;i++){ if(budgetArray[i]==0 &amp;&amp; budgets.iterator().hasNext()){ budgetArray[i] = budgets.iterator().next().getBudgetField(); } } i=0; Set budgetSet = new HashSet&lt;Integer&gt;(Arrays.asList(budgetArray)); Integer min = Collections.min(budgetSet); valueAdw = valueAdw + min; for(i=0; i&lt;maxInviate; i++){ budgetArray[i] = budgetArray[i] - valueAdw; } }else{ valueAdw = null; valueAdwEnd = null; campaigns.addLast(new Campaign(valueAdw, valueAdwEnd, (long) adwordsBudget.getZona().getAdwordsCode())); } } } </code></pre>
java
[1]
973,964
973,965
How to insert data from second row in tableview in iphone
<p>i need your help.I need to insert data dynamically but insertion should be from the second row in the tableview in iphone.How can i do this. </p>
iphone
[8]
4,710,184
4,710,185
Override incoming call screen?
<p>Hello I was wondering if there is a way to override the incoming call screen to add more functionality to it? If so could you either point me in the right direction or provide some sample code? </p> <p>--------------------------------------------------EDIT: --------------------------</p> <p>I got the receiver working well when the call comes in but how would I get the current window to override the call screen? This is what I got so far... but i get a classCastException trying to cast to activity from context, I cant think of any other way to gain access to the window.</p> <pre><code>@Override public void onReceive(Context context, Intent intent) { Bundle extras = intent.getExtras(); if (extras != null) { String state = extras.getString(TelephonyManager.EXTRA_STATE); Log.w("DEBUG", state); Log.w("DEBUG", "-------------------------------------------------- Broadcast Received"); if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) { String phoneNumber = extras .getString(TelephonyManager.EXTRA_INCOMING_NUMBER); Log.w("DEBUG", phoneNumber); Activity activity = (Activity)context.getApplicationContext(); Window window = activity.getParent().getWindow(); window.addContentView(window.findViewById(R.layout.textalertbuttonview),null); Log.w("DEBUG", "------------------------Button Added"); } } else { Log.w("DEBUG", "---------------------------------------------------no Extras"); } } </code></pre> <p>--------------------------------------------------EDIT 2: --------------------------</p> <p>It doesn't seem after some research that I can actually add elements to the actual incoming call screen. So I will have to make my own view and override the incoming call screen. But I am still open for ideas... I saw incoming call plus but can not find the source code for that project.</p>
android
[4]
3,032,497
3,032,498
Mouseout and mouseleave not working
<p>Hi I am using <code>mouseout</code> and <code>mouseleave</code> methods but both are not working. I tried to fix it but cant find the solution. My code looks fine, it has no errors so I want to know why it is not working. Here is example code <a href="http://jsfiddle.net/Dpp8a/" rel="nofollow">link</a></p> <pre><code>$(".chzn-select").chosen() $(function(){ $('a').click(function(){ $('.mydiv').addClass('redbrd') }) $('.redbrd').live('mouseover', function(){ var htm= '&lt;div id="mmt"&gt;some text&lt;/div&gt;' $('body').append(htm) }) $('.redbrd').live('mouseout', function(){ $('#mmt').remove() }) }) </code></pre>
jquery
[5]
816,635
816,636
callback function of this menu button in javascript
<p>It's defined here</p> <pre><code>var CMenu = cc.Sprite.extend({ onClickCallback: null, onClick: function (callback) { this.onClickCallback = callback; }, handleTouches: function (touch, evt) { (this.hovered &amp;&amp; this.onClickCallback) &amp;&amp; this.onClickCallback();}); </code></pre> <p>It's being called here</p> <pre><code>backMenu.onClick(function () { window.location.href = "http://www.test.com"; }); </code></pre> <p>is <code>this.onClickCallback = this.onClickCallback()</code>?</p>
javascript
[3]
2,438,358
2,438,359
asp.net DataGrid file structure and linking back to it
<p>I am using a DataGrid:</p> <pre><code>&lt;asp:DataGrid runat="server" ID="articleList" UseAccessibleHeader="true" AutoGenerateColumns="false" AlternatingItemStyle-BackColor="#EEEEEE" HeaderText="File Name"&gt; &lt;Columns&gt; &lt;asp:HyperLinkColumn DataNavigateUrlField="DirectoryName" DataTextField="Name" HeaderText="File Name" /&gt; &lt;asp:BoundColumn DataField="LastWriteTime" HeaderText="Modified" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:f}" /&gt; &lt;asp:BoundColumn DataField="Length" HeaderText="Size" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,### bytes}" /&gt; &lt;asp:BoundColumn DataField="Extension" HeaderText="Type" ItemStyle-HorizontalAlign="Left" /&gt; &lt;/Columns&gt; &lt;/asp:DataGrid&gt; </code></pre> <p>Here is my code-behind page:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { DirectoryInfo dirInfo = new DirectoryInfo(Server.MapPath("examfilemanager")); articleList.DataSource = dirInfo.GetFiles(); articleList.DataBind(); } </code></pre> <p>The files inside this directory are:</p> <pre><code>01.jpg 02.jpg MyDoc.doc </code></pre> <p>I am trying to provide a direct link for the client to click on and download this. It seems the only links I can get are the name "01.jpg" which is inside a folder examfilemanager.</p> <p>The Name property of the file info properties returns just the name. (01.jpg)</p> <p>The href of the link is 01.jpg, I need that to be <code>examfilemanager/01.jpg</code> how can i make this possible?</p>
asp.net
[9]
5,000,597
5,000,598
Displaying progress dialog before starting a new activity
<p>I have an activity 'Activity1' and also another activity named 'Activity2'. The 'Activity2' is loaded upon clicking a button in 'Activity1'. I wanted to display the progress dialog until the new activity is loaded . Can you please show me the code to do this </p>
android
[4]
3,666,236
3,666,237
DLLImport error: System.AccessViolationException with Manifest file and c#
<p>When trying to call (DLLImport) an external c++ dll from a .net application that has a manifest file with requireAdministrator, I get this error trying to call function from the C++ dll in Windows 7 with UAC enabled.</p> <p>Method I am calling: EnCrypts</p> <p>System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.</p> <p>public class BlowFish { [DllImport("BlowfishTool.dll", CharSet = CharSet.Auto)] public static extern String EnCrypt(String strData, String strPassword);</p> <pre><code> [DllImport("BlowfishTool.dll", CharSet = CharSet.Auto)] public static extern String EnCrypt(String strData, String strPassword, bool doNotUsePassChecking); [DllImport("BlowfishTool.dll", CharSet = CharSet.Auto)] public static extern String DeCrypt(String strData, String strPassword, bool doNotUsePassChecking); [DllImport("BlowfishTool.dll", CharSet = CharSet.Auto)] public static extern String DeCrypt(String strData, String strPassword); public static String EnCrypts(String strData, String strPassword) { return EnCrypt(strData, strPassword, true); } } </code></pre> <p>}</p>
c#
[0]
284,618
284,619
Android Device Chooser shows my device but my app will not start on my phone! :(
<p>My Device shows up on the Android Device Chooser as:</p> <p>Serial Number -- Ige-vm670-A0000028F1773B</p> <p>AVD NAME -- N/A</p> <p>Target -- 2.2.1 (with a green check mark next to it!)</p> <p>State -- Online</p> <p>Everything seems fine..So, I press the "OK" button on the bottom right hand corner of the Device Chooser screen. When I do this the Device Chooser closes and the Launching bar in eclipse eventually finishes, but then the application never starts on my phone!! :(. Am I missing something? I tried using different USB cables, switching from USB 3.0, and checking if there is enough memory on my phone but nothing seems to work :(. PLease help this newbie!! I'd much appriciate it!! ALso, i'm running eclipse in windows 8.</p>
android
[4]
4,922,305
4,922,306
Invalid cast from 'System.String' to 'System.TimeSpan'
<p>I currently have a Generic method that reads an Value from the database based on a key and returns a specific type of that value.</p> <pre><code> public T Get&lt;T&gt;(string key, T defaultValue) { var myparms = new List&lt;SqlParameter&gt; { new SqlParameter("@KEY", key), }; const string getPropertyQuery = "SELECT SPARM_VALUE FROM SYSPARAMS WHERE SPARM_KEY = @KEY;"; var returnedValue = //Get value from Database if (returnedValue == null) { return defaultValue; //Value does not exists so return default. } return (T)Convert.ChangeType(returnedValue, typeof(T)); } </code></pre> <p>But when I try and return a TimeSpan type I get the following exception. <code>Invalid cast from 'System.String' to 'System.TimeSpan'.</code></p> <p>After a bit of googling I found that the most common solution is to use the <code>TimeSpan.Parse</code> or <code>TimeSpan.TryParse</code> methods. </p> <p>I also found <a href="http://msdn.microsoft.com/en-us/library/system.timespan.aspx" rel="nofollow">TimeSpan</a> Structure.</p> <p><code>public struct TimeSpan : IComparable, IComparable, IEquatable, IFormattable</code></p> <p>My question is why, why is TimeSpan not able to do this. Is it because it doesn't have the <code>IConvertible</code> interface? Any thoughts on this would be much appreciated.</p>
c#
[0]
5,755,990
5,755,991
Create multi-dimensinal ArrayList in java
<p>I want to create an arrayList as following.</p> <pre><code>id-&gt;1512 associated with the values -&gt; 12,45,78 id-&gt;1578 associated with the values -&gt; 456,78,87,96 </code></pre> <p>What I have to do? Should I create a 2-d arrayList or can I do that with single dimension arraylist?</p>
java
[1]
4,349,523
4,349,524
triggering browser Zoom-in and Zoom-out funtions
<p>Is it possible to trigger Browser's zoom-in and zoom-out function throught Javascript?</p> <p>I want to add Zoom-In(+) and Zoom-Out(-) buttons in my website, and by clicking on the buttom want to call browser's zoom-in (which can be called by pressing ctrl and +) / zoom-out (ctrl and -) function.</p> <p>Thanks in advance.</p>
javascript
[3]
2,239,013
2,239,014
Packing data into a buffer portably
<p>I have to place several integer values into a (32 byte) buffer, where each integer must be at a specific place in the buffer (I'm going to use the data in OpenGL VBOs).</p> <p>The way I'm doing it now is kind of ugly. All the content is supposed to be placed at the address buf2. Don't bother looking at the values I'm assigning to the buffer, as those are irrelevant to the problem.</p> <pre><code> uint32_t *const coords = reinterpret_cast&lt;uint32_t *&gt;(buf2 + CoordDataOff); uint16_t *const texcoords = reinterpret_cast&lt;uint16_t *&gt;(buf2 + TcoordDataOff); uint32_t *const color = reinterpret_cast&lt;uint32_t *&gt;(buf2 + ColorDataOff); coords[0] = x + bearing[0]; // left coords[1] = y + bearing[1] - 64*(tcoords[3] - tcoords[1]); // bottom coords[2] = x + bearing[0] + 64*(tcoords[2] - tcoords[0]); // right coords[3] = y + bearing[1]; // top copy_n(tcoords, 4, texcoords); *color = c.color; </code></pre> <p>Is there any nicer, portable way of accomplishing it?</p>
c++
[6]
2,976,310
2,976,311
Combining numbers into one Java variable
<p>I am trying to make a program that, depending on an int called <code>length</code>, adds a certain number of 9s to a variable called <code>nines</code>. For example, if <code>length</code> is 4 then I want <code>nines</code> to equal 9999. If <code>length</code> is 7, I want <code>nines</code> to equal 9999999. The value of <code>length</code> needs to correspond to the number of nines in <code>nines.</code> Is this possible, and if so, how?</p>
java
[1]
5,251,871
5,251,872
Run java file from outside its directory
<p>I am stuck in to a basic problem of java. I need to run a java file from a shell. Please see below for the scenario.</p> <p>Java file resides in com.abc.foo.test.Execution.java Shell file to execute the java file resides in the same location.</p> <p>Now from outside(Any location) I need to execute the shell file and the shell file will execute my java program.</p>
java
[1]
1,929,913
1,929,914
9patch border issues
<p>Is there a trick to making 9patch images with single pixel borders? </p> <p>I'm not talking about the single pixel black borders that you use to define the stretchable and content areas. I'm talking about the image itself. If I create an image that has a 1 pixel border around it, often times android will pick one of the edges and stretch it to 2 (or sometimes more) pixels, even though I specifically left the edges out of the stretchable area in the draw9patch utility.</p> <p>Here is a screenshot of what I mean; in this screenshot I've got two buttons in a vertical LinearLayout with the same background image. The top button obviously has a thicker border, though it shouldn't.</p> <p><a href="http://www.vimtips.org/media/button_ss.png" rel="nofollow">http://www.vimtips.org/media/button_ss.png</a></p> <p>Here is a closeup of the screenshot button (on the left) and the actual 9patch image (on the right).</p> <p><a href="http://vimtips.org/media/images/buttoncmp.png" rel="nofollow">http://vimtips.org/media/images/buttoncmp.png</a></p> <p>Buttons are not the only place I've seen this. If I create a background image with a 1 pixel border and use it as the background for ListView rows, sometimes the border appears to be 2pixels instead of just 1.</p> <p>It's hard to get a UI to look exactly how you want it with these problems. There's got to be a way to get it to appear how you think it should.</p>
android
[4]
254,098
254,099
In need of a Javascript Delay
<p>I was wondering how I could modify this code so that it has a 2 second delay before the function become active:</p> <pre><code>&lt;script type="text/javascript"&gt; function iframe_onload() { var theWaitCell = document.getElementById('Wait1'); theWaitCell.style.display = "none"; } &lt;/script&gt; </code></pre> <p>Any help would be appreciated,</p> <p>Thanks!</p>
javascript
[3]
5,742,147
5,742,148
How to add user input of Edittext to the List? in android
<p>I want my user inputs(username,userId,password) to add in the list.I am new to Android.plz help..</p> <p>Thanks in advance.</p>
android
[4]
881,443
881,444
cout<<"\n\n any key to continue or Ctrl+Z to exit."; how to hide the pressed key?
<p>At the end of my loop I have:</p> <pre><code>cout&lt;&lt;"\n\n any key to continue or Ctrl+Z to exit."; </code></pre> <p>It allows the user to continue entering data, or to exit by pressing <kbd>Ctrl</kbd><kbd>Z</kbd>. I would like to hide the pressed key when the user decides to continue entering data.</p> <p>I don't want the pressed key to appear when the user press any key to stay in the loop. How can I do that? I am using Dev-C++. the code of my function is below.</p> <pre><code>void student::read() { char response; ofstream OS ("student.dat", ios::app); do { cout&lt;&lt;"Name: "; cin&gt;&gt;name; cout&lt;&lt;"Age: "; cin&gt;&gt;age; cout&lt;&lt;"GPA: "; cin&gt;&gt;GPA; //calling writefile to write into the file student.dat student::writefile(); cout&lt;&lt;"\n\n any key to continue or Ctrl+Z to exit."&lt;&lt;endl&lt;&lt;endl; cin&gt;&gt;response; cin.ignore(); } while(cin); //Ctrl+Z to exit } </code></pre>
c++
[6]
5,549,610
5,549,611
Scroll to next div using arrow keys
<p>I want my Left/Right arrow to go to the Next/Previous <code>.embedded_post</code> div. The problem is that it only works once and I can only scroll between the first and second div. I thought it was the offset of -100 but removing the offset did not do the trick. I'm thinking that after I animate to the next div, the jQuery selector has not moved anywhere so I'm stuck.</p> <pre><code>jQuery(document).keydown(function(e){ switch(e.which) { case 37: // left jQuery('html, body').animate({scrollTop:jQuery('.embedded_post').prev().offset().top - 100}, 500); return; break; case 38: // up break; case 39: // right var next_embed = jQuery('.embedded_post').next(); jQuery('html, body').animate({scrollTop:next_embed.offset().top - 100}, 500); return; break; case 40: //down break; default: return; // exit this handler for other keys } e.preventDefault(); }); </code></pre>
jquery
[5]
2,499,846
2,499,847
How to change comma position in string with javascript
<p>I have an issue where my commas are misplaced in the string. Anyone know a replace or a similar function that could move my commas to the correct grammatical position? Example posted below:</p> <p>Cabernet Sauvignon ,Marsanne ,Red Blend ,Syrah ,Zinfandel </p> <p>I need it to look like this:</p> <p>Cabernet Sauvignon, Marsanne, Red Blend, Syrah, Zinfandel </p>
javascript
[3]
3,591,142
3,591,143
How to add JSON String to NSDictionary
<p>How to add JSON String to NSDictionary ?</p> <pre><code> NSString *j_String @"{ "comp": [ { "id": "1" }, { "id": "2" }, { "id": "3" } ], "contact": [ { "mail": "some@email.com", "name": "Name" }, { "mail": "email@email.com", "name": "Name" } ] }"; NSMutableDictionary *dic = [NSMutableDictionary dictionary]; [dic setValue:@"nvjd" forKey:j_String]; </code></pre> <p>can i do this way to add Json String into NSMutableDictionary or NSDictionary!</p>
iphone
[8]
5,970,973
5,970,974
java trouble with trees
<p>Binary trees are giving me a problem and I am trying to learn them. I need to make an array of trees and put user input into a Node. Then take those nodes and put them in a tree as the root. Then put all these one node trees in the array. I have the array of trees and the user input is creating nodes, but I'm stuck after this. Any suggestions?</p> <pre><code> class Tree { public Node root; public Tree() { root = null; } } class Node { public int iData; public Node leftChild; public Node rightChild; public void displayNode() { System.out.print('{'); System.out.print(iData); System.out.print(", "); System.out.print("} "); } } Tree myTrees[] = new Tree[3]; Scanner scan = new Scanner(System.in); Node newNode = new Node(); Node plusNode = new Node(); Node root = new Node(); char plussign[] = {'+'}; String str = new String(plussign); System.out.print(str); for (int i = 0; i &lt; myTrees.length; i++) { System.out.print("Enter value : "); newNode.iData = scan.next().charAt(0); myTrees[i] = new Tree(); myTrees[i].root = root; myTrees[i].displayTree(); } </code></pre>
java
[1]
3,750,139
3,750,140
how can i remove chars between indexes in a javascript string
<p>i have the following: </p> <pre><code>var S="hi how are you"; var bindex = 2; var eindex = 6; </code></pre> <p>how can i remove all the chars from S that reside between bindex and eindex?<br> therefore S will be "hi are you"</p>
javascript
[3]