Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
5,215,495
5,215,496
Initialize a static member ( an array) in C++
<p>I intended to create a class which only have static members and static functions. One of the member variable is an array. Would it be possible to initialize it without using constructors? I am having lots of linking errors right now...</p> <pre><code>Class A{ public: static char a[128]; static void do_something(); } </code></pre> <p>How would you initialize a[128]? Why can't I initialize a[128] by directly specifying its value like in C?</p> <pre><code>a[128={1,2,3,...}; </code></pre>
c++
[6]
5,675,652
5,675,653
Why code stops working after this function?
<p>I have some other functions and a html page call after this simple function, but they dont run after this. </p> <pre><code>function page($name){ $content =&lt;&lt;&lt;eol &lt;?php PAGE CONTENT ?&gt; eol; $file = "./search/$name.php"; $open = fopen($file, "w"); fwrite($open, $content); fclose($open); } </code></pre> <p>function works itself, but causes exiting code.</p>
php
[2]
2,787,273
2,787,274
jquery on to replace live?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/9864476/jquery-on-vs-live">jquery: on vs live</a> </p> </blockquote> <p>I have code that works just fine using <code>$('thing').live("mousemove", function(e) {</code> and <code>$('thing').live({mouseenter:function(e) {</code>. I notice jquery said <code>live</code> is depreciated and to use <code>on</code> so i did. However it doesn't seem to work the way i expect it to. I had mousemove events but since objects were loaded dynamically the events werent triggering which is why i use live. Now live works perfectly but when i use <code>on</code> as jquery suggested it seems to act like .mousemove and such. It works on objects that exist when the code is executed and not on dynamically added events (the whole reason i use live).</p> <p>Is there a way to tell on to act like live and add events on new object? or do i use live?</p>
jquery
[5]
4,482,473
4,482,474
converting -1 to unsigned types
<p>Consider the following code to set all bits of <strong>x</strong></p> <pre><code>unsigned int x = -1; </code></pre> <p>Is this portable ? It seems to work on at least Visual Studio 2005-2010 </p>
c++
[6]
3,424,517
3,424,518
Embedded PDF's in a DROID App?
<p>What is the best way to integrate a PDF document into my droid app?</p> <p>I am attempting to recreate the same functionality we provide on our website in our mobile app.</p> <p>I have 2 options of delivering the PDF to the device but the route I choose depends on the best way to implement this functionality on the device. </p> <p>I could stream the document do the client and store a local temp file for viewing OR I could simply provide an HTTP URI for the document and present it on the device.</p> <p>My main question is, what is the best way to integrate PDF viewing on the DROID? Can I check to see if they have Acrobat Viewer installed and make a call to the app, passing the URI data to it for loading?</p>
android
[4]
2,962,134
2,962,135
What part of the Javascript do i edit?
<p>I found this great tutorial <a href="http://bavotasan.com/2009/creating-a-jquery-mouseover-fade-effect/" rel="nofollow">http://bavotasan.com/2009/creating-a-jquery-mouseover-fade-effect/</a></p> <p>Its easy to follow but i am getting stuck with the JS because i want to have more than one image on the page. </p> <p>Can someone assist. </p>
javascript
[3]
2,338,187
2,338,188
use microphone to receive an inaudible tone?
<p>I am doing a project. I want to use the speaker of computer to generate an inaudible tone and microphone on smartphone to receive this tone. </p> <p>1.what software that can generate the inaudible tone (18- 20 Khz) through the speaker in PC ?</p> <p>2.A code android to receive and analyse some features (frequency, amplitude,…) of this tone?</p>
android
[4]
1,194,376
1,194,377
Site not displaying but rather downloading
<p>I am working on a site and just published it to the client's domain, but when I try to access the root or subpages, they download to my computer rather than displaying as the pages. Could it be the fact php is not installed (the server is managed by my client so I don't know if PHP is installed)?</p>
php
[2]
4,706,226
4,706,227
php issue with syntax
<p>i have this problem with the syntax here but i don't know what it is..</p> <p>could you please help me out? it must be in the url... I guess there might be any error in the way i'm expressing it, because when i use a plain URL it works..</p> <p>Thanks!</p> <pre><code>$url='http://testext.i-movo.com/api/receivesms.aspx?".$str_from.$str_zip.$phone.$str_time.$date1.$str_msg'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); return $output; </code></pre>
php
[2]
4,663,047
4,663,048
Is there a Heap in java?
<p>I am porting c++ library to java and I need a heap data structure. Is there a standard implementation or I will need to do it myself?</p> <p>Thanks</p>
java
[1]
4,600,143
4,600,144
NameError: name 'getResultFromDatabase' is not defined
<p>I'm getting this error:</p> <pre><code>NameError: name 'getResultFromDatabase' is not defined </code></pre> <p>Here is my code:</p> <pre><code>import pymongo from itertools import groupby from pymongo import Connection data = getResultFromDatabase() connection = Connection('localhost', 27017) db = connection.students item = db.grades.find({'type' : 'homework'}).sort([('student_id',pymongo.ASCENDING),('score',pymongo.ASCENDING)]) for id, items in groupby(data, lambda s: s['student_id']): lowest_score = min(i['score'] for i in items) print lowest_score </code></pre>
python
[7]
1,290,689
1,290,690
what is the main purpose of post() method of View
<p>what is the main purpose of the post method which are associated with views such as imageview,textview etc. </p> <pre><code>new View(Context).post(runnable) </code></pre> <p>An example will be appreciated :)</p>
android
[4]
511,241
511,242
running tcpdump from android application
<p>I want to develop an android application that will be able to launch tcpdump. Can any one give me any suggestion regarding this issue? </p> <p>thanks kaisar</p>
android
[4]
3,996,199
3,996,200
i have some problem with left join JPQL
<p>there is something wrong with ths way i use left join, and i dont understand what am i doing wrong.</p> <p>can you see it?</p> <pre><code>select distinct r.globalRuleId, r.ruleId, sv.validFrom, pm.moduleId, nvl(min(rai.failedOnRegistration),0) from TRules r, TSlaVersions sv, TModuleFormulas mv, TPendingModule pm, left join TRulesAdditionalInfo rai on r.ruleId = rai.ruleId where r.slaVersionId = sv.slaVersionId and r.formulaId = mv.pk.formulaId and mv.pk.moduleId = pm.moduleId group by r.globalRuleId, r.ruleId, sv.validFrom, pm.moduleId order by pm.moduleId </code></pre>
java
[1]
4,743,037
4,743,038
How to make a custom drawn UITableViewCell resize properly?
<p>For performance reasons, I draw the strings for my UITableViewCell in a custom view that overrides its drawRect method to draw strings directly in the view rectangle using NSString:drawInRect. This is similar to Apple's TableViewSuite Example 5-CustomTableViewCell.</p> <p>However, when I invoke setEditing on the cell to bring up the delete button, the view ends up with a squeezed appearance after the animation completes. To demonstrate this, invoke setEditing:YES on the CustomTableViewCell example mentioned above and observe the distortion. Is there any way around this or should I just revert back to using UILabels for my text?</p>
iphone
[8]
1,791,620
1,791,621
iPhone programing
<p>I'm beginner for iPhone. I want to learn iPhone programming without UI. Can you help me?</p>
iphone
[8]
1,441,406
1,441,407
How to check whether a control gets a focus or not in android
<p>I have a question that How to check whether the widget having a focus or not. Actually I have a form in which there is a DOB edit text, a user navigates all the edit text boxes with Next action on keyboard and I want when user navigates to DOB field from any of the control then a Calendar Dialog automatically appears, currently what happens is user have to click on edit text then a Calendar Dialog appears, I want whenever DOB field gets a focus then it automatically call the Calendar Dialog. </p> <p>I have searched regarding the same enough on web but failed to achieve this. Please help me out about this problem.</p> <p>Thanks in advance.</p>
android
[4]
3,021,128
3,021,129
How to use method stringWithContentsOfFile:encoding:error
<p>I don't know how to use this method. </p> <p>I want to get the data in an rtf file as a NSString, however I can not.</p> <p>Here is part of my code.</p> <pre><code>NSString *filePath = @"path of the file"; NSString *ImagePath = [[[NSString alloc] init] autorelease]; imagePath = [NSString stringWithContentsOfFile: filePath encoding:(NSStringEncoding)nil error:(NSError**) nil]; </code></pre> <p>I can't readout the data in that .rtf file. I am appreciate that everyone may help me. Thanks.</p>
iphone
[8]
2,708,140
2,708,141
why is header() function displaying A sql error
<pre><code>&lt;?php include_once( 'mysqlconnect.php' ); $id=$_POST['id']; //8 header("location:settings_pay_roll.allowance.general.view.php?id='$id'"); ?&gt; </code></pre> <p>output:</p> <blockquote> <p>You have an error in your SQL syntax; check the manual that corresponds to your //MySQL server version for the right syntax to use near '8''' at line 1</p> </blockquote> <p>I know my error is at the <code>?id='$id'</code> but what I don't understand and my question is: why is it displaying output: You have an error in your SQL syntax?...</p>
php
[2]
4,579,281
4,579,282
Code giving SEG FAULT only when the class is being derived!
<p> I am unable to find out the bug in the below code which i had written[Not for any purpose though]. </p> <p> <pre> <code> #include &lt iostream &gt #include &lt cstdlib &gt using namespace std; class Base{ public: Base(){cout &lt&lt "Base class constructor" &lt&lt endl;} void funv() {}; ~Base(){cout &lt&lt "Base class destructor" &lt&lt endl;} ; }; class Derived:public Base{ public: char *ch; Derived():ch(new char[6]()){} ~Derived(){ cout &lt&lt "before" &lt&lt endl; delete [] ch; ch = NULL; cout &lt&lt "after" &lt&lt endl; } }; int main(){ Derived * ptr = new Derived; //memcpy(ptr -> ch,"ar\0",4); // Works when class Derived is derved from base and also when not derived from base ptr -> ch = const_cast &lt char* &gt("ar0"); // Works only when class Derived is not derived from class Base cout &lt&lt ptr -> ch[1] &lt&lt endl; ptr -> funv(); delete ptr; return 0; } </code> </pre> </p> <p> I have commented on the suspected lines of the code. <p> I am using sun Studio 12. </p> </p>
c++
[6]
2,624,409
2,624,410
Method to delete files in c#
<p>I have this simple method of deleting list of files. But for some cases it fails to delete the file unless i give it Sleep for some seconds. This is visible especially when i merge Word Documents using Interop and then right after executing merging i try to delete the files it fails to do so for some of them (as i guess Word is still in background). </p> <p>What would be your approach on this one? Have it async and make it spawn a thread that would start deleting files after a while (kinda like garbage collector?)</p> <pre><code> public static void deleteDocuments(List&lt;string&gt; arrayList) { foreach (var item in arrayList) { try { File.Delete(item); } catch (Exception e) { MessageBox.Show("Błąd kasowania: " + e.ToString(), "Błąd Kasowania", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } </code></pre>
c#
[0]
4,856,767
4,856,768
Group and then sort a list using java comparator
<p>i have a list that contains product items and when it was purchased. is it possible to use comparator java to first sort this list out by the product description, and then sort it by date purchased as well?</p> <p>So far i can use it sort out the list in order of dates or description or another field but i want to know if it is possible to sort it by using multiple fields?</p> <p>here is what i have so far that sorts the dates fine.</p> <pre><code>public int compare(Transaction aTransaction1, Transaction aTransaction2) { Date lTransactionDate1 = aTransaction1.getTransactionDate(); Date lTransactionDate2 = aTransaction2.getTransactionDate(); return lTransactionDate2.compareTo(lTransactionDate1); } </code></pre> <p>Thanks in advance.</p>
java
[1]
2,415,406
2,415,407
Sort table rows based on their Class Names
<p>I want to rearrange table rows based on their Class names.<br> Below is my HTML code. </p> <pre><code>&lt;table&gt; &lt;tr class="a4"&gt;&lt;td&gt;4&lt;/td&gt;&lt;/tr&gt; &lt;tr class="a6"&gt;&lt;td&gt;6&lt;/td&gt;&lt;/tr&gt; &lt;tr class="a1"&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt; &lt;tr class="a2"&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt; &lt;tr class="a5"&gt;&lt;td&gt;5&lt;/td&gt;&lt;/tr&gt; &lt;tr class="a3"&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre> <p>So now, with class name a1 should display first, likewise a2 second.. etc..</p> <p>Please someone help me</p>
jquery
[5]
1,510,683
1,510,684
Using An Array in Javascript
<p>So I have an assignment in which I have to Write a function named "addEmUp" declared this way:</p> <pre><code>function addEmUp() { // Your code goes here. }; </code></pre> <p>addEmUp returns the total of the numbers in an array. The name of the array is LASVEGAS and the array has 3 values in it.</p> <p>The array LASVEGAS exists - do not create it - just use it.</p> <p>I am clueless, how do I write this function?</p> <p>Thanks</p>
javascript
[3]
687,199
687,200
java.lang.Object.equals() what was the intention?
<p>What do you think the primary motive for putting the <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#equals%28java.lang.Object%29" rel="nofollow"><code>equals</code></a> method in <code>java.lang.Object</code> is? Most of the implementations that we override it with are domain-centric, i.e. in model classes. I'm yet to see an implementation of <code>equals</code> in a factory class or something equivalent.</p> <p>My conclusion is that it was primarily put in to support the Java Collection API, so that it could deal with any <code>Object</code>. Else, it could have been left to be defined by specific domain designs.</p> <p>PS: I know this thread may be more discussion oriented, but did not where else to get insight into this. I have tried to search far and wide for the answer to this, but always land up in discussions or explanations as to the difference between <code>==</code> and <code>equals</code> or the best practices of writing equals.</p>
java
[1]
2,632,268
2,632,269
How to find the version of a File on windows through Java program?
<p>I want to design a function in Java which will have prototype like this.</p> <pre><code>public String FindVersion(String FullPath) { } </code></pre> <p>where FullPath can be: <code>C:\tmp\readme.txt</code> or <code>C:\windows\system32\xcopy.exe</code> or like <code>C:\windows\system3</code></p>
java
[1]
4,803,935
4,803,936
Deduction of SQL Server 2005 connection through layers using C#
<p>I would be very thankful to you if you would help me creating a connection to SQL Server 2005 using C# through layers. </p> <p>I have created different main classes of BLL, DAL, WebService etc. but I tried a lot but in vain. There is problem of reference and some other technical errors. </p> <p>Pls help me making this connection I would be very thankful to you.</p>
c#
[0]
4,532,324
4,532,325
set() runtime in python
<p>Just wondering what the run time of lookup for set() is? O(1) or O(n)?</p> <p>if I have </p> <p>x = set() whats the runtime of</p> <p>if "a" in x: print a in set!</p>
python
[7]
5,397,686
5,397,687
convert javascript to jQuery to disable text boxes on option selection
<p>I am currently using javascript to disable a text box if my "remote_server" option is set to no. Here is my existing code</p> <p><strong>HTML</strong></p> <pre><code>&lt;select name="remote_server" class="required"&gt; &lt;option&gt;&lt;/option&gt; &lt;option value="1" &lt;?php if($remote=="1") echo 'selected="selected"'; ?&gt;&gt;Yes&lt;/option&gt; &lt;option value="0" &lt;?php if($remote=="0") echo 'selected="selected"'; ?&gt;&gt;No&lt;/option&gt; &lt;/select&gt; </code></pre> <p><strong>Javascript</strong></p> <pre><code>var e = document.getElementsByName("remote_server")[0] var strUser = e.options[e.selectedIndex].value; if ( strUser == 0 ) { document.getElementsByName("ftp_hostname")[0].setAttribute("disabled", "disabled"); document.getElementsByName("ftp_user")[0].setAttribute("disabled", "disabled"); document.getElementsByName("ftp_password")[0].setAttribute("disabled", "disabled"); document.getElementsByName("ftp_mode")[0].setAttribute("disabled", "disabled"); document.getElementsByName("ftp_port")[0].setAttribute("disabled", "disabled"); document.getElementsByName("ftp_directory")[0].setAttribute("disabled", "disabled"); } </code></pre> <p>Is there an easy way to convert this to jquery so that at the moment the option is chosen the text boxes will be either enabled or disabled?</p>
jquery
[5]
4,770,699
4,770,700
Getting parse error but I can't see anythting wrong in the line
<p>Here is my code: </p> <pre><code>if($_POST['format'] == "csv") { Line 174 -&gt; $objWriter = new PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV'); $objWriter-&gt;save($FNAME); } else { $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel); $objWriter-&gt;save($FNAME); } </code></pre> <p>I am getting parse error: "<code>( ! ) Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in B:\wamp\www\SuperPages\action.php on line 174</code>" but I can't see anything wrong."</p>
php
[2]
235,575
235,576
tips for practicing android development
<p>I just completed my Lynda Android App Development tutoiral. I got all the basics covered. But now I have no idea what shoud I code to get into habit and learn more techniques. Some one please suggest some programs or apps that I should code to get into the practice. </p>
android
[4]
2,889,072
2,889,073
What does string::npos mean
<p>What does the statement <code>string::npos</code> mean here</p> <pre><code>found=str.find(str2); if (found!=string::npos) cout &lt;&lt; "first 'needle' found at: " &lt;&lt; int(found) &lt;&lt; endl; </code></pre>
c++
[6]
999,497
999,498
Did back key destroy an activity?
<p>I have an activity defined as below:</p> <pre><code> &lt;activity android:name="com.example.ui.HomeActivity" android:alwaysRetainTaskState="true"/&gt; </code></pre> <p>A strange thing is that, when running on emulator, and the back key is pressed, the activity was destroyed (I saw onDestroy() called in log). But when running on my Nexus One phone, and the back key is pressed, the activity is not destroyed (I didn't see onDestroy() called in log).</p> <p>Could someone tell me why?</p> <p>Thanks.</p>
android
[4]
2,570,520
2,570,521
Nexus S not showing up on DDMS
<p>I am using Windows 7/64 bit HP laptop...</p> <p>Installed Java 32 bit as well as java 64 bit. Installed Android environment. Installed Google Version 4 driver from Android AVD and SDK Manager.</p> <p>Windows autmoatically installed the nexus driver and it shows up in my computer->manage->device manager->Storage->Android UMS composite USB device.</p> <p>Windows shows the removable storage for the connected Nexus S device. but don't see anything on DDMS for device niether does "adb devices" shows anything.</p> <p>Pls suggest.</p>
android
[4]
4,092,935
4,092,936
how to get data from an Android Activity?
<p>I need Activity A to retrieve the string value from a textview in Activity B. The catch is I don't want Activity B to send the data, I just want Activity A to reach out and grab the data from B. I understand about Bundles and Intents, but the problem I'm having is that every time Activity B is accessed, it sends the bundled intent to A. I don't want that to happen, I just want Activity A to grab the string from Activity B's textview whenever Activity A is accessed. I'm using Android 2.2 and SDK 8.</p>
android
[4]
2,804,306
2,804,307
override and overload perspective
<ul> <li>Overloading - same method with different signatures in the same class.<br/></li> <li>Overriding - same method signature different implementations in subclass <br/></li> </ul> <p>If i have an overloaded method in the parent class does the child class overload or override this particular method? </p>
java
[1]
6,020,970
6,020,971
Change focus of activities in android
<p>I am using a dialog themed activity in android to show a popup from a application context. The dialog has a transparent theme, but the issue is that I want the underlying activity to have focus and not the popup though the popup must be visble. How do I achieve this in android?</p>
android
[4]
4,843,780
4,843,781
dynamically input year based on date range
<p>I have an application that is good from September 1st of the current year, and ends January 15th of the following year.</p> <p>What I need to do is enter the current year into the database when they submit their application. </p> <p>If the user completes the application between Sept 1, 2012 and January 15, 2013 - 2012 will be entered into the table.</p> <p>Say it is January 2, 2013 - it will enter 2012 into the year column</p> <p>Say it is November 10, 2012 - it will enter 2012 into the year column</p> <p>Say it is December 5, 2013 - it will enter 2013 into the year column.</p> <p>I can't wrap my head around how I will be able to insert the appropriate year (in this situation anyway).</p> <p>Any help is appreciated.</p>
php
[2]
1,525,850
1,525,851
add value to user control throw databinding after page_load?
<p>Have a Repeater in a updatepanel with a user control inside.</p> <pre><code>&lt;asp:Repeater id="repQuestionElement" runat="server" OnItemCommand="repQuestionElement_ItemCommand" OnItemDataBound="repQuestionElement_ItemDataBound"&gt; &lt;ItemTemplate&gt; &lt;uc1:elements ID="Elements1" runat="server" ctrl="&lt;%#((testElements.EditorControl.EControl)Container.DataItem)%&gt;" /&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; </code></pre> <p>User control.</p> <pre><code>public EControl ctrl { get; set; } protected void Page_Load(object sender, EventArgs e) { if (ctrl != null) { if (ctrl.Lb != null &amp;&amp; ctrl.C != null) { lblQuestion.Text = ctrl.Lb; plhUser.Controls.Add(ctrl.C); } } } </code></pre> <p>When i set the datasource and databinding (to a array of EControl) in page_load its working, but when i do it after page_load the user-control is not loaded. ctrl is null.</p> <p>Do someone know why?</p>
asp.net
[9]
1,609,740
1,609,741
How to auto login when I run the Android Application
<p>Assume that I have login to system using PHP + MySQL, then, after I exit the apps, I run the apps again, no need to login again and auto login, Please help to solve the problem.</p>
android
[4]
5,887,326
5,887,327
Install and uninstall windows service via command prompt "C#"
<p>i want install and uninstall win service via command prompt "C#"</p> <p>following code is not working please help me</p> <pre><code>string strInstallUtilPath ="C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\"; string strInstallService = " InstallUtil.exe \"D:\\TestUser\\ServiceForPatch\\TestService\\bin\\Debug\\TestService.exe\""; ProcessStartInfo PSI = new ProcessStartInfo("cmd.exe"); PSI.RedirectStandardInput = true; PSI.RedirectStandardOutput = true; PSI.RedirectStandardError = true; PSI.UseShellExecute = false; Process p = Process.Start(PSI); System.IO.StreamWriter SW = p.StandardInput; System.IO.StreamReader SR = p.StandardOutput; SW.WriteLine(@"cd\"); SW.WriteLine(@"cd " + strInstallUtilPath); SW.WriteLine(strInstallService); p.WaitForExit(); SW.Close(); </code></pre>
c#
[0]
2,024,953
2,024,954
Problem embedding a cgi within PHP using system
<p>Hi I am using php system to embed a cgi-script like this</p> <pre><code>&lt;?php echo system('./cgi-bin/rebol-include.cgi'); ?&gt; </code></pre> <p>Problem is my cgi-script writes</p> <pre><code>print "content-type: text/html^/" </code></pre> <p>so that PHP will show up </p> <pre><code>"content-type: text/html" </code></pre> <p>above the html page. This is an unwanted artefact, what's the optimal way to remove it knowing a whole html page is returned from the cgi to be embedded in php ?</p>
php
[2]
1,463,640
1,463,641
iPhone SDK: Navigation is causing crash
<p>My app is crashing when I navigate two view controllers in my application. For example, if I do this sequence:</p> <p>RootController ViewControllerA<br> ViewControllerB ViewControllerA</p> <p>My app crashes.</p> <p>It crashes when I pressed the back button in ViewControllerB. So, It seems like it is with two or more ViewControllers being pushed. Each by themselves work.</p> <p>I don't know why.</p> <pre><code>This is the code I am using to invoke new views. salesViewController *anotherViewController = [[salesViewController alloc] initWithNibName:@"salesView" bundle:nil]; //confirmViewController *anotherViewController = [[confirmViewController alloc] initWithNibName:@"confirmView" bundle:nil]; [self.navigationController pushViewController:anotherViewController animated:YES]; [anotherViewController release]; </code></pre> <p>Thanks in advance.</p>
iphone
[8]
3,851,900
3,851,901
What Visual C++ setting/option/flag is the counterpart of -ansi -pedantic in g++
<p>I have a C++ codebase, and I am porting from Visual Studio to g++, which should I set in Visual Studio so that build errors in gcc are reduced? With g++ this is achieved by -ansi -pedantic.</p>
c++
[6]
1,221,401
1,221,402
Marquee tag in Jquery
<p>hi I want to implement marquee tag in my web from using jquery. in my web from i have text box ,button and div for display the marquee.my requirement is i want to display the textbox text to marquee as sliding after click on button this is my code</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $("#btn_click").click(function () { var textboxvalue = $("#txtbx_data").val(); var dis = $("#div_scroll").find(".ticker").text(textboxvalue); $('.ticker').each(function () { var marq = $('&lt;marquee&gt;&lt;/marquee&gt;').attr({ 'behavior': 'slide', 'scrollamount': 08, 'direction': 'left', 'width': '100%' }) $(this).wrap(marq); }) }) }); &lt;/script&gt; </code></pre>
jquery
[5]
47,652
47,653
JQuery: How to do validation on blur of a text box?
<p>I have a textbox with ID "name", I want to do validation when the text box get onblur function. The below code doesn't work. What's wrong with me?</p> <pre><code> $(function() { $('name').validate({ rules:{ "name": {required: true, minlength: 5 } } }); $('name').blur(function(){ $('name').validate() }); }; </code></pre>
jquery
[5]
91,146
91,147
jQuery attribute doesn't change
<p>As I'm a newbie to jQuery I'm having a little problem. I have two divs with product images, below them I have a couple of "color selectors" to let the customer look at what colors that's available. When the user hovers one of the "links" I have a new div showing with a color in it. Bla bla... The problem I'm having is that it always picks the ID from the first "color_selector" even when I'm hovering a link in the second color_selector span.</p> <p>Edit: I can't post more than one hyperlink in the text, so I've changed all the <code>&lt;a&gt;</code> tags to <code>&lt;hyperlink&gt;</code>.</p> <pre><code> &lt;div class="product_color" id="color_product01_content"&gt;&lt;/div&gt; &lt;span class="color_selsector" id="color_product01"&gt; &lt;hyperlink href="javascript:void(0);" class="color_trigger" rel="000000"&gt;Product 01 color 01&lt;/hyperlink&gt; &lt;hyperlink href="javascript:void(0);" class="color_trigger" rel="efefef"&gt;Product 01 color 02&lt;/hyperlink&gt; &lt;/span&gt; &lt;div class="product_color" id="color_product02_content"&gt;&lt;/div&gt; &lt;span class="color_selsector" id="color_product02"&gt; &lt;hyperlink href="javascript:void(0);" class="color_trigger" rel="000000"&gt;Product 02 color 01&lt;/hyperlink&gt; &lt;hyperlink href="javascript:void(0);" class="color_trigger" rel="efefef"&gt;Product 02 color 02&lt;/hyperlink&gt; &lt;/span&gt; </code></pre> <p>And the jQuery:</p> <pre><code>$('a.color_trigger').mouseover(function(){ var contentPanelId = $(".color_selector").attr("id"); var valueColor = jQuery(this).attr("rel"); $("#" + contentPanelId + "_content").css({"background-color" : "#" + valueColor, "display" : "block"}); }); </code></pre>
jquery
[5]
1,559,217
1,559,218
Parsing Ambiguous Dates in Java
<p>Is there any way in Java to guess the date format when it is not explicitly defined?</p> <p>For example a user types in 11Mar09 or 11-09-2009 or 11/09/2009 or 11-09 what is the best way of parsing this to a Date object without either a bunch of try catch or raising an error?</p>
java
[1]
3,062,985
3,062,986
Summing columns of a txt file in java
<p>I have a text file that reads:</p> <p>1 2 3 4 5</p> <p>6 7 8 9 1</p> <p>8 3 9 7 1</p> <p>9 3 4 8 2</p> <p>8 7 1 6 5</p> <p>where each number is separated by a tab.</p> <p>My question is, is there a simple way to sum the columns of numbers using java? I want it to sum 1+6+8+9+8, 2+7+3+3+7, etc. I am reading the file using:</p> <pre><code> public static boolean testMagic(String pathName) throws IOException { // Open the file BufferedReader reader = new BufferedReader(new FileReader(pathName)); // For each line in the file ... String line; while ((line = reader.readLine()) != null) { // ... sum each column of numbers } reader.close(); return isMagic; } public static void main(String[] args) throws IOException { String[] fileNames = { "MyFile.txt" }; </code></pre> <p>}</p>
java
[1]
2,109,940
2,109,941
get current device location after specific interval
<p>I want to capture current location (latitude and longitude) of android device after specific interval (say 30 mins).. My class (or service ?? not sure what to use ) will start listening to <code>LocationManagerListener</code> when device booting completed. What is the best way of implementing this? how we can make use of <code>locationChanged()</code> method in this scenario? </p> <p>This is what i think it can go:</p> <p>Listen for boot completed event and set alarm service:</p> <pre><code>public class OnBootReceiver extends BroadcastReceiver { private static final int PERIOD=1800000; // 30 minutes @Override public void onReceive(Context context, Intent intent) { AlarmManager mgr=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE); Intent i=new Intent(context, OnAlarmReceiver.class); PendingIntent pi=PendingIntent.getBroadcast(context, 0, i, 0); mgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime()+60000, PERIOD, pi); } } </code></pre> <p>Listen for alarm service and initiate the location capture class or service:</p> <pre><code> public class OnAlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { WakefulIntentService.acquireStaticLock(context); context.startService(new Intent(context, locationCapture.class)); or new locationCapture().classmethod(); } } </code></pre> <p>I am not sure how <code>locationCapture</code> class should be implemented. Should it be normal Java class or Service class?</p> <p>Any help will be appreciated.</p>
android
[4]
2,704,582
2,704,583
Like layout-sw600dp,alternative for drawable
<p>My question is straight forward and simple, Like there is layout-sw600dp,values-sw600dp, for layout and values respectively, what is there for drawable folder in relative to size of screen.</p> <p>I read in various document that if we want to use any screen more than or equal to 7 inches we can use layout-sw600dp folder, and for any lesser screen size device, layout folder will be taken into consideration. So how we can make use of same concept for images also. Right now there are ldpi, mdpi, hdpi folder, but images are taken in accordance of screen density not with screen size.Now if I am developing an app which work both on device and phone, what should be my probable approach for images. </p> <p>Thanks in advance, please guide me.</p>
android
[4]
4,917,014
4,917,015
python: what's the point of adding`__dict__` to `__slots__`
<p>The whole point of <code>__slots__</code> is to save space. </p> <p>But I saw people add <code>__dict__</code> to it so that new attributes can be added. Isn't this defeating the goal of <code>__slots__</code>? </p>
python
[7]
1,218,802
1,218,803
Subtle List<string> Manipulation
<p>I have two <code>List&lt;string&gt;</code> (<code>listOfFullPaths</code> containg full database paths for e.g. "C:\MyDir\SomeDir\SomeDatabase.mdf") and some other <code>List&lt;string&gt;</code> containing <em>some</em> of the names of the databases (only) ('listOfDatabases'). So each might include</p> <pre><code>List&lt;string&gt; listOfFullPaths = new List&lt;string&gt;() { "C:\MyDir\SomeDir\SomeDatabase1.mdf", "C:\MyDir\SomeDir\SomeDatabase2.mdf", "C:\MyDir\SomeDir\SomeDatabase3.mdf" }; </code></pre> <p>the other just</p> <pre><code>List&lt;string&gt; listOfFullPaths = new List&lt;string&gt;() { "SomeDatabase1", "SomeDatabase2" }; </code></pre> <p>My question is <strong>what is the most efficent way of returning the full paths contined in <code>listOfFullPaths</code> that have their corresponding database in <code>listOfDatabases</code>?</strong></p> <p>Note: The answer is <em>not</em> something like</p> <pre><code>List&lt;string&gt; tmpList = new List&lt;string&gt;(); foreach (string database in listOfDatabases) if (listOfFullPaths.Contains(database)) tmpList.Add(database); listOfFullPaths.Clear(); listOfFullPaths = tmpList; </code></pre> <p>although this does what I want. </p>
c#
[0]
2,450,291
2,450,292
Python class method decorator w/ self arguments?
<p>How do I pass a class field to a decorator on a class method as an argument? What I want to do is something like:</p> <pre><code>class Client(object): def __init__(self, url): self.url = url @check_authorization("some_attr", self.url) def get(self): do_work() </code></pre> <p>It complains that self doesn't exist for passing self.url to the decorator. Is there a way around this?</p>
python
[7]
5,397,193
5,397,194
Session management for same server having different domains by not setting different sessions
<p>I have two folders in same server , one is for development(ponting to dev.mysite.com) and other for live site (ponting to 'mysite.com'). But if some one logged in development his session will be generated and at the same time if he enter into live site he automatically loged in since session is already set in development site. </p> <p>How can I manage sessions for development and live site without overwriting each other and not setting different sessions . Which is the best method?</p>
php
[2]
2,341,463
2,341,464
How does Python handle globals?
<p>I've come across some very odd handling of global variables in Python. I was hoping someone can explain and justify these surprises!</p> <p>A) This code prints 10 as expected:</p> <pre><code>def func(): print(a) a = 10 func() </code></pre> <p>B) This code throws an exception about referencing a too early:</p> <pre><code>def func(): print(a) a += 1 a = 10 func() </code></pre> <p>C) But this code prints [10] as expected:</p> <pre><code>def func(): print(a) a.append(1) a = [10] func() </code></pre> <p>So I can gather that the type of <code>a</code> changes its scope and additionally later statements that haven't even been reached yet change how <code>a</code> is seen. I know I can use <code>global a</code> at the start of the function but it's rather verbose.</p> <p>Can anyone tell me what rules Python is using to handle its bizarre scoping?</p>
python
[7]
4,475,914
4,475,915
Reducing PDF File Size - Adobe SDK C#
<p>What i am wondering, is if there is a way to use the function from the Adobe Acrobat Pro Software "Document >> Reduce File Size" programatically in C# using the Adobe SDK ? I already have it so i can retrieve adobe documents/pages i just need to apply this method from the software. If this is possible or you know how to reduce file size it would be greatly appreciated!</p> <p>Thanks</p>
c#
[0]
3,870,577
3,870,578
How can I check if a string ends in is or are valid? using regex
<p>I do a check to see if my strings contain the words "is valid". But how using regex can I check "is valid" or "are valid"?</p> <pre><code>@"Which (of the following )?(is valid) (?&lt;result&gt;.*?)[?:]" </code></pre>
c#
[0]
4,647,180
4,647,181
Unable to remove element on click
<p>I have a page where I appendTo a div on page load. After a user can dismiss this div by clicking another element.</p> <pre><code>var overlay = jQuery('&lt;div id="start"&gt;111111111&lt;/div&gt;'); overlay.appendTo(document.body); $("#go").click(function() { $(document).remove("#start"); }); </code></pre> <p>Unfortunately it does append the div, but not remove... What am iI missing?</p>
jquery
[5]
4,663,126
4,663,127
Iterate and add Class to Each Paragraph
<p>I'm trying to add a class "ignore" to the first P and a class "style" for the last P for each block.</p> <pre><code>&lt;div class="tiles_large"&gt; &lt;span class="spacer"&gt;&amp;nbsp;&lt;/span&gt; &lt;p&gt;image here&lt;/p&gt; &lt;span class="spacer"&gt;&amp;nbsp;&lt;/span&gt; &lt;h4&gt;headline here&lt;/h4&gt; &lt;span class="spacer"&gt;&amp;nbsp;&lt;/span&gt; &lt;p&gt;content here&lt;/p&gt; &lt;span class="spacer"&gt;&amp;nbsp;&lt;/span&gt; &lt;/div&gt; &lt;div class="tiles_small"&gt; &lt;span class="spacer"&gt;&amp;nbsp;&lt;/span&gt; &lt;p&gt;image here&lt;/p&gt; &lt;span class="spacer"&gt;&amp;nbsp;&lt;/span&gt; &lt;h4&gt;&lt;div&gt;&lt;span&gt;headline here&lt;/span&gt;&lt;/div&gt;&lt;/h4&gt; &lt;span class="spacer"&gt;&amp;nbsp;&lt;/span&gt; &lt;p&gt;content here&lt;/p&gt; &lt;span class="spacer"&gt;&amp;nbsp;&lt;/span&gt; &lt;/div&gt; </code></pre> <p>This is my jquery, but it's not returning the expected results.</p> <pre><code> $(".tiles_large p,.tiles_small p").each(function() { $(this).find("p:first").addClass("ignore"); }); $(".tiles_large p,.tiles_small p").each(function() { $(this).find("p:last").addClass("style"); }); </code></pre> <p><a href="http://jsfiddle.net/gsg3m/" rel="nofollow">Here is my fiddle</a></p>
jquery
[5]
1,877,254
1,877,255
Two C# questions; how can I reinterpret cast a float to an int? Does C# have a non-static conversion operator or user-defined assignment operator so that the conversion takes place on 'this'?
<p>1. How can I reinterpret cast a float to a int (or a double to a long)?</p> <pre><code>float f = 2.0f; int i = (int)f; // causes conversion </code></pre> <p>I only want to copy the bit-pattern from f to i. How can this be done?</p> <p>2. The implicit and explicit operators in C# uses one intermediate object because the operator function is 'static'</p> <pre><code>public static implicit operator MyClass(double s) { return new MyClass(s); } .. .. MyClass m = 2.2; // this code uses 'm' and one intermediate object. </code></pre> <p>This is fine for reference types, but for value-types which are big (say 20-30 bytes), this will cause unnecessary data copy. Is my understanding correct? And If yes, then why doesn't C# have a non-static conversion operator or user-defined assignment operator so that the conversion/assignment takes place on 'this'? If it does, whats the way to do it?</p> <p>Thanks</p>
c#
[0]
5,551,235
5,551,236
Android: any-screen capture without ROOT and constant USB connection
<p>I'm trying to make an app that takes a video capture of the screen by taking individual snapshots. I've been looking into taking the snapshot without root, and seems that most solutions use ddmlib and require the device to be constantly connected via USB. </p> <p>The only solution that doesn't require root and a constant usb connection is the android screenshot library. However, from the forum comments as well as my experience with the demo app, this library doesn't work very reliably/consistently.</p> <p>Is there any other solution? </p> <p>Note: I've also looked at the Noroot Screenshotit app (<a href="https://play.google.com/store/apps/details?id=com.edwardkim.android.screenshotitfullnoroot&amp;hl=en" rel="nofollow">https://play.google.com/store/apps/details?id=com.edwardkim.android.screenshotitfullnoroot&amp;hl=en</a>), and seem like they have a similar approach to the android screenshot library, but have no idea how they make it more reliable. If anyone has an idea, that would be helpful as well.</p> <p>Thanks</p> <p>Edit: We've already got the USB-connected implementation, but we want to be able to do it on the device alone, without needing any connection to another PC.</p>
android
[4]
1,421,704
1,421,705
The handler in click button keeps adding everytime I refresh my page
<p>I use jquery to bind a click event in my link element and binding a handler. But every time I refresh the page the registration of the handler in my link element keeps adding. Like for example, in a new load page, only one handler registered in the click but when I click the link again, it it will add another handler.</p> <p>Please advise.</p> <p>Many thanks.</p> <pre><code>$("#btn").click(function () { $("#blck").slideToggle("fast", function(){ }); }); </code></pre>
jquery
[5]
2,468,355
2,468,356
Why does playing a .wav using AVAudioPlayer hang my iPhone simulator?
<p>I'm trying to get a simple button to play a sound:</p> <pre><code>-(IBAction)myButton:(id)sender { NSString *audioFilePath = [[NSBundle mainBundle] pathForResource:@"whistle" ofType:@"wav"]; AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:audioFilePath] error:NULL]; [audioPlayer play]; } </code></pre> <p>Using the debugger, the call to 'play' never returns. No sound is played either. The button stays in the highlighted state until I hit the home button to exit the app.</p> <p>From the about menu of the simulator I'm using 'Version 2.2 (77.4.9)'.</p> <p>-Bill</p>
iphone
[8]
5,837,185
5,837,186
expandable list not looking properly in 2.1 QVGA
<p>i have developed an application for 1.5 and above which uses expandable list ,but when i test it on 2.1 QVGA emulator expandable list dosent look proper . Also i have tried running sample Expandablelist1 ,but it also has same issue. so can anyone tell me is this issue with emulator only? if yes how to resolve it?</p> <p>Thanks in advance</p>
android
[4]
4,549,037
4,549,038
Use of undefined constant DB_SERVER - assumed 'DB_SERVER'
<p>I have the following php code : </p> <pre><code>$db_host = "localhost"; $db_user = "root"; $db_pass = ""; $db_name = "photos"; define(DB_SERVER,$db_host); define(DB_USER,$db_user); define(DB_PASS,$db_pass); define(DB_NAME,$db_name); </code></pre> <p>I am defining <code>DB_SERVER</code> and all the other ones as you can see above, but for some reason I get the following errors : </p> <pre><code>Notice: Use of undefined constant DB_SERVER - assumed 'DB_SERVER' in /Users/ahoura/Sites/photos/include/config.php on line 34 Notice: Use of undefined constant DB_USER - assumed 'DB_USER' in /Users/ahoura/Sites/photos/include/config.php on line 35 Notice: Use of undefined constant DB_PASS - assumed 'DB_PASS' in /Users/ahoura/Sites/photos/include/config.php on line 36 Notice: Use of undefined constant DB_NAME - assumed 'DB_NAME' in /Users/ahoura/Sites/photos/include/config.php on line 37 </code></pre> <p>What am I doing wrong!?!?!</p>
php
[2]
2,917,182
2,917,183
Problems with mousewheel in jQuery
<p>I have the following code in the head-section:</p> <pre><code>&lt;script type='text/javascript' src='/js/jquery.mousewheel.min.js'&gt;&lt;/script&gt; jQuery(function($) { $('#box').bind('mousewheel', function(event, delta) { var dir = delta &gt; 0 ? 'Up' : 'Down', vel = Math.abs(delta); alert(dir + ' at a velocity of ' + vel); return false; }); }); </code></pre> <p>In firefox 5 nothing happens at all. In Chrome 13 and IE 9 I get "Down at a velocity of NaN", no matter at which direction I scroll.</p> <p>How can I fix this? What I want to do is to check if the user is scorlliing upwards, or if he´s scrolling downwards.</p> <p>Thanks for your help!</p>
jquery
[5]
3,436,390
3,436,391
Getting a CC copy of user invite Emails
<p>The code below works great. It allows a user to send a recommendation for my site to a list of friends via email. </p> <p>For each person that gets the email below, I would like to get an email with that person's email, and the name of the person that sent them the message. If my email address was john@site.com, what code could I use to do this?</p> <p>Thanks in advance,</p> <p>John</p> <pre><code>$msg = "&lt;html&gt;&lt;body&gt;Hello, your friend ".htmlspecialchars($_POST['sendername'])." recommends that you use &lt;a href='http://www.site.com/'&gt;Site.com&lt;/a&gt;.&lt;a href='http://www.site.com/'&gt;Site.com&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;img src='http://site.com/images/blacklogo.PNG'&gt;&lt;/body&gt;&lt;/html&gt;"; $subject = "Try out Site.com"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: ' . $_POST['sendername'] . "\r\n"; foreach($_POST['email'] as $email){ mail($email, $subject,$msg,$headers); } </code></pre>
php
[2]
2,300,263
2,300,264
What is the difference between x = function(a, b, c){} and function x(a, b, c){}?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/336859/javascript-var-functionname-function-vs-function-functionname">Javascript: var functionName = function() {} vs function functionName() {}</a> </p> </blockquote> <p>Is there any difference between these two ways of declaring a function?</p>
javascript
[3]
5,700,516
5,700,517
Strings memory model
<p>What I read about strings is when a string object is created in Java it is immutable. For example:</p> <pre><code>String s=new String(); s="abc"; s="xyz"; </code></pre> <p>Does the <code>String s</code> no longer point to <code>"abc"</code>?</p> <p>And another thing: what is size of s; Is the <code>String</code> object analogous to a <code>char*</code> pointer in C in terms of the memory model?</p>
java
[1]
2,673,518
2,673,519
Advertisements in Android
<p>I have a publisher account registered in US and I am deploying my application from that account. I have an admob account registered in India. Can I give ads to my app with both being registered with different details. This is my first app I am going to deploy Please help me.</p>
android
[4]
4,107,690
4,107,691
Listview in Listview
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5244797/listview-setadapter-raising-nullpointer-exception">Listview.setadapter raising nullpointer exception.</a> </p> </blockquote> <p>Hi, How to create a listview in a listview. I have a tabbar application. The second tab is a list view, when a cell in the listview is clicked, it should showthe next list view. How to do this?</p> <p>I have tried some thing here <a href="http://stackoverflow.com/questions/5244797/listview-setadapter-raising-nullpointer-exception">Listview.setadapter raising nullpointer exception.</a></p> <p>The error is as below. is it possible to do it in the way as in the previous question. are there any easier methods.</p>
android
[4]
32,540
32,541
Can an IPhone app be developed on a PC?
<p>I do not have access to a MacOS box. Everything I've found while researching iPhone development leads me to believe that you have to have one to develop for the iPhone. I have a Windows 7 development box running Visual Studio 2010 with IIS 6.0 in the background. I need to develop an App. Can I create an icon-on-the-desktop-out-of-the-browser App with only HTML5, Javascript, and CSS3? Can I do it without MacOS and Objective-C? Most importantly, can I do it without spending hundreds of dollars or man hours?</p> <h2>Edits:</h2> <p>I will simplify my question: Can I develop an IIS web application that can be used out-of-browser on an iPhone?</p> <h2>Further Edits:</h2> <p>Does PhoneGap.com create native iPhone apps?</p>
iphone
[8]
3,530,686
3,530,687
On button click make div visible if check box checked is true Using jquery
<p>I have 32 checkboxes (checkbox1,checkbox2,checkbox3.... checkbox32) and 32 div(div1,div2,div3.....div32) and one asp:Button.</p> <p>On button click I need to make div1 visble if checkbox1 checked true and div2 visble if checkbox2 checked true and div3 visble if checkbox3 checked true and so on using JQuery..</p> <pre><code>&lt;div class="CheckBoxDiv "&gt; &lt;asp:CheckBox ID="checkBox1" runat="server" /&gt; &lt;/div&gt; &lt;asp:CheckBox ID="checkBox2" runat="server" /&gt; &lt;/div&gt; . . . &lt;asp:Button ID="buttonShowData" runat="server" Text="Show data" class="ShowDataButton" /&gt; &lt;div id="div1" runat="server" visible="false"&gt; ...... &lt;/div&gt; &lt;div id="div2" runat="server" visible="false"&gt; ...... &lt;/div&gt; . . </code></pre>
jquery
[5]
2,949,172
2,949,173
What problems might arise when sharing an int between two threads?
<p>Two threads accesses a shared int, x. What problems can arise from instruction reordering etc.</p> <p>Thread 1:</p> <pre><code>x = 1; </code></pre> <p>Thread 2:</p> <pre><code>obj.f(x); </code></pre> <p>What would change if x is declarared volatile?<br> What would change if Thread 1 and Thread 2 runs on different cores?</p>
c++
[6]
2,254,237
2,254,238
Android Html.fromHtml takes too long
<p>What do I do if <code>tv.setText(Html.fromHtml(text));</code> takes too long, and hangs the UI? If I can do it with a thread, can you provide an example?</p>
android
[4]
241,453
241,454
What's the diff between Cache and Application?
<p>I just noticed a "Cache" object, when would you use the Cache object to store state data nd when would you use the Application object?</p>
asp.net
[9]
4,207,699
4,207,700
how to request for camera for an application?
<p>I have made an application which is always using the front camera. My application is running and i want to use camera for some other application. How can i request for camera to release for other application?</p>
android
[4]
5,985,674
5,985,675
How to obfuscate an Android library (.jar file) from eclipse
<p>Hi I need to create a create a obfuscated jar. I want to distribute it client so want my code to be obfuscated .</p>
android
[4]
4,442,477
4,442,478
Replace Button Text during .click() Function
<p>I have a hidden Textbox. If I click a button, the content of a div appears. If I click the Buutton again, the content disappears (.slideToggle()): I would like to replace the text of my button, if the content of the div is visible and change it back, if the button gets clicked again and the content of the DIV, better: the DIV gets hidden. That is my current Coce:</p> <pre><code>function show_content(){ jQuery('.single_content').hide(); jQuery('.css_hide').show(); jQuery('.show_content').click(function(){ jQuery('.single_content').slideToggle(); var text = jQuery(this).html(); if ( jQuery('.single_content').is(':visible') ) { jQuery(this).html('abc'); } }); } </code></pre> <p>What did I do wrong?</p> <p>Many Thanks</p>
jquery
[5]
2,989,339
2,989,340
Script printing Blob works on one hosting site, not on another
<p>I've a script that prints images (Blobs from mysql DB). It works fine on Godaddy but when I move it to a UK hosting company it fails to print the image - prints the alt text instead (everything else works fine). GD is PHP 5.3 and the UK company is PHP 5.2. Both mysql DBs are 5. I have checked that the scripts are the same, correct data is in the DB etc. I am at a loss as to where to look now.</p> <p>The script is called with</p> <pre><code>echo "&lt;img src = 'printimage1.php?recipetableID=$recipetableID' alt='Picture does not display.'&gt;"; </code></pre> <p>and the printimage1.php script looks like</p> <pre><code>&lt;?php header("Content-type: image/jpg"); $recipetableID=$_GET['recipetableID']; include("connect.inc"); $connection = mysql_connect($host,$user,$password) or die ("couldn't connect to server"); $db = mysql_select_db($database,$connection) or die ("Couldn't select database"); $query = "SELECT * FROM RecipeTable WHERE recipetableID = '$recipetableID'"; $result = mysql_query($query) or die ("Couldn't execute query."); while($row=mysql_fetch_array($result,MYSQL_ASSOC)) { echo $row['Picture1content']; } ?&gt; </code></pre> <p>Any suggestions appreciated. John.</p>
php
[2]
2,310,021
2,310,022
java : convert float to String and String to float
<p>How could I convert from float to string or string to float?</p> <p>In my case I need to make the assertion between 2 values string (value that I have got from table) and float value that I have calculated.</p> <pre><code>String valueFromTable = "25"; Float valueCalculated =25.0; </code></pre> <p>I tried from float to string:</p> <pre><code>String sSelectivityRate = String.valueOf(valueCalculated ); </code></pre> <p>but the assertion fails </p>
java
[1]
1,067,903
1,067,904
Mainting the state of array across the entire app using singleton pattern
<pre><code>function MySingletonClass(arg) { this.arr = []; if ( arguments.callee._singletonInstance ) return arguments.callee._singletonInstance; arguments.callee._singletonInstance = this; this.Foo = function() { this.arr.push(arg); // ... } } var a = new MySingletonClass() var b = MySingletonClass() Print( a === b ); // prints: true </code></pre> <p>My requirement is i am pushing objects to an array on each load of window, but when i open the next window the state of the array is not visible. </p> <pre><code>var arr = []; arr.push("something"); </code></pre> <p>// It gets pushed. </p> <p>When i open the new window, the array's length becomes zero again. </p>
javascript
[3]
3,929,164
3,929,165
How To Generate (Somewhat) Secure Passwords in PHP?
<p>I'm trying to come up with a function that can generate random passwords, that must meet the following requirements:</p> <ul> <li>Between 8 &amp; 14 characters</li> <li>Contain a least one of the following: lowercase letter, uppercase letter, punctuation, and number</li> </ul> <p>what would be the best way about going about this, such that the function can generate every possible password that meets said requirements?</p>
php
[2]
1,682,829
1,682,830
How to change color of the toggle button?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/11253512/change-on-color-of-a-switch">Change &ldquo;on&rdquo; color of a Switch</a> </p> </blockquote> <p>I need to have a toggle button change color when it changes state from Green(true) to Red(false).how can i change toggle button color? thanks..</p>
android
[4]
817,015
817,016
Byte[] Array to String
<p>I want to output a Byte[] array to a string so I can send it along a HTTPRequest. Can it be done? And will the server pick up the data and create a file from it? Or does some special encoding need to be done?</p> <p>The file is an image. At the moment I have: </p> <pre><code>Byte[] fBuff = File.ReadAllBytes("C:/pic.jpeg"); </code></pre> <p>I need to take what's in fBuff and output it to send along a post request.</p>
c#
[0]
658,250
658,251
Show numerals only on clicking edit text and also able to accept decimal point(.)
<p>For an edittext i used wt.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL); But the virtual keyboard that comes up on clicking that field is not showing integers only. It is showing normal querty keypad only. But when i used like this wt.setRawInputType(Configuration.KEYBOARD_12KEY); the keypad is showing as desired but am not able to use the decimal point(.). I wanted to get the numerical keypad as well as able to enter decimal point. How can i do this.</p>
android
[4]
2,674,068
2,674,069
find current element in repeater
<p>How can i get current MainNavigationMenu hyprelink in code behind and check if is current menu clicked then i will change him default CSS.</p> <p>I try with this code but is always null</p> <pre><code>HyperLink mainNavigationMenu = siteMapAsBulletedList.FindControl("MainNavigationMenu") as HyperLink; </code></pre> <p>full repeater code:</p> <pre><code>&lt;asp:Repeater runat="server" ID="siteMapAsBulletedList" DataSourceID="smdsMenu"&gt; &lt;HeaderTemplate&gt; &lt;li&gt;&lt;asp:HyperLink ID="MainNavigationMenu" runat="server" NavigateUrl='&lt;%#SiteMap.RootNode.Url%&gt;' Text='&lt;%#SiteMap.RootNode.Title%&gt;'&gt;&lt;/asp:HyperLink&gt;&lt;/li&gt; &lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; &lt;li&gt;&lt;asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='&lt;%#Eval("Url")%&gt;' Text='&lt;%#Eval("Title")%&gt;'&gt;&lt;/asp:HyperLink&gt;&lt;/li&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; </code></pre>
c#
[0]
3,057,671
3,057,672
Android. Record calls, disable mic. Acer Ferrari
<p>My app needs to record calls. It works fine on many devices, but not on Acer Ferrari Liquid E. If my app is running, then interlocutor on other side of wire does not hear me (if I set mic on/off manually, then he hear me). So, as workaround for Ferrari, I want to try set on/off mic programmaticaly.</p> <pre><code>(AudioManager)getApplicationContext() .getSystemService(Context.AUDIO_SERVICE) .setMicrophoneMute </code></pre> <p>does not work.</p>
android
[4]
3,426,444
3,426,445
jquery accessing label of input
<p>I have some HTML like this:</p> <pre><code>&lt;input type="radio" class="MyRadio" name="TheName"&gt; &lt;label for="TheLabel"&gt;the text&lt;/label&gt; </code></pre> <p>How do I change the label's text?</p> <p>Tried </p> <pre><code>$('#TheLabel').text('My New Text'); </code></pre> <p>It doesn't work. What's the way to do it?</p> <p>Thanks.</p>
jquery
[5]
1,636,025
1,636,026
How to update contact number using Android
<p>I am learning android. I am trying to upadate contact number programmatically. Could anyone help me please how can I do that.</p> <p>My effort is:</p> <pre><code>String lNumber = pCur.getString( pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); ContentValues values = new ContentValues(); Uri lPhoneUri = Uri.withAppendedPath(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, ContactsContract.CommonDataKinds.Phone.NUMBER); values.put(ContactsContract.CommonDataKinds.Phone.NUMBER, "45323333")); getContentResover().update(lPhoneUri, values, ContactsContract.CommonDataKinds.Phone.NUMBER+"=?", new String[] { lNumber }); </code></pre>
android
[4]
5,816,711
5,816,712
spliting java string based on bunch of non alpha characters
<p>I have a string some thing like <code>my+*%name===is+jhon!#and&amp;*^I$stay===in^&amp;$#@US</code>. I want output as </p> <pre><code>s[0]="my" s[1]="+*%" s[2]="name" s[3]="===" s[4]="is" s[5]="+" s[6]="jhon" s[7]="!#" s[8]="and" s[9]="&amp;*^" s[10]="I" s[11]="$" s[12]="stay" s[13]="===" </code></pre> <p>etc.</p> <p>Please note that it is not following any pattern and the bunch of nonalphanumeric chars vary as the string will be dynamic data string</p>
java
[1]
4,067,229
4,067,230
Is there another way to create an object with a classname returned by a method?
<p>I have this method : </p> <pre><code>public function getInstance() { $classname = $this-&gt;getFullyQualifiedClassName(); return new $classname(); } </code></pre> <p>Is there a way to write this without the <code>$classname</code> variable, which gets used only once?</p>
php
[2]
3,237,296
3,237,297
Why is UIApplicationWillChangeStatusBarFrameNotification not sent when the status bar changes height?
<p>I've been trying to listen for changes in the status bar height – such as when the in-call status bar is shown or hidden, or the same with the internet tethering status bar – by listening for the UIApplicationWillChangeStatusBarFrameNotification notification to be sent.</p> <p>Fairly straightforward code here...</p> <pre><code>[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarWillChangeFrame:) name:UIApplicationWillChangeStatusBarFrameNotification object:nil]; </code></pre> <p>But the notification never seems to be sent in that case, either on the Simulator by using the "Toggle In-Call Status Bar" option or on the device when a call ends with the application open. In addition, the similar UIApplicationDelegate method is not called.</p> <p>According to the documentation,</p> <blockquote> <p><strong>UIApplicationWillChangeStatusBarFrameNotification</strong></p> <p>Posted when the application is about to change the frame of the status bar.</p> <p>The userInfo dictionary contains an NSValue object that encapsulates a CGRect structure expressing the location and size of the new status bar frame. Use UIApplicationStatusBarFrameUserInfoKey to access this value.</p> </blockquote> <p>Can anyone explain why this notification is not being sent in response to the in-call status bar being shown or hidden? According to the documentation, it should be.</p>
iphone
[8]
3,710,919
3,710,920
Not Adding Contents to New Line while writing to a file in Append Mode
<pre><code> &lt;?php if(isset($_POST['submit'])){ $file="get.php"; $open = fopen($file, "a+"); //open the file, (get.php). fwrite($open, "Name: " .$_POST['user'] . "/n"); //print / write the name. fwrite($open, "Colour: ". $_POST['color'] . "/n"); //print / write the colour. fclose($open); //close the opened file echo "Log File Entry Had Been Made"; } ?&gt; </code></pre> <p>But The Output is written to get.php as -> /nName: The Name Posted/nColour: Colour Posted/n Please help if you have time, Thanks All.</p>
php
[2]
1,251,583
1,251,584
starting text to speech engine from a service?
<p>i have a service from where i am trying to start a TextToSpeech engine ,but it seems that it's not working , so is it possible to start tts from a service?</p> <p>here's what i've tried:</p> <pre><code>package com.example.TextSpeaker; import java.util.Locale; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.speech.tts.TextToSpeech; import android.speech.tts.TextToSpeech.OnInitListener; import android.util.Log; import android.widget.Toast; public class SpeakerService extends Service implements OnInitListener{ public static TextToSpeech mtts; @Override public IBinder onBind(Intent arg0) { // TODO Auto-generated method stub return null; } @Override public void onCreate(){ Log.d("SpeakerService","Service created successfully!"); mtts = new TextToSpeech(this,this); mtts.setLanguage(Locale.ENGLISH); } @Override public void onStart(Intent intent,int startid) { Log.d("SpeakerService","Service started successfully!"); Log.d("SpeakerService","Service started successfully!"); Log.d("SpeakerService","tspker.mtts = " + TextSpeaker.mtts.toString()); mtts = new TextToSpeech(this,this); mtts.setLanguage(Locale.ENGLISH); mtts.speak(Receiver.str, TextToSpeech.QUEUE_FLUSH,null); } @Override public void onDestroy(){ if(mtts!=null) { mtts.stop(); Toast.makeText(getApplicationContext(),"The service has been destroyed!", T oast.LENGTH_SHORT).show(); } } @Override public void onInit(int arg0) { // TODO Auto-generated method stub } } </code></pre>
android
[4]
2,330,548
2,330,549
Using adapters for non-list views
<p>I am using a SimpleCursorAdapter to populate a ListView with items from my database. When a user clicks on an item it takes them to the detail Activity for that item. What is the best practice for displaying that page; just write a display function that grabs all the TextViews I want to set the text for and populate them from the database or to use another SimpleCursorAdapter to set the TextViews? If the answer is to use an adapter, do I have to shove the detail page in a ListView?</p>
android
[4]
3,014,126
3,014,127
form is submitimg even I am using return false
<p>form is submitimg even I am calling return false my code</p> <pre><code>$(document).ready(function() { $('.submit').click(function() { $('.hour').each(function() { var $hours = $(this).val(); if ($hours == "") { alert(" Active Time is required"); return true; } }); }); });​ </code></pre> <p>submit button</p> <pre><code> &lt;input type="submit" class="submit" name="Submit" id="Submit" value="Submit" onclick="return validateForm();"/&gt; </code></pre>
jquery
[5]
2,763,646
2,763,647
Move cursor to end of EditText?
<p>I'm replacing some text in an EditText, then I want to move the cursor to the end of the current text input. It kind of seems to work - when I start typing again, the cursor seems to be at the end of the EditText, but it doesn't flash / blink anymore. I have to touch the EditText again for the cursor to start blinking again. Am I doing it wrong?:</p> <pre><code>editText.setSelection(editText.getText().length()-1); </code></pre> <p>Thanks</p>
android
[4]
1,551,074
1,551,075
Regarding to save previous record in asp.net
<p>Hi I have one label for question, radiobuttonlist for their answers, next button to move next question &amp; previous button. I am displaying one question per page after clicking next button next question appears, but when i click previous button previous question appears. But i want previous question with earlier selected answer when i click to previous button. Asp.net c# Thank you.</p>
asp.net
[9]