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
4,254,475
4,254,476
Manually creating a javascript event object
<p>Say I have the following code:</p> <pre><code>$('#someid').click(function(event) { myFunction(event); }); function myFunction(event) { // do something with event } </code></pre> <p>And I would like to test <code>myFunction()</code> with an eval statement, without doing something like using <code>eval('$("#someid").click()')</code>;</p> <p>Is there a way to manually create an event object in javascript that would work with an eval statement?</p> <p>Also if myFunction is only used as an event handler, can it always assume <code>event</code> is not null?</p>
javascript
[3]
386,695
386,696
Calling this->get/this->set methods versus directly accesing member variables in C++
<p>Suppose I have a class <code>Foo</code>, with a private variable <code>bar_</code> containing some state for <code>Foo</code>. If necessary, I may write public get/set methods for <code>bar_</code>. Naturally, I avoid this as much as possible to maintain encapsulation.</p> <p>Assuming I have these get/set methods, whenever I have to access or modify <code>bar_</code> within a method belonging to <code>Foo</code>, I usually do it directly to <code>bar_</code>, instead of using the get/set methods, which I use for accessing <code>bar_</code> from outside the class. I have no justification other than concerns regarding the speed of directly accessing the variable versus calling the methods, but I suspect that if the get/set methods are defined inline (which they are) it shouldn't make a difference. Does it make a difference? Does <code>const</code>ness play a role in this?</p> <p>So far I haven't had any problems with this, but I have a lingering feeling I am Doing It Wrong. Are there any compelling arguments for not doing it? Any guidelines regarding this?</p>
c++
[6]
4,476,093
4,476,094
Return value on condition failing in PHP
<p>I need a return false if the query fails... where do i put it... </p> <pre><code>function asas($username,$password){ $qry = "SELECT * FROM members WHERE login='$username' AND passwd='".md5($password)."'"; $result = mysql_query($qry); while($row = mysql_fetch_array($result)) { return(array($row['userlevel'], $row['email'])); } //return 'Invalid username / password '; } </code></pre>
php
[2]
4,746,438
4,746,439
Inline functions vs Preprocessor macros
<p>How does an inline function differ from a preprocessor macro?</p>
c++
[6]
3,774,817
3,774,818
play more than one video from one activity in android
<p>How to play more than one video from one activity in my android application? I have the following code:</p> <pre><code>VideoView vd = (VideoView) findViewById(R.id.surface_view); String movieurl = Environment.getExternalStorageDirectory() + "/content1/bio_brain.mp4"; mc = new MediaController(this); vd.setMediaController(mc); vd.setVideoPath(movieurl); vd.start(); </code></pre>
android
[4]
1,556,276
1,556,277
How the .aspx page will contain the user control .ascx page?
<p>i have to create a “aspx” page called “ViewMessageDetail.aspx” which will contain user control “ucViewMessageDetail.ascx”. Since it will be display as lyte box popup. How can i do that??</p>
asp.net
[9]
3,245,868
3,245,869
need to repeat function
<p>I need your help. I am a noobie and need some help with getting the animation to cycle back to the first function once it finishes.</p> <p>Here is the code:</p> <pre><code>function phase1() { $('#main .home_intro.phase1 h2').eq(0).delay(1000).fadeTo(500,1); $('#main .home_intro.phase1 h2').eq(1).delay(2000).fadeTo(500,1); $('#main .home_intro.phase1 h2').eq(2).delay(3000).fadeTo(500,1); $('#main .home_intro.phase1 h2').eq(3).delay(4000).fadeTo(500,1); $('#main .home_intro.phase1 h2').eq(4).delay(5000).fadeTo(500,1); $('#main .home_intro.phase1').delay(6000).fadeTo(500,0, phase2); }; function phase2() { $('#main .home_intro.phase2 h2').delay(1000).fadeTo(500,1); $('#main .home_intro.phase2').delay(4000).fadeTo(500,0,phase3); }; function phase3() { $('#main .home_intro.phase3 h2').delay(1000).fadeTo(500,1); $('#main .home_intro.phase3').delay(4000).fadeTo(500,0,phase1); }; phase1(); </code></pre> <p>});</p>
jquery
[5]
4,273,891
4,273,892
Why Python for web development?
<p>I'm wondering if learning this language or not.</p> <p>I've been 15 years mainly coding with PHP. I know C, C++, Java, Perl … but PHP has solved all of my problems for web development.</p> <p>I've read carefully this: <a href="http://wiki.python.org/moin/PythonVsPhp" rel="nofollow">http://wiki.python.org/moin/PythonVsPhp</a></p> <p>I find Python useful for sysadmin tasks for example, or for first programming language learning. Sincerely, I love its cleanliness and clarity (it's like a "Jquerized PHP") … but I'm still finding blogs defending Python for web development … Why ? </p> <p>Can anyone explain me advantages of Python for web ?</p>
python
[7]
400,093
400,094
How to access a downloaded internal-file icon and use as a drawable e.g. in setIcon(drawable)
<p>I download a png icon and store it on the internal file system. How can I use this icon in a similar manner to a drawable in res/drawable. I can read it and pulls its ears, but how to use it in a setIcon() method? Does an internal file have a resource id? (wishful thinking).</p> <p>I notice someone suggest saving to res/raw, but you cant write to application folders anyway.</p> <p>I've been using: *openFileOutput(filename, Context.MODE_PRIVATE);* But maybe I need to create a File object and do the usual Java stuff. Even so, how to grab it as a drawable in my code?</p> <p>Thanks.</p>
android
[4]
4,804,723
4,804,724
PHP echo directory contents (as links) not working
<p>I have a php file called download.php which I link to pdf files in a directory. This allows them to appear as links but open 'save as' instead of trying to open in a web page. Trouble is that I can't get the following code to work. It repeats the directory items, with the download.php appended, but I think my php semantics might be slightly wrong! Anyone got any ideas? Perhaps not enough info here to work out, but worth a try: This is the code that sits on the page presenting the various pdf files (ordered by dateLastModified):</p> <pre><code>&lt;?php // *** Folder List Repeater Start while ($MeetingMinutes-&gt;canRepeat()) { ?&gt; &lt;?php echo '&lt;p&gt;&lt;a href=\"http://www.duncton.org/download.php?file=login/uploads2/'.$MeetingMinutes-&gt;folderList('name').'&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;'; ?&gt; &lt;?php $MeetingMinutes-&gt;MoveNext(); } $MeetingMinutes-&gt;endRepeater(); // *** Folder List Repeater End ?&gt; </code></pre>
php
[2]
2,505,498
2,505,499
Which PHP framework is easier to start
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4551162/easy-to-use-learn-php-framework">Easy to use/learn PHP framework?</a> </p> </blockquote> <p>Do most of professional programmers recommend using PHP frameworks? Which framework is relately easier to begin with? Thanks.</p>
php
[2]
2,421,632
2,421,633
Hexa Decimal conversion
<p>How to convert integer into hexadecimal value programmatically in iphone</p> <p>Can anyone help me? Thanks in advance</p>
iphone
[8]
2,554,257
2,554,258
File exists php code
<pre><code>&lt;?php function data_info($data) { if ($data) { while (!feof($data)) { $buffer = fgets($data); if (file_exists($buffer)) { $bufferArray[$buffer]['Exists'] = (file_exists($buffer)); $bufferArray[$buffer]['Readable'] = (is_readable($buffer)); $bufferArray[$buffer]['Writable'] = (is_writable($buffer)); $bufferArray[$buffer]['Size'] = (filesize($buffer)); } else { $bufferArray[$buffer]['Exists'] = "No"; } } print_r($bufferArray); } else { echo "The file could not be opened"; } } $data = fopen("D:/xampp/htdocs/Practice/ficheros.txt", "r"); data_info($data); ?&gt; </code></pre> <p>If I have this: ficheros.txt: ExistingFile.txt ExistingFile2.txt ExistingFile3.txt... ... It works, but If I have at least 1 NON EXISTING FILE then It will take every file as a non existing one too.</p> <p>What's wrong? I believe someting in the inner if condition.</p> <hr> <p>I mean, what is wrong with the entire code.</p> <p>I just need to make an array with arrays in it, a good result would be:</p> <pre><code> array ( 'text.txt' =&gt; array ( 'exists' =&gt; true, 'readable' =&gt; true, 'writable' =&gt; true, 'Size' =&gt; 64 ), 'document.doc' =&gt; array ( 'exists' =&gt; false ), 'photo.jpg' =&gt; array ( 'exists' =&gt; true, 'readable' =&gt; true, 'writable' =&gt; false, 'size' =&gt; 354915 ) ) </code></pre>
php
[2]
5,044,608
5,044,609
My php variables are not being printed out.
<pre><code> &lt;?php if ( is_user_logged_in() ) { echo '&lt;a href="/community"&gt;&lt;img id="visit-the-forums" src="&lt;?php bloginfo('template_url') ?&gt;/images/visit-the-forums.png" alt="Check out the Forums!" /&gt;&lt;/a&gt;' } else { echo '&lt;a href="/community"&gt;&lt;img id="join-the-forums" src="&lt;?php bloginfo('template_url') ?&gt;/images/join-the-forums.png" alt="Join the Forums!" /&gt;&lt;/a&gt;' } ?&gt; </code></pre> <p>I think there is something wrong w/ the way I set up the "php bloginfo" code inside but I'm not sure how to fix it.</p>
php
[2]
2,975,266
2,975,267
Contigency table
<p>I am struggling to find the Java code for this problem. Firstly, I am in a beginner level and this question were hard for me to answer. I know that this used a 2D array right? But I having problem to write the Java code for this question. </p> <p>Here is the question:</p> <blockquote> <p>Write a Java program that</p> <ol> <li>queries a user for the number of rows and columns of a contingency table,</li> <li>read the data, row by row and</li> <li>displays the data in tabular form along with the row totals, column totals and grand total.</li> </ol> <p>For example if the six data of 2x3 table are</p> <p>1,3,6,7,9, and 8. the program displays these six numbers together with the appropriate totals as</p> <pre><code>1 3 6 | 10 7 9 8 | 24 8 12 14 | 34 </code></pre> <p>The character '|' is used to separate the data from the row totals</p> </blockquote>
java
[1]
2,927,298
2,927,299
EnableViewstate = true/false
<p>We have enableviewstate property for all the server controls in ASP.net. We know that its going to have the member datas and values in viewstate across postbacks</p> <p>What is the actual example for this?</p>
asp.net
[9]
5,386,861
5,386,862
Light theme for AlertDialog?
<p>I'm creating an AlertDialog. I'm using setView() to set a custom view. This enables the 'dark' theme on the dialog (grey background, and need white text).</p> <p>Is there a way to set the dialog to use the 'light' theme? It looks nicer (white background, dark text).</p> <p>Thanks</p>
android
[4]
3,710,353
3,710,354
Converting values using a text file
<p>I'm trying to write a console application in C# which allows a user to enter the following information in the format x,pound,ounce where X is the value to be converted.</p> <p>I've created a text file which contains the conversion factors in the following format.</p> <p>pound,ounce,16.0</p> <p>What I want the application to do is to grab the user input and then find the correct conversion factor within the text file and then calculate the result.</p> <p>I've tried using a Node class to cycle through the list of conversion factors but it doesn't seem to work =(</p> <p>Can you help?</p>
c#
[0]
1,087,670
1,087,671
How to run video in android?
<pre><code>VideoView videoView = (VideoView) findViewById(R.id.butterfly); videoView.setVideoPath("res/raw/butterfly"); videoView.setMediaController(new MediaController(this)); videoView.requestFocus(); videoView.start(); MediaPlayer mp = MediaPlayer.create(this,R.raw.butterfly); mp.start(); </code></pre> <blockquote> <p>In my application I need to run multiple video, I used this code and it does not work, when I run it the emulator couldn't show the selected video. </p> </blockquote>
android
[4]
5,518,726
5,518,727
how to set value to incremental variable name?
<p>HI i got 4 flash clocks, that show the different city times, and i am getting the different 4 city times from my php file. after i get new time and minute and second for a city it sending me the information to a function like this :</p> <pre><code> setFlashvar (hours,minutes,seconds); </code></pre> <p>so my function will called 4 times. now i need to send that 4 different parameter to my flash clocks like this :</p> <pre><code>flashvars1 = {thisH:myH,thisM:myM,thisS:myS}; flashvars2 = {thisH:myH + 2,thisM:myM + 2,thisS:myS + 2}; flashvars3 = {thisH:myH + 4,thisM:myM + 4,thisS:myS + 4}; flashvars4 = {thisH:myH + 4,thisM:myM + 4,thisS:myS + 4}; </code></pre> <p>what is the best way to set this all variables with different times what i am getting from function?</p> <p>thanks in advance.</p>
javascript
[3]
1,936,519
1,936,520
jquery ajax post with & symbol
<p>I am using jHTMLArea and I allow the user to type any character. I am also passing the values to a PHP page for processing but I have found that I cannot send the &amp; symbol.</p> <p>Is there a jQuery encode function? I am serializing the string but I think the PHP page is reading the &amp; as a new parameter.</p> <p>Any suggestions?</p>
jquery
[5]
1,914,600
1,914,601
MinMaxHeap in Java
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1098277/java-implementation-for-min-max-heap">Java implementation for Min-Max Heap?</a> </p> </blockquote> <p>Is there a api or some sort of collection in Java for MinMaxHeap? I searched but couldn't find any. It would be helpful if there is an inbuilt implementation in java.</p> <p>Thanks</p>
java
[1]
2,222,472
2,222,473
How i can control whether a char[] is null?
<p>I wrote this code to control whether a char[] is null or not.</p> <pre><code>char[] xxx = new char[9]; for (int i = 0; i &lt; 9; ++i) { if (xxx[i]==null) { xxx[i]=i; } } </code></pre>
java
[1]
3,407,231
3,407,232
'System.OutOfMemoryException' while writing 400.000 records to file
<p>I really REALLY hope that someone could help me.</p> <p>I have to pass almost 400.000 records from a database to a textfile Because of this amount the extension of the textfile is just something I made up ...(.you_name_it) I get an error while writing the data to the file at +/- 9000 records. The error = Exception of type 'System.OutOfMemoryException' was thrown And I don't know the solution :(</p> <p>This is the peace of code I use for writing the records to the file.</p> <pre><code> this.path_to_file = ConfigurationManager.AppSettings["ExportDir"] + DateTime.Now.ToString(ConfigurationManager.AppSettings ["Export_FileName"]) + ConfigurationManager.AppSettings ["Export_Extension"]; FileStream fm = new FileStream (this.path_to_file, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite); StreamWriter sw = new StreamWriter(fm, Encoding.Default); List&lt;Export&gt; exportRecords = null; exportRecords = ExportList(); try { int i = 0; foreach (Export ex in exportRecords) { sw.Write(ex.ExportLine()); sw.Write(sw.NewLine); sw.Flush(); exportlines += ex.ExportLine() + "\n"; i++; } } catch (Exception exc) { Log.Write(exc.Message); } </code></pre>
c#
[0]
5,275,677
5,275,678
How to enable a multi-select in a UITableView?
<p>Ha ii every body i have a tableview with some datas in it,i want to to sync it with googledoc ,my need is the user can select multiple selection in tableview cell and export those note to Gdoc.So is there any method for multiple selection in tableview with a tickmark or check mark? .Thanks in advance.</p>
iphone
[8]
4,631,281
4,631,282
post Increment problem
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3831341/why-does-this-go-into-an-infinite-loop">Why does this go into an infinite loop?</a> </p> </blockquote> <pre><code>public class loop { public static void main(String[] args) { int k=0; for (int i = 0; i &lt; 6; i++) { k = k++; System.out.println(k); } } } </code></pre> <p>out put :</p> <pre><code>0 0 0 0 0 0 </code></pre> <p>Can You Please explain me why above resulting zeros even am incrementing k value and assigning it to k.</p>
java
[1]
2,114,498
2,114,499
How to make dialog box in iphone
<p>I need to open the dialog box when the user clicks on a button . How can I do this programmatically in iphone.</p>
iphone
[8]
1,649,423
1,649,424
Basce64 encoding in android
<p>I have to submit a base64 encoded string to my server. How to do this in android application.</p> <p>Please help!!</p>
android
[4]
3,988,543
3,988,544
PHP: Handling Multiple Submit Buttons
<p>Would like to get a consensus as to what the best practice is in this scenario:</p> <p>Muliple submit buttons, is it better to handle this by having separate FORMS for each one of the submits, OR is it okay to have one form and check which button was pressed?</p> <p>thank you for your input :D</p>
php
[2]
3,378,351
3,378,352
How to repeat animation on complete using jQuery's animate() function?
<p>Here's my code. How to get the animation to repeat every time it completes?</p> <pre><code>$('img.balloon').animate({ bottom : '100%' }, 4000, 'linear', function() { // on complete repeat but how? }); </code></pre>
jquery
[5]
2,083,579
2,083,580
Android development
<p>Does the Android Application Development comes under the J2ME programming or is it totally/partially different?</p> <p>Please do let me know if anybody has a clear idea.</p>
android
[4]
2,123,950
2,123,951
Array of subclasses and onClick()
<p>I want to create by code an array of objects that are subclasses of Button.</p> <pre><code>public class MyButton extends Button { private Context ctx; private int status; public MyButton(Context context) { super(context); ctx = context; status = 0; } private click() { status = 1; // OTHER CODE THAT NEEDS TO STAY HERE } } </code></pre> <p>In the main activity I do this:</p> <pre><code>public class myActivity extends Activity { private MyButton[] myButtons = new MyButton[100]; @Override public onCreate(Bundle si) { super.onCreate(si); createButtons(); } private void createButtons() { for (int w=0; w&lt;100; w++) { myButtons[w] = new MyButton(myActivity.this); myButtons[w].setOnClickListener(new View.onClickListener() { public void onClick(View v) { // ... (A) } }); } } } </code></pre> <p>Now I want the click() method inside MyButton to be run each time the button is clicked. Seems obvious but it is not at my eyes.</p> <p>If I make the click() method public and run it directly from (A), I get an error because myButtons[w].click() is not static and cannot be run from there.</p> <p>In the meantime, I an not able to understand where to put the code in the MyButton class to intercept a click and run click() from there. Should I override onClick? Or should I override onClickListener? Or what else should I do?</p> <p>How can I run click() whenever one of myButtons[] object is clicked?</p> <p>Thanks for the help.</p>
android
[4]
1,429,610
1,429,611
Search in a list by predicate
<p>I would want to do something like:</p> <pre><code>&gt;&gt;&gt; lst = [1, 2, 3, 4, 5] &gt;&gt;&gt; lst.find(lambda x: x % 2 == 0) 2 &gt;&gt;&gt; lst.findall(lambda x: x % 2 == 0) [2, 4] </code></pre> <p>Is there anything even nearing such behavior in Python's standard libraries ? </p> <p>P.S. I know it's very easy to roll-your-own here, but I'm looking for a more standartized way</p>
python
[7]
2,370,422
2,370,423
how to retrieve checked values in php
<p>I am a newbie in php. I have a form with multiple checkbox values. I wanna retrieve the checked values and diplay these values on other php form.</p> <p>Below is the code which works perfectly fine if we add the checkboxes without while loop. But when added through while loop I am not able to fetch the selected items. </p> <p><strong>xyzhtml.php</strong>(html form)</p> <pre><code>&lt;?PHP require ("DBConnect.php"); $selectQuery =mysql_query( "SELECT * FROM fruits where approved = 0"); while($row = mysql_fetch_array($selectQuery)) { $fruit_name = $row['fruit_name']; echo "&lt;input type=\"checkbox\" name=\"things[]\" value=\"$fruit_name\"&gt;"; echo "&lt;br&gt;"; } ?&gt; On click of submit I call other php clled "xyz.php". Below is the code used in it. &lt;?php $checkBox = $_POST['things']; echo $checkBox[0]; for($i=0; $i&lt;sizeof($checkBox); $i++){ echo($checkBox[$i]); } ?&gt; </code></pre> <p>Please help. Thanks in advance.</p>
php
[2]
1,938,208
1,938,209
matching two fields in a form from two functions in javascript
<p>I have two fields that I'd like to match. (already done the validation functions for field 1 and 2)</p> <p>field01 has a client number Txxxxx xxxxx (can be T G or M)</p> <p>field02 has the area code 416 / 905 / 647</p> <p>I'd like to match T with 416, G with 905, and M with 647. and show a relationship error if the rules were broken.</p> <p>I made a separate function trying to compare the two.</p> <pre><code> function validatecompare(errMessages) { var clientID = document.pizza.field02; var telenum = document.pizza.field03; var client = clientID.value; var phone = telenum.value; var firstL = ""; var areaC = ""; firstL=client.substr(0,1); areaC =phone.substr(0,3); if ((firstL) !=areaC) { errMessages += "&lt;li&gt;Client Number and Telephone No. are not consistent with our set up rules.&lt;/li&gt;\n"; } return errMessages; } </code></pre> <p>I know that's wrong, I just have no idea how to compare two fields from two separate functions. The error message will pop up regardless of what I do. Even if I violate the rules for field 1 and 2 the error message will pop up with those when it shouldn't.</p> <p>If there is somewhere I can read up on how to do this would be excellent for future reference.</p> <p>any help would be greatly appreciated, thanks.</p>
javascript
[3]
5,903,374
5,903,375
List View in C#
<p>I have a ListView in my C# and I want to select an item based on a number which I give. Is this possible ?</p> <p>Example: if my List which has add , multiply and divide as elements in list . so if I give 2 it must select multiply. All these must be done programatically </p>
c#
[0]
2,392,936
2,392,937
Javascript - return false error
<p>I have a form validation function that loops through the form elements checking for empty fields - code below:</p> <pre><code>function formValidate(ourform){ var formelems = document.getElementById(ourform).elements; for (var i=0; i&lt;formelems.length; i++){ if(formelems[i].value == "") { alert("Empty Field(s). Please fill in all the fields."); return false; } } } </code></pre> <p>the problem is that my form does not return false if there's an empty field - it processes the form. I have solved this before but now i just cannot remember how.</p> <p>Thanks.</p>
javascript
[3]
583,519
583,520
replacing jquery.live() with jquery.on() doesn't work
<p>I have several textboxes that are added dynamically after an ajax call. These boxes are tied to event handlers with .live() that currently work fine. I want to replace that with the newer .on() function.</p> <p>This is what I have</p> <pre><code>$('.MyTextBox').live({ mouseenter: function () { .... }, mouseleave: function () { .... }, blur: function () { ... } }); </code></pre> <p>When I replace .live() with .on() it doesn't work; the textboxes don't display their normal behavior after they're added.</p> <p>If I write <code>$('#MainDiv .MyTextBox').live({...</code> , where MainDiv is the top DOM element where all the action happens, nothing happens either.</p> <p>What am I missing?</p> <p>Thanks</p>
jquery
[5]
4,548,088
4,548,089
Use Jquery to alter an item in a selectlist?
<p>Before: </p> <pre><code>&lt;select id="NumberId" name="NumberId"&gt; &lt;option value=""&gt;ZERO&lt;/option&gt; &lt;option value="4"&gt;FOUR&lt;/option&gt; &lt;option value="5"&gt;FIVE&lt;/option&gt; &lt;/select&gt; </code></pre> <p>Using JQuery, modify the value of the option with an empty value to 0 (zero).</p> <p>After: </p> <pre><code>&lt;select id="NumberId" name="NumberId"&gt; &lt;option value="0"&gt;ZERO&lt;/option&gt; &lt;option value="4"&gt;FOUR&lt;/option&gt; &lt;option value="5"&gt;FIVE&lt;/option&gt; &lt;/select&gt; </code></pre> <p>How can I do that?</p>
jquery
[5]
86,977
86,978
How do I get javascript to return this value?
<p>The alert works, but the return is 0. How do I get it to return the correct value?</p> <pre><code>var img; img = new Image(); img.onload = function() { alert(img.width); return(img.width); }; img.src = "https://maps.gstatic.com/mapfiles/dir/bike.png"; alert(img.width); </code></pre>
javascript
[3]
1,643,887
1,643,888
Force Close error description
<p>I've released an application to some people for testing. Some of them are reporting that it works fine, while other say that they are getting Force Close error on the first run. How can I get the error description that happens, so I can fix it?</p>
android
[4]
1,260,544
1,260,545
How to use subscriberCellularProviderDidUpdateNotifier
<p>I have done something like</p> <pre><code>CTTelephonyNetworkInfo *networkInfo = [[CTTelephonyNetworkInfo alloc] init]; networkInfo.subscriberCellularProviderDidUpdateNotifier = ^ (CTCarrier * carrier) {Do some stuff here }; </code></pre> <p>to get the notification when the cell service provider changes and do some tasks.The documentation says:</p> <blockquote> <p>A block object that is dispatched on the default priority global dispatch queue when the user’s cellular provider information changes. This occurs, for example, if a user swaps the device’s SIM card with one from another provider, while your application is running.</p> <p>To handle changes in cellular service provider information, define a block in your application and assign it to this property. The block must be implemented to support being called from any context.</p> </blockquote> <p>I am not sure where to implement this in my code and will it exceute if my application is running in background or suspended. </p>
iphone
[8]
933,178
933,179
Dalvik Debug Monitor not showing my phone
<p>I have downloaded and installed the SDK. But my phone is not getting shown in the Dalvik Debug monitor.</p> <p>Please help me, what is going wrong? I have killed the server. And restarted. But adb devices is not listing my device. I know while development in eclipse, I cant get my application running on my phone rather on emulator.</p> <p><img src="http://i.stack.imgur.com/ZgwE1.png" alt="enter image description here"></p> <p>I executed these commands too:</p> <pre><code>E:\programs\Android\android-sdk-windows\platform-tools&gt;adb kill-server E:\programs\Android\android-sdk-windows\platform-tools&gt;adb devices * daemon not running. starting it now on port 5037 * * daemon started successfully * List of devices attached E:\programs\Android\android-sdk-windows\platform-tools&gt; </code></pre> <p>PS: I re-installed my SDK. Previously I was having a <a href="http://stackoverflow.com/questions/6462851/my-android-phone-not-showing-up-in-dalvik-debug-monitor">problem</a> when my phone was offline. But that was resolved. I followed the same steps. But no success. </p> <p>Thanks in advance.</p>
android
[4]
1,362,767
1,362,768
JavaScript Query
<p>I have a field named "GROSS AMOUNT" </p> <p>If the gross amount is zero, then the javascript message confirmation asks the user whether the user should continue saving with zero amount and if the user presses cancel, even the server side save button should not be active, it should return back to the panel of the gross amount.</p> <p>I have used the following code for the client side.</p> <pre><code>function show_confirm() { // var txttemp = document.getElementById("&lt;%=txtSAmt.ClientID %&gt;").value; var menu = $find("&lt;%= this.txtSAmt.ClientID %&gt;"); var check; if (menu != null) { check = menu.get_value(); } if (check == '0') { var r = window.confirm("Gross Settlement Amount is 0.Press Cancel to Change, Press OK to save anyway"); if (r == 'false') { } } } </code></pre> <p>Please let me know that if the client clicks cancel, it should not fire the btnSave on the server side.</p>
javascript
[3]
5,167,759
5,167,760
Compatibility of the new sdk
<p>When developing with features introduced with in the new Android OS version, does one have to write an entirely different application structure to deal with older devices, or is there some sort of support mechanism for these situations?</p>
android
[4]
5,076,789
5,076,790
How to show uploaded file on the webpage with download option?
<p>Actually I am uploading a file by using file upload control. After successful upload, when I am viewing that page then at that time I want to show that uploaded file on the page which will have the options to download it too. Please help me out on this.</p> <p>Thanks.</p>
asp.net
[9]
5,002,622
5,002,623
How to use combination of enums in switch case in c#?
<p>I have following enum definition</p> <pre><code>public enum UploaderType { BrandLogo = 0, ReportingLogo = 1, DocumentTemplate = 2, MModalTemplate = 3, } </code></pre> <p>I have a switch case in which i want to use this enum</p> <pre><code>void FileUploadExceptionHandler(FileUploadControl.FileUploadExceptionType exceptionType, FileUploadControl.UploaderType uploaderType) { switch (uploaderType) { case FileUploadControl.UploaderType.DocumentTemplate: (this.Page as PageBase).SetMessage(string.Format(GetLocalResourceObject("FileExtensionError").ToString(), docIndentifier, formatAllowed(ucdocxUploadControl.SupportedFileTypes)), PageMessageType.ErrorMessage); break; case FileUploadControl.UploaderType.MModalTemplate: (this.Page as PageBase).SetMessage(string.Format(GetLocalResourceObject("FileExtensionError").ToString(), docIndentifier, formatAllowed(ucampUploadControl.SupportedFileTypes)), PageMessageType.ErrorMessage); break; case FileUploadControl.UploaderType.MModalTemplate|FileUploadControl.UploaderType.DocumentTemplate: (this.Page as PageBase).SetMessage(string.Format(GetLocalResourceObject("FileExtensionErrorForBoth").ToString(), formatAllowed(ucdocxUploadControl.SupportedFileTypes), formatAllowed(ucampUploadControl.SupportedFileTypes)), PageMessageType.ErrorMessage); break; } } </code></pre> <p>I am trying to use combination of enum in third case but compiler complains The label 'case 3:' already occurs in this switch statement.</p> <p>This enum is outside my control,so icannot use flags on it. Please suggest how to achieve this.</p> <p>When i call it, i use </p> <pre><code> FileUploadExceptionHandler(FileUploadControl.FileUploadExceptionType.FileExtensionNotAllowed, FileUploadControl.UploaderType.DocumentTemplate | FileUploadControl.UploaderType.MModalTemplate); </code></pre>
c#
[0]
5,833,745
5,833,746
Paypal currency conversion
<p>I have integrated paypal in my site. I have paypal sandbox account for development. my currency is USD. if customer deposit in other currency, how to handle it. Can anyone help me?</p>
php
[2]
5,991,200
5,991,201
where should i put server side code for google sites?
<p>i m developing an app from which i post some data to my webpage from my android app using http POST request this is my site <a href="https://sites.google.com/site/aycsdk/advertisement" rel="nofollow">https://sites.google.com/site/aycsdk/advertisement</a> i m following this <a href="http://webhole.net/2011/11/15/android-tutorial-how-to-post-data-from-an-android-app-to-a-website/" rel="nofollow">http://webhole.net/2011/11/15/android-tutorial-how-to-post-data-from-an-android-app-to-a-website/</a> tutorial problem is where should i paste server side code for my site so it can receive data from the app please help i haven't done any work before in this domain thankss !!</p>
android
[4]
2,374,692
2,374,693
Java question about super
<p>If A extends B, then I know I can user super.<em>*</em> to access B's method.</p> <p>What if A extends B and B extends C, how to access C's method from A?</p>
java
[1]
1,905,640
1,905,641
Edittext line number and currentline cursor position.
<p>Now I am working on a Android application. I created a custom keyboard with functionalities. I am using a edittext for displaying the entered texts. Edit text may have n number of lines.Now my problem is I have a up button in my keyboard.So if I click the up button then i have to go the previous lines same position.But I couldn't able to find out the edittext line number and curser position of the currentline. Please help me friends</p>
android
[4]
5,454,770
5,454,771
Readlines() vs. Read() - Can I convert data back and forth between the two functions?
<p>I have a module file containing the following functions:</p> <pre><code>def replace(filename): match = re.sub(r'[^\s^\w]risk', 'risk', filename) return match def count_words(newstring): from collections import defaultdict word_dict=defaultdict(int) for line in newstring: words=line.lower().split() for word in words: word_dict[word]+=1 for word in word_dict: if'risk'==word: return word, word_dict[word] </code></pre> <p>when I do this in IDLE:</p> <pre><code>&gt;&gt;&gt; mylist = open('C:\\Users\\ahn_133\\Desktop\\Python Project\\test10.txt').read() &gt;&gt;&gt; newstrings=replace(mylist) &gt;&gt;&gt; newone=count_words(newstrings) </code></pre> <p>test10.txt just contains words for testing like:</p> # <p>risk risky riskier risk. risk?</p> # <p>I get the following error:</p> <pre><code>Traceback (most recent call last): File "&lt;pyshell#134&gt;", line 1, in &lt;module&gt; newPH = replace(newPassage) File "C:\Users\ahn_133\Desktop\Python Project\text_modules.py", line 56, in replace match = re.sub(r'[^\s^\w]risk', 'risk', filename) File "C:\Python27\lib\re.py", line 151, in sub return _compile(pattern, flags).sub(repl, string, count) TypeError: expected string or buffer </code></pre> <p>Is there anyway to run both functions without saving <code>newstrings</code> into a file, opening it using <code>readlines()</code>, and then running <code>count_words</code> function?</p>
python
[7]
3,061,062
3,061,063
Add icon to Text field in Label control
<p>I want to know if there is a way I can add an icon to asp.net Label's Text.</p> <p>So, something like </p> <pre><code>&lt;asp:Label run="server" Text= "Please see the "icon" below /&gt; </code></pre> <p>Thanks.</p>
asp.net
[9]
3,264,590
3,264,591
Functionality code in event handler bad practice?
<p>I was reading some C# coding standards and it has this:</p> <p>"The event handler should not contain the code to perform the required action. Rather call another method from the event handler"</p> <p>I was wondering if there is a reason for this (performance or something else) or if it is just a style preference?</p>
c#
[0]
5,537,159
5,537,160
Android API for call sound stream manipulation
<p>Is there any way to hook voice sound while calling? Can I append this sound stream with for example some music?</p>
android
[4]
1,239,905
1,239,906
Idle time period before screen lock, wifi shutdown, phone sleep?
<p>I want to know <strong>how much time of inactivity</strong> has to pass before:</p> <ol> <li>the screen locks (Actually I know that one, it's configurable in the settings) </li> <li>the Wi-Fi shuts down? Where can I change this value?</li> <li>the phone goes to sleep mode? Where can I change this value?</li> </ol> <p>UPDATE: I don't want to lock anything. I only want to know how long it takes normally, when there are no locks set? Where in the OS code is this specified?</p>
android
[4]
4,886,226
4,886,227
automatic install of apk
<p>I'd like to know if it is possible to trigger programmatically the installation of an apk that is on the card ? </p>
android
[4]
3,172,272
3,172,273
Android icon for touch screen Java
<p>I want create android application which has application icon to show a main screen with three touchable areas. How can I do this?</p>
android
[4]
1,338,417
1,338,418
How can I know if ListA has everything ListB has?
<p>If I have the following...</p> <pre><code>List&lt;string&gt; listA = new List&lt;string&gt;(); listA.Add("a"); listA.Add("b"); listA.Add("c"); listA.Add("d"); List&lt;string&gt; listB = new List&lt;string&gt;(); listB.Add("b"); listB.Add("d"); </code></pre> <p>How can I know if listA has everything listB has?</p>
c#
[0]
1,683,503
1,683,504
dynamic String.Format depending of params
<p>Giving the following examples: </p> <pre><code>string amountDisplay = presentation.Amount == 1 ? "" : String.Format("{0} x ", presentation.Amount); </code></pre> <p>is there anyway to use String.Format so it formats depending on properties without having to do a condition of the 'value' of the parameters ?</p> <p>another use case:</p> <pre><code>String.Format("({0}) {1}-{2}", countryCode, areaCode, phonenumber); </code></pre> <p>if I only have phonenumber, I would end up with something like "() -5555555" which is not desirable. </p> <p>another use case :</p> <pre><code>String.Format("my {0} has {1} cat[s]", "Aunt", 3) </code></pre> <p>in this case, I would like to include the s in the [] if the value > 1 for example.</p> <p>Is there any black 'syntax' of String.Format that removes code parts depending on value of parameters or null ?</p> <p>Thanks.</p>
c#
[0]
474,438
474,439
threads or service
<p>I need to have gps running all the time in my application, but I don´t know if it is better throw it like a thread inside of the activity or if I should creat a Service and then in the Service, throw the thread</p> <p>Can anybody help me?? Thank you!!</p> <p>P.D: Sorry for my English</p>
android
[4]
644,382
644,383
Why do we have to explicitly specify "this" when invoking an extension method from within a method of a class being extended?
<pre><code>public class StoreController : Controller { // // GET: /Store/ public string Index() { // implicitly specified instance does not work //return GetMemberName(); // must specify this explicitly return this.GetMemberName(); } } public static class Utilities { public static string GetMemberName(this Controller caller, [CallerMemberName] string memberName = "") { return caller.GetType().FullName + "." + memberName; } } </code></pre> <p>Why do we have to explicitly specify <code>this</code> when invoking an extension method from within a method of a class being extended?</p> <p>In my mental model, we usually can omit <code>this</code> such as when we initialize fields, for example.</p>
c#
[0]
138,488
138,489
Pause/resume mediaPlayer on notification sound
<p>It's easy to detect when phone calls come in (via phoneStateListener), but what about other notification sounds, such as email or sms? </p> <p>On some devices, these notification sounds mute but don't pause any currently running mediaPlayer instances, which is annoying for the user. Ideally, I'd like to listen for notifications that play sound, pause playback for the duration, and then resume playback afterwards.</p>
android
[4]
4,312,793
4,312,794
Web Content Highlights to be read at backend
<p>I want to write a back end java program to listen to a text highlight event on the web browser and pass the highlighted text to my back end program. How can I do this? Are there any libraries that support this?</p>
java
[1]
3,134,618
3,134,619
how to replace youtube url in text?
<p>I have following text</p> <pre><code>"I made this video on my birthday. All of my friends are here in party. Click play to video the video http://www.youtube.com/watch?v=G3j6avmJU48&amp;feature=g-all-xit " </code></pre> <p>What i want is to replace this above url to</p> <pre><code>"I made this video on my birthday. All of my friends are here in party. Click play to video the video &lt;iframe width="853" height="480" src="http://www.youtube.com/embed/G3j6avmJU48" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt; " </code></pre> <p>I know we can get youtube video id from above url in following script</p> <pre><code> preg_match("#(?&lt;=v=)[a-zA-Z0-9-]+(?=&amp;)|(?&lt;=v\/)[^&amp;\n]+(?=\?)|(?&lt;=v=)[^&amp;\n]+|(?&lt;=youtu.be/)[^&amp;\n]+#", $word, $matches); $youtube_id = $matches[0]; </code></pre> <p>But I dont know how to replace url</p> <pre><code>http://www.youtube.com/watch?v=G3j6avmJU48&amp;feature=g-all-xit </code></pre> <p>to </p> <pre><code> &lt;iframe width="853" height="480" src="http://www.youtube.com/embed/G3j6avmJU48" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt; </code></pre> <p>Please help Thanks</p>
php
[2]
4,261,952
4,261,953
Access an inner function from outside the function in Javascript
<p>I'm trying to access an inner function from outside a function in Javascript, but it only prints "undefined" instead of printing the function's source code. How can I modify the prototype of the function <code>changeBlah</code> from outside the scope of <code>exampleFunction</code>?</p> <pre><code>var blah = ""; function exampleFunction(theParameter){ this.blah = theParameter; this.changeBlah = function(){ this.blah += "gah"; } } var stuff2 = new exampleFunction("Heh!"); alert(stuff2.blah); stuff2.changeBlah(); alert(stuff2.blah); alert(exampleFunction.changeBlah); //now why doesn't this work? It doesn't print the function's source code, but instead prints undefined.​​​​​​​​​​​​​​​​​​​​​​​ </code></pre>
javascript
[3]
583,188
583,189
How to launch the application upon booting up the device?
<p>Can anybody share the sample code to how to launch android application upon starting/booting up the device?</p>
android
[4]
3,514,318
3,514,319
How to append parameter to given url in javascript?
<p>I want to append some value to given URL. Suppose var name = "ABC";</p> <p>I want to append ABC to url say "http://www.mysite.com"</p> <p>How to append name "ABC" to above url??</p>
javascript
[3]
2,564,006
2,564,007
I need $(".className").each(function () with div. I can only get it to work with input
<p>The following jQuery code works if my tag is:</p> <pre><code>&lt;input class="AmountElementValue" readonly="readonly" /&gt; </code></pre> <p>However, it does not work if I make the input a <code>&lt;div /&gt;</code>. The code is:</p> <pre><code>$(".AmountElementValue").each(function () { alert($(".AmountElementValue").val()); var TrimedAmountElementValue = $(this).val().replace(/\$/g, ''); TrimedAmountElementValue = TrimedAmountElementValue.replace(",", ""); totalDisbursement += parseFloat(TrimedAmountElementValue); }); </code></pre> <p>How can use a <code>&lt;div /&gt;</code> instead?</p>
jquery
[5]
3,079,291
3,079,292
How to call function on swipe?
<p>I have implement on click button to do some thing and go to next activity. How to call this ( button.performClick() ) on swipe ? What listener to implement and catch ? Just on swipe to call button.performClick().</p>
android
[4]
1,753,598
1,753,599
How to draw a box in java inside which various shapes can be drawn?
<p>I am using paint method to draw shapes . But I want those shapes to appear inside a box whose by deafault colour is white . How do i do it?</p>
java
[1]
2,618,622
2,618,623
Android Development: Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
<p>I am trying to develop an app for Android. When I try to run it, I get this in the console:</p> <pre><code>[2012-05-16 11:49:52 - LDAPLookUp] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY [2012-05-16 11:49:52 - LDAPLookUp] Please check logcat output for more details. [2012-05-16 11:49:52 - LDAPLookUp] Launch canceled! </code></pre> <p>And, in LogCat, there is this:</p> <pre><code>05-16 11:49:51.169: E/PackageManager(91): Package com.ericbrian.ldaplookup requires unavailable shared library com.unboundid.android.ldap.*; failing! 05-16 11:49:51.169: W/PackageManager(91): Package couldn't be installed in /data/app/com.ericbrian.ldaplookup-2.apk </code></pre> <p>In the Referenced Libraries, I have <code>unboundid-ldapsdk-se.jar</code>.</p> <p>In the manifest, I have:</p> <pre><code>&lt;application android:icon="@drawable/logo" android:label="@string/app_name" android:logo="@drawable/logo" &gt; &lt;uses-library android:name="com.unboundid.android.ldap.*" /&gt; ... snip ... &lt;/application&gt; </code></pre> <p>What am I missing to get this to work?</p> <p>Thanks</p>
android
[4]
2,654,986
2,654,987
How to provide permission to the other 3rd party APK read/write files in my own APK
<p>I have a Provider and few files in my APK in ANDROID I want other APK can read/write files programmatically to my data/data//files folder (Just like MMS providing permission to 3rd Party APK to read/write parts file). How Can I provider permission to Other APK to read/write files to my above location in Android</p>
android
[4]
4,684,739
4,684,740
Consultation about binding list to listView
<p>i get array from my WebService.</p> <p>i got this:</p> <pre><code>WS w=new WS(); w.WebServiceCallExampleGetArray(); </code></pre> <p>that return this: <code>List&lt;Category&gt;</code></p> <p>i have listView <code>ListView list;</code></p> <p>how to bind <strong>w.WebServiceCallExampleGetArray()</strong> to <strong>listView</strong> </p>
android
[4]
997,483
997,484
Best place to save Java configuration information
<p>I am writing a library which uses some configurations. These configuration will not change frequently but will possible change in the future. Therefore I don't want to hard code them in the code.</p> <p>What is the best way of doing this for a Java library? One possible solution is to inject it and hard code them in a DI configuration file I assume. But this requires code change as well.</p> <p>What is the most typical way of doing this?</p> <p>Many thanks</p>
java
[1]
563,189
563,190
How can you view the filename of a webpage if it has been hidden
<p>I'm trying to find out the name of the default page of a domain for a site i'm working on.</p> <p>It has been set so that the name of the default page isn't shown, so it just shows the domain name in the address bar and ends after .com/</p> <p>Is there any way to view what the name of this file is?</p>
php
[2]
5,628,365
5,628,366
Picking dates in Jquery and calling methods
<p>I have a jquery DatePicker control From and To. Once the date is changed in either of them, I want to call a controller method. How can I do this and how can associate the event of changing date to the function.</p> <p>Assume that Controller is called TestController and the method is TestMethod and it takes two parameters namely DateTime StartDate and DateTime EndDate. </p> <p>Any ideas and suggestions are greatly appreciated.</p>
jquery
[5]
5,120,209
5,120,210
My Android app does not show up on the devices android market, but does on the website
<p>I submiited a app to the Android market. It shows up on the website, buty not when I go to the android market on a android device. My account shows it as published and I dont see any error messages. - Ted</p>
android
[4]
3,999,032
3,999,033
Jquery, getting image with custom attribute
<p>Can you please give me a hint on how do I get the value of a specific image by an custom attribute . For example, I have :</p> <pre class="lang-html prettyprint-override"><code>&lt;img class="image" identif="&lt;?php echo $j; ?&gt;" id="&lt;?php echo $id; ?&gt;" src="../&lt;?php echo $sqlg[$pic] ?&gt;" h="&lt;?php echo $heightl; ?&gt;" w="&lt;?php echo $widthl ?&gt;" height="&lt;?php echo $height; ?&gt;px" width="&lt;?php echo $width; ?&gt;px" title="Double-click to enlarge image" /&gt; </code></pre> <p>I want in jquery to get the "src" of the image by the "identif" attribute, thank you :)</p>
jquery
[5]
4,215,998
4,215,999
Dynamically changing TextViews with a for loop
<p>I am trying to change the values of several TextView elements but iterating through an array list and adding these values. However I can't seem to find a way to change the R.id value that is used each time. For example:</p> <pre><code>for (int i=0; i&lt;arrayList.size(); i++) { TextView t = (TextView) dialog.findViewById(R.id.value+(i)); t.setText(arrayList.get(i)); } </code></pre> <p>Where the values are in the format animals_eng1,animals_eng2 etc.. Any help appreciated.</p>
android
[4]
2,889,921
2,889,922
is there any way to converts Python scripts into executable Windows programs on linux
<p>is there any way to converts Python scripts into executable Windows programs on linux<br> i know py2exe and pyinstall will work well on windows<br> but i only has linux Environment</p>
python
[7]
5,975,419
5,975,420
How to make sure a batch file is executed properly through a CMD from a c# applicaiton?
<p>I have a c# applications which writes to a batch file and executes it. The application to be started and the path of application will be written in batch file and executed. which is working fine.</p> <p>How can i make sure that the application launched successfully via my batch file run in command prompt ?</p> <p>Is there any value that cmd returns after executing a batch file ? or any other ideas please...</p> <p>Code i am using now : </p> <pre><code> public void Execute() { string LatestFileName = GetLastWrittenBatchFile(); if (System.IO.File.Exists(BatchPath + LatestFileName)) { System.Diagnostics.ProcessStartInfo procinfo = new System.Diagnostics.ProcessStartInfo("cmd.exe"); procinfo.UseShellExecute = false; procinfo.RedirectStandardError = true; procinfo.RedirectStandardInput = true; procinfo.RedirectStandardOutput = true; System.Diagnostics.Process process = System.Diagnostics.Process.Start(procinfo); System.IO.StreamReader stream = System.IO.File.OpenText(BatchPath + LatestFileName); System.IO.StreamReader sroutput = process.StandardOutput; System.IO.StreamWriter srinput = process.StandardInput; while (stream.Peek() != -1) { srinput.WriteLine(stream.ReadLine()); } stream.Close(); process.Close(); srinput.Close(); sroutput.Close(); } else { ExceptionHandler.writeToLogFile("File not found"); } } </code></pre>
c#
[0]
3,002,876
3,002,877
redirecting a page link and changing page text based on link
<p>OK I am not sure if the question title is actually correct , newbie web developer here so bear with me.<br /> This is an ASP.NET webiste running on IIS 6.0<br /> So here is the problem: I have two pages called Page1 and Home<br /> you can navigate to both like so<br /> www.mysite.com/Page1.aspx, www.mysite.com/Home.aspx</p> <p>Page1 is now undergoing a lot changes so that it is going to end up looking a lot like Home except for some really small text changes. Also there are a number of emails in the wild with customers that link to Page1 and \ or Home </p> <p>What I want is a solution that does the following </p> <ol> <li><p>Create One page( say newhome.aspx) which displays the correct text based on the URL of the link that people clicked on to get here </p></li> <li><p>Let existing links go to this new page( and of course as per the above requirement the appropriate text would be displayed) </p></li> </ol> <p>I guess they sort of are the same requirement , bottom line I want only one page and all legacy links to continue to work as in get redirected to this new page</p> <p>Thanks </p>
asp.net
[9]
3,074
3,075
AutoCompleteTextView with server response
<p>How to create AutoCompleteTextView which will fetch results from remote server?</p> <p>As I understand I need to implement ArrayAdapter, which must make async requests to server.</p>
android
[4]
366,595
366,596
C++ simple program realization
<p>I need your help to get started with a good implementation thinking.</p> <p>I need to create a simple program with the following: 1. A function with two parameters, first parameter is a name (char*), and the second parameter is the number of times you would like to print this name to the screen(int). If the second parameter wasn't supplied in the function call, it should print the name 10 times. If the first parameter wasn't supplied in the function call, it should print the author name / the writer of the program (i.e my name).</p> <p>I was thinking to create the following function with default parameteres:</p> <pre><code>void printTextToScreenNTimes(char * text = "guy", int n = 10); </code></pre> <p>This function implementation is the following :</p> <pre><code>void printTextToScreenNTimes(char * text, int n) { int i; for (i = 0; i &lt; n; i++) cout &lt;&lt; text &lt;&lt; " "; } </code></pre> <p>My problem arises as I try to print my default name 2 times. For example if I want only using the following function call: </p> <pre><code>void printTextToScreenNTimes(3); </code></pre> <p>I would like the function to print the default name (in this case "guy") 3 times but It's impossible because I must fill the first parameter.</p> <p>Do I have no choice but using a global parameter holding my name?</p>
c++
[6]
4,069,767
4,069,768
How to search file over LAN in java?
<p>My question is: How to search file in other pc connected through lan in java?</p>
java
[1]
3,177,104
3,177,105
Managing big amount of data (around 400Mb)
<p>I am thinking about developing a birds catalog for Android. It will contain many pictures and audio files, around 400Mb.</p> <p>I am starting in this world but after some reading I didn't find too much info about such kind of applications. I have following questions:</p> <p>1.- What kind of options do I have for installation? 400Mb downloaded from Android Market? Minimal installation from Android Market and in the first execution connect to a second server to download all the data? Other options?</p> <p>2.- Which is the best way to store such amount of data? File system in the SD Card? SQLite DB?</p> <p>3.- Is there any way to specify in the manifest file, the minimum file system space required to avoid failure installations (imagine you pay for the app, and the app doesn't install because there is no enough space)?</p> <p>Any tip or pointer to documentation about this kind of applications will be appreciate.</p> <p>Thanks in advance,</p> <p>Chemi.</p>
android
[4]
1,919,832
1,919,833
How to move the Focus of the keyboard in android?
<p>I made a login page... when even i enter the login page then the keyboard always popup to fill in the entry.. i need to control this popup in my mobile. I tried setFocusable(false).. still no use... Can anyone help me in this?</p>
android
[4]
136,750
136,751
I want to use .load() with query value, jquery
<p>I want to be able to load the feed value with a user id, but does not. The full url is </p> <pre><code>http://localhost/feed/feeds.php/?userid=xxyy var f = &lt;? echo $_POST['xy']; ?&gt; $('#feed').bind('click',function(){ $('#feed1').load("http://localhost/feed/feeds.php/",{'userid':[f]); }); </code></pre> <p>Can I use the url directly></p> <p>Either way I the page does not load on clicking <code>&lt;div id="feed"&gt;&lt;/div&gt;</code></p>
jquery
[5]
2,519,130
2,519,131
Why am I getting this warning about my app delegate and CLLocationManageDelegate?
<p>Observe this perfectly simple UIViewController subclass method:</p> <pre><code>-(IBAction)launchSearch { OffersSearchController *search = [[OffersSearchController alloc] initWithNibName:@"OffersSearchView" bundle:nil]; EverWondrAppDelegate *del = [UIApplication sharedApplication].delegate; [del.navigationController pushViewController:search animated:YES]; [search release]; } </code></pre> <p>On the line where I get *del, I am getting a compiler warning that reads, <code>Type 'id &lt;UIApplicationDelegate&gt;' does not conform to the 'CLLocationManagerDelegate' protocol</code>. In fact, my app delegate DOES conform to that protocol, AND what I'm doing here has nothing at all to do with that. So what's up with that message?</p> <p>Secondary question: sometimes I can get to my navigationController via <code>self.navigationController</code>, and sometimes I can't, and have to go to my app delegate's property to get it like I'm doing here. Any hint about why that is would be very useful.</p>
iphone
[8]
4,940,853
4,940,854
What is *.o file?
<p>I'm compiling own project. And it halted by this error:</p> <blockquote> <p>LINK||fatal error LNK1181: cannot open input file 'obj\win\release\src\lua\bindings.o'|</p> </blockquote> <p>Compiling using Code::Blocks with VS 2005/2008 compiler under win7. There are also lot of another empty directories where *.o files are missing.</p> <p>What do they do?</p>
c++
[6]
184,218
184,219
forsee std::bad_alloc in C++
<p>As far as I understand std::bad_alloc exceptions in C++ are triggered when the program runs out of memory. Is there a way to monitor how much memory left there are and trigger a special routine before we reach the point of no return ?</p>
c++
[6]
5,844,891
5,844,892
Parcelable and Message object from Javamail
<p>I am using the JavaMail API in Android.</p> <p>I need to pass an object of type Message from a activity to another. The use of Parcelable would work ridiculously annoying and costly. I have a way to send an object "type object" to another activity? </p> <p>This should be common Java and native may be Android. It is an absurdity can not pass an object of one activity to another "type object". There are extreme cases you do not want implement parcelable because it does not work!</p> <p>Any idea?</p>
android
[4]
4,304,377
4,304,378
pdf combo box javascript
<p>Can someone help me out? I need two combo boxes form my pdf. </p> <p>As an example, I need the first to list the following: Dodge, Chrysler, Jeep. The second combo box to read models of that make. </p> <p>For Dodge lets use the example Caliber, Charger, Challenger. for Jeep; Patriot, Compass, Wrangler. And for Chrysler how about: 200, 300 and Sebring. </p> <p>So when Dodge is selected, the second combo box will show models of that partifular make. Simple right? I of course will name my first combo box "Make" and the second "Model". I need a script to make this happen and am NOT versed in javascript at all. I just know that is what needs to happen. </p> <p>Something I can copy/paste? Anyone? I can add more makes/modules to the script once I get the basic layout. :)</p>
javascript
[3]
139,360
139,361
If internet requires authentication for actually connecting to be able to download?
<p>My application requires using internet connection to download some file from a link. I have a internet connection which uses proxy and needs authentication. Somehow when I try to connect to internet it never asks for this authentication hence is unable to download file.</p> <p>What I want to ask is that is there any way to detect if the internet connection of the user requires authentication to download files from internet, so that in-case if it is required my application can ask the user to open a normal internet browser of device and provide the wanted authentication.</p>
android
[4]
5,377,333
5,377,334
Android: Handling events in menu
<p>I am trying to implement smth like context menu but with icons </p> <pre><code>public class MenuItem { private int type; private String nameItem; private int imageResource; } menu.xml // ImageView ant TextView public final class MenuItemProvider { //create our menu items } public class MenuListAdapter extends ArrayAdapter&lt;MenuItem&gt; { private Activity context; private List&lt;MenuItem&gt; menuItems; public MenuListAdapter(Activity context, List&lt;MenuItem&gt; menuItems) { super(context, R.menu.menudlg, menuItems); this.context = context; this.menuItems = menuItems; } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = context.getLayoutInflater(); View row = inflater.inflate(R.menu.menudlg, parent, false); TextView label = (TextView) row.findViewById(R.id.text_item); label.setText(menuItems.get(position).getName()); ImageView icon = (ImageView) row.findViewById(R.id.icon_item); icon.setImageResource(menuItems.get(position).getImageResource()); return row; } </code></pre> <p>}</p> <p><strong>Question</strong> I don't understand how to handle event in this menu(event of filled menu item), one of the ways send in builder.setAdapter dialogListener ,but i don't know how create them</p> <pre><code> listView = getListView(); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; a, View v, int position, long id) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); builder.setAdapter(new AccountsTypesListAdapter(context, AccountTypesProvider.accountTypes), dialogListener); builder.create().show(); } </code></pre>
android
[4]
4,928,596
4,928,597
what is the purpose of backgroundWorker ? (can i get some sample code to understand ?)
<p>what is the purpose of backgroundWorker ? (can i get some sample code to understand ?)</p> <p>thank's in advance</p>
c#
[0]
6,002,849
6,002,850
audioTrack play() plays only once
<p>using Android's AudioTrack for the first time. I have created a class AndroidAudioDevice. I init it with this constructor:</p> <pre><code> public AndroidAudioDevice( ){ // constructor Log.i("Audio", "constructor"); int minSize =AudioTrack.getMinBufferSize( SAMPLE_RATE, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT ); track = new AudioTrack( AudioManager.STREAM_MUSIC, SAMPLE_RATE, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, minSize, AudioTrack.MODE_STATIC); createSample(); track.write( buffer, 0, buffer.length ); }; </code></pre> <p>(SAMPLE_RATE is set to 44100).</p> <p>My main activity simply has a button, which calls </p> <pre><code>public void playSound(){ track.play(); Log.i("Audio", "playState: " + track.getPlayState()); }; this works find BUT ONLY ONCE! If I press the button again no sound anymore. </code></pre> <p>BTW: Log.i displays a "3" for the playstate</p> <p>Any idea why this works only once? Thanks in advance</p>
android
[4]
31,927
31,928
Generic order method by specific property
<p>I am quite new in generic programming and have a question:</p> <p>I am trying to order a list by specific properties which should be defined as parameter. Please look at the code for better understanding what I want:</p> <pre><code>public static IEnumerable&lt;T&gt; SortEmployeesFor&lt;T&gt;( IEnumerable&lt;T&gt; list, property1, property2, OrderOptions options) { switch (options) { case OrderOptions.1: return list.OrderBy(x =&gt; property1).ThenBy(x =&gt; property2); case OrderOptions.2: return list.OrderBy(x =&gt; property2).ThenBy(x =&gt; x.property1); ... } return list; } </code></pre> <p>Is there any option to perform this?</p> <hr> <p>P.S. It's my first post, if I did something wrong, please understand and let me know.</p>
c#
[0]
2,681,553
2,681,554
java.lang.NoSuchMethodError: main Exception in thread "main"
<p>I Cant understand why this messege come---------></p> <pre><code>java.lang.NoSuchMethodError: main Exception in thread "main" . </code></pre> <p>I know it expecting main() method but as i m building an applet which does not contain main method rather contain init() method.So what will i do??My code is s follow ---></p> <pre><code>import java.applet.*; import java.awt.*; public class Ballbewegung1 extends Applet implements Runnable { // Initialisierung der Variablen int x_pos = 10; // x - Position des Balles int y_pos = 100; // y - Position des Balles int radius = 20; // Radius des Balles public void init() { setBackground (Color.blue); } public void start () { // Schaffen eines neuen Threads, in dem das Spiel lไuft Thread th = new Thread (this); // Starten des Threads th.start (); } public void stop() { } public void destroy() { } public void run () { // Erniedrigen der ThreadPriority um zeichnen zu erleichtern Thread.currentThread().setPriority(Thread.MIN_PRIORITY); // Solange true ist lไuft der Thread weiter while (true) { // Verไndern der x- Koordinate x_pos ++; // Neuzeichnen des Applets repaint(); try { // Stoppen des Threads fr in Klammern angegebene Millisekunden Thread.sleep (20); } catch (InterruptedException ex) { // do nothing } // Zurcksetzen der ThreadPriority auf Maximalwert Thread.currentThread().setPriority(Thread.MAX_PRIORITY); } } public void paint (Graphics g) { g.setColor (Color.red); g.fillOval (x_pos - radius, y_pos - radius, 2 * radius, 2 * radius); } } </code></pre> <p>And I dont know how to use code tag.so plz someone ans.</p>
java
[1]