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
50,834
50,835
Difference between while(i=0) and while(i==0)
<p>In my exam the following problem appeared in C++</p> <p>Code:</p> <pre><code>int i,n; int* A cin&gt;&gt;n; A=new int[n] for(int i=0;i&lt;n;i++) cin&gt;&gt;A[i]; while(i=0){ cout&lt;&lt;A[i]&lt;&lt;endl; i=i-1; } } </code></pre> <p>What will be the output? I think that it should go into indefinite loop!</p>
c++
[6]
2,017,600
2,017,601
Backslash in PHP -- what does it mean?
<p>I just saw the use of a backslash in reference to a PHP object and was curious about it (never seen this before). What does it mean?</p> <pre><code>$mail = new SendGrid\Mail(); </code></pre> <p>If you're curious, here's <a href="http://docs.sendgrid.com/documentation/get-started/integrate/examples/php-email-example-using-smtp/" rel="nofollow">SendGrid's documentation</a>.</p>
php
[2]
3,023,178
3,023,179
Custom container control
<p>I'm trying to create a CollapsiblePanel control, which is essentially just a panel which has a header which can be used to expand / collapse the body. I've got an example of it working on a page (inline) but now what to make it a reusable control that can be used as follows</p> <pre><code>&lt;cc:CollapsiblePanel runat="server" Header="This is a collapsible panel"&gt; &lt;asp:Label runat="server" Text="This is the contents of the panel" /&gt; &lt;/cc:CollapsiblePanel&gt; </code></pre> <p>So, I want the CollapsiblePanel to render the header, the beginning of the container, then the contents of the container (i.e. the label in this case), and finally the end of container. </p> <p>I'm unsure how to do this properly. I've seen some examples which override the rendering methods in order to insert controls at the right points, but it seems very hack-y. </p> <p>What is the 'proper' way to do something like this? (.NET 4.0 if that makes a difference)</p>
asp.net
[9]
5,759,485
5,759,486
How to get Content on Post Method
<p>I've used below code for <code>HttpPost</code>, Its execute successfully. But unable to see the response.I get <code>InputStream</code>. I want to know what are the contents in it.</p> <p>I want to display as string format.How to do this.</p> <pre><code> HttpPost httppost = new HttpPost(requestURL); ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(params.length); for (int postValueCount = 0; postValueCount &lt; params.length; postValueCount++) nameValuePairs.add(new BasicNameValuePair(params[postValueCount][0],params[postValueCount][1])); try { httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); Log.d("HttpPostRequest","URL : " + httppost.getRequestLine().getUri()); Log.d("HttpPostRequest","Method : " + httppost.getRequestLine().getMethod()); Log.d("HttpPostRequest","Parameters : " + nameValuePairs); response = httpclient.execute(httppost); status = response.getStatusLine(); if (status.getReasonPhrase().equals("OK")) { httpEntity=response.getEntity(); InputStream in = httpEntity.getContent(); return in; } else { Log.d("Http Status", status.getReasonPhrase()); } } </code></pre>
android
[4]
1,309,476
1,309,477
How do I downgrade Java from 1.6.0 to 1.5.0 in Ubuntu?
<p>I need to downgrade Java in Ubuntu. Current version is 1.6.0, I have to use JDK 1.5.0 for my Android platform.</p> <p>How to do it? Remove it and reinstall?</p>
java
[1]
3,890,881
3,890,882
How to pass a 2D matrix to function
<p>I am doing an addition of matrices using classes.I have declared a class 'Matrix'.now i need to pass an object of Matrix to a function.how do i do that? </p>
c++
[6]
4,782,039
4,782,040
How do I move a div with javascript?
<p>I have a div with text on the center of the page. When I click on the div it should be moved anywhere on the page (for example: 100px above). How can I do it?</p>
javascript
[3]
3,315,398
3,315,399
Why does this code result in 0?
<p>I have the following code</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;iostream&gt; #include &lt;stdlib.h&gt; #include &lt;stdint.h&gt; using namespace std; int main(){ int x; cin&gt;&gt;x; uint32_t Ex; Ex=(x&lt;&lt;1)&gt;&gt;24; cout&lt;&lt;Ex&lt;&lt;endl; return 0; } </code></pre> <p>but it gives 0 for any value of x?</p> <p>My task is the following:</p> <pre><code>Computation of the biased exponent Ex of a binary32 datum x. </code></pre>
c++
[6]
2,244,144
2,244,145
C#: bandwidth
<p>I was successfully calculate bandwidth consumed by my application (which connects to web service to send files) using [this][1] [1]: <a href="http://stackoverflow.com/questions/442409">http://stackoverflow.com/questions/442409</a> i used the code provided by Rasmus Faber... One thing puzzled me: the received bytes is far too more than sent bytes... As far as i am concerned i am sending images, xml files etc and returning error codes.. therefore the sent bytes should be more? .... </p>
c#
[0]
1,147,992
1,147,993
Does the default constructor of std::pair<> set basic types (int, etc) to zero?
<p>After writing:</p> <pre><code>std::pair&lt;int, int&gt; x; </code></pre> <p>Am I guaranteed that x.first and x.second are both zero? Or could they have any value? </p> <p>The reason why I care is because I'm trying to determine whether a map whose values are pointers is guaranteed to return NULL if I access an element that's not in the map. I.e., if I do:</p> <pre><code>std::map&lt;int, void*&gt; my_map; std::cout &lt;&lt; int(my_map[5]) &lt;&lt; std::endl; </code></pre> <p>then am I guaranteed to get zero (NULL)? Or is the behavior undefined?</p>
c++
[6]
1,560,059
1,560,060
is there a JavaScript implementation of the Inverse Error Function, akin to MATLAB erfinv()?
<p>is there a JavaScript implementation of the Inverse Error Function? This would implement the Gauss inverse error function. Approximations are ok.</p>
javascript
[3]
884,013
884,014
reload the sourcecode of a C# app on command
<p>i have a C# application, and id like to be able to make a system, so that within the program, you can display the sourcecode of the application. easy enough so far right?</p> <p>well, i need them to be able to edit that code, almost like the debug break option... then load the new code and continue without stopping the program. so my problem is, that when this app loads its several thousand lines of code, and it takes a good block of time. after its loaded, it needs to do several hundred operations before allowing user input the first time it loads. also, it has a tcp client in it, and it is very important that it does not get disconnected.</p> <p>i want people to be able to edit the source, click a button, and wait a few seconds, and have the new code inserted and "rehashed" so to speak, without having to break the overall function of the application.</p> <p>im looking thorough code examples where possible and an input weather this is possible or not</p> <p>~ thanks</p>
c#
[0]
4,289,111
4,289,112
Check status of dialog in android
<p>I create dialog by:</p> <pre><code>protected void showAlertDialog(String title, String message) { AlertDialog.Builder builder = new Builder(this); if(title != null) { builder.setTitle(title); } if(message != null) { builder.setMessage(message); } builder.setPositiveButton("OK", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { backToMainActivity(); } }); builder.show(); } </code></pre> <p>and after that I use it in my activity. How can I check status my dialog. I mean I want to check when dialog was canceled or closed. This is any way to do that? I have a example when user click backbutton and dialog was closed and I want finish activity when dialog was closed. This is any way to check if dialog is showing or was closed?</p>
android
[4]
1,886,540
1,886,541
inputAccessoryView from UISearchBar
<p>How can I access to <code>inputAccessoryView</code> propery from <code>UISearchBar</code>? I mean there's no <code>UITextField</code> property in <code>UISearchBar</code> that by it I could access to <code>inputAccessoryView</code>.</p> <p>Regards</p>
iphone
[8]
124,786
124,787
what is this nameless function?
<p>What does this line from the following code sample mean? </p> <pre><code>synchronized (_surfaceHolder) { _panel.onDraw(c); } </code></pre> <p>I can guess what it does, but what is it called and how does it works? Is it a nameless synchronized function?</p> <pre><code>class TutorialThread extends Thread { private SurfaceHolder _surfaceHolder; private Panel _panel; private boolean _run = false; public TutorialThread(SurfaceHolder surfaceHolder, Panel panel) { _surfaceHolder = surfaceHolder; _panel = panel; } public void setRunning(boolean run) { _run = run; } @Override public void run() { Canvas c; while (_run) { c = null; try { c = _surfaceHolder.lockCanvas(null); synchronized (_surfaceHolder) { _panel.onDraw(c); } } finally { // do this in a finally so that if an exception is thrown // during the above, we don't leave the Surface in an // inconsistent state if (c != null) { _surfaceHolder.unlockCanvasAndPost(c); } } } } </code></pre>
android
[4]
5,916,035
5,916,036
Passing Complex JavaScript Object to WCF using JQuery
<p>I have a FireFox browser plugin that is devloped in C++, that connects to a Scanner and retrievs data</p> <p>When a user clicks on a button on a Web Page (Developed in ASP.net AJAX 3.5) it retrieves data from the scanner by JavaScript and sends to the WCF service (RESTful WCF and accepts JSON message format)</p> <p>Question is C++ Object that passed backto the browser using JQuery (when button is clicked) object is complex and does not match remove WCF service (which only accepts a custom object as input; one parameter only)</p> <p>Question</p> <p>Do I need to reconstruct (tore it apart in JQuery and match its structure to remote WCF service and use JSON.Stringfy() with JQuery AJAX in order to pass) object that was passed from C++ browser plugin to the WCF?</p> <p>Can object be passed between JQuery and remote WCF if both have different properties? </p>
jquery
[5]
281,099
281,100
Using the Prototype object correctly
<p>HI,</p> <p>I have a JavaScript program that's written with object literal syntax:</p> <pre><code>var MyJsProgram = { someVar: value1, somevar2: value2, init : function() { //do some initialisation }, libraryFunction : function() { }, getStyle : function() { }, extend : function() { } } </code></pre> <p>There can be multiple instances of this script running at once. Should I move the common methods in to the prototype object of the myJsProgram? If so, <strong>is this syntax correct?</strong></p> <pre><code> var MyJsProgram = { someVar: value1, somevar2: value2, init : function() { //do some initialisation }, //more methods/members here that are unique to each instance } myJsProgram.prototype = { //all shared methods here } </code></pre> <p>?</p>
javascript
[3]
998,379
998,380
mysql insert PHP statement keeps throwing error
<p>Does anybody know why the following <code>PHP</code> code keeps throwing errors: I have been unable to log any proper error other than the if statement $result not going through and giving me the <code>Echo 'Error'</code> statement. Is there something wrong with my insertion?</p> <pre><code> $new_tbl_name = 'Password_Reset'; $sql = "INSERT INTO $new_tbl_name (Email, Key) VALUES ('$email','$resetHash')"; $result = mysql_query($sql); if ($result) { } else { echo 'Error'; } </code></pre>
php
[2]
4,926,052
4,926,053
window.close(); not working when page changed or refreshed
<p>I have this little function to open/close a popup player:</p> <pre><code>function popuponclick(popup) { my_window = window.open("folder/player-itself.htm", popup, "width=350,height=150"); } function closepopup() { my_window.close(); } </code></pre> <p>I call the functions from HTML anchors that are on each page of the site (idea is to have the player stopped/started whenever you want)...now...</p> <p>it works well until i change the page, or refresh the existing one - and from then the window can't be closed anymore. Any idea where i'm wrong? Tested in FF and IE8, same behavior.</p> <p>Thanks for your help.</p>
javascript
[3]
3,351,525
3,351,526
How to parse the response of youtube video upload api to get the video's url
<p>I'm using the youtube api's non resume method to upload a video to youtube from my android app. The response of this upload is an xml file. I need to parse it and find the url of the video (WHICH IS IN THE TAG media:player url). How to get that url?</p> <p>The xml is as follows </p> <p><img src="http://i.stack.imgur.com/KzMKC.png" alt="XML is as follows"></p> <p><img src="http://i.stack.imgur.com/obNMe.png" alt="enter image description here"></p> <p><img src="http://i.stack.imgur.com/n9ZGS.png" alt="enter image description here"></p>
android
[4]
2,076,317
2,076,318
Problem with input in c++
<p>I have a very basic question i want to take integer input in certain range from user. if the user gives some string or char instead of integer. then my program goes to infinite loop.</p> <p>my code is some what like that</p> <pre><code>cin &gt;&gt; intInput; while(intInput &gt; 4 || intInput &lt; 1 ){ cout &lt;&lt; "WrongInput "&lt;&lt; endl; cin &gt;&gt; intInput; } </code></pre> <p>I am only allowed to use c++ libraries not the c libraries.</p>
c++
[6]
167,992
167,993
PHP 5.4 after-install: preg_match(): Compilation failed: unknown option bit(s) set at offset 0
<p>I recently upgraded my PHP to version 5.4.1 on my Lion OS X 64bit, I'm getting an error thrown in Codeigniter:</p> <pre><code>Severity: Warning Message: preg_match(): Compilation failed: unknown option bit(s) set at offset 0 Filename: core/Utf8.php Line Number: 44 </code></pre> <p>I Googled the problem, this seems to be a problem with the PCRE lib in PHP, well I followed <a href="http://www.hirmet.com/mac-os-x-lion-upgrade-to-php-5-4" rel="nofollow">this tutorial</a> which shows to install pcre with homebrew which I did (I'm running pcre 8.30) and this didn't solve the problem.</p> <p>I've tried looking around for solutions, but I haven't came across one that helped - is there a method of fixing this PCRE lib problem?</p>
php
[2]
5,919,551
5,919,552
Why is my icon not being distributed to the device?
<p>During the work on my iPhone application the icon changed from time to time. Colleagues or management came with fancy new ideas and .pngS and all I did was changing the Icon.png in the file system. Most times the new icon was distributed to simulator or device with the very next build, sometimes I had to delete and add th icon.png in Xcode (images), but it worked. Then, the other day I added the UIPrerenderedIcon element to the info.plist to eliminate the icon's shine (it worked) and since I did, I've problems with bringing new icons to the device:</p> <ul> <li>Simulator shows new icon when in debugging mode</li> <li>Simulator doesn't present new icon in release mode (only when debugging was used before)</li> <li>Never new icons on any iPhone or iPod</li> <li>Whenever icon distribution fails, a white square or (even stranger to me) an old icon (corresponding .png is completly eliminated from the file system) is shown</li> </ul> <p>Any ideas?</p>
iphone
[8]
5,326,853
5,326,854
Why struct can not have parameterless constructor
<p>Why struct can not have parameterless constructor? What's the problem in doing this for CLR or why it's not allowed ? Please explain it as I don't understand it.</p>
c#
[0]
2,828,288
2,828,289
Call master page function from user control?
<p>After searching Google I found one way to call a master page function from a user control: </p> <ol> <li>Create an interface that includes your method.</li> <li>Implement the interface in your master page</li> <li>From your control, reference this.Page.Master via the interface type.</li> <li>Call your method.</li> </ol> <p>This is a good approach, but I don't know that can I call a master page static function in this way.</p> <p><strong>Another approach is :</strong></p> <pre><code>// this is also good. ((MyMaster)this.Page.Master).MyFunction(); </code></pre> <p>But I heard that this can also be done through an event. </p> <p>1) Could someone show me how I could call a master page function from a user control through an event? 2) Also, how can I call a master page static function through a common interface way which I explained above.</p>
asp.net
[9]
2,989,605
2,989,606
How to fill the part of the imageview with another color
<p>I am developing an application in which I am using one <code>UIImageView</code> and adding one rectangle image to that <code>UIImageView</code>. I am getting some float value from another calculation like 67.4 and I need to place one green image on the 67.4 part of rectangle <code>UIImageView</code>. So please tell me how can I fill that green image onto that <code>UIImageView</code> ?</p>
iphone
[8]
5,769,373
5,769,374
why does my code "break" out of loop?
<pre><code>fileName = raw_input("Enter the filename: ") n = input("Enter the line you want to look: ") f = open(fileName,'r') numbers = [] for line in f: sentenceInLine = line.split('\n') for word in sentenceInLine: if word != '': numbers.append(word) print numbers print len(numbers) print numbers[n-1] if n == 0: print "There is no 0 line" break </code></pre>
python
[7]
2,290,728
2,290,729
jquery live function not working for a specific selector
<p>i'm having trouble applying .live function to a specific input tag having a unique id. Am i doing it the wrong way? Any suggestions?</p> <pre><code>$('input.newQty').live('change', function(){ }); //works $('input.newQty[id="'+naam+'"]').live('change', function(){ }); //does not work </code></pre>
jquery
[5]
1,031,380
1,031,381
multiple file preview by javascript
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4100927/chrome-filereader">Chrome FileReader</a> </p> </blockquote> <p>I was wondering how I can change this code in order to be able to preview multiple images.</p> <p>Thank you in advanced.</p> <pre><code>Select Image: &lt;input type="file" name="files[]" multiple=""&gt;​ $("#image").change(function(e) { var file = this.files[0]; var reader = new FileReader(); reader.onload = function(e) { $('&lt;img&gt;').attr('src', e.target.result).appendTo('body'); }; reader.readAsDataURL(file);} }); ​ </code></pre>
javascript
[3]
5,562,184
5,562,185
Make DatePicker and TimePicker smaller
<p>Is there any way to make smaller DatePicker and TimePicker (but to be visible all parts ) in Android ? I tried to set layout_width="130dp" but then DatePicker isn't visible, just left upper corner.</p>
android
[4]
1,576,387
1,576,388
How to perform the default link action after the specified action with Jquery?
<p>I have a "slide out" div that I'm hiding/showing via CSS positioning, and using jquery to toggle a class that sets the hidden/shown state of the div. </p> <p>That's all working great. What I'm now trying to do is have any link farther up on the page change the class to show the div, and jump down the page to it.</p> <p>Here's what I have :</p> <pre><code>$('a[href="#request-trial"]').click(function () { $("#request-trial").toggleClass("on off"); }); </code></pre> <p>The problem is it's first jumping to the anchor, and then changing the class, so it's jumping to the position of the div when it's "off" instead of when it's "on" - does that make sense? Does anyone have any suggestions?</p> <hr> <p>adding some extra info:</p> <p>HTML:</p> <pre><code>&lt;section class="form-popup on" id="request-trial"&gt; &lt;div class="container"&gt; &lt;h1&gt;Let's Talk more!&lt;/h1&gt; &lt;p&gt;Have a project in mind or have an organizational challenge you need assistance in tackling? Get in touch... we’ll discuss ways that the Beyond Nines team could help.&lt;/p&gt; &lt;a class="close"&gt;Close&lt;/a&gt; &lt;/div&gt; &lt;/section&gt; </code></pre> <p>Link is something like:</p> <pre><code>&lt;a href="#request-trial"&gt;Sign up&lt;/a&gt; </code></pre> <p>Css: </p> <pre><code>.form-popup, .form-popup.on { position: absolute; height: 500px; z-index: 0; bottom: 0px; opacity: 1; } .form-popup.off { bottom: -580px; opacity: 0; } </code></pre>
jquery
[5]
1,156,596
1,156,597
Cell Index of a GridView Cell
<p>I'm a novice in .Net. I w8ish to know how to get index of a cell just like getting row index of a row after accessing the GridView.</p>
asp.net
[9]
1,282,946
1,282,947
How to use int.TryParse with nullable int?
<p>I am trying to use TryParse to find if the string value is an integer. If the value is an integer then skip foreach loop. Here is my code.</p> <pre><code>string strValue = "42 " if (int.TryParse(trim(strValue) , intVal)) == false { break; } </code></pre> <p>intVal is a variable of type int?(nullable INT). How can I use Tryparse with nullable int?</p> <p>Thanks..</p>
c#
[0]
552,729
552,730
How to get the current week starting date and add it to a combo box?
<p>I'm attempting to recreate a time sheet built on asp and I can't figure out how to get the current weeks starting date "6-13-2010" and have it populate a combo box can you help me with this I'm new to C# and asp programming.</p>
c#
[0]
2,287,369
2,287,370
jQuery core method overload
<p>how can I <em>overload</em> or extend (or intercept) jQuery's .html() method so that it works its default way unless the object has a certain class?</p> <p>Thanks</p>
jquery
[5]
5,552,671
5,552,672
finding the request on a port
<p>how i can write a java program to find the total number of requests which can be found on a particular port with complete specification (request at present,request running &amp; request pending?</p>
java
[1]
5,059,241
5,059,242
php unable to show chr(128+) when called by jquery
<p>Normally when I ask php to show a character e.g. the EURO sign with <code>chr(128)</code> there is no problem. However, when the php code is being called by jQuery, <code>chr()</code> only works up to 127.The code above will print an empty result is produced.</p> <p>Any idea why and how it can be fixed?</p> <p>Thanks</p>
jquery
[5]
1,207,154
1,207,155
Call C++ main classes from other file
<p>Alright so Im making a text adventure game in C++ and I am quite new to it. I'm experienced in java and some other languages. But I have a problem. I'm trying to call a class from the main file into my other file and I get an error. I get it even when I include the main.cpp in my header file or in my .cpp file. I already know that its bad practice to call .cpp's into another file, but as main has no header file I cant exactly include it. </p>
c++
[6]
5,169,957
5,169,958
Installed PHP module and restarted nginx but but PHP configuration isn't updating?
<p>Okay, I'm on CentOS 5.3 and I'm running an nginx/php/mysql server stack with FastCGI. One of my Twitter apps requires PHP to connect to the Twitter API, which uses OAuth. So I installed the OAuth module with PECL and confirmed that oauth.so was compiled in /usr/lib/php/modules and extension=oauth.so was added in PHP.ini. However, when I try to access the PHP file I get a fatal error, the OAuth class is not found. So I checked phpinfo() and the PHP.ini file hasn't been reloaded apparently. </p> <p>So, how do I force PHP with FastCGI to update its configuration without restarting the server?</p>
php
[2]
3,667,606
3,667,607
nth-child not working using jQuery
<p>Hello Fellas i am trying to use nth-child in my code but its not working following is my code </p> <p><strong>HTML</strong></p> <pre><code>&lt;ul class="colour" &gt; &lt;li&gt;one&lt;/li&gt; &lt;li&gt;two&lt;/li&gt; &lt;li&gt;three&lt;/li&gt; &lt;li&gt;one&lt;/li&gt; &lt;li&gt;two&lt;/li&gt; &lt;li&gt;three&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>jQuery</p> <pre><code>$(document).ready(function(e) { $('.colour ul li:nth-first-child(1)').css('color','pink'); }); </code></pre> <p>I don't know why its not working plz help guys</p>
jquery
[5]
5,567,272
5,567,273
question about code comments in book about designing the business layer
<blockquote> <p>Thanks all for the help</p> </blockquote> <p>Hi All,</p> <pre><code>public static List&lt;Order&gt; LoadAll() { // Load all orders in the table. If too // many records, consider exposing this // operation as a plain ADO.NET function. } </code></pre> <p>What would the "plain ADO.NET function" look like if there were too many records?</p> <p>Thanks, rod.</p> <p>P.S. The name of the book is:</p> <blockquote> <p>Microsoft® .NET: Architecting Applications for the Enterprise</p> </blockquote>
c#
[0]
3,877,413
3,877,414
Set all properties of same name recursively
<p>I have an <code>IsDirty</code> property of type <code>bool</code> on most of my objects.</p> <p>My base object is called <code>Client</code>, but contains several inner collections e.g.: <code>Client.Portfolios.Policies.Covers.CoverOptions</code>, each object type has an <code>IsDirty</code> property:</p> <ul> <li><code>Client.IsDirty</code></li> <li><code>Client.Portfolios.IsDirty</code></li> <li><code>Client.Portfolios.Policies.IsDirty</code></li> <li>etc...</li> </ul> <p>How do I recursively set all <code>IsDirty</code> properties?</p>
c#
[0]
3,730,617
3,730,618
Can you perform an action based on a seperate window in asp.net?
<p>I have a page of search results, and clicking one opens a new window where they edit the information about it. Once they finish, they currently have to hit "search" again to refresh the results to ensure it saved correctly (it refreshes the search results and reflects the new status).</p> <p>Is there any way to trigger the page to automatically refresh (ie. automatically click the search button) based on the popup window closing or through some other means?</p>
asp.net
[9]
5,282,736
5,282,737
How to define default "TagPrefix" for custom controls
<p>I have a number of custom controls that I am trying to enable designer support for. The signature looks something like the following:</p> <pre><code>[ToolboxData("&lt;{0}:MyDropDownList runat=\"server\" CustomProp="123"&gt;&lt;/{0}:MyDropDownList&gt;")] public class MyDropDownList: DropDownList { ... code here } </code></pre> <p>This works fine, but when I drag a control onto the page from the toolbox, the TagPrefix that gets added is "cc1":</p> <pre><code>&lt;%@ Register Assembly="DBMClientPortal.Controls" Namespace="DBMClientPortal.Controls" TagPrefix="cc1" %&gt; </code></pre> <p>Obviously it is somewhat irrelevant what that TagPrefix is... it works as it stands, but I figured I <em>must</em> be able to change it somehow and curiosity got the better of me...</p> <p>Anyone know how to define what the TagPrefix will be set to when dragging a custom control onto a page in visual studio?</p> <p>Thanks, Max</p>
asp.net
[9]
266,303
266,304
Calling webservice from android application without Ksoap
<p>What would be best and simplest way to call Yahoo weather webservice/any json webservice in android? Some people suggest not to use Ksoap for mobile application instead use Restful or Json webservice.</p> <p>TIA Bhaskar</p>
android
[4]
1,273,485
1,273,486
chaining appendTo method to animate is not working?
<p>chaining appendTo to the animate is not working? Meaning the left margin never moves over to margin 0 from margin 600px?</p> <pre><code> $(data).filter('.test1Div').appendTo("#tes1Section").animate({"left": + slideLeft},"slow"); </code></pre> <p>I can see the data get inserted into the #test1Section because I manually move the test1Section div over..</p>
jquery
[5]
2,019,549
2,019,550
How do I make a input field active after I tick a checkbox, using JQuery?
<p>I have this code I wrote but it doesnt seem to be working, see below:</p> <pre><code>$('#Reserve, #BuyItNowPrice, #featureplate').attr('disabled','disabled'); $('.fake-fieldset .fake-input').css({'background-color':'#e1e1e1'}); $('.enable').click(function(){ if($('.enable:checked')){ $(this).closest('input').removeAttr('disabled'); } else{ $(this).closest('input').attr('disabled','disabled'); } }); </code></pre> <p>This HTML structure is repeated 3 times in my code, see below</p> <pre><code> &lt;strong&gt;&lt;input type="checkbox" class="enable" /&gt; Specify Buy It Now Price&lt;/strong&gt; &lt;div class="fake-fieldset"&gt; &lt;div class="fake-input"&gt; &lt;span&gt;&amp;pound;&amp;nbsp;&lt;/span&gt; &lt;input type="text" id="BuyItNowPrice" name="BuyItNowPrice" value="" /&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>What I'd like to happen is when I check <code>.enable</code> the closest input should become active so the user can type a value</p> <p>Any help would be greatly appreciated, Thanks </p>
jquery
[5]
5,681,542
5,681,543
Trying to write a simple Blackjack, but there are errors I don't understand
<p>I have a problem with a code of mine. It gives random errors and I don't know why.. I'm a newbie to C++ so please bear with me >.></p> <p>Here is the code that's problematic:</p> <pre><code>while (!IsGameOver) { struct decktype deck = DeckInit(); struct card card = PickACard(deck); PrintHand(TextCard(card)); } </code></pre> <p>The parameter for 'PrintHand' causes compilation errors no matter what I do. Here are both the functions.</p> <pre><code>char *TextCard(struct card &amp;card) { char str[22]; sprintf(str,"%s of %s (%d)",card_num[card.number],card_type[card.color],card.value); return str; } struct card PrintHand(char &amp;cardtext) { struct card card; return card; } </code></pre> <p>PrintHand isn't done yet, but I don't know how to make it work.. Basically what I want to do is feed a string from TextCard to be used in PrintHand. Could you please help? Much appreciated.</p> <p>EDIT:</p> <p>The structure 'card' at the moment looks like this.</p> <pre><code>struct card { int color; int number; int value; char *hand; int totalvalue; }; </code></pre> <p>And the errors are along the lines of "can't convert something to something". Sorry I couldn't be more specific :/</p>
c++
[6]
3,478,019
3,478,020
avoid overwritting on array
<p>is there any way where overwritting of the array can be avoided...in my implementation i have to write data to an buffer/array of fixed size say buff[100]....and wll b using buff[100] when ever i want to o/p data i wll write to buff[100](i.e wll u again using the same buff[100]) the next time when i use buff[100] it should append the data.</p>
c++
[6]
1,480,865
1,480,866
Why is it called onBlur?
<p>JavaScript has an event called onBlur that fires when a control loses focus. My question is: Why is it called that? Wouldn't all of our lives be easier if it was called OnFocusLost?</p>
javascript
[3]
3,297,329
3,297,330
split links in text file PHP
<p>I have a text file which contains many (over 5000) links. Like this:</p> <pre><code>http://www.website.com/rgfdefvrggh http://www.website.com/rgfdefvrggh http://www.website.com/rgfdefvrggh http://www.website.com/rgfdefvrggh http://www.website.com/rgfdefvrggh http://www.website.com/rgfdefvrggh http://www.website.com/rgfdefvrggh http://www.website.com/rgfdefvrggh http://www.website.com/rgfdefvrggh http://www.website.com/rgfdefvrggh http://www.website.com/rgfdefvrggh http://www.website.com/rgfdefvrggh http://www.website.com/rgfdefvrggh http://www.website.com/rgfdefvrggh http://www.website.com/rgfdefvrggh http://www.website.com/rgfdefvrggh </code></pre> <p>etc etc....</p> <p>I'm trying to fetch each link at a time and do stuff with it....</p> <p>so one by one, get the link <code>do something</code> and then move on to the next....</p> <p>I don't know how i would split the links up...</p> <p>they're all in a .txt file, separated by a line break.</p> <p>any ideas?</p>
php
[2]
4,937,587
4,937,588
Word game server in Python, design pros and cons?
<p>I'd like to get busy with a winter programming project and am contemplating writing an online word game (with a server load of up to, say, 500 users simultaneously). I would prefer it to be platform independent. I intend to use Python, which I have some experience with. For user data storage, after previous experience with MySQL, a flat database design would be preferable but not essential. Okay, now the questions:</p> <p>Is it worth starting with Python 3, or is it still too poorly supported with ports of modules from previous versions?</p> <p>Are there any great advantages in using Python 3 for my particular project? Would I be better off looking at using other languages instead, such as Erlang?</p> <p>Is there any great advantage in using a relational database within a game server?</p> <p>Are there any open source game servers' source code out there that are worthy of study before starting?</p>
python
[7]
5,525,546
5,525,547
How to allow Android WebView to accept Address and Phone information
<p>I am making a webapp for android that uses a WebView that takes control of all hyperlinks instead of having them passed onto a browser for client ease. What would you use when when you'd like to have it so that when you click an address or phone number, it will ask you what program you'd like to open it with? the default browser allows this but I can't seem to figure out where to enable this feature for a WebView. Any ideas?</p>
android
[4]
4,498,096
4,498,097
Integration of sms and speech to text
<p>I am a beginner.I build two apps 1)sms 2)speech to text.Both are working fine on real device.I want to integrate these two apps such that the user must speak the message instead of typing.Is it possible.If yes how can i do it.Any link to build such an app.Or any clear idea plz let me know.</p>
android
[4]
477,610
477,611
Adding values to a list
<p>I'm an R newbie and am trying to create a basic "database" for my comic books. However, I have a problem.</p> <p>The idea is to place each new entry as a list. I assumed that I could set up the lists to look like the following.</p> <pre><code>[Thor, 50, Marvel] [Thor, 51, Marvel] [Thor, 52, Marvel] ... eventually, I 'd like to include entries for story arc, writer, artist, etc. </code></pre> <p>However, I'm using the following code to enter in the comics and have found that each new entry is just added to the end of the list.</p> <pre><code>option = 0 comicdb = [] while option != 3: print "--------------------------" print "1. Add a New Comic Book" print "2. Print the Database" print "3. Quit" option = int(raw_input("Pick an Option: ")) if option == 1: title = raw_input("Comic Book Title: ") issue = int(raw_input("Issue Number: ")) publisher = raw_input("Publisher: ") comicdb.append(title) comicdb.append(issue) comicdb.append(publisher) print comicdb </code></pre> <p>After running the code a couple times, the list looks like:</p> <pre><code>['Thor', 50, 'Marvel', 'Thor', 51, 'Marvel', 'Thor', 52, 'Marvel'] </code></pre> <p>I'm assuming that one of the following things is wrong, but I can't figure it out:</p> <ol> <li>append is the wrong command to use</li> <li>i should use a dictionary or tuple instead of a list</li> </ol> <p>Help!</p>
python
[7]
2,359,681
2,359,682
jquery remove part of href that is dynamic
<p>In this href:</p> <pre><code>&lt;a href="/Lists/ListeActualitesCarrousel/4_.000/DispForm.aspx?ID=4" class=""&gt;Lire l'article&lt;/a&gt; </code></pre> <p>This part <code>/ListeActualitesCarrousel/4_.000/</code> is dynamic and can change, I would like to remove it. Thus, the URL will become:</p> <pre><code>&lt;a href="/Lists/ListeActualitesCarrousel/DispForm.aspx?ID=4" class=""&gt;Lire l'article&lt;/a&gt; </code></pre> <p>How can that be done?</p>
jquery
[5]
1,573,062
1,573,063
Home screen takng time to load after the application in android
<p>i have an application which i have made. Once i use this application for sometime and if i press the home screen, it takes the home screen sometime to load and a progress dialog appears telling me that it's loading.</p> <p>My application is not a graphics intensive application. It just parsers data from the an XML and displays.</p> <p>Is is because of the coding of my application that the home screen is taking time to load?</p> <p>thank you in advance.</p>
android
[4]
4,406,598
4,406,599
Celcius to Fahrenheit
<p>I can convert from fahrenheit to celcius, but not the other way around. I have attached the code below. Hopefully it's enough to see what is going on.</p> <pre><code> public void actionPerformed(ActionEvent arg0) { double temps = 0, temp1 = 0; String instrings; instrings = temp.getText(); if(instrings.equals("")) { instrings = "0"; temp.setText("0"); } temps = Double.parseDouble(instrings); instrings = temp.getText(); if(instrings.equals("")) { instrings = "0"; temp.setText("0"); } temp1 = Double.parseDouble(instrings); if(arg0.getActionCommand().equals("C")){ temps = (( temps * 9)/5+32); DecimalFormat formatters = new DecimalFormat("#,###,###.###"); results.setText(""+formatters.format(temps)); } else if(arg0.getActionCommand().equals("F")); { temp1 = (((temps - 32)/9)*5); DecimalFormat formatters = new DecimalFormat("#,###,###.###"); results.setText(""+formatters.format(temp1)); } } </code></pre>
java
[1]
3,847,841
3,847,842
using IMG_FILTER_GAUSSIAN_BLUR makes my thumb too much blury
<p>so im using my class to resize an image to a very little thumb, and im trying to blur that thumb in order to have a decent image and not some broken image all pixaleted. but IMG_FILTER_GAUSSIAN_BLUR its a little TOO MUCH. </p> <pre><code>imagefilter($newImg, IMG_FILTER_GAUSSIAN_BLUR); imagefilter($newImg, IMG_FILTER_EDGEDETECT); imagejpeg($newImg, $this-&gt;getImage(), 90); </code></pre> <p>is there any decent way to have a good quality thumbnail from a picture?</p>
php
[2]
2,183,683
2,183,684
How do i get the full path of the file in Firefox
<p>How do i get the full path of the file in Firefox with JavaScript?</p> <p>Thanks in advance!</p>
javascript
[3]
3,026,120
3,026,121
get top margin from a div and apply to another
<p>I have used the following Jquery code to make fixed position sidebar div middle of screen.</p> <pre><code>$j("#sidebar").css('margin-top', $j(window).height()/2 - $j("#sidebar").height()/2); </code></pre> <p>now i am trying to get it's top margin to apply with #content div.</p> <p>is there any way to do it easily.</p> <p>Thanks in advance.</p>
jquery
[5]
3,483,693
3,483,694
How check javascript not to open the same window with window.open function
<p>In my javascript i want to open URL in new window with this method:</p> <pre><code>var win = window.open(url...); </code></pre> <p>How can i check this, not to open the same window and lose all inputted data. For example, if i opened "www.musite.com/addproduct" URL in new window, input data, leave my work place. then i click open window again, new window open and i lost all my data.</p>
javascript
[3]
4,512,615
4,512,616
how do I automatically execute javascript?
<p>how do I automatically execute javascript?</p> <p>I know of <code>&lt;body onLoad=""&gt;</code>, but I just thought maybe there is another way to do it?</p> <p>html:</p> <pre><code>&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;div id="test"&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt; </code></pre> <p>javascript:</p> <pre><code>&lt;script&gt;(function(){var text = document.getElementById('test').innerHTML;var newtext = text.replace('', '');return newtext;})();&lt;/script&gt; </code></pre> <p>I wanna get the text within "test", replace certain parts, and then output it to the browser.</p> <p>Any ideas on how to do it? I'd appreciate any help. Thanks.</p>
javascript
[3]
1,599,953
1,599,954
jQuery - rule for "does not contain element"
<p>I want to create a rule to match only on the following:</p> <pre><code>&lt;ul id="root"&gt; &lt;li&gt; &lt;a href="item.html"&gt;Root Menu Item&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>However it must not match if the "li" element contains another "ul" element:</p> <pre><code>&lt;ul id="root"&gt; &lt;li&gt; &lt;a href="#"&gt;Sub Menu&lt;/a&gt; &lt;ul&gt; &lt;li&gt; &lt;a href="item.html"&gt;Sub Menu Item&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>The event for the rule is a click() function on the "a" element, I have created the event as required but need it to only work on the root menu items.</p> <p>I know I can just add an id attribute to target the desired element only but the menu plugin that my client has installed is not easily configurable.</p>
jquery
[5]
2,883,670
2,883,671
how to autoplay all songs one after another?
<p>i am creating a music application in which i m having 20 songs.First i have to download all the songs from my server which i am done with now my next requirement is after downloading gets over all the songs should play one after another.</p> <p>To play one song m using the below code:</p> <pre><code> player=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:Mp3filePath] error:nil]; [player play]; </code></pre> <p>please help me as soon as possible.......</p>
iphone
[8]
1,906,142
1,906,143
How do I use Python to convert a string to a number if it has commas in it as thousands separators?
<p>I have a string that represents a number which uses commas to separate thousands. How can I convert this to a number in python?</p> <pre><code>&gt;&gt;&gt; int("1,000,000") </code></pre> <p>Generates a <code>ValueError</code>.</p> <p>I could replace the commas with empty strings before I try to convert it, but that feels wrong somehow. Is there a better way?</p>
python
[7]
4,084,149
4,084,150
jQuery each element
<p>I'm curious why this code is invalid:</p> <pre><code>$.each( $("p") ).css("color", "green"); </code></pre> <p><br /> While this code works fine:</p> <pre><code>$.each($("p"), function() { $(this).css("color", "green") }); </code></pre> <p><br /> Is it not possible to chain elements with each?</p>
jquery
[5]
3,789,308
3,789,309
dynamic button creation with single refrence
<p>Here i am creating 20 Button dynamically using for loop</p> <p>exmple</p> <pre><code>for(int i =1 ;i &lt;= 20 ;i++){ Button b = new Button(this); b.setText(String.valueOf(i)); b.setId(String.valueOf(i)); b.setBackgroudColor(Color.Red); b.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { b.setBackgroundColor(Color.GREEN); } ); } </code></pre> <p>If i select 1st Button color will be changing to green remaining all are red. similarly if i select 2nd Button 1st and 2nd button color will be green and remaining all are red. this is the way it working fine .but my requirement is if i select the any button 2nd time all buttons and previous button which i pressed color should be red. to do that i am not getting the previous button id's. can any help for this problem </p>
android
[4]
727,986
727,987
change style (using variable)
<p>I've this code and I need to change MyCustonTheme1 to 2 or 3 or 4 (From a value by sharedpreferences, user choose a value (1,2,3,4)</p> <pre><code>AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.MyCustomTheme1); </code></pre> <p>In MainActivity I've:</p> <pre><code>if (fade == 500){ animazione = "R.style.MyCustomTheme1"; } if (fade == 1000){ animazione = "R.style.MyCustomTheme2"; } [...] </code></pre> <p>Now, I need put "animazione" like this code:</p> <pre><code>AlertDialog.Builder builder = new AlertDialog.Builder(this, animazione); </code></pre> <p>The constructor AlertDialog.Builder(MainActivity, String) is undefined</p> <p>Is it possibile change R.style.MyCustomTheme1 to variable like "animazione"?</p> <p>thanks!</p>
android
[4]
2,711,203
2,711,204
Why do we still use JavaScript?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://programmers.stackexchange.com/questions/44842/why-arent-there-other-client-side-scripting-languages-for-websites">Why aren&#39;t there other client-side scripting languages for websites?</a> </p> </blockquote> <p>It seems to me that, despite being one of the world's most used languages, even some of the leading experts of JavaScript like <a href="http://en.wikipedia.org/wiki/Douglas_Crockford">Doug Crockford</a> think JavaScript suffers from some pretty big design flaws (<em><a href="http://www.crockford.com/javascript/javascript.html">JavaScript: The World's Most Misunderstood Programming Language</a></em>) that make development confusing and ambigious.</p> <p>Programming languages and development tools are always getting better and make it much easier for developers to make things. There's a new version of .NET every few years, new version of HTML5 with new tags, new versions of CSS, etc.</p> <p>Why hasn't there been a better version of JavaScript or another dynamic loosely typed language, but without all the design flaws, come out to supercede JavaScript?</p>
javascript
[3]
1,316,290
1,316,291
Hiding a folder in Android
<p>I want to make an application in android ,which can hide my selected files are folders from Sdcard . your suggestion will be appreciated.Thanks!! </p>
android
[4]
2,972,747
2,972,748
Android List with Image - How to implement
<p>I'm looking for a clear way to establish the XML resource for a list of strings with an image attached to it. Should I use attributes? What is the best practice? </p>
android
[4]
1,835,609
1,835,610
Android: Application restarts sometimes
<p>I found a strange behavior in my App. When i try to fetch data from the internet with bad wifi signal, i have a couple of exceptions(IOException, SocketException). All this exceptions are handled in the application in try-catch block, but app performance slows, and in one moment application restart. I have a SomeClass extends from Application class where onCreate method calls again after this exceptions.</p> <p>I haven't got OutOfMemory error in the log, and method onLowMemory of Application didn't call.</p> <p>Is anybody have any idea about this behavior?</p>
android
[4]
3,834,656
3,834,657
How to change href of <a> tag on button click through javascript
<p>I want to change the href of <code>&lt;a&gt;</code> tag through javascript on button click.I m not find out any help regard this.Please help me asap.I shall be very thankful to you</p> <pre><code> &lt;script type="text/javascript"&gt; function f1() { document.getElementById("abc").href="xyz.php"; } &lt;/script&gt; &lt;a href="" id="abc"&gt;jhg&lt;/a&gt; &lt;a href="" id="" onclick="f1()"&gt;jhhghj&lt;/a&gt; </code></pre>
javascript
[3]
2,758,203
2,758,204
obtaining current location in GPS?
<p>Below is my code but its not working. Can anyone help me???</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; CLController = [[CoreLocationController alloc] init]; CLController.delegate = self; //[CLController setDesiredAccuracy:kCLLocationAccuracyBest]; [CLController.locMgr startUpdatingLocation]; } - (void)locationUpdate:(CLLocation *)location { locLabel.text = [location description]; } - (void)locationError:(NSError *)error { locLabel.text = [error description]; } </code></pre>
iphone
[8]
4,863,267
4,863,268
I found a php code in my server , how can know what is mean?
<p>How are you ?</p> <p>I found a php code , but i can't know what is mean .. maybe some one put it in my server ..</p> <p>it is strange ..</p> <p>maybe you can know what is mean?</p> <p>here : <a href="http://codepaste.net/3rj6y8" rel="nofollow">http://codepaste.net/3rj6y8</a></p>
php
[2]
3,737,964
3,737,965
Script tag in JavaScript string
<p>I am encountering an issue where having a ending script tag inside a quoted string in JavaScript, and it is killing the script. I assume this is not expected behaviour. An example of this can be seen here: <a href="http://jsbin.com/oqepe/edit">http://jsbin.com/oqepe/edit</a></p> <p>My test case browser for the interested: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4) Gecko/20091028 Ubuntu/9.10 (karmic) Firefox/3.5.4.</p>
javascript
[3]
3,690,525
3,690,526
Strange behavior when comparing float with a constant
<p>I was struck by this strange behavior:</p> <pre><code>float pi = 3.14; if(pi == 3.14) cout &lt;&lt; "OK"; else cout &lt;&lt; "How is it possible?"; </code></pre> <p>Could anyone explain this?</p>
c++
[6]
4,590,892
4,590,893
Is it possible to call a method with a null parameter but have the argument not be null?
<p>In the function below, what can I use to replace <code>&lt;typedefinition&gt;</code> to make the program print "O noes!"?</p> <pre><code>public static void main(String[] args) { Object o = null; story(o); } private static void story(&lt;typedefinition&gt; o) { if (o != null) System.out.println("O noes!"); else System.out.println("O yes"); } </code></pre>
java
[1]
1,233,346
1,233,347
problem with installing app in the device
<p>I have an android app. (built for 1.5) while installing it on my device it creates no error, but while running it, it says "the application is not installed in your phone".. can any one help me...? I have tried this installing after uninstalling it for many times...</p> <p><strong>Manifest file:</strong></p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.testapp" android:versionCode="1" android:versionName="1.0"&gt; &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt; &lt;activity android:label="@string/app_name" android:name="WelcomeScreen"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name="Untitled1"&gt;&lt;/activity&gt; &lt;activity android:name="Welcome"&gt;&lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre>
android
[4]
489,124
489,125
Problems with reading and searching thru txt file with PHP
<p>I am writing a small script which checks if a users has his username in file called whitelist.txt or not. If the username is not found its added. This is the script:</p> <pre><code>$fh = @fopen("whitelist.txt", 'a+'); $stringData = $_POST[usr]. "\n"; if ($fh) { while (!feof($fh)) { $buffer = fgets($fh); if (strpos($buffer, $stringData) == TRUE) echo "This username is already whitelisted."; elseif (strpos($buffer, $stringData) == FALSE) { fwrite($fh, $stringData); echo "Username ". $stringData. " is now whitelisted."; } } fclose($fh); } </code></pre> <p>What I get now if I enter a new username first time, all is ok. The second time I enter a new username it gets dubbled. Problems go on: if I enter an existing username it gets added twice and the message "This username is already whitelisted." is not shown. Every username is in a new row.</p> <p>Thank you for your time and help!</p>
php
[2]
5,425,106
5,425,107
why the method with int parameter is considered for numerical value?
<pre><code>class Test { void m1(byte b) { System.out.print("byte"); } void m1(short s) { System.out.print("short"); } void m1(int i) { System.out.print("int"); } void m1(long l) { System.out.print("long"); } public static void main(String [] args) { Test test = new Test(); test.m1(2); } } </code></pre> <p>The output is : int. why does jvm consider the method with int parameter?</p>
java
[1]
2,998,583
2,998,584
Need timer to run after 10 seconds in C#
<p>I am working with socket programing ,I can to check the live connection of Users after some time intervals such as 10 seconds.But currently, i have no idea. how i will do it.</p> <p>Please help me. I shall be highly thankful.</p>
c#
[0]
3,049,586
3,049,587
Determine the file type using C#
<p>I have a web page that has the file upload component to upload the allowed document types only to my system (images only). I don't want to use the regular expression to determine the file type and using the extension.</p> <p>Please let me know if there is any other means of determining file types in C#.</p>
c#
[0]
1,262,166
1,262,167
Python Method Placement
<p>Can someone give me a solution to this</p> <pre><code>dosomething() def dosomething(): print 'do something' </code></pre> <p>I don't want my method defines up at the top of the file, is there a way around this?</p>
python
[7]
2,533,489
2,533,490
How a reference address become NULL in C++?
<p>I have a coredump,it shows a reference address is NULL....</p> <p>details:</p> <pre><code>(gdb) bt #0 0xffffe410 in __kernel_vsyscall () #1 0x005b6c10 in raise () from /lib/libc.so.6 #2 0x005b8521 in abort () from /lib/libc.so.6 #3 0xf749e641 in Application::fatalSignal () at Application.cc:277 #4 &lt;signal handler called&gt; #5 SdlProcess::procedureReturn (this=0x0, aSignal=0, aArg1=1, aArg2=0x0) at /include/c++/4.1.1/bits/stl_list.h:652 #6 0x08112edb in Sdl::authFailurer (aSdlProcess=@0x0, aLabel=0, aSignal=0, arg2=0x0) at /Mgr/SdlAuth.cc:1781 #7 0x00000000 in ?? () ================ define: Sdl::authFailurer(SdlProcess&amp; aSdlProcess, int aLabel, int aSignal, int /*arg1*/, void* arg2) #5 aSdlProcess.procedureReturn(0, 1, 0); </code></pre> <p>and in stl_list.h:652</p> <pre><code> bool empty() const { return this-&gt;_M_impl._M_node._M_next == &amp;this-&gt;_M_impl._M_node; } ----&gt;652 in procedureReturn() { ... if (!mProcedureStack.empty())----&gt;here,mProcedureStack is a datamember of SdlProcess ... { ...} } </code></pre>
c++
[6]
5,993,388
5,993,389
Resizing the webview content
<p>I am loading image url on to webview it fetching the image as well but i need to display it in resizeable it means te height to be reduced,help me to get reduced height of the image.</p>
android
[4]
886,965
886,966
HTML-formatted selected text returns whitespace from a range selection
<p>I have a Javascript routine that retrieves the selection text by a user formatted as HTML:</p> <pre><code>function getHTMLOfSelection() { var range; if (document.selection &amp;&amp; document.selection.createRange) { range = document.selection.createRange(); return range.htmlText; } else if (window.getSelection) { var selection = window.getSelection(); if (selection.rangeCount &gt; 0) { range = selection.getRangeAt(0); var clonedSelection = range.cloneContents(); var div = document.createElement('div'); div.appendChild(clonedSelection); return div.innerHTML; } else { return ''; } } else { return ''; } } </code></pre> <p>With the fiddle, make sure and select the quoted text first:</p> <p><a href="http://jsfiddle.net/userdude/Y4BBq/13/" rel="nofollow">http://jsfiddle.net/userdude/Y4BBq/13/</a></p> <p>The code works fine, however, the selection includes a <code>\r\n</code> after every <code>&lt;/p&gt;</code> and <code>&lt;br/&gt;</code>. Why are these added and at what point? It seems redundant, as the <code>&lt;p&gt;</code> and <code>&lt;br&gt;</code> tags already include the new line.</p>
javascript
[3]
3,409,436
3,409,437
Splitting a string into words in Java
<p>Could you please assist me with the code for splitting this string. I am using <strong>"|"</strong> as a special character to mark how the splitting is to be done</p> <p>The string is "<strong>The|value|is|infinite</strong>" so that after splitting I have 'the','value','is' and 'infinite' as separate strings. Thank you.</p>
java
[1]
2,103,213
2,103,214
What does it mean if change the order of code bugs occur?
<p>I change places function so that the caller is before called, an error occurs.</p> <p>What can say this character? Maybe somewhere in the distance of a kilometer bracket is not closed?</p> <p>UPD: For example, its code work correctly if I place first string at end:</p> <p>SCRIPT5022: Pass a function that returns the value of the dependentObservable knockout-2.0.0.debug.js, line 1054 character 9</p> <pre><code>osagoViewModel.fields.yearsBoxes = new field("Years", yearsBoxesFunc, null, osagoViewModel); function yearsBox() { this.year = new field("Years", function () { return ["1 year", "2 years", "3 years", "4 years", "5 years", "6 years", "7 years", "8 years", "9 years", "10 years"]; }, null, osagoViewModel); } var yearsBoxesFunc = function () { var yearsBoxCount = osagoViewModel.fields.driversCount.selectedValue(); var retArrFunc = function (count) { var arr = []; for (var i = 0; i &lt; count; i++) { arr.push(new yearsBox()); } return arr; }; switch (yearsBoxCount) { case "many": return retArrFunc(0); case "1": return retArrFunc(1); case "2": return retArrFunc(2); case "3": return retArrFunc(3); case "4": return retArrFunc(4); case "5": return retArrFunc(5); } } </code></pre>
javascript
[3]
4,394,534
4,394,535
c# Progress Bar based on event and delgate not working
<p>I need help in troubleshooting my code. I have 3 classes. Class 1 is a WinForm with Progressbar on it. Class 2 is where the event is fired. Class 3 is the EventArg for the progress. The program compiles with out any errors, but when I click the button, the progress bar does not move!. </p> <pre><code>namespace WindowsFormsApplication1 { class Class1 { //Declaring a delegate public delegate void StatusUpdateHandler(object sender, ProgressEventArgs e); //Declaraing an event public event StatusUpdateHandler OnUpdateStatus; public int recno; public void Func() { //time consuming code for (recno = 0; recno &lt;= 100; recno++) { UpdateStatus(recno); } } public void UpdateStatus(int recno) { // Make sure someone is listening to event if (OnUpdateStatus == null) return; &lt;--------------OnUpdateStatus is always null not sure why? ProgressEventArgs args = new ProgressEventArgs(recno); OnUpdateStatus(this, args); } } } namespace WindowsFormsApplication1 { public partial class Form1 : Form { private Class1 testClass; public Form1() { InitializeComponent(); testClass = new Class1(); testClass.OnUpdateStatus += new Class1.StatusUpdateHandler(UpdateStatus); } public void button1_Click(object sender, EventArgs e) { Class1 c = new Class1(); c.Func(); } public void UpdateStatus(object sender, ProgressEventArgs e) { progressBar1.Minimum = 0; progressBar1.Maximum = 100; progressBar1.Value = e.Recno; } } } namespace WindowsFormsApplication1 { public class ProgressEventArgs : EventArgs { public int Recno { get; private set; } public ProgressEventArgs(int recno) { Recno = recno; } } } </code></pre>
c#
[0]
3,692,225
3,692,226
get contacts Birthday in iphone
<p>I got the code from stackoverflow of getting contacts birthday in label in iphone but it is printing in console 2013-01-09 13:31:15.913 addressBook[1478:c07] 1604-09-29 12:00:00 +0000 so how can only print birthdate.plz help me</p>
iphone
[8]
4,375,180
4,375,181
What's the difference between e.preventDefault(); and return false?
<pre><code>$("a.avatar").click(function(e){ e.preventDefault(); $("#thumbnails").fadeIn(); }); </code></pre> <p>and </p> <pre><code>$("a.avatar").click(function(e){ $("#thumbnails").fadeIn(); return false; }); </code></pre> <p>Both can achieve the same goal for me.</p>
jquery
[5]
4,267,495
4,267,496
android keyboard
<p>Hi I have added a new button in android virtual keyboard and gave name Done. Now i want to perform some action by pressing Done button. How to do this can any body help?</p> <p>Thanks &amp; Regards.</p>
android
[4]
3,400,037
3,400,038
how to set a confirm box with picture(javascript)
<p>In Chrome web store, when I add a new application, there is a confirm box with a picture (App icon) to ask me. I have tried to search the JavaScript code to find the answer but there is no result.</p> <p>Is it created by JavaScript API?</p>
javascript
[3]
5,263,896
5,263,897
Refer to class variable in another class variable definition
<pre><code>class SomeClass: SOME_CONST = "hello" SOME_OTHER_CONST = SomeClass.SOME_CONST + " world" </code></pre> <p>This doesn't work.</p> <blockquote> <p>NameError: name 'SomeClass' is not defined</p> </blockquote> <p>Is there any way to refer to the class within the class?</p>
python
[7]
5,508,882
5,508,883
Get the ActionBar to redraw itself?
<p>I'd like to replace the icon used for an ActionBar item at runtime (it appears as an action item on the ActionBar). I'm trying the following:</p> <pre><code>private Map&lt;Integer, Integer&gt; mPendingReplacements = new HashMap&lt;Integer, Integer&gt;(); @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.my_menu, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onPrepareOptionsMenu(Menu menu) { for (Map.Entry&lt;Integer, Integer&gt; it : mPendingReplacements.entrySet()) { MenuItem item = menu.findItem(it.getKey().intValue()); if (item != null) { item.setIcon(getResources().getDrawable(it.getValue().intValue())); } } mPendingReplacements.clear(); return true; } private void replaceMenuItemIcon(int menuItemId, int drawable) { mPendingReplacements.put(menuItemId, drawable); invalidateOptionsMenu(); } private void onUserClickedSomeButton() { replaceMenuItemIcon(R.id.foo, R.drawable.grok); } </code></pre> <p>------------ Update -----------</p> <p>Updated the above sample to use mPendingReplacements as suggested by Selvin. I can see it execute as excepted, but the actionbar icon still doesn't change immediately. Will continue digging into this, but can anyone spot if I'm missing something?</p> <p>Thank you</p>
android
[4]
3,880,289
3,880,290
How to use a UIButton as a toggle switch
<p>I am using a UIButton of custom type and what I want is use it like a toggle switch with the change of image. Like when it is clicked if previously it was not in selected mode it should go in selected mode or otherwise vice-a-versa. Also it will have a different image and when it is selected it will have a different image when it is not.</p> <p>I am not able to do it programatically, is there any good easy way to do this.</p>
iphone
[8]
5,374,778
5,374,779
jquery mobile - Aligning issue
<p>I have the following in jquery mobile:</p> <pre><code> &lt;div class="ui-grid-b"&gt; &lt;div class="ui-block-a" style="width:40%"&gt; &lt;label for="Main_deg"&gt;Deg&lt;/label&gt; &lt;asp:DropDownList id="deg" runat="server"&gt; &lt;/asp:DropDownList&gt; &lt;/div&gt; &lt;div class="ui-block-b" style="width:10%"&gt; &lt;button class="button" type="button" id="mther" onclick="otherDialog()"&gt;Other Click&lt;/button&gt; &lt;/div&gt; &lt;div class="ui-block-c" style="width:50%"&gt; &lt;label for="specialty"&gt;Special&lt;/label&gt; &lt;input type="text" id="special name="specialty" /&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>What I am getting is that the the first and third div's are aligned horizontally fine. THe middle div - that one that has Other Click is slightly above the other 2. Any idea on how I can have them all be aligned? </p>
jquery
[5]
37,934
37,935
HTC problems with android application
<p>I have written a simple android application for auto-replying to SMS messages. It starts a service for monitoring incoming messages, then replies to them.</p> <p>It works fine using the Elipse AVD as well as the 3 Motorola phones I have installed it on. I have been having problems with it causing problems with "com.android" processes on the 2 HTC phones it is installed on. The processes are random but will display an alert box with a "Force Close" button.</p> <p>Can anyone help with this? Is there something special about the HTC OS I have to account for in my application? </p>
android
[4]