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
3,735,445
3,735,446
Problems with MessageBox
<p>I have some code for a MessageBox, but I get a red line below the code and also in the beginning of the class at using System.Windows.Forms!?</p> <p>Isn't it enough to add the using System.Windows.Forms to show MessageBoxes? Or could I have missed something else? Hints are preciated! Thanks! </p> <p>EDIT:</p> <p>The error message: Error 1 The type or namespace name 'Windows' does not exist in the namespace 'System' (are you missing an assembly reference?)</p>
c#
[0]
5,208,895
5,208,896
How to display a certain portion of a site depending on a javascript variable?
<p>Suppose I have a javascript variable "is_valid"</p> <p>If the variable is 1, I'd like to display:</p> <pre><code>&lt;div&gt;It's valid!&lt;/div&gt; ...and a big chunk of other code </code></pre> <p>Otherwise...</p> <pre><code>&lt;div&gt;NOT valid&lt;/div&gt;...and a big chunk of other code </code></pre> <p>I do NOT want to use INNERHTML. I want to do it like this:</p> <pre><code>&lt;script type="text/javascript"&gt; if(is_valid == 1){ &lt;/script&gt; It's valid! &lt;script type="text/javascript"&gt; }else{ &lt;/script&gt; It's not valid &lt;script type="text/javascript"&gt; } &lt;/script&gt; </code></pre>
javascript
[3]
5,036,761
5,036,762
Deleting nullptr - performance overhead?
<p>Operator delete checks itself if the pointer is nullptr. Is there any performance overhead when calling delete on a nullptr without checking it yourself?</p> <pre><code>delete ptr; </code></pre> <p>or</p> <pre><code>if (ptr != nullptr) delete ptr; </code></pre> <p>Which of the above executes faster if ptr is nullptr?</p>
c++
[6]
1,357,267
1,357,268
No resource found that matches the given name '@android:style/AlertDialog' error after the latest android 3.2 sdk update
<p>I ran into the following error after upgrading my <code>android sdk</code> to 3.2:</p> <pre><code>-resource-src: [echo] Generating R.java / Manifest.java from the resources... [aapt.exe] c:\jenkins\workspace\AndroidAppBranch2.0_conversion\res\values\themes.xml:11: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/AlertDialog'. </code></pre> <p>I didn't change anything in the code and the only thing that I did was upgraded the Android SDK to 3.2 this morning when the <code>SDK Manager</code> prompted me. I upgraded the <code>SDK</code> on another machine (stupid me...) and the same error showed up.</p> <p><strong>Has anyone run into this?</strong></p>
android
[4]
760,859
760,860
Android development
<p>I plan to work with android. Please point me some good books and blogs/discussion/tutorials/ forums for getting vast and in depth knowledge quickly about this android technology.</p>
android
[4]
1,191,063
1,191,064
I cannot get ADB to see my Nexus One device
<p>Mac OSX 10.6.4 Nexus One Android 2.2 The command adb devices will list my emulators and also my Droid Eris (Android 2.2) but nothing shows for the Nexus One</p> <p>I have searched extensively and failed to find any answer or suggestions, any help most welcome</p>
android
[4]
3,202,385
3,202,386
PHP magic_quotes_gpc = off but slashes are still added
<p>magic_quotes_gpc has been set to off and confirmed by phpinfo(), but content is still inserted into the database with slashes</p> <p>Note: I'm using mysql_real_escape_string() to insert each value, I have tested this function to see if it's causing any issues but it made no changes to the value inserted into the database</p> <p>PHP Version 5.2.12 MySQL Client API version 5.0.91</p>
php
[2]
5,898,210
5,898,211
java file writing within shared folder
<p>How to write excel sheets in the shared network folder using Java API.I think before writing the files ,first program should authenticate it.</p> <p>Please provide any hints.</p>
java
[1]
4,312,381
4,312,382
Android modal application?
<p>I'm looking at making an application which doesn't yield to the home button when the button is pressed. Logically speaking I doubt this behavior is possible for security reasons (to prevent phones being hijacked). It is however an important feature for my app which is being written to help my mentally handicapped uncle use his phone.</p> <p>My question at a high level is can I prevent him closing the application and returning to the core android home page/switching applications? Or is it the case that I would have to modify the android OS itself and create my own custom flavour and then jail-break/flash the phone with it?</p>
android
[4]
4,214,290
4,214,291
Multiple statements inside a conditional operator
<p>HI, I need to write multiple statements inside a conditional operator.</p> <p>What will be the equivalent of this if condition with conditional operator</p> <pre><code>var name; var age; var passed; if ( arg == "first" ) { name = "John"; age = "25"; passed = false; } else { name = "Peter"; age = "29"; passed = true; } </code></pre>
javascript
[3]
1,029,299
1,029,300
onBackPressed to hide Not destroy activity
<p>i know how to cancel back keypress, so that the activity / main window stays visible:</p> <pre><code>public void onBackPressed() { return; } </code></pre> <p>my aim is to hide the activity, however, without finishing it, how do you do that in the onBackPressed event? </p> <p>i.e. I would like to get as far as onPause(), but not evoke the onBackPressed() default behaviour that essentially calls finish(). another way to put it is that i would like to mimic onUserLeaveHint() ?</p> <p>any help appreciated!</p>
android
[4]
4,855,766
4,855,767
How do I "translate" characters typed via JQuery?
<p>I need to somehow change the character typed into a different utf8 character and was wondering how it can be achieved with jquery? Basically when some inputs are focused, I want to have English letters typed translated into other predefined character. Any ideas?</p>
jquery
[5]
4,609,092
4,609,093
UTRAN Cell Identity returned by getCid()
<p>In UMTS I get a large number returned by <code>getCid()</code> (larger than the allowed value). Is this the UTRAN Cell Identity (UC-ID)?</p> <pre><code>UC-Id = RNC-Id + C-Id </code></pre> <p>Does someone knows that? How to get the <code>C-Id</code> from the <code>UC-Id</code>?</p> <p>Thanks and Best, Benny</p>
android
[4]
1,588,462
1,588,463
Debug fails but works in other cases
<p>WHy do I always get |Access is denied| exception during debug ?</p> <pre><code>foreach(Process p in Process.GetProcesses()) { string module=p.MainModule.Filename; } </code></pre> <p>Whatever process it is, the exeption's always called. But it works if I just start without debugging. I'd like to get the full path of the process by the way/.</p>
c#
[0]
5,335,757
5,335,758
does javascript require ';' at the end of a line of code?
<p>I have seen and used javascript code that both has and omits the ';' from the end of statements. Are they required in some cases and not in others? If so can you give some examples, and if not what is the general standard, to use the ';' or to not...that..is the question??</p>
javascript
[3]
5,631,403
5,631,404
setInterval Variable Scope
<p>I have a variable declared at the top of my function as <code>this.current_test = null;</code> and then down the line I have a setInterval function and I need to set the variable to a new parameter...</p> <p><code>this.current_test.failed = true;</code></p> <p>Code:</p> <pre><code>timer = this.window.setInterval(function() { this.window.clearInterval(timer); this.current_test.failed = true; },1000); } </code></pre> <p>However I am getting a <code>TypeError: 'undefined' is not an object (evaluating 'this.current_test.failed = true'</code> error</p> <p>And I assume this is because this.current_test is not defined inside the setInterval function, so how can I edit that variable?</p>
javascript
[3]
4,201,938
4,201,939
Create Buttons for activity in code
<p>I dont't see last button (bx), when first button array too big, for example size is 12, when size is 2 I see it. Why button doesn't transition to second row.</p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout linLayout = new LinearLayout(this); linLayout.setOrientation(LinearLayout.HORIZONTAL); LayoutParams linLayoutParam = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); setContentView(linLayout, linLayoutParam); int size=20; Button[] mButtonsArray = new Button[size]; LayoutParams Lpx= new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); for (int i=0; i&lt; size;i++) { mButtonsArray[i]= new Button(this); mButtonsArray[i].setText(name); linLayout.addView(mButtonsArray[i], Lpx); } Button bx = new Button(this); bx.setText("back"); linLayout.addView(bx, Lpx); } </code></pre>
android
[4]
560,758
560,759
how to access the instance variables of one class to be used in another class?
<p>Suppose we declare and define the variable in one class let say FirstClass and we want to use that variable in another class let say SecondClass which is outside of FirstClass .how to do this? </p>
asp.net
[9]
691,787
691,788
How to get width of the container in which my view is added in Android
<p>I have a ImageView object inside a LinearLayout. I'm setting an animation to the ImageView which will move image view from point x to y. Now, starting point should be right corner of parent container. My question is , how do i get the dimension of the container in which the view is present. I don't see view.getParent().getWidth() kind of method in view hierachy.</p>
android
[4]
5,868,108
5,868,109
jQuery method to click on image/caption or <li> to go to URL
<p>I'd like to use an image slider plugin (Elastislide) as a menu. The problem is that it uses <code>&lt;a href="#"&gt;</code> as a function and can't be used as a link. I've tried. So, I'm looking for a jQuery solution to use the images/captions or a <code>&lt;li&gt;</code> as a pseudo-link.</p> <p>The pages are all local, so I don't need to go to another domain, just another page in the same directory. Here's an example of the HTML</p> <pre><code> &lt;div id="carousel" class="es-carousel-wrapper"&gt; &lt;div class="es-carousel"&gt; &lt;ul&gt; &lt;li value="another_page.php"&gt;&lt;a href="#"&gt;&lt;img src="images/small/1.jpg" alt="image01" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li value="yet_another.php"&gt;&lt;a href="#"&gt;&lt;img src="images/small/2.jpg" alt="image02" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li value="still_another.php"&gt;&lt;a href="#"&gt;&lt;img src="images/small/3.jpg" alt="image03" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li value="last_one.php"&gt;&lt;a href="#"&gt;&lt;img src="images/small/4.jpg" alt="image04" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I added the value getting a clue from another post.</p>
jquery
[5]
2,014,230
2,014,231
Unexpected result when checking network reachability
<p>In my app I implemented the code for network reachability. This is my code.</p> <pre><code>-(void)viewDidLoad { // Test for internet. gotInternet = [self checkInternet]; if (gotInternet == NO) { // No Internet. UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Connection Error" message:@"The internet is down" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; [alert show]; [alert release]; } else { NSLog(@"I do have internet"); } } -(BOOL)checkInternet { //Test for Internet Connection NSLog(@"——–"); NSLog(@"Testing Internet Connectivity"); Reachability *r = [Reachability reachabilityWithHostName:@"https://mobile.areafinancial.com/cutechservice/cutechwebservice.asmx"]; NetworkStatus internetStatus = [r currentReachabilityStatus]; BOOL internet; if ((internetStatus != ReachableViaWiFi) &amp;&amp; (internetStatus != ReachableViaWWAN)) { internet = NO; } else { internet = YES; } return internet; } </code></pre> <p>This code returns me gotInternet = NO; Actually WiFi is enabled. What am i doing wrong?</p> <p>Thank you in advance.</p>
iphone
[8]
5,703,210
5,703,211
Java: enough free heap to create an object?
<p>I recently came across this in some code - basically someone trying to create a large object, coping when there's not enough heap to create it:</p> <pre><code>try { // try to perform an operation using a huge in-memory array byte[] massiveArray = new byte[BIG_NUMBER]; } catch (OutOfMemoryError oome) { // perform the operation in some slower but less // memory intensive way... } </code></pre> <p>This doesn't seem right, since Sun themselves recommend that you shouldn't try to catch <code>Error</code> or its subclasses. We discussed it, and another idea that came up was explicitly checking for free heap:</p> <pre><code>if (Runtime.getRuntime().freeMemory() &gt; SOME_MEMORY) { // quick memory-intensive approach } else { // slower, less demanding approach } </code></pre> <p>Again, this seems unsatisfactory - particularly in that picking a value for <code>SOME_MEMORY</code> is difficult to easily relate to the job in question: for some arbitrary large object, how can I estimate how much memory its instantiation might need?</p> <p>Is there a better way of doing this? Is it even possible in Java, or is any idea of managing memory below the abstraction level of the language itself? </p> <p><strong>Edit 1:</strong> in the first example, it might actually be feasible to estimate the amount of memory a <code>byte[]</code> of a given length might occupy, but is there a more generic way that extends to arbitrary large objects?</p> <p><strong>Edit 2:</strong> as @erickson points out, there are ways to estimate the size of an object once it's created, but (ignoring a statistical approach based on previous object sizes) is there a way of doing so for yet-uncreated objects?</p> <p>There also seems to be some debate as to whether it's reasonable to catch <code>OutOfMemoryError</code> - anyone know anything conclusive?</p>
java
[1]
3,240,358
3,240,359
About session expire if user don't do any action for sumtime
<p>Can anyone give be the code of session expire if user dont do any activity for 15mins, if no activity[like mouse move,scroll,click] is done then the session should expire </p> <p>I have tried the following:</p> <pre><code>$_SESSION['start'] = time(); $_SESSION['expire'] = $_SESSION['start'] + (45 * 60); if(isset($_SESSION['luser'])) { $now = time(); if($now &gt; $_SESSION['expire']) { session_destroy(); echo "Your session has expire ! &lt;a href='login.php'&gt;Login Here&lt;/a&gt;"; } else { } } </code></pre>
php
[2]
3,161,316
3,161,317
how to create an callback method in my own application whenspecific situation arises(based on my own requirement) in ANDROID
<p>I am developping one android application.where some third party provides button to My view.My view actually displays the camerapreview.So when that button is clicked I want to give some call back method giving back the information of the picture.</p> <p>So how to create a callback in my application and provide it to other application</p> <p>Regards, Malaya</p>
android
[4]
4,524,389
4,524,390
pythonic way to write this code
<p>I have this ugly piece of code..</p> <pre><code> orders = got_something_from_db() if orders: for order in orders: #print order event_id = order["event_id"] if event_id in event_id_dict: # something i grabbed earlier product_id = order["product_id"] # products in an event qty = order["qty"] if product_id in product_sku_dict: sku_id =product_sku_dict[product_id] for i in range(qty): sku_ids.append(sku_id) </code></pre> <p>How do I made this more pythonic (and terse)</p>
python
[7]
4,325,456
4,325,457
Condition to test if a word exists in window.location.href
<p>I want to test if a word ["sublanguageid-all" to be specific] is present in the current address of the page using an 'if' condition. I've tried /sublanguageid-all/g, but I'm not able to put it in an if-statement</p>
javascript
[3]
4,630,622
4,630,623
how to handle single click and double on same button in mfc?
<p>In my VC++ project I am using a button in dialog. I already add single click event of a button. Now I want to handle double click event of the same button. So I add ON_BN_DOUBLECLICKED( IDC_BUTTON1, OnDBClick ) for the same button. But it is not working. Can anyone explain it?</p>
c++
[6]
3,877,909
3,877,910
extra space being added in array output
<p>I'm trying to create a custom function to take a array and add comma. Like for a location or list of items.</p> <pre><code>function arraylist($params) { $paramlist = reset($params); while($item = next($params)) { $paramlist = $item . ', ' . $paramlist; } return $paramlist; } $location = array('San Francisco','California','United States'); echo arraylist($location); </code></pre> <p><code>San Francisco , California, United States</code> is the output. It should out put <code>San Francisco, California, United States</code></p>
php
[2]
5,475,865
5,475,866
How to get corresponding value of key in JavaScript
<p>I have this code:</p> <pre><code>var getValuesArray = []; var setValuesArray = []; function SetValueJson(key, value, scormVersion, methodCalled) { if (key1 != null) { var obj = { key: key1, value: value1 } setValuesArray.push(obj); alert("pushing the key as: " + setValuesArray[key] + " and value as: " + setValuesArray[key].value); //not shure how te reference it? return value; } </code></pre> <p>and:</p> <pre><code>function GetValueJson(key, scormVersion, methodCalled) { //I will get to this later, want to get the array right first } </code></pre> <p>How do I reference the array?alert("pushing the key as: " + setValuesArray[key] + " and value as: " + setValuesArray[key].value); is not correct..</p> <p>thanks</p>
javascript
[3]
4,085,330
4,085,331
Printing a word every X seconds
<p>I just started learning how to use interfaces and I was trying to figure out how to print a particular word (in this case "Howdy") every 10 seconds. I used the <code>TimerTask</code> and <code>Timer</code> classes in order to schedule my task to run every 10 seconds, but am I doing it the right way?</p> <pre><code>import java.awt.event.*; import javax.swing.*; import javax.swing.Timer; import java.util.*; public class Howdy2 { class PrintHowdy extends TimerTask { public void run() { System.out.println("Howdy!"); } } public static void main(String[] args){ Timer timer = new Timer(); timer.schedule(new PrintHowdy(), 10000); } } </code></pre>
java
[1]
3,500,760
3,500,761
call back function inside onButton click
<p>I have a gui application that passes a "Connect" callback function to an API function inside of a class library, I need to access that callback function inside of an event handler. Here is what I got so far:</p> <p>Gui:</p> <pre><code> public bool ConnectI2CFn(int selected_index) { return true; } Interface.RegisterInterface(IFaceType.I2C, i2cCfg, I2COptions, ConnectI2CFn); </code></pre> <p>.DLL:</p> <pre><code> public void RegisterInterface(IFaceType iface, object iface_config, int options, Func&lt;int,bool&gt;Connect, Func&lt;int,bool&gt;Disconnect) { //Test if (Connect(cboAddress.SelectedIndex)) { MessageBox.Show("Connect"); } if (Disconnect(cboAddress.SelectedIndex)) { MessageBox.Show("Disconnect"); } switch (iface) { case IFaceType.I2C: I2CConfig i2cCfg = (I2CConfig)iface_config; i2cCfg.Type = IFaceType.I2C; cboInterface.Items.Add(i2cCfg.InterfaceName); CreateListOfInterfaces(i2cCfg,i2cCfg.Type); break; case IFaceType.UART: UARTConfig uartCfg = (UARTConfig)iface_config; uartCfg.Type = IFaceType.UART; cboInterface.Items.Add(uartCfg.InterfaceName); CreateListOfInterfaces(uartCfg, uartCfg.Type); break; case IFaceType.DISEQC: DISEQCConfig diseqcCfg = (DISEQCConfig)iface_config; diseqcCfg.Type = IFaceType.DISEQC; cboInterface.Items.Add(diseqcCfg.InterfaceName); CreateListOfInterfaces(diseqcCfg, diseqcCfg.Type); break; } if(options == 1) { cboInterface.SelectedIndex = cboInterface.Items.Count - 1; ChangeInterface(iface, cboInterface.SelectedIndex); } } private void btnConnect_Click(object sender, EventArgs e) { } </code></pre> <p>This is my first time writing call back functions, I am not sure if I did it right.</p>
c#
[0]
4,088,305
4,088,306
problem while using extern variable
<pre><code>//FILE 1 char *ptr="Sample"; void SomeFunction() { cout&lt;&lt;ptr&lt;&lt;endl; } //FILE 2 void SomeFunction(); int main() { extern char ptr[]; SomeFunction(); cout&lt;&lt;ptr&lt;&lt;endl; } </code></pre> <p><code>ptr</code> in the main function is printing some garbage value. please let me know the reason.</p>
c++
[6]
2,762,080
2,762,081
Canvas: clear rect but keep the rest of the content
<p>I want to draw some text onto my canvas and want to clear everything which was drawn out of a specific area (area defined by a Rect). </p> <p><img src="http://i.stack.imgur.com/47X6p.png" alt="enter image description here"></p> <p>I draw the magenta-Text and want to clear everything in the grey and keep everything in the white box. I got the white area as a rect.</p>
android
[4]
3,499,375
3,499,376
how to read value from UITextFiled
<p>i am making a temperature converter as iphone application can someone help me that how can i read a value entered in textfield of iphone through keyboard for conversion</p>
iphone
[8]
4,905,263
4,905,264
JQUery validation plugin for checking data availability
<p>I am learning how to use JQuery validation plugin, I got a simple input text field like this:</p> <pre><code>&lt;input type="text" name="username"&gt; </code></pre> <p>But I don't know how to use this plugin to do some data availability tasks.</p> <p>Could you help me please?</p>
jquery
[5]
3,358,263
3,358,264
Clickable panel problem
<p>How to implement something like this in android ?</p> <p><img src="http://i.stack.imgur.com/AWsim.png" alt="enter image description here"></p> <p>There are three different panels ( I need one to implement), I will have matrix of this stuffs, so I need first to figure out how to draw one . I need to implement panel (not popup) which react on click and which contains three smaller panels 1st type ( O or F ), second id ( and change color ) and third name. I know this implement in Java easy but how in android ?</p>
android
[4]
1,788,765
1,788,766
How to Access Database on Android Emulator Device
<p>I'm developing an Android application and using SQLite. </p> <p>I would like to access the database and run some SQL queries on the emulator handset for debugging purpose. How to do this?</p>
android
[4]
2,949,284
2,949,285
Parsing all files(doc/docx) from a directory one by one to a program C++
<p>I'm new to C++ and programming; and lately have to work with C++ and my knowledge is quite limited. Any help would be appreciated </p> <p>I'm trying write a code in C++ to Parse (doc/docx) files from a directory (1 by 1 ) ; let say "Desktop" to a program that takes file as an input </p> <p>1) search the selected directory for DOC/DOCX file(s)</p> <p>2) Parse the file(s) one by one into a program (lets call it : Converter which will output as a .txt file) from the selected directory </p> <p>3) call : system("converter.exe (x).doc > (x).txt") ; file(s) get parse into converter.exe</p> <p>where (x) is the file's name and will changed every time a file get parse into the converter eg. </p> <p>first round : system("converter.exe doc1.doc > doc1.txt")</p> <p>Second round : system("converter.exe somedocx2.doc > somedocx2.txt")</p> <p>Thanks</p>
c++
[6]
5,559,715
5,559,716
how can i find my .net frame work version
<p>how can i find the version of my .net frame work</p>
asp.net
[9]
2,537,282
2,537,283
storing value Turbo C++
<p>I am currently trying to get my program to store a value so that it can display that value whenever there is an error. Here is my program :</p> <pre><code>void function() { float abc[2]; int i = 0; if ( i/2 != 0 ) { i++; abc[0] = 1; } abc[1] = abc[0]; cout &lt;&lt; abc[1]; } </code></pre> <p>Practically, my program keeps calling this function until I exit it, so it will keep updating my program and show me <code>abc[1]</code>. What I want is when the condition of the <code>if</code> statement is not met, <code>abc[1]</code> will display the previously known value of itself. How do I do it?.</p>
c++
[6]
4,837,816
4,837,817
JQuery Update text in a select dropdown list
<p>I am trying to update the text of one of the options on a select dropdown after an action on my page. Does anyone know how to do this in jquery? I have tried this:</p> <pre><code>$("#selectid").text("newtext"); </code></pre> <p>But that will remove all of the other options in the select list and it makes it blank. I know this is not the right approach because I just want to update one of the option values. Thanks for the help</p>
jquery
[5]
4,869,756
4,869,757
PHP array function that matches this foreach loop
<p>PHP have all sort of built in array functions. So I'm wondering if there is a function that is equivalent to the foreach loop in this code.</p> <pre><code>$args = array('var1', 'var2'); $args2 = array('var3', 'var4', 'var5', 'var6'); foreach ($args2 as $arg) { $args[] = $arg; } </code></pre>
php
[2]
3,906,542
3,906,543
Checking if CheckBoxList has any selected values
<p>I would like to know the fastest/easiest way to check if a CheckBoxList control has any checked items or not, I'm talking about an entire checkbox list as a whole, not a single checkbox.</p>
asp.net
[9]
2,092,953
2,092,954
Android URL fetch and parse from sample - error
<p>I'm trying a simple example : <a href="http://www.vogella.com/articles/AndroidJSON/article.html" rel="nofollow">http://www.vogella.com/articles/AndroidJSON/article.html</a></p> <p>But got an error .. Can anyone tell me why I get this error : <a href="http://puu.sh/1mGz1" rel="nofollow">http://puu.sh/1mGz1</a></p>
android
[4]
4,296,327
4,296,328
How to set style(small and large) to Button programmable way?
<p>How to set style(small and large) to Button programmable way ?</p> <p>Is it possible ? </p> <p>I can set the style to the Button from xml resource (like styte= ?android:attr/buttonStyleSmall). But I don't know how set it programmable way.</p> <p>Thanks in advance. </p>
android
[4]
5,184,368
5,184,369
Why does C style cast allow you to convert to a private base class?
<p>Say we have this code</p> <pre><code>class A { public: A() : x(1) {} virtual ~A() {} int x; }; class B { public: B() : y(2) {} virtual ~B() {} void g() { cout &lt;&lt; "B::" &lt;&lt; y &lt;&lt; endl; } int y; }; class C : private A, private B { public: void f() { B* p = static_cast&lt;B*&gt;( this ); p-&gt;g(); } }; int main() { C c; ((B*)&amp;c)-&gt;g(); return 0; } </code></pre> <p>The C style cast in the main function cannot be correctly expressed in terms of the C++ casts (<code>static_cast</code>, <code>dynamic_cast</code>, <code>reinterpret_cast</code>). But what is the reason to allow this in the first place? Doesn't it hurt encapsulation?</p>
c++
[6]
5,038,325
5,038,326
android video playback
<p>I'm new to android. Can anyone help me how to display images from the Sd Card or play videos from Sd Card.. I tried it many ways but none of it is working..</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /&gt; &lt;VideoView android:id="@+id/videoView1" android:layout_width="243dp" android:layout_height="234dp" /&gt; &lt;/LinearLayout&gt; </code></pre>
android
[4]
3,511,795
3,511,796
splitting of xml file using c#
<p>I am using c# and am creating xml from an external data source and saving the xml as a single xml file. How can I split the xml up and save it as multiple xml files? For example, say there are 263 records in my xdocument xml. I need to split that into multiple xml files containing exactly 25 records. (That's the specs - no way around it.) So, for this example, I'd end up with 11 xml files.</p> <p>My data source is a XML file , and I have the option of splitting that into chunks of 25 records per XML file, if that is easier. How would I approach doing it that way?</p>
c#
[0]
819,604
819,605
Is using strings this way inefficient?
<p>I am a newbee to c++ and am running into problems with my teacher using strings in my code. Though it is clear to me that I have to stop doing that in her class, I am curious as to why it is wrong. In this program the five strings I assigned were going to be reused no less than 4 to 5 times, therefore I put the text into strings. I was told to stop doing it as it is inefficient. Why? In c++ are textual strings supposed to be typed out as opposed to being stored into strings, and if so why? Below is some of the program, please tell me why it is bad.</p> <pre><code> string Bry = "berries"; string Veg = "vegetables"; string Flr = "flowers"; string AllStr; float Tmp1, Precip; int Tmp, FlrW, VegW, BryW, x, Selct; bool Cont = true; AllStr = Flr + ", " + Bry + ", " + "and " + Veg; </code></pre>
c++
[6]
461,393
461,394
jQuery objects, getting element value from a parent attr?
<p>This code:</p> <pre><code>$el.parent().html() </code></pre> <p>Writes out as: </p> <pre><code>&lt;input type="checkbox"&gt; &lt;span&gt;Finish This&lt;/span&gt; </code></pre> <p>If I want to get the value of the span in the parent attribute how do I do this?</p> <p>I've tried this:</p> <pre><code> $el.parent().html().$('span').val() </code></pre> <p>or:</p> <pre><code> $el.parent().$('span').val() </code></pre> <p>And other things to that effect, but I can't seem to get the value of the span. I'm guessing there is a problem with how I'm thinking the objects work in jQuery, or is it a simple solution to this?</p> <p>Is it a function I'm missing?</p>
jquery
[5]
4,682,233
4,682,234
PHP - why doesn't count() work like strlen() on a string?
<p>A string is an array of characters, correct? If so, then why does <code>count()</code> not produce the same result as <code>strlen()</code> on a string?</p>
php
[2]
2,044,102
2,044,103
Login page first before being able to download a file
<p>I am new to ASP.NET and web application developing. What I'm trying to implement is, I am storing a file on the web server and is supposed to give the link of the file to the user for them to download the file. The link and the "downloading" process is easy but I wanted to make it more secure like having the link go through the login page, then the user will enter his/her credentials, if success, then the file will be automatically downloaded.</p> <p>Does anyone know how where should I start or what is the name of this kind of method/processing for me to be able to start my research.</p> <p>Thanks.</p>
asp.net
[9]
644,816
644,817
getResources().getIdentifier problem
<p>In one activity, there are 1 text view and 1 image view. I have to display number of data for different images. I have stored the data in string-array in strings.xml. My code is working fine for them. Problem is with images. I have stored images in R.raw folder. How can I get the images in image view so that for every data corresponding images can be displayed.</p> <p>In the listactivity(where the data are displayed in a listview i have added async task and in doinbackground i am loading values from these arrays ). I am stuck in images. How to do that? pls help...</p> <p>started like this,</p> <pre><code>int image[]= {getResources().getIdentifier("aa", "raw", getPackageName()), getResources().getIdentifier("bb", "raw", getPackageName()), getResources().getIdentifier("cc", "raw", getPackageName()),}; </code></pre> <p>Pls reply.. Many Thanks </p>
android
[4]
4,005,536
4,005,537
How to return to main activity after being three activities down?
<p>My app has four activities; MainActivity, ListActivity1 (L1) , ListActivity2 (L2), ListActivity3 (L3). From Main, the user goes down to L1 by clicking a button. After selecting an item in L1, user comes to L2 and then L3 after selecting an item in L2. In L3, when selecting an item a Yes/No-toast is launched. If user selects "No", user stays on L3. If user selects "Yes", user returns way back to Main.</p> <p>Here's the question: If the user selects "yes" taking him to Main and pressing Back button, he returns to L3. What I want is that if the user has walked down to L3, selected yes and returned to Main, pressing Back should take him to Home screen. I.e. I want to delete the "back trace" to L3.</p> <p>How do I accomplish this?</p> <p>(Main and the ListActivities starts the new activity with <code>startActivity(new Intent(foo, Bar.class))</code>)</p>
android
[4]
1,304,280
1,304,281
how to change default orange color when press button any one tell me
<p>how to change the default color orange when tyoping text in edittext field or press button how that color will change? any help?? this is my xml below when i run this code default orange color is appear on border of edittext and when pressing button</p> <pre><code> &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="#ffffff"&gt; &lt;TextView android:id="@+id/txtEnterPinForTransaction" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /&gt; &lt;TextView android:id="@+id/lblPinno" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /&gt; &lt;EditText android:id="@+id/txtPinno" android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" android:inputType="textPassword" /&gt; &lt;Button android:id="@+id/btnsubmit" style="?android:attr/buttonStyleSmall" android:layout_width="80dp" android:layout_height="wrap_content" android:text="Submit" /&gt; &lt;Button android:id="@+id/clearButton" style="?android:attr/buttonStyleSmall" android:layout_width="80dp" android:layout_height="wrap_content" android:text="Clear" /&gt; &lt;Button android:id="@+id/btngoback" style="?android:attr/buttonStyleSmall" android:layout_width="80dp" android:layout_height="wrap_content" android:text="Go Back" /&gt; </code></pre> <p></p>
android
[4]
5,937,275
5,937,276
jquery change() alert fires 6 times for one click?
<pre><code>jQuery(document).ready(function($) { $('.c5sliderSelect').change(function() { alert('change clicked'); }); }); </code></pre> <p>When I change the select list item, I get 6 alerts. Not sure why. I only have one element in the markup with this classname and the select list has 10 option items.</p> <p>Any ideas why the alert fires more than once for a single change event?</p> <p>Markup:</p> <pre><code>&lt;select class="c5sliderSelect" title="Note: only categories which have posts assigned are listed here"&gt; &lt;option value=""&gt;Custom Text&lt;/option&gt; &lt;option value="164"&gt;Blog (10)&lt;/option&gt; &lt;option value="8"&gt;Digital Cameras (3)&lt;/option&gt; &lt;option value="9"&gt;GPS Systems (1)&lt;/option&gt; &lt;option value="7"&gt;Healthy Herbal Teas (1)&lt;/option&gt; &lt;option value="93"&gt;hidden (1)&lt;/option&gt; &lt;option value="20"&gt;iPhone 4s (2)&lt;/option&gt; &lt;option value="5"&gt;Samsung Galaxy (5)&lt;/option&gt; &lt;option value="4"&gt;Smart Phones (5)&lt;/option&gt; &lt;option value="1"&gt;Uncategorized (7)&lt;/option&gt; &lt;/select&gt; </code></pre> <p><em><strong>What I'm trying to do here is to hide an unrelated div when the selected item's value is ""</em></strong></p>
jquery
[5]
4,124,677
4,124,678
Dispatch events to child
<p>I have a ListView containing items with one button each and I want to handle user events in this order:</p> <ol> <li>TouchEvent on <em>ListView</em>.</li> <li>TouchEvent on <em>ListItem</em>.</li> <li>Click on Button inside <em>ListItem</em>.</li> </ol> <p>How can I do this?</p>
android
[4]
1,222,917
1,222,918
Pop-Up Window on Parent Window from iFrame Button
<p>If I have a button within a iframe, how can I create a pop-up window that will appear as part of the parent window and not within the iframe window, when I press on this button, within the iframe?</p> <p>Thanks. Tony.</p>
javascript
[3]
4,960,336
4,960,337
Split a string only the at the first n occurrences of a delimiter
<p>I'd like to split a string only the at the first n occurrences of a delimiter. I know, I could add them together using a loop, but isn't there a more straight forward approach?</p> <pre><code>var string = 'Split this, but not this'; var result = new Array('Split', 'this,', 'but not this'); </code></pre>
javascript
[3]
4,851,453
4,851,454
using Threadpool.QueueWorkItem in Asnychronous Handler
<p>This MSDN <a href="http://msdn.microsoft.com/en-us/library/ms227433.aspx" rel="nofollow">example</a> for an Asynchronous Handler starts the new thread using ThreadPool.QueueUserWorkItem.</p> <p>I thought that you should not use ThreadPool.QueueUserWorkItem to start the new thread as the thread is taken from the ASP.net thread pool and defeats the purpose of using an Asynchronous handler.</p> <p>Is the example wrong? </p>
asp.net
[9]
4,559,578
4,559,579
jQuery - detect mouse out of new element
<p>I've built a menu using jQuery which shows a new element fading in when the user hovers the mouse over the element and fades it out when they move the mouse away. Now, I've moved the element up so it covers the original element which is causing the problem that the second hover event is triggered when the new element is placed over the top. What would be the best method to ignore the new element and only fade out once the mouse has moved out of the bound of the original element?</p> <p>Here's the code:</p> <pre><code>$('#menuitem').hover(function() { $('#menu').append('&lt;span id="hover_'+$(this).attr('rel')+'" class="hover"&gt;&lt;/span&gt;'); }, function() { $('#hover_'+$(this).attr('rel')).fadeOut(function(){$(this).remove();}); }); </code></pre> <p>Now, the <code>#menu</code> item is a anchor with some text in it, when the mouse is over it, a new element (<code>.hover</code>) should appear on top and should fade out once the mouse leaves the original menu item.</p> <p>What's currently happening is that the new element appears and fades out immediately as the second hover function is triggered when the new item is added on top of the original anchor.</p> <p>Thanks, J</p>
jquery
[5]
1,976,994
1,976,995
code help for stored procedure dll class
<p>i m making dll class for stored procedure as...help me to correct it...my boss said that i m missing parameter values to return but i m not getting anything to correct it...</p> <pre><code>public class transactionService { SqlConnection cs; private void OpenConnection() { cs = new SqlConnection(); cs.ConnectionString = "Data Source=IRIS-CSG-174;Initial Catalog=library_system;Integrated Security=True"; cs.Open(); } public membership_details calculatefine() { OpenConnection(); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "Exec member_fine_detail"; cmd.Parameters.Add(new SqlParameter("member_id", SqlDbType.Int)); membership_details myObjec = new membership_details(); cmd.ExecuteNonQuery(); SqlDataReader sdr = cmd.ExecuteReader(); myObjec.fine_per_day = 0; return myObjec; </code></pre> <p>help me to correct this code...i m trying to get fne_per_day as per member_id and after this reference is adding to return form in project from that according to member_id fine_per_day is calculated...as the creteria is like member_id=5,membership_desc=silver,gol,platinum,fineperday=30or 20or10</p>
c#
[0]
587,358
587,359
Show TextView when pulling down a ListView
<p>I'm not sure if this is possible but I want to show a TextView that would be on top of a ListView but not shown, when I pull down the ListView the TextView reveals itself, if I let go the TextView hides again. Any help is appreciated.</p>
android
[4]
4,402,636
4,402,637
Location based messaging
<p>Im doing a project on location based services, in which i have the following conditions Set Location manually ( With a radius )</p> <p>On reaching that location i need to trigger SMS activity</p> <p>please tell how to go about doing this.</p>
android
[4]
1,701,932
1,701,933
jQuery, do something while form is posting or in action
<p>I got the following form:</p> <pre><code>&lt;form name="x" method="post" action="/message.jsp" onsubmit="validate(this)"&gt; &lt;input type="button" name="Export" value="Export" onclick="this.form.action='ReportExecute.jsp';this.form.submit();"&gt; &lt;/form&gt; </code></pre> <p>What I want to do is, I am trying to do something (like displaying an spinner or disabling button) when the export button is cliecked (this button create a csv file to be downloaded eventually after loading some specific data which is specified in the form fields) until the form action (which is exporting data) or form post is finished.</p> <p>What I did was something like this:</p> <pre><code>$(document).ready(function(){ $('form[name="x"]').submit(function() { alert("test"); }); }); </code></pre> <p>I expected to get the alert when I click the export button since the form does some actions by clicking this button, But it never worked! as if the form does not post anything at all!</p> <p>Would be grateful for some help . thanks</p>
jquery
[5]
3,778,904
3,778,905
Can I check if e-mail address is valid?
<p>How can I implement following logic?</p> <ul> <li><p>User registers with an e-mail address</p></li> <li><p>If provided e-mail address is a valid email address Then user account get's activated</p></li> <li><p>or if it is a fake email then user account is not activated</p></li> </ul> <p>I doubt that I can catch the - "Delivery failed reply message", right? anyhow how would you suggest to implement the above logic? </p> <p>PS. I will have to find a way no matter what, client wants it =)</p>
php
[2]
1,823,720
1,823,721
error: missing } in xml expression for exeternal javascript?
<p>I write external js and write JSON string in js file want to parse main html file's js tag but it gives like</p> <p><code>**error: missing } in xml expression**</code></p>
javascript
[3]
213,114
213,115
NSString to NSArray
<p>i get the following value as a string format.</p> <pre><code> getcommands=( { "created_time" = "2011-01-18T10:44:14+0000"; from = { id = 100001511725982; name = "ABC Welcomes U"; }; id = "100001511725982_158433587542247_1658635"; message = Nice; }, { "created_time" = "2011-01-18T10:44:22+0000"; from = { id = 100001511725982; name = "ABC Welcomes U"; }; id = "100001511725982_158433587542247_1658637"; message = "Gud One"; } ) </code></pre> <p>Now, i need to get ""Message"" only from this string. </p> <p>Please any one knows the code please help me.</p> <p>Thanks.</p>
iphone
[8]
3,888,096
3,888,097
subdomain with rewriteModule
<p>hi i'm using this rule for rewriting subdomain</p> <p> </p> <p>and i'm corrected host file to</p> <p>127.0.0.1 domain.net</p> <p>when user typed news.domain.net/default.aspx it must return domain.net/news/default.aspx but browser showed Address not found.</p> <p>how do i?</p> <p>please help</p> <p>thanks all</p>
asp.net
[9]
3,400,098
3,400,099
Android third party GUI widget vendors
<p>In my MFC user interface programming days you could purchase all kinds of cool screen widgets from 3rd party vendors to integrate into your Visual Studio and use in creating your screens. Fancy buttons, meters, control knobs, etc... I can't seem to find anyone doing that for Android. Does anyone know of any vendors selling stuff like that for programmers to use in Android projects?</p> <p>Thanks!</p>
android
[4]
3,142,545
3,142,546
How to change this code?
<pre><code>#include &lt;iostream&gt; #include &lt;string.h&gt; // for strlen #include &lt;stdlib.h&gt; // for atoi #include &lt;sstream&gt; void expand_combinations(const char *remaining_string, std::ostringstream&amp; i, int remain_depth) { if(remain_depth==0) { std::cout &lt;&lt; i.str() &lt;&lt; std::endl; return; } for(int k=0; k &lt; strlen(remaining_string); ++k) { std::ostringstream l; l &lt;&lt; i.str(); l &lt;&lt; remaining_string[k]; expand_combinations(remaining_string+k+1, l, remain_depth - 1); } return; } int main(int argc, char **argv) { std::ostringstream i; if(argc&lt;3) return 1; expand_combinations(argv[1], i, atoi(argv[2])); return 0; } </code></pre> <p>How can this code be changed so that it doesn't use ostringstream?</p>
c++
[6]
1,179,880
1,179,881
Add HTML element after text
<p>I am looking for a way to add an HTML element using JavaScript. But the problem is that the new element might be in between some text. In all other cases I'm using the insertBefore() method.</p> <p>I am using the following function to get the cursor position. My initial approach was to split the target innerHTML and add the necessary tags but the cursor position provided does not take into account the character conversions such as space to <code> &amp;nbsp;</code>. So if there are multiple continous spaces, the cursor position will not give the coreect position int he innerHTML.</p> <pre><code>function getCursorPos() { var cursorPos=-1; if (window.getSelection) { var selObj = window.getSelection(); var selRange = selObj.getRangeAt(0); cursorPos = findNode(selObj.anchorNode.parentNode.childNodes, selObj.anchorNode) + selObj.anchorOffset; /* FIXME the following works wrong in Opera when the document is longer than 32767 chars */ } else if (document.selection) { var range = document.selection.createRange(); var bookmark = range.getBookmark(); /* FIXME the following works wrong when the document is longer than 65535 chars */ cursorPos = bookmark.charCodeAt(2) - 11; /* Undocumented function [3] */ } return cursorPos; } function findNode(list, node) { for (var i = 0; i &lt; list.length; i++) { if (list[i] == node) { return i; } } return -1; } </code></pre> <p>Is there any other method to do this? The new element may be in the middle of the HTML ie, it may not be always at the end.</p> <p>Thank You</p>
javascript
[3]
134,648
134,649
Simple condition that returns true if document.activeElement = ""
<p>I need to know if the selected element has an ID. </p> <p>What am I doing wrong?</p> <pre><code> var selected = document.activeElement; if (selected.id = "") { document.getElementById('test3').innerHTML= "is blank"; } </code></pre> <p>Thanks</p>
javascript
[3]
4,903,644
4,903,645
Parse html from loadHTML, how to loop through cols?
<p>I'm trying to parse HTML from loadHTML but I'm having trouble, I managed to loop through all <code>&lt;tr&gt;</code>s in the document but I don't know how to loop through the <code>&lt;td&gt;</code> s on each row.</p> <p>This is what I did so far:</p> <pre><code>$DOM-&gt;loadHTML($url); $rows= $DOM-&gt;getElementsByTagName('tr'); for ($i = 0; $i &lt; $rows-&gt;length; $i++) { // loop through rows // loop through columns ... } </code></pre> <p>How can I get loop through the columns in each row?</p>
php
[2]
4,688,496
4,688,497
Want java code for calculating time between various logs
<pre><code>[Tue Jun 21 16:09:27.530 2011] request_suspend_state: sleep (0-&gt;3) at 263958221465 (2000-01-01 00:04:22.124816866 UTC) [Tue Jun 21 16:09:27.530 2011] WARNING omaplfb (OMAPLFBPresentSync 235): Unable to sync with display 1! [Tue Jun 21 16:09:27.530 2011] stop_drawing_early_suspend: timeout waiting for userspace to stop drawing [Tue Jun 21 16:09:27.530 2011] WARNING omaplfb (OMAPLFBPresentSync 235): Unable to sync with display 1! [Tue Jun 21 16:09:27.530 2011] PM: Syncing filesystems ... done. [Tue Jun 21 16:09:27.545 2011] PM: Preparing system for mem sleep [Tue Jun 21 16:09:27.545 2011] Freezing user space processes ... (elapsed 0.02 seconds) done. </code></pre> <p>This is a log file which contains day,time. I want to calculate time between any two lines. Kindly help me in this.</p>
java
[1]
1,357,701
1,357,702
Am I failing to follow the standard?
<p>If I have something like this:</p> <pre><code>MyStruct clip; clip = {16, 16, 16, 16}; </code></pre> <p>I get the following warning from the compiler: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x</p> <p>If I active -std=c++0x in the compiler, it does not give any warning. But I'm not sure if I am following the standard. So should I deactivate that flag and initialize each member of the structure separately?</p> <p>Thank you.</p>
c++
[6]
470,517
470,518
Why does iterating over jQuery objects with .each() not give me jQuery objects?
<p>The following works as expected:</p> <pre><code>$(".foo").first().text("hi!") </code></pre> <p>...because <a href="http://api.jquery.com/first/" rel="nofollow"><code>first()</code></a> returns a jQuery object.</p> <p>However, if I want to work with the <a href="http://api.jquery.com/text/" rel="nofollow"><code>text()</code></a> method for all matches, I need to do:</p> <pre><code>$(".foo").each( function(idx, obj) { $(obj).text("hi!") } ) </code></pre> <p>...because <a href="http://api.jquery.com/each/" rel="nofollow"><code>each()</code></a> gives you DOM objects.</p> <p>What is the design reason behind this baffling difference? How can I avoid having to build a jQuery object for each match?</p>
jquery
[5]
1,917,655
1,917,656
Android Background Service with Task Queue
<p>My app needs a background service, where I can submit tasks to. The tasks can be quite generic, it might involve downloading feeds, fetching location one time, or fetching resources.This service needs minimal interaction from the activities and it should be started when the app launches and should quit if there is no pending task in the queue.</p> <p>Is it a good idea? How would I design such a service? All suggestions are welcome</p>
android
[4]
1,238,043
1,238,044
How can mute the audio recorder sound and donot affect the visualizer in android
<p>I developing audio recorder application.I want to display visualizer for audio recorder.In android ginger bread audio recorder have no <strong>Sessionid()</strong> method.So pulling audio recorder buffer data into audio tracker to play and show visualizer.how can mute the audio tracker sound without affecting visualizer. <strong>OR</strong> I'm thinking wrong directions??</p>
android
[4]
5,849,661
5,849,662
string replace vowels in python?
<p>Expected:</p> <pre><code>&gt;&gt;&gt; removeVowels('apple') "ppl" &gt;&gt;&gt; removeVowels('Apple') "ppl" &gt;&gt;&gt; removeVowels('Banana') 'Bnn' </code></pre> <p>CODE (Beginner):</p> <pre><code>def removeVowels(word): vowels = ('a', 'e', 'i', 'o', 'u') for c in word: if c in vowels: res = word.replace(c,"") return res </code></pre> <p>How I do both lowercase and upercase?</p>
python
[7]
685,268
685,269
How to handle multiple checkboxes in a PHP form?
<p>I have multiple checkboxes on my form:</p> <pre><code>&lt;input type="checkbox" name="animal" value="Cat" /&gt; &lt;input type="checkbox" name="animal" value="Dog" /&gt; &lt;input type="checkbox" name="animal" value="Bear" /&gt; </code></pre> <p>If I check all three and hit submit, with the following code in the PHP script:</p> <pre><code>if(isset($_POST['submit']) { echo $_POST['animal']; } </code></pre> <p>I get "Bear", i.e. the last chosen checkbox value even though I picked all three. How to get all 3?</p>
php
[2]
2,661,561
2,661,562
get specific value from file_get_content
<p>hi i need to get specific content from the file get content but the problem is if i made a function which determine the content of a page and when i call this function in a loop (means more than 200 times) than memory limit problem occur . i have resolve this problem by increase the memory limit by ini_set . My Question is that how can i increase the performance of this function.should i use ob_flush after reading the content or there is another way .please let me know . thnks </p>
php
[2]
2,512,420
2,512,421
miminum height and width of a div
<p>I have a re-sizable and drag able div in my page I want to restrict users to re size the DIV to a fixed minimum width or height and cannot resiz more than that.</p> <p>i did try it using the following code but it did not help. please guide me to solve this.</p> <pre><code>$("#dv_move").resizable({ resize: function () { var t = $(this); if (parseInt(t.width()) &lt; 300 || parseInt(t.height()) &lt; 150) return false; } }); </code></pre>
jquery
[5]
1,553,646
1,553,647
Convert tree data structure from Database into JSON in Java
<p>We have a database that has the child_id, parent_id and the other details for each row of a tree in the database. I am looking for a best method to read the data from the database recursively and create the JSON not knowing how deep the child items run under each root node. Also is there something that helps create the JSON without having to write the syntax of JSON manually in the program? Thanks in advance for any pointers.</p>
java
[1]
2,767,883
2,767,884
Download audio file from non direct link
<p>i want to implement a download manager</p> <p>lets say there is a form with post method on a site,after clicking the submit button the site will send the post data to its server and a download should start with the content of the response of the form so what i want is how do i download the data after the user clicks the submit button</p> <p>any help thanks</p>
iphone
[8]
3,408,607
3,408,608
How can I do something like this - loop thru an indefinite set of numbers
<p>I'm trying to loop tru a set of numbers based on the initial number. Tried, but cant see a good way to achieve this. The thing goes inside a while loop.</p> <pre><code>&lt;?php $this = 1; //If 1 then 1,4,7 //If 2 then 3 //If 3 then 10 while ( //mySql while loop ) { if ( $this == 1 ) { call example() //thrice for 1, 4, 7 } } function example($a) { echo $a+10; } ?&gt; </code></pre> <p>Here, based on what <code>$this</code> is, I need to call function example. So if <code>$this = 1</code>, I need to call <code>example</code> thrice - <code>$a</code> value <code>1, 4, 7</code>. If <code>$this = 2</code> I need to call it once, value <code>3</code>.</p> <p>What would be a good way to achieve this?</p>
php
[2]
2,896,836
2,896,837
Dispose C# DLL marked for COM interop
<p>I created a vanilla C# dll and marked it for COM inter op. The dll is a plain user form with no functionality as this is an experiment. </p> <p>I registered the DLL and opened active x test container and instantiated my COM object. It shows up in the test container and i can view the exposed methods of the control - these are the default methods and not created by me.</p> <p>i then exit from the active x test container and i noticed that test container was still lurking around in task manager and that i had to kill the process manually. This leads me to believe that the test container still holds a reference to my C# dll exposed for com inter op. </p> <p>The default dispose method in the designer.cs is</p> <pre><code> protected override void Dispose(bool disposing) { if (disposing &amp;&amp; (components != null)) { components.Dispose(); } base.Dispose(disposing); } </code></pre> <p>When i used the test container with Quick time, it invoked quick time as expected and when i closed the test container it disposed correctly and did not leave a footprint in the task manager.</p> <p>The question - is there a specific thing that i must do in my dispose method? Also, this may not be relevant, but when i create a test project and it launches my c# control and i click on the close button, it closes my test form but the test application ins still running in debug mode - the run button is disabled.</p>
c#
[0]
5,833,187
5,833,188
NameValueCollection for editing query strings
<p>If I call </p> <pre><code>var nvc = HttpUtility.ParseQueryString("?foo=bar&amp;baz=robots") </code></pre> <p>I get back a NameValueCollection where if I call ToString on it, I get back a query string.</p> <pre><code>var str = nvc.ToString(); //foo=bar&amp;baz=robots.... </code></pre> <p>If I create a new NameValueCollection, add stuff to it, and call ToString() on it, I don't get back a query string.</p> <pre><code>var nvc= new NameValueCollection(); nvc["foo"] = "bar"; var str = nvc.ToString(); //default for Object.ToString() </code></pre> <p>Also there doesn't seem to be a way to construct a NameValueCollection that acts as a query string editor. Is there one? If not, why? Being able to edit query strings is a pretty useful thing, but this functionality is totally hidden away in an obscure mode of some object most people don't even know exists.</p>
asp.net
[9]
2,919,768
2,919,769
JavaScript dynamically getting the names
<pre><code>&lt;TD class="small" width="13%"&gt; &lt;input type="text" id="gardes" name="Names$Dynamic${$Index}$tract$" maxlength="14" style="width:98%" value="{./@tract}"&gt; &lt;/input&gt; &lt;/TD&gt; &lt;TD class="small" width="12%"&gt; &lt;input type="text" id="gradesfar" name="Names$Dynamic${$Index}$TractFild$" maxlength="14" onchange="validate(this,gardes)" style="width:98%" value="{./@TractFild}"&gt; &lt;/input&gt; &lt;/TD&gt; </code></pre> <p>Inside <code>validate(this,gardes)</code> function I want to check which one is greater out of these 2 textboxes.</p> <p>How do I write the javascript code?</p> <p>The problem is, the value of index is dynamic it will be keep changing. With the index if I try it will be always constant. In my case for first instance.</p> <p>Confusing? Just tell me how I can validate less than or greater than between the values of these two inputs.</p>
javascript
[3]
2,234,289
2,234,290
when does JS/jQuery statement gets executed which is not part of jquery doc/window handlers
<p>I have following jquery code in client side JS</p> <pre><code>// Following gets executed at document.ready() time $(function() { prepareCurList(); }); // When does the following code gets executed as its just a plain JS statement??? prepareNextList(); </code></pre> <p>Please provide pointers.</p>
jquery
[5]
6,023,143
6,023,144
CountDownTimer runs in old Activity when switching Activities
<p>I have a CountDownTimer, which needs to run all the time. There are 2 Activities (A and B). Activity A has the CountDownTimer, which updates a TextView inside it. When I switch to B, the CountDownTimer still runs (it is the desired behavoir), but when I switch back to A, there seems to be an old and a new A. The timer does not update a TextView inside of the "new" A. It is started only once when A is first visited. Any ideas of how to solve this problem? Maybe put the timer somewhere else?<br> <strong>Edit:</strong> Some code: </p> <pre><code>private void prepareTimer() { // TODO: DOES NOT WORK YET! (switching activities -&gt; runs in old activity) textTime = (TextView) findViewById(R.id.text_time); // is a field if (!timerRunning) { timerRunning = true; int duration = 60000; timer = new CountDownTimer(duration, 1000) { public void onTick(long millisUntilFinished) { long minsLeft = (long) Math.floor((double) millisUntilFinished / (double) Constants.ONE_MINUTE) + 1; textTime.setText(minsLeft + " Min."); } public void onFinish() { textTime.setText("done!"); } }; timer.start(); } } </code></pre>
android
[4]
2,025,687
2,025,688
How to avoid data lose when UIImagePickerController unloads my controller?
<p>I am using UIImagePickerController to take a photo from the camera. However, the I find that randomly my calling controller (the one that is shown before the UIImagePickercontroller is shown) gets unloaded. I logged the viewDidUnload, and indeed it does get called. When the camera is done and dismissed, my controller's viewDidLoad will be called, unfortunately all the state is now gone. Things like text entered or things selected will be gone. </p> <p>Obviously this is something to do with running out of memory. But is this behavior normal? Should I be handling it? This is NOT typically how modalViewController works. Usually you show it and dismiss it, everything should be intact. </p> <p>What is a good way to avoid data lost in this case? Should I have to write a bunch of code to save the full state?</p>
iphone
[8]
4,190,980
4,190,981
Animation 2D Graphics and Drawing on Canvas
<p>In first, sorry for my language.</p> <p>I have two questions which I can't resolve.</p> <p>The first questions is about Animation 2D Graphics. I have an Activity that call a <code>SurfaceView</code> in which I draw on <code>Canvas</code> my background and my player (this player it's moved by accelerometers). I want this movement to go along an animation without to use xml, it's possible? </p> <p>The second question is about draw in <code>Canvas</code> from a other method than <code>onDraw()</code>. For example, when the time is out, I want draw the text "Game Over" and I don't know where write this code.</p> <p>EDIT: I found a form to paint in my Canvas based on conditionals. A method which receive a Canvas Object and paint something is called in onDraw if(something), but... there is an easier way to do it????</p> <p>The animation I have not yet achieved succesfully, I need some help please! Other thing is when I can paint in Canvas the way I've said before, I need my current thread is stopped, draw something and later restart the level game, How I can do this??</p>
android
[4]
184,652
184,653
Javascript timing events
<p>I want to display the message "Hi how are you?" for 1 minute using <a href="http://en.wikipedia.org/wiki/JavaScript" rel="nofollow">JavaScript</a>. After 1 minute, I'd like it to disappear. Can you help me write the code to produce this?</p> <p>Thank you.</p>
javascript
[3]
3,150,512
3,150,513
question regarding the keyword super
<p>In the book "Java in a Nutshell", chapter 3, section 3.5 Subclasses and Inheritance, there is such as paragraph about the usage of super to access overriden method:</p> <blockquote> <p>Note that the super keyword invokes the most immediately overridden version of a method. Suppose class A has a subclass B that has a subclass C and that all three classes define the same method f( ). The method C.f() can invoke the method B.f( ), which it overrides directly, with super.f( ). But there is no way for C.f() to invoke A.f( ) directly: super.super.f( ) is not legal Java syntax. Of course, if C.f() invokes B.f( ), it is reasonable to suppose that B.f( ) might also invoke A.f(). This kind of chaining is relatively common when working with overridden methods: it is a way of augmenting the behavior of a method without replacing the method entirely. We saw this technique in the the example finalize() method shown earlier in the chapter: that method invoked super.finalize() to run its superclass finalization method.</p> </blockquote> <p>What does it mean? There is no way for a instance of class C to call the f() of class A? Why?</p>
java
[1]
4,845,075
4,845,076
L shaped custom gallery view
<p>I want to implement a gallery view in which the gallery is L-shaped and the thumbnails move from vertical to horizontal. And also: the image size will be max at the center and will decrease from center to last.</p>
android
[4]
5,070,701
5,070,702
Android XML parsing
<p>I have to parse the url <a href="http://local.yahooapis.com/LocalSearchService/V3/localSearch?appid=YahooDemo&amp;query=pizza&amp;zip=94306&amp;results=2" rel="nofollow">http://local.yahooapis.com/LocalSearchService/V3/localSearch?appid=YahooDemo&amp;query=pizza&amp;zip=94306&amp;results=2</a> and show the result in android simulator</p> <p>I have done earlier parsing in android I did not get problem in that Can anyone help me in this regard?</p>
android
[4]
1,018,138
1,018,139
jquery creating events when mouseenter and mouseleave
<p>I am trying to rock a simple image back and forth on a mouseover using jquery. The image id is "img".</p> <pre><code> $(document).ready(function () { $("#img").bind('mouseenter', function () { $('#img').rotate(43); }); $("img").bind('mouseleave', function () { $('#img').rotate(-43); }); }); </code></pre> <p>When I do this the first rotate works but the second does not. Why is this? I can use the second by itself and it works as expected too. I just can't get both to work together. Iam using a library to rotate. If I sub alerts for the rotate I still can't the second to work. Any suggestions? TIA John</p>
jquery
[5]
5,095,914
5,095,915
About android mobile application development?
<p>Android mobile application development is the J2ME Application.I need to know about it? Can anyone help me?</p>
android
[4]
2,120,646
2,120,647
android loading message
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3028306/download-a-file-with-android-and-showing-the-progress-in-a-progressdialog">Download a file with Android, and showing the progress in a ProgressDialog</a><br> <a href="http://stackoverflow.com/questions/5025652/android-activity-indicator">Android Activity Indicator?</a> </p> </blockquote> <p>i am really a novice in android I am doing an app connected with a webservice(xml) and it works good, but my app load the screen with the views incomplete and then shows the data. Iwould like to implement a " gettin ready" dialog when all the data has been downloaded and showed from the server.</p> <p>Thanks for your help</p>
android
[4]