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
679,154
679,155
Easy looking at Android source code without downloading full code
<p>I want to modify say MediaRecorder class for example. And I want to show at full source code of it. </p> <p>Where can I get source code of standard classes?</p>
android
[4]
5,642,689
5,642,690
jQuery’s deferreds down to earth
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4869609/how-can-jquery-deferred-be-used">How can jquery deferred be used?</a> </p> </blockquote> <p>deferred objects appeared in jQuery 1.5. Frankly speaking I don’t get the idea. Could you explain me how to use it based on simple, real world example? It would be nifty to show the difference between new concept (deferreds) and old style of writing the same task.</p>
jquery
[5]
492,918
492,919
Why is my application not detecting a shake gesture?
<p>I'm trying to enable shake gestures within my application but I'm having a problem. </p> <p>I have different view controllers, but on one of them (not the main view controller for the application) nothing happens in response to a shake gesture. What could be the problem? </p> <p>The relevant code is as follows:</p> <pre><code>-(BOOL)canBecomeFirstResponder { return YES; } -(void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self becomeFirstResponder]; } -(void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { if (event.subtype == UIEventSubtypeMotionShake) { NSLog (@"SHAKED"); } } </code></pre>
iphone
[8]
4,847,965
4,847,966
How do I get actual image width and height using jQuery?
<p>On a page I have displayed 100 images, which have the width and height attribute changed. Image id is in a loop. </p> <p>How do I get the original image size, inside this loop? $(this).appendTo(".prod_image").attr('height',150).attr('width',150).attr('title','').attr('name','').attr('alt','').attr('id','id'+i);</p>
jquery
[5]
2,923,013
2,923,014
Dynamic variable names Java
<p>How will I be able to retreive value of variable which has a dynamic name</p> <p>For Example I have list of constants</p> <pre><code>public class Constant{ public static final String S_R = "Standard(240)"; public static final String S_W = "Standard(180)"; public static final String L_R = "Large(360)"; public static final String L_W = "Large(280)"; } </code></pre> <p>Based on database I build a variable name </p> <pre><code>String varName = "S" + "_" +"R"; // This can be S_R , S_W , L_R or L_W String varVal = // How do i get value of S_R </code></pre>
java
[1]
4,567,834
4,567,835
Is there a way to get the current line number when executing code? c#
<p>I have a application which writes a log to a .txt file</p> <pre><code>Helper.WriteSimpleDebugTrace(securityLogFilePath, "About to authenticate user."); Helper.WriteSimpleDebugTrace(securityLogFilePath, "Directory Search Path:"); Helper.WriteSimpleDebugTrace(securityLogFilePath, "Username:" + username); </code></pre> <p>I was just wondering is there a way I could pass the current line number into this method?</p>
c#
[0]
2,176,244
2,176,245
disable button in a <li>
<p>okay, if I have six buttons in a list, under the <code>li</code> tag (each on is <code>rel</code> to a part of an array), how can I disable a button while it's doing it's thing? (In this case playing a video)</p>I know it's a little vague (i haven't supplied code or anything of the sort), but that's because I don't know how to go about it. If I could at least get pointed in the right direction, that would be helpful, so that even if I can't figure it out, at least I can be specific with my problem... thanks...</p></p><strong>EDIT</strong> this is what I've now done </p> <pre><code>&lt;li rel='1' id="first"&gt; &lt;div style="top:0px;"&gt; &lt;img src="graphics/filler.png" alt="" width="280" height="128" onClick="asess"/&gt; &lt;/div&gt; &lt;/li&gt; </code></pre> <p>and then added the corresponding function</p> <pre><code>function asess() { document.getElementById("first").disabled = true; } </code></pre> <p>I'm not to concerned with adding the function back just yet, because first I'd like to make this part work.</p></p><strong>EDIT</strong> I've got this, which should work, but I guess it's not "talking" to the button? </p> <pre><code>$("li, .thumbs").bind("touchstart click", function() { var $this = $(this); if (!document.getElementById("first").disabled) { document.getElementById("first").disabled = true } else {document.getElementById("first").disabled = false}; }); </code></pre> <p>I know it will only talk to the button with that id (first one) but as long as I can make it work for one, I can do the rest. So, what am I doing wrong?</p>
javascript
[3]
765,613
765,614
i am getting java.net.socketException in android mobile
<p>i am calling url in my application, it works fine in emulator but not works in mobile,when i run application in mobile i am getting <strong>java.net.socketException</strong> </p>
android
[4]
3,506,468
3,506,469
Fail to write to file when I force quit
<p>I have a program that looks like this. I need to consistently write something into a text file but I cannot predetermine when the program is going to end. So I force quit the program.</p> <pre><code>FILE *f = fopen("text.txt", "w"); while (1) { fprintf(f, "something"); sleep(1000); } </code></pre> <p>The problem is that the text file would be empty. Can anyone give me some suggestions? I am using XCode to do the job.</p>
c++
[6]
2,844,167
2,844,168
What is the size limit for Logcat?
<p>I believe Logcat is a circular store and I wonder what is the limit before it overwrites? </p> <p>Presumably this means that it's time range will vary according to usage.<br> Is their any way to expand it's capacity?</p>
android
[4]
4,806,623
4,806,624
Is it possible to have a data structure that is able to store different types?
<p>A single data structure to store different types in a single variable.</p> <p>Not asking for generics, some a dynamically typed data structure.</p> <p>Is it possible?</p>
java
[1]
4,454,491
4,454,492
How to use JQuery to highlight a checkobx when it is checked
<p>I am trying to use JQuery to highlight the checkboxes checked by a user,<br/> and when they will be un-highlighted when the user unchecked those checkoxes.<br/></p> <p>But how is it possible to do this effect?</p>
jquery
[5]
3,327,278
3,327,279
How do I make a program from my C++ code?
<p>I found this code:</p> <pre><code>#include &lt;iostream&gt; int main() { std::cout &lt;&lt; "Hello World!" &lt;&lt; std::endl; } </code></pre> <p>How do I run this code? What software do I need? How do I use that software to make a program?</p> <p>I thought this would be a good faq for absolute beginners. Each answer could provide detailed instructions for a particular compiler/environment.</p>
c++
[6]
5,736,299
5,736,300
How do I change the image on a <asp:buttonField type="Image" /> in code behind?
<p>I have a <code>&lt;asp:GridView &gt;</code> with a <code>&lt;asp:ButtonField ButtonType="Image"&gt;</code> as one of the columns.</p> <p>Here's the problem: I have to dynamically change the image of this ButtonField during the <code>gridView_RowDataBound(...)</code> event based on the data found in that particular gridview row. </p> <p>The real question is, is how to access that particular ButtonField inside the <code>gridView_RowDataBound(...)</code> event so I can change its image in C# code?</p> <p>I can't use </p> <pre><code>Image imgCtrl = (Image)args.Row.FindControl("ctrlID"); </code></pre> <p>because the <code>&lt;asp:ButtonField&gt;</code> won't allow an ID to be set (get a parser error when I try to run the webPage). And I can't use</p> <pre><code>args.Row.Cells[0].Controls[0]; </code></pre> <p>because the zeroth index of the .Controls[0] doesn't exist (I get a boundry overflow error).</p> <p>There's got to be a simple, slick, easy way to do this!</p>
asp.net
[9]
4,976,626
4,976,627
Using the OnTextChanged TextBox event isn't working
<p>I have a repeater that places 600+ textboxes filled with data on my page. A typical user will edit several of these.</p> <p>I would like the OnTextChanged event to run when I hit a save button, but it's not working.</p> <p>All of my textboxes have the property <code>OnTextChanged="TextBoxChanged"</code> When my user selects the save button</p> <pre><code>&lt;asp:Button ID="SaveChangesBtn" CssClass="SaveAndNextBtn" runat="server" Text="Save Changes" onclick="SaveChangesBtnClick" /&gt; </code></pre> <p>I would like the TextBoxChanged event to run for each textbox that has been changed. How can I implement this?</p>
asp.net
[9]
5,420,663
5,420,664
Copy one string array to another
<p>How can I copy a <code>string[]</code> from another <code>string[]</code>?</p> <p>Suppose I have <code>string[] args</code>. How can I copy it to another array <code>string[] args1</code>?</p>
c#
[0]
3,421,146
3,421,147
How to using GetChanges() in DataTable
<p>I have been developing some application with DataGridView binded to DataTable. So, now I need to do 1 thing: user can edit some fields, and when he clicks by "Save" the application must change some fields programmatically. I'm trying to use this code, but it doesn't work:</p> <pre><code>private void toolStripMenuItemSaveChanges_Click(object sender, EventArgs e) { try { dataGridViewPersons.BindingContext[table].EndCurrentEdit(); // DataTable changes = table.GetChanges(); if (changes != null) { Console.WriteLine("edited rows=" + table.GetChanges().Rows.Count); foreach (DataRow row in changes.Rows) { row[29] = getRightBody(row, 7, 18); row[30] = "-"; row[31] = getRightBody(row, 23, 25); row[32] = getRightBody(row, 26, 28); } } else { Console.WriteLine("edited rows=0"); } adapter.Update(table); } catch (Exception exeption) { this.Text = exeption.Message; } } </code></pre> <p>If there is edited rows, this code won't change fields in the binded DataTable; I thought that GetChanges() return DataTable with relations to the original DataTable, but now I know it's false. Please, tell me the decision. Thank you in advance. </p>
c#
[0]
581,779
581,780
Java parse a number in exponential notation
<p>I am trying to do a conversion of a String to integer for which I get a <code>NumberFormatException</code>. The reason is pretty obvious. But I need a workaround here. Following is the sample code.</p> <pre><code>public class NumberFormatTest { public static void main(String[] args) { String num = "9.18E+09"; try{ long val = Long.valueOf(num); }catch(NumberFormatException ne){ //Try to convert the value to 9180000000 here } } } </code></pre> <p>I need the logic that goes in the comment section, a generic one would be nice. Thanks.</p>
java
[1]
2,907,490
2,907,491
newbie in developing ANDROID APPS (not asking solution for programming)
<p>i am a newbie in android program development .. eventually i know nothing about android programming language... haha... is there any website for me to learn about the android development program? more on android apps (connect to databases..key in or retrieve data in various format >> graph,chart.etc)... and i know there are a a lot of website outside there (google searhed) but is there any other reliable websites or e-book (pdf.etc) for me to learn about it ? preferable free e-book or pdf version ... other than that .. wat programming language that normally used on developing android apps??? softwares, sql databases .. thanks everyone .... and have a nice day !!! </p>
android
[4]
1,807,732
1,807,733
Change TabPageIndicator footer and text colors (ViewPagerIndicator)
<p>This is driving me insane: I can't for the life of me figure out how to change the footer and text colors of my TabPageIndicator (from Jake Wharton's ViewPagerIndicator). I looked at the source code for the sample ViewPagerIndicator app and I can't find where the code differs for the "Default" and the "Styled" samples. The Default has the default blue footer and white text, whereas the Styled sample has a red footer and uses a gray font.</p> <p>I know it's possible, but I can't find out how to do it!! Any help is tremendously appreciated. :)</p>
android
[4]
4,916,082
4,916,083
how set the border color property through a class name using jquery?
<p>I can set the border color property through using the jquery css method but when reading the border color property back through IE and Firebox, I get different format values. To get around this issue, I add a class name including the border color like this:</p> <pre><code>$('#'+ pageSection[sectionIndex] +'').addClass("addBordeColor"); .addBorderColor { border: 2px color black; } </code></pre> <p>This is not working. Any ideas on how troubeshoot this problem? </p>
jquery
[5]
4,225,757
4,225,758
How to get server-side parameters using jQuery UI remote?
<p>I have a php ajax script that is getting called by some jQuery, and I can not seem to get the parameters that are being passed. Here is the example I am working from: <a href="http://jqueryui.com/demos/autocomplete/#remote" rel="nofollow">http://jqueryui.com/demos/autocomplete/#remote</a></p> <p>In my php side, I did something like this just to see what my parameters are:</p> <pre><code>error_log ("1) ".var_dump($_GET)); error_log ("2) ".var_dump($_POST)); error_log ("3) ".var_dump($_REQUEST)); </code></pre> <p>But they all return empty. Can that be? How can I get at the parameters that are being passed?</p> <p>Thanks!!</p> <p>Here is my js:</p> <pre><code>$(function() { $( "#birds" ).autocomplete({ source: "/problems/get_categories_ajax.php", minLength: 2, select: function( event, ui ) { log( ui.item ? "Selected: " + ui.item.value + " aka " + ui.item.id : "Nothing selected, input was " + this.value ); } }); </code></pre>
php
[2]
158,909
158,910
how to get int[][] dimensionArray?
<p>I want to get matrix[i][j] to my int[][] gettwodimensionalArray, I try so many way, but when I do the test, my gettwodimensionaArray still not store from matrix[i][j]. Please help me out, thank you. </p> <p>Here is my code look like. </p> <pre><code> public int[][] gettwodimensionalArray(String file_name) { File file = new File(file_name); ArrayList&lt;int[]&gt; rows = new ArrayList&lt;int[]&gt;(); try { Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { String line = scanner.nextLine(); String[] s = line.split("\\s+"); int[] row = new int[s.length]; for (int i = 0; i &lt; s.length; i++) { row[i] = Integer.parseInt(s[i]); } rows.add(row); System.out.println(line); } } catch (FileNotFoundException e) { e.printStackTrace(); } int numbOfRow = rows.size(); // find number of columns by gettting the lenght of one of the rows row int keepTrackSizeFirstRow; for (int i = 0; i &lt; numbOfRow; i++) { if (i == 0) { keepTrackSizeFirstRow = rows.get(0).length; } // compare current row i's array length, to keetracksizefirstrow } int[][] matrix = new int[numbOfRow][rows.get(0).length]; // System.out.println(matrix); for (int i = 0; i &lt; numbOfRow; i++) { // i = row for (int j = 0; j &lt; rows.get(i).length; j++) { // j = col matrix[i][j] = rows.get(i)[j]; System.out.print(matrix[i][j]); } } return matrix; } </code></pre>
java
[1]
5,114,812
5,114,813
Should every C++ programmer read the ISO standard to become professional?
<p>Should every C++ programmer read the ISO standard to become professional?</p>
c++
[6]
5,030,674
5,030,675
set keywords into array
<p>I'm using automatic php class to gets the keywords from my website page content and the out put is exactly like</p> <pre><code>$text = "blah word1 blah word2 blah word3 blah" $keywords = "word1, word2, word3"; </code></pre> <p><img src="http://i.stack.imgur.com/OPRxH.png" alt="echo $keywords;"></p> <p>and let suppose i've </p> <pre><code>$url = "http://www.some_site.com"; </code></pre> <p><strong>Now</strong> i've gonna convert all that keywords that inside my text content into links by adding those keywords into array as follow</p> <pre><code>$keyword_array = array( "word1" =&gt; $url, "word2" =&gt; $url, "word3" =&gt; $url ); </code></pre> <p>The question now is how then to convert</p> <pre><code>$keywords = "word1, word2, word3"; </code></pre> <p>into</p> <pre><code>$keyword_array = array( "word1" =&gt; $url", "word2" =&gt; $url, "word3" =&gt; $url ); </code></pre> <p>since content and keywords indeed differ from page to page and can't do manually !</p> <p>I've been thinking of using <code>explode</code> for <code>$keywords</code> but i don't know how to do it any help ~ thanks</p>
php
[2]
2,371,663
2,371,664
JAVA: I have the address; how can I print its contents?
<p>THE SHORT VERSION: I have an address; how can I print the contents at that address?</p> <p>LONG VERSION: I have this object, and the object has two fields - dest and source. The source is given to me as an address:</p> <pre><code> Field Detail dest public final VVarRef dest The variable/register to store the value into. source public final VMemRef source The memory location being read. </code></pre> <p>I need to know what's at that address.</p> <p>Thanks!</p> <p>EDIT: Instead of just downvoting my question, will someone tell me WHY this isn't a good question? I never understand why some of my questions get upvoted while others get downvoted. I don't consider this stuff easy and I've done my share of research....this question is surely more difficult than something like <a href="http://stackoverflow.com/questions/3844595/how-can-i-make-java-print-quotes-like-hello?rq=1">How can I make Java print quotes, like &quot;Hello&quot;?</a>, which got 3 upvotes....</p>
java
[1]
2,909,220
2,909,221
How to stop a jQuery function being run on keydown when Tab key is pressed
<p>I am new to jQuery and haven't been able to find a solution to this.</p> <p>I have this HTML:</p> <pre><code>&lt;input type="text" id="Box1" /&gt;&lt;br /&gt; &lt;input type="text" id="Box2" /&gt; </code></pre> <p>And jQuery:</p> <pre><code>$("#Box1").keydown(function () { $("#Box2").val(""); }); $("#Box2").keydown(function () { $("#Box1").val(""); }); </code></pre> <p>Example here: <a href="http://jsfiddle.net/tv4my/" rel="nofollow">http://jsfiddle.net/tv4my/</a></p> <p>When you type in "Box1" then start typing in "Box2", Box1's content is cleared. This is good, however I don't want this function to run if the Tab key is pressed, i.e. I don't want Box1 to be cleared if I press the Tab key inside Box2. How do I write this in jQuery?</p>
jquery
[5]
2,635,869
2,635,870
How to integrate two .apk files
<p>My problem is, I have two android apps. first one is UI app(Activity). second one is non-UI app(Service). How can you integrate both apps and install together?....</p>
android
[4]
1,784,030
1,784,031
Classes across multiple files in C++
<p>I'm almost 100% sure I have the syntax right in both of these classes, however I'm getting the following errors: </p> <p>For CShape.cpp - "error C2011: 'CShape' : 'class' type redefinition" For CCircle.cpp - "error CS2504: 'CShape': base class undefined"</p> <p>Here is the full code for CShape.cpp</p> <pre><code>#include &lt;iostream&gt; using namespace std; class CShape { protected: float area; virtual void calcArea(); public: float getArea() { return area; } } </code></pre> <p>And here is the code for CCircle.cpp</p> <pre><code>#include &lt;iostream&gt; #include "CShape.cpp" #define _USE_MATH_DEFINES #include "math.h" using namespace std; class CCircle : public CShape { protected: int centerX; int centerY; float radius; void calcArea() { area = M_PI * (radius * radius); } public: CCircle(int pCenterX, int pCenterY, float pRadius) { centerX = pCenterX; centerY = pCenterY; radius = pRadius; } float getRadius() { return radius; } } </code></pre> <p>As you can see, CShape is the base class that CCircle is suppsoed to inherit from. I'm pretty new to C++, so I could have the file structures wrong (maybe the base is supposed to be in a header file?), if something like that matters. </p>
c++
[6]
5,835,799
5,835,800
get fixed number of items from array list c#
<p>I would like to create a list variable of items from another list. So lets say I have a list of 100 items I would like to pull items 25 - 35 and put them inside of another list. is there a way of doing this without calling a big for statement and pulling out the element one by one and putting that into a list. </p>
c#
[0]
3,802,299
3,802,300
how to append dropdown list box
<pre><code>$("#Grid").click( $("#showgrid").load('SomeURL')); $.each($('#Grid td:nth-child(4n)'), function() { var forthColumn = $(this); forthColumn.append("&lt;select&gt;&lt;option value='1'&gt;Division 1&lt;/option&gt;&lt;option value='2'&gt;Division 2&lt;/option&gt;&lt;option value='3'&gt;Division 3&lt;/option&gt;&lt;/select&gt;"); }); }; </code></pre> <p>I am trying to append the dropdown list box? this way but I am not seeing the dropdownbox at 4th colum?</p> <p>is this right? thanks for all..</p>
jquery
[5]
5,496,684
5,496,685
How can I set for daily morning 9AM notification?
<pre><code>String ns = Context.NOTIFICATION_SERVICE; NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns); int icon = R.drawable.ic_launcher; CharSequence tickerText = "Test"; long when = System.currentTimeMillis(); Notification notification = new Notification(icon, tickerText, when); Context context = getApplicationContext(); CharSequence contentTitle = "Test"; CharSequence contentText = "testing texts"; Intent notificationIntent = new Intent(this, HolotestActivity.class); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); final int HELLO_ID = 1; mNotificationManager.notify(HELLO_ID, notification); </code></pre> <p>I used for notification. How can I set for daily morning 9AM notification?. I am beginner. :D</p>
android
[4]
694,132
694,133
changing date format in javascript dynamically in userside
<p>how to change date format dynamically in clientside using javascript..as i cant change it in serverside..say jsps..as these things meeds 2 b changed frequently.</p> <p>i am using eclipse,j2ee,jscript</p>
javascript
[3]
6,015,928
6,015,929
Should not display the alertview if already another alertview is displaying in iphone
<p>On the iPhone, how can I check whether some <code>UIAlertView</code> is already being displayed before displaying a <code>UIAlertView</code>?</p>
iphone
[8]
5,190,921
5,190,922
How to sum time in php?
<p>PHP: How to sum the result of a foreach statement?</p> <p>Below is my working code. As you will see, I'm trying to count the days in each month and then sum them.</p> <pre><code>// A function to calculate days in a given month using just the date function daysInMonths($date) { $month = date("m", strtotime($date)); $year = date("Y", strtotime($date)); $num = cal_days_in_month(CAL_GREGORIAN, $month, $year); return $num; } // A function that places the date of an unknown number of months into an array: function getNextMonths($date, $numberOfMonths) { $timestamp_now = strtotime($date); $months[] = date('Y-m-d', $timestamp_now); for($i = 1;$i &lt;= $numberOfMonths; $i++) { $months[] = date('Y-m-d', (strtotime($months[0].' +'.$i.' month'))); } // counts the days in each month: $j=0; foreach ($months as $days) { echo "$j:".daysInMonths($days)."&lt;br&gt;"; ++$j; } print_r($months); } getNextMonths('2011-11-1', '4'); </code></pre> <p>Current output:</p> <pre><code>Array ( [0] =&gt; 2011-11-01 [1] =&gt; 2011-12-01 [2] =&gt; 2012-01-01 [3] =&gt; 2012-02-01 [4] =&gt; 2012-03-01 ) </code></pre> <p>After counting:<br> 0:30<br> 1:31<br> 2:31<br> 3:29<br> 4:31 </p> <p>This is all correct, I'm just having trouble summing the array after I have the days of the month counted.</p>
php
[2]
3,539,151
3,539,152
BulletedList in asp.net
<p>How I can give separate style to custom image of Bulletdlist in .net?</p>
asp.net
[9]
231,218
231,219
Try to use Window.FEATURE_CUSTOM_TITLE but got Exception:You cannot combine custom titles with other title feature..
<p>I am trying to use a custom title to include an image button to the title bar. I got a lot of help form this post: <a href="http://stackoverflow.com/questions/2569753/android-adding-button-to-the-title-of-the-app">http://stackoverflow.com/questions/2569753/android-adding-button-to-the-title-of-the-app</a>, but could not get it work for my ListActivity.</p> <p>In a nutshell, following is what I have:</p> <ol> <li>I hide the titlebar in the AndroidManifest.xml</li> <li><p>The specify a relative layout for the custom title (workorder_list_titlebar.xml)</p></li> <li><p>My Activity Class looks like the following:</p></li> </ol> <pre> public class WorkOrderListActivity extends ListActivity { String[] orders={"WO-12022009", "WO-12302009","WO-02122010", "02152010"}; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); this.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.workorder_list_titlebar); setContentView(R.layout.workorder_list); setListAdapter(new ArrayAdapter(this,R.layout.workorder_list, R.id.label,orders)); } } </pre> <p>When I ran the app, I got AndroidRuntimeException: You cannot combine custom titles with other title features. </p> <p>Base on the stack trace, the exception was thrown by com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:183), that was triggered by setlistAdapter call.</p> <p>Does anyone have the same problem with ListActivity? Also once I manage to get this work, how do I attach listeners to the image button for it to do something?</p> <p>Thanks in advance.</p>
android
[4]
2,649,635
2,649,636
Android: Get physical device orientation in a portrait-only app
<p>My app is locked into portrait orientation only, however in one fragment I have a camera preview where I would like to rotate captured images based on the device orientation. I believe that because my app is portrait only, the following code always logs zero. </p> <pre><code>Display display = ((WindowManager)getActivity().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); int rotation = display.getRotation(); Log.i(TAG, "Rotation: " + rotation ); </code></pre> <p>Is it possible to get the actual orientation of the device while locking the app to portrait?</p> <p>I am targeting android 4.0+ so I'm not concerned if the solution won't work on older devices. </p>
android
[4]
1,532,683
1,532,684
Cannot refer to an instance member of a class from within a shared method
<p>I have a public shared function and I'm trying to access the values of a text box and a session variable.</p> <p>I'm getting the error "Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class."</p> <p>Is there any way I can get to the values in the textboxes or session variables from within the method?</p> <p>Thanks,</p> <pre><code>&lt;WebMethod()&gt; _ Public Shared Function savenote() As String Dim newnote As New note() newnote.callID = txtRef.Text newnote.LoggedBy = Session("user_id") newnote.Note = txtNote.Text newnote.Create() Return 1 End Function </code></pre>
asp.net
[9]
3,704,245
3,704,246
Javascript - use of indexOf to search for strings
<p>In the first block, I make sure the password does not contain 'password'. It works perfectly.</p> <pre><code> var element=document.getElementById('password'); if (element.value.toLowerCase().indexOf('password') &gt; -1){ //returns 0 or more if present alert('Password may not contain the word `password`.'); element.focus(); return false; } </code></pre> <p>In the second block I check that the password does not containthe firstname, it does not work, what have I done wrong?</p> <pre><code> //stop password of firstname var element=document.getElementById('password'); var firstname=document.getElementById('firstname'); if (element.value.toLowerCase().indexOf(firstname.value) &gt; -1){ //returns 0 or more if present alert('Password may not contain the firstname.'); element.focus(); return false; } </code></pre>
javascript
[3]
1,503,003
1,503,004
can i compile android project without eclipse?
<p>Hello there is one question which comes in my mind from last 2 days. Can we compile our android project without Eclipse? If yes then what is alternatives? Please share it.</p>
android
[4]
5,369,159
5,369,160
how do I write to a parent dictionary?
<p>How do I write to a parent's dictionary? I've given a list of urls to some children to retrieve, which then need to write to the parent's dictionary:</p> <pre><code>from multiprocessing import Pool import random parent_dict={} urls = ['www.yahoo.com','www.google.com','www.microsoft.com','www.apple.com','www.cisco.com'] def workit(url): # retrieve the urls, process some stuff and then add that info to parent_dict key = random.randrange(1,10) # pretend that this is the variable that we want in parent_dict value = random.randrange(11,20) parent_dict[key] = value pool = Pool(processes = 5) pool.map(workit,urls) print parent_dict # returns {}} </code></pre>
python
[7]
3,587,785
3,587,786
Quiz game application
<p>I'm new to C# programming so I need to ask C# experts here, what techniques should I use for a quiz game application I'm planning to develop. I'd like my quiz app to be like this:</p> <blockquote> <p>1.) What is the capital city of UK? <br />a. London <br/> b. Washington D.C. <br /> c. Tokyo <br /> d. Manila</p> <p>2.) What is the capital city of Russia? <br/> a. Bangkok <br /> b. Beijing <br /> c. Islamabad<Br /> d. Moscow <br /></p> <p>ETC....</p> </blockquote> <p>I want the questions to be randomly generated using Rand(). The questions should be randomly placed, not in the order I set up here, but still those 4 choices I declared are the only ones to display in the set of the quiz. If you have any links to tutorials please give me so I can study it. I really love to develop this app, but I don't have any clue to start this. Any help is truly appreciated. Thanks!</p>
c#
[0]
4,018,607
4,018,608
How do I limit my Windows application to spawning a single instance of a process?
<p>I am working on a Windows application. I have created a help file (.chm) using a third party tool and I call it from the Windows application. The help file is invoked successfully when I click on <em>Help</em> menu item or press <kbd>F1</kbd> for the application.</p> <p>The problem I am facing is that if I click on the menu item again or press <kbd>F1</kbd> (while the application is open and I have not closed the previous help file) it opens another instance of the help file.</p> <p>Let me be clear by giving an example: I want it to be just like the "Solitaire" game. No matter how many times you press <kbd>F1</kbd> or the <em>Contents</em> menu item it shows only one help window.</p> <p>I want to do same thing like "Solitaire". I don't want multiple instances to be created.</p> <p>I hope you understood my problem. Please let me know if my query is wrong. I have posted my code below.</p> <pre><code> ProcessStartInfo info; Process exeprocess; </code></pre> <p>The below code is in Help menuitem click event.</p> <pre><code> private void mnuContents_Click(object sender, EventArgs e) { string ApplicationPath=ConfigurationSettings.AppSettings["HelpFile"].ToString(); info = new ProcessStartInfo(ApplicationPath); //Process.Start(info); exeprocess = Process.Start(info); } </code></pre>
c#
[0]
2,330,979
2,330,980
C++ dynamic byte signatures
<p>Is there a good way (or a good lib/class/source file/something) to, at runtime, find a byte signature (using a string of bytes) at a certain address and get a pointer to that address?</p> <p>I.e. in running memory:</p> <blockquote> <p>... 05 AE 6B 24 B1 00 B5 ...</p> </blockquote> <p>and at runtime finding the first pattern of <code>AE 6B 24</code> and returning the address of the position?</p>
c++
[6]
1,207,537
1,207,538
max_execution_time and sleep()
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/740954/does-sleep-time-count-for-execution-time-limit">Does sleep time count for execution time limit?</a> </p> </blockquote> <p>If the max execution time lower than the sleep function argument</p> <pre><code>ini_set('max_execution_time', 30); sleep(35); foo(); </code></pre> <p>will the foo() function run?</p> <p>Is it OS specific or not?</p> <p><strong>EDIT:</strong> thank you for your answers, and for a link to a similar question: <a href="http://stackoverflow.com/questions/740954/does-sleep-time-count-for-execution-time-limit">Does sleep time count for execution time limit?</a></p>
php
[2]
3,090,131
3,090,132
asp.net how to use sever side changes after post back
<p>In my asp.net application I have a some client side scripting that alters the page events and do different things. One problem I am having is when I post back to the server after all of the validation is done on the client side, I have a couple more validation checks on the server side (c#), and I want to show the proper error, but the page refreshes. I just would like to do some server side coding and if i need to go back to the page, go there as lasted viewed, with the error in the label, and changes i made on server side. Thanks for any help.</p>
asp.net
[9]
2,455,947
2,455,948
How to use a variable correctly through GET?
<p>How can I correctly pass a variable to the path? <strong>photos.php?fname=MARERINA</strong></p> <pre><code>&lt;?php foreach(glob('.$_GET["fname"]./*.*') as $filename){ echo $filename; } ?&gt; </code></pre>
php
[2]
5,268,318
5,268,319
fwrite not working
<p>Is there a way to know why fwrite is not working? I mean as in .net (I am a .net guy) the method just throws the exception which can be caught and the exception message and stack trace message tells all the story why the .net method didn't work. Is there any way I can know why my fwrite is not working as I think my code is stable because it's working fine on one machine but not on the other. Please help. Thanks in advance.</p> <p>Edit: It's just returning false leading me nowhere. :(</p>
php
[2]
5,698,862
5,698,863
Query regarding notification on Android
<p>I have the following requirement.</p> <p>1> I have developed an Android mobile application &amp; lets assume the user is currently on screen X.</p> <p>2> If the user clicks on the HOME button of the mobile device , the mobile application goes to background &amp; the user is currently on the HOME screen of the mobile device.</p> <p>3> I want to show an icon of the my mobile application on the top of status bar at the extreme left (where the battery strength , clock , signal of the device) are shown , to inform the user that my mobile application is running on background. If the user clicks on the icon , he should be navigated to the screen X of the mobile application.</p> <p>Actually , it should be such that whenever my mobile application is on background &amp; the user is on the HOME screen of the mobile device, the icon of my application should be displayed on the status bar.</p> <p>I have seen such an implementation but I am not sure how can I implement this type of notification.</p> <p>Kindly provide your suggestions/sample code.</p> <p>Thanks in advance.</p> <p>Warm Regards, CB</p>
android
[4]
3,978,894
3,978,895
why I do not see my Icon in Android Option Menu?
<p>I have the following code to generate a Menu Item:</p> <pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@+id/menu1" android:icon="@drawable/ic_action1" android:title="@string/foo" /&gt; &lt;/menu&gt; </code></pre> <p>I see the Item in the menu, but I can not see the icon. Whats wrong? I dont want to use it as the following:</p> <pre><code>android:showAsAction="ifRoom|withText" </code></pre> <p>then I see the icon, but I dont want it to be in the Action Bar</p>
android
[4]
3,596,542
3,596,543
Getting information from RadioButtons and Checkboxes
<p>I have report which consists of 5 questions (there can be <strong>only one answer</strong> or <strong>multiple choice answer</strong>). Question are different for each report. So everytime I generate questions and answers as <code>RadioButtons</code> (one answer) or <code>CheckBoxes</code> (multiple choice answer)...But now I really don't know how to save those answers (I'd like to save to it as <code>_question_id</code>, <code>_answer_id</code>).</p> <p>How can I assign good <code>_answer_id</code>, to <code>_question_id</code>...</p> <p>Thanks for help in advance</p>
android
[4]
3,576,170
3,576,171
Text processing of an HTTP link in Python
<p>Imagine that I have url</p> <pre><code>http://www.google.com/subdomain/blah-blah.../.. /.. </code></pre> <p>So I want to extract 4 things from this 1) The Protocol: "http" 2) "www" 3) domain name : google" 4) "com" portion 5) subdomain par: all those after .com part But as you can see this link can be anything</p> <pre><code>ftp://google.net/hola-hola </code></pre> <p>now this might also be a valid link. So how do I extract these various portions of url using python</p>
python
[7]
1,118,289
1,118,290
JavaScript variable declaration
<p>What's the difference between following types of var declaration in JavaScript?</p> <pre><code>$x var x var $x </code></pre>
javascript
[3]
4,491,661
4,491,662
If I have got content of line 2 I want to get content of line 9. How to do?
<p>I have text file:</p> <pre><code>[1]AAAAAA [2]BBBBBB [3]CCCCCC [4]DDDDDD [5] [6] [7] [8]111111 [9]2222222 [10]333333 [11]4444444 [12]555555 [13]6666666 </code></pre> <p>If I have got content of line 2 I want to get content of line 9. How to do?</p>
python
[7]
3,292,144
3,292,145
in android nothing displayed
<p>I am doing a application that has database coding and some classes. I put Log.e() after and before the <code>setContentView(R.layout.main);</code> in main activity but no log value printed in Logcat and no design applied for the main activity. </p> <p>my logcat prints:</p> <blockquote> <p>05-03 16:19:06.011: ERROR/PackageInstallationReceiver(289): Remove /data/local/tmp/com.sai.thread.apk Fail! 05-03 16:19:31.451: ERROR/SETTING_AUTO_BACKLIGHT(59): open: /sys/class/leds/lcd-backlight/auto failed, errno: 2</p> </blockquote>
android
[4]
1,950,636
1,950,637
use jquery to animate lines of text
<p>I have a paragragh of text.</p> <pre><code>&lt;p&gt; line1 line2 line3 &lt;/p&gt; </code></pre> <p>intially all the text are red when a button is pressed each line's color changes to black gradually (2 sec each line)</p> <p>can this be done with only jquery?</p>
jquery
[5]
3,355,151
3,355,152
Activity passing from last to first activity
<p>I have 4 Activity are there i want to come from 4th activity to first activity without using intent, pls which method i need to cal.2nd &amp; 3rd activity will not be effected.</p>
android
[4]
5,661,753
5,661,754
Javascript split remove ":" colon character
<p>I have a string like this.</p> <pre><code>var a="1:2:3:"; </code></pre> <p>I want to split it with <code>a.split(":")</code> to remove the ":" colon character.</p> <p>I want to get this as the result:</p> <pre><code>["1","2","3"] </code></pre> <p>But instead the result of <code>a.split(":")</code> is this:</p> <pre><code>["1","2","3",""] </code></pre>
javascript
[3]
2,702,746
2,702,747
what is a quick way to delete all elements from a list that do not satisfy a constraint?
<p>I have a list of strings. I have a function that given a string returns 0 or 1. How can I delete all strings in the list for which the function returns 0?</p>
python
[7]
4,284,039
4,284,040
Android, Is it possible to consolidate two APK files?
<p>I have a project for Android. In this project my client asked me following scenario but I'm not sure that it is possible.</p> <p>They want to create an app-store for android. In this store after developer uploads his application we should wrap this APK file with our APK file (therefore we will have one APK file). This wrapper adds some activities to developer's application in order to able users to check their credits and add credits if they have not enough credit to their account (we don't want to manipulate the developer's code, we just want to add our code into their code). Therefore, when user download and install this application, each time he/she launches the application, our wrapper should be run first and check his/her financial account through Internet, if s/he has enough credit in his account, therefore s/he is free to use the application. If s/he didn't have enough credit we should guide him/her to buy more credit. </p> <p>The things that I did, I created two sample project to see if I add APK of one to second, may I run that application from second application.</p> <p>In the first application I just show some text in its activity and in second project (wrapper) I created a button that when I click on it, first project should be run. The result was not satisfactory and I couldn't run it. </p> <p>I think if I export JAR file from first project and repeat above procedure I'll have better results but because in future we can't ask developers to put JAR file of your application instead of APK, it is not a good idea.</p> <p>Now, for around a week I was thinking about this story and I couldn't find a way to know how can I consolidate and merge developer's application with our wrapper application. </p> <p>If you have any suggestion please guide me.</p>
android
[4]
4,632,021
4,632,022
how to display a dial pad
<p>how would I open the Dialpad and get the Number that the User like to call. So I can do a check with it before I dial it from my Source?</p> <p>If possible, with a small example.</p> <p>Thanks Anshuman</p>
android
[4]
4,626,749
4,626,750
Proper layout folders for 7 and 10 inch layouts
<p>I'm looking to build 3 total layouts for my android app. The first is layout-normal for phones. I also want two other layouts, one for 7inch screens, one for 10inch screens. What should those folders be named? I was told layout-sw600dp and layout-sw720dp but now I'm not sure if that's correct.</p>
android
[4]
91,333
91,334
C# why sizeof is unsafe and how to get size of a struct in a safe way?
<p>I've defined a struct to send via socket. I'd like to get the size of it but <code>sizeof</code> is unsafe and the same for "<code>System.Runtime.InteropServices.MarshalSizeOf</code>". Is there a way to get its size in a safe way?</p>
c#
[0]
2,818,022
2,818,023
Passing member function to function pointer
<p>I have to pass in a function pointer of a member function to another class. I couldn't get it to compile and I get the "undefined reference to classB::classB(classA::*)(std::shared_ptr) " error. Can someone help me with this?</p> <p>Thanks.</p> <pre><code>classA{ string functionA(share_ptr&lt;int&gt;); void functionB(){ classB* ptr = new classB(&amp;classA::functionA); } } //in other .h file classA; //forward declaration classB{ classB(string (classA::*funcPtr)(shared_ptr&lt;int&gt;); //constructor } </code></pre>
c++
[6]
854,570
854,571
multiple style values inside a view
<p>I have 2 styles defined inside styles.xml. I want to apply it to a textview. How to implement that using style = "@style/"</p>
android
[4]
3,170,343
3,170,344
complex thinking on simple java challenge, how can i fix it?
<p>Simple stuff but somehow not able to crack it, below piece of code gives compile time exception like <code>unexpected token</code> at <code>try/catch</code> and <code>unhandled exception:java.io.FileNotFound</code> </p> <pre><code> String fileName = "C:\\GS.xlsx"; try{ CSVReader reader = new CSVReader(new FileReader(fileName)); }catch(Exception e){ } </code></pre> <p>What is the possible issue in here, i know there is something really goofy that am doing in here...</p> <p><strong>Update</strong></p> <p>Issue was, I didn't had my code in method...result of longs hrs of continous work...</p> <pre><code> public class PositionGS { public PositionGS() { String fileName = "C:\\GS.xlsx"; try { CSVReader reader = new CSVReader(new FileReader(fileName)); } catch (Exception e) { } } } </code></pre> <p>that's the complete code...</p>
java
[1]
911,033
911,034
combo box and Generic list
<p>I'm Having a list</p> <pre><code> List&lt;string&gt; strArraylist = new List&lt;string&gt;(); </code></pre> <p>i want to add to it the values of a <strong>combo box</strong> ..</p>
c#
[0]
1,218,771
1,218,772
How do I call a nested function in a parent document from an iframe
<p>In parent:</p> <pre><code>function outer(){ function inner(){ alert("hello"); } } </code></pre> <p>in iframe</p> <pre><code>parent.outer.inner(); </code></pre> <p>does not work.</p> <p>Edit: So they are private. No problem. The reason for doing this is to try and hide these functions from global scope as much as possible. I thought putting them behind a single function name with a pretty unique name would be the best way to do this.</p> <p>Essentially do I need to</p> <p>parent:</p> <pre><code>function outer(action){ if(action == "inner") inner() function inner(){ alert("hello"); } } </code></pre> <p>iframe: parent.outer("inner");</p> <p>Is there a more elegant way of doing this?</p>
javascript
[3]
179,812
179,813
How to redirect URLs to login page?
<p>I have an application which has a login page which comes up with the URL: </p> <p><a href="http://localhost:8080/Analyze" rel="nofollow">http://localhost:8080/Analyze</a> </p> <p>when the user fills the login page and clicks submit.it goes to a page with the URL: </p> <p><a href="http://localhost:8080/Analyze/analyze" rel="nofollow">http://localhost:8080/Analyze/analyze</a> </p> <p>Now if i copy the url:http://localhost:8080/Analyze/analyze and paste in a new browser window I get </p> <p>HTTP Status 405 - HTTP method GET is not supported by this URL </p> <p>What can I do to redirect back to the login page: </p> <p><a href="http://localhost:8080/Analyze" rel="nofollow">http://localhost:8080/Analyze</a> if I copy paste <a href="http://localhost:8080/Analyze/analyze" rel="nofollow">http://localhost:8080/Analyze/analyze</a> in a new browser window. </p>
java
[1]
469,934
469,935
Linking problem with Three20
<p>I'm using Three20 in my project. I added Three20 to my project using the python script supplied. Everything works fine when I compile and deploy my project onto the iphone 4 in debug mode, but when I try to build for distribution (Build and Archive) the compile fails with 2 linking errors. Does any one know what this problem might be, and why I have no problem running the project on my iphone in debug mode?</p> <p>The linking error (that appears twice) is:</p> <blockquote> <p>ld: file not found: ../Three20/facebook-three20-309d34e/Build/Products/Distribution-iphoneos/libThree20UICommon.a collect2: ld returned 1 exit status Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2 failed with exit code 1</p> </blockquote> <pre><code>Ld build/BDV.build/Distribution-iphoneos/BDV.build/Objects-normal/armv7/BDV normal armv7 cd /Users/fh/projects/iphone/BDV setenv IPHONEOS_DEPLOYMENT_TARGET 4.2 </code></pre>
iphone
[8]
2,910,293
2,910,294
Fileupload Control in asp.net
<p>I want to get full path which user selected in file upload control. how can we do it. </p>
asp.net
[9]
3,252,987
3,252,988
how to filter text inside html tag using jQuery
<p>i want to grab text inside a div element like this : </p> <pre><code>&lt;div class='someclass'&gt; &lt;blockquote&gt;some text ! &lt;/blockquote&gt; another text goes here . &lt;/div&gt; </code></pre> <p>so i get all text with jQuery like this: var qtext = $('.someclass').text(); </p> <p>but i don't want <code>&lt;blockquote&gt;some text ! &lt;/blockquote&gt;</code> i just need the text inside div element . how can i filter that ? </p> <p>tanks guys . </p>
jquery
[5]
3,297,848
3,297,849
if i choose contact, i didn't get the contact that i mean
<p>i know how to get all contact on Android, but if i choose the contact i can't get the contact what i want. example : i have 4 contact</p> <pre><code>joe have phone number 7889 987; erick have phone number 8792 871; nona phone number 3653 872 and 2345 907; rina phone number 8796 235; </code></pre> <p>if i choose joe, i get nona's phone number= 2345 907 i don't know what is the problem on my application.</p> <p>this is my code</p> <pre><code>public void tambahPenerima ( View v ) { Intent i = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI); i.setType(ContactsContract.Contacts.CONTENT_TYPE); startActivityForResult(i, PICK_CONTACT); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(resultCode == RESULT_OK) { Cursor cursor = null; String name = ""; String number = ""; cursor = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null); while(cursor.moveToNext()) { name = cursor.getString(cursor.getColumnIndex((ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME))); number = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); } if(cursor!=null) { cursor.close(); } Intent kirimPesan = new Intent(); kirimPesan.setClass(this, kirimPesan.class); kirimPesan.putExtra("nama", name); kirimPesan.putExtra("nomor", number); kirimPesan.putExtra("chiper", chiper); startActivity(kirimPesan); } } </code></pre> <p>Somebody please help me, I really need help. Sorry for my poor english. thanks ..</p>
android
[4]
4,054,064
4,054,065
Python - value in list of dictionaries
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1580270/whats-the-best-way-to-search-for-a-python-dictionary-value-in-a-list-of-dictiona">What&#39;s the best way to search for a Python dictionary value in a list of dictionaries?</a> </p> </blockquote> <p>I have a list of dictionaries in the form</p> <pre><code>my_dict_list = [] my_dict_list.append({'text':'first value', 'value':'number 1'}) my_dict_list.append({'text':'second value', 'value':'number 2'}) my_dict_list.append({'text':'third value', 'value':'number 3'}) </code></pre> <p>I also have another list in the form:</p> <pre><code>results = ['number 1', 'number 4'] </code></pre> <p>how can I loop through the list of <code>results</code> checking if the value is in <code>dict</code>, e.g.</p> <pre><code>for r in results: if r in my_dict_list: print "ok" </code></pre>
python
[7]
1,145,103
1,145,104
How to avoid scroll bar in all browsers while a jQuery Dialog box is showing?
<p>I have a page where when we click a button a Jquery dialog box is called using JQuery. But when it is shown the Window scroll bar is shown in all browsers. How can we avoid this? Can we avoid this uising JQuery? Or is it is better to fix by CSS?.</p>
jquery
[5]
974
975
Two way communication in two android emulators
<p>I have a server client code in one file, running fine for the client to server when using redir add tcp:clientEmulatorPort:serverEmulatorPort</p> <p>but for the server side to reply back to client I have redirection issue of the ports as redir add tcp:serverEmulatorPort:clientEmulatorPort because now server emulator has to generate response to client emulator, does anyone have idea how can I perform this second port redirection or any other way of two way communication? everything else is working fine because I have checked that over devices just want to run it over 2 emulators as well. </p> <p>Any help is appreciated, thanks</p>
android
[4]
1,819,245
1,819,246
Change canvas width and height in android
<p>I want to change width and height of a canvas in android? How can I do it?</p> <pre><code>protected void onDraw(Canvas canvas) { canvas.drawColor(Color.WHITE); super.onDraw(canvas); final long now = SystemClock.uptimeMillis(); if(movieStart == 0) movieStart = now; final int relTime = (int)((now - movieStart) % movie.duration()); movie.setTime(relTime); movie.draw(canvas, 0, 0); this.invalidate(); } </code></pre> <p>Thanks</p>
android
[4]
399,791
399,792
show loading message while content loads
<p>I know the following code would show a loading image when a button is clicked on the page:</p> <pre><code> $.ajaxSetup ({ cache: false }); var ajax_load = "&lt;img src='img/load.gif' alt='loading...' /&gt;"; var loadUrl = "ajax/load.php"; $("#load_basic").click(function(){ $("#result").html(ajax_load).load(loadUrl); }); </code></pre> <p>but what if I want this to happen soon as the page loads. I dont want the user interaction of clicking a button to make the ajax call. </p>
jquery
[5]
3,260,282
3,260,283
Image control in asp.net?
<p>In web application, i am trying to display image in .aspx page, for that i write code like this in page_load event ,</p> <pre><code>Image1.ImageUrl = @"C:\Users\Public\Pictures\Sample Pictures\Koala.JPEG"; </code></pre> <p>but image is not displaying, can you help me thank you.</p>
asp.net
[9]
2,822,617
2,822,618
Android long-duration socket listener
<p>My company has, in essence, undertaken a project to replace some of its pagers with stock smartphones running Android. As long as they are signed in, the device should be listening on a particular socket to receive "pages" from a server. My naive implementation was to create a foreground service that 1) kicked off a listening thread, and 2) holds a PARTIAL_WAKE_LOCK. </p> <p>This works fine unless the device has a long period of inactivity, 1+ hours. Then, it appears that the OS shuts down my app's process, understandably believing it to be not in use.</p> <p>I completely understand their reasons for doing so, but I'm wondering if I can somehow get around this restriction. Are there ways to signal Android that my process really is important enough to keep alive/the device awake? I learned both Java and the Android API for this project, so there are plenty of areas where my knowledge is incomplete.</p> <p>Failing that, given the description of my business needs, how would you suggest implementing this functionality? While the user is signed in to our custom app, the device should always be listening.</p> <p>Thanks to everyone for reading this question.</p>
android
[4]
4,915,309
4,915,310
For my project I want to convert an integer into byte array and byte array back to integer
<p>For my project I have to convert an integer into byte array and byte array back to integer. I did the below code but it is not working</p> <pre><code> int temp=200; byte[] tempbyte= new byte[4]; String s= String.valueOf(temp); tempbyte= s.getBytes(); // integer to byte array conversion String s2 = String.valueOf(ByteBuffer.wrap(tempbyte).getInt()); int temp2 = Integer.parseInt(s2); // byte array to integer conversion System.out.println("the value of temp2 = "+temp2); </code></pre>
java
[1]
5,983,268
5,983,269
Show ToolBar over TabBar
<p>In my app I would like to replace the TabBar with a ToolBar under certain conditions, similar to what happens in the Photos App when a user places it in selections mode (A toolbar with share copy, etc, buttons appear over the tab bar). How can I achieve this please?</p>
iphone
[8]
3,075,618
3,075,619
How to save times, timezone question
<p>I'm building an ASP web app that stores appointment times; it'll be used in different timezones. I'm currently saving an appointment in the database as a datetime field. Do I also need to add a field to save the timezone? What's the best option to solve these multi-timezone issues?</p> <p>Thanks.</p>
asp.net
[9]
5,109,104
5,109,105
how to restart the JVM?
<p>is there any possibility of unloading all the java class from the JVM or restart the JVM.</p> <p>i have called System.exit(0) in my application when certain condition is met, all i want is restart the application that is start from main method onwards</p>
java
[1]
5,027,609
5,027,610
The right way to create pointer to pointer object?
<p>What is the right way to create a pointer to pointer object? Like for example,</p> <pre><code>int **foo; foo = new int[4][4]; </code></pre> <p>Then the compiler gives me an error saying "cannot convert from int (*)[4] to int **.</p> <p>Thanks.</p>
c++
[6]
5,758,924
5,758,925
GetExportedTypes() exception for ReflectionOnlyLoadFrom
<p>I am getting an error in a piece of code in our framework which I have no idea how to solve.</p> <p>Basically, we have a list of dlls via Directory.GetFiles("*.dll"), and when iterating over the list and doing Assembly.ReflectionOnlyLoadFrom(filename).GetExportedTypes(), I get an exception : "Method 'abc' has no implementation". </p> <p>The method is question is implemented in the assembly used in ReflectionOnlyLoadFrom(). </p> <p>I noticed that the method implements an interface which is in another assembly that is also in the list obtained by Directory.GetFiles(). I reordered the list (i.e so that it is in reverse order, so that the interface assembly is reflected first) but I still get the same error.</p> <p>Any ideas where to look?</p> <p>JD</p>
c#
[0]
2,414,086
2,414,087
Can any one suggest a good networking project in python
<p>I want to do a networking project using python. Can any one suggest a useful project in networking? I am aiming to complete it within next 5 months or so.</p>
python
[7]
1,877,982
1,877,983
Skipping if condition in jquery
<p>I am using following code snippter on button click event. Issue is if I don't select radio button than it gives me alert undefined but if I use same condition that is if I equate value of same in if condition than it escape condition. From below code I am not getting <code>alert("Select action to perform.");</code> as this if condition is skipped.</p> <pre><code> $('#actionbutton').click(function(){ alert('HI SANKALP'); var manageradiorel = $('input[name="managerelradio"]:checked').val(); var parentid = &lt;?php echo $parentid; ?&gt;; var childid = $('#managechild').val(); var sgid = &lt;? echo $_GET["s"]; ?&gt;; var relationship = $('#childsgrel').val(); alert(manageradiorel); if(manageradiorel == "undefined"){ alert("Select action to perform."); return false; } alert("Next time"); }); </code></pre>
jquery
[5]
3,368,490
3,368,491
difference between "Pacific standard time(mexico)" and "Pacific standard time"
<p>There are many time zones for single value of offset, is there any difference between these time zones for single value of offset. If yes, then how to differntiate between these. e.g. In my case I need "Pacific standard time" to be returned for offset value of "-08:00" but I am getting "Pacific standard time(mexico)"</p>
c#
[0]
321,486
321,487
problem installing ADT for eclipse
<p>I have installed Eclipse on my laptop - it seems to be the Indigo version. The I tried to Install new software. I entered the <a href="https://dl-ssl.google.com/android/eclipse" rel="nofollow">https://dl-ssl.google.com/android/eclipse</a> url into the Work With box. After pending resolved itself I then pressed next and now have a view of the items and an error saying that a shared profile (maven) is missing. I am stumped as to what to do next!!</p>
android
[4]
4,642,351
4,642,352
how to use handler to run a task in background
<p>I am using following code to to access web service and its showing me error application no responding.</p> <pre><code>package com.android.webservice; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class WebServiceActivity extends Activity { private static final String SOAP_ACTION = "http://tempuri.org/HelloWorld"; private static final String METHOD_NAME = "HelloWorld"; private static final String NAMESPACE = "http://tempuri.org/"; private static final String URL = "http://192.168.1.19/TestWeb/WebService.asmx"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button getquote = (Button) findViewById(R.id.getquote); getquote.setOnClickListener(new OnClickListener() { public void onClick(View v) { TextView result1; result1=(TextView)findViewById(R.id.result1); try { SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); EditText CompanyName = (EditText) findViewById(R.id.CompanyName); String val1 = (CompanyName.getText().toString()); request.addProperty("passonString", val1); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet=true; envelope.setOutputSoapObject(request); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); androidHttpTransport.call(SOAP_ACTION, envelope); Object result = (Object)envelope.getResponse(); result1.setText(result.toString()); } catch (Exception e) { result1.setText(e.getMessage()); } } }); } } </code></pre> <p>May be because this is running in UI thread, I want to run it in background using handler i am new in this field so having poroblem to write it in background thread . Can anyone please give me direction, how to write the code inside handler. Thanks</p>
android
[4]
2,556,774
2,556,775
Incomplete scan of bluetooth devices
<p>I am trying to scan for bluetooth devices using a processing based android app. I would like to use processing to communicate to my microcontroller board via bluetooth as shown in the example below:</p> <p><a href="http://webdelcire.com/wordpress/archives/1045" rel="nofollow">http://webdelcire.com/wordpress/archives/1045</a></p> <p>I was successful in launching this app on my android tablet. However, I am not able to list the bluetooth device on my tablet. The only bluetooth device that my tablet recognizes is the bluetooth adapter on my computer. Why am I not able to list all the bluetooth devices? My computer is able to recognize the microcontroller's bluetooth device.</p>
android
[4]
4,224,286
4,224,287
offsetof function in c++
<p>here is code </p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stddef.h&gt; struct mystruct { char singlechar; char arraymember[10]; char anotherchar; }; int main () { printf ("offsetof(mystruct,singlechar) is %d\n",offsetof(mystruct,singlechar)); printf ("offsetof(mystruct,arraymember) is %d\n",offsetof(mystruct,arraymember)); printf ("offsetof(mystruct,anotherchar) is %d\n",offsetof(mystruct,anotherchar)); return 0; } </code></pre> <p>output of which is</p> <pre><code>offsetof(mystruct,singlechar) is 0 offsetof(mystruct,arraymember) is 1 offsetof(mystruct,anotherchar) is 11 </code></pre> <p>i have read this documentation</p> <pre><code>http://www.cplusplus.com/reference/clibrary/cstddef/offsetof/ </code></pre> <p>but i did not understand no not because of my english but i dont understand documenattion itself please can anybody give me a little example or tell me how it works? thanks</p>
c++
[6]
1,267,413
1,267,414
Reverse filter in jQuery
<p>Instead of this...</p> <pre><code>$("#gridContainerAvailable input:checkbox") </code></pre> <p>How do I do this...</p> <pre><code>var parent = $("#gridContainerAvailable"); parent.[insert method here].('input:checkbox') </code></pre> <p>Cheers, Ian.</p>
jquery
[5]
10,575
10,576
why do I see the output of error_log but not die in PHP?
<p>I noticed that when I issue a <em>die</em> statement in php, it's output doesn't appear on the error log (If i put an error_log statement right beside it it shows fine though).</p> <p>I tried everything.. Here are the settings I did to make sure I see all my error logs:</p> <p><strong>php.ini</strong>:</p> <pre><code>error_reporting = E_ALL display_errors = On display_startup_errors = On log_errors = On log_errors_max_len = 1024 ignore_repeated_errors = Off ignore_repeated_source = Off error_log = /Applications/XAMPP/logs/error_log </code></pre> <p><strong>httpd.conf:</strong></p> <pre><code>php_value error_log /Applications/XAMPP/logs/error_log </code></pre> <p>i even set up an <strong>.htaccess</strong> file in the root directory of one of my virtual hosts:</p> <pre><code>php_flag display_startup_errors on php_flag display_errors on php_flag html_errors on php_flag log_errors on php_value error_log /Applications/XAMPP/logs/error_log </code></pre> <p>but then every time I reach a statement like this in the code: die("I love Prestashop");</p> <p>the code just dies without any output.. any ideas guys?</p> <p>I got the site running on my localhost using XAMPP and I'm running a Prestashop website, with PHP 5.3.1</p>
php
[2]
5,292,433
5,292,434
what should i put in this if statment to save the the current array value to a variable
<pre><code>if (preg_match('/^([0-9]( |-)?)?(\(?[0-9]{3}\)?|[0-9]{3})( |-)?([0-9]{3}( |-)?[0-9]{4}|[a-zA-Z0-9]{7})$/', $buffer, $matches)); { $variable = ?; } </code></pre>
php
[2]
1,154,652
1,154,653
How to encode & decode non Ascii characters?
<p>I am developing an application in which i want to encode the Spanish text. But the problem is that,it doesn't encode the special characters such as <strong>á, é, í, ó, ú, ü,Á, É, Í, Ó, Ú, Ü,Ñ,ñ</strong> . How can i do this?i want to <strong>encode-decode the spanish text</strong>.</p>
c#
[0]
1,285,107
1,285,108
mysql_fetch_assoc only returns 1 result
<p>mysql_fetch_assoc is only fetching one record (checked database side of things all good) Php Code:</p> <pre><code>&lt;?php $folder_id = $_GET['folder_id']; $query = mysql_query("SELECT * FROM gallery_photos WHERE folder_id = $folder_id"); if (mysql_num_rows($query) == 0) { echo '&lt;h2&gt;Sorry, you cannot change a folders photo cover if that folder has no photos in it&lt;br /&gt; &lt;a href="gallery.albums.php?fder_id='.$folder_id.'"&gt;Back to the folder&lt;/a&gt;&lt;h2&gt;'; } else { while ($row = mysql_fetch_assoc($query)) { echo '&lt;img src="gallery_photos/'.$row['photo_name'].'" width="200"'; } } ?&gt; </code></pre> <p>Can you help?</p>
php
[2]
339,241
339,242
How to make links in element availible when clicking on this element checks a checkbox?
<p>I have links inside an article element. While clicking on the element a checkbox achieves checked attribute. But links inside this element are inactive.</p> <p>How could i improve this script to make the links available?</p> <p><a href="http://jsfiddle.net/57GsC/" rel="nofollow">http://jsfiddle.net/57GsC/</a></p> <pre><code>&lt;article class="post short-post"&gt; &lt;header&gt;&lt;h3 class="post_title"&gt;&lt;a href="/posts/2"&gt;Yo&lt;/a&gt;&lt;/h3&gt;&lt;/header&gt; &lt;input type="checkbox" value="" name="post_check" class="post-check center-align"&gt; &lt;div class="post-body"&gt;Mauris nec nisl justo. Suspendisse quis metus venenatis turpis feugiat euismod ac semper arcu. Vestibulum &lt;/div&gt; &lt;footer&gt; &lt;div class="links"&gt; &lt;a class="edit button" href="/posts/2/edit"&gt;Edit Post&lt;/a&gt; &lt;a rel="nofollow" data-method="delete" class="delete button" href="/posts/2"&gt;Delete a Post&lt;/a&gt; &lt;a class="view button" href="/posts/2"&gt;View&lt;/a&gt; &lt;/div&gt; &lt;/footer&gt; &lt;/article&gt; $(".short-post").click(function(evt) { var $checkbox; if (evt.target.type !== "checkbox") { $checkbox = $(":checkbox", this); $checkbox.attr("checked", !$checkbox.attr("checked")); evt.stopPropagation(); return false; } }); </code></pre>
jquery
[5]