Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
5,030,395
5,030,396
Little help with some (simple) Javascript code
<p>I'm a newb when it comes to javascript. Perhaps somebody could help me with this. I assume it is not very complicated. This is what I would like:</p> <pre><code>&lt;SCRIPT type=text/javascript&gt; var StandardURL = "http://site/Lists/test/AllItems.aspx"; &lt;/script&gt; &lt;SCRIPT type=text/javascript&gt; var FilterURL = "http://site/Lists/test//AllItems.aspx?FilterField1=Judge&amp;FilterValue1="; &lt;/script&gt; </code></pre> <p><code>var DynamicURL = FilterURL + DynamicUserInf</code> (no space between it should be like one url link), dynamicuserinf contains different value depending on the user that is logged in no need to worry what is in it. It already contains a value befor this runs</p> <p><code>var CurrentURL = current URL where this script is loading</code></p> <pre><code>&lt;script language="JavaScript" type="text/javascript"&gt; if (CurrentURL == StandardURL) { location.href= (DynamicURL);} &lt;/script&gt; </code></pre> <p>ElSE do nothing (i assume this is not neccarry with only one if statement)</p> <p>Hopefully not much of a mess.</p>
javascript
[3]
2,830,817
2,830,818
During the publishing of a .Net web application, what's the best way to make the application unavailable to users?
<p>When you publish a .Net application - what's the easiest way to put something up for users that says 'this application is currently being upgraded, please try later'</p>
asp.net
[9]
2,864,855
2,864,856
What source code process statusbar animation?
<p>I use status bar notify. </p> <p>For a short time, status bar display notify animation. Maybe 1 sec.</p> <p>This animation show cropped icon. What source code process this animation?</p> <pre><code>Notification notification = new Notification(icon, ... notification.setLatestEventInfo(context ... notification.notify(); </code></pre>
android
[4]
2,809,916
2,809,917
Loading images in gridview [universal image loader]
<p>I'm trying to use the universal image loader to load images into a gridview but my app seems to be crashing right when the activity loads and I cant identify the problem. I'm loading the images from an array then calling the image adapter to populate them. </p> <p>I debugged through the application but didn't see anything prominent in LogCat.</p> <p>All help will be greatly appreciated :)</p> <pre><code>public class MainActivity extends Activity { String[] imageUrls; DisplayImageOptions options; protected ImageLoader imageLoader = ImageLoader.getInstance(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Bundle bundle = getIntent().getExtras(); imageUrls = bundle.getStringArray(Extra.IMAGES); options = new DisplayImageOptions.Builder() .showStubImage(R.drawable.stub_image) .showImageForEmptyUri(R.drawable.image_for_empty_url) .cacheInMemory() .cacheOnDisc() .bitmapConfig(Bitmap.Config.RGB_565) .build(); GridView gridView = (GridView) findViewById(R.id.gridview); gridView.setAdapter(new ImageAdapter()); } public class ImageAdapter extends BaseAdapter { @Override public int getCount() { return imageUrls.length; } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { final ImageView imageView; if (convertView == null) { imageView = (ImageView) getLayoutInflater().inflate(R.layout.item_grid_image, parent, false); } else { imageView = (ImageView) convertView; } imageLoader.displayImage(imageUrls[position], imageView, options); return imageView; } } } </code></pre> <p><strong>EDIT: Logcat Error: "AndroidRuntime(6789): java.lang.RuntimeException: ImageLoader must be init with configuration before using"</strong></p>
android
[4]
1,721,136
1,721,137
patterns/patterns for designer-webdeveloper communication
<p>as the title implies i am searching for a good pattern / schema collection that makes designer &lt;-> webdeveloper communication less ambiguous when it comes to javascript effects and dynamic content loading.</p> <p>google just provided me with the shorthand markup by ryan singer, but this seems to be restricted to page/ui flows.</p> <p>can you recommend any commonly used / efficient patterns?</p>
javascript
[3]
1,356,688
1,356,689
ASP.NET: Static Class in App_Code
<p>If a static class is put in App_Code, does that imply only <strong>one instance</strong> will be created, shared by different http requests?</p> <p>Or each request still brings one request?</p> <p>Thanks.</p>
asp.net
[9]
3,834,010
3,834,011
JavaScript: How to find out when images are turned off in browser?
<p>Would like cross-browser solution.</p>
javascript
[3]
953,761
953,762
Jquery traversing images
<p>I'm trying to write a way of handling a button press so that a div can expand &amp; collapse and a button updates from reading 'open' to 'hide' (along with updating ALT tags). The toggling part is fine. I just can't get my head around the traversing aspects. </p> <p>Two buttons are presented but CSS is applied so only one is shown (the open one). When clicked the hideImage needs to be visible and the openImage needs to be removed. Pretty straightforward.</p> <p>Here is the HTML: </p> <pre><code>&lt;tr&gt; &lt;td&gt;text&lt;/td&gt; &lt;td class="tdclass"&gt;&lt;a href="" class="hrefclass"&gt;&lt;img src="openImage.gif" class="openImage" border="1"&gt;&lt;/a&gt; &lt;td class="tdclass"&gt;&lt;a href="" class="hrefclass"&gt;&lt;img src="hideImage.gif" class="hideImage hiddenImage" border="1"&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>Is there an easy way of doing this with JQuery?</p> <p>Also, why doesn't this work?</p> <pre><code>$('.openImage').parent().parent().find('.hideImage') </code></pre> <p>I have assumed that I can traverse back up to the and find the 'hideImage' class. </p> <p>Help!</p>
jquery
[5]
394,401
394,402
Python global variable is not working as expected
<p>I'm just starting out with Python and experimenting with different solutions. I was working with global variables and I ran into something but don't know why it's doing what it's doing.</p> <p>To start, I have two modules: test1 and test2. test1 is as follows:</p> <pre><code>import test2 num = 0 def start(): global num num = num + 5 print 'Starting:' print num test2.add() print 'Step 1:' print num test2.add() print 'Step 2:' print num </code></pre> <p>And test2 is this:</p> <pre><code>import test1 def add(): test1.num = test1.num + 20 </code></pre> <p>When I run test1.start() the output is:</p> <blockquote> <p>Starting:<br> 5<br> Step 1:<br> 25<br> Step 2:<br> 45</p> </blockquote> <p>Why doesn't test2 need the global declaration to modify the variable in test1? Line 5 in test1 requires it at line 4, but if I remove both it still works (0, 20,40). I'm just trying to figure out why it's not working as I expected it to.</p> <p>Thanks.</p>
python
[7]
1,755,329
1,755,330
php code analysis
<pre><code>$test = 'aaaaaa'; $abc = &amp; $test; unset($test); echo $abc; </code></pre> <p>It outputs 'aaaaaa',which is already unset,can you explain this?</p>
php
[2]
4,038
4,039
Write ASP.NET aspx page output to server-side disk
<p>I am writing an application which produces reports. I want to save the generated html server side to the disk for another application to use.</p> <p>The response objects only expose streams for writing data. I need to read the data from the response and write it to disk.</p> <p>Is there a more graceful way of doing this than creating a front-end which receives the user request, programattically makes a separate report http request, saves the response to disk and writes it to the user?</p>
asp.net
[9]
609,711
609,712
How to reload the same page on a button click , with the data from database and ignoring the changes
<p>I have an aspx page with repeater control on it used for showing the data.The user can modify the data inside the repeater but the data will not get saved until the SAVE button is hit. I also have an UNDO button on the page. If the user clicks this button, I want to reload the page and discard the changes made by user (similar to UNDO functionality in MS Office) I need to show him the same data that was shown when the page was loaded for the first time.</p> <p>Kindly help me with this.</p> <p>Thank you ! </p>
asp.net
[9]
2,786,109
2,786,110
Using foreign keys and ContactsContract
<p>I'm building an app where I need the user to select some "favorite" contacts and a phone number. I'm able to select a contact using </p> <pre><code> startActivityForResult(new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI), PICK_CONTACT_REQUEST); </code></pre> <p>and I'm able to extract all the information I need. </p> <p>I then proceed to save the _id of the contact into my own database. My plan is to later list all the "favorited" contacts and display the name and phonenumber in a listview. </p> <p>I want to save the contact id instead of the name and number so my listview will reflect any changes the user makes to his or her contacts.</p> <p>But now I'm stuck. I don't know how to transform my table with contacts ids into a table with contact names. </p> <p>I would like to something like this</p> <pre><code>my_table LEFT OUTER JOIN contacts_table ON (my_table.contact_id = contacts_table._id) </code></pre>
android
[4]
3,125,146
3,125,147
How can I check whether the current account has reviewed my Android application in Google Play?
<p>Currently in my Android application I have a popup that brings the user to my application in the Google Play store so they can review my application. I would like to display the popup only if the current user account has not reviewed my application yet. Is it possible to check if the account has already written a review or rated the application?</p>
android
[4]
2,083,995
2,083,996
PHP : Can I compile/build my site like .NET?
<p>I am new to PHP, and working on a class based web site. So my question is simple. Can I compile the site like I can in .NET?</p> <p>This would be helpful to me because I changed my IsAAction interface to accept an error callback function as a parameter of the Execute function, and I would like all of my implementations to break so I can easily see where to change them.</p> <p>Thanks in advance.</p>
php
[2]
2,570,296
2,570,297
I want to share my data to social sites available in my android device. How can I write android code for that in my app?
<pre><code>SocAdapter = new SocialAuthAdapter(new ResponseListener()); // Add providers SocAdapter.addProvider(Provider.FACEBOOK, R.drawable.facebook); SocAdapter.addProvider(Provider.TWITTER, R.drawable.twitter); SocAdapter.addProvider(Provider.LINKEDIN, R.drawable.linkedin); SocAdapter.addProvider(Provider.MYSPACE, R.drawable.myspace); SocAdapter.enable(share); </code></pre> <p>I need total social sites in my device . How can I get them dynamically without writing like this.</p>
android
[4]
2,897,366
2,897,367
PHP5 mysql examples
<p>where will I find PHP5, mysql OOP examples? Whta I mean is common class library with examples. </p>
php
[2]
5,055,675
5,055,676
How to remove label from MapView?
<p>I am trying to make only satellite view without label. </p> <p>How to do it ?</p> <p>Thanks.</p>
android
[4]
5,838,749
5,838,750
Sending the same form with 1 different field n number of times
<p>Right now, I have 3 part of my code working:</p> <ul> <li>I have a form that I wish to add n number of names.</li> <li>The names are put into an array.</li> <li>A loop iterates through the array with a delay</li> </ul> <p>But I want to submit the form on every iteration with the new name attached.</p> <p>The form is always submitted (target is an iframe) with the last name yet you can see from my debugging commented out code that an alert will pop up (with a delay) for every name in the array.</p> <pre><code>&lt;script&gt; function getUsers() { var separateUsers = document.getElementById("Requestors").value.split("\n"); //document.write(separateUsers[1]); for (var i=0;i&lt;separateUsers.length;i++) { sleep(400); document.sendForm.userName.value = (separateUsers[i]); //alert("Loop iteration "+separateUsers[i]+ " " +i+ " out of"+ i); document.getElementById("sendForm").submit(); //document.write(sendForm.userName.value); } } function sleep(ms) { var dt = new Date(); dt.setTime(dt.getTime() + ms); while (new Date().getTime() &lt; dt.getTime()); } &lt;/script&gt; &lt;form name ="sendForm" id="sendForm" action="form.php" method="post" enctype="multipart/form-data" target="theTarget"&gt; &lt;input type="hidden" name="userName" id="userName" value="" /&gt; &lt;/form&gt; &lt;form name ="initialForm"&gt; &lt;textarea name="Requestors" cols="10" rows="10" value= ""&gt;&lt;/textarea&gt; &lt;input type="button" onclick="getUsers()" value="Submit" /&gt; &lt;/form&gt; &lt;iframe id="theTarget" name ="theTarget" &gt;&lt;/iframe&gt; </code></pre>
javascript
[3]
5,818,125
5,818,126
Jquery event does not work on dynamically created html
<pre><code>&lt;li&gt; &lt;label&gt;Chapter Title&lt;/label&gt; &lt;input type="text" name="chapter[1][title]" /&gt; &lt;/li&gt; &lt;li&gt; &lt;label&gt;Text&lt;/label&gt; &lt;textarea name="chapter[1][text]" &gt;&lt;/textarea&gt; &lt;/li&gt; &lt;li&gt; &lt;input type="file" name="image2" id="image2" /&gt; &lt;img id="thumb2" width="100px" height="100px"/&gt; &lt;input type="hidden" id="image_src2" name="chapter[1][photo]" /&gt; &lt;/li&gt; &lt;li id="caption2" style="display:none;"&gt; &lt;label&gt;Photo Caption&lt;/label&gt; &lt;input type="text" name="chapter[1][photo_caption]" /&gt; &lt;/li&gt; </code></pre> <p>The form fields and javascript code is created dynamically.</p> <pre><code>var thumb = $('img#thumb2'); new AjaxUpload('image2', { action: "action", name: 'userfile', onSubmit: function(file, extension) { $('div.preview').addClass('loading'); }, onComplete: function(file, response) { thumb.load(function(){ $('div.preview').removeClass('loading'); thumb.unbind(); }); thumb.attr('src', response); $('#image_src2').val(response); $('#image_src2').live('change',function() { $('#caption2').show(); // this does not work }); } }); </code></pre> <p>the image is uploading well and the thumbnail is shown but the caption field does not show up and no error is shown.</p>
jquery
[5]
3,396,135
3,396,136
verify URL is live and running or not
<p>I will be taking URL from user. Now I need to verify whether address is live or not.</p> <p>For example:</p> <p>If user enters "google.com", then I will pass "google.com" as argument to some function, and function will return me TRUE if URL is live, upload and running, otherwise FALSE.</p> <p>Any in-built function or some help.</p>
php
[2]
4,384,138
4,384,139
How do I reference a specific class type in C#?
<p>Is it possible to obtain a reference/pointer to a class type and enforce that it derives from a particular base class?</p> <p>I'm writing a client library that needs to negotiate with a server to pick an algorithm to use for communication. I want the user of the library to be able to select a subset of algorithms to use and not be fixed to the set I initially provide (ie. not fixed in some kind of factory class).</p> <p>Ideally this would be done by passing in a list of classes that derive from some common "Algorithm" subtype. I've seen the "Type" object but I would have to check all the types myself. Is there a way to have the compiler do this for me? What I want is something like "Type&lt;Algorithm&gt;" but I can't find anything like that. Or is there different way entirely to do this?</p> <p>An example of what I've thought of so far:</p> <pre><code>public class Algorithm { public static abstract Name; } public class Client { public MyLib(Type[] algorithms) { m_algorithms = algorithms; // ... Check they all derive from Algorithm } public Communicate() { // ... Send list of algorithm names to server // ... Create instance of algorithm dictated by server response } } </code></pre>
c#
[0]
4,192,664
4,192,665
Code not reaching "finally" block
<p>The given java code is not going to the <code>finally</code> block, I thought these blocks were supposed to execute no matter what:</p> <pre><code>public static void main(String[] args) { try { System.out.println("Hello world"); System.exit(0); } finally { System.out.println("Goodbye world"); } } </code></pre>
java
[1]
4,112,518
4,112,519
Can i reference an exe in a class library?
<p>Can i reference an exe in the class library which in turn is used by excel. I have referenced the project reference in class library(dll). My exe will run whenever i open excel or if it is running it will point to it as it is singleton. while exe is running some of the global values will change.but whenever i am using some function of dll from the excel , it is not using changed values instead it is using unchanged values. How do i see that every exe will point to same exe and values are from it.</p> <p>Thanks</p>
c#
[0]
2,196,500
2,196,501
Concept of Benchmarking in C#?
<p>Please tell me something about Benchmarking in C#..What the different code benchmarking techniques are?? How to benchmark our own code based on speed and memory usage?? Please help me guys..Thanks </p>
c#
[0]
4,427,902
4,427,903
C# - Array Copying using CopyTo( )-Help
<p>I have to copy the following int array in to Array :</p> <pre><code>int[] intArray=new int[] {10,34,67,11}; </code></pre> <p>i tried as</p> <pre><code>Array copyArray=Array.CreateInstance(typeof(int),intArray.Length,intArray); intArray.CopyTo(copyArray,0); </code></pre> <p>But ,it seems i have made a mistake,so i did not get the result.</p>
c#
[0]
2,722,141
2,722,142
Onclick Reload page
<p>Hi currently i have a problem with my Onclick because it wont reload on my page This is what i have. </p> <pre><code> &lt;div id="vpanel"&gt; &lt;div&gt; &lt;form method="post" action="enrollalpha.php"&gt; &lt;label&gt;View Panel&lt;/label&gt; &lt;select name="Vpanel" onclick="return.this.form"&gt; &lt;option value="VS"&gt;Students&lt;/option&gt; &lt;option value="VSc"&gt;Section&lt;/option&gt; &lt;option value="VA"&gt;Adviser&lt;/option&gt;&lt;/select&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>And will be used in this code on the same page.</p> <pre><code> &lt;form method="post" action=""&gt; &lt;div id="tbody" class="scrollbar"&gt; &lt;?php if(!empty($_POST['Vpanel'])){ $vview = $_POST['Vpanel']; }else{ $vview = 'VS'; } if($vview == 'VS'){ require_once 'vpanel_student.php'; }else if($vview == 'VSc'){ require_once 'vpanel_section.php'; }else if($vview == 'VA'){ require_once 'vpanel_adviser.php'; }else{ require_once 'vpanel_student.php'; } ?&gt; &lt;/div&gt; </code></pre> <p>Would appreciate any help on what I'm doing wrong.</p>
php
[2]
1,226,234
1,226,235
i th order statistic in Python
<p>Given a list of <code>n</code> comparable elements (say numbers or string), the optimal algorithm to find the <code>i</code>th ordered element takes <code>O(n)</code> time.</p> <p>Does Python implement natively <code>O(n)</code> time order statistics for lists, dicts, sets, ...?</p>
python
[7]
5,332,506
5,332,507
is there any simple way to find out unused strings in android project?
<p>I have a huge android project with many strings declared in strings.xml. I wanted to remove un-used strings in strings.xml. Is there any easy way to do so?</p> <p>Thanks</p>
android
[4]
1,193,991
1,193,992
how to import a sql file into mysql database dynamically?
<p>I have a sql file exported from mysql database. I want to import that database into another mysql database dynamically. How can i do this ?</p>
php
[2]
1,801,733
1,801,734
disable android bluetooth
<p>I have the code that enables the blueooth on a device. </p> <pre><code>Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBtIntent, 1); </code></pre> <p>I am wondering how can I disable it?</p>
android
[4]
4,806,407
4,806,408
single character arithmetics?
<p>I need to invent my own conversion function because of some encoding issue. I decided that for now I will create a conversion table for my characters.</p> <p>I want to know how I can possibly do an operation like the following C code to print out characters 'a' to 'z':</p> <pre><code>char a='a'; for(i=0;i&lt;26;i++){ printf("%c",a); } </code></pre> <p>How can I do that (incrementing characters value by value) in PHP ?</p>
php
[2]
980,372
980,373
how to keep text on imageview in android?
<p>i want to display text on image view.</p>
android
[4]
499,922
499,923
basic php question
<p>Sorry for the poor title, but as im not a experinced programmer i could think of a better one</p> <p>Instead of storing errors in arrays, then show a list of errors in some of my forms i would like to show them next to the input field. Its so sexy!</p> <p>How would you suggest I do this?</p> <p>Set a variable like, $wrongemail = 1;, $tooshortpass = 1; if wrong is wrong and then check in the form?</p> <pre><code>if (!preg_match($regex, $email)) $errors[] = "Invalid email address"; if (strlen($password) &lt; 4) $errors[] = "Password too short"; // No errors? if (count($errors) == 0) { // success } else { foreach ($errors as $error) echo '&lt;li&gt;'.$error.'&lt;/li&gt;'; } &lt;table cellspacing="5" cellpadding="0"&gt; &lt;tr&gt; &lt;td width="70px"&gt;Email:&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="email" class="textinput" /&gt;&lt;/td&gt; &lt;td class="red"&gt;&lt;?php if error with email print here ?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Password:&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="password" class="textinput" /&gt;&lt;/td&gt; &lt;td class="red"&gt;&lt;?php if error with password print here ?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&lt;input type="submit" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>
php
[2]
3,402,256
3,402,257
Toiling with HTMLEditorKit
<p>Im a novice Java programmer trying to use the HTMLEditorKit library to travers a HTML document and alter it to my linking (mostly for the fun of it, what im doing could be done in hand without a problem)</p> <p>But my problem is: After i have modifed my HTML file i am left with a HTMLDocument that i have no clue how to save back to a HTML file.</p> <pre><code> HTMLEditorKit kit = new HTMLEditorKit(); File file = new File("local file") HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE); InputStreamReader(url.openConnection().getInputStream()); FileReader HTMLReader = new FileReader(file); kit.read(HTMLReader, doc, 0); </code></pre> <p>after that i do my thing with the "doc" element.</p> <p>Now that im done with that i just want to save it back, preferablly overwriting the file which i got HTML from in the first place.</p> <p>Anyone able to tell me how to save the modified HTMLdocument into a html file afterwards?</p> <p>Regards Rasmus</p>
java
[1]
1,273,631
1,273,632
how to let user know that name already exists
<p>New programmer- I have created a function to add a user to a database. This function is found in class USER. I have set up mysql to have user_name as a unique key. If a user tries to enter a name that already exists it is not entered into the mysql database but my form says ok its been submitted and just moves to the next page. I want to let the user know that the name already exists and create an error on the registration form. Is there a way to append that to this function?</p> <pre><code> function add_member($name, $email, $password) { global $mysqli; $query = "INSERT INTO members SET user_name = '".addslashes($name)."', user_email = '".addslashes($email)."', password = '". md5($password) ."'"; $success = $mysqli-&gt;query ($query); if (!$success || $mysqli -&gt; affected_rows == 0) { echo "&lt;p&gt; An error occurred: you just are not tough enough!!! &lt;/p&gt;"; return FALSE; } $uid = $mysqli -&gt; insert_id; return $uid; if (!$found_error) { header("location: homepage.php"); } </code></pre>
php
[2]
2,382,025
2,382,026
How to find Windows Taskbar location and size?
<p>I have created an application that runs in the system tray. When the user single- clicks the try icon, a small form comes up in the bottom right corner of the screen, i.e. right above the system tray. The form is basically "sticky" to the tray.</p> <p>Here is my question: How do I accomplish the same thing, even if the user has the taskbar docked somewhere else? Like at the top of the screen, or one of the sides?</p> <p>It shouldn't be hard, since I figure all I have to do is find out <em>where</em> the taskbar is. Is it at the bottom, the top, or one of the sides. But I can't find any documentation anywhere, that explains how to get the location and position of the taskbar.</p> <p>Any one has any idea about this ?</p>
c#
[0]
1,762,813
1,762,814
Un-named parameter in function definition
<p>I understand that function prototypes don't need to have a name associated with the parameters. For example:</p> <pre><code>void foo(int, std::string); </code></pre> <p>I was interested to find out recently that you could do the same thing in a function definition though:</p> <pre><code>void* foo(void*) { std::cerr &lt;&lt; "Hello World!" &lt;&lt; std::endl; } </code></pre> <p>Why does this work and how could you ever make use of an un-named parameter? Is there a reason this is allowed (like maybe dealing with legacy interfaces or something along those lines)?</p>
c++
[6]
4,470,155
4,470,156
uieditfield validation to allow specific character and match some specifc character
<p>How to check to this string</p> <pre><code>for example: 1=https://wwww.example.com or may be .net 2=https://example.com 3=https://example.com/ similar with http: </code></pre> <p>if user enter only example.system give error if above format will come.android allow to access our resources.if format is correct and user want to enter more than above format character then android does not allow to enter in uiedittextfield</p>
android
[4]
1,463,173
1,463,174
how to assign variable value to jquery?
<pre><code>var s="attr" var i=$(s) // jQuery(elem).attr(attr,eval("elm"+attr)); jQuery(elem).$(s)(attr,eval("elm"+attr));//i tried this. </code></pre> <p>how to assign a variable name in the above code(in place of s) so that i need to add an attribute to the element "elem".</p>
jquery
[5]
853,214
853,215
How to use Contains(Of T)(T) method?
<p>I have a byte list variable which I store byte array information here:</p> <pre><code>internal List&lt;Byte&gt; portBuffer = new List&lt;Byte&gt;(); </code></pre> <p>And I have another byte array variable:</p> <pre><code>byte[] ret_bytes = { 0x4F, 0x4B }; </code></pre> <p>How can I find out if ret_bytes is inside the portBuffer? The code below seems like not correct.</p> <pre><code>portBuffer.Contains(ret_bytes) </code></pre> <p>Another question, how to find out the position of the first element of ret_bytes in side the portBuffer list if it is inside the list?</p> <p>Thanks</p>
c#
[0]
857,480
857,481
New File() - The operation is insecure
<p>I've a problem with javascript. I'm making a AJAX based upload and have an array of all files uploaded. If the site is reloaded I want to restore all files to the array.</p> <p>I do like this:</p> <pre><code>var file = new File({the url to the file on my server}); </code></pre> <p>And I get:</p> <pre><code>SecurityError: The operation is insecure. </code></pre> <p>I use the same origin, and on my local server: mylocal:88/init.php?page=upload</p> <pre><code>var file = new File('http://mylocal:88/init.php?file=12345'); </code></pre> <p>Gives me this error. Port, protocol and domain is the same.</p> <p>Why and how to create a new file without getting this error?</p>
javascript
[3]
40,041
40,042
How to treat the last element in list differently in Python?
<p>I need to do some special operation for the last element in a list. Is there any better way than this?</p> <pre> array = [1,2,3,4,5] for i, val in enumerate(array): if (i+1) == len(array): // Process for the last element else: // Process for the other element </pre>
python
[7]
800,774
800,775
Return single string from database
<p>I have this query in my database helper requesting a <code>Google map</code> <code>URL</code>string,</p> <pre><code>public String getBeachMap(String id) { String[] args = {id}; String strMap = getReadableDatabase().rawQuery("SELECT _id, BeachMap FROM Beach WHERE _id=?", args).toString(); return(strMap); } </code></pre> <p>And this in my activity,</p> <pre><code>theUrl = dbBeachHelper.getBeachMap(passedVar); Toast.makeText(getBaseContext(), theUrl, Toast.LENGTH_SHORT).show(); </code></pre> <p>The passedVar is being sent through and I have no problem returning a cursor, but I just want a string, I think! <code>theUrl</code> has some random value in it! Am I close to receiving a string?</p> <p>Cheers,</p> <p>Mike.</p>
android
[4]
3,398,300
3,398,301
Adding numbers read from a file to a totalAmount initialized to 0 giving an unexpected result
<p>I have a small homework application that writes random numbers from 5 to 77 to a text file, and then a separate application that reads the file and totals the numbers.</p> <p>Here is my code for writing the numbers to the text file...</p> <pre><code>Random r = new Random(); int min = 5; int max = 77; int[]randomNumbers = new int[1000]; try { PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("myTextFile.txt")), true); for(int i = 0; i &lt; randomNumbers.length; i++) { randomNumbers[i] = r.nextInt(max - min + 1) + min; pw.println(randomNumbers[i]); } } catch(IOException io){} </code></pre> <p>Here is my code for reading the file and totalling the amount...</p> <pre><code>int totalAmount = 0; public void run() { try { BufferedReader buffy = new BufferedReader(new FileReader("myTextFile.txt")); String s; while((s = buffy.readLine()) != null) { int number = Integer.parseInt(s); totalAmount += number; System.out.println(totalNumbers); } } catch(IOException io){} } </code></pre> <p>The output however starts with <strong>29633</strong> and displays numbers all the way to <strong>42328</strong></p> <p>Why do I get this result... just trying to understand the wrong part of my code</p>
java
[1]
1,828,651
1,828,652
How can I add name and quantity in a single row in a table view?
<p>I am creating a simple shopping list application, and with it I am displaying an array of items.</p> <p><img src="http://i.stack.imgur.com/f94SG.jpg" alt="ArrayOfitems"> </p> <p>How can I display quantity of each item after its name?</p>
iphone
[8]
2,955,289
2,955,290
c# Error 2 Argument 1: cannot convert from 'string[]' to 'string' 40 37 emailsearch
<p>How can I show the EmailsList</p> <p>Error 1 The best overloaded method match for 'System.Windows.Forms.MessageBox.Show(string)' has some invalid arguments C:\Users\วิน7\documents\visual studio 2010\Projects\emailsearch\emailsearch\Form1.cs 40 21 emailsearch</p> <pre><code> if (!string.IsNullOrEmpty(result)) { Coderbuddy.ExtractEmails helper = new Coderbuddy.ExtractEmails(result); EmailsList = helper.Extract_Emails(); MessageBox.Show(EmailsList); } } </code></pre>
c#
[0]
4,707,964
4,707,965
php trim function
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/7082295/replacing-excess-whitespaces">Replacing excess whitespaces</a> </p> </blockquote> <p>When I trim using PHP It just trim left and right side of PHP. Isn't their any function that remove more than 2 white spaces between a string? </p> <p>Suppose I have this </p> <pre><code>"Stack Overflow" </code></pre> <p>and I want this</p> <pre><code>"Stack Overflow" </code></pre>
php
[2]
5,634,895
5,634,896
Storing Number in an integer from sql Database
<p>i am using database with table RESUME and column PageIndex in it which type is number in database but when i want to store this PageIndex value to an integer i get exception error</p> <p><strong>Specified cast is not valid.</strong></p> <p>here is the code</p> <pre><code>string sql; string conString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=D:\\Deliverable4.accdb"; protected OleDbConnection rMSConnection; protected OleDbDataAdapter rMSDataAdapter; protected DataSet dataSet; protected DataTable dataTable; protected DataRow dataRow; </code></pre> <p>on Button Click</p> <pre><code>sql = "select PageIndex from RESUME"; rMSConnection = new OleDbConnection(conString); rMSDataAdapter = new OleDbDataAdapter(sql, rMSConnection); dataSet = new DataSet("pInDex"); rMSDataAdapter.Fill(dataSet, "RESUME"); dataTable = dataSet.Tables["RESUME"]; </code></pre> <blockquote> <p>int pIndex = (int)dataTable.Rows[0][0];</p> </blockquote> <pre><code>rMSConnection.Close(); if (pIndex == 0) { Response.Redirect("Create Resume-1.aspx"); } else if (pIndex == 1) { Response.Redirect("Create Resume-2.aspx"); } else if (pIndex == 2) { Response.Redirect("Create Resume-3.aspx"); } } </code></pre> <p>i am getting error in this line </p> <pre><code>int pIndex = (int)dataTable.Rows[0][0]; </code></pre>
c#
[0]
3,326,098
3,326,099
Unexpected token error
<p>I have a small script and it throws Unexpected token error on line 2 and firebug says missing : after property id $('#hubmeter').click(function() {...}</p> <pre><code>$(document).ready({ $('#hmeter').click(function() { alert("Handler for .click() called."); }); }); </code></pre> <p>html</p> <pre><code>&lt;body&gt; &lt;div id="hmeter"&gt; &lt;img src="meter.png"/&gt; &lt;/div&gt; &lt;/body&gt; </code></pre>
jquery
[5]
4,931,753
4,931,754
generating subprocess.call arguments from a list
<p>I am using the subprocess module to execute a command line software with arguments but I am running into a bit of trouble when it comes to feeding it a list of arguments .</p> <p>Here is what I am doing :</p> <pre><code>subprocess.call([rv,"[",rv_args[0],rv_args[1],"]",]) </code></pre> <p>This works fine and <strong>len(rv_args) == 2</strong> , now I would like to generate this :</p> <pre><code>if len(rv_args) == 4 : subprocess.call([rv,"[",rv_args[0],rv_args[1],"]","[",rv_args[2],rv_args[3],"]",]) </code></pre> <p>then</p> <pre><code>if len(rv_args) == 6 : return subprocess.call([rv,"[",rv_args[0],rv_args[1],"]","[",rv_args[2],rv_args[3],"]","[",rv_args[4],rv_args[5],"]"]) </code></pre> <p>etc .. etc ..</p> <p>Of course I don't want to hard code it, but generate it on the fly, what you be the best way ?</p> <p>cheers,</p>
python
[7]
5,505,044
5,505,045
How can I write C# Visual Studio F1 help that displays in a browser?
<p>I have an C# assembly with classes, methods and properties documented in the code, using the /// syntax before each member. I would like to generate html help files from the documentation and place them on my website. When a user implements the assembly and presses F1 on a class or property can it opened in a web browser? This is just copying the function of any .NET Framework class. Is this possible?</p>
c#
[0]
2,290,855
2,290,856
non-static vs. static function and variable
<p>I have one question about static and non-static function and variable.</p> <p>1) non-static function access static variable. </p> <p>It's OK!</p> <pre><code>class Bar { public: static int i; void nonStaticFunction() { Bar::i = 10; } }; int Bar::i=0; </code></pre> <p>2) non-static function access non-static variable</p> <p>Definitely OK!</p> <p>3) static function access static variable&amp;funciton</p> <p>Definitely OK!</p> <p>4) static function access non-static function</p> <p>It's OK</p> <pre><code>class Bar { public: static void staticFunction( const Bar &amp; bar) { bar.memberFunction(); } void memberFunction() const { } } </code></pre> <p>5) static function access non-static variable</p> <p>It's OK or not OK? I am puzzled about this!</p> <p>How about this example</p> <pre><code>class Bar { public: static void staticFunction( Bar &amp; bar) { bar.memberFunction(); } void memberFunction() { i = 0; } int i; }; </code></pre>
c++
[6]
4,203,350
4,203,351
C++ What to put in a Class Declaration and what not
<p>I'm totally confused where to put e.g. the definition of a constructor. Sometimes you see something like this</p> <pre><code>// point.h class Point { Point(int x, int y) { x_ = x; y_ = y; } private: const int x_; const int y_; } </code></pre> <p>Then you sometimes see something like this:</p> <pre><code>// point.h class Point { Point(int x, int y); private: const int x_; const int y_; } // point.cc Point::Point(int x, int y) { x_ = x; y_ = y; } </code></pre> <p>I.e. sometimes things like constructors, copy constructors etc. get declared in the <code>.h</code> and then implemented in the <code>.cc</code> file, sometimes they get defined in the header and so on. But under which circumstances? Which is good practice, which is not? </p>
c++
[6]
5,266,551
5,266,552
edit span using jquery
<p>I have a div that has multiple children divs. inside of the children divs consist of a table. In that table are two span tables that i need edited using jquery. maybe a each selector or something.</p> <pre><code> &lt;div class="slides"&gt; &lt;div class="Slide1&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="span1"&gt;&lt;/span&gt;&lt;span id="span2"&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt; &lt;div class="Slide2&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="span1"&gt;&lt;/span&gt;&lt;span id="span2"&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>Each div I want to go in and edit span1 and span2. span 1 with the iteration number and span2 with the size of slides total. Thank you for any help.</p>
jquery
[5]
5,576,833
5,576,834
show pixel value of .TIF image on the basis of X Y coordinates in c#
<p>i am in trouble. how to read 1MB .tif file with bitmap class in c# and have to show pixel value of this .tif image on the basis of X Y coordinates. I searched google lot but not find any answer yet.</p> <pre><code>string imgPath; imgPath = @"C:\Documents and Settings\shree\Desktop\2012.06.09.15.35.42.2320.tif"; Bitmap img; img = new Bitmap(imgPath, true); MessageBox.Show(Here i have to show pixel value of this .tif image on the basis of X Y coordinates.); </code></pre>
c#
[0]
2,033,178
2,033,179
php code consolidation
<p>I was troubleshooting some code and ended up with this:</p> <pre><code>$url=$this-&gt;_protected_arr['f3b']; $title=$this-&gt;_protected_arr['f3a']; $email=$_SESSION['email']; database::query("INSERT INTO bo VALUES ('$title','$url','','$email')"); </code></pre> <p>I think that it should be abel to get rid of $url, $title, and $email and just insert their values directly into the query. How do I write this in a single statement?</p>
php
[2]
5,396,581
5,396,582
JavaScript + Querystring + div
<p>How to load content in to a html page. please note IM not allowed to use php or C. Only javascript and html.</p> <p>for example</p> <p>load Page B in to Page A</p> <p>http:myweb.com/index.html?load=pageb</p> <p>thank you.</p>
javascript
[3]
5,514,754
5,514,755
show selection pointers and highlight text in textview with longclick
<p>I have a TextView that I want to implement LongClickListner on and select part of the text in it... However selection pointers don't appear and the text is not highlighted. I know the text is selected because when I use view.getselectionstart() and view.getselectionend() they return the right values...below the code I use:</p> <pre><code>textView.setOnLongClickListener(new OnLongClickListener() { public boolean onLongClick(View v) { Selection.setSelection((Spannable) textView.getText(),5, 10); v.setSelected(true); return true; } }); </code></pre> <p>This doesn't show any thing.....But when I try to log selection start and end:</p> <pre><code>Log.d("SELECTED TEXT LISTNER",Selection.getSelectionStart(textView.getText()) + " " +Selection.getSelectionEnd(textView.getText())); </code></pre> <p>the right values (5, 10) are returned...any help how I can show selection pointers and highlight on longclick??</p>
android
[4]
4,189,501
4,189,502
Random time and date between 2 date values
<p>I'm trying to write a php script (or line of code) to echo a random time and date between 2 dates, eg</p> <p>2012-12-24 13:03</p> <p>which would be between my chosen dates of 1st October 2012 and 1st Jan 2013.</p> <p>Any ideas how best to do this? Thanks in advance.</p>
php
[2]
1,642,683
1,642,684
Android - how to display large text
<p>I have a txt file which is around 2MB. I need to display it in android. I have tried out WebView and it takes around 5 seconds to load and display the file. Is there any way I can get it rendered faster? Moreover, I dont want to load all the text at the start. Something like a scrollbar which displays elements efficiently is what I require. I need not stick to WebView alone, but can choose to show it using any efficient way.</p>
android
[4]
790,930
790,931
Python not sorting Unicode correctly
<pre><code>data = [unicode('č', "cp1250"), unicode('d', "cp1250"), unicode('a', "cp1250")] data.sort(key=unicode.lower) for x in range(0,len(data)): print data[x].encode("cp1250") </code></pre> <p>and I get:</p> <pre> a d č </pre> <p>It should be:</p> <pre> a č d </pre> <p>Slovenia Alphabet goes like: a b c č d e f g.....</p> <p>I'm using WIN XP(Active code page: 852 - Slovenia). Can you help me?</p>
python
[7]
550,676
550,677
How to get called function name in __construct without debug_backtrace
<p>How to get a caller method name in an class constructor, get_called_class() gives me the name of an extended class which was instantiated but how can I get the name of a method which was called in that class? I need this for a production state so debug_backtrace() is not a good solution. </p>
php
[2]
83,505
83,506
Obscure the folder serving the files for the duration of a session
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/12963435/hide-a-folder-path-when-user-downloads-a-file">hide a folder path when user downloads a file</a> </p> </blockquote> <p>Is there a way I can serve a unique directory path to the same files every time a user accesses a script -- then have those files accessible at that location for at least the duration of the user's browser session (for example, if another user accesses the script while it is being viewed)? </p> <p>I would have issued a rename() every access, but then I realised if the script is accessed again in between a download, it would render the file path invalid. </p> <p>Thanks. </p>
php
[2]
4,271,481
4,271,482
Increasing Page Height With Javascript
<p>I dont know anything about javascript but I want to be able to click on an Image and increase the page size. </p> <p>Example. A 500px x 500px box with an image in it. When you click on an image the box will increase to 500px x 1000px with new content within the new area without it changing the page.</p> <p>How would I do this?</p> <p>Like On This Website <a href="http://kyanmedia.com/" rel="nofollow">http://kyanmedia.com/</a> Click on the earth worm at the bottom</p>
javascript
[3]
1,595,455
1,595,456
Invoking audio recorder and getting the resulting file
<p>I am trying to invoke the audio recorder on Android 2.2.1 (device Samsung Galaxy POP) using the following code:</p> <pre><code>private static final int ACTIVITY_RECORD_SOUND = 1; Intent intent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION); startActivityForResult(intent, ACTIVITY_RECORD_SOUND); </code></pre> <p>This invokes the recorder successfully. In my activity result i do the following:</p> <pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case ACTIVITY_RECORD_SOUND: data.getDataString(); break; } } } </code></pre> <p>After i complete the recording i press back on the audio recorder which returns the control to the onActivityResult method as expected, but my resultCode is always 0 (which is Activity.RESULT_CANCELED) and my data is null. Am i missing out on something here? Kindly help me with this. This works on the emulator but not on the device. Thanks in advance.</p>
android
[4]
1,844,417
1,844,418
Context in Android Programming
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3572463/what-is-context-in-android">What is Context in Android?</a> </p> </blockquote> <p>Can anybody please tell me about the "context" term used in android. I wonder what exactly this means because this is something i used to see at lots of places. </p> <p>I found it being a Class :- "Interface to global information about an application environment" but I am not quite clear regarding it still by now.</p> <p>for Instance: public GetCurrentLocation(Context context) { this.context = context; }</p> <p>Thanks, david</p>
android
[4]
1,403,882
1,403,883
Finding the index when using a vector<>::iterator
<p>I wonder if there is a way to get the index of random access iterator. For example:</p> <pre><code>int myIndex = -1; for(std::vector&lt;std::string&gt;::iterator iter = myStringVec.begin(); iter != myStringVec.end(); iter++) { if(someFunction(*iter)) //got a hit on this string myIndex = ... } </code></pre> <p>Beg you pardon if this is super trival. An obvious solution would be to iterate by index, but my thinking is that was thinking for random access iterators, there might be a way for the iterator to tell you what it's index is, like <code>myIndex = iter.index()</code></p>
c++
[6]
938,339
938,340
Use of typedef on function
<p>In the following, how can i define my function with typedef syntax?</p> <pre><code>typedef void F(); //declare my function F f; //error F f { } </code></pre>
c++
[6]
1,161,077
1,161,078
Can anyone explain this simple Javascript behaviour?
<pre><code>function cat() { this.Execute = new function() { alert('meow'); } } var kitty = new cat(); </code></pre> <p><a href="http://jsfiddle.net/PaDxk/1/" rel="nofollow">http://jsfiddle.net/PaDxk/1/</a></p> <p>Why does it do that? I haven't told it to run the function.</p>
javascript
[3]
3,037,626
3,037,627
What is the best practice to make division return double in C#
<p>In c# when you want to divide the result of a method such as below, what is the best way to force it to return a double value rather than the default integer. </p> <pre><code>(int)Math.Ceiling((double)(System.DateTime.DaysInMonth(2009, 1) / 7)); </code></pre> <p>As you can see I need the division to return a double so I can use the ceiling function.</p>
c#
[0]
1,531,199
1,531,200
how to convert binary number to double in java
<p>I want to convert binary numbers into double.I have binary string </p> <pre><code>1100000110011101010111011000101011011000011111111111111111111110 </code></pre> <p>I want to convert it into double value. I am expecting the Following output.</p> <pre><code>Output:-1.2316741412499997E8 </code></pre> <p>Please Help me to solve this problem</p>
java
[1]
1,913,083
1,913,084
Calculate a specific number PHP
<p>I have a for loop, where $i is 0, and it will run until $i reaches 4. I am trying to make a code that would output numbers in an order like this: 01, 11, 02, 12, 03, 13... etc... Now, the thing is next: when $i is 1, the script should make an order of those number in the boundaries of 1 and 20. When $i is 2, it would be 21 to 40, etc.</p> <p>I've tried many things (mostly deleted), could not come up with anything that would work the right way.</p>
php
[2]
4,677,982
4,677,983
How to perform syncing in android?
<p>I am creating a networking website's Application in android.I want to know how can I perform syncing ie I want to store all user contacts on websites to my android phone. user's details will come in XML format.</p> <p>Please Guide me .. </p>
android
[4]
1,185,687
1,185,688
jquery image links turns into image tags
<p>Is there a jquery plugin that turns recognizes image urls and turns them into image links, much like how <a href="http://videojs.com/" rel="nofollow">http://videojs.com/</a> works for video or jquery media works <a href="http://jquery.malsup.com/media/#overview" rel="nofollow">http://jquery.malsup.com/media/#overview</a></p> <p>Apparently none of these plugins support images???</p>
jquery
[5]
2,222,743
2,222,744
Best approach for representing a simple electronic form editor/design app?
<p>I want to make an application that represents a document. The application would open, and the user would be presented with a blank page. The user could then drag controls to the page and design the document to their needs. (A text box, a drop down box, maybe a picture, or a table.). </p> <p>Then, I would like a separate app that would open this document (serialized in some manner - irrelevant at this point..) and have a user fill out the data fields.</p> <p>Are there any classes/approaches in C# that would make this relatively straight forward? Forgive the broad scope of the question, but before I re-invent anything, I am curious as to if this has been solved in any capacity within the C#/.NET framework. If not, I'm asking if anyone has any guidelines on how to approach this. I've googled for this, but have yet to find any concrete answers. Thank you.</p>
c#
[0]
4,867,153
4,867,154
javascript prototype getting a div wid id and display='none'
<p>i am using protoype and i want to get the div wid id='div_3' and display='none' means in a single line i want to find the element wid these two attribs</p>
javascript
[3]
3,918,075
3,918,076
how could we obtain magnitude of frequency from a set of complex numbers obtained after performing FFT in python?
<p>Hi folks i don't know what to do after obtaining a set of complex numbers from FFT on a wav file.How could i obtain the corresponding frequencies.This is output i got after performing FFT which is shown below</p> <pre><code>[ 12535945.00000000 +0.j -30797.74496367 +6531.22295858j -26330.14948055-11865.08322966j ..., 34265.08792783+31937.15794965j -26330.14948055+11865.08322966j -30797.74496367 -6531.22295858j] </code></pre>
python
[7]
5,326,429
5,326,430
Python - IndentationError: expected an indented block on a if
<p>I am new to python, so here is my problem. I get the error "IndentationError: expected an indented block" on y_list in line 31 -> after the first if. The file I load includes alot of numbers, and the idea is to skip the negative ones in the socalled y_list.</p> <pre><code>filename = "data_5.dat" # this file can also be found in the sandbox folder x_list = [] y_list = [] fp = open(filename) for line in fp: var1, var2 = line.split(",") # here we wish to split the line using the ',' character # since we want them in numeric format we need to convert a = float(var1) b = float(var2) # put them into two lists x_list.append(a) y_list.append(b) fp.close() # close the file x = x_list y = y_list I = 0.0 L = 0.0 for k in range(1, len(x)): if y_list&gt;0: y_list.append(y) I += y[k-1] * (x[k] - x[k-1]) for k in range(1, len(x)): if y_list&gt;0: y_list.append(y) L += y[k] * (x[k] - x[k-1]) print I print L print (I+L)/2 </code></pre>
python
[7]
2,833,163
2,833,164
jquery image scroller
<p>I'm making an image scroller with jQuery but I'm having a little trouble.</p> <p>I've almost got it, but for some strange reason the last slide scrolls past before the image slider starts. Take a look at this:</p> <p><a href="http://jsfiddle.net/BAEtV/" rel="nofollow">http://jsfiddle.net/BAEtV/</a></p> <p>and you'll see what the problem is.</p> <p>I can't understand why this is happening, any suggestions?</p>
jquery
[5]
5,854,753
5,854,754
How can I use a ttf file for a button's text?
<p>How can I use a ttf file for a button's text?</p>
android
[4]
4,027,806
4,027,807
HTML formatted email does not display correctly
<p>I'm still struggling with this mail script - I'm now getting all the marked up html through rather than seeing it as rendered html if that makes sense?</p> <pre><code>&lt;?php $mailheader .= "MIME-Version: 1.0\r\n"; $mailHeader .= "Content-type: text/html; charset=iso-8859-1\r\n"; $formcontent .="&lt;table border='1'&gt;"; foreach ($_POST as $field=&gt;$value) { $formcontent.="&lt;tr&gt;"; $formcontent .= "&lt;td&gt;$field:&lt;/td&gt; &lt;td&gt;$value&lt;/td&gt;"; $formcontent.="&lt;/tr&gt;"; } $formcontent .= '&lt;tr&gt;&lt;td&gt;User-Agent: &lt;/td&gt;&lt;td&gt;'.$_SERVER['HTTP_USER_AGENT'].'&lt;/td&gt;'; $formcontent .="&lt;/table&gt;"; $recipient = "info@*******.com"; $subject = "Event feedback form"; $mailheader = "From: web.form@*******-events.co.uk\r\n"; $mailheader .= "Reply-To: $email\r\n"; $mailHeader .= "Content-type: text/html; charset=iso-8859-1\r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Failure!"); header("location:http://www.******-events.co.uk"); ?&gt; </code></pre>
php
[2]
1,120,284
1,120,285
how to judge a page edited or not from server client
<p>a input asp.net page,you can image many input fields and a button named submit on it. before user submit the page ,I want to compare all the fields values with default values . if anyting didn't change ,i will give him a message. here it is the question: how to judge a page edited or not from server client(in button click event)?<br> i don't want compare each field in page. </p>
asp.net
[9]
69,606
69,607
clearTimeout() not working on Web Server
<p>I have a simple 'timer' script embedded in php page which takes the variable 'totalTime' value from php script and runs for the specified total no of minutes and need to clear the setTimeout and close the window through window.close() method</p> <p>this page is opened through window.open() method.</p> <pre><code>var m=parseInt(totalTime); var ts=m*60; var c=m+' : 00'; var timer_is_on=1; var timer="timer"; function timedCount() { ts=ts-1; m=Math.floor(ts/60); var s=ts%60; c=m+" : "+s; document.getElementById('timer').innerHTML=c; if(ts==0){ alert("Time Out"); clearTimeout(timer); window.close(); } else { timer=setTimeout("timedCount()",1000); } } function countTime() { if (timer_is_on) { timedCount(); } } </code></pre> <p>The timer is running until its 0:0 and instead of the popup window being closed, the timer is showing negative numbers.</p> <p>Neither the clearTimeout() nor window.close() is working.</p> <p>I had tested it on localhost before it was working fine.</p> <p>I have tried a lot on stackoverflow asl well as other sites to get a hint but was helpless...</p> <p>So please help me out.. Thanks</p>
javascript
[3]
2,115,991
2,115,992
Default Directory for packages
<p>I am a newbie in java I Want to know that what is the default directory for packages in java ? I Mean if i compile a java file which contains a package statement,and i compile it without using <code>-d</code> option in <code>javac</code> command,then where will be the package created ? eg.</p> <pre><code>package test; class Test{} </code></pre> <p>and compile it using <code>javac Test.java</code><br> then where will be the package created?</p> <p>Thanks</p>
java
[1]
5,481,752
5,481,753
what's the quickest way to simple-merge files and what's the quickest way to split an array?
<p>what's the quickest way to take a list of files and a name of an output file and merge them into a single file while removing duplicate lines? something like</p> <p>cat file1 file2 file3 | sort -u > out.file</p> <p>in python.</p> <p>prefer not to use system calls.</p> <p>AND:</p> <p>what's the quickest way to split a list in python into X chunks (list of lists) as equal as possible? (given a list and X.)</p>
python
[7]
2,169,942
2,169,943
jquery submit on change with a twist
<p>I have a form with a single select_field that gets submitted via jquery whenever the select field is changed.I use something like this:</p> <pre><code>$('#scope').change(function() { this.form.submit(); }); </code></pre> <p>Where scope is the ID of the select_field. This works as expected. </p> <p>We want to change the view slightly where the select field is hidden until the user clicks a link => then it pops up and you can select as before.</p> <p><strong>The problem:</strong><br> When the user clicks the link to show the select field. It also instantly triggers the change event somehow (even though the value of the select field has not changed). </p> <p>Any easy way around this that I am overlooking?</p> <p>Thanks for your time,<br> Erwin</p>
jquery
[5]
1,399,985
1,399,986
uservoice for iphone, anything formatted directly for iphone screen?
<p>Does anyone know of a site similar to <a href="http://stackoverflow.uservoice.com/" rel="nofollow">uservoice</a> that provides a iphone specific web front end?</p> <p>The plan is that there will be a link in my iphone app for user feedback and this will open mobile safari at the uservoice or similar site?</p> <p>That is, a bug tracker with iphone/mobile safari tweaks?</p> <p>Thanks, Chris</p>
iphone
[8]
4,486,058
4,486,059
Can we switch this SwigPyObject to a python file descriptor?
<p>I have a C function which returns FILE*, and is then swigged into Python as a SwigPyObject. I wonder is there any way we can switch this SwigPyObject to a python file descriptor so that I can check the open status of the file.</p>
python
[7]
4,118,665
4,118,666
What standards and practices should I use to develop an application that runs on both the iPhone and on iPads?
<p>What standards and practices should I use to develop an application that runs on both the iPhone and on iPads?</p>
iphone
[8]
1,660,482
1,660,483
android memory management (Heap Size)
<p>i am developing one application related to graphics, in this application i am using lots of images and drawing on it.and all activities are running until my flow does not get completed.so what should i do for assign large heap size to run smoothly my application. Or any other way to run application smoothly .. i have no idea about memory management right now . i am using only BitmapDrawable to display images and also system.gc() to garbage collection . also use this </p> <pre><code>Runtime.getRuntime().runFinalizersOnExit(true); Runtime.getRuntime().gc(); Runtime.getRuntime().freeMemory(); </code></pre> <p>can anybody help me .. thanx in advance</p>
android
[4]
4,089,818
4,089,819
jQuery hover with multiple items
<p>So I've got four circles next to each other, and when you move the mouse from one to the other, this code activates. But I only want it to activate when you move off/on any of the circles, not when you move from one .circle to another. Thanks folks!</p> <pre><code> $('.circle').hover( function () { $(this).parent().animate({marginLeft: '-=25px'}, 1000); }, function () { $(this).parent().stop(true, true).animate({marginLeft: '+=25px'}, 1000); } ); </code></pre>
jquery
[5]
951,906
951,907
how to disable the email message link after first click
<p>I developed a php email activation code for activate user's account after registration, what I want is that if the user click the activation link again after first time, the link will be disabled, any one could help, thanks a lot! here is my php code:</p> <pre><code> $to = $email; $subject = " Your Registration"; $message = "Welcome to our website!\r\rThanks for completing registration at www.example.com. You can complete registration by clicking the following link:\rhttp://www.example.com/verify.php?$activationKey\r\rIf this is an error, ignore this email and you will be removed from our mailing list.\r\rRegards,\ www.example.com Team"; $headers = 'From: noreply@ example.com' . "\r\n" . 'Reply-To: noreply@ example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); </code></pre>
php
[2]
2,905,719
2,905,720
Minus value using php
<p>I have the value as <code>$title =10</code> and I want to minus it with <code>01</code>.So my code is:</p> <pre><code>echo $minus = round(($title - 01),2); </code></pre> <p>I want the result <code>$minus = 09</code> but this code not like this it still have the result <code>$minus=9</code>. Anyone help me please,Thanks.</p>
php
[2]
3,309,198
3,309,199
Custom Font. Keeping the font width same
<p>I am trying to draw a string using quartz 2d.</p> <p>What i am doing is, i am drawing each letter of the string individually, because each letter has special attributes associated with it, by taking each letter into a new string. </p> <p>The string gets printed, but the space between the letters is not uniform. It looks very ugly to read . I read someting about using custom fonts. But i have no Idea, if I can do it!! my code is here.</p> <pre><code>- (void) drawRect : (CGRect)rect{ NSString *string=@"My Name Is Adam"; float j=0; const char *charStr=[string cStringUsingEncoding: NSASCIIStringEncoding]; for(int i=0;i&lt;strlen(charStr);i++) { NSString *str=[NSString stringWithFormat:@"%c",charStr[i]]; const char *s=[str cStringUsingEncoding:NSASCIIStringEncoding]; NSLog(@"%s",s); CGContextRef context=[self getMeContextRef]; CGContextSetTextMatrix (context,CGAffineTransformMakeScale(1.0, -1.0)) ; CGContextSelectFont(context, "Arial", 24, kCGEncodingMacRoman); //CGContextSetCharacterSpacing (context, 10); CGContextSetRGBFillColor (context, 0,0,200, 1); CGContextSetTextDrawingMode(context,kCGTextFill); CGContextShowTextAtPoint(context, 80+j,80,s,1); j=j+15; } } </code></pre> <p>In the output 'My Name is Adam' gets printed but the space between the letters is not uniform.!! is there any way to make the space uniform!!! </p>
iphone
[8]
2,742,162
2,742,163
How can implement search bar in android?
<p>I am working in android. i am trying to display name of university using listView.</p> <p>my list view is looking like this. <img src="http://i.stack.imgur.com/8wv0y.png" alt="enter image description here"></p> <p>Now i want to add a search bar on the top of this list view. if i press <strong>A</strong> in search bar then this list view should display all the name of university start with <strong>A</strong>, if i press some other character then according university name must be displayed.</p> <p>Please tell me how can implement this. Is any way to make search bar in android. I have seen in iPhone, it works very efficiently in iPhone. Please help me how can make this search bar ?</p> <p>Thank you in advance...</p>
android
[4]
4,153,424
4,153,425
How to retrieve original @classmethod, @staticmethod or @property
<p>I understand that @decorator.decorator doesn't allow to decorate above @staticmethod, @classmethod (and perhaps also @property). I understand the usage:</p> <pre><code>class A(object): @classmethod @mydecorator def my_method(cls): pass </code></pre> <p>But, in a debugging module, I still want to try to do it dynamically. So I was wondering what is the way to retrieve the original method from those descriptor(?). I've read few responses, but I'm still confused...</p> <p>I see some example with a class, and retrieving:</p> <pre><code>class my_class(property): def __get__(self, obj, cls): return self.fget.__get__(None, cls) </code></pre> <p>I love the signature-preserving of decorator, but still not sure how to do this. The logic I try to implement is:</p> <pre><code>import decorator def mydecorator(f, *d_args, **d_kwargs): if (isinstance(f, classmethod)): return classmethod(mydecorator(f.__get__.?WHATELSE?)) elif (isinstance(f, staticmethod)): return staticmethod(mydecorator(f.__get__.?WHATELSE?)) elif (isinstance(f, property)): return property(mydecorator(f.__get__.?WHATELSE?)) else: return decorator.decorator(f) </code></pre> <p>I'm trying to do this in Python 2.6, so I also welcome pointing that @decorator is changed (corrected?) in future version of python.</p> <p>Thanks.</p>
python
[7]
1,725,321
1,725,322
Android - Issue with the Android's back button
<p>Hi<br /> I have written a little program that will open the default browser and direct to an URL. My problem is that when I click Android's back button, it will return to a blank page, how can I change it to exit the program instead of return to a blank page</p> <p>The code for reference:</p> <pre><code>package com.example.helloandroid; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.widget.TextView; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent httpIntent = new Intent(Intent.ACTION_VIEW); httpIntent.setData(Uri.parse("http://www.bbc.co.uk/")); startActivity(httpIntent); } } </code></pre>
android
[4]
1,756,444
1,756,445
PHP $_POST and id only, no name
<p>Can someone please explain this to me?</p> <p>I have the following code:</p> <pre><code>&lt;form action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="post"&gt; &lt;input type="text" id="testField" /&gt; &lt;input type="submit"&gt; &lt;/form&gt; &lt;br /&gt;&lt;br /&gt; &lt;pre&gt; &lt;?php print_r($_POST); ?&gt; &lt;/pre&gt; </code></pre> <p>This works fine on my main dev box, and on the server. However, I'm having to work remotely on my laptop at the moment. I've installed the exact same WAMPServer 2.1a build as on my dev setup, and the $_POST array is empty.</p> <p>If I declare the field like:</p> <pre><code>&lt;input type="text" name="testField" /&gt; </code></pre> <p>I get the expected output.</p>
php
[2]
2,603,281
2,603,282
jquery - missing ; before statement
<pre><code>var splitIndexArray = (unformattedArray[0]).split('=') //alert(splitIndexArray[0]) //alerts correct value //alert(splitIndexArray[1]) //alerts correct value var serialNoArray[splitIndexArray[0]]=splitIndexArray[1] //(--&gt; this statement) </code></pre> <p>gives me an error saying "missing ; before statement" </p>
javascript
[3]