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
2,014,765
2,014,766
Strange issue about date and cookie
<p>I write this code:</p> <pre><code>var Ec = new Date (); Ec.setTime(Ec.getTime() + (365 * 24 * 3600 * 1000)); var Ed = new Date (); Ed.setTime(Ed.getTime() + (24 * 3600 * 1000)); document.cookie="visit=" + Ed.toGMTString() + ";expires=" + Ec.toGMTString(); var Ea = new Date (); Ea.setTime(Ea.getTime() + (24 * 3600 * 1000)); alert(Ea.toGMTString()); </code></pre> <p>In the cookie are stored this:</p> <pre>06/26/2012 8:46 AM</pre> <p>and in the alert it display this:</p> <pre>06/26/2012 12:46 AM</pre> <p>And the current time in my country is:</p> <pre><code> 06/25/2012 14:46 </code></pre> <p>Why ? I want simply store in the cookie the current time + 24 hours.</p>
javascript
[3]
4,851,119
4,851,120
Random interval number
<p>I modified this countdown script to actually count up.</p> <p>Now it changes the innerHTML of the div "container" every 300 ms.</p> <p>How can i change that 300ms to be a random number between 300 and 2000?</p> <p>Thanks so much for all your help :P</p> <p>Greetz, Camillo</p> <pre><code>var time = 1; //How long (in seconds) to countdown function countDown(){ time++; gett("container").innerHTML = time; if(time == 0){ window.location = page; } } function gett(id){ if(document.getElementById) return document.getElementById(id); if(document.all) return document.all.id; if(document.layers) return document.layers.id; if(window.opera) return window.opera.id; } function init(){ if(gett('container')){ setInterval(countDown, 300); // here instead of 300 a random number between 300 and 2000 gett("container").innerHTML = time; } else{ setTimeout(init, 50); } } </code></pre>
javascript
[3]
3,529,982
3,529,983
Getting the pointer to dib in a bmp file in C++
<p>I want to get a byte * to the dib in a bmp file in C++. I know that bmp contains a bmp header and I need to open the bmp file and skip some bytes in order to get the pointer to the dib. I am unfamiliar with C++ so any code would be helpful!</p> <p>Pseudocode of what I want to do:</p> <pre><code>byte * pointer = open(file.bmp); pointer += number of bits to get to dib. return pointer </code></pre>
c++
[6]
3,290,436
3,290,437
Where can I find third-party components?
<p>Where can I find third-party components for the Android? Components such as dials, meters, graphics of volume controls LED's, etc?</p>
android
[4]
5,783,891
5,783,892
C++: Pointer to char array
<p>I can't cope with pointers. Could you have a look at my problem.</p> <p>A function is as follows:</p> <pre><code> char * string_to_char_array(string line, int size) { char *a = new char[size]; &lt;..........&gt; return a; } </code></pre> <p>I call it and get this:</p> <pre><code>string autor = "Wern"; char * a = string_to_char_array(autor, 20); </code></pre> <p>Then I can do this:</p> <pre><code>char Autor[20]; for (int i = 0; i &lt; 20; i++) { Autor[i] = a[i]; } for (int i = 0; i &lt; 20; i++) { cout &lt;&lt; Autor[i]; } </code></pre> <p>I suppose this clumsy but somehow I don't know how to make it easier. Will you be so kind as to give me a piece of advice?</p>
c++
[6]
57,111
57,112
JQuery returns same charcode for capitals and lowercase
<p>i have attached this function to the key pressed event with jquery but in the eventObject it returns the same char code for capitals and lower case characters entered</p> <pre><code>function keyPressed(delegates,eventdata){ var keyType = new KeyType(); var keycode = eventdata.which; if((keycode === 0)&amp;&amp;(eventdata.keyCode === 46)){ keycode=46; } switch(keycode) { case keyType.enter: break; case keyType.backspace: break; case keyType.del: break; case keyType.space: break; default: keycode = 1; } console.log(eventdata.charCode); console.log(eventdata.which); console.log(eventdata.keyCode); //if a delegate is present call it var delegate = delegates[keycode]; if(delegate !== null){ delegate(eventdata); } } </code></pre>
jquery
[5]
3,606,638
3,606,639
audio recording in android
<p>I have and android emulator and microphone connected to my pc. I want to capture pcm pulses from microphone (i.e. record voice) and then send to udp socket. please anybody help me in source code at least for voice recording.</p>
android
[4]
308,207
308,208
Is SQL Server Compact Edition Serverless?
<p>Is SQL Server Compact Edition Serverless?</p> <p>I mean, If I have a Northwind.sdf file in some pc without SQL server installed, can my application still use that? </p> <p>Is it the same with SQLITE?</p>
c#
[0]
1,735,396
1,735,397
'document' for itext# not defined error on website
<p>I'm successfully using Itext# in my vs2008 development environment, the itextsharp.dll is in the 'bin' directory under the website root folder. however I'm getting the 'BC30002: Type 'Document' is not defined' error on the commercial website where the app runs: Dim document As New Document(PageSize.A4, 50, 50, 25, 25)</p> <p>on the commercial website the directory structure looks like this websiteRootDir/aSubDir/myAppRootDir/bin/, my webpage .aspx is in the myAppRootDir and the itextsharp.dll is in the bin directory directly under myAppRootDir</p> <p>I have namespace declarations in both the web.config and the webpage .aspx there is also a websiteRootDir/bin/ directory and have also put the .dll there also, but same error</p> <p>any ideas where/how etc to put the itextsharp.dll</p>
asp.net
[9]
2,224,283
2,224,284
Have TextView scale its font size to fill parent?
<p>Is there a way to have a TextView pick a font size such that it fills whatever space it has available? For example:</p> <pre><code>&lt;LinearLayout layout_width="fill_parent" layout_height="50dip" &gt; &lt;TextView layout_width="fill_parent" layout_height="fill_parent" textSize="scale?" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>Thanks</p>
android
[4]
5,286,208
5,286,209
In python, detect type, then cast to that type
<p>In support of some legacy code, I have to read a text file and parse it for statements like <code>x=102</code> and <code>file=foo.dat</code> that might be used to overwrite default values. Note that the second one there is not <code>file='foo.dat'</code>; these aren't python statements, but they're close.</p> <p>Now, I can get the <code>type</code> of the default object, so I know that <code>x</code> should be an int and <code>file</code> should be a str. So, I need a way to cast the right-hand side to that type. I'd like to do this programmatically, so that I can call a single, simple default-setting function. In particular, I'd prefer to not have to loop over all the built-in types. Is it possible?</p>
python
[7]
5,929,647
5,929,648
Android Progress Bar is not dismissed
<p>I am using Progress Dialog to show progress while loading web page, but sometimes it does not work properly. Progress Dialog never get dismissed though page is loaded.</p> <p>I have added Progress Bar like this</p> <pre><code>public boolean shouldOverrideUrlLoading(WebView view, String url) { //Added progress dialog } public void onPageFinished(WebView view, String url) { if(progressdialog.isShowing()) progressdialog.dismiss(); //Dismissed the progress, but sometimes never dismiss it } </code></pre>
android
[4]
1,254,068
1,254,069
windows application can not write to log.txt
<p>This is main program.cs</p> <pre><code>LogError.WriteError("Application started: " + DateTime.Now + Environment.NewLine); try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new CrawlerApp()); } catch (Exception e) { LogError.WriteError(e); } LogError.WriteError("Application closed: " + DateTime.Now + Environment.NewLine); </code></pre> <p>and this is LogError class</p> <pre><code>public static class LogError { public static void WriteError(Exception e) { WriteError("Message: " + e.Message + Environment.NewLine + "Stack trace: " + e.StackTrace); } public static void WriteError(string error) { try { StreamWriter sw = File.AppendText("log.txt"); sw.WriteLine(DateTime.Now + Environment.NewLine); sw.WriteLine(error + Environment.NewLine); sw.WriteLine(Environment.NewLine); sw.Close(); } catch (Exception) { // } } } </code></pre> <p>When i publish application and run it log.txt file is never created. If i run application from bin/debug folder then works. Why when i publish app logging not working. I am using win 2003 OS.</p>
c#
[0]
909,745
909,746
Selective USB UMS-Mode
<p>is there a way to regulate the UMS-mode? I would like to implement a feature, that lets the user select which files he wants to share with a pc. Say you only want the pc see the picture subfolder, but not all the other folders on your sd. I am not sure if this is possible and most likely I will require root access when possible.</p> <p>I know this will bring no real security, because you can always remove the sd card and read all the files on it. I thought of this feature mainly because of my crappy car radio. It can read mp3 files from a usb stick. But the many different folders and strange files on a android sd card seems to kill it. Furthermore I think there are a lot of other situation when you would prefer only to show a smaller part of your sd memory to a pc. </p> <p>Can you imagine any other way to simulate the described behaviour? Can I generate completely new usb modes and implement my own UMS?</p> <p>Every idea is welcome.</p> <p>Sincerely Erik</p>
android
[4]
4,358,681
4,358,682
iphone is there a way to create a view over the tabbar?
<p>I have an application that pulls up a login page when it first starts. This login page goes over the application and does not let anyone through until they've logged in. I also have a settings tab on my main application that needs to lead back to this login screen. Right now it displays the login screen with the tab bar over it. Is there a way to get the login view over the tab bar?</p>
iphone
[8]
3,601,984
3,601,985
Python deleting from a dictionary using list comprehensions
<p>I'm trying to be a good pythonista and use list comprehensions where possible...</p> <p>Why doesn't this work?</p> <pre><code>[del my_dict[r] for r in to_remove] </code></pre> <p>The goal is to remove the entries in the list <code>to_remove</code> from my dict object <code>my_dict</code> This:</p> <pre><code>for r in to_remove: del my_dict[r] </code></pre> <p>works fine but I am trying to do it with list comprehensions </p>
python
[7]
190,368
190,369
iPhone SDK: How can I test my app on an actual device?
<p>I have built an iPhone app that I need to test on an actual device. How do I get the app onto the device? I have an Apple Developer account.</p> <p>Also, I will need to distribute the binary to some of our testers. How can I get them a copy of the app?</p> <p>Many Thanks.</p>
iphone
[8]
1,342,774
1,342,775
Document Management System - Architectural Design Question
<p>I need to design an in-house server-based system that will store hundreds of thousands of files (images, spreadsheets, text documents) with users accessing metadata as well as files remotely. What are my options? ASP.Net MVC or WinForms with WCF service? I am really stuck here because I am a newbie.</p> <p>Any advice will be appreciated. Thanks in advance.</p>
c#
[0]
5,925,518
5,925,519
Joins not working
<pre><code> public object GetFeaturedUserComapnies(int loginid) { using(var context=huntableEntities.GetEntitiesWithNoLock()) { var newquery=(from a in context.Users join b in context.EmploymentHistories on a.Id equals b.UserId join c in context.Companies on a.CountryID equals c.CountryId or b.industryid equals c.industryid where a.Id==loginid select new {c.CompanyLogoId, c.CompanyName, c.Id}).ToList().Distinct(); return newquery; } } </code></pre> <p>The problem is </p> <ol> <li>join c in context.Companies on a.CountryID equals c.CountryId or b.industryid equals c.industryid not working throwing error not supported</li> <li>How to get the count from this object method</li> </ol>
asp.net
[9]
31,642
31,643
iphone application for tabbar
<p>How can I defined and check the alreadySelectedSpecificTab and viewControllerNotToAllow in my application. anyone give me one example for that.</p> <p>Actuly I would like to do something. like. When second tab is selected that time if we select second tab is not selected only remaing tab is to be selected.</p> <p>thats why I used the following code. </p> <p>please reply</p> <pre><code>- (BOOL)tabBarController:(UITabBarController *)tabBarControllers shouldSelectViewController:(UIViewController *)viewController { if(alreadySelectedSpecificTab) { if([viewController isEqual:viewControllerNotToAllow]) return NO; } return YES; } </code></pre>
iphone
[8]
4,277,812
4,277,813
Maintaing a map of buffered stream and closing in the end
<p>My applications does continuous disk i/o through 10 threads. The cpu profile is coming very high around 100%, i was planning to make it to 1 separate writer thread.</p> <p>Also I was thinking if i can maintain a Cache of Buffered Writers and so do not have to continuously open the streams. Does anyone see a problem in this </p> <p>But I am unsure of where to put the close the writer. Secondly if the writer are not closed will there be a problem.</p> <p>Thanks</p>
java
[1]
411,989
411,990
Getting code signing identity on runtime?
<p>Is it possible to get code signing identity information at runtime ? </p> <p>Thanks</p>
iphone
[8]
5,509,048
5,509,049
Wrap a created text node with an element WITHOUT jQuery
<p>I'm editing a script that at one point does the following:</p> <p><code>err_node = document.createTextNode(err_decoded_str);</code></p> <p>However I need the resulting text node to be wrapped in <code>&lt;label class="error"&gt;generated error node in here&lt;/label&gt;</code></p> <p>How can this be done without using jQuery? If needs be I can change <code>createTextNode()</code> to a different function to achieve this.</p>
javascript
[3]
4,471,490
4,471,491
How to display data in grid without wrapping the data?
<p>I have a grid control which is bound to a <code>DataTable</code>. I'm facing a problem in the display of data. Though each line in <code>DataColumn</code> of grid having enough space yet the data is being wrapped to next subsequent lines. But I need the data to be displayed without wrapping. Is it possible?</p>
asp.net
[9]
3,217,356
3,217,357
Centering a Javascript pop-up window
<p>I want to center a pop-up window within a browser. However, I'd like it to work regardless of the browser size and the browsers position within the users screen. </p> <p>Position within a browser is straightforward, for example (with jQuery) : </p> <pre><code>var left = ($(window).width()/2)-(width/2); .. uwin = window.open(...., left=...); </code></pre> <p>etc. But if the users browser is not full screen, then it positions relative to full screen rather than browser. </p> <p>I can get screen using</p> <pre><code>screen.width() </code></pre> <p>but that will just position on screen so that's no better. </p> <p>Anyone ?</p>
javascript
[3]
973,807
973,808
What does $path = $path . "$sub"; mean?
<p>What is the meaning of the code below? Especially the line <code>$path = $path . "$sub";</code>.</p> <pre><code>$sub = ($_GET['dir']); $path = "path/to/folder"; $path = $path . "$sub"; </code></pre>
php
[2]
2,176,855
2,176,856
Guessing Object Type while Deserializing
<p>I have a few objects serialized <em>[edit: using BinaryFormatter]</em> this way</p> <pre><code>Obj_A 1 Obj_A 2 Obj_A 3 Obj_B 1 Obj_B 2 Obj_B 3 Obj_B 4 </code></pre> <p>How many A objects there are before B's is decided by user on Runtime.</p> <p>While deserializing, I have no way to guess when to switch form Obj_A deseriliazing to Obj_B</p> <p>I welcome any relevant insight</p> <p><em>EDIT :</em> Serialization occurs on the flow and numbers of A's and B's is not known beforehand</p> <p><strong>ANSWER</strong><br> Marc Gravell suggested something I was JUST NOT aware of : <br> Why bother at all ? Just let the formatter do the job and test types afterwards.<br> (I am surprised I was not massively aswered that by people here, so obvious...)</p> <pre><code>IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream("X:\\binary.dump", FileMode.Open); object o = formatter.Deserialize(stream); if (o.GetType() == typeof(Obj_A)) ReadTheMSDN(Obj_A); else if (o.GetType() == typeof(Obj_B)) KnowObjectsYouHandle(Obj_B); stream.Close(); </code></pre> <p>Another less elegant solution was to force objects to Lists : </p> <pre><code>LIST Obj_A Obj_A 1 Obj_A 2 Obj_A 3 LIST Obj_B Obj_B 1 Obj_B 2 Obj_B 3 Obj_B 4 </code></pre>
c#
[0]
1,244,422
1,244,423
How to trigger an event on exit of div container using jquery
<p>So, I have a working version of this here: <a href="http://jsfiddle.net/yEmvm/19/" rel="nofollow">http://jsfiddle.net/yEmvm/19/</a></p> <p>When you click on the company of the first address block and then click on the name it fires the event and says invalid address. I don't want to fire that event until I cilck on company for the second address block or anywhere <em>outside</em> that first address block. I cannot figure out another event to trigger this on.</p> <p>This is just an example. This page will contain an unknown number of address blocks from 3 to 99. Also, it will contain many more fields for a full address. The user can keep adding more with a button. However, class and id name structure is consistent.</p>
jquery
[5]
2,493,776
2,493,777
Static readonly string arrays
<p>I am using static readonly string arrays in my web application. Basically array is having error codes and i have kept all similar error codes in one array and checking this array instead of checking each one in different constant string. </p> <p>like </p> <pre><code>public static readonly string[] myarray = string[] {"232132132","31232132","123123123"} </code></pre> <p>Please let me know is there any harm in using static readony string arrays ? </p> <p>Note : I am not facing any error, wanted to know is there any harm or performance issue for using like this? </p>
c#
[0]
2,155,259
2,155,260
How to receive a POST response in PHP via URL
<p>The info that I found hasn't worked for me or I simply don't understand what I'm reading.</p> <p>A POST request is being made to a specific location (URL) and a response will be sent back to a URL that I must specify, existing on my domain. (eg <code>www.mysite.org/answers/answer.php</code>)</p> <p>What do I need to do in order to extract every piece of information that is being sent to that location?</p> <p>Right now I am redirecting from the form page after the form (having been submitted via POST) has been submitted by a user to the <code>answer.php</code> which checks <code>if isset($_POST["submit"])</code> but it's not giving me anything.</p> <p>Furthermore, if I had many users doing requests what URL would I use so that each user is redirected to their own answer page?</p>
php
[2]
3,960,988
3,960,989
is it posible to run WS IIS on UNIX?
<p>hi evryone is it posible to run my WebService in IIS on UNIX ? if no, so what can i do ?</p> <p>thank's for any help</p>
c#
[0]
858,057
858,058
Regular Expression Password Validator
<p>I'm having a hard time trying to create a right regular expression for the RegularExpressionValidator control that allows password to be checked for the following: - Is greater than seven characters. - Contains at least one digit. - Contains at least one special (non-alphanumeric) character.</p> <p>Cant seem to find any results out there too. Any help would be appreciated! Thanks!</p>
asp.net
[9]
3,073,958
3,073,959
to count number
<p>Please help me to solve this problem. The problem is that I have a table which stores the all kind of alarms now I need to know count of one particular alarms. for example </p> <pre><code>alarms --------- aaa aaa aaa ccc ccc aaa bbb bbb </code></pre> <p>as shown in the above table I have to count how many times say (aaa) has repeated in this case its is 4 similarly for bbb in this case it is 2 and for ccc it is 2.</p> <p>How to solve this problem?</p>
java
[1]
715,071
715,072
Logging which keys have been pressed and in which order javascript?
<p>I am creating a html canvas game and need to log if there was a successful order of keys being pressed.</p> <p>The keys that have to be pressed in this order are</p> <p><strong>z</strong> then <strong>a</strong></p> <p>If z and then a is pressed it should trigger an event. How can this be best done?!</p> <p>Thanks</p>
javascript
[3]
1,494,425
1,494,426
trying to implement js textualizer
<p>I am trying to use js textualizer from <a href="http://kiro.me/projects/textualizer.html" rel="nofollow">http://kiro.me/projects/textualizer.html</a> but It is not working for me, I have a js fiddle going I am wondering if anyone could figure this out.</p> <p><a href="http://jsfiddle.net/Zk2tr/2/" rel="nofollow">http://jsfiddle.net/Zk2tr/2/</a></p> <p>code</p> <p>html</p> <pre><code>&lt;script src="https://raw.github.com/krisk/textualizer/master/textualizer.min.js"&gt;&lt;/script&gt; &lt;div id="output"&gt;&lt;/div&gt; Not Working </code></pre> <p>js</p> <pre><code>var list = ['first blurb', 'second blurb', 'third blurb']; // list of blurbs var txt = $('#output'); // The container in which to render the list var options = { duration: 1000, // Time (ms) each blurb will remain on screen rearrangeDuration: 1000, // Time (ms) a character takes to reach its position effect: 'random', // Animation effect the characters use to appear centered: true // Centers the text relative to its container } txt.textualizer(list, options); // textualize it! txt.textualizer('start'); // start </code></pre>
javascript
[3]
3,411,780
3,411,781
how to get the telephone number in real device
<p>i want to know get the number of device by telephoneManager and getLine1Number() ,it is workly well in analog machine,but in real device i donot get,could you tell me why?</p> <p>in the com.android.internal.telephony inlude getLine1Number() ,how can use the inner class?</p>
android
[4]
115,311
115,312
Return a result in the original page
<p>When the user submit his data, I take him to a different page where plenty of calculations are made, then I redirect him to the original page with a simple :</p> <pre><code>&lt;?php header("Location:http://mysite.com/index.php"); </code></pre> <p>The problem is I need all the variables and results to be show in this page, but they are obviously stored in the other one, so I need your help please :) ! Thank you for reading this !</p>
php
[2]
3,017,653
3,017,654
Why is decimal.Decimal returning scientific notation for a simple calculation?
<p>I'm having a weird issue on one of my machines:</p> <pre><code>Tibuchina ~$ python Python 2.6.7 (r267:88850, May 14 2012, 20:36:34) [GCC 4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.58)] on darwin Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; from decimal import Decimal &gt;&gt;&gt; Decimal('99') / 2 Decimal('2.21660407009470578688E-8') &gt;&gt;&gt; </code></pre> <p>I'm not sure where to look for a solution, and I haven't had any success searching for an answer - mostly because I'm not sure how to articulate the question. Hoping someone has seen something similar and can suggest a solution. Thanks!</p> <p>-<em>edit</em></p> <p>Hmm, not exactly a dupe, but close; actually the answer with the Mintyfresh link (CppLearner) was most helpful as it pointed me in the right direction. My python is brew installed, not mac ports, but ultimately the steps to fixing it were simply:</p> <ul> <li>Install Xcode command-line utils</li> <li>uninstall and reinstall python 2.6.7</li> </ul> <p>Thanks for the help!</p>
python
[7]
2,266,903
2,266,904
Good free chart library for Android
<p>I need some decent chart library for my app. It must be free to non or commercial use. I've tried Androidplot. It was easy to use but charts were kinda ugly, and project is pretty much dead as I've noticed. Also there are no pie charts which I also need. </p>
android
[4]
5,122,883
5,122,884
Connectivity action broadcastreceiver equivalent in manifest
<p>I set up my receiver like this:</p> <pre><code>networkReceiver = new NetworkChangesReceiver(); IntentFilter connFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION); registerReceiver(networkReceiver, connFilter); </code></pre> <p>I'd like to make the setup in manifest file. However, I can't find CONNECTIVITY_ACTION among android attributes for intent filter... </p> <p><strong>edit: I managed to find it, but on manifest I get this warning: "Exported receiver does not require permission" And this is not true as I have this line as well: and, by debugging, I see that receiver is perfectly working and no "missing permissions" exception is ever thrown.</strong></p>
android
[4]
586,003
586,004
Extract fields from the string in python
<p>I have text line by line which contains many field name and their value seperated by : , if any line does not have any field value then that field would not exist in that line for example</p> <pre><code>First line: A:30 B: 40 TS:1/1/1990 22:22:22 Second line A:30 TS:1/1/1990 22:22:22 third line A:30 B: 40 </code></pre> <p>But it is confirmed that at max 3 fields are possible in single line and their name will be A,B,TS. while writing python script for this, i am facing below issues: 1) I have to extract from each line which are the field exist and what are their values 2) Field value of field TS also have seperator ' '(SPACE).so unable retrieve full value of TS(1/1/1990 22:22:22)</p> <p>Output valueshould be extracted like that</p> <pre><code>First LIne: A=30 B=40 TS=1/1/1990 22:22:22 Second Line: A=30 TS=1/1/1990 22:22:22 Third Line A=30 B=40 </code></pre> <p>Please help me in solving this issue.</p>
python
[7]
3,599,235
3,599,236
How to convert ’ to apostrophe in C#?
<p>I have tried several combinations of ASCII, Latin1, Windows-1252, UTF-8 and Unicode to convert ’ to apostrophe in C#, but to no avail.</p> <pre><code>byte[] uBytes = Encoding.Unicode.GetBytes(questionString); byte[] utf8Bytes = Encoding.Convert(Encoding.Unicode, Encoding.UTF8, uBytes); string converted = Encoding.UTF8.GetString(utf8Bytes); </code></pre> <p>I am using this conversion chart to discover what each code should be: <a href="http://www.i18nqa.com/debug/utf8-debug.html" rel="nofollow">http://www.i18nqa.com/debug/utf8-debug.html</a> </p>
c#
[0]
5,382,441
5,382,442
Is there any mistake in this Java code?
<pre><code>class Creature { private int yearOfBirth=10; public void setYearOfBirth(int year) { yearOfBirth = year; } void setYearOfBirth(Creature other) { yearOfBirth = other.yearOfBirth; // is this correct it compiles fine } int getYearOfBirth() { return yearOfBirth; } public static void main(String args[]) { Creature c = new Creature(); c.setYearOfBirth(89); Creature d = new Creature(); c.setYearOfBirth(d); System.out.println(c.yearOfBirth); } } </code></pre> <p>Is there any mistake in this code? </p> <p>Is "other.yearOfBirth" wrong? My faculty says it is wrong but it works fine for me.</p>
java
[1]
4,537,110
4,537,111
Console application becomes ghost and does not show on task manager processes tab
<p>My program uses MSSQL database and has been working fine. However, after making some changes including converting from VS2008 to VS2010, generating 32bit application. It starts having the following strange problem: When I try to shutdown the console by clicking the system menu(X button), it does not shutdown, you can move the console around, you can also click on the left hand system menu such as properties, etc, but the program does not show up on the taskmanger's processes tab, therefore, there is no way to shut it down, but to restart box.</p> <p>Also, while the program is in this ghost mode, I can actually start another instance. That means the ghost application already release most of the resources such as file handle, db etc.</p> <p>The problem seems to occur after we have some issues with ms-sql server, such as time out exception. I simulate the situation by throwing an exception in the same db function call, but that does create the ghost situation. box is Windows Server Standard without Hyper-V, SP2, 32bit.</p>
c#
[0]
829,248
829,249
Seeking on a http progressive download
<p>I am trying to implement the progressive download of audio files in my android project. I am able to progressively play the audio by reading chunks of data and passing on to the media player. So, the media player does play the audio with simultaneous buffering, but the problem lies with seeking.</p> <p>When I seek to a position where the buffering has not yet completed, then the client requests the server for a range of bytes. Once I receive the range of data, I store it in a file and pass the file descriptor to the mediaplayer, but the mediaplayer is unable to play the audio since the header information is missing.</p> <p>Is there any better way to do this? Any queue buffering so that the header information is still retained while loading the content at a particular position? Or any other way to handle seeking on a progressive download? </p> <p>Note that I cannot pass the uri of the audio files to the media player for security reasons.</p>
android
[4]
4,187,658
4,187,659
Creating objects using the Class class
<p>How do I instantiate an object using the Class class?</p> <p>I would like to pass a Class object to a function and have that function return a new object of the class I pass in. </p> <p>I will be doing casting after I get the object back. Also, are there any suggestions on design patterns for this sort of thing?</p> <p>Here is some example pseudo code that shows what I want to do:</p> <pre><code>Class Animal { String name; } Class Cat extends Animal { boolean hasTail; } </code></pre> <p>MAIN: </p> <pre><code>Class myClass = Cat.class; Animal createAnimal(myClass) { return new myClass; } </code></pre> <p>Edit:</p> <p>Also, is there a way to cast within my function before returning the new instance or am I stuck with the default Object type?</p> <pre><code>return (myClass)myClass.newInstance(); </code></pre>
java
[1]
1,297,801
1,297,802
Python: Event Schedular like quartz
<p>I am looking for an event scheduler like quartz in java for my python project .</p> <p>Please suggest me some good scheduler in Python </p> <p>My Requirements </p> <p>1) Send an email or sms to the user after some interval</p> <p>Thanks !</p>
python
[7]
4,577,276
4,577,277
How can I access my desktop computer from my Android phone?
<p>Is it possible to access a computer connected to the internet through an Android phone? (the internet goes through the phone by tethering)</p> <p>I want to use ssh to connect to the computer (from a different computer in the same network), but I am not able to access the computer.</p> <p>Is it possible to portforward, use some kind of transparent proxy or to use DMZ?</p> <p>My phone is rooted and I have Cyanogenmod installed and I can use iptables.</p> <p>EDIT: The changed title completely changed the question!</p> <p>My setup is the following: I have an android phone connected to a computer through the usb cable tethering internet from the phone, I wanted to ssh into the computer behind the android phone from another computer in the same network as the android phone. This was not possible, because the android phone creates a separate network for the connected computer, effectively shielding it from any incoming signals.</p> <p>It turned out to be quite simple to fix by just using iptables.</p>
android
[4]
4,960,919
4,960,920
Php Syntax error and no valid output
<p>im receiving a PHP syntax error on the below, can anybody see where im going wrong? im trying to write a query thats dependant on post variables </p> <pre><code>&lt;? $args = array('orderby' =&gt; 'meta_value_num', 'meta_key' =&gt; 'order', 'order' =&gt;'ASC','meta_query' =&gt; array()); if(isset($_POST['vehicleType']){ $args['meta_query'][]=array( 'key' =&gt; 'vehicleType', 'value' =&gt; $_POST['vehicleType'], 'compare' =&gt; '='); } if(isset($_POST['another']){ $args['meta_query'][]=array( 'key' =&gt; 'vehicleType', 'value' =&gt; $_POST['vehicleType'], 'compare' =&gt; '='); } if(isset($_POST['another']){ $args['meta_query'][]=array( 'key' =&gt; 'vehicleType', 'value' =&gt; $_POST['vehicleType'], 'compare' =&gt; '='); } if(isset($_POST['another']){ $args['meta_query'][]=array( 'key' =&gt; 'vehicleType', 'value' =&gt; $_POST['vehicleType'], 'compare' =&gt; '='); } ?&gt; </code></pre>
php
[2]
5,205,968
5,205,969
Default associative array value in PHP
<p>I'm just wondering if its possible to have something like this:</p> <pre><code>$image = array( "default" =&gt; "test.jpg", "width" =&gt; 400, "height" =&gt; 500 ); </code></pre> <p>Then you could call:</p> <pre><code>echo $image // test.jpg echo $image['width'] // 400 </code></pre> <p>Thanks, Matt Mueller</p>
php
[2]
371,517
371,518
Does it make sense to define a static final variable in Java?
<p>Does this definition make sense ?</p> <pre><code>private static final String string = "Constant string"; </code></pre> <p>I'm a beginner and I don't understand the difference between final and static...</p>
java
[1]
5,479,287
5,479,288
Disapper when press spacebar
<p>(Sorry for my dumb English.) I'm doing with javascript. I have a menu like top right Facebook user menu. If click anywhere in the body area, it will disapper (unless click on the menu itself). My menu is a login form. I use tab to move across input fields. But when it focus on the checkbox "Remember Me", i press spacebar and the menu disapper. What's happened? How to fix this problem?</p>
javascript
[3]
3,426,728
3,426,729
Javascript renders with a delay after HTML
<p>I have an HTML page with a couple javascript buttons that 'replace' the HTML/CSS. </p> <p>However, when the page loads, there is an annoying delay between when the HTML/CSS loads and when the js 'replaces' it . (An example of what I'm talking about can be seen on the site: www.psd2html.com). What accounts for this delay and what is the best practice in terms of having the js load before a user experiences a delay (for example on Facebook or Youtube or any other large site with lots of js). Thank you.</p>
javascript
[3]
4,101,644
4,101,645
Is it a bad practice to pass "this" as an argument?
<p>I'm currently tempted to write the following:</p> <pre><code>public class Class1() { public Class1() { MyProperty = new Class2(this); } public Class2 MyProperty { get; private set; } } public class Class2() { public Class2(Class1 class1) { ParentClass1 = class1; } public Class1 ParentClass1 { get; set; } } </code></pre> <p>Is passing "this" as an argument a sign of a design problem? What would be a better approach?</p>
c#
[0]
62,105
62,106
Fallthrough variable assignment in PHP?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1013493/coalesce-function-for-php">Coalesce function for PHP?</a> </p> </blockquote> <p>I'm not sure what this is normally called, but I hope the title communicates well enough. What I have is a handful of variables some of which might be null.</p> <p>I want to do:</p> <pre><code>$a = $b || $c || $d; </code></pre> <p>Where $a ends up being = to the first non-null variable.</p>
php
[2]
3,593,327
3,593,328
jquery, hide content until loaded
<p>I am currently using this script to fade page transitions:</p> <pre><code>$(document).ready(function() { $(window).bind("unload", function() {}); $("body").css("display", "none"); $("body").hide(); $("body").fadeIn(2000); $('a.fade1, a.fade2, a.fade3, a.fade4').click(function(event) { event.preventDefault(); linkLocation = this.href; $("body").fadeOut(700, redirectPage); }); function redirectPage() { window.location = linkLocation; } });​ </code></pre> <p>this works like a charm when the content is alredy in cache, but when an image needs to load it will momentarily appear then be hidden and faded in</p> <p>so what i need is a way to hide the content until it is fully loaded and only after that let it be faded in</p> <p>hope someone can help me, thanks in advance</p>
jquery
[5]
985,977
985,978
Junior Software Engineer (C++) Interview Advice
<p>Hey guys.Tomorrow I have a phone interview with a good company for a Junior Software Engineer position. I have been out of the university with a bachelors for 3 months now, and am a bit rusty on my C++, as it has been a few semesters since I worked with it. I am currently reviewing it (working on pointers at the moment) to be prepared for tomorrow. Below is the description of the job. What would people recommend I brush up on the most to be prepared for the interview? What type of questions do you think the interviewer would ask that I should be sure to be prepared for? Thanks much. This would be huge for me.</p> <p>Responsibilities</p> <ul> <li>Willingness to accept new challenges and learn on the job in a fast paced environment</li> <li>Opportunity to become heavily involved in all phases of the development cycle in a very short time period</li> <li>You will gain hands on experience from day one while working in conjunction with other developers to ensure a high level of quality</li> <li>Through quality testing and real world feedback, continuously improve the software*s functionality and performance</li> </ul> <p>Skill Requirements</p> <ul> <li>Bachelor*s degree required in Computer Science/Engineering, or any science/engineering field with relevant programming knowledge</li> <li>Experience programming in C/C++</li> <li>Ability and desire to learn quickly and adapt to new technologies</li> <li>Familiar with polymorphism, memory allocation/de-allocation, and common data structures</li> <li>C# experience is a plus</li> <li>Network knowledge is a plus</li> <li>Knowledge of financial terms is a plus</li> </ul>
c++
[6]
2,537,766
2,537,767
Declare types without implicit conversion in C++
<p>I want to declare my own numeric types, exactly like unsigned int, but I do not want the types to be implicitly converted. I tried this first: typedef unsigned int firstID; typedef unsigned int secondID;</p> <p>but this is no good as the two types are just synonyms for unsigned int, so are freely interchangable.</p> <p>I'd like this to cause an error:</p> <pre><code>firstID fid = 0; secondID sid = fid; // no implicit conversion error </code></pre> <p>but this to be okay:</p> <pre><code>firstID fid = 0; secondID sid = static_cast&lt;secondID&gt;(fid); // no error </code></pre> <p>My reason is so that function arguments are strongly typed, eg:</p> <pre><code>void f( firstID, secondID ); // instead of void f(unsigned int, unsigned int) </code></pre> <p>What is the mechanism I am looking for?</p> <p>Thanks</p> <p>Si</p>
c++
[6]
2,635,263
2,635,264
At least one object must implement IComparable
<pre><code>using System; using System.Xml; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { SortedSet&lt;Player&gt; PlayerList = new SortedSet&lt;Player&gt;(); while (true) { string Input; Console.WriteLine("What would you like to do?"); Console.WriteLine("1. Create new player and score."); Console.WriteLine("2. Display Highscores."); Console.WriteLine("3. Write out to XML file."); Console.Write("Input Number: "); Input = Console.ReadLine(); if (Input == "1") { Player player = new Player(); string PlayerName; string Score; Console.WriteLine(); Console.WriteLine("-=CREATE NEW PLAYER=-"); Console.Write("Player name: "); PlayerName = Console.ReadLine(); Console.Write("Player score: "); Score = Console.ReadLine(); player.Name = PlayerName; player.Score = Convert.ToInt32(Score); //==================================== //ERROR OCCURS HERE //==================================== PlayerList.Add(player); Console.WriteLine("Player \"" + player.Name + "\" with the score of \"" + player.Score + "\" has been created successfully!" ); Console.WriteLine(); } else { Console.WriteLine("INVALID INPUT"); } } } } } </code></pre> <p>So i keep getting the "</p> <blockquote> <p>At least one object must implement IComparable.</p> </blockquote> <p>" when trying to add a second player, the first one works, but the second one doesn't. I also MUST use <code>SortedSet</code> because that is the requirment for the work, it's school work.</p>
c#
[0]
4,235,462
4,235,463
Load video file from Assets folder to VideoView
<p>I'm using VideoView and MediaController attached to it i know how to load a video from the raw folder and how to load a url but i'm unable to load a local file that sits in the Assets folder</p> <p>i saw some way to do it with a MediaPlayer and SurfaceView, but i'm seeking a way to do so without changing the all activity and layout</p> <p>Thanks</p>
android
[4]
5,943,652
5,943,653
How to Map Paths in ASP.NET Non-Form Class File
<p>I've been using the following code in my Web form code-behind classes. I want to use it in my regular .cs files: for example, when making database calls. But when I try to use it outside of a Web form I get the following error when attempting to map with base.Request.ApplicationPath: 'object' does not contain a definition for 'Request'. What would be the simple, correct way to map to the root in a regular .cs class file in a Web Application Project?</p> <pre><code> protected void LogError(string errMsg, string errTrace) { string mailSubject = "oops!"; string mailBody = errMsg + errTrace; System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration(base.Request.ApplicationPath); AppSettingsSection appSettings = (AppSettingsSection)config.GetSection("appSettings"); // Extract values from the web.config file string toAddress = "me@gmail.com"; string fromAddress = appSettings.Settings["FromEmailAddr"].Value; string emailHost = appSettings.Settings["EmailHost"].Value; mailProvider.SendMail(fromAddress, toAddress, mailSubject, mailBody.ToString()); } </code></pre>
asp.net
[9]
4,299,515
4,299,516
load background image from other page with jquery?
<p>I want to load a background image from another ajax page and Im not really sure whats the best way?</p> <p>In my index.html page I have the css background code and I want to load an image from another asp page.</p> <p>My index.html file as it looks now:</p> <pre><code>&lt;div id="bgimage" style="background-image: url(../images/theimage.jpg); background-repeat: no-repeat; background-position: center center; background-attachment:fixed;"&gt; </code></pre> <p>and the imagepage.asp page that gets the right image from the db.</p> <pre><code>&lt;div id="menuimage"&gt; &lt;img src="..user_images/&lt;%=folderName%&gt;/menuimage/&lt;%=rs("big_image")%&gt;" id="themenyimage"/&gt; &lt;/div&gt; </code></pre> <p>Any suggestions appriciated, thanks.</p>
jquery
[5]
3,757,870
3,757,871
When do I need to call this method Runtime.getRuntime().addShutdownHook()
<p>When do I actually need call this method Runtime.getRuntime().addShutdownHook() and when or why I need to shutdown my application. Could anyone please explain me this by giving some example.</p> <p>Thanks</p>
java
[1]
1,061,487
1,061,488
How do you write a immutable set code in c#?
<p>I am trying to make an assignment where I have to use an immutable set where g replaces G.<br> Thanks in advance.</p> <p>This is the code I have.</p> <pre><code>class interface IMMUTABLE_SET[G] count:INTEGER has(g:G):BOOLEAN choice:G clones(s:IMMUTABLE_SET{[G]):IMMUTABLE_SET[G] is_equal(other:IMMUTABLE_SET[G]):BOOLEAN plus(g:G):IMMUTABLE_SET[G] minus (g:G):IMMUTABLE_SET[G] the end--- class IMMUTABLE_SET[G] </code></pre> <p>that is all I have. Thanks in advance. I am supposed to use contracts in the code.</p>
c#
[0]
4,836,158
4,836,159
C++ Singleton class returning const reference
<p>I have an a class which is singleton as defined follows</p> <pre><code>class myData { private: myData (void); // singleton class. // Copy and assignment is prohibted. myData (const myData &amp;); myData &amp; operator=(const myData &amp;); static myData* s_pInstance; public: ~myData (void); static const myData &amp; Instance(); static void Terminate(); void myFunc() { cout &lt;&lt; "my function..." ;} }; </code></pre> <p>// In cpp file.</p> <pre><code>myData* myData::s_pInstance(NULL); myData::myData(){} myData::~myData() { s_pInstance = NULL; } const myData&amp; myData::Instance() { if (s_pInstance == NULL) { s_pInstance = new myData(); } return *(s_pInstance); // want to avoid pointer as user may deallocate it, so i used const referense } void main() { (myData::Instance()).myFunc(); } </code></pre> <p>I am getting following error</p> <p>error C2662: 'myData::myFunc' : cannot convert 'this' pointer from 'const myData' to 'myData&amp;'</p> <p>how to avoid above problem and call a function from Instance function which is returning const reference?</p> <p>Thanks!</p>
c++
[6]
4,140,101
4,140,102
LinearLayout height in onCreate is 0
<p>I'm trying to dynamically adjust the height of my rows depending on the (screen height - my layout height) / list.size.</p> <p>Unfortunately in the <code>onCreate</code> method the layout height returns null (not so when i call it in an on click listener).</p> <p>Is there another method I can call it in?</p>
android
[4]
2,266,871
2,266,872
jQuery - Loading Thumbnails
<p>basically I have thumbnails at the bottom of the page and one large image. I want to be able to hover over the thumbnails and have the source of the thumbnail replace that of the big image so the thumbnail takes its place.</p> <p>Please someone help!! I need to get this finished asap, is there any other info I should provide?!</p> <p>This is the code I am using:</p> <pre><code>jQuery('.image-rollover').hover(function() { var src = $(this).attr("src").match(/[^\.]+/); jQuery('.replace img').replace("src", src); }); </code></pre>
jquery
[5]
1,595,676
1,595,677
is opengl suitable for making simulator of robotic arm or any other would be best for this purpose?
<p>i m final year student want to make simulator for my robotic arm using opengl as i have command on c sharp so i would do coding using c sharp. now have a query that would it be better to use opengl for simulator preparation or rather any other software(tool) will be best for the achievement of this task. DO inform me i would be grateful to u</p> <p>thanks in advance</p>
c#
[0]
112,515
112,516
Learning python in one weekend
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="http://stackoverflow.com/questions/17988/how-to-learn-python">How to Learn Python</a><br> <a href="http://stackoverflow.com/questions/726912/fastest-way-to-learn-python">Fastest way to learn Python?</a> </p> </blockquote> <p>Hello,</p> <p>I'm planing to learn python this weekend. I have some programing skills and should not be difficult if I take the good path.</p> <p>I'm a sysadmin and I've been looking at python scripts since long ago, but now I would like to make python my scripting language, so I'll do the effort and next monday I will start using it.</p> <p>Any advice on how to trace my own path to good python skills?</p> <p>thanks. </p> <p>PS: I will use vim, ypython and <a href="http://www.diveintopython.net" rel="nofollow">http://www.diveintopython.net</a></p>
python
[7]
3,869,096
3,869,097
get the path of the project in C#
<p>how do I get the path of the project? i want to assign a string with the path of the folder of the project. lets say, the folder of my project (in C#) is E:\projects\something (in folder something, I have the .sln file and all the source codes and also a folder pictures, and in some function I want to assign a string to the path of the project's folder for after it use fhe files in pictures... what I need is a function retorning the path of the project. string s=project_path; </p>
c#
[0]
2,789,435
2,789,436
Delayed Write Error
<p>I developed a backup program for my important directories.</p> <p>This program writing is the data to a disk on a USB flash drive. Sometimes i get an error:</p> <pre><code>delayed write failed (id:50) </code></pre> <p>Is there any way to solve it in C# ? Writing directly to the DOK by using flags wasn't successful. it's probably caused by the cache but I can't disable it via the policies of the DOK. </p> <p>The copy method: </p> <pre><code>FileInfo backupFile = file.CopyTo(theDokDir + fileToCopy.Name); </code></pre>
c#
[0]
3,659,956
3,659,957
Fastest way to determine where PHP script exits
<p>Say you have a large PHP project and suddenly, when attempting to run it, you just end up with a blank page. The script terminates and you want to find excatly where that is with as little effort as possible.</p> <p>Are there a tool/program/command/IDE that can, on PHP script termination, tell you the location of a script exit?</p> <p>note: I can't mark my own post as "accepted answer" so look at the bottom to see my solution. If you come up with a better solution I will mark your post as the answer.</p>
php
[2]
2,625,004
2,625,005
In jQuery, cannot use a hover function into an each function?
<p>This is probably an easy question, but since I'm new to jQuery, I need someone to look at this code for me. So basically I want to change the css of the hover state of multiple anchor tags, I tried the following code but it didn't work. What's wrong with that?</p> <pre><code>(".p-container a").each(function () { $(this).css({'text-shadow':'0 0 0.2px '+ colorArray[i]}); $(this).hover(function() { $(this).css({'text-shadow':'0 0 2px '+ colorArray[i]}); },function() { $(this).css({'text-shadow':'0 0 0.2px '+ colorArray[i]}); }); i++; }); </code></pre> <p>The code works without having the hover function, but I want to change the css of the hover state at the same time. Is anybody know how to do that? </p> <p>Thanks KJ</p>
jquery
[5]
3,808,870
3,808,871
jQuery How to control, does an element exist in document?
<p>I want to control does an element exist in document with its ID, when page is loading. I tried code which is below, but i failed.</p> <pre><code> if($(':not(#&lt;%=TextBox1.ClientID %&gt;)')){ alert("Object is null")else{alert("Object is exist")}} </code></pre> <p>Thansk for your helps already now.</p>
jquery
[5]
4,541,194
4,541,195
Read file in binary and output in hex std::cin to std::cout
<p>I was trying to achieve this using this code:</p> <pre><code>char c; while (std::cin &gt;&gt; c) std::cout &lt;&lt; std::hex &lt;&lt; std::setw(2) &lt;&lt; std::setfill('0') &lt;&lt; static_cast&lt;uint32_t&gt;(c); </code></pre> <p>but it looks like it gets messed up reading in nulls (all nulls are removed from my file). How can I fix this?</p>
c++
[6]
2,468,182
2,468,183
webgame with simultaneous players
<p>I have seen many webbrowser based games with players playing simultaneously. Usually after waiting some time you can join a room where everyone is playing or you can play against one other player. All those games use Flash.</p> <p>How they achieve that? It would be very complex to accomplice without Flash?</p> <p>There are any toolkit (rails, etc) or plugin that provides this functionality? Or it is just a matter of storing sessions and mixing them ?</p> <p>Just a quick edit: I am not interested in Flash or Silverlight solutions</p>
javascript
[3]
2,802,855
2,802,856
How do I access a c# variable's value in an .aspx page?
<p>The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %>). </p> <p>we need to access the c# variable in .aspx page at the time we have problem</p> <p>Please guide us?</p>
asp.net
[9]
2,173,395
2,173,396
add leading zeros dynamically relative to input number
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/473282/left-padding-integers-with-zeros-in-java">Left padding integers with zeros in Java</a> </p> </blockquote> <p>I need to add some leading zeros dynamically relative to input number length, for example if I input 10 the it will output </p> <p>Numbers 01 02 03 04 05 06 07 08 09 10</p> <p>I think the way to do it is to get the length of the numbers input and then apply that value to the counter using some formatting, just not sure the best way of going about that.</p> <p>This is what I have so far.. (I am very new to programming)</p> <pre><code> public static void main(String[] args) { int numbers; int counter = 1; int padlength; Scanner ngrabber = new Scanner(System.in); System.out.println("Please enter numbers to output number"); numbers = ngrabber.nextInt(); System.out.println("Numbers"); while (counter &lt;= numbers) { padlength = String.valueOf(numbers).length(); System.out.println(counter); counter++; } } } </code></pre>
java
[1]
2,394,612
2,394,613
Updating the user
<p>I am having a grid in gridpage.aspx and on clicking the search button in gridpage.aspx. it opens a search popupwindow with search criteria and after entering the search criteria and clicking the search button in the popup window will close the popup window and displays all the records in the gridpage.aspx.</p> <p>the scenario is when i am retreiving lakhs of records i want to display the user with some update that the search is still in progress </p>
c#
[0]
5,428,579
5,428,580
How To download web page using java as well preserve image files
<p>How to download the page and the images given the url using java. A similar question was avaialble already, which when tried just saves the page and not the images.</p>
java
[1]
3,876,216
3,876,217
Find that one string is substring of other or not
<pre><code> public class StringIsSubstring { public static void main(String[] args) { String s1= new String("anurag"); String s2=new String("anu"); char a[]=s1.toCharArray(); char b[]=s2.toCharArray(); int i=0; int j=0; while(i&lt;a.length &amp;&amp; j&lt;b.length) { if(a[i]==b[j]) { i++; j++; } else { i++; j=0; } if(j == b.length) { System.out.println("we have found the substring"); } } } } </code></pre> <p>I have written following code to find that one String is substring of other or not. I dont want to use any library function. Is there any more efficient way to do the same</p>
java
[1]
5,303,076
5,303,077
asp.net dropdown list selected value
<p>For first time when the page loads we are unable to retrieve selected drop down value which consists of page numbers in dropdown list.Here is my dropdown list</p> <pre><code>&lt;asp:DropDownList ID="ddlpagenubers" runat="server" AppendDataBoundItems="true" onselectedindexchanged="ddlpagenubers_SelectedIndexChanged" AutoPostBack="true"&gt; </code></pre> <p>i did a custom paging in a datalist by placing a dropdown consisting of page number to navigate to particular pages</p>
asp.net
[9]
3,571,267
3,571,268
Problem with optional arguments in PHP
<p>I have a function which takes four optional arguments:</p> <pre><code>public function doSomething($x = null, $y = null, $a = null, $b = null) { } </code></pre> <p>However when I try to call this function and specify only $y for instance:</p> <pre><code>$object-&gt;doSomething($y=3) </code></pre> <p>It seems to ignore that I am setting $y as 3, and instead sets $x to be 3. Is there any reason why this might happen with PHP? I never used to have this issue before...</p> <p>Thanks,</p> <p>Dan</p>
php
[2]
3,027,176
3,027,177
Asp.Net difference between doPostBack & DoPostBackWithOptions
<p>In Asp.Net what is the difference between _doPostBack &amp; DoPostBackWithOptions, In what scenario _doPostback &amp; DoPostBackWithOptions will be used ?</p>
asp.net
[9]
986,953
986,954
MYSQL and SQLite
<p>I know this might seem like a basic question but can an android app which i know uses SQLite work with a web site like <a href="http://www.freemysql.net/client/" rel="nofollow">http://www.freemysql.net/client/</a>. I have developed a desktop program in netbeans that functions with this website using MYSQL and I want my android app to upload information to this site as well. Or can i use MYSQL with android. I just need to be pointed in the right direction. Any help will be greatly appreciated</p>
android
[4]
999,997
999,998
Is there a font picker on iPhone?
<p>as topic, I am strange that why does the SDK not provide API to show the UIFont picker ? like the date Picker......</p> <p>or maybe some open source code is available now ?</p> <p>Thanks for your help !</p> <p>Regards</p>
iphone
[8]
3,011,394
3,011,395
JavasScript ping to top of page?
<p>Is there a way to push the browser back to the top of the page when a link is clicked? I am dynamically changing some content but the project needs the user to start at the top of the page when the new content is loaded.</p> <p>I am already using the url hash tag to keep track of the history. Just looking for some type of javascript function to do this.</p>
javascript
[3]
2,183,453
2,183,454
Any way to find whether the IPAddress falls in Private Range
<p>I am working on code where I need to find whether the ipAddress belongs to Private Range or not. Any suggestions will be appreciated.</p> <p>UPDATED-</p> <p>This is my method-</p> <pre><code> if(isPrivateIPAddress(ipAddress)) { //do whatever you want } private static boolean isPrivateIPAddress(InetAddress address, String range) { // TODO Auto-generated method stub String ipAddress = address.getHostAddress(); return ipAddress.startsWith( range ); } </code></pre> <p>So I am not sure what is the address we need to pass in the above if loop.</p>
java
[1]
870,473
870,474
What JavaScript inconsistencies should I look out for?
<p>I remember reading some "funny" examples once of weird results JavaScript can give when you, for example, add strings to numbers etc. Does anyone have any good examples or a link to the blog that I might have read them on? Which ones are likely to catch a programmer out in the real world?</p>
javascript
[3]
4,592,621
4,592,622
Remove top notification bar in android phone
<p>In android phone we can see the top side contains icons for signal indicator, battery charge indicator, etc. When we click on any application these indicators are also visible along with our application's activity. Is there any way to remove those indicators when we run an application ???</p> <p>Thank you, Yugandhar</p>
android
[4]
4,365,110
4,365,111
jQuery fade content within a div
<p>Hey there, so far i have this, it toggles my footer down and up, but i want the content of the footer to fade out and new content fade in when it's toggled down. I can't for the life of me work it out, please help! - thanks</p> <pre><code>$(document).ready(function() { $('#footertab').toggle(function() { $('#footer').animate({ bottom: '-=120' }, 1000); },function() { $('#footer').animate({ bottom: '+=120' }, 1000); }) }); </code></pre>
jquery
[5]
1,765,140
1,765,141
I want to display location based information when overlay on map is clicked using android
<p>I am designing the following application.</p> <p>It shows several overlays on different places on map. I want some code that will show text information (location specific), when an overlay is clicked.</p> <p>It's not just small text; a huge amount of data is associated with every overlay.</p> <p>For example: To display hotel information about: Bangalore, Mumbai, Delhi, etc.</p>
android
[4]
1,857,388
1,857,389
access to public variable javascript in class
<p>I Have a Javascript class which has three text variable:</p> <pre><code>myClasss = function(){ this.color = "yellow"; this.type = "car"; this.other = this.type + ", " + this.color; } </code></pre> <p>unfortunately my class has error :( how can I fill this.Other ?</p> <p>thanks.</p>
javascript
[3]
3,447,954
3,447,955
calling a private method by a return statement java
<p>So I'm new to java and I'm trying to wrap my head around this. So far I'm writing a public method that calls a private method, both of which are written in the same class. When testing the public method, I am able to call the public method against an object, employeeOne, whose parameters are supplied by the user. I'm not exactly sure whats going on with the private method call here though since it appears that I'm calling it on the class (i think) and not the objects with defined attributes. </p> <p>So here is a private method that I have written inside a class called Employee:</p> <pre><code>private static double computeGrossPay() { if (hoursWorked &lt;= 40) { grossPay = (hoursWorked * payRate); } else if (hoursWorked &gt;= 40) { grossPay = ((40 * payRate) + ((1.5 * payRate) * (hoursWorked - 40))); } return grossPay; } </code></pre> <p>I was trying to figure out a way to call this method in another class and obviously since it is a private method I can't call it anywhere outside of the class it is written in. So I wrote a public method that makes a call to the private method</p> <pre><code>public double grossPayDisplay() { return Employee.computeGrossPay(); } </code></pre> <p>This is where my question comes into play: So far this code works but I'm not entirely clear on <em>why</em> it works.</p> <p>Here is how I tested it:</p> <pre><code>System.out.println(employeeOne.grossPayDisplay()); </code></pre> <p>employeeOne is an object created from the class Employee whose parameters are supplied by the user, my question is:</p> <p>How does the compiler go from Employee in Employee.computeGrossPay() to employeeOne? </p> <p>Or to reiterate how does </p> <pre><code>return Employee.computeGrossPay() </code></pre> <p>actually pass attributes to computeGrossPay()? </p>
java
[1]
4,911,074
4,911,075
how to calculate(sum up) an a row value of an datatable
<p>i have an datatable like this. i am getting this data from an excel sheet and converted to datatable</p> <pre><code>id workedhours tfshours 1 3 2 2 5 5 3 .7 3 4 2 3.2 5 4.3 6.8 </code></pre> <p>now i need the sum of the column workedhours and tfshours</p> <p>how can i achive that is .there any builtin function to get the sum of teh column </p> <p>i need the result like this in a new datatable</p> <pre><code> workedhours tfshours 15 20 </code></pre> <p>any help would be greatly appreicated. thank you </p>
c#
[0]
3,773,519
3,773,520
Find total hours between two Dates
<p>I have two Date objects and I need to get the time difference so I can determine the total hours between them. They happen to be from the same day. The result I would like would have the hours and minutes. </p> <p>When I use .toString() on my Date object I get this: Fri Dec 18 08:08:10 CST 2009 </p> <p>I've tried the following:</p> <pre><code>long diff=(this.endDate.getTime()-this.startDate.getTime())/(60*60 * 1000); </code></pre> <p>But this only gives me hours, not the minutes. I know this is a simple problem, but I can't figure it out atm.</p> <p>Edits: Final solution for those interested. Thanks to Michael Brewer-Davis</p> <pre><code>Period p = new Period(this.startDate, this.endDate); long hours = p.getHours(); long minutes = p.getMinutes(); String format = String.format("%%0%dd", 2); return Long.toString(hours)+":"+String.format(format, minutes); </code></pre>
java
[1]
3,609,667
3,609,668
Overloading output operator
<p>Why doesn't this work:</p> <pre><code>ostream &amp; operator&lt;&lt;( ostream&amp; os, Polygon&amp; p) { for (int i = 0; i &lt; p.antal; i++) { os &lt;&lt; p.veArr[i]; } return os; } </code></pre> <p>It says no operator matches these operands.</p>
c++
[6]
5,937,584
5,937,585
Use Jquery to save into text file
<p>Is there any method to use to save data from webpage to excel file or text file using jquery ?</p>
jquery
[5]
845,683
845,684
How do I get a date in UK local time using PHP?
<p>I'm using the <strong>unix timestamp</strong> to show when a message was posted in my project but when I came to displaying the exact time of the post I realized it was about 12 hours behind.</p> <p>I'm in the UK and my server is in the US (might be the problem).</p> <p>Is there a simple way of converting the unix timestamp into a readable British time?</p> <pre><code>$timestamp = time(); print date("F jS, Y", strtotime($timestamp)); </code></pre> <p>Any help would be great, Thanks!</p>
php
[2]
1,023,938
1,023,939
setinterval seems to accelerate
<p>I have a setinterval within a function, on the first click all seems fine, but every subsequent click accelerates this timer. I don't understand why.</p> <pre><code>function startGame() { var myVar=setInterval(function(){myTimer()},100); } </code></pre>
javascript
[3]