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,713,636
1,713,637
Campus Tour iPhone App
<p>I am I want to develop a Campus Map application on iPhone. I am searching for a way to figure out how to sync Current Location from Maps with my campus map. Or is there any other approach for building this app ? Suggest some good websites/ blogs/ groups working on something similar so that I can get information. </p>
iphone
[8]
3,808,784
3,808,785
Login Script problem
<pre> if (isset($_POST['login'])){ $query = mysql_query("SELECT id FROM users WHERE username = '".mysql_real_escape_string($_POST['username'])."' AND password = '".mysql_real_escape_string($_POST['password'])."'"); /* wrong login information? redirect to error message */ if (mysql_num_rows($query) == 0){ header("Location: error.php"); exit; } /* set session with unique index */ $_SESSION['id'] = mysql_result($query, 0, 'id'); mysql_query("UPDATE users SET last_login = NOW(), _last_ip = '".$_SERVER['REMOTE_ADDR']."' WHERE id = '{$_SESSION['id']}'"); header("Location: welcome.php"); exit; } /* if logout, destroy session */ if (isset($_GET['logout'])){ mysql_query("UPDATE users SET online = '0' WHERE id = '{$_SESSION['id']}'"); session_unset(); session_destroy(); header("Location: index.php"); exit; } </pre> <p>This works but if you leave username and password inputs empty, it log in too :/ I found it this script on a site. </p> <p>How can I fix this hole?</p>
php
[2]
75,024
75,025
How to create two application domains, each of them with its own separate window (as opposed to get embedded in host window)?
<p>I am learning application domain now.</p> <p>My host program will call 2 appdomains which call an assembly as follows:</p> <pre><code>class Program { static void Main(string[] args) { AppDomain ad1 = AppDomain.CreateDomain("appdom1"); ad1.ExecuteAssembly("c:\\InputOutput.exe"); AppDomain ad2 = AppDomain.CreateDomain("appdom2"); ad2.ExecuteAssembly("c:\\InputOutput.exe"); Console.Write("Press any key to unload"); Console.ReadLine(); AppDomain.Unload(ad1); AppDomain.Unload(ad2); } } </code></pre> <p>How to make each appdom have its own separate window rather than reside in the host application?</p> <p>Thank you in advance.</p>
c#
[0]
1,750,491
1,750,492
document.ready is to slow, it takes like 2min to load
<p>I have some problem using document.ready, it slows down the loading time with sometimes up to two minutes.</p> <p>I saw this link : <a href="http://encosia.com/dont-let-jquerys-document-ready-slow-you-down/" rel="nofollow">http://encosia.com/dont-let-jquerys-document-ready-slow-you-down/</a></p> <p>So my question is, how can I use that approach instead of document.ready ?</p> <p>here's my document.ready function inside custom.js file.</p> <pre><code>$(document).ready(function () { setBudgetPeriodReadOnly(); adjustTablePerBudgetNiva(budgetNiva); disableDeletedAccounts(); allowedKeyCodes(); showHideZeroRowsEvent(); removeZeroOnClick(); bindMouseOverOutEvent(); bindTableRowEvents(); returnAsTabEvent(); budgetNivaChangedEvent(); </code></pre> <p>});</p> <p>as you see it contains some funtions, and those functions using child functions and so on.</p> <p>here's a sample of a function using live</p> <pre><code>function bindMouseOverOutEvent() { $('#budgetTable tr').live({ mouseover: function () { $(this).find('td:eq(6)') .removeClass('budgetBelopp') .end().toggleClass('budgetTable-hover'); }, mouseout: function () { $(this).find('td:eq(6)') .addClass('budgetBelopp') .end().toggleClass('budgetTable-hover'); } }); </code></pre> <p>}</p> <p>but its not working because its wrapped in a function, and I want them to be wrapped so I see on the function name what the function is doing. </p> <p>I'm also new to jQuery.</p>
jquery
[5]
4,219,093
4,219,094
ASP.NET Plugin Model Question
<p>I have to create a new ASP.NET 3.5 site (Not MVC!), and I am required to build a Plugin Architecture for the same.</p> <p>I am thinking of using UserControls, but DLL of the UserControl must be placed in "bin" directory in order for it to work :(. I can't do that becauase I will have lots of Dlls and want to load the DLLs dynamically when needed for the UserControl.</p> <p>Is there a way to achieve it ?</p> <p>So my requirements :</p> <ul> <li>Core will load Plugin UserControls depending on configuration</li> <li>DLL should be loaded on demand rather then from bin directory</li> </ul> <p>Please help!</p>
asp.net
[9]
2,532,920
2,532,921
Limit length of list python
<p>I don't know if this question was asked somewhere, but I did not find it.</p> <p>I'm appending elements to a list. </p> <pre><code>thr_core0 +=[fpid[thread]] </code></pre> <p>this happens periodically.. At time 0:</p> <p>thr_core0 [9886, 9890]</p> <p>At time1:</p> <p>thr_core0 [9886, 9890, 9886, 9890]</p> <p>Is it possible to limit the length of the list to 2. </p> <p>I know it is possible using <code>deque</code>. but is it possible also using <code>lists</code>.</p> <p>using <code>deque</code>, we do it like this:</p> <pre><code>thr_core0 += [deque([0]*2,maxlen=2)] </code></pre> <p>These are the keywords I searched for on google: <code>limit</code> <code>list</code> <code>length</code> <code>python</code></p>
python
[7]
2,662,708
2,662,709
System.Security.SecurityException with GoDaddy Hosting
<p>net.my application is working fine on localhost.Till yesterday my application working fine on godaddy.But i do some changes in coding(there i used Viewstate) and then upload it to the godaddy.But now if i logged in to the index page,every thing is working as earlier.But if i click radio button(for which i have changed coding),it will give the System.Security.SecurityException error.The Error is as follows.i have doubt that whether using viewstate property caused this error..?.</p> <pre><code>Exception Details: System.Security.SecurityException: Request failed. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SecurityException: Request failed.] System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +150 System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +100 System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) +284 System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet, PermissionSet&amp; alteredDemandset, RuntimeMethodHandle rmh) +69 System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandle rmh) +150 System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +30 System.Threading.CompressedStack.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +40 System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant, CompressedStack securityContext) +123 System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant, Resolver accessContext) +41 </code></pre>
asp.net
[9]
4,955,340
4,955,341
adding noise to a signal in python
<p>I want to add some random noise to some 100 bin signal that I am simulating in Python - to make it more realistic.</p> <p>On a basic level, my first thought was to go bin by bin and just generate a random number between a certain range and add or subtract this from the signal.</p> <p>I was hoping (as this is python) that there might a more intelligent way to do this via numpy or something. (I suppose that ideally a number drawn from a gaussian distribution and added to each bin would be better also.)</p> <p>Thank you in advance of any replies.</p> <hr> <p>I'm just at the stage of planning my code, so I don't have anything to show. I was just thinking that there might be a more sophisticated way of generating the noise.</p> <p>In terms out output, if I had 10 bins with the following values:</p> <p>Bin 1: 1 Bin 2: 4 Bin 3: 9 Bin 4: 16 Bin 5: 25 Bin 6: 25 Bin 7: 16 Bin 8: 9 Bin 9: 4 Bin 10: 1</p> <p>I just wondered if there was a pre-defined function that could add noise to give me something like:</p> <p>Bin 1: 1.13 Bin 2: 4.21 Bin 3: 8.79 Bin 4: 16.08 Bin 5: 24.97 Bin 6: 25.14 Bin 7: 16.22 Bin 8: 8.90 Bin 9: 4.02 Bin 10: 0.91</p> <p>If not, I will just go bin-by-bin and add a number selected from a gaussian distribution to each one.</p> <p>Thank you.</p> <hr> <p>It's actually a signal from a radio telescope that I am simulating. I want to be able to eventually choose the signal to noise ratio of my simulation.</p>
python
[7]
3,812,940
3,812,941
Creating a dangling pointer using Java
<p>How can i create a dangling pointer using Java?</p>
java
[1]
264,465
264,466
Getting the selected values in a multiselect tag in Javascript
<p>I have the following code </p> <pre><code>function searchFlights() { var select1 = document.getElementById("airports-select-1"); var selected1 = []; while(select1.selectedIndex != -1) { if(select1.selectedIndex != 0) selected1.push(select1.options[select1.selectedIndex].value); select1.options[select1.selectedIndex].selected = false; } console.log(selected1); } </code></pre> <p>This works right, but as you can see from the code this line: </p> <pre><code>select1.options[select1.selectedIndex].selected = false; </code></pre> <p>Is doing a deselecting of the value. </p> <p>Now, I do not want to deselect the values. If I uncomment that line in the code, the code will run forever. </p> <p>Is there any more refined and sophisticated solution for retrieving multiple values from a select tag using Javascript?</p>
javascript
[3]
3,864,533
3,864,534
Need to schedule a method excecution in asp .net
<p>I am creating a web application in which I need to allow the user to schedule the excecution of a task. I have gone through the various threads for scheduling the task but all of them are using windows service that I am not aware of. Moreover I cannot install visual studio in the server systems due to budget constraints. Is there a way to create a method that runs a scheduler in a background thread in the asp .net application.Any code sample will be of great help.</p>
c#
[0]
989,856
989,857
Entry Test Application source
<p>I am trying to make an Entry test application for an organization. Can someone please send me source code example of some good entry test application. Thanks.</p>
asp.net
[9]
537,514
537,515
An HtmlSelect cannot have multiple items selected when Multiple is false
<p>I am getting the below error</p> <blockquote> <p>An HtmlSelect cannot have multiple items selected when Multiple is false.</p> </blockquote> <p>Why i am getting this error i don't understand still? </p>
asp.net
[9]
758,466
758,467
Javascript can't convert undefined to object
<p>I have the following code</p> <pre><code>for(i = 0; i &lt; num; i++) { var yPos = 10*i; var numCells = wid/30; for(j = 0; j &lt; numCells; j++) { blocks[i][j] = 1; } } </code></pre> <p>With</p> <pre><code>blocks = new Array(); </code></pre> <p>However, when I execute the code I receive an error stating that:</p> <pre><code>can't convert undefined to object </code></pre> <p>Any ideas? :/</p>
javascript
[3]
91,817
91,818
Error 500 Calling Rest Web Services iphone sdk
<p>I have two web services's url : </p> <ul> <li><a href="http://abcd.com/rest/1/loginDetails/resetPassword?email=jitender.k@gmail.com" rel="nofollow">http://abcd.com/rest/1/loginDetails/resetPassword?email=jitender.k@gmail.com</a></li> <li><a href="http://abcd.com/rest/1/search/nextProfileAttributeUsers?offset=30" rel="nofollow">http://abcd.com/rest/1/search/nextProfileAttributeUsers?offset=30</a></li> </ul> <p>I am following thse steps to call web service : </p> <p>I am making url from these string. </p> <pre><code>+ Passing url to + NSMutableURLRequest * request + [request setValue:[prefrences valueForKey:@"Cookie"] forHTTPHeaderField:@"Cookie"] + [request setHTTPMethod:@"GET"] [request setHTTPBody:[jsonPostBody dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]]; + [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; + [request setValue:postDataLengthString forHTTPHeaderField:@"Content-Length"]; + [NSURLConnection connectionWithRequest:request delegate:self]; </code></pre> <p>In this procedure First url is working fine for me but Second url giving error with status code 500. </p> <p>Please help me out. What problem is this web services are same and of same type. But one is working fine and another giving me error ?</p>
iphone
[8]
596,541
596,542
Setting properties of Button
<p>How to set Button <strong>"Layout below"</strong> properties by <strong>code</strong> in android inside an <strong>Relativelayout</strong> i have defined relative layout by using findviewby id. </p>
android
[4]
5,794,923
5,794,924
What is the Difference between onclick and href="javascript:function name?
<p>Is there any difference between</p> <pre><code>1 : &lt;a href="javascript:MyFunction()"&gt;Link1&lt;/a&gt; </code></pre> <p>and</p> <pre><code>2 : &lt;a href="#" onclick="MyFunction()"&gt;Link2&lt;/a&gt; </code></pre> <p>? Would one affect the page performance by any means ?</p>
javascript
[3]
5,815,212
5,815,213
Android - list of numbers with incrementer decrementer
<p>I want to have a list of numeric EditText fields with incrementers and decrementers (functionally like spin-buttons). The numbers are supposed to be percentages adding up to 100. Finalizing the values should only be possible when this happens. I also want the incrementers to grey out when the total reaches 100 and the decrementers to grey out when the total reaches 0. I'm also including another text view that shows the difference between the current total and 100. What is a good way to do this? Should I just have 2*n different buttons with the listeners doing all this work? Or is there a neater way?</p> <p><b> Update: </b> The principal way of changing the values will be the up/down buttons. The text being editable is just for a secondary matter of convenience.</p>
android
[4]
2,141,506
2,141,507
whole word match in javascript
<p>I am using javascript in my webpage. I am trying to search a single whole word through textbox. Say I search: 'me' , I should find all the 'me' in the text, but not find 'memmm' per say.</p> <p>I am using javascript's search('my regex expression') to perform the current search (with no success).</p> <p>Thank you!</p> <p>Edit: After several proposals to use the \b switches [which don't seem to work] I am posting a revised explanation of my problem:</p> <p>amm, from some reason this doesn't seemt to do the tricks. Assume the following javascript search text:</p> <pre><code>&lt;script type='text/javascript'&gt; var lookup = '\n\n\n\n\n\n2 PC Games \n\n\n\n'; lookup = lookup.trim() ; alert(lookup ); var tttt = 'tttt'; alert((/\b(lookup)\b/g).test(2)); &lt;/script&gt; </code></pre> <p>Moving lines is essential</p>
javascript
[3]
3,420,923
3,420,924
What is wrong with this method in java? I want implement recursion
<p>I have the following method, but I want to use recursion; however, I get an error: "missing return statement".</p> <pre><code>static String buscar(NodoDeArbol raiz, String letra) { if(raiz == null) { aux=""; for (int i = 0; i &lt; auxiliar.length()-1; i++) { aux+=auxiliar.charAt(i); } return aux; } auxiliar = buscar(raiz.izquierdo, auxiliar+= "0"); auxiliar = buscar(raiz.derecho, auxiliar+= "1"); } </code></pre> <p>What should to do to fix this?</p>
java
[1]
2,898,957
2,898,958
(window).load and (document).ready functions are conflicting
<p>I am trying to get the 2 jquerys to work without conflicting!</p> <p>Here is my code:</p> <pre><code>(function($){ //This functions first parameter is named $ $(document).ready(function(){ // tabbed boxes $('#tabs div').hide(); $('#tabs div:first').show(); $('#tabs ul li:first').addClass('active'); $('#tabs ul li a').click(function(){ $('#tabs ul li').removeClass('active'); $(this).parent().addClass('active'); var currentTab = $(this).attr('href'); $('#tabs div').hide(); $(currentTab).show(); return false; }); }); $(window).load(function(){ // jQuery Lightbox var lightboxPath = "/js/jquery-lightbox/"; $("a[rel='group1']").lightBox({ imageLoading:lightboxPath+"img/lightbox-ico-loading.gif", imageBtnPrev:lightboxPath+"img/lightbox-btn-prev.gif", imageBtnNext:lightboxPath+"img/lightbox-btn-next.gif", imageBtnClose:lightboxPath+"img/lightbox-btn-close.gif", imageBlank:lightboxPath+"img/lightbox-blank.gif" }); // Photo gallery &gt; Standard $(".photosgallery-std").sliderkit({ mousewheel:true, shownavitems:7, //navfx:"none", panelbtnshover:true, auto:true, circular:true, navscrollatend:true, counter:true }); }) })(jQuery); </code></pre> <p>Please can anyone help :)</p>
jquery
[5]
872,383
872,384
Using "namespace foo {" instead of explicitly qualifying outside of header files
<p>If a function is declared as such:</p> <pre><code>namespace foo { void bar(); } </code></pre> <p>Most people define the function like this:</p> <pre><code>void foo::bar() { ... } </code></pre> <p>However I like to do it this way:</p> <pre><code>namespace foo { void bar() { ... } } </code></pre> <p>I prefer this style because its saves me from always retyping foo::, which is often tedious in function parameters that accept types declared in that same namespace. Plus its easier to rename the whole namespace.</p> <p>I'm wondering why I almost never see my style in other peoples code, are there any disadvantages too it, besides the additional indentation level (and you don't even have to indent namespaces)?</p>
c++
[6]
1,582,418
1,582,419
Convert tabular List data to Rowa in C#
<p>I am querying database to get Tabular data</p> <pre><code>ID NAME 1 ABC 2 XYZ 3 IJK 4 LMN 5 OPQ 6 RSS 7 NTN 8 UPS 9 DHL 10 XXX I want this to convert it into following format to display in Grid 1 ABC 2 XYZ 3 IJK 4 LMN 5 OPQ 6 RSS 7 NTN 8 UPS 9 DHL 10 XXX I want to Convert it into a List of Following Object Class NewData { Int Id1 string Name1 int id2 string Name2 int id3 string Name3 </code></pre> <p>}</p>
c#
[0]
1,738,148
1,738,149
Why is my launcher icon smaller when placed on the Android desktop?
<p>I have an application built for 1.5 and I am adding higher resolution drawables to support hdpi devices in 1.6 and above.</p> <p>My original application icon is 48x48. I created a second launcher icon that is 72x72 and placed it in a res/drawable-hdpi/ directory. </p> <p>When I install the application on my Nexus One the icon looks good when I view it in the application menu. But when I place it on the desktop it appears small relative to other icons, my guess is I'm seeing the 48x48 version with no scaling.</p> <p>These are my two resource directories:</p> <p>res/drawable/appicon.png res/drawable-hdpi/appicon.png</p> <p>Do I need to do something differently either with my directory structure or my manifest file to get things to display correctly?</p> <p>Thanks!</p>
android
[4]
5,807,875
5,807,876
How to query excel file in php?
<p>I want to compare the 1st column of two excel files and if a match is found, I need to copy value of the 5th column to another excel sheet. I've tried <code>php_excel_reader</code> and <code>php_excel_writer</code> but with no success.</p> <p>I want something like this:</p> <pre><code>excelF1; excelF2; for ($i=1; $i&lt;=rowlength(excelF1); $i++) { val1 = excelF1[i][1]; for ($j=1; $j&lt;=rowlength(excelF2); $j++) { val2 = excelF2[j][1]; if(val1 == val2) { val3 = excelF2[j][5]; //insert val3 into last column of excelF1; } } } </code></pre>
php
[2]
4,075,196
4,075,197
Android: Alert Dialog
<pre><code>@Override protected Dialog onCreateDialog (int id) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.instant_alert_screen_title); builder.setInverseBackgroundForced(true); ListView aa = new ListView(this); aa.setAdapter( new IconicAdapter()); aa.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { switch (arg2) { case 0: ...... break; case 1: ...... break; case 2: ...... break; builder.setView(aa); builder.setPositiveButton("Done", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.setNegativeButton("Cancel", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); return builder.create(); </code></pre> <p>Ok guys..I have a <code>AlertDialog</code>..In <code>Adapter</code> i set to dialog 3 <code>CheckedTextView</code>... How in on Positive Button Listener i could find a second item and check is it checked or not ? </p> <p>Dont recomend me to do like this:</p> <pre><code> CheckedTextView a = (CheckedTextView)findViewById(R.id.text) boolean b = a.isChecked(); </code></pre> <p>I need to use <code>onClick(DialogInterface dialog, int which)</code> this dialog Interface...is that real ?</p>
android
[4]
498,670
498,671
in saveState what's my context?
<p>I am trying to do some cleanup within a saveState() call. I want to pop-up a dialog if there is an error on exiting the activity, but the activity is already gone by this point.</p> <p>I want to have this happen from an activity called StudentEdit but what should the context be? When I use StudentEdit.this, the dialog pops up and then disappears. getApplicationContext causes a null pointer exception.</p> <pre><code>private void saveState() { // some error checking code // if blah blah AlertDialog alertDialog = new AlertDialog.Builder(StudentEdit.this).create(); alertDialog.setMessage("error"); alertDialog.setButton(BUTTON_POSITIVE, "Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do something for yes } }); alertDialog.setButton(BUTTON_NEGATIVE, "No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); // kill dialog StudentEdit.this.finish(); // kill the activity } }); alertDialog.show(); } </code></pre>
android
[4]
5,476,383
5,476,384
Pythhon Check variable if it is in a list
<p>I am fairly new to Python, and I was wondering if there was a succinct way of testing a value to see if it is one of the values in the list, similar to a SQL WHERE clause. Sorry if this is a basic question.</p> <pre><code>MsUpdate.UpdateClassificationTitle in ( 'Critical Updates', 'Feature Packs', 'Security Updates', 'Tools', 'Update Rollups', 'Updates', ) </code></pre> <p>i.e, I want to write:</p> <pre><code>if MsUpdate.UpdateClassificationTitle in ( 'Critical Updates', 'Feature Packs', 'Security Updates', 'Tools', 'Update Rollups', 'Updates' ): then_do_something() </code></pre>
python
[7]
532,361
532,362
Illegal use of this type as an expression
<pre><code>class dataReader{ private: ifstream gfxDataFile; int numVertices; vector&lt;*vertexData&gt; vertices; public: dataReader(); dataReader(string file); ~dataReader(); string getLine(); int numberOfVertices(); }; </code></pre> <p>the line with the vector gives me the error</p> <p>vertexData: Illegal use of this type as an expression, any help guys?</p> <p>Heres the definition of vertexData</p> <pre><code>class vertexData{ private: float x; float y; float z; public: vertexData(); vertexData(float gx, float gy, float gz); ~vertexData(); float getX(); float getY(); float getZ(); }; </code></pre>
c++
[6]
3,830,526
3,830,527
Join two or more arrays of arrays
<p>Suppose I have two arrays like the following:</p> <pre><code>$arr2 = array(array("first", "second"), array("third", "fourth")); $arr3 = array(array("fifth", "sixth", "seventh"), array("eighth", "ninth"), array("tenth", "eleventh")); </code></pre> <p>And I want a result like this: </p> <pre><code>$arr4 = array("first", "second", "third", "fourth", "fifth", "sixth", "seventh","eighth", "ninth","tenth", "eleventh" ); </code></pre> <p>How to do that? in PHP</p>
php
[2]
4,327,923
4,327,924
generating a set of javascript code using php
<p>I´m trying using php to generate a set of "{URL.callback}" to use in javascript. By using database. Here is my code:</p> <pre><code>$sql="select * from search where keywords LIKE '$bb%' ORDER BY keywords "; $result=mysql_db_query($dbname,$sql); echo $_GET["callback"] . "({ t:\"$t\", r:["; while ( $rs=mysql_fetch_array($result)) { $keywords=$rs[keywords]; echo "" ."\"$keywords\"".","." "; } echo"] })"; </code></pre> <p>This is the code it returns:</p> <pre><code>({ t:"", r:["example1", "example2", "example3",] }) </code></pre> <p>Everything seemed to be correct except the (,) in the end (after "example3") that I want to get rid. because it´s not correct and can not be use with that.</p> <p>The question is: How to generate it correctly ? How to get rid the last (,) ?</p>
php
[2]
2,881,673
2,881,674
File Permission
<blockquote> <p>How i can set <strong>owner and group</strong> to file in php , i write</p> <p>chgrp("dompdf/background_image.html",1122);</p> <p>but this is not working</p> <p>it Set <strong>99</strong> instead of <strong>1122</strong></p> </blockquote>
php
[2]
2,441,010
2,441,011
returning referece of a local string object
<pre><code>string&amp; GetMyStr(string&amp; somestr) { string &amp; str=somestr; //do something with str return str; } </code></pre> <p>str is a local object, but why I can still get the value after return ? I think right after the function return, it too is gone and the return value is not referenced. I think I miss it, maybe.</p>
c++
[6]
5,545,033
5,545,034
Parser Error Problem
<p>Hi I have found a problem in Multilingual Asp.Net Web Application </p> <p>I have Created a Global.asax file and write the code</p> <pre><code>private void Application_BeginRequest(Object source, EventArgs e) { string[] languages = HttpContext.Current.Request.UserLanguages; if (languages[0].ToLower() != null &amp;&amp; languages[0].ToLower()!="") { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(languages[0].ToLower()); System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(languages[0].ToLower()); } } </code></pre> <p>and define Label Like this </p> <pre><code> &lt;asp:Label ID="Labeldg" runat="server" Text="&lt;%$ Resources:Resource, Labeldg %&gt;"&lt;/asp:Label&gt; </code></pre> <p>But it through Parser error like:</p> <blockquote> <p>Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. </p> <p>Parser Error Message: The resource object with key 'LblUsrName_Login' was not found. Source Error: </p> <p><code>&lt;/div&gt;</code></p> <p><code>&lt;div class="impcLoginText_Login"&gt;</code></p> <p><code>&lt;asp:Label ID="LblUsrName" runat="server" Text="&lt;%$ Resources:PageResource, LblUsrName_Login %&gt;" "&gt;&lt;/asp:Label&gt;</code></p> </blockquote>
asp.net
[9]
4,066,091
4,066,092
Is it possible to query the android market to find apps with given hardware features?
<p>I know that it is possible to do this for permissions (http://stackoverflow.com/questions/7486413/can-i-query-the-android-market-to-return-apps-with-specific-permissions) and more generally (http://stackoverflow.com/questions/4557300/finding-a-list-of-all-the-android-apps-on-the-market).</p> <p>The question I'm asking is related but different:</p> <p><em><strong>"Which list of applications utilize the phone's accelerometer?"</em></strong> etc</p> <p>I have successfully used the android-market-api to search for permissions which may imply certain features, but a direct search would be better.</p> <p>As an aside, I'd be interested to know if anyone has insight into what Google's market justification is for locking down the android market.</p>
android
[4]
4,269,077
4,269,078
confirm box styling
<p>I have a confirm box generated by javascript..... I want the backgorund colour of the box to be set green ..... and replace ok/cancel with yes/no ...can u please suggest how to do this ?</p>
javascript
[3]
3,682,619
3,682,620
How do friend classes interact with each other
<p>I have two simple class that I made just to understand how friend class works. I am confused as to why this doesn't compile and also would the Linear class have access to the struct inside Queues class?</p> <p>Linear.h</p> <pre><code>template&lt;typename k, typename v &gt; class Linear { public: //Can I create a instance of Queues here if the code did compile? private: }; </code></pre> <p>Linear.cpp</p> <pre><code>#include "Linear.h" </code></pre> <p>Queues.h</p> <pre><code> #include "Linear.h" template&lt;typename k, typename v &gt; class Linear; template&lt;typename x&gt; class Queues { public: private: struct Nodes{ int n; }; //Does this mean I am giving Linear class access to all of my Queues class variable or is it the opposite ? friend class Linear&lt;k,v&gt;; }; </code></pre> <p>Queues.cpp</p> <pre><code> #include"Queues.h" </code></pre> <p>My errors are </p> <pre><code>Queues.h:15: error: `k' was not declared in this scope Queues.h:15: error: `v' was not declared in this scope Queues.h:15: error: template argument 1 is invalid Queues.h:15: error: template argument 2 is invalid Queues.h:15: error: friend declaration does not name a class or function </code></pre>
c++
[6]
5,144,010
5,144,011
Neatest way of preserving application settings between upgrades?
<p>Our product has several user-defined settings, which to date have been stored using the project's Settings variables, e.g.</p> <pre><code>public string MySetting { get { return Settings.Default.MySetting; } set { Settings.Default.MySetting = value; Settings.Default.Save(); } } </code></pre> <p>That works fine - but it has the unfortunate characteristic that if you uninstall the app and reinstall a newer version (no direct upgrade path exists - don't ask), all the settings are lost.</p> <p>I can think of a few ways of achieving this, but they all seem a bit kludgy to me. What do you think is the neatest way of preserving user-defined application settings between uninstalling &amp; reinstalling?</p>
c#
[0]
4,791,139
4,791,140
ArrayList<Hashmap<String,Double[]> assigning the values to a single Double[]
<p>I am able to assign the Hash-map values to List double[] using following code, but for each entry in the Hash-map, it is creating separate array.</p> <pre><code> ArrayList&lt;HashMap&lt;String, Double[]&gt;&gt; arl =(ArrayList&lt;HashMap&lt;String, Double[]&gt;&gt;)pd.getArrayList(); while (itr.hasNext()) { HashMap&lt; String,Double[]&gt; map = (HashMap&lt;String,Double[]&gt;) itr.next(); empid.add((Double[])map.get("id")); } </code></pre> <p>How do I get all the entries into single array of double[].</p>
java
[1]
2,901,765
2,901,766
“too much recursion” in onload event
<p>I am trying to include a form from one page on one domain to another page on another domain. Here is my code which I put after my block form. </p> <pre><code>function IncludeSrc(src) { var s= document.createElement("script"); s.src = src; s.async = true; document.getElementsByTagName("head")[0].appendChild(s); } var onLoadFunc = window.onload; window.onload=function(){ if (typeof(onLoadFunc)=='function') onLoadFunc(); IncludeSrc('MYADRESS'); }; </code></pre> <p>There is no error in any browser but the form does not load. In Firefox console I found the error <code>too much recursion</code>. The address of the script is valid, I checked it. What am I doing wrong?</p>
javascript
[3]
5,022,490
5,022,491
Stopping video in viewWillAppear:(bool)animated method
<p>In my <code>viewWillAppear:(bool)animated</code> method I want to stop video playing. How can I do this? I am new I don't know much. I am playing a video on this screen. I have a tab which shows table view. When I click on the tab the table view is shown but video is playing in background: we can hear the music.</p>
iphone
[8]
1,746,073
1,746,074
Replace an input hidden value before submitting a form with some value fetched via Ajax
<p>I have the following submit handler which should lookup for some value based on the user input (key) and update an hidden field with the fetched value, before submitting the form.</p> <pre><code>$('#my_form').submit(function() { $.ajax({ url: "lookup.php?key=" + $('#key').val(),", // Read one of the user input and lookup dataType: 'json', success: function(data){ console.log(data); // Shows the expected result $('#my_form').find('input[name="xxx"]').val(data); // Substitute the hidden xxx with the fetched data return true; } }); console.log($('#my_form').find('input[name="xxx"]')); // Still the old value here return true; }); </code></pre> <p>Unfortunately, the final submitted form seems to contain the old value, as shown in the console.log. Given I'm very new to JS, I guess I'm missing something very basic here.</p>
javascript
[3]
2,130,737
2,130,738
Why can't this jQuery redirect to another domain?
<pre><code>http://phplist.xxmn.com/zen/index.php?main_page=index&amp;cPath=231 </code></pre> <p>the js code,in dress.js:</p> <pre><code>$('#1d, #1a').click(function(event){ event.preventDefault(); $('#producListing').load(this.attr('href')); }); </code></pre> <p>the big font Price UP and price down is the text i will click, i want to make when click the text the page can't refresh. thank you,</p>
jquery
[5]
3,753,754
3,753,755
How to clear the caching of the image gallery
<p>I need to delete a file(video file) saved on my android gallery. I used file.delete();. The file is deleted in some devices. In some devices like Galaxy S the status of the file says it is deleted, but it is still present in the gallery. But the video can't be played! </p> <p>I found that the media gallery is doing some aggressive caching of some preview/thumbnail, so that you see it there, but can not play it - as the underlying file is gone. How to delete this cache?</p>
android
[4]
3,889,106
3,889,107
Changing the 'Run As:' field for a scheduled task via C#
<p>I need to write a C# program to change the 'Run As' field of scheduled tasks on remote systems.</p> <p>What are some of the libraries I should be looking at to achieve this?</p>
c#
[0]
481,573
481,574
Site.Master Changes
<p>I started out with a basic site.master. After I laid out several pages, I have found that I need to make changes to the site.master. The changes show up while I am working in Visual Studio, but when I run the application, they don't take effect. What do I need to do to have them show up?</p>
asp.net
[9]
4,111,356
4,111,357
How can I make this list of queries shorter?
<p>I just want to hear if there is an easier way doing this.</p> <pre><code>public void Model(string _model) { var list = from vehicle in vehiclesorted where vehicle.Model == _model orderby vehicle.Price select vehicle; vehiclesorted = list.ToList(); } public void Brand(string _brand) { var list = from vehicle in vehiclesorted where vehicle.Brand == _brand orderby vehicle.Price select vehicle; vehiclesorted = list.ToList(); } public void Mph(int _mph) { var list = from vehicle in vehiclesorted where vehicle.Mph &lt;= _mph orderby vehicle.Price select vehicle; vehiclesorted = list.ToList(); } </code></pre>
c#
[0]
3,175,737
3,175,738
Reading web.config value through javascript
<p>I have web.config with the given value:</p> <pre><code>&lt;appSettings&gt; &lt;add key="vDirectory" value="fr" /&gt; &lt;add key="BookingSummaryPage" value="/pli/forms/BookingSummary.aspx" /&gt; &lt;/appSettings&gt; </code></pre> <p>Now I want to read the value of "vDirectory" through java script.</p> <p>I am using below code:</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; function test() { var t='&lt;%=ConfigurationManager.AppSettings("vDirectory").ToString() %&gt;' alert(t); } &lt;/script&gt; &lt;input type="button" value="Click Me" onclick="test();" /&gt; </code></pre> <p>The error generated is:</p> <pre><code>Error 'System.Configuration.ConfigurationManager.AppSettings' is a 'property' but is used like a 'method' </code></pre>
javascript
[3]
2,111,368
2,111,369
Random number generation
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/137783/expand-a-random-range-from-1-5-to-1-7">Expand a random range from 1-5 to 1-7</a> </p> </blockquote> <p>Hi, This question is taken from <a href="http://blog.seattleinterviewcoach.com/2009/02/140-google-interview-questions.html" rel="nofollow">http://blog.seattleinterviewcoach.com/2009/02/140-google-interview-questions.html</a></p> <blockquote> <p>Given a function which produces a random integer in the range 1 to 5, write a function which produces a random integer in the range 1 to 7.</p> </blockquote> <p>I am not getting a way to generate all random numbers 1 to 7 with almost equal probability by using 1 to 5 random generator.</p> <p>Could anyone pls solve it ?</p>
c++
[6]
898,535
898,536
How does compiling happen only for the first time in projectless development?
<p>I read these words in a book:</p> <blockquote> <p><strong>Projectless development simplifies debugging</strong>: When creating a web project, you must recompile the entire application when you change a single page. With projectless development, each page is compiled separately, <em>and the page is only compiled when you request it for the first time.</em> </p> </blockquote> <p>How does compiling happen only for the first time in projectless development? Should it recompile every time I run the page to reflect the new code I wrote it?</p>
asp.net
[9]
2,251,834
2,251,835
increase the upload size in php
<p>I want to upload the file size with more than 50 mb in size. But as the default max size that can be uploaded is 8M. I went to php.ini file in my xampp and made the following changes.</p> <pre><code>upload_max_filesize = 100M post_max_size = 100M </code></pre> <p>But still i am not able to upload file larger than 8mb. Whenever i try to upload i get this error:-</p> <pre><code>Warning: POST Content-Length of 69505977 bytes exceeds the limit of 8388608 bytes </code></pre> <p>Can anyone help me out with this problem. ??</p>
php
[2]
7,571
7,572
Using jQuery hover() to make element appear but not triggering animation twice
<p>I'm building a simple slider with jCycle. When you hover over the slider, I'd like the 'previous' and 'next' arrows to appear. Once the cursor leaves the slider, I'd like the arrows to disappear again. The arrows are absolutely positioned over the slider.</p> <p>The HTML for the slider:</p> <pre><code> &lt;div id="next"&gt;&lt;/div&gt; &lt;div id="prev"&gt;&lt;/div&gt; &lt;ul id="s2"&gt; &lt;li&gt;&lt;img src="bla1" /&gt;&lt;/li&gt; &lt;li&gt;&lt;img src="bla2" /&gt;&lt;/li&gt; &lt;li&gt;&lt;img src="bla3" /&gt;&lt;/li&gt; &lt;li&gt;&lt;img src="bla3" /&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I'm currently using this code:</p> <pre><code>jQuery('#s2,#next,#prev').hover( function () { jQuery('#next,#prev').animate({opacity: 0.9}); }, function () { jQuery('#next,#prev').animate({opacity: 0}); }); </code></pre> <p>This works, but it triggers the animation two times: when you hover over the slider and when you hover over the arrow element (#next or #prev).</p> <p>How can I make the animation trigger only once?</p> <p>For an example, please see <a href="http://fc.boilerroom.tv/" rel="nofollow">http://fc.boilerroom.tv/</a>.</p>
jquery
[5]
2,459,977
2,459,978
individual user services for moving local data?
<p>I have a client application that is used to maintain orders. Users have the ability to run one-off reports from the application. The reports are from from data which is created on the fly and saved to the individual user's pc. The data is deleted when the application is closed.</p> <p>There is a 2 step process in the app to create the report. first, the report button is clicked, which creates the data in the local folder. then the the create report button is clicked, at which time the report is actually created using that data. As I said earlier, when the app is closed, all local data is deleted. </p> <p>I have a need to collect this data so that it can be reported against. Currently, I have the user stop after the first step mentioned above and manually run a short program which copies the local data to a network share where it can be processed. I would like to eliminate the manual step of running the copy app.</p> <p>How are people handling similar situations to this? I have less than 10 users who would need it, and it can be run once a day, sometimes as many as 5 times a day. I have considered creating a service to run locally on each users pc, but this seems like it would be difficult to maintain. Can a windows service be pushed out by a login script?</p> <p>Does anyone have any other thoughts regarding how this could be handled?</p> <p>Thanks.</p>
c#
[0]
4,767,648
4,767,649
Retrieving checkbox status in an HTML table using JavaScript
<p>I'm trying to remember the syntax for getting an element inside a table using JavaScript. I have a table with a checkbox in it. These are dynamic checkboxes or i would just use the getElementById. Here is how I'm doing it. I know I'm close, but just figured it out yet. Here is the code I have so far:</p> <pre><code> table_name.rows[0].cells[0].item[0] </code></pre> <p>or </p> <pre><code> tbl_run_avail.rows[1].cells[0].elements[0] </code></pre>
javascript
[3]
3,156,571
3,156,572
Element 'DropDownListX' is not a known element.
<p>I have used the class in my project. But I have warning <code>Element 'DropDownListX' is not a known element</code> in source view page <code>default.aspx</code>. In design view shows the control.</p> <p>even in <code>default.aspx.cs</code> is known <code>dropdownlistx</code></p>
asp.net
[9]
3,557,790
3,557,791
jQuery call function if Enter hit
<p>I am calling a function on button click code is given blow:</p> <pre><code>&lt;input type="button" value="Search" id="go" /&gt; $("#go").click(function () { ... }); </code></pre> <p>now I catch if user hit <kbd>enter</kbd> key from keyboard by this function:</p> <pre><code>$("#s").keypress(function(e) { if(e.which == 13) { alert('You pressed enter!'); } }); </code></pre> <p>but how could I call </p> <pre><code>$("#go").click(function () { ... }); </code></pre> <p>both if user hits <kbd>enter</kbd> key &amp; on click <strong>GO</strong> button?</p>
jquery
[5]
4,254,205
4,254,206
jQuery Mobile existing action bar implementations?
<p>I'm wondering if there are working action bar implementations for the jQuery Mobile library. Thanks! </p>
jquery
[5]
1,077,872
1,077,873
What are the access-specifiers available in c#? What is the default one?
<p>What are the access-specifiers available in c#? What is the default one?</p>
c#
[0]
75,679
75,680
Can we install iPhone SDK 4 in iPhone OS 3
<p>Can i install a iPhone4 SDK, where my Mac Book has only iPhone OS3? If it is possible will i get all the features of iPhone OS4? </p>
iphone
[8]
4,329,894
4,329,895
Use a jQuery script so it can work without having to call the url
<p>Is there a way I can use this script so it can work without having to call the <code>url: "http://localhost/a/rate/update.php"</code></p> <p>Here is the script.</p> <pre><code>function getRatingText(){ $.ajax({ type: "GET", url: "http://localhost/a/rating/update.php", data: "do=getavgrate", cache: false, success: function(result) { // add rating text $("#rating-text").text(result); }, }); } </code></pre>
jquery
[5]
3,071,533
3,071,534
Unable to start activity on complete of bootload of the application
<p>The code to start the service at bootup..... I have even included the permissions in the manifest file as mentioned before...but the service doesn't start...i have to explicitly start as of now by startService(Intent..) commmand... Is there any mistake in what i have done??</p> <pre><code>public class BootReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent arg1) { Intent serviceIntent = new Intent(BackgroundService.class.getName()); context.startService(serviceIntent); } </code></pre> <p>}</p> <pre><code> &lt;receiver android:name="BootReceiver"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.BOOT_COMPLETED"&gt; &lt;/action&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /&gt; </code></pre>
android
[4]
2,200,153
2,200,154
Which collection should be used in this scenario?
<p>Can any one suggest me which collection to use for this scenario:</p> <p>Every student has a payment history with details of payment made by the student / family. The system should ensure that no duplicate payments are there against a student account. The program should be able to add payment details for a student, and ensure that duplicate payment details are not getting registered.</p>
java
[1]
3,899,329
3,899,330
how to add assign the value and make an addition in javascript
<pre><code>&lt;input name="" type="button" value="300" onclick="document.all.t1.value=this.value" /&gt; &lt;input name="t1" type="text" id="t1"/&gt;&lt;br /&gt; &lt;input name="" type="button" value="400" onclick="document.all.t2.value=this.value" /&gt; &lt;input name="t2" type="text" id="t2"/&gt;&lt;br /&gt; &lt;script&gt; function add(){ document.getElementById("t3").value = Math.floor(document.getElementById("t1").value) + Math.floor(document.getElementById("t2").value); } &lt;/script&gt; &lt;input name="" type="button" value="add" onclick="add" /&gt; &lt;input name="t3" type="text" id="t3"/&gt; </code></pre> <p>the above code is bad., expect some to correct it. thank you.</p> <p>when click 300, the 300 vill in the first textbox, the same as 400, then click add button. the third textbox shoew 700</p>
javascript
[3]
4,959,221
4,959,222
PHP detect if in subdirectory
<p>I want to determine if the PHP file I am on <code>install.php</code> is in a subdomain/subdirectory (basically not at domain.com/install.php).</p> <h2>Found solution to my problems</h2> <p>see below</p>
php
[2]
404,326
404,327
Is there a typo in the C++ Assignment Operator tutorial?
<p><a href="http://brskari.wordpress.com/2011/02/24/c-assignment-operator-or-how-i-learned-to-stop-worrying-and-not-check-for-self-assignment/" rel="nofollow">This</a> is a good tutorial that illustrates the correct way to design C++ assignment operator.</p> <p>In the end, the author provides the following alternative implementation for the operator as follows:</p> <pre><code>1 Foo&amp; operator=(Foo rhs) 2 { 3 swap(rhs); 4 return *this; 5 } </code></pre> <p>Based on the <a href="http://www.cplusplus.com/reference/algorithm/swap/" rel="nofollow">swap</a>, the line <code>3</code> should be <code>swap(*this, rhs)</code> or <code>swap(rhs, *this)</code>.</p> <p><strong>Question</strong>> Is my understanding correct?</p> <p>Thank you</p>
c++
[6]
5,642,825
5,642,826
asp.net validation for multiple text boxes
<p>I have two asp:TextBox. User needs to enter value in at-least one of the text boxes. Please let me know how to validate to make sure data is entered in atleast one of the boxes. Thanks.</p>
asp.net
[9]
2,693,387
2,693,388
I have a weird issue with hash:sha512(works perfectly, except when i tried logging in with wrong password
<p>session_start();</p> <pre><code>if(isset($_SESSION['logged'])){ header('Location: esm_questionnaire.php'); } if(isset($_POST['utilisateur'])&amp;&amp;isset($_POST['motdepasse'])){ $con = mysql_connect('localhost','root',''); mysql_select_db('esm_quiz', $con); $datID = mysql_real_escape_string($_POST['utilisateur']); $datPASS = $_POST['motdepasse']; $datPASS = hash(sha512, $datPASS); $SQL = "SELECT * FROM esm_sujets WHERE code_exp = '$datID'"; $result = mysql_query($SQL, $con); $row = mysql_fetch_array($result); if($result){ if($datPASS === $row['pass_exp']){ $_SESSION['logged'] = true; $_SESSION['sexe'] = $row['sexe']; $_SESSION['type'] = $row['type_attachement']; header('Location: esm_questionnaire.php'); } else{ die('Vous n&amp;#39;avez pas acces'); } } } </code></pre> <p>Notice: Use of undefined constant sha512 - assumed 'sha512' in C:\wamp\www\Nouveaudossier\esm_connexion.php on line 12</p> <p>this is the error i get if i have a wrong password or username</p>
php
[2]
6,001,344
6,001,345
mouseover and mouseout and div with images 1px separated
<p>I have div and function mouseover:</p> <pre><code>$('#mydiv').mouseover(function(){ $('#otherdiv').show('slow'); }); $('#otherdiv').mouseout(function(){ $('#otherdiv').hide('slow'); }); </code></pre> <p>but... The <code>#otherdiv</code> on show cover <code>#mydiv</code> and consists of 5 images <code>1px</code> separated from each other. I want to that <code>#otherdiv</code> disappear after <code>mouseout</code> but I get a blinking.</p> <p>How to do it?</p>
jquery
[5]
1,209,281
1,209,282
ClassCastException Explanation
<p>Good day, i was having a little trouble with the following code below and i got a solution from a ticked answer in this link. I would like to know why.</p> <p>Note: i had a similar type of layout as in the question, but with one TextView only.</p> <p><a href="http://stackoverflow.com/questions/6054773/classcastexception-in-my-application">solution link here</a></p> <p>my code below:</p> <pre><code> public void onItemClick(AdapterView&lt;?&gt; av, View v, int position, long id) { blueadapter.cancelDiscovery(); String info = ((TextView) v).getText().toString(); //classcastException here String Bluetooth_address = info.substring(info.length()-17); } </code></pre> <p>so from his solution, if i change this to this</p> <pre><code>String info = ((TextView) v.findViewById(R.id.search_device_id)).getText().toString(); </code></pre> <p>it solves my ClassCastException problem.</p> <p>Now please can someone kindly explain to me or point me to the right direction, what he meant by in the answer <strong>"You receive the whole LinearLayout as the parameter v. You should try v.findViewById() and then use this textview."</strong> its nice it solves my problem, but i would like to understand why i had to do that?.. i have dealt with ListViews before, but i have not come across this, so its kind of strange for me. Thank you.</p>
android
[4]
2,303,742
2,303,743
javascript get type/instance name
<p>Is there a reliable way of getting the instance of a JavaScript object?</p> <p>For example, relying on the fake '<code>obj.getInstance()</code>' function.</p> <pre><code>var T = { Q: { W: { C: function() {} } } }; var x = new T.Q.W.C(); console.log( x.getInstance() === T.Q.W.C); // should output true </code></pre> <p>If this is not part of the ECMA specification, please include browser/node.js support and compatibility in answers.</p>
javascript
[3]
2,660,073
2,660,074
Does it matter if I reuse a variable after running a function with the same variable?
<p>As the title states, does it matter - will it make any difference?</p> <p>Example:</p> <pre><code>$username = $_POST['username']; $username = mysql_real_escape_string($username); </code></pre> <p>Can this cause any problems or is this fine? I've seen a lot of examples, where they create new variables:</p> <p>Example:</p> <pre><code>$username = $_POST['username']; $escaped_username = mysql_real_escape_string($username); </code></pre>
php
[2]
5,875,863
5,875,864
How does iOS determine to apply the autoresizing masks if launched on iPad?
<p><em>I do not know how to explain my question properly, but if anyone understand it is much appreciated else this question can be deleted.</em></p> <p>I am making an universal application I wonder: The code I write in <code>loadView</code> I write positions of components specified in a iPhone points (320, 480). And from the documentation below it says that autoresizing is a response to their superview being moved or resized. So my question is how does the code/views know to autoresize when runned on a iPad? Because, are the superview (which is self.view) really resized? </p> <p>Code you write outside of loadView and attaches to self.view and with iPhone positions (320, 480) are not automatically resized even though you use autoresizing masks.</p> <p>I know this is for Mac OSX but: (Quote from <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaViewsGuide/WorkingWithAViewHierarchy/WorkingWithAViewHierarchy.html" rel="nofollow">Mac OSX Documentation</a>)</p> <blockquote> <p>Autoresizing of Subviews NSView provides a mechanism for automatically moving and resizing subviews in response to their superview being moved or resized. In many cases simply configuring the autoresizing mask for a view provides the appropriate behavior for an application. Autoresizing is on by default for views created programmatically, but you can turn it off using the setAutoresizesSubviews: method.</p> </blockquote>
iphone
[8]
2,993,751
2,993,752
Ideal Data Structure to Deal with XML Data
<p>Maybe a silly question, but I usually learn a lot with those. :)</p> <p>I'm working on a software that deals a lot with XML, both as input and as output, and in between a lot of processing occurs. </p> <p>My first thought was to use internally a dict as a internal data structure, and from there, work my way with a process of reading and writing it.</p> <p>What you guys think? Any better approach, python-wise?</p>
python
[7]
2,942,661
2,942,662
How to determine current stream type in c++?
<p>I am using a template in c++, and I am passing a stream object as an templated argument. How to know the current stream type at run time?</p>
c++
[6]
1,795,178
1,795,179
Multiple recipient mail php not working for second onwards addresses
<p>I have an HTML email needed to be sent to more than one person:</p> <pre><code>$mem = "abc@def.com, qwr@rty.com"; $subject = 'Invitation to Party'; $headers = "From: info@example.com\r\n"; $headers .= "Reply-To: info@example.com\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $message = "SNIPPED"; mail($mem, $subject, $message, $headers); </code></pre> <p>It is sending to the first email which is <code>abc@def.com</code>, but it's not sending mail for the second recipient which is <code>qwr@rty.com</code> and the rest.</p> <p>The email addresses are examples.</p> <p>Is there any work-around for this besides using library?</p>
php
[2]
1,617,239
1,617,240
PHP Real path always returning false
<p>I have a problem with the PHP realpath always returning false how ever I pass the file path string. </p> <p>By default I pass this the the <code>realpath()</code> "/shop/templates/default/css/reset.css", I have also tried:</p> <ul> <li><a href="http://localhost/shop/templates/default/css/reset.css" rel="nofollow">http://localhost/shop/templates/default/css/reset.css</a></li> </ul> <p>What could be causing this to break?</p>
php
[2]
4,892,448
4,892,449
how to do a repeated replace or update in jquery
<p>I've got a page that displays something like this:</p> <p>"Who's turn is it? Jake"</p> <p>Where "Jake" is populated with a jquery statement after an ajax query. something like:</p> <pre><code>$('#whosturnisit').append(result); </code></pre> <p>The problem is of course that it just adds the result each time it runs.</p> <p>I've tried using .hide() and then doing .append(), but without good results.</p> <p>I've also tried using </p> <pre><code>$('#whosturnisit').replaceWith(result); </code></pre> <p>But again, it does not seem to work correctly.</p> <p>My desired result here is that this ajax query runs every X seconds, lets just say 30 seconds, and grabs the name of whoever's turn it is, and displays that name.</p>
jquery
[5]
4,239,778
4,239,779
How to set song as an alarm in iPhone
<p>I want to set any song in my iPhone as an alarm tone. How will I access my songs and set it as an alarm? And can I increase the time of alarm more than 40 secs? I mean i want to play full song as an alarm tone. Thanks</p>
iphone
[8]
1,831,544
1,831,545
How to adapt this iPhone paging control to images instead of colors
<pre><code>+ (UIColor *)pageControlColorWithIndex:(NSUInteger)index { if (__pageControlColorList == nil) { __pageControlColorList = [[NSArray alloc] initWithObjects:[UIColor grayColor], [UIColor greenColor], [UIColor magentaColor], [UIColor blueColor], [UIColor orangeColor], [UIColor brownColor], [UIColor redColor], nil]; } return [__pageControlColorList objectAtIndex:index % [__pageControlColorList count]]; } </code></pre> <p>in this above code,i want to repalce the colors display in each page by changing it to uiimages,,i want to load images insted of colors ,,what can i do to solve this problem,,please help</p> <p>thankzz</p>
iphone
[8]
3,602,576
3,602,577
PHP Bug? With Class?
<p>Here is my code:</p> <pre><code>&lt;?php class Video { protected $_test; } ?&gt; </code></pre> <p>and when I try to include the file containing this code I've got that error:</p> <pre><code>Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in ../classes/Video.class.php on line 1 </code></pre> <p>What's wrong? I don't understand.</p>
php
[2]
5,186,395
5,186,396
Why is this code running before the 'click' event?
<p>I have what seems to be a simple issue. I have a jquery function that's running on page load, despite the fact that I specifically set it to run after the 'click' event on a specific element.</p> <p>This is the function: </p> <pre><code> $('#boxShow').click(function() { $('#colorBox').animate({ height: 'toggle' }, 400, function() { // Code that will run after the click }); }); </code></pre> <p>Is there a way to prevent this code from running before the 'click' event? Thanks!</p> <p><strong>EDIT:</strong></p> <p>The full jquery code:</p> <pre><code>$(document).ready(function() { $("#accordion").accordion({ event: "click" }); $("#TagsSelectBox").multiSelect({ minWidth:130, selectedList:5, showHeader:false }); $('#boxShow').click(function() { $('#colorBox').animate({ height: 'toggle' }, 400, function() { // Animation complete. }); }); $('#test').colorPicker({ defaultColor: 0, // index of the default color (optional) columns: 13, // number of columns (optional) click:function(c){ $('#boxShow').css("background-color",c); } }); }); </code></pre> <p><strong>EDIT:</strong> Just in case anyone wants to know, here's the final version after making a few adjustments to make it generic enough for multiple 'color-pickable' items:</p> <p><a href="http://pastebin.com/pma0DNCB" rel="nofollow">Final Version</a></p> <p>If you want to try it out yourselves, you can download the color picker plugin from the syronex site. The link is in the comments!</p> <p>Thanks to everyone who helped me achieve this!</p>
jquery
[5]
5,891,745
5,891,746
Include upper bound in range()
<p>How can I include the upper bound in range() function? I can't add by 1 because my for-loop looks like:</p> <pre><code>for x in range(1,math.floor(math.sqrt(x))): y = math.sqrt(n - x * x) </code></pre> <p>But as I understand it will actually be <code>1 &lt; x &lt; M</code> where I need <code>1 &lt; x &lt;= M</code> Adding 1 will completely change the result. I am trying to rewrite my old program from C# to Python. That's how it looked in C#:</p> <pre><code>for (int x = 1; x &lt;= Math.Floor(Math.Sqrt(n)); x++) double y = Math.Sqrt(n - x * x); </code></pre>
python
[7]
808,996
808,997
Why I'm getting this errors? Delegate 'System.Func<MusicTop.Data.Song,int,bool>' does not take 1 arguments
<p>I'm getting this errors in this line of code: </p> <pre><code>var result = context.Songs.Include("Weeks") .Where(c =&gt; c.WeekID == weekIdFilter).ToList(); </code></pre> <blockquote> <p>1.Cannot convert lambda expression to type 'string' because it is not a delegate type</p> <p>2.Delegate 'System.Func' does not take 1 arguments</p> <p>3.Operator '==' cannot be applied to operands of type 'int' and 'System.Guid'</p> </blockquote>
asp.net
[9]
2,611,837
2,611,838
Javascript .js loading issue
<p>I am editing an existing site, which is a typical merchant site. A series of PHP files with one main index that loads in the various content pages.</p> <p>The main index.php, using <code>&lt;script&gt;</code>, loads in jsFunctions.js. </p> <p>When ever I modify the jsFunctions.js file, the index only loads the jsFunctions.js partially. For example I will get a firebug error such as 'unterminated string literal' or 'missing end }' or similar. The errors themselves make sense, because the js file isn't fully loading, a brace or quote is missing and throwing an error. It is seemingly random, sometimes it will load 100 lines of the js, then sometimes 105 lines, etc. </p> <p>But why would the file be partially loading if i edit it? If i remove the single line of my code, no matter how simple, it starts working again?</p> <p>Any ideas?</p>
javascript
[3]
1,488,056
1,488,057
How to access module-level names in Python?
<p>I have the following code:</p> <pre><code>import m def f(m=None): if m is None: k = m.M() # I want this m to refer to the imported module, not the parameter </code></pre> <p>I would really prefer to keep both the parameter name and the module name the same. Is there a way explicitly to refer to the module m?</p>
python
[7]
2,146,019
2,146,020
How is this argument making its way to a called function?
<p>code:</p> <pre><code>function onDeviceReady() { window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail); } function gotFS(fileSystem) { fileSystem.root.getFile("readme.txt", {create: true, exclusive: false}, gotFileEntry, fail); } </code></pre> <p>What I don't understand is how does fileSystem get passed when there are no arguments passed with gotFS in the requestFileSystem?</p>
javascript
[3]
5,619,909
5,619,910
MapReduce Java Program Error: java.lang.RuntimeException: Error in configuring object
<p>I have run a MapReduce (older API) java program and run in Hadoop. I have not set some configuration right and I don't get my error. I tried with various workarounds but I get similar errors repeatedly.</p> <p>Let me paste the complete program.</p> <p>The error message is too long and I have pasted the first few lines. It appeares like I am not using the right packages or invoking the map fucntion. It would be great help if anyone would want to share the thoughts. Thanks.</p>
java
[1]
2,907,596
2,907,597
Possible to continue script execution if require_once fails?
<p>Is it possible to continue PHP script execution even if require_once fails? If so, how?</p>
php
[2]
4,583,114
4,583,115
Activity.showDialog(int), Activity.removeDialog(int) deprecated
<p>In this question <a href="http://stackoverflow.com/questions/3170308/dialog-show-vs-activity-showdialog?rq=1">Dialog.show() vs. Activity.showDialog()</a> it was recommended to use showDialog() that was 2010. I need to support Android 2.1-4.1 so should I keep this deprecated code or change it? Reason for deprecation?</p>
android
[4]
5,430,574
5,430,575
How to combile the label and textfield in same line with littel bit space?
<p>iam developing one application.In that i use the label and textfield in same line.Every label contain the different size of text.And i place the textfield after the completing the label width.But i want to place the textfield after completion of label text.For example in my view Server name: is the label ans naresh is the textfield.I got like Server name:space Naresh.But i want like Server name:Naresh.So please tell me how to do this.</p>
iphone
[8]
3,517,914
3,517,915
Do apps created on the lower android versions gets supported in the newer versions?
<p>We are planning to create an android application for our web application. I have noticed that the latest android sdk is 4.0 but many mobiles on market just run on lower versions. If creating an app in lower version is supported in higher versions, which would be the most advisable version of android to start working with?</p>
android
[4]
1,692,848
1,692,849
Use CloudMade on iphone:How can we know if RMMapView load complete?
<p>I just start learn to use RMMapView to make some example.As I know, if we use MKMapView we can implement some methods to see loading map status like:</p> <pre><code>- (void)mapViewWillStartLoadingMap:(MKMapView *)mapView - (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView - (void)mapViewDidFailLoadingMap:(MKMapView *)mapView withError:(NSError *)error </code></pre> <p>But if use RMMapView, Does we have any function like that ? I just try to catch even when RMMapView finish load and save data into database.</p> <p>Thank and best regards for any supporting.</p>
iphone
[8]
3,040,106
3,040,107
jQuery is not defined
<p>I <strong>have to use an external js file, in which I load the jquery</strong>. My js file look like this:</p> <pre><code> document.write('&lt;script language="javascript" type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"&gt;&lt;/script&gt;'); (function($) { $(document).ready(function() { alert('it works!!'); }); })(jQuery); </code></pre> <p>On the firefox console I get the "jQuery is not defined" and I think it is because the jQuery library is loaded after the $ function from my js file.</p> <p>Do you have any idea about how can I fix this? If I run the script from the FF console all works fine.</p>
jquery
[5]
5,910,790
5,910,791
Why does the line keyboard = new Scanner(keyboard.nextLine()); keep the program from hanging?
<p>I have been trying to figure out how to input multiple tokens at one time using the <code>Scanner</code> class. I found some code that works perfectly. I know that the <code>Scanner.hasNext</code> method can block indefinitely. Why does the line <code>keyboard = new Scanner(keyboard.nextLine());</code> in this code keep it from doing this?</p> <pre><code> Scanner keyboard = new Scanner(System.in); LinkedList&lt;String&gt; ll = new LinkedList&lt;String&gt;(); System.out.println("Please enter your full name: "); keyboard = new Scanner(keyboard.nextLine()); while(keyboard.hasNext()) { System.out.println("tag "); ll.add(keyboard.next()); } System.out.println(ll); </code></pre> <p>Thanks!</p>
java
[1]
990,892
990,893
How to change Filename in URL
<p>I have two field in database "FileName" and "UrlFileName",so I sanitize "FileName" from Invalid character to have a new file Name for example "FinaleFileName",so my question is I need a simple code or function to change the name of file in URL too before stored my both field in DB,for example : </p> <pre><code>$FileName = "NaMeoFImagE-10.jpeg" $UrlFileName = "uploads/pics/NaMeoFImagE-10.jpeg" .... //I had created a function to remove or replace a invalid character //Ok $FinaleFileName= nameofimage-10.jpeg ..... A function to replace a File name in URL // Not OK $FinaleUrlFileName = "uploads/pics/nameofimage-10.jpeg"// Im looking for this result </code></pre> <p>Any Idea?</p>
php
[2]
1,682,273
1,682,274
android: i want to wait for WebView finishing excuting script
<p>i want to get the html including javascript from web.</p> <p>my code is like this</p> <p>public class HogeActivity extends Activity {</p> <pre><code>@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final WebView webView = new WebView(this); webView.getSettings().setJavaScriptEnabled(true); webView.setWebViewClient(new HogeWebViewClinet()); webView.addJavascriptInterface(new WebViewLogger(), "webViewLogger"); webView.loadUrl("http://www.example.com/"); setContentView(webView); } class HogeWebViewClinet extends WebViewClient { @Override public void onPageFinished(WebView view, String url) { view.loadUrl("javascript:window.webViewLogger.log(document.documentElement.outerHTML);"); } } class WebViewLogger { public void log(String str) { Log.d("webViewLogger", str); } } </code></pre> <p>}</p> <p>the URL in this code including javascript.</p> <p>i override onPageFinished to wait for finishing process and put result at WebViewLogger class.</p> <p>i must wait for excuting javascript,but onPageFinish waits only to load page ,dont wait to execute javascript.</p> <p>what is the best way to wait to execute javascript?</p>
android
[4]
5,906,879
5,906,880
maintain state of radiobutton onclick change index
<p>i have three radio button. and each have gridview. like rd1 for communication rd2 for course content rd3 for student <strong>when i click rd1 then shows rd1 gridview then i fills rd1 grid view and click on rd2 and do same but when i click on rd1 again there is nothing to show any fill record. and at the end when submit button click then all three gridvalues saves. how to do this (maintain state and at the end save)</strong></p> <pre><code>if (RadioButton1.Checked == true) { fun_Call(button.Text); } //next option radio....... if (RadioButton2.Checked == true) { fun_Call(button.Text); } //next option radio....... if (RadioButton3.Checked == true) { fun_Call(button.Text); } //next option radio....... </code></pre>
asp.net
[9]
5,782,301
5,782,302
Fullscreen UIView with Status bar and Navigation Bar overlay on the top
<p>What is the proper way to implement the status bar and navigation bar that go on top of an UIView?</p> <p><img src="http://img.skitch.com/20081217-t78sdixk37hqgdh1ia2fgec4st.png" alt="alt text" /></p>
iphone
[8]
5,846,309
5,846,310
Javascript shortest possible check for undefined, if it is assign a default value
<p>If passing params or an object full of properties into function, it's useful to check for undefined params and give default values to those that are undefined.</p> <p>Without using a library function like jQuery extent, what would be the shortest about of code to do this kind of assigning defaults?</p> <p>Here is the shortest I can think of:</p> <pre><code>var test; var output = (typeof test != "undefined") ? test : "Default"; </code></pre> <p>Before someone suggests:</p> <pre><code>var test; var output = test || "Default"; </code></pre> <p>That will not work with false, 0 or ""</p>
javascript
[3]
2,475,531
2,475,532
Saving an image using js
<p>I am stuck at a point where I am getting an image from the server as a binary data and i need to save this image on my PC without any user interference. </p>
javascript
[3]