Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
1,410,678
1,410,679
Page Event and Clearing the Fields on a ASP.NET Web Form
<p>I know that asp.net is all about events , but I don't quite get how the events work. </p> <p>I have the requirement to build a web form that will submit and send an e-mail to a an specified email address with the <code>TextBox</code> and <code>CheckBox</code> values and some HTML on the email body. The issue I am having is that I need to:</p> <ol> <li>Make sure that the information is gone when the user goes back in the browser or refresh the page.</li> <li>I need to also let the user print a page with all form filled out, before reaching the second page, (confirmation) and after the validation was successful. Currently I have an event <code>OnClientClick</code> on the submit button and that calls window.print function, but what I really want is to print after the page is submited. and before the confirmation open. On top of my head I only can think on having all information passed to a intermediate second page , and then on the Page Loading Event on the third page print .. </li> </ol>
asp.net
[9]
1,765,068
1,765,069
What options exist to update Android app setting remotely?
<p>I have an Android device that I'm using to monitor a couple of sensors with an app that I created. What useful ways are there to update the settings in my app (while it's running at a remote location) from my computer? I'm interested in sending a message to my app to tell it to email a screenshot, change sample rate, etc. Creative workarounds are encouraged.</p> <p>I've already looked into C2DM and unfortunately have no experience with setting up the required third-party application server.</p>
android
[4]
1,036,540
1,036,541
iPhone Difference between [(id)Object class] and object_getClassName(id Object)
<p>can someone tell me what the difference is between [(id)Object class] and object_getClassName(id Object) and when and why you would prefer one over the other?</p>
iphone
[8]
2,797,659
2,797,660
How to get dropdown selected value in render control of repeatercontrol in c#
<p>I am doing a c# web app.I have a repeater control.A drop down is placed in the repeater control.i want to mail what ever is there in the repeater control.so i am using repeatercontrol.rendercontrol.but i am getting dropdown as normal.i want the dropdown value which user selected in the mail.pls help.</p>
c#
[0]
2,856,198
2,856,199
Beginner: SDK manager fails, Eclipse fails to load ADT
<p>I can run the emulator from the command prompt and start it from the desktop (Win7 32-bit) using a batch file, but it doesn't run from the SDK Manager.</p> <p>Also, I have installed Eclipse, but when I try to load the ADT Plugin, it seems to run then I get</p> <p>"Cannot complete install because one or more required items cannot be found"</p> <p>I've tried changing https to http. No difference. If I cancel any of the ticks beside the list of 4 installation components, the "Next" box is no longer greyed out.</p> <p>Any clues as to what I'm doing wrong?</p>
android
[4]
3,188,242
3,188,243
How to secure the Javascript Code?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1660060/how-to-prevent-your-javascripts-being-stolen-copied-and-viewed">how to prevent your javascripts being stolen,copied, and viewed ?</a> </p> </blockquote> <p>Hi</p> <p>What is the best way to secure the javascript code &amp; make it hard to understand it and for sure steal it... I know that its impossible to secure it 100% since its client side and all the code the client can see it.. But I need to make it as hard as possible...</p> <p>thanks alot Guys.. </p> <p>//----------------------------- Added ------------------------</p> <p><strong>there is a site that used a new way to secure the javascript code using the regular expression.. is there is a way to see the code easily ?? is it safe to do that method?? and how to do it, if its hard to do it?? <a href="http://samy.pl/" rel="nofollow">http://samy.pl/</a></strong></p>
javascript
[3]
4,933,314
4,933,315
Android ActionBar Tab Color
<p>I have added ActionBar tabs to my application. Default color for that underline is light blue. How do I change that color or style for selected tab ?</p>
android
[4]
3,990,101
3,990,102
What is Rage Shake api used in Facebook and Google + like application,Can i use same api in my application?
<p>I recently found this article about Rage Shake which is secret bug reporting tool that facebook used to logs it's bug and get report of it.</p> <p>So my question is Can i used that Rage Shake API in my android application. I can not find any APi available like that.If you have some then share with me.</p> <p>What exact Rage Shake Api do in Facebook ? I read from this Site <a href="http://techcrunch.com/2012/11/24/facebook-droidfooding/" rel="nofollow">Facebook Droid fooding </a> that Rage Shake used to log application state when device shake .</p>
android
[4]
959,444
959,445
Why calendar.getActualMaximum(Calendar.DAY_OF_MONTH) return 31 instead of 30?
<p>Why I'm getting 31 instead of 3? Now December, so previous of Nov = 30.</p> <pre><code>Calendar calendarPreviousMonth = Calendar.getInstance(); calendarPreviousMonth.add(Calendar.MONTH, calendarCurrent.get(Calendar.MONTH) - 1); System.out.println("Amount of days in month " + calendarPreviousMonth.getActualMaximum(Calendar.DAY_OF_MONTH)); </code></pre> <p>Thank you!</p>
java
[1]
5,993,799
5,993,800
Redirection on the last Slideshow-Element with Jquery
<p>I'm very new to Jquery and want to realize a manual slideshow with a page-redirect on the last "next"-button.</p> <p>I detect the last Slide-Element with CSS-Classes and then I want to add a Class to the next button to declare that it is the last next-button of the whole Slideshow.</p> <p>The half of my Code works :) – If I navigate to the last Slide-Element, Jquery adds the Class "last" to the button and if I click on the button with this Class, I'm redirected to the next page – that's what I want. But if I navigate to the last Slide-Element, then click a few times the "prev"-button and then again the next button, I'm instantly redirected although the Class "last" was removed.</p> <p>Thanks in advance and sorry for my bad english.</p> <p>Here's my Code:</p> <pre><code>$(document).ready(function(){ $("#image_nav a:first").attr('id', 'firstSlide'); $("#image_nav a:last").attr('id', 'lastSlide'); $(".dritte_ebene li:first").attr('id', 'firstNavi'); $(".dritte_ebene li:last").attr('id', 'lastNavi'); //Redirect to the next page $("a").click(function(){ if ($("#lastSlide").hasClass("activeSlide")) { $("#weiter").addClass("last"); $('.slide').cycle('pause'); $(".last").click(function(){ window.location.replace("[+PJN_next+]"); }); } }); //Remove "last" if prev is clicked $('#zurueck').click(function(){ $("#weiter").removeClass("last"); }); }); </code></pre>
jquery
[5]
2,182,585
2,182,586
which is better to get the contents of a web page
<p>To get the contents of a web page which is better: 1) To use Curl 2) file_get_contents 3)Any thing better than the above two.</p> <p>Thanks for answers in advance</p>
php
[2]
2,872,346
2,872,347
jQuery append()/appendTo()/html() cause to fire javascript inside DOM
<p>I am working with some legacy software which generates HTML and I need to do some manipulation with this HTML. In order to do so I want to clone all body content to variable and work on it in order to not change anything in browser window. Like this:</p> <pre><code>var tmp = jQuery("body").contents(); </code></pre> <p>Then I try to do some modifications with <em>tmp</em> variable:</p> <pre><code>tmp.wrap("&lt;span&gt;&lt;/span&gt;"); </code></pre> <p>The problem is HTML has &lt;style&gt; and &lt;script&gt; tags in the &lt;body&gt; and it looks like JavaScript fires up when I try to append <em>tmp</em> somewhere, or do wrapping. I'd like to know if there is a way to do $.append, $.appendTo without firing javascript inside of it? (except, filtering actual HTML and removing all &lt;script&gt; tags)</p>
jquery
[5]
123,656
123,657
CleanCalendar In JQuery
<p>I m Using a calendar.js file to implement calendar in my App. Actually this calendar .js has a line which accepts the classname and Div id name of my app.</p> <p>In my App i m having these lines</p> <pre><code> &lt;input type="text" class="calendarSelectDate" /&gt; &lt;div id="calendarDiv"&gt;&lt;/div&gt; </code></pre> <p>When i click this textbox it will generate the calendar inthe DIv tag..</p> <p>..But if i created a input tag and Div tag of my own using JQuery</p> <p>$(" 1").appendTo("#hold1"); $("").appendTo("#hold1"); and use the same Class, The calendar is not generated....Suggest ME</p>
jquery
[5]
560,933
560,934
confused when to use addslashes and when to use htmlentities
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="http://stackoverflow.com/questions/2214244/htmlentities-vs-addslashes-vs-mysqli-real-escape-string">Htmlentities vs addslashes vs mysqli_real_escape_string</a><br> <a href="http://stackoverflow.com/questions/5770912/when-to-use-which-string-escaping-method">When to use which string escaping method?</a> </p> </blockquote> <p>Hi, I get very confused when to use addslashes and when to use htmlentities. </p> <p>can you please tell me a example where in i should use addslashes and when to use htmlentities.</p>
php
[2]
1,524,877
1,524,878
What does "Return false;" in onclick event for JavaScript mean?
<p>What does "Return false;" in onclick event for JavaScript mean?</p> <pre><code> &lt;input type="button" runat="server" id="btnCancel" value=" Cancel " style="width:70px;" onclick="document.location.href = 'ReportPanel.aspx'; return false;" /&gt; </code></pre> <p>in the onclick event. It has <code>return false;</code> What does it mean? What does it mean if <code>return true;</code>?</p>
javascript
[3]
5,690,444
5,690,445
Photo: wrap_content, but max_width = layout width
<p>I have a normal "read an article" type page with a single large photo at the top.</p> <p>I'd like it to:</p> <ul> <li>not scale larger than the source imgae</li> <li>not be larger than the screen</li> <li>not be CRAZY long vertically</li> <li>side things I already have working <ul> <li>border (via padding), center crop (would rather top crop, but seems not avail)</li> </ul></li> </ul> <p>The main issue I'm having is - I can either have it fill_parent (ie full width) OR wrap_content (ie as large as the original image). And nothing I have done so far allows the image to be normal size (ie keep from enlarging).</p> <p>Is there a "norm" for this kind of thing? I'm sure there's some kind of sweet spot or combination of attributes for this that works - I just can't find them.</p> <p>My current attempt:</p> <pre><code> &lt;ImageView android:id="@+id/article_photo" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@color/super_light_gray" android:scaleType="centerCrop" android:contentDescription="@string/articlePhoto" android:cropToPadding="true" android:layout_marginBottom="20dp" android:padding="1dp"/&gt; </code></pre>
android
[4]
3,327,382
3,327,383
Implement cut, copy paste in uiwebview
<p>I am implementing a text editor using uiwebview for ipad. I am using a simple javascript to Bold Italics and Underline the text. </p> <p><code>[webView stringByEvaluatingJavaScriptFromString:@"document.execCommand(\"Bold\")"];</code></p> <p>The above code is using for making the text bold. </p> <p>Now I want to implement cut, copy and paste as well. I am using this code for cut copy and paste.</p> <p><code>[webView stringByEvaluatingJavaScriptFromString:@"document.execCommand(\"Cut\")"]; [webView stringByEvaluatingJavaScriptFromString:@"document.execCommand(\"Copy\")"]; [webView stringByEvaluatingJavaScriptFromString:@"document.execCommand(\"Paste\")"]; </code> But its not working. Am I using the wrong command parameter or is there any way to implement it? I understand there is a popup menu which gives all these features but I want to disable this popup menu and want to used of my own.</p> <p>Thanks</p>
iphone
[8]
3,662,725
3,662,726
referencing List preferences in email subject
<pre><code>private void submit() { SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); String listprefs = SP.getString("listprefs","1"); Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); String[] recipients = new String[]{""}; emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, recipients); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, ); </code></pre> <p>I am not sure if this is even possible, but I am needing to have the value that is selected in the list preference to show in the subject of an email. This is part of the code for the submit function of the app. </p> <p>It works fine the way it is, but I am needing what the user selects to show in the <code>emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT</code> line so it will auto populate when the email is generated. </p> <p>I have tried just about everything I can find on here and through other searches and have not had any luck.</p>
android
[4]
5,709,408
5,709,409
How to return 1 of many possibilities from method
<p>I have a login procedure, which can result in multiple results: </p> <ul> <li>User not activated</li> <li>Unknown username</li> <li>Invalid password</li> <li>Valid password</li> </ul> <p>I'm thinking about how I would design the method. I see these options</p> <ul> <li><p>One method for each possibility (like IsUserActivated, IsUsernameKnown..). This seems to violate "Tell don't ask" principle, I don't know I just don't like it.</p></li> <li><p>Throw custom exception for each possibility (like UserNotActivatedException, UserUnknownException..). This also seems wrong to me.</p></li> <li><p>Return custom ValidationResult class</p></li> <li><p>Return custom enum</p></li> </ul> <p>Ideas? :-)</p> <p>Also feel free to edit the subject (and tags)</p>
c#
[0]
5,325,899
5,325,900
problem in parsing a session id and passing id in url in android
<p>I am developing an android application.I have parsed the url.Now i want to find the value of session id which i got response after passing user name and password.Can anyone help</p> <p>Thanks in advance Tushar</p>
android
[4]
2,412,496
2,412,497
Best Python Tips for Beginners
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/70577/best-online-resource-to-learn-python">Best online resource to learn Python?</a> </p> </blockquote> <p>Great tutorials for Python Novice</p>
python
[7]
5,516,173
5,516,174
jQuery positioning and appending a div on mouse move
<p>Well i tried to do something like this :</p> <pre><code>var oldX=0,oldY=0; $('body').mousemove(function(e){ $('.movestatus').text('mouse moved'); var clientCoords = "( " + e.clientX + ", " + e.clientY + " )"; $(".chords").text(clientCoords); var ap = $("&lt;div class='k'&gt;&lt;/div&gt;"); ap.offset({ top: e.clientX, left: e.clientY }); $("body").append(ap); oldX = e.clientX; oldY = e.clientY; }); </code></pre> <p><a href="http://jsfiddle.net/kritya/nW53h/" rel="nofollow">Demo</a></p> <p>Well this works <strong>BUT</strong> the added div are added a lot below where the mouse actually is and also not added always.</p> <p>How can i fix this ?</p>
jquery
[5]
4,770,952
4,770,953
code to know wifi is enabled or not and bluetooth is on or not in iphone
<p>Can anybody tell me the code to know wifi is enabled or not and bluetooth is on or not in iphone.</p> <p>Thanks in advance.</p>
iphone
[8]
2,589,962
2,589,963
How to implement language translator facility in an iphone application?
<p>How to implement language translator facility in an iphone application ? I have found that for Online mode this works, using GOOGLE API :(for example)</p> <p><a href="http://ajax.googleapis.com/ajax/services/language/translate?q=nature&amp;v=1.0&amp;langpair=en%7Cja" rel="nofollow">http://ajax.googleapis.com/ajax/services/language/translate?q=nature&amp;v=1.0&amp;langpair=en%7Cja</a></p> <p>But how to perform language translation in offline mode ? Any open source API available.</p> <p>Is it allowed to use google translate API in iphone application ??</p> <p>(Languages : All languages which are supported by iPhone)</p>
iphone
[8]
2,086,407
2,086,408
GeoTagging Videos in Android
<p>In Android it is possible to add <code>Geolocation</code> (lat and long) information to a picture. Under <code>Camera</code> settings, there is an option for it.</p> <p>But for videos this is missing. Is there any other way to add <code>Geolocation</code> to video files?</p> <p>Is it possible to use the <code>ExifInterface</code> class's <a href="http://developer.android.com/reference/android/media/ExifInterface.html" rel="nofollow">setAttribute</a> method for this?</p> <p>Thanks In Advance, Perumal</p>
android
[4]
5,277,561
5,277,562
List of entries, how to add a new Entry?
<p>In Java, I am implementing this:</p> <pre><code>List&lt;Entry&lt;String, Integer&gt;&gt; listObjects = new ArrayList&lt;Entry&lt;String, Integer&gt;&gt;(); </code></pre> <p>but how can I add a new Entry?</p> <p>as it does not work with: <code>listObjects.add(new Entry&lt;"abc", 1&gt;());</code></p> <p>thanks in advance.</p>
java
[1]
712,367
712,368
Android provide call
<p>I am working on an Android application wherein when the user click on the phone call button then, the application provide itself to make call through skype or viber? I made the intent filter but how can I call through it? Is there any way to register my application in phone system that it provides call service ?</p> <pre><code> Intent in=new Intent(Intent.ACTION_DIAL, Uri.parse("tel:000")); startActivity(in); </code></pre> <p>thank you for answer</p>
android
[4]
4,347,738
4,347,739
jQuery: Convert numeric string in to some standard format
<p>Is there any jQuery plugin which convert numeric string into a standard format let say:</p> <pre><code>200000 to 2,00,000 1000 to 1,000 398740 to 3,987,40 </code></pre> <p>and so on..</p>
jquery
[5]
4,896,335
4,896,336
how to preserve filter values after opertion on grid
<p>I have some filter and one grid.And grid have some buttons like modify/edit.I am selecting some value from filters and getting some result in grid.now i want to modify some record.when i come again on grid data in filter should be remain same.</p> <p>There is two pages. one contain filters and grid second contain modify details.</p> <p>Thanks Pankaj Pareek.</p>
asp.net
[9]
3,277,186
3,277,187
Why are conditional statements not working in this example?
<p>I'm a bit perplexed with this code. <code>$this-&gt;product</code> is an Object with 12 vars. The var_dump indicates that <code>$key</code> is a string.</p> <pre><code>foreach ($this-&gt;product as $key =&gt; $val) { if (($key !== "id") || ($key !== "weight")) { var_dump($key); } else { print_r("Success" . $key); } } </code></pre> <p>Despite "id" and "weight" being present as var names and represented as strings within <code>$key</code> they are not caught with this conditional. Does anyone have any ideas?</p>
php
[2]
2,784,921
2,784,922
Open link after script is done with jquery
<p>I'm trying to make a jquery script that makes the page fade out before leaving it. can anyone help? </p>
jquery
[5]
3,710,421
3,710,422
The cookie value shows, but doesn't get logged in - WebView inject cookie
<p>I have trouble passing the cookie into the WebView inject. I know how to inject the cookie. When the cookie is injected I want to display a member.php and this page requires a cookie. It shows me the error page even if I've injected the cookie.</p> <p>The WebView are correctly loaded and I've tried to set a cookie using the CookieManager class. Alll this is known to me. </p> <p>From the CookieStore I have tried to print out the whole cookie itself; which prints this:</p> <pre><code>[[version: 0][name:SQMSESSID][value: 9166729532c975f261bda9e6e583bdba] [domain: mydomain.com][path: /][expiry: null], [version: 0][name: key] [value: vrckNRab][domain: mydomain.com][path: /][expiry: null]] </code></pre> <p>Should be mentioned that the code above is the successful CookieStore when I have passed my correct username and password.</p> <p>My inject + loadUrl code:</p> <pre><code>CookieStore cookie = /* CookieStore cookie takes a CookieStore from my own function that succesful returns the CookieStore */ List&lt;Cookie&gt; listcookie = cookie.getCookies(); //Set my CookieStore to a list Cookie setcookieOne = listcookie.get(0) //My cookie has two fields Cookie setcookieTwo = listcookie.get(1) //....and assign these to a cookie CookieManager cookieManager = CookieManager.getInstance(); CookieSyncManager.createInstance(getApplicationContext()); cookieManager.setAcceptCookie(true); cookieManager.setCookie(setcookieOne.getDomain(), setcookieOne.getValue()); cookieManager.setCookie(setcookieTwo.getDomain(), setcookieTwo.getValue()); CookieSyncManager.getInstance().sync(); browse.setWebViewClient(new WebViewClient(){ }); browse.loadUrl("http://mypagethatwillredirectmeonacorrectcookie.php"); /* This page will redirect if the cookie is successful */ </code></pre> <p>Any ideas why it doesn't show the member.php? </p>
android
[4]
3,563,969
3,563,970
Pinch Zoom out in Google Maps in Android?
<p>I am developing an application in Android in which I'm using google map using the Javascript V3 library with Phonegap. It works fine for me until I noticed that map is zooming in on touch event but couldn't able to zoom out when I tried for number of times.</p> <p>I'll appreciate if someone suggest me how I can get the pinch zoom in and out without using the default zoom controls of Google Maps?</p>
android
[4]
3,396,815
3,396,816
Parse GMT string to local
<p>I've a <code>date = 2011-04-17T22:02:00.001-07:00</code> that I'm parsing using SDF</p> <pre><code>SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); formatter.parse(date) </code></pre> <p>I It doesnt support -07:00 but -0700 works. What should change in the format?</p>
java
[1]
1,908,468
1,908,469
How to create a popup window inside the dialog box?
<p>I am creating one custom dialog box. It contains lot of folders and files. When click a Folders and/or Files to view the pop-up window inside the custom dialog box. How to create pop-up window inside the dialog box? I have no idea. If it is possible or not?</p>
android
[4]
3,495,315
3,495,316
in jQuery, set spans with same class to display:inline from :block
<p>Using jQuery, is there a way to select all tag that reference a specific css class, and set the display to "inline"?</p> <p>example:</p> <pre><code>&lt;span class="theclass"&gt;junk&lt;/span&gt; &lt;span class="theclass"&gt;other junk&lt;/span&gt; &lt;span class="theclass"&gt;more junk&lt;/span&gt; </code></pre> <p>in .css: </p> <pre><code>.theclass { display: none; } </code></pre>
jquery
[5]
456,491
456,492
Dialog with transparent background in Android
<p>I am facing a strange problem, how to remove black background from a dialog box in Android. The pic shows the problem. Please guide me to suitable solution.</p> <p><img src="http://i.stack.imgur.com/o3cat.png" alt="enter image description here"></p> <p>Thanks </p> <pre><code> final Dialog dialog = new Dialog(Screen1.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.themechanger); </code></pre>
android
[4]
1,674,495
1,674,496
Android development with Windows XP and no Android device
<p>Hi, I'm planning to learn android app development, but I don't have any Android device. Can I still learn it using my Windows machine?</p> <p>If so, how to check the output? And can any one suggest me a good tutorial for beginners.</p>
android
[4]
2,716,784
2,716,785
When must arbitrary precision arithmetic functions be used in PHP?
<p>My colleague uses the <a href="http://www.php.net/manual/en/ref.bc.php" rel="nofollow">Binary Calculator functions</a> in bandwidth calculations; as much as terrabytes, and with percentage splitting on allocation. His usage of these functions appears correct in order not to lose a byte; although he seems to be using them now for everything.</p> <p>The manual only says: </p> <blockquote> <p>For arbitrary precision mathematics PHP offers the Binary Calculator which supports numbers of any size and precision, represented as strings. </p> </blockquote> <p>How much is any size? Is it really necessary? How big is the default float in PHP? Are there any good advice regarding this or things to keep in mind?</p>
php
[2]
3,115,667
3,115,668
When trying to set an AlarmManager event, previous one is resetting with new time and the new one is not getting triggerred
<p>Here is my code which I tried, Steps.</p> <p>1) creating an AlarmManager event by calling AM.Set( ) method suppose with time X.</p> <p>2) creating another AlarmManager event suppose with time Y.</p> <p>Result = first event is triggered at time Y in place of time X. and second is not triggered at all.</p> <pre><code>AlarmManager AM =(AlarmManager)getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(); intent.setAction(Constants.ALARM_ACTION); intent.putExtra(Constants.EXTRA_DATA1, data[0]); intent.putExtra(Constants.EXTRA_DATA2, data[1]); long selectedTime = Long.parseLong(data[2]); PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, intent,0); AM.set(AlarmManager.RTC,selectedTime, pi); </code></pre> <p>Am I doing something wrong? I need to trigger all the events .</p>
android
[4]
2,876,630
2,876,631
Undefined offset: 3 error excel file upload and INSERT
<p>I am using below code to upload excel and INSERT in mysql in php</p> <pre><code>public function read_file($table = 'users', $filename = 'test.xls') { $this-&gt;load-&gt;library('Spreadsheet_Excel_Reader'); //$data = new Spreadsheet_Excel_Reader($pathToFile); $data = new Spreadsheet_Excel_Reader(); $data-&gt;read($filename); $sql = "INSERT INTO $table ("; for($index = 1;$index &lt;= $data-&gt;sheets[0]['numCols']; $index++){ $sql.= strtolower($data-&gt;sheets[0]['cells'][1][$index]) . ", "; } $valuesSQL = ''; $sql = rtrim($sql, ", ")." ) VALUES ( "; for ($i = 2; $i &lt;= $data-&gt;sheets[0]['numRows']; $i++) { for ($j = 1; $j &lt;= $data-&gt;sheets[0]['numCols']; $j++) { $valuesSQL .= "\"" . $data-&gt;sheets[0]['cells'][$i][$j] . "\""; if($j!=$data-&gt;sheets[0]['numCols']){ $valuesSQL .= ","; } } if($i!=$data-&gt;sheets[0]['numRows']){ $valuesSQL .= "),("; }else{ $valuesSQL .= ")"; } } $sqlQuery = $sql . rtrim($valuesSQL); return($sqlQuery ); } </code></pre> <p>I am getting below error</p> <pre><code>A PHP Error was encountered Severity: Notice Message: Undefined offset: 3 Filename: controllers/userInfo.php Line Number: 154 A PHP Error was encountered Severity: Notice Message: Undefined offset: 3 Filename: controllers/userInfo.php Line Number: 154 </code></pre> <p>I am using codeigniter php framework.</p> <p>line number 154 -> <code>$valuesSQL .= "\"" . $data-&gt;sheets[0]['cells'][$i][$j] . "\"";</code></p>
php
[2]
3,274,276
3,274,277
Enter data in EditText and respond without pressing enter
<p>I have an editText with a listener.</p> <pre><code>edittext.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) &amp;&amp; (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on key press return true; } return false; } }); </code></pre> <p>Now I want to use the data entered in the textBox by the user in my program without the user pressing enter. (If I remove <code>(keyCode == KeyEvent.KEYCODE_ENTER)</code> then the program hangs for some reason).</p> <p>What should I do to identify that the user has entered some character in the textbox?</p>
android
[4]
973,189
973,190
How to do visible EditText Data on Activity change
<p>HellO friends i am having edit text in my program and if i am writing some thing on there and if i am clciking on other option which will move to anothe activity and when i am coming back to same page the data of my edit text is clearing i dont want to clear data if i move on another page can any body tell me how to do it ..i am doing it by writing below code..</p> <pre><code> if(PresetQuestion.value=="true") { String note1=note.getText().toString(); note.setText(note1); } </code></pre> <p>but its not woring i thing i am not doing correctly ...</p>
android
[4]
5,525,221
5,525,222
Newbie : installing and upgrading python module
<p>I have downloaded and install a python library, via setup.py , python2.5 setup.py install ...</p> <p>now the version is changed at the source . a newer library is available. originally , i have clone it via mercurial, and install it. right now , i have updated repository. </p> <p>how do i use the newer version ? overwrite the installation ?</p> <p>by simply doing setup.py install again ?</p>
python
[7]
4,634,055
4,634,056
obtaining string from urlpath in NSString in ipnone apps
<p>Hi I am new to iphone development.</p> <p>I want to obtain string from url path For example, the relative path: 90-000000-General_Motors<br> i want to extract: General Motors<br> if path is 90-000000-General_Motors/5.jpg<br> i want to extract: 5</p> <p>How can i acheive using simple coding </p>
iphone
[8]
5,212,346
5,212,347
android get latitude and longitude on emulator of android
<p>hi iwant to check lat long of current position in android emulator how to achive this..??it is possible to get current position latitude and longitude on emulator???if yes then what setting is required in emulator?</p> <pre><code>@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); LocationListener ll = new Mylocationlistener(); boolean isGPS = lm .isProviderEnabled(LocationManager.GPS_PROVIDER); // If GPS is not enable then it will be on if(!isGPS) { Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE"); intent.putExtra("enabled", true); sendBroadcast(intent); } lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ll); } private class Mylocationlistener implements LocationListener { @Override public void onLocationChanged(Location location) { if (location != null) { Log.d("LOCATION CHANGED", location.getLatitude() + ""); Log.d("LOCATION CHANGED", location.getLongitude() + ""); float speed = location.getSpeed(); double altitude = location.getAltitude(); Toast.makeText(currentlatlong.this,"Latitude = "+ location.getLatitude() + "" +"Longitude = "+ location.getLongitude()+"Altitude = "+altitude+"Speed = "+speed, Toast.LENGTH_LONG).show(); } } @Override public void onProviderDisabled(String provider) { } @Override public void onProviderEnabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } } </code></pre>
android
[4]
5,119,064
5,119,065
How to retrieve files created by an android app?
<p>My android app creates an sqlite database and I need to get it off the device so I can look at the data with a database viewer. </p> <p>Was hoping I could just issue >adb shell and then go find it somewhere on the file system. Looks like there are permission issues with lots of commands. Even just running >find . -name *.sqlite gives permission denied.</p> <p>Can anyone advise on how to do this?</p>
android
[4]
2,739,884
2,739,885
Android Image comparision
<p>I am developing an application for comparing the wound images and point out how much centimeter the wound is cured ,Is it possible to do can anyone share your ideas as early as possible</p>
android
[4]
3,293,339
3,293,340
User is unable to enter the value of the string variable
<p>User is unable to enter the value of the string variable.</p> <p>This is the program: </p> <pre><code>import java.io.*; public class testing { char a; int b; double c; String d; public void method() throws IOException { BufferedReader p=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter a variable of type 'char'"); a = (char)p.read(); System.out.println("Enter a variable of type 'string'"); d = p.readLine(); System.out.println("Enter a variable of type 'integer'"); b = Integer.parseInt(p.readLine()); System.out.println("Enter a variable of type 'double'"); c = Double.parseDouble(p.readLine()); System.out.println("Your values are: string-" +d +", integer-" +b +", double-" +c); } } </code></pre> <p>Can someone see a problem?</p>
java
[1]
256,726
256,727
I need to show the panel on top of the drop down list.Panel is distorted because of dropdownlist
<p>I had dynamically created the drop down list and placed in the tablecell and based on the button click i need to show the panel on top of the drop down list. But I’m facing the problem that whenever I’m placing the panel on the top of the drop down list, the drop list control is getting displayed on top of the panel. Any help is appreciated.</p> <p>Note: I’m facing this problem only in IE6, remaining browsers is working fine (IE8, FF, and Chrome)</p> <p></p> <p> <p>width: 506px; height: 236px;"></p> <p></p> <p></p> <p> </p> <p></p> <p></p> <p></p> <p></p> <p> <p>OnClick="OkClicked" /></p> <p>&nbsp;</p> <p></p> <p></p> <p></p> <p><img src="http://i.stack.imgur.com/ggsys.gif" alt="enter image description here"></p>
asp.net
[9]
3,735,956
3,735,957
How can we Zoom a camera screen by programatically in iphone?
<p>Is this possible to Zoom the camera picture programatically ,i checked the APi provided by the apple for this but there is no API in the SDk for the zooming for the camera .There is only zooming functionality in the scroll view only ,is there any way by which we can do the zoom our camera view.</p> <p>Even some App on the appstore hve the zooming functionality ,than how it is possible .</p> <p>thanks for any suggestion </p> <p>Balraj verma</p>
iphone
[8]
1,991,189
1,991,190
Why won't this work? If selected item from list box is string then set different string as number
<p>Okay i'll probably get a lot of crap for this but I'm new. Why won't this work?</p> <pre><code> string serviceCode; string Next_Day_Air_Early_AM; string inserviceCode = listBox1.SelectedItem.ToString(); if (inserviceCode = Next_Day_Air_Early_AM) { serviceCode = 14.ToString(); } </code></pre>
c#
[0]
2,417,158
2,417,159
C# version of Flee?
<p><a href="http://flee.codeplex.com/" rel="nofollow">Flee</a> is really great, but are anyone aware of a C# port of it?</p> <p>I saw a mention of this in one of the answers to this question: <a href="http://stackoverflow.com/questions/12422338/compiling-c-sharp-on-the-fly">Compiling C# on the fly</a></p> <p>I would prefer c# to be able to handle possible issues that might arise myself.</p>
c#
[0]
1,052,722
1,052,723
How to enter a special character as a password character in C#
<p>How do I enter a unicode character (it needs to be the equivalent of ascii character 254, a solid square centered box) as the password character in a textbox?</p> <p>I need to do this in code, for example textbox.passwordchar = ????????</p> <p>Thanks,</p>
c#
[0]
825,775
825,776
What is this syntax: using "this" in property in C#?
<p>I happened to read this line of code:</p> <pre><code>public MyArray this [int index]{ get{ return array[index]; } } </code></pre> <p>Where can I find the document on msdn about the syntax of using "this" in property?</p> <p>And is there any book covers this kind of tricky syntax of C# other than the common stuff?</p>
c#
[0]
152,735
152,736
Looking for a slicker way of rebuilding this array
<p>I have a data result being returned from my database with multiple rows. The problem I'm having is that I only need a single row for some items and the multiple rows for others and without doing multiple database queries for every item that is needed, I thought I'd rebuild the data array.</p> <p>What I am ultimately after is to use each item in the array as a string. If the last two items, product and location have multiple rows then I need them returned as strings.</p> <p>What would be the best way to handle this?</p> <pre><code>Array ( [0] =&gt; Array ( [cid] =&gt; one line [model] =&gt; one line [mfgr] =&gt; one line [color] =&gt; one line [orderid] =&gt; one line [product] =&gt; many lines [location] =&gt; many lines ) [1] =&gt; Array ( .. repeats for as many rows as were found ) ) </code></pre> <hr> <p>Let me rephrase this question. The array that you see above is the array that is produced from my foreach. Array key [0] holds all of the data from my result. Array key[1] simply repeats the data. I need single rows for columns 1-5. Columns 6 &amp; 7 are where I need multiple rows, hence the repeating array keys.</p> <p>If I had to rebuild this array that way I need, it would look something like this:</p> <pre><code>Array ( [single] =&gt; Array ( [cid] =&gt; one line [model] =&gt; one line [mfgr] =&gt; one line [color] =&gt; one line [orderid] =&gt; one line [product] =&gt; Array ( [0] =&gt; many lines [1] =&gt; many lines ) [location] =&gt; Array ( [0] =&gt; many lines [1] =&gt; many lines ) ) ) </code></pre>
php
[2]
3,371,052
3,371,053
How to send arguments to a process that started before?
<p>how to send arguments to process that started before ?</p> <p>think we started process "Name.exe" before . and we know its process ID is X ;</p> <p>in order not to open a new process , I want to send argument to this process . How can I do this ?</p> <p>What is securest way . so I will find the date received from my application , not hackers .</p>
c#
[0]
277,480
277,481
Counted and Terminated String in Java
<blockquote> <p>Two methods of implementing a string. A counted string explicitly records its length. The terminated string’s length is determined by an end-of-string mark.</p> </blockquote> <p>Can anyone give an example of counted string and a terminated string in java. </p>
java
[1]
5,663,741
5,663,742
What does String [][] means in C#?
<p>EG. </p> <pre><code>String [ ][ ] LinesSplitByComma1 = File.ReadAllLines("Filepath").Select(s =&gt; s.Split(',')).ToArray(); </code></pre>
c#
[0]
4,098,865
4,098,866
Beginning PHP (loading DIV)
<p>I'm just diving into PHP and have been doing some reading and playing around - with my code below, I'm trying to load the pages (as you can see) - I'm getting parse error. Syntax error, unexpecter T_VARIABLE in index.php on line 7</p> <p>Line 7 on my index</p> <pre><code>&lt;?php include(''$id'') ?&gt; </code></pre> <p>I'm told is supposed to be for variables rather than ('$id')</p> <p>When I use ('$id') or ('$nav_menu') as is in the current coding, it gives me failed to open stream: No such file or directory</p> <p>I'm probably missing something blatantly obvious, but can someone point me in the right direction?</p> <p>Thanks</p> <pre><code>&lt;?php if (is_numeric($_GET['id'])) //prevent hacking { switch ($_GET['id']) //get the id of menu needed for this page { case 0: $nav_menu = "content.php"; //if the variable is 0 or not set break; case 1: $nav_menu = "bio.php"; //if the variable is 1, get category 1 links break; case 2: $nav_menu = "contact.php"; //if the variable is 2, get category 2 links break; default: $nav_menu = "content.php"; //redundant for defaulting if the id is greater than 2 } } ?&gt; </code></pre>
php
[2]
2,106,058
2,106,059
Ignore attributed and compare collections
<p>I want to compare 2 Collections using <code>CollectionUtils.isEqualCollection</code>. Before this, I need to remove or ignore one attribute of one object collection, this attribute needs to be ignored or deleted, because it is filled in only one collection.</p> <p>Anyone can help me?</p>
java
[1]
5,079,443
5,079,444
How to make an object that can fly, lay an egg, and do stuff (Inheritance)
<p>Im working on Inheritance right now in Java and this is the cod that I have that describes a bird</p> <pre><code>public class Bird { public void fly() { System.out.println("the Bird flies"); } public void layEgg() { System.out.println("The bird layed an egg"); } public void doStuff() { System.out.println("Doing some stuff..."); fly(); layEgg(); } } </code></pre> <p>this is my main class and how do I create a bird object that can fly, lay an egg, and do stuff.</p> <pre><code>public class Exploration { public static void main(String[] args) { ???? } } </code></pre>
java
[1]
2,983,444
2,983,445
Parsing input from user in any order or format
<p>I am having some trouble trying to figure out how to parse information collected from user. The information I am collecting is:</p> <ul> <li>Age</li> <li>Sex</li> <li>Zip Code</li> </ul> <p>Following are some examples of how I may receive this from users:</p> <ul> <li>30 Male 90250</li> <li>30/M/90250</li> <li>30 M 90250</li> <li>M 30 90250</li> <li>30-M-90250</li> <li>90250,M,30</li> </ul> <p>I started off with explode function but I was left with a huge list of if else statements to try to see how the user separated the information (was it space or comma or slash or hypen)</p> <p>Any feedback is appreciated.</p> <p>Thanks</p>
php
[2]
5,245,031
5,245,032
Link to a page then execute a Javascript request
<p>Does anyone know if it is possible to link to a page using href and then calling a javascript function?</p> <p>Ex: href="http://www.mywebsite.com/Details.aspx?javascript:__doPostBack('INFO','')</p> <p>How would I go about this?</p> <p>Thanks for your help!</p>
javascript
[3]
1,632,998
1,632,999
Java DateFormat: most convenient & elegant way to validate input date against multiple patterns
<p>I'm doing like that now:</p> <pre><code>...... DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy"); try{ dateFormat.parse(criteria.getPeriodFrom()); dateFormat.parse(criteria.getPeriodTo()); } catch{ errors.reject("Incorrect format"); } ...... </code></pre> <p>But what if I need to validate against few acceptable patterns (ex. "dd.MM.yyyy", "ddMMyyyy" ....). And I don't want to do any copy&amp;paste or iterate through collection of DateFormats :) Are there cool libraries for that?</p>
java
[1]
3,067,379
3,067,380
Deleting line breaks in a text file with a condition
<p>I have a text file. Some of the lines in it end with lf and some end with crlf. I only need to delete lfs and leave all crlfs.</p> <p>Basically, my file looks like this</p> <blockquote> <p>Mary had a lf</p> <p>dog.crlf</p> <p>She liked her lf</p> <p>dog very much. crlf</p> </blockquote> <p>I need it to be</p> <blockquote> <p>Mary had a dog.crlf</p> <p>She liked her dog very much.crlf</p> </blockquote> <p>Now, I tried just deleting all lfs unconditionally, but then I couldn't figure out how to write it back into the text file. If I use File.WriteAllLines and put a string array into it, it automatically creates line breaks all over again. If I use File.WriteAllText, it just forms one single line. So the question is - how do I take a text file like the first and make it look like the second? Thank you very much for your time. BTW, I checked similar questions, but still have trouble figuring it out.</p>
c#
[0]
6,031,047
6,031,048
(Closed) Android phone, changing settings that aren't user settings
<p>Edit: Thanks, been pointed to the correct stackoverflow.</p> <p>I've moved to Android and my phone, an LG P920, makes sounds when you turn it on and off. You can't configure these, but I assume I can if I root it and use some ... other ... software. I don't know what "other" means in this context yet.</p> <p>Here's the problem. I don't know how to root it. Google hasn't helped so much, the noise to signal ratio is awful. Even if I manage the rooting, I don't know where I'd find software to do what I want, or even if I've got that bit right.</p> <p>Bonus question. I actually picked it up to play with Android development. Will there be any benefit to rooting my device to development tasks? </p> <p>Thanks</p>
android
[4]
1,967,329
1,967,330
python: append only specific elements from a list
<p>i have a list of a list:</p> <pre><code>b=[[1,2,3],[4,5,6],[7,8,9]] </code></pre> <p>i have a list:</p> <pre><code>row = [1,2,3] </code></pre> <p>how do i append to <code>b</code> only <code>row[0]</code> and <code>'3847'</code> and <code>row[2]</code> such that <code>b</code> will equal:</p> <pre><code>b=[[1,2,3],[4,5,6],[7,8,9],[1,3847,3]] </code></pre>
python
[7]
3,342,351
3,342,352
initialize an array with dummy values
<pre><code> while ($row = mysql_fetch_object($result)) { $data[] = $row; echo "&lt;div id='captionbox' style='width: 110px;float:left;color:#FFF;text-align:center;'&gt;"; echo "&lt;a href='#' class='thumb'&gt;&lt;img class='thumb-img' value = ".$row-&gt;aid." onclick='getVote(".$row-&gt;aid.", \"".$row-&gt;atitle."\")' src='images/roadies/th".$row-&gt;aid.".jpg' /&gt; &lt;/a&gt;"; echo "&lt;input type = hidden name = aid id = rd".$row-&gt;aid." value = ".$row-&gt;aid."&gt;".$row-&gt;atitle."&lt;/input&gt;"; echo "&lt;/div&gt;"; } $jsfriend = json_encode($data); </code></pre> <p>In the above PHP code, I am adding the mysql rows into an array $data. then i am making a JSON object from that array. before I come into the while loop I want to create the array $data and initialize the $data[0] pointer with dummy values as I do not want to use the [0] pointer values. can this be done?</p> <p>I hope I am making sense. </p>
php
[2]
4,311,711
4,311,712
Can you help me understand this php script
<p>I'm a fairly newbie php coder, got this php code in a tutorial to create a randomly generated quote, but I don't fully understand the code</p> <p>IN particular, I don't understand </p> <p>a) line 4 -- where does the "rows" come from. Is that a name made up on the spot. Could it just as easily have been called "ferrari"</p> <p>b) line 9 -- where does "storedtext" come from? is it just made up on the spot? </p> <p>c) based on the code, do you have an idea what the database is supposed to look like. Would it just be a database called "text" with a table called "quotables" in it? </p> <pre><code> &lt;? // // count() gets the number of rows from database text-- //it assigns a number to rowcount 1 $rowcount = mysql_query("select count() as rows from text"); // don't understand what exactly is happening here, where did "rows" come from 2 while ($row = mysql_fetch_assoc($rowcount)) 3 { 4 $max = $row["rows"]; 5 } // Selects an item's index at random 6 $rand = rand(1,$max)-1; //there is a database table called "quotables?" taking one random row 7 $result = mysql_query("select from quotables limit $rand, 1"); 8 $row = mysql_fetch_array($result); //where does "storedText" come from????? 9 $randomOutput = $row['storedText']; 10 echo '&lt;p&gt;' . $randomOutput . '&lt;/p&gt;'; 11 ?&gt; </code></pre>
php
[2]
5,673,746
5,673,747
Accessing classes from other apk
<p>I would like to know if it is possible to access directly a class in an apk from another apk.</p> <p>By example, in the notepad tutorial, an activity is launched by these lines of code:<pre><code> Intent i = new Intent(this, NoteEdit.class); startActivityForResult(i, ACTIVITY_CREATE); </pre></code> This code accesses directly NoteEdit.class. But in this tutorial, the class containing this code and the NoteEdit class are in the same apk. I would like to know if the same constructor for an intent could be use if the activity is in another apk.</p> <p>System classes are, off course, accessible, but they seem to be in a jar file, android.jar. So there seems to be a way to access directly classes inside jar files, I would like to know if there is a way to access direclty classes in other apk.</p>
android
[4]
5,603,497
5,603,498
java: resetting program by pressing space key on keyboard
<p>I am creating a humas vs. zombies program on java. I need to be able to reset the program (regenerate buildings, only one zombie and the humans) in other words rerun it. How can I do that by just pressing the space key on the keyboard?</p>
java
[1]
960,333
960,334
created tooltips with jquery not working
<p>i am have create a tooltip for somwe divs but the div donot work.can any help me to find out where the problem my be.but i donot know if the new p created takes a position depending on the main div .because i floated all my div to the the left. thanks</p> <pre><code>$('div#myiris').tooltip({ track: true, delay: 0, showURL: false, //showBody: "- ", //fade: 250, bodyHandler: function(){ return $('&lt;p&gt;&lt;/p&gt;').html('hello there').css({border:'1px solid black', width:'70px', height:'20px',display:'block',color:'blue'}); } }); </code></pre>
jquery
[5]
5,904,543
5,904,544
$_SERVER["REMOTE_ADDR"] gives server IP rather than visitor IP
<p>I'm trying to track IP addresses of visitors. When using <code>$_SERVER["REMOTE_ADDR"]</code>, I get the server's IP address rather than the visitor's. I tried this on multiple machines at multiple locations and they all resulted in the exact same IP. Is there some PHP/server settings that could be affecting this?</p>
php
[2]
5,067,553
5,067,554
how to Apply Master Pages By Folder in web.config
<p>I have folder called Email which contains 20 aspx pages I am trying to apply master page to this email folder through web.config</p> <p>i Got following error The relative virtual path 'MasterPage.Master' is not allowed here.</p> <p>code in web.config</p> <p> </p> <p>Please help in this issue</p>
asp.net
[9]
5,590,013
5,590,014
Class cast exception from Double to double
<p>Why class cast exception from Double to double?</p> <p>Used like:</p> <pre><code>Console.writeLine(Validator.TryParse("1.5", double.class)); </code></pre> <p>Code:</p> <pre><code>public static &lt;T&gt; T TryParse(Object ConvertFrom, java.lang.Class&lt;T&gt; ConvertTo) { switch(ConvertTo.getSimpleName().toLowerCase()) { case "int": case "integer": return ConvertTo.cast((int)Integer.parseInt((String)ConvertFrom)); case "string": return ConvertTo.cast(String.valueOf(ConvertFrom)); case "double": return ConvertTo.cast((double)Double.parseDouble((String)ConvertFrom)); case "float": return ConvertTo.cast((float)Float.parseFloat((String)ConvertFrom)); case "long": return ConvertTo.cast((long)Long.parseLong((String)ConvertFrom)); default: return null; } } </code></pre>
java
[1]
49,429
49,430
why cerr flushes the buffer of cout
<pre><code>#include &lt;iostream&gt; using std::cout; using std::endl; using std::cerr; #include &lt;cstdio&gt; int main( ) { char pbuffer[BUFSIZ]; setbuf(stdout, pbuffer); cout &lt;&lt; "hello cout" ; sleep(5); cerr &lt;&lt; "hello cerr"; sleep(5); cout &lt;&lt; "\nAll done " &lt;&lt; endl; sleep(5); return 0; } </code></pre> <p>after I compile and run the program above, it's output is :</p> <pre><code>hello couthello cerr All done </code></pre> <p>but I think it should be:</p> <pre><code>hello cerrhello cout All done </code></pre> <p>I want to know, why <code>cerr</code> flushes the buffer of <code>cout</code> ?</p>
c++
[6]
4,125,060
4,125,061
sorting vector of strings in c++ according to index in the string
<p>Hi I have vector of strings,that is the structure of vector : The name of vector is vector</p> <pre><code>"key: abc 165.123.34.12", "key: bca 1.1.1.1", "key1: bac 3.3.3.3" </code></pre> <p>I want to sort the vector according to the second field(abc,bac,bac)</p> <p>My code is;</p> <pre><code> bool sort_function(string&amp; str1,string&amp; str2) { string nick1,nick2,nick1_ignore,nick2_ignore; stringstream ss1(str1) ss1&gt;&gt; nick1_ignore &gt;&gt; nick1; stringstream ss2(str2) ss2&gt;&gt; nick2_ignore &gt;&gt; nick2; return (nick1&lt;nick2); } sort(vector.begin(), vector.end(),sort_function); </code></pre> <p>But it gives a long error starting with error,</p> <pre><code> error: no match for ‘operator&gt;&gt;’ in ‘std::basic_stringstream&lt;char&gt; </code></pre> <p>UPDATE:Error is tl_algo.h: In function ‘_RandomAccessIterator std:..</p> <p>UPDATE:It is fixed. the error is in function declaration I have to use const string</p>
c++
[6]
5,798,400
5,798,401
Is construction of static function-scope object thread-safe?
<p>Suppose I have a function that tries to protect a global counter using this code:</p> <pre><code> static MyCriticalSectionWrapper lock; lock.Enter(); counter = ++m_counter; lock.Leave(); </code></pre> <p>IS there a chance that two threads will invoke the <code>lock</code>'s constructor? What is the safe way to achieve this goal?</p>
c++
[6]
4,460,655
4,460,656
Update left property while dragging
<p>I want to update the <code>left</code> property of a <code>ul</code> while dragging, but it just jumps to -1980 as soon as I start dragging.</p> <pre><code>$('#draggable').on('drag', function() { var start = 0; var end = 2000; while (start &lt;= end) { $('ul').css('left', -start); start+=20; } }); </code></pre> <p><a href="http://jsfiddle.net/EKp2H/" rel="nofollow">FIDDLE</a></p>
jquery
[5]
5,438,086
5,438,087
PHP Strip between 2 points
<p>This is really simple problem but I still seem to be stuck on it.</p> <p>I'm looking to grab the filename and extension from this string:</p> <pre><code>/customscripts/systemfunctions/showimage.asp?img=109(14).JPG&amp;folder=listingpics/220/138/&amp;maxW=200&amp;maxH=120 </code></pre> <p>What I'm looking to grab is the "<strong>img=109(14).JPG</strong>"</p> <p>Possibly using a preg_replace or something.</p> <p>Anyway, any help would be appreciated.</p> <p>Thanks!</p>
php
[2]
1,453,139
1,453,140
asp.net regular exprssion Max char with not in condition
<p>I have my regular expression as ValidationExpression="^[^&lt;>]<em>$" I want to add number of char it will accept. say for example i want to limit my textbox(multiline) length to 200. how to achieve. I tried ValidationExpression="^[^&lt;>]</em>{0, 200}$" but its not working. what is the solution></p>
asp.net
[9]
2,210,604
2,210,605
Need to Learn javaScript form validation!
<p>i want to learn a bit about javaScript form validation(coding and as well as theory).Can you give me the links for the tutorials(apart from w3schools). And make sure that i dont to learn in depth, because i need to learn this for exam purposes only, not for my feature use.</p>
javascript
[3]
2,071,114
2,071,115
How to run a PHP function concurrently against an array?
<p>I have a PHP web app which scrapes a search engine for a given keyword.</p> <p>Currently the app is looping through an array of keywords running the scrape function one keyword at a time.</p> <p>This is OK at the moment because the number of keywords is fairly small, but it won't scale well.</p> <p>I think the best way to go will be to select a smaller set of keywords from the mysql db using limit, and then run the scrape function concurrently against the entire array. Once that set has finished, I'll move on to the next set.</p> <p>But I'm stuck with how to run the function concurrently against the array.</p> <p>How would you handle this?</p>
php
[2]
2,274,597
2,274,598
Building of an sqlite database outside an android project?
<p>I'd like to create a project which generates a sqlite database, which will eventually be used by an android application. I'd like to create this project as a standard java application, so I can hook it up to a build script etc. What's a good way to go about doing this, so that the sqlite database I output is conformant with the way android sqlite classes expect to have it in?</p> <p>I could create this util project as an android project, and then I have access to all the sqlite classes, but the output sqlite file would live on an emulator instance, right? And I'd have to fire up an emulator etc whenever I wanted to run the util, ugh.</p> <p>Thanks</p>
android
[4]
2,611,988
2,611,989
compile time assertions *across modules* / c,c++
<p>recently i discovered in a relatively large project, that ugly runtime crashes occurred because various headers were included in different order in different cpp files.</p> <p>These headers included #pragma pack - and these pragmas were sometimes not 'closed' ( i mean, set back to the compiler default #pragma pack() ) - resulting in different object layouts in different object files. No wonder the application crashed when it accessed struct members being created in one module and passed to another module. Or derived classes accessing members from base classes.</p> <p>Since i like the idea to create a more general debugging and assertion strategy from every bug i find, i would really like to assert that object layouts are always and everywhere the same.</p> <p>So it would be easy to assert </p> <p>ASSERT( offsetof(membervar) == 4 )</p> <p>But this would not catch a different layout in another module - or require manual updates whenever the struct layout changes .. so my favourite idea would be something like</p> <p>ASSERT( offsetof(membervar) == offsetof(othermodule_membervar) )</p> <p>Would this be possible with an assertion? Or is this a case for a unit test?</p> <p>Thanks, H</p>
c++
[6]
3,911,633
3,911,634
How can I find an element by passing in a variable in jQuery?
<p>I tried the following and it works:</p> <pre><code>$('#row_').remove(); </code></pre> <p>However now I would like to make it depend on the value of a variable. For example if the number of the row is contained in the variable id:</p> <pre><code>var id = 4; $('#row_').remove(); </code></pre> <p>How can I make it so the above looks for row 4 by using the id variable?</p>
jquery
[5]
5,517,761
5,517,762
My LINQ sort does not seem to be sorting the way I asked it to
<p>I have this code:</p> <pre><code>var query = _cityRepository.GetAll( u =&gt; u.PartitionKey == pk &amp; u.RowKey.CompareTo(lowerBound) &gt;= 0 &amp; u.RowKey.CompareTo(upperBound) &lt; 0) .OrderBy(item =&gt; item.RowKey.Substring(0, 3)) .ThenBy(item =&gt; item.ShortTitle) .Select((t, index) =&gt; new City.Grid() { PartitionKey = t.PartitionKey, RowKey = t.RowKey, Row = index + 1, ShortTitle = t.ShortTitle, Created = t.Created, CreatedBy = t.CreatedBy, Modified = t.Modified, ModifiedBy = t.ModifiedBy }) .ToList(); </code></pre> <p>When I look at the data coming out I find this for the first two rows:</p> <pre><code>RowKey = 0101004O , ShortTitle = "Access 1" RowKey = 0103004M , ShortTitle = "Access 2" RowKey = 0101004K , ShortTitle = "xxx" </code></pre> <p>When testing I simplified this to:</p> <pre><code> var query1 = _cityRepository.GetAll() .OrderBy(item =&gt; item.RowKey.Substring(0, 3)) .ThenBy(item =&gt; item.ShortTitle); </code></pre> <p>and the order is the same. Still the RowKey does not seem to be in the right order. </p> <p>It is supposed to sort on the first four characters of the rowkey and then on the ShortTitle. </p> <p>Can anyone see why this is not working. I have looked hard but I can't see why the OrderBy and ThenBy doesn't seem to work correctly.</p>
c#
[0]
5,567,686
5,567,687
How to generate a UUID in this format?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2040240/php-function-to-generate-v4-uuid">PHP function to generate v4 UUID</a> </p> </blockquote> <p>I've been looking all over the web for this. Im trying to make a UUID which will appear in this format: 32321-65631-43546-54542 (the numbers of course, will vary) I know how to make a uniqid id, but dont know where to start with this. Anybody know how this can be accomplished?</p>
php
[2]
5,416,479
5,416,480
Limit words of string - UTF8
<p>Can you explain me how to display let`s say first 10 words of string which contains of 20 words. I have a function which deals good with non utf8 letters, but how to do that with utf8 letters ?</p>
php
[2]
4,964,183
4,964,184
android-http-image-manager response?
<p>I am using this library called android-HTTP-image-manager, i have successfully implemented the caching, how would i get response for that as i have a progress bar which i have to make invisible. </p> <pre><code> bitmap = getHttpImageManager().loadImage(new HttpImageManager.LoadRequest(Uri.parse(myFileUrl), imageview)); @Override protected void onPostExecute(Void result) { try{ if (bp != null) { imageview.setImageBitmap(bp); progressBar1.setVisibility(View.GONE); } } </code></pre> <p>Thanks</p>
android
[4]
2,256,543
2,256,544
Code to record from webcam or default video and audio devices in asp.net?
<p>I want to record video and audio, from the user's system using asp.net and save on the server.</p> <p>Is there any simple solution?</p>
asp.net
[9]
5,141,240
5,141,241
dropdown list in user control and auto postback after new item selected
<p>I have a dropdown list in User Control</p> <p>How Can I get selected value of dropdown list of user control in page when user select another item (auto postback is true)?</p> <p>I tried to store selected value of ddl in a public member from Selected Index Changed event handler. But this handler executes after page load of container page. I need to load data in page based on selected value in ddl of user control. </p> <p>Thanks</p> <p>User Control's code</p> <pre><code>protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) { _SelectedPageSize = Convert.ToInt32(ddlPageSize.SelectedValue); } int GetSelectedPageSize() { return _SelectedPageSize; } </code></pre>
asp.net
[9]
3,332,410
3,332,411
I'm new in programming with C#
<p>How can I start with C#</p>
c#
[0]
4,533,494
4,533,495
DownladAsyncFile checking the file download completion
<p>Is there any way to know which file has just now finished downloading from the DownloadFileCompleted event of WebClient.</p> <p>Thanks in advance.</p>
c#
[0]
185,602
185,603
Gps location in android
<p>I have taken the current gps value using the following code.</p> <pre><code>public class GetGPS implements LocationListener { public void onLocationChanged(Location location) { } public void onProviderDisabled(String provider) { //alertDialog.showMessage("Please Turn On your GPS", "GPS Turned Off"); } public void onProviderEnabled(String provider) { } public void onStatusChanged(String provider, int status, Bundle extras) { } } </code></pre> <p>it works.but the values are 100-200 feet off.i want to know what is the problem?</p>
android
[4]
3,111,940
3,111,941
Path to file in Android Eclipse project
<p>I need to use map rendering library in my android project. I want to use code found in <a href="http://code.google.com/p/mapsforge/" rel="nofollow">mapsforge website</a>.</p> <p>First, I must set the map I want to use. Method to do that is <code>setMapFile(String newMapFile)</code> from <a href="http://code.google.com/p/mapsforge/source/browse/trunk/mapsforge/src/org/mapsforge/android/maps/MapView.java#" rel="nofollow"><code>MapView</code></a> class. I tried to place map file in <code>assets</code> and <code>res/raw</code> folder in Eclipse project and then give path to it, but it doesn't work for me.</p> <p>Could anyone tell me how to correctly deliver path with map to this map?</p>
android
[4]
1,084,978
1,084,979
DeviceAdmin policies PASSWORD_QUALITY_NUMERIC not working
<p>I am working on DeviceAdmin policies implementation, followed below link for implementation <a href="http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#PASSWORD_QUALITY_NUMERIC" rel="nofollow">http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#PASSWORD_QUALITY_NUMERIC</a> , In that if we selected PASSWORD_QUALITY_NUMERIC password Quality from spinner, while setting password, it should ask for at least one digit but not showing any information to input digit, simply accepting ALPHABETIC, not asking for at least 1 number.I hope this is not expected behaviour,may be i am wrong Please let me know Am i misunderstand PASSWORD_QUALITY_NUMERIC?.If i selected PASSWORD_QUALITY_ALPHABETIC, i tried to give only digits, this time asking for at least 1 letter. Thanks in advance :D</p>
android
[4]
5,787,071
5,787,072
Reading xlsx file in PHP
<p>I'm following <a href="http://matthom.com/archive/2010/04/14/read-microsoft-office-2007-files-with-php" rel="nofollow">this tutorial</a> to read the <code>xlsx</code> file format. I'm reading xlsx file. Working fine. But it display all the file content in one line. How to add space between them? Thanks Here is my code.</p> <pre><code> $file_upload = 'book.zip'; $zip = new ZipArchive; // the string variable that will hold the file content $file_content = " "; // the uploaded file //$file_upload = $file -&gt; upload["tmp_name"]; if ($zip -&gt; open($file_upload) === true) { // loop through all slide#.xml files if ( ($index = $zip -&gt; locateName("xl/sharedStrings.xml")) !== false ) { $data = $zip -&gt; getFromIndex($index); $xml = DOMDocument::loadXML($data, LIBXML_NOENT | LIBXML_XINCLUDE | LIBXML_NOERROR | LIBXML_NOWARNING); $file_content = strip_tags($xml -&gt; saveXML()); } echo $file_content; } </code></pre>
php
[2]
3,126,734
3,126,735
Pythonic loops--how to get multiple elements while iterating a list
<p>I want to iterate over my list and do something with multiple elements, not just one element. I want to take the first element and some elements after it (they could be sequential or maybe the 3rd element from the one returned).</p> <pre><code>l = ['a', 'b', 'c', 'd', 'e'] for items in l: print items[:3] </code></pre> <p>The output should be:</p> <pre><code>['a', 'b', 'c'], ['b', 'c', 'd'], ['c', 'd', 'e'] </code></pre> <p>There are a lot of good answers, what if want to skip elements? Say, get an element, skip the next element, and get the 3rd element?</p> <p>Output:</p> <pre><code>('a', 'c'), ('b','d'), ('c', 'e') </code></pre> <p>I guess enumerate is the best way to handle this?</p> <p>Iterating through lists so simple and elegant I hoped similar syntax would allow you to use it inside a for loop on the element itself and not use range or enumerate.</p> <pre><code>l = ['a', 'b', 'c', 'd', 'e'] for items in l: print (items[0], items[2]) </code></pre> <p>(Yes, I know this code would give different results if the original list was a list containing lists. [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ] would return [1, 3], [4, 6], [7, 9])</p>
python
[7]