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,148,864
5,148,865
string function
<p>please can anybody explain me what this function do?i am confused</p> <pre><code>bool isOnlyLeftHand(string w) { return (w.find_first_not_of("qwertasdfgzxcvb") == string::npos); }//end isOnlyLeftHand </code></pre>
c++
[6]
1,378,064
1,378,065
Math operations with null
<p>Please explain why this test passes?</p> <pre><code>[Test] public void TestNullOps() { Assert.That(10 / null, Is.Null); Assert.That(10 * null, Is.Null); Assert.That(10 + null, Is.Null); Assert.That(10 - null, Is.Null); Assert.That(10 % null, Is.Null); Assert.That(null / 10, Is.Null); Assert.That(null * 10, Is.Null); Assert.That(null + 10, Is.Null); Assert.That(null - 10, Is.Null); Assert.That(null % 10, Is.Null); int zero = 0; Assert.That(null / zero, Is.Null); } </code></pre> <p>I don't understand how this code even compiles.</p> <p>Looks like each math expression with null returns <code>Nullable&lt;T&gt;</code> (e.g. <code>10 / null</code> is a <code>Nullable&lt;int&gt;</code>). But I don't see operator methods in <code>Nullable&lt;T&gt;</code> class. If these operators are taken from <code>int</code>, why the last assertion doesn't fail?</p>
c#
[0]
2,124,295
2,124,296
Application access permission to files on internal storage
<p>A question about the internal storage that's private to each application (especially when storing files with Context.MODE_PRIVATE). </p> <p>How is that storage actually assigned to the application? Just by package name or also somehow bound to the sign key of the app?</p> <p>Let's say I have installed application 1 and then write another application 2 with the same name and package name (just differently signed with different keys) and install it (app 2 replacing app 1), would that application 2 get access to the /data/data/[app]/files ?</p> <p>Or would I not even be able to replace app1 with app2 due to different sign keys in the first place?</p>
android
[4]
1,251,052
1,251,053
Firefox Add-on SDK : nsIDOMGeolocation getCurrentPosition not working
<p>While following one of the tutorial <a href="https://addons.mozilla.org/en-US/developers/docs/sdk/1.7/dev-guide/tutorials/reusable-modules.html" rel="nofollow">https://addons.mozilla.org/en-US/developers/docs/sdk/1.7/dev-guide/tutorials/reusable-modules.html</a> ,I got stuck, trying to get lat-lon values on console.</p> <p>Here's an approximation of my code:</p> <pre><code>var {Cc, Ci} = require("chrome"); function getCurrentPosition(callback) { var geolocation = Cc["@mozilla.org/geolocation;1"] .getService(Ci.nsIDOMGeoGeolocation); geolocation.getCurrentPosition(done,error); } var widget = require("widget").Widget({ id: "whereami", label: "Where am I?", contentURL: "http://www.mozilla.org/favicon.ico", onClick: function() { getCurrentPosition(function(position) { console.log("latitude: ", position.coords.latitude); console.log("longitude: ", position.coords.longitude); }); } }); function error(error) { console.log("error occured trying to get geolocation from chrome"); } function done(position) { console.log("geolocation was found from chrome"); } </code></pre> <p>I run this using "cfx run" command from cmd on windows machine , new instance of firefox opens up, on clicking widget created , nothing happens ,why it does not output lat lon on console? </p> <p>Thanks in advance.</p>
javascript
[3]
2,815,489
2,815,490
want to show the balloon
<p>I am working on the map view and i want to show the balloon by clicking on the user which are displayed on the map view. i have done till it shows the use name and status using the dialog box.but i want the profile name, status, and button on small rectangle above the clicked balloon(balloon is the users on the map).please give me some idea to do so. thank you.</p> <pre><code>protected boolean onTap(int index) { OverlayItem item = mOverlays.get(index); AlertDialog.Builder dialog = new AlertDialog.Builder(mContext); dialog.setTitle(item.getTitle()); dialog.setMessage(item.getSnippet()); dialog.show(); return true; } </code></pre>
android
[4]
5,423,754
5,423,755
Can we make an incremental counter with only PHP?
<p>I would like to know if it's possible without javascript to update an echo ?</p> <p>For example</p> <pre><code>&lt;?php for ($i = 1; $i &lt; 100; $i++){ echo $i; } ?&gt; </code></pre> <p>But it will only update the number without adding another line, and another until 100. Is this possible or only with javascript you can achieve this.</p> <p>I need to output a counter to know how much files is being processed at the moment like</p> <blockquote> <p>45 of 100 pages</p> </blockquote>
php
[2]
5,883,871
5,883,872
queryselectorAll - find an element with more than one matching class
<p>Using the JS queryselectorall method is it possible to select an elemnent of a particular tag name with 2 matching classes.</p> <p>E.g. I have an element</p> <pre><code>&lt;a class="classOne classTwo"&gt;&lt;/a&gt; </code></pre> <p>using queryselectorall I can select on one classname:</p> <pre><code>document.querySelectorAll("a.classOne"); </code></pre> <p>how could this be extended so I can find all a tags with classOne AND classTwo?</p> <p>document.querySelectorAll("a.classOne classTwo"); as expected doesn't seem to work</p> <p>Thanks in advance</p>
javascript
[3]
5,767,086
5,767,087
augmentation reality
<p>Can somebody help me in knowing how nyARToolkit is embedded in android app as library as there is no jar file in it.It consist only of java file. I am very confused.Please help me. Thankyou</p>
android
[4]
2,512,700
2,512,701
Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode
<p>I am using <code>MySql</code> and <code>SQLLITE</code> in my application. When Inserting data or updating the data using <code>SQLLITE</code> my <code>session</code> value returning <code>null</code> after query is processed. So in-order to overcome this I write as follows in <code>Web.Config</code></p> <pre><code>&lt;sessionState mode="StateServer"&gt;&lt;/sessionState&gt; </code></pre> <p>Every thing works fine but when coming to a certain page I am getting the error as </p> <p><code>Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.</code></p> <p>In remaining pages every thing works fine can any one tell why this happens</p>
asp.net
[9]
4,368,992
4,368,993
can anybody suggest me the website from where i can see the proper code of an application
<p>hello I want to make an application for practise so can anybody suggest me the address of any website so that i can take codes of android application and practise it on my sdk.</p> <p>thanks!</p>
android
[4]
3,446,357
3,446,358
C# keyword-like variables
<p>We have the following cycle in the code:</p> <pre><code>foreach (var event in events) { ... { </code></pre> <p>Of cources we can't name variable "event" as it is a keyword. Which way is a more appropriate in this kind of cases: to use @ prefix (@event) or to use another name like "currentEvent"?</p>
c#
[0]
5,144,560
5,144,561
scrolling and swiping problem in android
<p>In my project i am rendering pdf, in landscape mode i am fitting to pagewidth and in portrait mode i am fitting to pageheight mode. can anybody suggest me how to do scrolling in landscape mode only and swiping in both orientations. thank you in advance..</p>
android
[4]
901,647
901,648
How to send a email from C#.net?
<p>I am working on framework 2.I want to send email through my portal.I visited many site.From that I able to understand this much.Here is my code.I have created page design.What is smtpserver.This code giving me error.</p> <blockquote> <p>System.Web.HttpException: The server rejected the sender address</p> </blockquote> <pre><code> MailMessage Msg = new MailMessage(); // Sender e-mail address. Msg.From = txtFrom.Text; // Recipient e-mail address. Msg.To = txtTo.Text; Msg.Subject = txtSubject.Text; Msg.Body = txtBody.Text; // your remote SMTP server IP. SmtpMail.SmtpServer = "smtp.gmail.com"; SmtpMail.Send(Msg); Msg = null; </code></pre>
asp.net
[9]
3,690,445
3,690,446
how to unselect a select option box after some calculation is done
<p>just wondering how it's possible to un-select the select option box, i used .remove() but this actually removes the text from the select box,</p> <p>is there any other way. </p> <p>thanks</p>
jquery
[5]
1,348,255
1,348,256
Unable to understand this python code
<p>I was reading about python functions and saw this code:</p> <pre><code>def happyBirthday(person): print("Happy Birthday to you!") print("Happy Birthday to you!") print("Happy Birthday, dear " + person + ".") print("Happy Birthday to you!") happyBirthday('Emily') happyBirthday('Andre') </code></pre> <p>I couldn't understand why these brackets were being used for the print commands and so I removed them.</p> <pre><code>def happyBirthday(person): print "Happy Birthday to you!" print "Happy Birthday to you!" print "Happy Birthday, dear " + person + "." print "Happy Birthday to you!") happyBirthday('Emily') happyBirthday('Andre') </code></pre> <p>Even after removing those brackets I am getting the exact same results, so I am not sure which one is correct or whether I should use those brackets at all. Is it really necessary to use those brackets?</p> <p>One more thing. when I use the brackets then the <code>+person+</code> gives the result as Happy Birthday, dear Andre. but when I use <code>,person,</code> then it gives the result as &lt;'Happy Birthday,dear ',' 'Andre','.'></p> <p>I am unable to understand these differences in the results. Could you shed some light on this?</p>
python
[7]
3,236,560
3,236,561
How to send emails using C#
<p>I want to send email through windows form. I want to do the code as all the emails sent from the application will be sent to the my Yahoo mail box. I have done something where I used my Gmail account as Smtp Network Credidentials.</p>
c#
[0]
5,653,198
5,653,199
java matches regex for variables
<p>I want to match any string that has the pattern</p> <pre><code>{"id":"362237- any number of characters followed by "http//:www.abc.com" any number of characters followed by "id":"364121- any number of characters followed by "http://www.efg.com" </code></pre> <p>I want to match above pattern to the string below.</p> <pre><code>[{"id":"362237-13","http//:www.abc.com"},{"id":"364075-13","http://www.xyz.com"},{"id":"364121-13","http://www.efg.com"}] </code></pre> <p>Code:</p> <pre><code>String pttrn=".*{\"id\":"362237-.*\"http//:www.abc.com\".*\"id\":"364121-.*\"http://www.efg.com\".*"; String mtchr="[{\"id\":\"362237-13\",\"http//:www.abc.com\"},{\"id":\"364075-13\",\"http://www.xyz.com\"},{\"id\":\"364121-13\",\"http://www.efg.com\"}]"; boolean b = Pattern.matches(pttrn, mtchr); System.out.println("b is !!" + b); </code></pre> <p>I was expecting b to be true but it returns false. I have got the regex wrong.</p> <p>Please let me know how to fix it.</p> <p>Thanks</p>
java
[1]
1,789,637
1,789,638
How to load pictures using JPEG codec in java?
<p>what is the procedure to loading a picture by using of JPEG codec?</p>
java
[1]
5,788,086
5,788,087
Updating data from GridView
<p>I have a Gridview where I join two tables, bringing in the data to be displayed</p> <p>table 1 sid, schedule, stime, splace, stourid</p> <p>table 2 tourid, tourname</p> <p>Basically they are joined stourid to tourid. That is so I can show the tourname in the grid.</p> <p>Now I want to edit this GridView, what do I need to do, for instance, if the user edits the tourname, that it'll be saved to the database? I assume an Update statement is need, but how does it link to the GridView?</p> <p>Whats the best and neatest method?</p> <p>Regards,</p>
asp.net
[9]
2,459,317
2,459,318
Progress spinner inside textview or autocompletetextview
<p>I would like to create autocompletetextview with loading spinner inside (like in bilt-in Android browser, when page is loaging).</p> <p>How can I implement it? </p> <p>Also is it existing drawable inside android framework?</p>
android
[4]
4,964,359
4,964,360
Adding a Row to a DataTable question
<p>Greetings everyone-</p> <p>In my code below I'm trying to add a Row from an existing DataTable (dtResult) into a new DataTable (dtCopyResult) if email address does not match. So I guess my knowledge of ADO.NET is not up to par because whenever I try to run my below code, I get an "This Row already belongs to another table". Please let me know how I can fix this..</p> <p>Many Thanks</p> <pre><code> if (checkBox1.Checked) { for (int i = dtResult.Rows.Count - 1; i &gt;= 0; i--) //dtResult is a DataTable { foreach (object email in emails) //emails is an ArrayList of email addresses { if (email.ToString().ToUpper() != dtResult.Rows[i][3].ToString().ToUpper()) { dtCopyResult.Rows.Add(dtResult.Rows[i]); //dtCopyResult is a new blank DataTable that I'm trying to add rows to } } } } </code></pre>
c#
[0]
1,719,214
1,719,215
Fixed - Adding parameter to link, then redirect results in amp; in $_GET
<p>// Edit FIXED: I fixed it by moving the code to the HTML head, removing it from the Smart html template file. Seems smarty messed it up in some way. Thx for your help :] // Edit</p> <p>How do I correctly add a parameter to a link with jquery? I've now read various threads here about that, but I can't get it to work right. </p> <p>In detail, if the user clicks a certain link on click I want to get the value of an input, afterwards add it to the clicked link and redirect the user with the new url with the added parameter.</p> <p>Everything works just fine, but when I dump the $_GET with Php on the target URL I always end up with amp;parameter_name instead of parameter_name. What I do:</p> <pre><code>$('#add-item-wishlist').bind('click', function(e) { // get quantity from input var current_qty = $('.inp-qty').val(); //redirect user e.preventDefault(); window.location.href = $(this).attr("href") + '&amp;qty=' + current_qty; }); </code></pre> <p>&amp;qty always results in amp;qty if I dump with php, so does the check inside the php script fail.</p> <p>// edit may I mention that i use this snippet in en enviroment with Smarty Template Engine?</p>
jquery
[5]
716,192
716,193
How to use custom font in String.xml file
<p>I have use following code in String.xml file.Now my question is here i had use font face as Aerial.So is there any way where i can use my custom font instead of using aerial here..suppose my custom font is aa.ttf...so how that can i use here. My code is</p> <pre><code>&lt;string name="strt_dialog_desc"&gt;To start monitoring press and hold the date on which the latest cycle started.&lt;![CDATA[&lt;font face=Aerial&gt;]]&gt;Click OptionMenu for help!&lt;![CDATA[&lt;/font&gt;]]&gt;&lt;/string&gt; </code></pre>
android
[4]
5,993,671
5,993,672
C# with WPF Call UserControl form from Window Form
<p>Actually, I'm using C# with WPF. Let me explain again:</p> <ol> <li><p>I have create UserControl (WPF) with one Button (Click on Button to create Image and textBox (Like New Folder)).</p></li> <li><p>And I have another Window form (WPF) with Button and I want to Click on Button in Window Form to do Action instead of Button in UserControl. Here is the code of UserControl: </p></li> </ol> <pre class="lang-cpp prettyprint-override"><code>private void btnNewRoom_Click(object sender, RoutedEventArgs e) { Image img = new Image(); img.VerticalAlignment = System.Windows.VerticalAlignment.Top; img.Width = 100; img.Height = 100; var assemblyLocation = Assembly.GetExecutingAssembly().Location; var applicationDirectory = System.IO.Path.GetDirectoryName(assemblyLocation); img.Source = new BitmapImage(new Uri("/Resources/Images/folder.png", UriKind.RelativeOrAbsolute)); StackPanel sp = new StackPanel(); TextBox tb = new TextBox(); tb.Width = 120; tb.Height = 25; tb.Text = "New Folder"; sp.Children.Add(img); sp.Children.Add(tb); AddNewRoom.Children.Add(sp); } </code></pre> <p>and It is possible ?</p> <p>Note: Any good way to Click button to Create Image and TextBox?</p>
c#
[0]
2,099,965
2,099,966
result is disappeared when mobile orientation is changed
<p>in my application result displayed in Text view is disappeared when mobile orientation is changed,for this what can i do.i want my application in both modes means portrait and landscape.for this what can i do.Give me some suggestions.Thanks in advance</p>
android
[4]
5,905,108
5,905,109
Google Maps Hash value not accepted (Convert SHA1 to MD5?)
<p>I've followed the steps delineated in Lee's android book on generating an MD5 fingerprint:</p> <p>At a command prompt, I navigated to: C:\Program Files\Java\jre7\bin</p> <p>I then entered: keytool.exe ... C:\Users\Clay.android\debug.keystore ... (etc. - from p. 112 of "Beginning Android Tablet Application Development" by Wei-Meng Lee)</p> <p>It generates a code like this:</p> <p>: CC:AB:1E:GD:E8:18:29:3A:25:3D:B9:19:23:F1:10:3C:15:14:CF:2B</p> <p>When I enter this at <a href="http://code.google.com/android/add-ons/google-apis/maps-api-signup.html" rel="nofollow">http://code.google.com/android/add-ons/google-apis/maps-api-signup.html</a>, it takes me to another page that tells me that the entered value is invalid ("The fingerprint you entered is not valid. Please press the Back button on your browser and enter a valid certificate fingerprint")</p> <p>Note: I did not add the "" portion. I tried it with and without the colon separators.</p> <p>As it says it is MD5 that is needed, and the values is apparently SHA1, do I need to convert this SHA1 to MD5? If so, how?</p>
android
[4]
5,301,405
5,301,406
Why Private data member inherited in child class
<p>I have this piece of code</p> <pre><code>public class Base { private int x=10; void show(){ System.out.println(x); } } public class Child extends Base { public static void main(String[] args) { Child c1=new Child(); c1.show(); } } </code></pre> <p>This piece of code is working fine and output is 10.Can anyone please Elaborate how this private data member is access in child class.. </p>
java
[1]
2,681,401
2,681,402
Unexpected end of file error while opening a file via os.system
<pre><code> f = urllib.urlopen(url) #Download the file localFile = open(url.split('/')[-1],'w') localFile.write(f.read()) os.system("transmission %s" %localFile) </code></pre> <p>Error I get is this:</p> <pre><code>sh: Syntax error: end of file unexpected 512 </code></pre>
python
[7]
526,171
526,172
ASP.Net Add Control "Cannot get inner content of [control] because the contents are not literal."
<p>I am currently trying to dynamically add HTML controls in my web form, but each time I insert a control in another control the error <code>Cannot get inner content of [control] because the contents are not literal</code> pops up(when trying to look at innerHtml or innerText) and cannot seem to find the reason why.</p> <p>Here is the code that I am using:</p> <pre><code>Dim newsList As New HtmlControls.HtmlGenericControl newsList.TagName = "ul" Dim i As Integer = 0 For Each newsDR As DataRow In newDS.Tables(0).Rows i += 1 Dim stri As String = i.ToString() Dim newsListItem As New HtmlControls.HtmlGenericControl newsListItem.TagName = "li" newsListItem.ID = "newsListItem" + stri Dim newsTitle As New HtmlControls.HtmlGenericControl newsTitle.TagName = "h1" newsTitle.ID = "newsTitle" + stri Dim newsAnchor As New HtmlControls.HtmlAnchor newsAnchor.ID = "newsAnchor" + stri newsAnchor.InnerHtml = newsDR("NewsTitle") newsAnchor.HRef = "#" newsTitle.Controls.Add(newsAnchor) Dim newsSummary As New HtmlControls.HtmlGenericControl newsSummary.TagName = "div" newsSummary.ID = "newsSummary" + stri newsSummary.InnerHtml = newsDR("NewsSummary") newsListItem.Controls.Add(newsTitle) newsListItem.Controls.Add(newsSummary) newsList.Controls.Add(newsListItem) Next </code></pre>
asp.net
[9]
3,838,667
3,838,668
making Imageview displayed on fullScreen
<p>I have 4 imageviews in an activity and I want that if the user clicks on any of the images .. the image should pop out and get displayed in full screen .. How can i possibly achieve this??</p> <p>is using webviews a better option??</p> <p>code: package com.integrated.mpr;</p> <pre><code>import java.io.File; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.os.Environment; import android.widget.ImageView; import android.widget.TextView; public class FinalShow extends Activity{ ImageView iva; ImageView ivb; ImageView ivc; ImageView ivd; File folder = null; Model model = new Model(); @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.finalshow); iva = (ImageView) findViewById(R.id.iva); ivb = (ImageView) findViewById(R.id.ivb); ivc = (ImageView) findViewById(R.id.ivc); ivd = (ImageView) findViewById(R.id.ivd); String sdcardstate = android.os.Environment.getExternalStorageState(); if(sdcardstate.contentEquals(android.os.Environment.MEDIA_MOUNTED)){ String filepath = Environment.getExternalStorageDirectory().getPath(); folder = new File(filepath,model.s);//model.s contains the name of folder File fa = new File(folder,"bmp1.png"); Bitmap bmpa = BitmapFactory.decodeFile(fa.getAbsolutePath()); iva.setImageBitmap(bmpa); File fb = new File(folder,"bmp2.png"); Bitmap bmpb = BitmapFactory.decodeFile(fb.getAbsolutePath()); ivb.setImageBitmap(bmpb); File fc = new File(folder,"bmp3.png"); Bitmap bmpc = BitmapFactory.decodeFile(fc.getAbsolutePath()); ivc.setImageBitmap(bmpc); File fd = new File(folder,"bmp4.png"); Bitmap bmpd = BitmapFactory.decodeFile(fd.getAbsolutePath()); ivd.setImageBitmap(bmpd); } } } </code></pre>
android
[4]
2,125,935
2,125,936
how to hide header redirect on address bar?
<p>I do have a redirect from <code>search.php</code> to <code>get.php</code> using header command and then redirect back to <code>search.php</code> the whole process takes only around few seconds.</p> <p>what I want is I want to hide this redirect on address bar. say this redirect must happened behind the screen. so all the time</p> <p>the address line should show for example :- <a href="http://wwww.example.com/search" rel="nofollow">http://wwww.example.com/search</a></p>
php
[2]
4,149,062
4,149,063
Why does the answer print out twice?
<p>I made a program that returns the product a*b*c where a,b,c are pythagorean triples and add up to 1000. The program does output the correct answer but does it twice. I was curious as to why this is so. After playing around with it a bit I found out that it prints out when a = 200 b = 375 c = 425. And once again when a = 375 b = 200 c = 425.</p> <pre><code>bool isPythagTriple(int a, int b, int c); int main() { for(int a = 1; a &lt; 1000; a++) { for(int b = 1; b &lt; 1000; b++) { for(int c = 1; c &lt; 1000; c++) { if( ((a+b+c)==1000) &amp;&amp; isPythagTriple(a,b,c) ) { cout &lt;&lt; a*b*c &lt;&lt; " "; break; } } } } return 0; } bool isPythagTriple(int a, int b, int c) { if( (a*a)+(b*b)-(c*c) == 0 ) return true; else return false; } </code></pre>
c++
[6]
2,257,173
2,257,174
searching a character in a string
<p>How can i search a character <code>"</code> in a string.</p>
c++
[6]
5,623,367
5,623,368
Calling an inherited property in python
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3964929/polymorphism-in-python">Polymorphism in Python</a> </p> </blockquote> <p>Hi I'm trying to call a property in a class, that is inherited from my baseclass, but it doesn't work. I guess I'm missing something, but what? Here is my code:</p> <pre><code>class Produkt: def __init__(self,pID,pProdNavn,pNetto): self.__produktId = pID #atributt for produkt nummer self.__produktNavn = pProdNavn #atributt for produkt navn self.__produktNetto = pNetto #egenskap for nettopris def getName(self): #Metode for å finne produktnavnet return self.__produktNavn class Bok(Produkt): def __init__(self,pID,pProdNavn,pNetto,pForfatter): Produkt.__init__(self,pID,pProdNavn,pNetto) self.__produktForfatter = pForfatter #atributtp for forfatter def getNet(self): return self.__produktNetto </code></pre> <p>as you see I'm trying to call the _productNetto property that is inherited from my Produkt class.</p> <p>What am I doing wrong?</p> <p>/Andy</p>
python
[7]
2,614,825
2,614,826
change text color in a textbox dynamically in C#
<p>is there any alternative that can be used to change the text color in a textbox dynamically apart from <code>ColorTranslator.FromHtml(#F9DA00)</code>?</p>
c#
[0]
1,342,580
1,342,581
how to get real date (not system date) by c# or c++?
<p>Hi Is it possible to get real date (not system date) without any connection to internet? I developed my application by C#. DateTime.Now gets system date but I want to know real date because system date may be wrong. Is it possible?how to do this? Thanks</p>
c#
[0]
5,642,351
5,642,352
How to make the first character of the word uppercase?
<p>Is there any function in PHP to make the first character of the word uppercase, or should I write it by regular expression? </p>
php
[2]
3,241,693
3,241,694
Can't understand this "Unreachable code detected" error
<p>I have this snippet of code that is giving me problems.</p> <p>The last break statements gives an error of "unreachable code detected"</p> <p>this has caused a logical flaw in my program.</p> <p>can someone identify the problem please?</p> <p>thanks!</p> <pre><code> case 127232: case1 = splited[0]; changeRow[inServer] = "Audit Privileges and Logs:\n"; changeRow[inServer + " Exception"] = "No Exception"; writeToFile(Directory.GetCurrentDirectory() + @"\" + inServer + "127232.txt", case1); if (case1.Contains("audit level;failure") || case1.Contains("audit level;all")) { Console.WriteLine("success!"); changeRow[inServer + "Observations"] = changeRow[inServer + "Observations"] + "1) Audit options found ."; changeRow[inServer] = changeRow[inServer] + "string pattern audit level;failure or auditlevel;all found"; break; } else { //Audit Privileges should have been in enabled for sys and system accounts or the security administrator. changeRow[inServer + "Observations"] = changeRow[inServer + "Observations"] + "1) No audit options found."; changeRow[inServer] = changeRow[inServer] + "Correct audit options not configured!"; changeRow[inServer + " Exception"] = "Exception"; break; } break; </code></pre>
c#
[0]
4,480,611
4,480,612
php technique name
<p>I have database, there are ids of foods, names of the foods, recipes of the foods and ingredients of the foods. </p> <p>I want a PHP code to create pages for the foods in my DB. </p> <p>And I know this is made by a PHP code. </p> <p>But I don't know what programmers call that code or that technique</p> <p>What do you call this?</p>
php
[2]
4,910,070
4,910,071
How can I reference objects with keys that have dots in JavaScript?
<pre><code>var ageRanges; ageRanges = { '18.20': 0, '21.24': 0, '25.34': 0, '35.44': 0, '45.54': 0, '55.64': 0, '65+': 0 }; </code></pre> <p>I want to access <code>ageRanges.'18.20'</code>, but that gives me an error: <code>TypeError: Cannot read property '0' of null</code> - so what's the proper way to access it?</p>
javascript
[3]
4,340,877
4,340,878
How to disable button in UIActionSheet?
<p>I need to disable the buttons in UIActionSheet. after some operations i need to enable them again. So is there a way to do this.</p> <p>Thanks</p>
iphone
[8]
5,500,903
5,500,904
Destructor query
<p>I have this below program, where I am passing a vector by reference to a function <code>myFunc</code> and inside this function, I am adding few elements to the vector.</p> <p>I am not freeing object creating with new, for now ignore the memory leak due to this.</p> <p>After <code>myFunc()</code> execution is complete I am printing the variables ctor and dtor to know how many times constructor and destructor were called.</p> <p>Output is:</p> <pre><code>Before Exiting 5 7 </code></pre> <p>I am creating 5 objects so <code>ctor</code> is <code>5</code>. But why is <code>dtor</code> <code>7</code>? From where do the extra two counts? Am I missing something?</p> <pre><code>#include #include using namespace std; static int ctor = 0; static int dtor = 0; class MyClass { public: MyClass(int n) { i = n; ctor++; // cout &lt;&lt; "Myclass ctor " &lt;&lt; ctor &lt;&lt; endl; } ~MyClass() { dtor++; // cout &lt;&lt; "Myclass dtor" &lt;&lt; dtor &lt;&lt; endl; } private: int i; }; void myFunc(vector&lt;MyClass&gt; &amp;m); void myFunc(vector&lt;MyClass&gt; &amp;m) { MyClass *mc; for(int i = 0; i &lt; 5; i++) { mc = new MyClass(i); m.push_back(*mc); } } int main() { vector&lt;MyClass&gt; m; vector&lt;MyClass&gt;::iterator it; myFunc(m); cout &lt;&lt; "Before Exiting " &lt;&lt; ctor &lt;&lt; " " &lt;&lt; dtor &lt;&lt; endl; } </code></pre>
c++
[6]
4,681,523
4,681,524
The import javax.mail cannot be resolved
<pre><code>import javax.mail.BodyPart; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Multipart; import javax.mail.SendFailedException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; private void sendMail() throws MessagingException{ String host = "smtp.gmail.com"; String password = "abcde12345"; String from = "[email protected]"; String toAddress = email; String filename = Environment.getExternalStorageDirectory() + "/jam.jpg"; Properties properties = System.getProperties(); properties.put("mail.smtp.host", host); properties.put("mail.smtps.auth", true); properties.put("mail.smtp.starttls.enable", true); Session session = Session.getInstance(properties, null); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); message.setRecipients(Message.RecipientType.TO, toAddress); message.setSubject("Anti-Theft Attachment"); BodyPart messageBodyPart = new MimeBodyPart(); messageBodyPart.setText(smsMessageString); Multipart multipart = new MimeMultipart(); multipart.addBodyPart(messageBodyPart); message.setContent(multipart); try{ Transport transport = session.getTransport("smtps"); transport.connect(host, from, password); transport.sendMessage(message, message.getAllRecipients()); System.out.println("Mail Sent Successfully"); transport.close(); } catch (SendFailedException sfe){ System.out.println(sfe); } }; </code></pre> <p>I am developing an application which the application will automatically send out an email to user informing user the current phone status once the phone is stolen or lost. But I faced problem in importing javax.mail "The import javax.mail cannot be resolved". What should I do? Thanks...</p>
android
[4]
5,691,375
5,691,376
Closing Firefox Window or current Tab Using Java Script
<p>How can i close a Firefox Window or current Tab Using Java Script? I tried the following code, but it doesn't work....</p> <pre><code>window.close(); </code></pre> <p>Please anyone help me!!!!</p>
javascript
[3]
2,166,446
2,166,447
Add more effect on div using jQuery
<p>Hello friends i want to add more effects on my div when i click on the <code>&lt;li&gt;</code> my code is working perfect <a href="http://jsfiddle.net/m7mRx/" rel="nofollow">here</a> but i want to add effect like <code>fadeIn()</code> <code>fadeOut()</code> and <code>slideup()</code> and <code>slideDown()</code> </p> <p>Thanks in advance</p>
jquery
[5]
1,341,835
1,341,836
Fill fields on website
<p>I am opening up a web page from a link button.</p> <p>My issue is populating this web page with data that I need to be pre-populated in some of the fields on that web page.</p> <p>Can anyone please assist?</p> <p>Many thanks in advance</p>
asp.net
[9]
2,827,349
2,827,350
Hot to pass Values between views or classes?
<p>i have a view with label when button pressed moves to second view controller with a picker view , i need to retrive the selected value and then to pass to first view's label,</p> <p>i have used delegates and protocols to acheive this,</p> <p>but is there any possible ways like referencing like etc to do this?</p>
iphone
[8]
4,558,722
4,558,723
Replace word with jQuery
<p>I have word Hello on most of my pages and i want to change it to Welcome. Is it possible and if yes how to replace the words with jQuery?</p> <pre><code>Hello &lt;p&gt;Hello user Jack&lt;/p&gt; &lt;div&gt;Hell ow you from us &lt;h1&gt;12344 Hello&lt;/h1&gt; &lt;div&gt;Hellow&lt;/div&gt; &lt;/div&gt; &lt;script src="jquery-1.5.1.min.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre>
jquery
[5]
5,738,895
5,738,896
Foursquare log-in
<p>i am developing an android application for foursquare.I have gone through every api endpoints,experimented with it.I know how to access data using api endpoints and access token.</p> <p>Now what my application requires is a log-in page containing username password.</p> <p>I use the following url for obtaining access token for a user.</p> <pre><code>https://foursquare.com/oauth2/authenticate ?client_id=MY_CLIENT_ID &amp;response_type=token &amp;redirect_uri=MY_REGISTERED_REDIRECT_URI </code></pre> <p>when i post the above url in the browser i am 1st redirected to the foursquare login page then after log-in i am directed to MY_REGISTERED_REDIRECT_URI with the access token appended to it. if i follow this procedure then my log-in page is a waste.</p> <p>Is there any way by which i can append the username and password to above url directly and bypass foursquare log-in page in my application?</p> <p>can any1 help me out with this?</p> <p>I only require a proper log-in page.</p> <p>And 1 more thing i wanted to know is that after user log-in how to get user's foursquare ID from username and password?</p>
android
[4]
377,349
377,350
What does this regexp(rinlinejQuery) mean in jQuery?
<pre><code>var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, html: function( value ) { if ( value === undefined ) { return this[0] &amp;&amp; this[0].nodeType === 1 ? this[0].innerHTML.replace(rinlinejQuery, "") : null; // See if we can take a shortcut and just use innerHTML } </code></pre> <p>Does it match code such as <code>jQuery11="11"</code>?</p> <p>And why is it needed in the <code>html()</code> function?</p>
jquery
[5]
3,007,212
3,007,213
How to stop a timer in android
<p>How to stop the currently executing task of the timer.? If i use timer.cancel() it will cancel the timer but perform the currently executing task..So is there a way around so that i can cancel the currently executing task??</p>
android
[4]
2,685,062
2,685,063
What exactly should be set in PYTHONPATH?
<p>I'm going through and writing a setup doc for other developers at work for a python project and I've been reading up on the <code>PYTHONPATH</code> environment variable. I'm looking at my current development system and think I have a few things set wrong that is causing my IDE (IntelliJ) to behave incorrectly when looking up the python libraries.</p> <p>I've looked at the documentation <a href="http://docs.python.org/using/cmdline.html#envvar-PYTHONPATH" rel="nofollow">here</a> and <a href="http://stackoverflow.com/questions/859594/cant-find-my-pythonpath/859672#859672">here</a> and I'm still unsure of what should actually be in the <code>PYTHONPATH</code> environment variable. </p> <p>I have <code>PYTHONHOME</code> pointed to `C:\Python27'.</p> <p>My current <code>PYTHONPATH</code> is set to <code>PYTHONHOME</code>. Should I also add the directories from <code>sys.path</code>?</p> <p>UPDATE:</p> <p>Based on the below information, <code>PYTHONPATH</code> does not need to be set unless there are non-standard libraries that you want python to be able to find by default. For instance, when I install <a href="http://www.wxpython.org" rel="nofollow">wxPython</a> from the installer it will add its libraries to <code>PYTHONPATH</code>. I do set <code>PYTHONHOME</code> to the root of the python installation so that I can add it to my system <code>PATH</code> environment variable so that I can run python from any where.</p>
python
[7]
1,086,180
1,086,181
issue with ACTION_PICK and what could be used instead?
<p>I have a problem with ACTION_PICK. Code below works well on my Galaxy mini, when i pick photos then it opens my gallery with photos only and when i pick videos then it opens gallery with videos only. However on htc legend first option opens my gallery with both, movies and images and second crash my application coz it's trying to open com.htc.music process. I want to know how can i solve this problem with acion_pick or what could be used instead of this?</p> <p>&lt;</p> <pre><code>code&gt; case ATT_GALLERY_PHOTO : { Intent i = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI ); startActivityForResult(i, ACTIVITY_GALLERY_PHOTO ); break; } case ATT_GALLERY_MOVIE : { Intent movieIntent = new Intent(Intent.ACTION_PICK, MediaStore.Video.Media.EXTERNAL_CONTENT_URI ); startActivityForResult(movieIntent, ACTIVITY_GALLERY_MOVIE ); break; } &lt;/code&gt; </code></pre>
android
[4]
2,723,283
2,723,284
jQuery: find() children until a certain threshold element is encountered
<p>I have a nested table structure like</p> <pre><code> &lt;table&gt; &lt;td id="first"&gt; &lt;div class="wrapper"&gt; &lt;input name=1&gt; &lt;/div&gt; &lt;input name=2&gt; &lt;table&gt; &lt;td id="second"&gt; &lt;input name=3&gt; </code></pre> <p>I have jQuery selection <code>$("#first")</code>. I'd like to traverse and <code>find()</code> all children <code>&lt;input&gt;s</code> within this <code>&lt;td&gt;</code> context, but not to descent into the nested <code>&lt;table&gt;</code>s.</p> <p>So I need a jQuery trick which</p> <ul> <li><p>Will <code>find()</code> all children elements of a certain element</p></li> <li><p>Will descent n levels down in DOM tree</p></li> <li><p>But will stop descending if certain a element (<code>&lt;table&gt;</code>) is encountered, so that the selector doesn't select inputs of a nested tables (which will be handled separately)</p></li> <li><p>There could be any number of nested <code>&lt;table&gt;</code> levels, so the solution should work no matter how many parent <code>&lt;table&gt;</code> or children <code>&lt;table&gt;</code> are encountered within the scope of $("#first") <code>&lt;td&gt;</code> or any other <code>&lt;td&gt;</code></p></li> </ul> <p>I checked other jQuery find until questions. They have answers, but seems like they do not fill the last criteria</p>
jquery
[5]
1,183,878
1,183,879
Page.ParseControl to find HTMLImage
<p>I have a richtext textbox on a webpage that will be used to create email templates. This textbox returns HTML as a string. I need to get the source of all the images from the HTML so that the images can be stored in the database. Once the HTML is returned the images have already been loaded to the server and the new path has been used as the source of the image.</p> <p>I would like to parse the controls, loop through the controls as seen below, find the images save to the database and change the source to a new value.</p> <p>However when the string is parsed, it always returns one literal control unless there is a runat server attribute assigned to the tag. If the run at server is present it correctly identifies the control as an HTMLImage control.</p> <p>Is there away to get the page to parse all the controls regardless of if they are server controls? </p> <pre><code>Dim s As String = "&lt;P&gt;&lt;IMG src=""http://localhost/MessageImages/14699666.jpg""&gt;&lt;/P&gt;" Dim cnts As Control = Page.ParseControl(s) For Each c As Control In cnts.Controls If TypeOf c Is System.Web.UI.HtmlControls.HtmlImage Then Dim src As String = CType(c, HtmlImage).Src 'TODO: Save image to database 'TODO: Change source End If Next </code></pre>
asp.net
[9]
1,794,576
1,794,577
a simple problem about RegExp in Javascript
<p>I have a text:</p> <pre><code> &lt;font class="myclass"&gt;class abc&lt;/font&gt; </code></pre> <p>and i have a pattern: class now, i want to find the word "class" before "abc" but not in the <code>&lt;font class="myclass"&gt;</code> ,how could i do with RegExp in javascript? Thanks! :)</p>
javascript
[3]
6,004,112
6,004,113
Match a href-class with div-class in if-statement
<p>I´d really like some help with this one... I'm building a filterbox for portfolio-items. </p> <p>I have four links each with one classname, the same as their text. All portfolio items are listed besides. Each portfolio item is in a div with two classes — .listItem AND one of the links classes. </p> <p>Example: <code>&lt;a class="Architecture" href="#"&gt;</code></p> <p>The div I want to animate on a-click is: <code>&lt;div class="listItem Architecture"&gt;</code></p> <p>This is my script and it´s not working... </p> <pre><code>$(document).ready(function(){ var filterTrig = $('#sortPort a').attr('class'); $('#sortPort a').click(function() { $('.listItem').each(function(){ if ($(this).is(filterTrig)){ $(this).hide(); } }); return false; }); }); </code></pre>
jquery
[5]
3,138,104
3,138,105
how to implement protocol buffering in android
<p>Currently we have the requirement to implement the protocol buffering for server communication. Can somebody provide me any input if , they have regarding this.</p>
android
[4]
4,834,794
4,834,795
how to access arraylist sent from server in Javascript
<p>I have a requirement of displaying a <code>dropdown</code> list based on the <code>arraylist</code> being sent from the server on certain conditions on load of the page and on change of the event For example <code>ArrayList1</code>,<code>ArrayList2</code></p> <pre><code> if(condition is true) display the contents to dropdownlist from arraylist1 else display the contents to dropdownlist from arraylist 2 </code></pre> <p>Can any one tel how this arraylist can be saved on the page as hidden field so i can access the same in javascript. ??</p>
javascript
[3]
4,431,308
4,431,309
create subdomain programatically in PHP
<p>I am on a shared hosting and on a add on domain.</p> <p>I need to create subdomain for each user of my website like if the username is jeff then he should have a url jeff.mydomain.com.</p> <p>How can i create it programatically using PHP?</p> <p>Thanks Prady</p>
php
[2]
4,665,428
4,665,429
Getting selected text from path in python
<p>My variable has name like this:</p> <pre><code>var1 = '/home/name/file.txt' </code></pre> <p>How to just get name of file in variable?</p> <p>I need my variable like this:</p> <pre><code>var1 = 'file.txt' </code></pre>
python
[7]
1,910,667
1,910,668
Android WebViewClient problem
<p>I've defined a private class that extends WebViewClient and set my WebView's client to an instance of that class (webView01.setWebViewClient(new Callback());).</p> <p>The class definition is as follows:</p> <pre><code>private class Callback extends WebViewClient { public void onLoadResource (WebView view, String url) { } public void onPageStarted (WebView view, String url, Bitmap favicon) { } public void onPageFinished (WebView view, String url) { Animation anim = AnimationUtils.loadAnimation(MyNews.this, R.anim.webviewanim); view.startAnimation(anim); } public void onReceivedError (WebView view, int errorCode, String description, String failingUrl) { } public boolean shouldOverrideUrlLoading (WebView view, String url) { Log.e("loading url", url); return false; } } </code></pre> <p>My problem is that onPageFinished is definitely getting called, but shouldOverrideUrlLoading is never being called.</p> <p>What am I doing wrong here?</p> <p>6/13/2010</p> <p>A little more information. </p> <p>I'm loading the initial page from a string ( webView01.loadDataWithBaseURL("fake://fake", myHTML, "text/html", "UTF-8", null); ).</p> <p>The page loads (and there are several calls to onLoadResource) and onPageFinished is being called at page load completion.</p> <p>When the user taps on an Anchor link in the page, instead of calling shouldOverrideUrlLoading, onLoadResource is called.</p> <p>I need to invoke the full web browser when the user taps on the link, but I never get the chance to override url loading.</p>
android
[4]
2,514,010
2,514,011
Reading Dynamic Content From JavaScript
<p>We have a viewer written in a combination of HTML and JavaScript that displays our own personal content. A need has come up to display a webpage from another domain inside our viewer. Is there any way to do this in a combination of JavaScript and HTML?</p> <p>Thanks</p>
javascript
[3]
5,714,704
5,714,705
Temporarily change a variable's value
<p>In an API implementation I'm currently hacking on, there's the need to repeatedly change some variables temporarily, before doing some task, and change them back after the task is done to whatever they were before. </p> <p>The current code looks like this: </p> <pre><code>var _oldValue = _variable; _variable = tempValue; try { doIt(); } finally { _variable = oldValue; } </code></pre> <p>Doing this a lot is annoying, ugly, hard to maintain, and buries the actual algorithms under a lot of clutter that's just implementation artifacts. </p> <p>In C++, I would make a class which stores the old value somewhere during construction, and restores it in its destructor: </p> <pre><code>{ temp_value tmp(variable_, temp_val); do_it(); } </code></pre> <p>When trying to do something similar in C# <a href="http://stackoverflow.com/questions/5463666/can-i-store-a-reference-to-an-variable-in-an-object/">I failed</a> because apparently <a href="http://stackoverflow.com/questions/2760087/storing-a-reference-to-an-object-in-c/2760111#2760111">C# can't store references to other objects in classes</a>. </p> <p>So what would I have to do in C# to remove that clutter? </p> <p>P.S.: Feel free to add any other tags you see fit. I failed to come up with any. </p>
c#
[0]
5,484,779
5,484,780
How do i reference an array as a whole?- php
<p>array_unique is to be used by passing the array name as a parameter.</p> <p>But as far as all the online examples researched go, it shows the arrays first being assigned to a single variable at the time they are instantiated, like so:</p> <pre><code>$var1 = $array['val1', 'val2', 'val3'] </code></pre> <p>The only problem is, i am assigning the values of my array 1 at a time via a loop, so i dont know how to assign my array as a whole to a variable.</p> <p>So how can i represent the entire array to either put in a variable or pass as a parameter for array_unique directly, without having to reference the specific array values?</p> <p>Edit: Added the loop where array values are instantiated, as requested.</p> <pre><code>$productsQueryResult = mysql_query($productsQuery); while ($row = mysql_fetch_row($productsQueryResult)) { $array[$i] = $row[0]; $i++; } </code></pre>
php
[2]
1,004,258
1,004,259
jQuery numeric backgroundColor animation
<p>I know you need the a jQuery Color Plugin or jQuery UI to animate between colors if you want to use the .animate() method. </p> <p>Would it be possible to use jQuery to animate grey numbers... like #333 to #999 <em>without</em> this plugin?</p> <p>If that sounds possible, would anyone like to venture what it would look like as code? </p>
jquery
[5]
5,095,098
5,095,099
Java - material about Observer pattern
<p>I search a good explanation about Observer pattern and listner objects in Java.</p> <p>I saw what is written in Wikipedia, but I didn't understand a lot.</p> <p>Thank you.</p>
java
[1]
3,778,123
3,778,124
Why ofstream would fail to open the file in C++? Reasons?
<p>I am trying to open an output file which I am sure has a unique name but it fails once in a while. I could not find any information for what reasons the ofstream constructor would fail.</p> <p><strong>EDIT:</strong> It starts failing at some point of time and after that it continuously fails until I stop the running program which write this file.</p> <p><strong>EDIT:</strong> once in a while = 22-24 hours </p> <p>code snippet ( I don't this would help but still someone asked for it )</p> <pre><code>ofstream theFile( sLocalFile.c_str(), ios::binary | ios::out ); if ( theFile.fail() ) { std::string sErr = " failed to open "; sErr += sLocalFile; log_message( sErr ); return FILE_OPEN_FAILED; } </code></pre>
c++
[6]
3,448,392
3,448,393
Raphael map won't resize
<p>Hi I'm trying to resize the map created by raphael I ended up loading the SVG file coordinates and then running this function to create the map with the new region selected but I can't seem to get it to resize. <a href="http://pastie.org/4319180" rel="nofollow">http://pastie.org/4319180</a></p>
jquery
[5]
4,478,468
4,478,469
Can't load my app on the Samsung galaxy prevail and I try settings and unkonw source
<p>Can't load the app i made on the Samsung galaxy prevail and I try goning to settings and unkonw source but it still not showing up on the avd manager in eclispe and i was try development USB debugging but that just have it chage the battey. it work on one of my friends evo</p> <p>thank you</p>
android
[4]
4,756,841
4,756,842
JQuery beginner: :has for direct descendants only
<p>Assuming a tree structure like the following: (Ugly legacy layout, sorry)</p> <pre><code>&lt;tr&gt; (1) dont want to select this one &lt;td&gt; &lt;table&gt; &lt;tr&gt; (2) not a "special" td, dont select &lt;td.normal&gt; &lt;tr&gt; (3) this is what I want to select &lt;td.special&gt; &lt;tr&gt; &lt;td.normal&gt; </code></pre> <p>I want to select the tr which has a td with class special as direct descendant, i.e. only (2), not (3) [its td is not special], and also not (1) [special td is not a direct descendant but a "grandkid"]</p> <p>I tried </p> <pre><code>$("tr:has(td.special)"); </code></pre> <p>but that gives me (1) and (2), because :has means "has somewhere among all my descendants".</p> <p>What I need is something like :has, but meaning "has among my direct children".</p> <p>Alternatively, a way to transverse upwards, like "select only the parent of the currently selected element".</p> <p>Sorry for the simple question, but I can't seem to find it anywhere in the API docs.</p>
jquery
[5]
996,578
996,579
using variable extracted from selector
<p>I am trying to use list elements to toggle between corresponding panels, I also want to do this using variables, just so I can orient myself with their use better. Here is my html and code below. I am tring to extract the i from the the "icon" id clicked, and use that i to open a corresponding "panel" id, with the attached i afterward. Any help would be appreciated! thanks!</p> <p>html</p> <pre><code>&lt;div id="icon0" class="icon"&gt; &lt;a href=""&gt;&lt;img src="Images/film_icon.png"/&gt;&lt;/a&gt; &lt;/div&gt; &lt;div id="icon1" class="icon"&gt; &lt;a href=""&gt;&lt;img src="Images/film_icon.png"/&gt;&lt;/a&gt; &lt;/div&gt; &lt;div id="icon2" class="icon"&gt; &lt;a href=""&gt;&lt;img src="Images/film_icon.png"/&gt;&lt;/a&gt; &lt;/div&gt; &lt;div id="icon3" class="icon"&gt; &lt;a href=""&gt;&lt;img src="Images/film_icon.png"/&gt;&lt;/a&gt; &lt;/div&gt; </code></pre> <p>html panels:</p> <pre><code>&lt;div id="panel0" class="panel"&gt;0000&lt;/div&gt; &lt;div id="panel1" class="panel"&gt;1111&lt;/div&gt; &lt;div id="panel2" class="panel"&gt;2222&lt;/div&gt; &lt;div id="panel3" class="panel"&gt;3333&lt;/div&gt; </code></pre> <p>Jquery</p> <pre><code>for(var i=0; i&lt;4; i++){ $('#icon'+i).click( function() { $('#panel'+i).fadeOut(400); return false; </code></pre>
jquery
[5]
4,609,530
4,609,531
Selecting href element within a DIV using JQuery
<p>Within JQuery, to select all elements with a href attribute I would use:</p> <pre><code>$("[href]") </code></pre> <p>How would I select all elements with a href attribute within a specific DIV?</p> <p>Many thanks</p>
jquery
[5]
1,223,977
1,223,978
android custom application icon
<p>is it possible to make large/custom size icon on the desktop for android? </p>
android
[4]
370,003
370,004
how to declare an array globally
<p>hi i am new to iphone. what i am doing is declaring a NSMutable array named as labels, and that is declared in viewdidload.But when i access the label in buttonclick function it shows null. Previously i declred propery in .h file and initialize in init function also. please help where can i declare and how to declare a mutable array that is accesble any where in the class and how to add objects to it,that to the values are changeble dynamically. thanku </p>
iphone
[8]
2,389,980
2,389,981
format number in C#
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/105770/net-string-format-to-add-commas-in-thousands-place-for-a-number">.NET String.Format() to add commas in thousands place for a number</a> </p> </blockquote> <p>How to format a number 1234567 into 1,234,567 in C#?</p>
c#
[0]
720,481
720,482
how can we tell the host that we are requesting a webpage from android device
<p>Actually I'm using HttpClient() and HttpPost() methods for downloading the html source here is the code for downloading:</p> <pre><code>HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(_url); try { // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); responseBody = EntityUtils.toString(response.getEntity()); } </code></pre> <p>If I execute the above code some sites like www.google.com (which will give user agent specific code (HTML code)), not giving whole information suitable for android. So I can tell the host that I'm requesting webpage from android device.</p>
android
[4]
1,549,933
1,549,934
What should I study to be able to join a C++ open source project?
<p>I am learning C/C++/Oracle/Unix.</p> <p>I am thinking of developing some application on my own, but I have no Idea what else is required.</p> <p>If you take an example of C++. I have very basic knowledge of it (data types, OOP concepts, vectors, file handling, exception handling, etc). I am not an expert though. I have just read one book about C++ and don't know much about graphics in C++.</p> <p>I went to codeplex.com (an open source website for programming and development) they had <a href="http://www.codeplex.com/site/search/openings?query=&amp;sortBy=OpeningPostedDate&amp;tagName=,c%2b%2b,&amp;licenses=%7C&amp;refinedSearch=true">some projects</a> in C++ that are looking for developers.</p> <p>Now this looks way beyond my knowledge but I want to buld something. If not, I want to learn more to do it but I have no clue where to begin and what material topics, books to read.</p> <p>There so many things involved with an application: .exe files, .dll files and many more</p> <p>1) Am I thinking in the right direction?</p> <p>2) Is it possible to do it alone or be a part of such big open source projects online? What are the things that I need to collect online and study?</p> <p>Please help, if possible please provide the topics, books, websites that might help me to study and proceed to achieve my goal.</p>
c++
[6]
2,203,305
2,203,306
How to store a string with delimiters in an array in PHP
<p>I have a string like this:</p> <pre><code>$string = '"Joe Bob" "John Doe" "Amber Page" "Jordan Tole"'; </code></pre> <p>I want to store it in an array with each item in between the " " being an element inside of the array.</p> <p>e.g.</p> <pre><code>$Array = StringToArray($string); </code></pre>
php
[2]
4,059,210
4,059,211
Memory Management in Objective-C when dealing with NSMutableArray
<p>In Instruments the tempPlayer object is showing a leak. In this code, in every for loop I keep on allocating a new tempPlayer instance, set its playerCode variable with a string and add it to an NSMutableArray in each iteration. Instruments shows me a leak in the alloc statement. Is there any way to prevent tat leak in the tempPlayer object ?</p> <pre><code> for(int i = 0 ; i &lt; [homeLineupArray count] ; i++) { NSArray * tildeSeperator = [[homeLineupArray objectAtIndex:i] componentsSeparatedByString:@"~"]; [self.tempPlayer release]; self.tempPlayer = [[LineUpsPlayer alloc] init]; tempPlayer.playerCode = [tildeSeperator objectAtIndex:0]; [matchLineUp.homeTeamPlayingEleven addObject:tempPlayer ]; } </code></pre> <p>Thanks Harikant Jammi</p>
iphone
[8]
829,882
829,883
How to call a outside method in AlertDialog?
<p>I have a method use to connect HttpGet in AppTools.java:</p> <pre><code>public class AppTools extends Activity { public void connectToServerWithURL(String URL) throws ClientProtocolException, IOException, JSONException { /* Start connect */ new Thread() { client = new DefaultHttpClient(); request = new HttpGet(URL); response = client.execute(request); reader = new BufferedReader(new InputStreamReader(response.getEntity() .getContent())); builder = new StringBuilder(); for (String s = reader.readLine(); s != null; s = reader.readLine()) { builder.append(s); } if (builder != null) { /* Transfer to JSONArray */ jsonTransfer = new JSONObject(builder.toString()); systemConfigJSONArray = jsonTransfer.getJSONArray(config); runOnUiThread(performResult); } }.start(); } private Runnable performResult = new Runnable() { public void run() { closeProgressDialog(); performResult(systemConfigJSONArray); } }; /** Connect complete, interface for Override **/ public void performResult(JSONArray resultArray) { } </code></pre> <p>And, in another Activity is extends AppTools:</p> <pre><code>public class A extends AppTools { </code></pre> <p>in Activity A has a AlertDialog use to select url to connect :</p> <pre><code>new AlertDialog.Builder(this).setView(aLayout) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { /* Set command */ if (spinner_options.getSelectedItemPosition() == 0) { connectToServerWithURL("http://..."); } else if (spinner_options .getSelectedItemPosition() == 1) { connectToServerWithURL("http://..."); } } }).setNegativeButton("Cancel", null).show(); </code></pre> <p>the aLayout in <code>.setView(aLayout)</code> has a Spinner, so the onClick interface of setPositiveButton</p> <p>will get the selected position of spinner and do the method</p> <p>but the code can't work, LogCat shows AlertController$ButtonHandler error</p> <p>What is the problem?</p>
android
[4]
197,140
197,141
Generic binary search Java
<p>I've been trying to make this code work. I have to create a generic binary version of the binary search. I'm not sure how to compare two generic types without the comparable interface</p> <pre><code>import java.util.ArrayList; public class BinarySearcher&lt;T&gt; { private T[] a; public BinarySearcher(T[] words) { a = words; } public int search(T v) { int low = 0; int high = a.length - 1; while (low &lt;= high) { int mid = (low + high) / 2; T midVal = a[mid]; if (v.compareTo(midVal) &lt; 0) { low = mid - 1; } else if (v.compareTo(midVal) &gt; 0) { high = mid + 1; } } return -1; } public int compareTo(T a) { return this.value.compare - b; } } </code></pre> <p>This is the tester class:</p> <pre><code>import java.util.Arrays; import java.util.Scanner; /** This program tests the binary search algorithm. */ public class BinarySearchTester { public static void main(String[] args) { String[] words = {"Alpha", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot", "Golf", "Hotel", "India", "Juliet", "Kilo", "Lima", "Mike", "November", "Oscar", "Papa", "Quebec", "Romeo", "Sierra", "Tango", "Uniform", "Victor", "Whiskey", "X-Ray", "Yankee", "Zulu"}; BinarySearcher&lt;String&gt; searcher = new BinarySearcher&lt;String&gt;(words); System.out.println(searcher.search("November")); System.out.println("Expected: 13"); System.out.println(searcher.search("October")); System.out.println("Expected: -1"); } } </code></pre>
java
[1]
2,517,413
2,517,414
Android. How to operate by history stack?
<p>Questions 1. How to make the same functionality as physical button "Back" on android phone? 2. Is it possible to make "Next" button using android history stack? I understand that probably it is not possible, but may be yes. So please let me know exactly</p>
android
[4]
2,708,421
2,708,422
Call object property with variable
<p>This code doesn't work quite as i want to. </p> <pre><code>var csd = {large10x10: 0} var nextitem = "large10x10"; buildings.push(nextitem,"black",a); csd.nextitem += 1; </code></pre> <p>at <code>csd.nextitem +=1</code> I want it to add 1 to csd.large10x10. How do I do that? Or what do I google to find the answer?</p> <p>Thanks</p>
javascript
[3]
482,402
482,403
check if mouseover is fired?
<p>in Javascript: Is there a way of checking if a mouseover event for some element has fired?</p> <p>If yes, how?</p> <p>T</p>
javascript
[3]
5,374,726
5,374,727
Jquery, Given a string and its coordinates replace it
<p>I have a string like that:</p> <blockquote> <p>I'm a string not too long but neither so short</p> </blockquote> <p>Let's take the word 'not' inside the string: it starts at position number 13 and it ends at position numer 16.</p> <p>There's a way with JQuery to substitute the word between position 13 and position 16 with this:</p> <pre><code>&lt;b&gt;not&lt;/b&gt; </code></pre> <p>I know only the position of the string that i want to replace not it's content.</p>
jquery
[5]
2,873,627
2,873,628
context of self
<p>When I see a 'self' automatically to think of static methods. Lately I have been pointed out that self depends on the context. Just like 'parent', which can also call static methods. Consider this example:</p> <pre><code>error_reporting(-1); class A { public $var = 1; public function __construct($n) { $this-&gt;var = $n; self::foo(); } public function foo() { echo $this-&gt;var; } } $obj = new A(5); </code></pre> <p>Operate without errors and within the method foo $ this is available. Someone can tell me some guide that explains in detail how the calls are resolved by self and parent?</p>
php
[2]
5,282,710
5,282,711
Avoiding BinaryReader.ReadString() in C#?
<p>Good morning,</p> <p>At the startup of the application I am writing I need to read about 1,600,000 entries from a file to a <code>Dictionary&lt;Tuple&lt;String, String&gt;, Int32&gt;</code>. It is taking about 4-5 seconds to build the whole structure using a BinaryReader (using a FileReader takes about the same time). I profiled the code and found that the function doing the most work in this process is <code>BinaryReader.ReadString()</code>. Although this process needs to be run only once and at startup, I would like to make it as quick as possible. Is there any way I can avoid <code>BinaryReader.ReadString()</code> and make this process faster?</p> <p>Thank you very much.</p>
c#
[0]
5,285,774
5,285,775
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/u231382487/public_html/templates/sleek_silver/index.php on line 74
<p>this is line 74 </p> <pre><code>$thumbnailUrl = $entry-&gt;medx-MoBiLeroup-&gt;thumbnail[0]-&gt;url; </code></pre> <p>why do i keep getting this error ?</p>
php
[2]
1,384,580
1,384,581
Images taken from camera roll take long time to display in ImageView android sdk
<p>Images taken from camera roll take long time to display in ImageView android sdk</p> <p>i am taking photo from camera and once back to my activity take long time to be displayed any one know how can i decrease this time </p>
android
[4]
3,994,990
3,994,991
Can anyone help me understand why this Jquery works in Chrome but not in IE?
<p>i've just spent the last 4 hours working on this piece of code and was so happy to finally get it working, but it wont work in IE! I can't undersand why?</p> <p>Here is the code on jsfiddle: <a href="http://jsfiddle.net/hQkFH/8/" rel="nofollow">http://jsfiddle.net/hQkFH/8/</a></p> <p>Thank you!!</p>
jquery
[5]
1,343,595
1,343,596
Array sort keys numerically help
<pre><code>$test1[2] = "one"; $test2[1] = "two"; $test2[3] = "three"; $test = $test1 + $test2; print_r($test); </code></pre> <p>I've used the array union operator but when i print the array it is in the wrong order.</p> <pre><code>Array ( [2] =&gt; one [1] =&gt; two [3] =&gt; three ) </code></pre> <p>How do i sort the keys numerically in the array?; so i get the below result.</p> <pre><code>Array ( [1] =&gt; two [2] =&gt; one [3] =&gt; three ) </code></pre>
php
[2]
940,727
940,728
Java convert string to number, floating point only when needed?
<p>I want to conver a string to number in Java. I already tried with two methods but both work bad with integers, adding an unneeded floating point: "1" > 1.0 (when I want "1" > 1 and "1.5" > 1.5). I found a couple more ways to convert strings to numbers but they either don't work or are many lines long, I cannot believe it's so complicated coming from javascript where I only need parseFloat().</p> <p>This is what I'm trying now:</p> <pre><code>String numString = "1".trim().replaceAll(",",""); float num = (Float.valueOf(numString)).floatValue(); // First try Double num2 = Double.parseDouble(numString); // Second try System.out.println(num + " - " + num2); // returns 1.0 - 1.0 </code></pre> <p>How can I have the floating point only when needed?</p>
java
[1]
520,928
520,929
Operation with fuzzy numbers using alpha cut
<p>I am interested in implementing the triungular function of a fuzzy number <code>f(x)=(x-a)/(b-a)</code> when <code>a&lt;=x&lt;=b</code>, and <code>(c-x)(c-b)</code> when <code>b&lt;=x&lt;=c</code>. </p> <p><code>[a,b,c]</code> is defined as a triplet and represents the coordonates of a triangle where <code>b</code> is the center.</p> <p>More exactly I want a graphical representation in c# with drawline(if possible).</p> <p>The problem is i tried to do it but i didn't succeed because the values of the function are in the interval[0,1].</p> <p>In the coordinates have to be big for the figure to show.</p> <p>I also tried to multiply the value to 100 but then it doesn't draw a triangle.</p> <p>The final task is to make all the operations with fuzzy numers using alpha cut and their graphical representation.</p>
c#
[0]
2,657,656
2,657,657
checking if a number is divisible by 6 PHP
<p>I want to check if a number is divisible by 6 and if not i need to increase it until it becomes divisible.</p> <p>how can i do that ?</p> <p>Thanks</p>
php
[2]
2,350,438
2,350,439
anybody working or heard of qcubed/qcodo mvc frameworks?
<p>I have been using qcodo/qcubed for developing CMS based sites. I had been successful in developing and maintaining fairly complex sites using these frameworks.</p> <p>Things get done so quick and easy using qcubed that i never felt the need to look for another framework like zend, symfony ....</p> <p>I am wondering if you guys have tried or have been using them.</p> <p>I have not tried zend, symfony, kohana or other frameworks of discusson on reddit.</p> <p>What is your opinion, is qcubed as good as these frameworks? If not can you please suggest some of the features that you find useful in other frameworks and are missing from qcubed.</p> <p>thanks</p>
php
[2]
4,315,851
4,315,852
Get tags in PHP
<p>How do I get this in PHP, I want put it in a variable? </p> <p>Example: </p> <pre><code>$variable = "debe ser detenido y los libios decidirán dónde juzgarle"; </code></pre> <p><img src="http://i.stack.imgur.com/hrMcT.png" alt="enter image description here"></p> <p><a href="http://i54.tinypic.com/n63ioz.png" rel="nofollow">http://i54.tinypic.com/n63ioz.png</a></p> <p>Thanks in advance!</p>
php
[2]
282,501
282,502
How to show dialog to send email AND call phone number in Android?
<p>I am wondering if there is a way to have a "contact" button in Android and when the button is pressed a menu pops up giving you the possibility:</p> <ul> <li>to send an email (showing all available email accounts, send-to is a predefined email address</li> <li>or to call a predefined phone number</li> </ul> <p>This should everything be in the same menu, so similar to this but also with the option to place a call:</p> <p><a href="http://mobile.tutsplus.com/tutorials/android/android-email-intent/" rel="nofollow">http://mobile.tutsplus.com/tutorials/android/android-email-intent/</a> (sorry, as a new user I cannot post images yet...)</p> <p>Is there a pre-defined function to do this or do I have to code the whole menu from scratch?</p> <p>Thanks for your help,</p> <p>Reto</p>
android
[4]
942,147
942,148
Error generic array creation
<pre><code>public class TwoBridge implements Piece{ private HashSet&lt;Hexagon&gt;[] permutations; public TwoBridge(){ permutations = new HashSet&lt;Hexagon&gt;[6]; </code></pre> <p>Hi, I'm trying to create an array of Sets of hexagons (hexagons being a class i created).</p> <p>However I get this error when I try to compile </p> <pre><code>oliver@oliver-desktop:~/uni/16/partB$ javac oadams_atroche/TwoBridge.java oadams_atroche/TwoBridge.java:10: generic array creation permutations = new HashSet&lt;Hexagon&gt;[6]; ^ 1 error </code></pre> <p>How can I resolve this?</p>
java
[1]
3,137,624
3,137,625
array, I/O file and standard deviation (c++)
<pre><code> double s_deviation(double data[],int cnt, double mean) { int i; double sum= 0; double sdeviation; double x; //x = mean(billy,a_size); for(i=0; i&lt;cnt; i++) { sum += ((data[i]) - (mean)); } sdeviation = sqrt(sum/((double)cnt)); return sdeviation; } </code></pre> <p>When I cout the result from this function, it gave me NaN. I tested the value of (mean) and data[i] using return data[i] and return mean they are valid. </p> <p>when i replaced mean with an actual number, the operation returned a finite number. but with mean as a variable, it produced NaH. I can't see anything wrong with my code at the moment.</p> <p>Again, I am sure mean, data are getting the right number based on those tests.</p> <p>Thank you</p>
c++
[6]