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
3,136,025
3,136,026
Operator keyword used in an unexpected manner in a function
<p>I ran across this code recently which is part of a template class:</p> <pre><code>operator T*(); </code></pre> <p>I have been unable to find a clarification on this on SO or online. I have been unable to figure out how this declaration is working.</p>
c++
[6]
2,982,792
2,982,793
How to start kdiff from Console application?
<p>UPDATED...</p> <p>I want to call kdiff from Console application. So I'm building two files and want to compare they at the end of executing my program:</p> <pre><code>string diffCmd = string.Format("{0} {1}", Logging.FileNames[0], Logging.FileNames[1]); // diffCmd = D:\vdenisenko\DbHelper\DbHelper\bin\Debug\Reports\16_Nov 06_30_46_DiscussionThreads_ORIGIN.txt D:\vdenisenko\DbHelper\DbHelper\bin\Debug\Reports\16_Nov 06_30_46_DiscussionThreads_ORIGIN.txt System.Diagnostics.Process.Start(@"C:\Program Files (x86)\KDiff3\kdiff3.exe", diffCmd); //specification is here http://kdiff3.sourceforge.net/doc/documentation.html </code></pre> <p>It runs kdiff3 tool, but something wrong with filenames or command... Could you please look on screenshot and say what is wrong? <img src="http://i.stack.imgur.com/20jl4.jpg" alt="enter image description here"></p>
c#
[0]
4,222,498
4,222,499
what jQuery library does this?
<p>I want to be able to have the following UI. When you click on the close button on top, the row below it moves to the top and so on.</p> <p><img src="http://i.stack.imgur.com/Ut8A4.png" alt="enter image description here"></p> <p>Is there a library for this?</p>
jquery
[5]
4,304,036
4,304,037
How to change last letter of filename to lowercase if it is a letter?
<p>I have been given data which cannot be interpreted by my software unless it has a lowercase letter at the end. The data was delivered with an uppercase letter at the end.</p> <p>Somehow I need to first recursively loop through all folders and find whether the filename ends with a letter and then change it to lowercase.</p> <p>I think python could do this, but I don´t know how,. Any help would be great!</p> <p>yours, Rob</p>
python
[7]
5,514,035
5,514,036
Giving extending classes a specific behaviour?
<p>How can I have several extensions of a class <code>Fruit</code>, and based on what class/type the object ist, execute the same method on this fruit but with different function?</p> <p>Example: I'm using a <code>FruitManager</code> to add a new <code>Fruit fruit = new Apple();</code> to the fruitstore. If this fruit is an apple, I want of course to add this to the apples list. Elso to bananas list. Now if I have 10 sorts of fruits, I do no want to create 10 functions like <code>addBanana()</code>, <code>addApple()</code> and so on. And I too do not want to have cluttering if-else statements for getting the right fruit list.</p> <p>Can I samehow get the fruitlist just based on the type of object I'm adding?</p> <pre><code>class Fruit; class Apple extends Fruit; class Banana extends Fruit; class FruitStore { List&lt;Fruit&gt; apples = new ArrayList&lt;Apple&gt;(); List&lt;Fruit&gt; bananas = nwe ArrayList&lt;Banana&gt;(); } class FruitManager { FruitStore store; //called from somewhere with Fruit fruit = new Apple(); addFruit(Fruit fruit) { //how could things like this be done in one statement? store.&lt;get list apples or bananas&gt;.add(fruit); } } </code></pre>
java
[1]
4,369,979
4,369,980
Very simple jQuery countdown
<p>I want to do two things using a countdown in jQuery. I have looked at the delay method but it won't be applied to an element like shown in the docs.</p> <p>What I want to do is wait 2 hours and then 30 seconds before the timeout do function A and then after that do function B.</p> <p>During function A I will be showing a modal where I want to show a message saying you have 30 seconds to respond. And show the 30 counting down before executing function B.</p> <p>What would be the best and simplest way of doing all of this?</p> <p>Thanks</p>
jquery
[5]
213,202
213,203
Android:textwatcher is swapping keypad automatically from numeric to qwerty after single entry of digit?
<p>I want to use a text watcher which should take both alpha numeric characters and only numeric characters, initially my keypad is qwerty but when I want to enter all numeric values and press a numeric digit my keypad automatically swaps to qwerty back again. Why is this happening? Can you please help me on this?</p>
android
[4]
1,349,806
1,349,807
Programming with Java for beginners
<p>I am a registered Student at a university in Switzerland, thus I know that programming is part of Electrotechnik (electrical engineering), the field I am going to take. </p> <p>How can I learn programming with Java with easiest way, and without help by others?</p> <p>I tried it through learning books, but I found it not easy, especially to do it alone.</p>
java
[1]
3,879,303
3,879,304
Is there any example for android media player with add player control in Notification?
<p>Is there any example for android media player with notification to add player controls like play/pause,previous and next button?</p>
android
[4]
3,188,055
3,188,056
Convert binary string to list of integers using Python
<p>I am new to Python. Here's what I am trying to do: </p> <ol> <li>Slice a long binary string into 3 digit-long chunks. </li> <li>Store each "chunk" into a list called row. </li> <li>Convert each binary chunk into a number (0-7).</li> <li>Store the converted list of numbers into a new list called numbers. </li> </ol> <p>Here is what I have so far:</p> <pre><code>def traverse(R): x = 0 while x &lt; (len(R) - 3): row = R[x] + R[x+1] + R[x+2] ??? </code></pre> <p>Thanks for your help! It is greatly appreciated. </p>
python
[7]
2,327,465
2,327,466
Python string extraction
<p>In the following string how to get the id after the directory media and after getting the id ignore the rest of the string to read only the id numbers</p> <pre><code>id_arr= ["/opt/media/12/htmls","/opt/media/24/htmls","/opt/media/26/htmls","/opt/media/56/htmls"] </code></pre> <p>The output should be 12 24 26 56</p>
python
[7]
2,109,489
2,109,490
Toggle additional rows in a table
<p>I am trying to setup a table to toggle additional 'detail' rows. Essentially, the table is loaded, if a row is clicked, it will insert a 'details' row after said row. If said row is clicked again, it will remove the 'details' row. The following yields unexpected results. I was wondering what the best approach would be?</p> <pre><code>jQuery('.tasks-table tbody tr').toggle( function () { jQuery(this).next().remove(); }, function () { jQuery(this).after('&lt;tr&gt;&lt;td colspan="10"&gt;&lt;p style="margin-left: 50px;"&gt;lorem ipsum&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;'); } ); </code></pre>
jquery
[5]
4,939,461
4,939,462
I can't pass a String array to my AsyncTask
<p>The compiler error is "<code>The method execute(ArrayList&lt;String&gt;...) in the type AsyncTask&lt;ArrayList&lt;String&gt;,Void,ArrayList&lt;String&gt;&gt; is not applicable for the arguments (String)</code>"</p> <p>Why wouldn't it accept the new parameter? can anyone see what i am doing wrong?</p> <pre><code> ArrayList&lt;String&gt; passing = new ArrayList&lt;String&gt;(); passing.add(logicalUrl); passing.add("filename.pdf"); new myTask().execute(logicalUrl); return true; } public class myTask extends AsyncTask&lt;ArrayList&lt;String&gt;, Void, ArrayList&lt;String&gt;&gt; { ProgressDialog dialog; @Override protected void onPreExecute() { dialog = new ProgressDialog(ModuleContents.this); dialog.setTitle("Downloading..."); dialog.setMessage("Please wait..."); dialog.setIndeterminate(true); dialog.show(); } protected ArrayList&lt;String&gt; doInBackground(ArrayList&lt;String&gt;... passing) { ArrayList&lt;String&gt; passed = passing[0]; String physicalUrl = parsePhysicalUrl(passed.get(0)); String filename = passed.get(1); try { globals.saveFile(physicalUrl, filename); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return passed; } </code></pre>
android
[4]
4,005,534
4,005,535
jQuery function to check classes between two divs?
<p>I've got a page with two sets of <code>div</code> like so</p> <pre><code>&lt;div id="set1"&gt; &lt;div class="1"&gt;&lt;/div&gt; &lt;div class="2"&gt;&lt;/div&gt; &lt;div class="3"&gt;&lt;/div&gt; ..... &lt;div class="n"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div id="set2"&gt; &lt;div class="1"&gt;&lt;/div&gt; &lt;div class="2"&gt;&lt;/div&gt; &lt;div class="3"&gt;&lt;/div&gt; ..... &lt;div class="n"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>"set2" is hidden on page load but each div needs to appear when the corresponding div in "set1" is clicked. For example, when "div#set1.1" is clicked, "div#set2.1" will show up. How can I do this with jQuery?</p> <p>Thanks</p>
jquery
[5]
4,602,893
4,602,894
JAVA Code for Card Reader
<p>I have MAGTEK Card Reader. I need to capture the data from magnetic card when card is swiped on the card reader. I have to develop this using core Java. Any code or application of the above would be appreciated.</p> <p>Regards, Sandeep Raju</p>
java
[1]
3,941,836
3,941,837
How do I get the name of a python class as a string?
<p>What method do I call to get the name of a class?</p>
python
[7]
679,163
679,164
What is the best way to copy a folder and all subfolders and files using c#
<p>I need to copy a Folder from one drive to a removable Hard disk. The Folder which needs to be copied will have many sub folders and files in it. The input will be Source Path and Target Path.</p> <p>Like..</p> <p>Source Path : "C:\SourceFolder" </p> <p>Target Path : "E:\"</p> <p>After copying is done, i shud be able to see the folder "SourceFolder" in my E: drive.</p> <p>Thanks.</p>
c#
[0]
240,205
240,206
I want to calculate distance in a gps
<p>I am currently working on a gps project. I have read an xml file, I can print out the longitude and latitude bounds in the form of minLat, maxLat, minLon, maxLon. Way,Relation and Node properties like, id, user, uid, version, visible, changeset and timestamp . I can also print out the tag key and value and the reference. My problem now is that I want to calculate the distance between two points with the use of latitude and longitude, it is unclear to me on how do it and which of the properties that I printed out to console I really need to do it. So please I need some help!</p>
java
[1]
3,483,206
3,483,207
multiple transition animations for an activity
<p>I have 3 activities - Activity A, Activity B and Activity C. the transitions are as follows</p> <p>A->B and B->A , A->C and C->A</p> <p>now, when I am returning to A, I need different animation for the transition, depending on whether I am coming from B or C.</p> <p>Activity A is the home page of the app, so I am going from A->B or A->C using Textviews but from both of them, I am returning to A using the hardware back button.</p> <p>So, my question is how can I detect in A, whether I am returning from A or B and apply the transition animation accordingly? </p>
android
[4]
3,069,266
3,069,267
for (var propertyName in object) vs for (propertyName in object)?
<p>Which one of those two methods for iterating over the property names of an object are preferable?</p> <pre><code>for (var propertyName in object) { } </code></pre> <p>vs.</p> <pre><code>for (propertyName in object) { } </code></pre> <p>I know in the second example, propertyName becomes a global variable, which is something to avoid, so I guess the first one would be better, right?</p>
javascript
[3]
2,556,382
2,556,383
Adding dynamic height with jQuery
<p>I need to calculate available height of an element and add it to a style via jQuery. How to I add the var of the height? Here's where I am at the moment:</p> <pre><code>var scrolH = $("#box").height() - $(".alert").height() - 100; $("#container").css({"overflow-y":"scroll", "height": scrolH + "px"}); </code></pre>
jquery
[5]
3,612,669
3,612,670
How set width of one element equal to other in android?
<p>I have two buttons defined in XML</p> <pre><code> &lt;Button android:layout_alignParentBottom="true" android:id="@+id/takepic_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Take_Pic" android:layout_gravity="left" android:layout_alignParentLeft="true" /&gt; &lt;Button android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:id="@+id/cancel_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Cancel" android:layout_gravity="right" /&gt; </code></pre> <p>My question is how can I tell android that set the width of second button equal to whatever is the width of first button.</p> <p>Update: I am looking for XML solution</p>
android
[4]
805,975
805,976
Issues with "Read More" feature of my website
<p>I need your help with doing a Read More feature for my website. Contents that the Read More feature will be applied on are generated dynamically. When I implement it, and I click the Read More...i'm taken to the same page and the full article dosent show.</p> <p>Please how can I fix this.</p> <p>Thank you.</p> <pre><code>&lt;?php $row['article_content']; if (strlen($row['article_content']) &gt; 500) { $shortText = substr($row['article_content'], 0, 100); $shortText .= '... &lt;a href="site/article.php?id=' . $id . '"&gt;Read More&lt;/a&gt; echo $shortText; </code></pre> <p>} ?></p>
php
[2]
2,790,677
2,790,678
clear UIWebView Shadow
<p>Is there a way to remove the UIWebView Shadow ? </p>
iphone
[8]
5,302,690
5,302,691
Android: Display custom dialog in center of the container
<p>How to display custom dialog as a center of the container?</p> <pre><code>Dialog customdialog = new Dialog(this,android.R.style.Theme_Translucent_NoTitleBar); Window window = customdialog.getWindow(); window.setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); window.setGravity(Gravity.CENTER); </code></pre> <p>R.style.Theme_Translucent_NoTitleBar - is used to remove border for cutomdialog. Once i used this line the dialog will appear at the topleft corner of the tablet?</p> <p>Can anyone help me to solve this issue?</p>
android
[4]
5,877,744
5,877,745
how to do functions in an AsyncTask?
<p>I have to use directions() function in an AsyncTask to avoid network processing on the UI thread.i'm unable to do this thing. MY code is</p> <pre><code> public class MainActivity extends MapActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); MapView mapView = (MapView) findViewById(R.id.mapview); //or you can declare it directly with the API key Route route = directions(new GeoPoint((int)(26.2*1E6),(int)(50.6*1E6)), new GeoPoint((int)(26.3*1E6),(int)(50.7*1E6))); RouteOverlay routeOverlay = new RouteOverlay(route, Color.BLUE); mapView.getOverlays().add(routeOverlay); mapView.invalidate(); } private Route directions(final GeoPoint start, final GeoPoint dest) { Parser parser; //https://developers.google.com/maps/documentation/directions/#JSON &lt;- get api String jsonURL = "http://maps.googleapis.com/maps/api/directions/json?"; final StringBuffer sBuf = new StringBuffer(jsonURL); sBuf.append("origin="); sBuf.append(start.getLatitudeE6()/1E6); sBuf.append(','); sBuf.append(start.getLongitudeE6()/1E6); sBuf.append("&amp;destination="); sBuf.append(dest.getLatitudeE6()/1E6); sBuf.append(','); sBuf.append(dest.getLongitudeE6()/1E6); sBuf.append("&amp;sensor=true&amp;mode=driving"); parser = new GoogleParser(sBuf.toString()); Route r = parser.parse(); return r; } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu); return true; } @Override protected boolean isRouteDisplayed() { // TODO Auto-generated method stub return false; } } </code></pre>
android
[4]
2,606,550
2,606,551
Strip all non-numeric characters (except for ".") from a string in Python
<p>I've got a pretty good working snippit of code, but I was wondering if anyone has any better suggestions on how to do this:</p> <pre><code>val = ''.join([c for c in val if c in '1234567890.']) </code></pre> <p>What would you do?</p>
python
[7]
3,416,384
3,416,385
Is it possible to get a reference to a live collection in jQuery?
<p>I have a simple table with 1 row to start out with. </p> <pre><code>&lt;table&gt; &lt;tr id="tr1"&gt; &lt;td&gt;ROW 1&lt;/td&gt; &lt;td&gt;ROW 1&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>Each <code>tr</code> listens to a click event. Once clicked on a table row I would like to get the number of rows in the table without having to constantly requery it. Does jQuery somewhere store the current collection of <code>tr's</code> and if so how can I access it?</p> <pre><code>$("table").on("click", "tr", function(e){ $("#output").html("click on row with id " + $(this).attr("id") + "&lt;br&gt;") $("#output").append("Number of rows" + $("table").find("tr").size()) // instead of "live" requerying $("table").find("tr") is there another way to get to all tr's }); // more code... $("table").append("&lt;tr id='tr2'&gt;&lt;td&gt;ROW 2&lt;/td&gt;&lt;td&gt;ROW 2&lt;/td&gt;&lt;/tr&gt;"); </code></pre> <p>EDIT: To be clear, getting the number of rows is just an example. I actually need to perform other operations on the collection as well</p> <p>See example here: <a href="http://jsfiddle.net/Flandre/Ed4pp/2/" rel="nofollow">http://jsfiddle.net/Flandre/Ed4pp/2/</a></p>
jquery
[5]
990,408
990,409
load a code as the first thing in a webpage?
<p>How do I make the followings code load the first thing in my website ? as matter of fact I want the href to load the first thing.</p> <pre><code>&lt;link rel="image_src" href="" id="ShareImageID"/&gt; &lt;script&gt; var ShareImageIdVar = location.href.match(/\d+/); document.getElementById('ShareImageID').href = "http://www.mysite.com/Images/"+ ShareImageIdVar +".jpg"; &lt;/script&gt; </code></pre> <p>what I am trying to do is, when some one share this page on facebook I want facebook to load this picture as thumbnail. So i want this herf to be filled out as soon the page loads out.</p>
javascript
[3]
2,779,786
2,779,787
how to resize ImagView by java code for android
<p>how to resize ImagView by java code when i press the Image ?</p> <p>this my xml</p> <pre><code>&lt;ImageView android:id="@+id/MyPic" android:src="@drawable/clean" android:layout_gravity="center" android:gravity="center" android:layout_height="70dp" android:layout_width="90dp" android:adjustViewBounds="true" android:scaleType="fitXY" /&gt; </code></pre> <p>and this my java</p> <pre><code>public class see_me extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.see_me); MyPic = (ImageView) findViewById(R.id.MyPic); </code></pre>
android
[4]
1,218,801
1,218,802
I want to send a textBox value in email in C#. some one Help me?
<p>I want to send a textBox value in email in C#. some one Help me?</p>
c#
[0]
5,782
5,783
Easy way to blur label
<p>Need to create blurred shadow under UILabel. Same text but with blur and offset. Since NSShadow not supported in the iPhone SDK only way I see is Quartz render. Is there simpliest solution ? Thanks</p>
iphone
[8]
3,616,180
3,616,181
Match number of chars between quotes with Javascript?
<p>Suppose my data is the following</p> <pre><code>Hello { "I have {g{t{" braces { between "{" { quotes{ "{{" </code></pre> <p>How can I match the { symbol that is only between the quotes? I am trying to extract the number of occurrences of a specified character only between quotes. Any ideas? The sample should match 6 braces</p>
javascript
[3]
871,765
871,766
Weird string does not name a type Error C++
<h3>game.cpp</h3> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;sstream&gt; #include "game.h" #include "board.h" #include "piece.h" using namespace std; </code></pre> <h3>game.h</h3> <pre><code>#ifndef GAME_H #define GAME_H #include &lt;string&gt; class Game { private: string white; string black; string title; public: Game(istream&amp;, ostream&amp;); void display(colour, short); }; #endif </code></pre> <hr> <p>The error is:</p> <blockquote> <p>game.h:8 error: 'string' does not name a type<br> game.h:9 error: 'string' does not name a type</p> </blockquote>
c++
[6]
813,950
813,951
Fget in smtp function
<p>I want to read last line which is 250 from Ehlo command. Currently it reads the first line which has 250 . Here is the current code</p> <pre><code>fputs($socket, "EHLO server1.aa.com\r\n"); // ehlo command $res = fgets($socket, 1024); // read output if (substr(trim($res), 0, 3) != "250") { </code></pre> <p>Please help me modify the code </p>
php
[2]
3,094,405
3,094,406
What is the difference between AVAudioPlayer and MPMusicPlayerController?
<p>It looks like both of them can play audio file. What is the difference between AVAudioPlayer and MPMusicPlayerController?</p> <p>Welcome any comment</p> <p>Thanks interdev</p>
iphone
[8]
4,232,522
4,232,523
Javascript - streamlining code
<p>I've created a rough version of a site that will pull and display hundreds of pdfs. I want to be able to bookmark each pdf once the user clicks on it. The only way I could think of doing this is the following:</p> <pre><code>&lt;script&gt; $(document).ready(function(){ $(".pdf1").click(function(){ if ($('#bookmark1').is(':visible')) { $("#bookmark1").css("display", "none"); } else { $("#bookmark1").css("display", "inline"); } }); $(".pdf2").click(function(){ if ($('#bookmark2').is(':visible')) { $("#bookmark2").css("display", "none"); } else { $("#bookmark2").css("display", "inline"); } }); $(".pdf3").click(function(){ if ($('#bookmark3').is(':visible')) { $("#bookmark3").css("display", "none"); } else { $("#bookmark3").css("display", "inline"); } }); $(".pdf4").click(function(){ if ($('#bookmark4').is(':visible')) { $("#bookmark4").css("display", "none"); } else { $("#bookmark4").css("display", "inline"); } }); }); &lt;/script&gt; </code></pre> <p>This isn't the best because I don't want to have to create over a hundred versions of the code above with different ids for each.</p> <p>Is there any way the code can be changed so that I don't have to duplicate this so many times?</p>
javascript
[3]
3,675,076
3,675,077
Using UIAlertView in a manner similar to Windows' MessageBox()?
<p>I'm new to the iPhone and I would like to be able to use UIAlertView in a manner similar to the Windows <code>MessageBox()</code> or the <code>MessageDlg()</code> in <code>Delphi</code>.</p> <p>For example, I have a method that needs to ask the user for confirmation on something, and proceed based on their response.</p> <p>E.g. (pseudocode):</p> <pre><code>-(void)doSomething { [doStep1]; [doStep2]; var myValue = [getDefaultValue]; if (myValue = nil) { if [promptUser(@"No value in setting. Use the default value?")] //UIAlertView here? { myValue = @"defaultValue"; } else return; // bug out of the routine 'cause we have no value. } [doStep3 withValue:myValue]; } </code></pre> <p>Or, put put it another way- is there a way of using <code>UIAlertView</code> to ask the user a question within a routine as a way of controlling the logic flow of that routine?</p>
iphone
[8]
229,768
229,769
Exception occurs for some users with email contact picker
<p>I am trying to allow my users to select a contact from among their contacts that have email addresses. This is the code that is executed when they click the appropriate button:</p> <pre><code>Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Email.CONTENT_URI); startActivityForResult(intent, PICK_CONTACT); </code></pre> <p>This is working just fine on my own phone, but after releasing my app I'm seeing the following exception occur for some of my users: </p> <pre><code>0 android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.PICK dat=content://com.android.contacts/data/emails } 1 at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1638) 2 at android.app.Instrumentation.execStartActivity(Instrumentation.java:1510) 3 at android.app.Activity.startActivityForResult(Activity.java:3244) 4 at com.fitrocket.android.InviteMethodSelectionAct.onClick(InviteMethodSelectionAct.java:59) 5 at android.view.View.performClick(View.java:3549) 6 at android.view.View$PerformClick.run(View.java:14400) 7 at android.os.Handler.handleCallback(Handler.java:605) 8 at android.os.Handler.dispatchMessage(Handler.java:92) 9 at android.os.Looper.loop(Looper.java:154) 10 at android.app.ActivityThread.main(ActivityThread.java:4945) 11 at java.lang.reflect.Method.invokeNative(Native Method) 12 at java.lang.reflect.Method.invoke(Method.java:511) 13 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 14 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 15 at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>I haven't been able to reproduce this myself so I'm wondering if anyone could tell me what the problem may be?</p>
android
[4]
2,685,489
2,685,490
Python execute complex shell command
<p>Hi I have to execute a shell command :diff &lt;(ssh -n root@10.22.254.34 cat /vms/cloudburst.qcow2.*) &lt;(ssh -n root@10.22.254.101 cat /vms/cloudburst.qcow2) I tried </p> <pre><code>cmd="diff &lt;(ssh -n root@10.22.254.34 cat /vms/cloudburst.qcow2.*) &lt;(ssh -n root@10.22.254.101 cat /vms/cloudburst.qcow2)" args = shlex.split(cmd) output,error = subprocess.Popen(args,stdout = subprocess.PIPE, stderr= subprocess.PIPE).communicate() </code></pre> <p>However I am getting an error diff: extra operand cat</p> <p>I am pretty new to python. Any help would be appreciated</p>
python
[7]
890,946
890,947
In java, what's the relationship between field and class?
<p>Please refer to this API. The link is:</p> <p><a href="http://download.carrot2.org/stable/javadoc/org/carrot2/text/preprocessing/pipeline/CompletePreprocessingPipeline.html" rel="nofollow">http://download.carrot2.org/stable/javadoc/org/carrot2/text/preprocessing/pipeline/CompletePreprocessingPipeline.html</a></p> <pre>Class CompletePreprocessingPipeline Field Summary DocumentAssigner documentAssigner Document assigner used by the algorithm, contains bindable attributes.</pre> <p>Then I found some example using completePreprocessingPipeline this way</p> <pre><code>completePreprocessingPipeline().documentAssigner()exactPhraseAssignment(true) </code></pre> <p>I do not understand the relationship between "completePreprocessingPipeline" and "documentAssigner" in terms of "field vs.class".</p>
java
[1]
13,089
13,090
Android: SMS and contacts data access
<p>I'm trying to do a backup &amp; restore application and I want to backup all SMS and all contacts informations. I read a lot about content providers but I first tried to copy these <code>contacts2.db</code> and <code>smsmms.db</code> files (the lazy and easiest way I figured out ) with no success because of permission issue (these databases are private). Now it seems like content providers remain my only issue. I thought about accessing each data field in both SMS and contacts, store it in files(XML format) with a specific structure, being easy to read and restore. Is that a good way? Are there any other easy ways instead of content providers for my backup &amp; restore purpose?</p>
android
[4]
5,385,517
5,385,518
match and replace using php
<p>I have a html file that contains urls that start with ftps, http, https, mms, ed2k.. and in certain paragraphs. I need to sort these links and remove all the links that start with mms://. I tried preg_replace but it doesnt work coz many links are too long. can someone suggest a good method to remove the links using php?</p>
php
[2]
4,894,760
4,894,761
Using $.each for more complex JSON data
<p>I understand how to use <code>$.each</code> to go through JSON data which looks like this:</p> <pre><code>{ "one": "Singular sensation", "two": "Beady little eyes", "three": "Little birds pitch by my doorstep" } </code></pre> <p>For example:</p> <pre><code>$.each(data, function(key, val) { echo '&lt;div&gt;' + val + '-' + key + '&lt;/div&gt;'; }); </code></pre> <p>But how do I use <code>$.each</code> to go though JSON data which looks like this:</p> <pre><code>{ "d": [ { "__type": "Tab", "id": 1, "name": "Innovation", "ordering": 0 }, { "__type": "Tab", "id": 3, "name": "Thought", "ordering": 0 }, { "__type": "Tab", "id": 0, "name": "Collaboration", "ordering": 0 } ] } </code></pre> <p>Where I want to use the <code>id</code> and <code>name</code>.</p>
jquery
[5]
2,972,165
2,972,166
How to get pictures of the camera preview, before its Callback draws theese pictures to its holder?
<p>I really hope you guys could help me, because I couldn't find no solution for my task since 2 weeks now, neither by searching, nor by myself. </p> <p>What I'm trying to do is to get the camera-preview-pictures in bitmap format, before they are drawn to the camera-preview's surfaceView!, then i want to manipulate the bitmap with computer-vision-algorithms, and eventually draw them on the camera-preview's surfaceView.<br> I'm able to get YuvImages from the camera-preview using the callback's onPreviewFrame() method, further I'm able to manipulate them as needed and I'm able to draw pictures on a surfaceView using a thread. BUT I can't figure out how to combine those tasks.<br> The problem is that the preview's callback automatically draws it's pictures to its surfaceView, so when I get the pictures in the onPreviewFrame() method, they were already drawn to the surfaceView. How to change this behaviour? I could find no solution.<br> I thought it might be a workaround simply not showing the preview's surfaceView, but another one, where the manipulated pictures are drawn on, but I couldn't get this solution working either... </p> <p>I hope you guys could help me, because I'm already frustrated. </p> <p>Greetz from Germany! </p> <p>Deniz </p>
android
[4]
5,952,566
5,952,567
Break parent, top variables in iframe to prevent frame busting, but still access functions of parent
<p>I am loading a website's content in an iframe through a proxy on my server. If I add this javascript at the top of the file,</p> <pre><code>var top = ""; var parent = ""; </code></pre> <p>I can successfully prevent the website from frame busting. How can I do this and still access functions in the parent window, like this:</p> <pre><code>parent.my_function('this is called from inside the iframe'); </code></pre>
javascript
[3]
5,412,460
5,412,461
Unique value in find and replace
<p>My problem is that im using jQuery to replace the bb tags in a message. I want to replace all the <code>[youtube][/youtube]</code> with a youtube video and so far it works only if there is only 1 <code>[youtube][/youtube]</code> tag. If there is multiple <code>[youtube][/youtube]</code> tags in a message they change all of them to the same video.</p> <p>This is the code:</p> <pre><code>&lt;script&gt; function playt(a,b){ //nothing yet } f=0; function ytbb(s,w){ f++; results = s.match("[\\?&amp;]v=([^&amp;#]*)"); vid = ( results === null ) ? s : results[1]; $('.yt'+w).html('&lt;div onclick="playt('+f+',\''+vid+'\')" class="playt"&gt;&lt;/div&gt;&lt;img width="200" height="151" src="http://img.youtube.com/vi/'+vid+'/0.jpg"&gt;'); } function ubbcode(txt) { var find = [ /\[youtube\](.*?)\[\/youtube\]/gi, /(?:%lb%){3,}/g ]; var e = Math.floor(Math.random()*99999999999); var replace = [ '&lt;script&gt;ytbb("$1","'+e+'")&lt;/script&gt; &lt;div class="rmg yt'+e+'"&gt;&lt;/div&gt;', '%lb%%lb%' ]; for(var i in find) { txt = txt.replace(find[i],replace[i]); } txt = txt.replace(/%lb%/g,'&lt;br /&gt;'); return txt; } &lt;/script&gt; </code></pre> <p>Can anybody help me with this?</p>
jquery
[5]
1,635,671
1,635,672
Convert Degrees/Minutes/Seconds to Decimal Coordinates
<p>In one part of my code I convert from decimal coordinates to degrees/minutes/seconds and I use this:</p> <pre><code>double coord = 59.345235; int sec = (int)Math.Round(coord * 3600); int deg = sec / 3600; sec = Math.Abs(sec % 3600); int min = sec / 60; sec %= 60; </code></pre> <p>How would I convert back from degrees/minutes/seconds to decimal coordinates?</p>
c#
[0]
5,603,926
5,603,927
Jquery find class with a certain text and change the css of the parent class if conditions are true
<p>I am trying to achieve the following using Jquery but I am not sure how to go about doing it. Any help would be greatly appreciated. Thank you.</p> <pre><code>&lt;script&gt; $a = array(1,2); if ($('.box:contains($a)')){ $('.inbox' //the .inbox where .box text = $a).css(//something); } &lt;/script&gt; &lt;body&gt; &lt;div class='inbox'&gt; &lt;div class='box'&gt;1&lt;/div&gt; &lt;/div&gt; &lt;div class='inbox'&gt; &lt;div class='box'&gt;2&lt;/div&gt; &lt;/div&gt; &lt;div class='inbox'&gt; &lt;div class='box'&gt;3&lt;/div&gt; &lt;/div&gt; </code></pre>
jquery
[5]
5,091,390
5,091,391
how to apply JavaScript replace() Method 2 time in a page
<p>JavaScript replace() Method</p> <p>Hello <strong>username</strong>!Don’t forget me this weekend!<strong>Username</strong>.</p> <p>When i use this</p> <pre><code>str.replace("username", "Username"); </code></pre> <p>but it's replace only first occurance i have to perform replace all.</p>
javascript
[3]
1,684,526
1,684,527
how find location within kml file using php
<p>how can i find the user entered location is within kml file using php. PHP</p>
php
[2]
671,615
671,616
Getting a value from a .text function
<p>I have functions in which values are constantly being calculated I am trying to store the value of these functions when the button is pressed however when I try the code below it doesn't work. How then can I capture this in a variable when a button is paused?</p> <p><code>songposition = $("#songCurrentpos").text(pad(Math.floor(current / 60), 2) + ":" + pad(Math.floor(current % 60), 2));</code></p> <p><code>songlength = $("#songDuration").text(pad(Math.floor(duration / 60), 2) + ":" + pad(Math.floor(duration % 60), 2));</code></p>
jquery
[5]
2,584,444
2,584,445
Android: Multiclick at the same button
<p>In my Application I have a simple image switcher and 2 buttons(Next and Previous) at the bottom of screen to switch images. Also I set animation to image switcher with duration 700. So when i click "Next" button firstly I disable next button, and than set to Clickable with delay with the same duration...because i need animation to be finished.</p> <pre><code>public void onNextButtonPressed(View view) { setPreviousAndNextButtonsClickable(false); setPeviousAndNextButtonsClickableWithDuration(); } private void setPeviousAndNextButtonsClickableWithDuration() { Handler mHandler = new Handler(); mHandler.postDelayed(new Runnable() { public void run() { setPreviousAndNextButtonsClickable(true); } }, 700); } private void setPreviousAndNextButtonsClickable(boolean clicable) { nextButton.setClickable(clicable); previousButton.setClickable(clicable); } </code></pre> <p>And now about my problem...When I click next button very faster, some time button can click two times with out delay...Looks like i can click faster than button.setCkickable() method work... What is the problem ? Can it be because of device ? I'm trying that on HTS with android 2.2 where I reproduce a bug...and also on android 2.3.4 where i cannot reproduce that...Is that because device is slow or something wrong in my code ? thanks...</p>
android
[4]
2,632,921
2,632,922
Javascript :: Does better to write: var arr=[]; then var arr=new Array();?
<p>Does better to write and why: </p> <pre><code>var arr=[]; then var arr=new Array(); var obj={}; then var obj=new Object(); </code></pre> <p>I read <a href="http://www.slideshare.net/Sampetruda/advanced-javascript-closures-prototypes-and-inheritance?src=related_normal&amp;rel=908356">slide lection page 36</a> about that idea , but no explanation was given or example why its better.</p> <p>Thanks</p>
javascript
[3]
4,653,406
4,653,407
removing a breakpoint I didn't set
<p>It seems to quite frequently happen that when I'm playing with code in the chrome console that execution of a webpage is stopped by a breakpoint in the jquery file, such as you see below. If I don't have the console open when running the page, it doesn't stop, only when console open. I also can't click on the breakpoint to disable it. It also happens, in this instance and others, that when I'm trying to get access to the file with the custom javascript it's not showing up in the sources presumably because things have stopped loading. I click the ||> arrow to push through the breakpoint, but the file with the javascript never loads in scripts, so I can't set breakpoints where I want. Does what I've told you explain what I might be doing wrong? </p> <p><img src="http://i.stack.imgur.com/IWBgk.png" alt="enter image description here"></p>
javascript
[3]
5,818,472
5,818,473
Compile error: X does not exist in the current context
<p>The name 'MenuItems_Click' does not exist in the current context. Should I name it anywhere in ContextMenuStrip?</p> <pre><code>private void icnNotify_Click(object sender, EventArgs e) { // Create a new instance of the Favorites class Favorite.Favorites objFavorites = new Favorite.Favorites(); // Scan the Favorites folder objFavorites.ScanFavorites(); // Clear current menu items FavoritesMenu.Items.Clear(); // Process each objWebFavorite object // in the Favorites collection foreach (Favorite.WebFavorite objWebFavorite in objFavorites.FavoriteCollection) { // Declare a ToolStripMenuItem object ToolStripMenuItem objMenuItem = new ToolStripMenuItem(); // Set the properties of ToolStripMenuItem object objMenuItem.Text = objWebFavorite.Name; objMenuItem.Tag = objWebFavorite.Url; // Add a handler to Click event of new menu item objMenuItem.Click += new EventHandler(MenuItems_Click); // Add the ToolStripMenuItem object // to the ContextMenu FavoritesMenu.Items.Add(objMenuItem); } private void MenuItems_Click(object sender, System.EventArgs e) { // Create a ToolStripMenuItem // and fill it with sender parameter ToolStripMenuItem s = (ToolStripMenuItem)sender; // Open the internet explorer to view selected // favorite System.Diagnostics.Process.Start(s.Tag.ToString()); } private void ExitMenuItem_Click(object sender, System.EventArgs e) { Application.Exit(); } </code></pre>
c#
[0]
2,798,795
2,798,796
Any reason behind hyphens in a GUID?
<p>Just when I generated a GUID, I found some hyphens in between the character and also at specified intervals</p> <pre><code>8b55fec7-c987-4e7b-abad-16e5aaea9b53 </code></pre> <p>Is there any story behind this?</p> <p><strong>Note:</strong> My intention is to remove those hyphens as I am adding this GUID to a filename and our filename should only be aplhanumeric.</p>
c#
[0]
4,241,222
4,241,223
find the phone number based on name - android
<p>I have a list view with three persons from the contact list . How can I display the phone number of these persons?</p> <p>Can someone please post a code?</p> <pre><code> for (int i=0;i&lt;list.size();i++) { Log.i("TAG","PHONE NO IS: "+ ......)---------phone number? //list.get(i).getName() - is the contact list persons name. CounterResolvercr=getCounterResolver(); Cursor cur= cr.query(ContactsContact.CONTENT_URI,null,null,null); while (cur.moveToNext()) { if (cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME))== list.get(i).getName()) { String id= cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID); Cursor pcur=cr.quesy(ContactsContact.CommonDataKinds.Phone.CONTENT_URI, null, ContactContract.CommonDataKInds.Phone.CONTACT_ID+"=?",new Strng[]{id},null); while (pCur.moveToNext()) { String number = pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); Log.d(TAG,number);//IS NOT PRINTING ANYTHING WHY?!!! } pcur.close() } } } </code></pre>
android
[4]
2,101,779
2,101,780
Python reading file that might not exist
<p>What is the best way in python to handle reading a file that may potentially not exist?</p> <p>Currently I have the following:</p> <pre><code> try: with open(filename, "r") as f: return f.read() except IOError: return False </code></pre> <p>Is this the best way to do it or is this wrong on any level at all?</p> <p>I guess my biggest concerns are:</p> <ol> <li>Catching the exception only to return false</li> <li>Maybe i am missing a 'Python' way of silently missing the error for a missing file</li> </ol>
python
[7]
4,256,429
4,256,430
Passing string through stat() function
<p>I have following code:</p> <pre><code>#include &lt;stdio.h&gt; // For printf() #include &lt;sys/stat.h&gt; // For struct stat and stat() struct stat stResult; if(stat("Filename.txt", &amp;stResult) == 0) { // We have File Attributes // stResult.st_size is the size in bytes (I believe) // It also contains some other information you can lookup if you feel like it printf("Filesize: %i", stResult.st_size); } else { // We couldn't open the file printf("Couldn't get file attributes..."); } </code></pre> <p>Now. How can I pass my own string through stat()? Like this</p> <pre><code>string myStr = "MyFile.txt"; stat(myStr, &amp;stResult) </code></pre>
c++
[6]
5,826,579
5,826,580
changing uitableviewcellaccessory image
<p>is it possible to change the uitableviewcellaccessory image in tableviewcell??</p>
iphone
[8]
47,008
47,009
running a function when another is clicked using jquery
<p>When i run this <code>$btns.first().click();</code> in the first function it doesnt action it where as if i click it (as per second function it works perfectly. The result is the slides all show when i click on a tab instead of just one. And then when i click one of the inner buttons the slides all disapear leaving just one. Which is correct. </p> <p><a href="http://jsfiddle.net/p259x/" rel="nofollow">http://jsfiddle.net/p259x/</a></p> <p>I know this is hard to understand so hopefully the link helps.</p>
jquery
[5]
4,447,731
4,447,732
Unable to upate ListView data
<p>I have a class A which extends Activity. From the class A ,I am calling Adapter class B which extends BaseAdapter.</p> <p>I am displaying ListView data from within the overriden method public View getView(final int position, View convertView, ViewGroup parent)</p> <p>I am fetching the data for the ListView from SQLite. Now on clicking on a cancel button for a specific listitem , I am able to delete the record the data from the database , but unable to refresh the view . Still the data is being displayed . But if again I navigate to the screen from the home screen , the data is not being displayed , indicating there is no problem with the database , only updating display is a issue .</p> <p>The skeletal code is as follows:</p> <pre><code>class A extends Activity { B adapter ; ListView list ; public void onCreate(Bundle savedInstanceState) { list = (ListView) findViewById(R.id.textList); // I am calling the adapter adapter = new B(this, txtStr); list.setAdapter(adapter); } class B extends BaseAdapter{ public View getView(final int position, View convertView, ViewGroup parent){ // on click of the delete button , record is delated for a specific // listitem &amp; the view needs to be updated , but I am unable to update the view holder.deleteImage.setOnClickListener(new OnClickListener() { private int pos = position; public void onClick(View v) {// (position)) -- what was this doing here? (dbreslau) sampleDB.execSQL("DELETE FROM " + Constants.TABLE_NAME + " where id = 1"); adapter.notifyDataSetChanged(); } }); } } } </code></pre> <p><strong>Even after calling the notifyDataSetChanged , the view is not getting updated. Kindly help if anyone already implemented the same.</strong></p>
android
[4]
4,166,078
4,166,079
jQuery click OUT with overlay
<p>I would like it that when the user clicks out of the #email-form div, it is hidden and #stamp is displayed again. I am trying to do this with an overlay div, but it's not working..</p> <pre><code> jQuery('#email-form').hide(); jQuery('#stamp').click(function() { jQuery(this).hide(); jQuery('#email-form').show(); jQuery( }); jQuery('.overlay').click(function() { jQuery('#email-form').hide(); jQuery('#stamp').show(); }); </code></pre> <p>---------------------------------- HTML ------------------------------</p> <pre><code> &lt;div class="overlay" style="width:100%; height:100%;"&gt;&lt;/div&gt; &lt;div id="stamp"&gt;&lt;img src="email_postmark.png"/&gt;&lt;/div&gt; &lt;div id="email-form"&gt; &lt;form id="signup" action="&lt;?=$_SERVER['PHP_SELF']; ?&gt;" method="get"&gt; &lt;span id="response"&gt; &lt;?php require ('store-address.php'); if($_GET['submit']){ echo storeAddress(); } ?&gt; &lt;/span&gt; &lt;input type="text" name="email" id="email" placeholder="TYPE EMAIL &amp; PRESS ENTER"/&gt; &lt;/form&gt; &lt;/div&gt; </code></pre>
jquery
[5]
4,334,274
4,334,275
Possible to capture entire call stack from a jQuery call?
<p>Admittedly, a strange question....but is it <strong>possible</strong> to somehow capture an entire javascript call stack from jQuery? For example, let's say on page ready, I do a for each on every row in a table, and for a certain cell in each row, I want to change the row color based on this cell exceeding a certain value.</p> <p>So, I'm wondering if it is possible to write this in jQuery, execute it, and somehow end up with an entire stack trace of the actual javascript that was executed?</p> <h2>Update #1</h2> <p>Hmmm....this looks very similar to what I am hoping for (looks like it must be technically possible):<br> <a href="http://getfirebug.com/logging" rel="nofollow">http://getfirebug.com/logging</a> </p> <p><strong>Stack traces</strong><br> <em>Just call console.trace() and Firebug will write a very informative stack trace to the console. Not only will it tell you which functions are on the stack, but it will include the value of each argument that was passed to each function. You can click the functions or objects to inspect them further.</em></p> <h2>Update #2</h2> <p>Ah of course, the question is: why?<br> How about this: javascript is allowed at my company, but jQuery is not.</p> <h2>Conclusion</h2> <p><a href="http://getfirebug.com/logging" rel="nofollow">http://getfirebug.com/logging</a><br> or<br> <a href="http://blog.johnmckerrell.com/javascript-call-tracer/" rel="nofollow">http://blog.johnmckerrell.com/javascript-call-tracer/</a></p>
jquery
[5]
4,579,208
4,579,209
Hide the acrobat reader tool bar and capturing the print event from my application
<p>Hi all I want to capture the print event from my asp.net web application and also i want to disable the save button from acrobat tool bar.</p>
asp.net
[9]
3,011,981
3,011,982
If I use "on" with jQuery do I need to include this function inside a document ready?
<p>I have the following:</p> <pre><code>$("#menu, #home").on('click', 'a', function() { // javascript code }); </code></pre> <p>But it's not inside a document ready? Will it still work okay even if the #menu or #home are not yet part of the DOM? </p>
jquery
[5]
4,552,662
4,552,663
How to access a variable in an object from a member object's function
<p>Ok, I have a class:</p> <pre><code>class class1 { public: class2 object2; int a; }; </code></pre> <p>where:</p> <pre><code>class class2 { public: void function2(); }; </code></pre> <p>Basically, I need function2 in object2 to be able to access "a." How would I go about doing this? Thanks.</p>
c++
[6]
3,999,311
3,999,312
Why do types referenced outside of a namespace need to be fully qualified?
<p>Given the following code snippet:</p> <pre><code>using System; using Foo = System.Int32; namespace ConsoleApplication3 { class Program { static void Main(string[] args) { } } } </code></pre> <p>If I remove the "System." from in front of Int32 in my declaration for the "Foo" type alias, I get a compiler error. Despite the fact that I'm using the System namespace at the top of the file, the compiler can't find an unqualified "Int32" type.</p> <p>Why is that?</p>
c#
[0]
1,805,244
1,805,245
How can I achieve safe user-generated client script execution?
<p>So we all know that <strong>eval</strong> is bad, and allowing users to create their own JavaScripts to run on your site is just potentially VERY dangerous, opening doors to all kinds of security risks.</p> <p><strong>My challenge however, is to come up with a solution, to allow users to create their own custom script snippets, that will execute on the client side. These scripts are basically prediction algorithms, that allow each individual user to build their very own customized prediction strategy, calculating and processing a set of data provided to them via AJAX.</strong></p> <p>Basically, on regular time intervals, an AJAX request is made by the system, a JS event is trigerred, notifying the client side each time new data has arrived. The above user scripts are allowed to hook into/subscribe to this event, executing the users algorithm on the received data, and outputting the result of their algorithm.</p> <p>The following problem I have...If I allow users to create their own JavaScripts, they can pull all kinds of fancy tricks, like make cross browser unauthorized AJAX requests, invoke unintended input events and in plain short...attempt to hack the system with malicious intent.</p> <p>I need to encapsulate these scripts, restricting them from using the browser context. For example they cannot make AJAX requests, or invoke click events on the page. The only access they have is to the data supplied, via a pre-determined input>process>output interface.</p> <p>So my question is, how can my site, give users, SAFE, limited, scripting access? Is there for example a Lua script parser written in JavaScript or something likewise that can be utilised?</p>
javascript
[3]
3,145,877
3,145,878
JAVA: Read char from String to a certain char
<p>Is there a method or way to read and keep reading chars from a string, putting them in a new string until there is a certain char. Keep reading from &lt; to > but no further. Thankx</p>
java
[1]
4,171,822
4,171,823
Adding ImageViews to SurfaceView
<p>I am developing game in android. In my game i have SurfaceView(i.e., GameView) which is set on setContentView(new GameView(this));. During the runtime i have to add no of imageviews to the surface view. Each ImageView should listen for TouchEvent. and now How to add ImageViews to surfaceview?</p>
android
[4]
4,471,295
4,471,296
Flurry State level user Details
<p>friend's I have configured Flurry Analytics in my application,it points the users in the country well,but here i need to know the detailed view of the state wise users by clicking up the country from map showing but the corresponding users from that state is not showing.</p> <p>I set <code>&lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;</code> in my manifest file and set <code>FlurryAgent.setReportLocation(true);</code>before FlurryAgent.onStartSession(Rss_Feed_Grid.this, brown_api); in OnStart() method. what i need to configure to view detail users by states from the country.</p> <p>please help me..</p>
android
[4]
5,532,304
5,532,305
Is it possible to skip parameters that have default values in a php(5) function call?
<p>I have this:</p> <pre><code>function foo($a='apple', $b='brown', $c='Capulet') { // do something } </code></pre> <p>Is something like this possible:</p> <pre><code>foo('aardvark', &lt;use the default, please&gt;, 'Montague'); </code></pre>
php
[2]
2,937,486
2,937,487
Get microphone soundlevel in android
<p>Im trying to get the sound level by getting live-input from the microphone.</p> <p>As apps such as ,Sound meter and deciBel. I found this sample code from the link: </p> <p><a href="http://code.google.com/p/android-labs/source/browse/trunk/NoiseAlert/src/com/google/android/noisealert/SoundMeter.java" rel="nofollow">http://code.google.com/p/android-labs/source/browse/trunk/NoiseAlert/src/com/google/android/noisealert/SoundMeter.java</a></p> <p>I'm also pasting it here.</p> <pre><code>package com.google.android.noisealert; import android.media.MediaRecorder; public class SoundMeter { static final private double EMA_FILTER = 0.6; private MediaRecorder mRecorder = null; private double mEMA = 0.0; public void start() { if (mRecorder == null) { mRecorder = new MediaRecorder(); mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); mRecorder.setOutputFile("/dev/null"); mRecorder.prepare(); mRecorder.start(); mEMA = 0.0; } } public void stop() { if (mRecorder != null) { mRecorder.stop(); mRecorder.release(); mRecorder = null; } } public double getAmplitude() { if (mRecorder != null) return (mRecorder.getMaxAmplitude()/2700.0); else return 0; } public double getAmplitudeEMA() { double amp = getAmplitude(); mEMA = EMA_FILTER * amp + (1.0 - EMA_FILTER) * mEMA; return mEMA; } </code></pre> <p>}</p> <p>Does this code do what im trying to do? Thanks!</p>
android
[4]
4,826,245
4,826,246
How to make a login and registration system in android?
<p>I have thorough understanding of php and mysql but I need help with making a registration form in android. I am not that experienced in java and none of the tutorials that are out are up to date.</p>
android
[4]
3,345,989
3,345,990
Load test for a web server
<p>I have to write python script to perform load test for thttpd server. i need to test like "wat happens if 500 users accesing the server at a time" . i'm in need of some input to implement this..</p>
python
[7]
1,901,231
1,901,232
In Python, how do I check the size of a StringIO object?
<p>And get the bytes of that StringIO object?</p>
python
[7]
5,799,546
5,799,547
Javascript alternative to document.write not innerHTML
<p>I modified a little js script which compares a date to today and calculates the difference. (I'm a novice) However, it uses document.write, which I've been told is bad. I don't know why it's bad, people just say it's bad and never explain why. Anyway, I'm looking for an alternative. innerHTML doesn't seem to work, and other questions answered on this site just point to DOM manipulation references without really answering the question.</p> <p>Here's my script:</p> <pre><code> //Set the two dates var iquit =new Date(2013, 1, 15); today=new Date(); //Get 1 day in milliseconds var one_day=1000*60*60*24; var day_numeric=Math.ceil((today.getTime()-iquit.getTime())/(one_day)); //Calculate difference btw the two dates, and convert to days document.write("&lt;p&gt;"+day_numeric+ " days have gone by since you quit smoking!&lt;/p&gt;"+ "&lt;p&gt;You have saved "+ day_numeric*7+" pounds&lt;/p&gt;"); </code></pre> <p>If anyone can tell me a better way to write this, it'd be amazing.</p>
javascript
[3]
2,985,099
2,985,100
PHP set data by var name
<p>I have class</p> <pre><code>class User extends BaseModel{ public $id; public $name; } class BaseModel{ function __construct($data=null){ if($data!=null) //set $id and $name } } </code></pre> <p>I would like to set $id , $name and any other data that extends BaseModel by calling</p> <pre><code>$test = new User(array('id'=&gt;1,'name'=&gt;'user name')) </code></pre> <p>I tried to use </p> <pre><code>$this-&gt;__set($arrayKey,$arrayValue); </code></pre> <p>But i got error : Fatal error: Call to undefined method User::__set() What am I doing wrong? Thank you for any help.</p>
php
[2]
5,858,607
5,858,608
print out the content of a modified file
<p>I am having a problem with outputting a modified file in php, here is my code:</p> <pre><code>&lt;?php $content = file_get_contents("1.txt"); $items = explode("\n",$content); $line = ""; foreach ($items as $item){ $values = explode(",",$item); foreach ($values as &amp;$value){ $key = array_search($value,$values); if ($key!=4){ $line .= $value.","; } elseif ($value=="0"){ $value="?"; $line .= $value."\n"; } else $line .= $value."\n"; } } $file = fopen("1.txt","w"); fwrite($file,$line); fclose($file); ?&gt; </code></pre> <p>The original content in 1.txt is </p> <pre><code>1,1,1,1,1 2,2,2,2,0 </code></pre> <p>The desired output is to be</p> <pre><code>1,1,1,1,1 2,2,2,2,? </code></pre> <p>However, I got this when I run the script:</p> <pre><code>1,1,1,1,1,2,2,2,2,? , </code></pre> <p>What is the problem of my script? Thanks a lot!</p>
php
[2]
1,816,471
1,816,472
Customizing the mobile for Blind in android
<p>i have developed some applications for blind which makes them to use basic mobile functionalities like making call, add contact,delete contact. but now i am in dilemma that how the blind can even unlock the mobile if he is given the android mobile and navigate through the menu to reach the specific application. So does one need to customize the entire OS by making it interactive to the blind user by responding to "Voice commands" (like "unlock mobile" should unlock it) to enable him to use mobile functionalites. </p> <p>But i have tried some of the voice recognition tutorials,Voice recogntition approach was not accurate. What could be the possible way to customize the mobile for blind and is it possible to access the internals of the OS and customize it, to make it respond to voice commands? how to code it i am not getting.</p> <p>please throw some light on this problem. in what way it could be made possible.</p>
android
[4]
5,116,512
5,116,513
Android synhronization of profile (mobile and web)
<p>I have profiles in my mobile app and in web project. We are currently thinking about how can we synchronize them. The point is, if person add something to mobile profile - we can just send a bundle of ids to webserver and server will add them as well. The same with removing items. But what is if person will removes in mobile profile without constant connection, then removes something inside his profile in webserver`s profile? And after that we have to synchronize it somehow. </p> <p>I understand that solution of such issue has to be already found, but unfortunately I didn`t find anything helpful yet.</p>
android
[4]
2,536,713
2,536,714
Replacing the nth location of the selected text using jQuery
<p>I've the following div:</p> <pre><code>&lt;div id="target" &gt;hello(first), hello(second), hello(third), hello(fourth)&lt;/div&gt; </code></pre> <p>and following code based on this <a href="http://stackoverflow.com/questions/5765381/how-do-i-wrap-a-text-selection-from-window-getselection-getrangeat0-with-an-h">discussion</a>:</p> <pre><code> $(document).ready(function(){ $('#target').bind('mouseup', function(){ var needle = window .getSelection() .getRangeAt(0); var haystack = $(this).text(); var newText = haystack.replace(needle,'&lt;span class="highlight"&gt;' + needle + '&lt;/span&gt;'); $(this).html(newText); }); </code></pre> <p>When I select one of the "hello", it 'randomly' highlights one of them rather than the actual selected "hello".</p> <p>How can I highlight the selected one?</p> <p>Thanks in advance for your help.</p>
jquery
[5]
2,047,723
2,047,724
access scope of variable in for loop
<p>I have searched the SO before I post this question here and hopefully this is not a duplicated one.</p> <pre><code>def print_me(): a_list = range(1, 10) for idx, aa in enumerate(a_list): pass print(idx) if __name__ == '__main__' : print_me() </code></pre> <p>Output is as follows:</p> <blockquote> <p>8</p> </blockquote> <p>I came from C++ world and could not figure out why <code>idx</code> is still in the scope when the code is out side of for loop?</p> <p>Thank you</p>
python
[7]
5,957,159
5,957,160
NSTimer was not triggered
<p>I used the code below to wait for NSTimer triggered</p> <pre><code> -(void)timer1Fired :(NSTimer *) timer { isTriggered=true; } //---------------------------------------------- isTriggered=false; [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timer1Fired:) userInfo:nil repeats:NO]; int j1 = 0; while ( !isTriggered &amp;&amp; j1 &lt; 1000) { [NSThread sleepForTimeInterval: 0.5]; j1++; } //continue to do something //b </code></pre> <p>but it looks like NSTimer never be triggered</p> <p>Welcome any comment</p>
iphone
[8]
4,653,018
4,653,019
remove a value from an int array c#
<p>I have an array of int values <code>int[] ids</code>. I have a Datatable <code>DataTable dt</code> I want to keep only those values in the array that are there in the Datatable column ids</p> <p>Say <code>int[] ids</code> contain <code>[2,3,4,5]</code> <code>dt</code> contains <code>[2,3,4,3,4]</code> ---<code>ids</code> here may repeat</p> <p>so output <code>ids</code> will have only <code>[2,3,4]</code></p> <p>Pls suggest ways with lambda or linq....</p> <p>I tried the crude way using two foreachs.</p>
c#
[0]
5,582,234
5,582,235
retrieving parameter from function
<p>I have 2 functions, one that gets a name and the other that is being set up to Delete from the list of name. There are no compliation errors, but my DeleteName doesn't display anything. Probally a simple fix, what did I overlook?</p> <pre><code> public static List&lt;string&gt; GetName(List&lt;string&gt; aString) { aString = new List&lt;string&gt;(); localList.Add("cat"); localList.Add("apple"); localList.Add("bass"); localList.Add("dog"); return aString; } public static List&lt;string&gt; DeleteName(List&lt;string&gt; aString) { aString = new List&lt;string&gt;(); GetName(aString); foreach (string x in aString) { Console.WriteLine(x); } return aString; } </code></pre>
c#
[0]
2,291,355
2,291,356
writeToFile fails on iphone but works on simulator
<p>NSString *myfile = [[NSBundle] mainBundle] pathForResource:@"fileName" ofType:@"plist"];</p> <p>NSMutableArray *mydata= [[NSMutableArray alloc] initWithContentsOfFile:myfile];</p> <p>/* code to modify mydata */</p> <p>[mydata writeToFile:myfile atomically:YES]</p> <p>In case of simulator 'fileName.plist' is modified but in case of iphone device file remains unchanged. There is no exception seen either.</p> <p>Is the above code expected to work fine on both iphone and simulator ?</p> <p>Also in the debugger when I hover over 'mydata' I see different values in case of simulator and device. In case of simulator I see for example, '5 objects' but in case of actual device it shows '{(int)[$VAR count]}'. Could this be related to file not being written ?</p>
iphone
[8]
1,931,198
1,931,199
Practical use of sender & EventArgs in Page_Load
<p>I am on the verge migrating all my asp.net WebForms skills to asp.net mvc. So far, I never felt a need to use <code>EventArgs</code> and <code>sender</code> argument, passed to <code>Page_Load</code>. </p> <p>Can you please point me a couple of scenario, when you leverage theses parameters?</p>
asp.net
[9]
4,199,273
4,199,274
Generic DateTime List Comparison in C#
<p>I have a Generic DateTime List</p> <pre><code>List&lt;DateTime&gt; **PreviousDates** = //Some List of Dates </code></pre> <p>Now i want to Get all the Dates in the <strong>PreviousDates</strong> List whose Month and Year equals the GivenDate's Month &amp; Year. no matter what the Day &amp; Time are...</p> <p>I Tried using List.Contains() method, but it checks all Parts of the Date, i want to check only Month&amp;Year..</p> <p>Help Me!</p> <p>Thanks Pradeep</p>
c#
[0]
4,970,253
4,970,254
Does PHP mail only work in windows?
<p>Is there any reason PHP would only work in windows?</p> <p>I keep seeing 'windows only' in the documentation, but maybe I am confusing this with something else.</p> <p>If it does only work in windows, why? And if not, why does all the documentation mention 'windows only' so frequently?..</p>
php
[2]
3,501,793
3,501,794
Javascript function which does not return a value in every case
<p>If I have a javascript function, it is possible that I do not return a value from every code path, e.g:</p> <pre><code>function f() { if (checkSomething()) { return 42; } // no return statement here } </code></pre> <p>Is this valid javascript or does it only work by chance (i.e. might there be problems when run in some browsers)?</p>
javascript
[3]
2,102,501
2,102,502
add event once in jquery
<p><br/>How can I have something like this :</p> <pre><code>&lt;input class="myClass" id="a" type="checkbox" other="x"/&gt; &lt;input class="myClass" id="b" type="checkbox" other="x"/&gt; &lt;input class="myClass" id="c" type="checkbox" other="x"/&gt; &lt;input class="myClass" id="d" type="checkbox" other="y"/&gt; &lt;input class="myClass" id="e" type="checkbox" other="z"/&gt; </code></pre> <p>I can retrieve the element a to e, add a click event and I want to add an event on the element define in the attribut <code>other</code> (x, y and z).<br/> How can I do it?<br/> I try :</p> <pre><code>$(".myClass").each( function() { $("#" + $(this).attr("other")).click( function() { ... }); }); </code></pre> <p>But three elements have <code>other="x"</code> so the event is add three time on x and I want just one.</p>
jquery
[5]
5,481,247
5,481,248
Error when get value in javascript?
<p>I have a code js;</p> <pre><code>&lt;script type="text/javascript"&gt; init_test(500,100); document.write(init_test[0]); &lt;/script&gt; </code></pre> <p>but output is wrong, it is not result is 500. How to fix ?</p>
javascript
[3]
4,883,724
4,883,725
Is there a C# equivalent to the Java Selector class?
<p>Is there a C# equivalent to the Java Selector class? In the .Net framework or opensource.</p> <p>This is the <a href="http://doc.java.sun.com/DocWeb/api/java.nio.channels.Selector" rel="nofollow">java.nio.channels.Selector</a> class.</p> <p>Thanks</p>
c#
[0]
674,547
674,548
Chaining a constructor with an object function call in PHP
<p>Does anyone know if the following expression will be possible in the next version(s) of PHP?</p> <pre><code>(new A())-&gt;a(); // Causes a syntax error </code></pre> <p>I find very annoying that currently one must write 2 lines instead of 1:</p> <pre><code>$c = new A(); $c-&gt;a(); </code></pre>
php
[2]
3,958,158
3,958,159
Is it possible to resolve domain names to an IP address with PHP?
<p>Well, very simple question. So that's good news for you, I guess.</p> <p>More thorough explanation:</p> <p>I have a PHP script allowing me to add urls to a database. I want the script to resolve the url to an IP address as well, to store that, too. However, some of the URLs are like this:</p> <p><code>http://111.111.111.111/~example/index.php</code></p> <p>So it also needs to work with that.</p> <p>I'm not <strong>SURE</strong> that this is possible, but it only makes sense it would be.</p> <p>So: Is it possible, and if so, how?</p>
php
[2]
4,528,489
4,528,490
How to return the specific page in jQuery Datatables paging?
<p>I have a datable and "Edit" button in each row. When I click that button, /edit/ url opens. Everything is Ok until now. But if I need to go back to the datatable, it starts from the first page. What can I do for that?</p> <pre><code> $('#table').dataTable({ "sDom" : 'rtFip&gt;', 'fnDrawCallback' : function() { $('input:checkbox, input:radio').checkbox(); }, 'sPaginationType' : 'full_numbers', "bServerSide" : true, "sAjaxSource" : "{% url 'get_menu_list' %}" }); </code></pre>
jquery
[5]
3,323,040
3,323,041
Android: Specify String in different Package in Manifest
<p>Is it possible to specify that a @string value belongs to a different package via the Manifest?</p> <p>i.e. android:text="@string/my_logo_text"</p> <p>Implicitly specifies the value as belonging to the current package. Is there a way to fully qualify that this string belongs to another package?</p>
android
[4]