Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
2,507,281
2,507,282
How to set focus on a TextView when an Activity starts?
<p>There are an EditText and a TextView in my Activity. I want to set focus on the TextView when the Activity starts. I used the following code:</p> <pre><code> TextView myTextView = (TextView) findViewById(R.id.my_text_vew); myTextView.setFocusable(true); myTextView.setOnClickListener(this); myTextView.requestFocus(); </code></pre> <p>But the code doesn't work. The EditText always receives focus when the activity starts.</p> <p>Can anyone help?</p> <p>Thanks.</p>
android
[4]
3,921,622
3,921,623
creating an array whose key and value is defined
<p>This code below basically will count the number of occurrences of a word inside an array.</p> <p>What I would like to happen now though, is to get <code>$word</code>, assign it as a key to an array, and assign <code>$WordCount[$word]</code> to be its value. So for example, if I get, a word "jump", it will be automatically assigned as the key of an array, and the number of occurrences of the word "jump" (<code>$WordCount[$word]</code>) will be assigned as its value. Any suggestions please?</p> <pre><code>function Count($text) { $text = strtoupper($text); $WordCount = str_word_count($text, 2); foreach($WordCount as $word) { $WordCount[$word] = isset($WordCount[$word]) ? $WordCount[$word] + 1 : 1; echo "{$word} has occured {$WordCount[$word]} time(s) in the text &lt;br/&gt;"; } } </code></pre>
php
[2]
3,951,515
3,951,516
How do I make a simple calculator using switch-statements?
<p>I'm new to PHP and need some assistance.</p> <p>I am learning switch statements and this is where I am stuck. How do I use a switch statement to code a simply calculator that adds, subtracts, multiplies and divides two numbers entered? The switch statement should echo the result back to the user.</p>
php
[2]
2,714,495
2,714,496
Thread handling problem in Android Junit Test Case
<p>I am implementing a testcase in Android Juint. I am facing problem in handling threads. After the successful running of a test case, it will not wait for child thread to be finished. e.g. If one testcase call some services in server. testcase will successfully send request to a server, but it will not wait for a response. Because testcase will start this request in a different Thread. Currently I am using following code,</p> <pre><code> currentThread = Thread.currentThread(); synchronized (Thread.currentThread()) { try { Thread.currentThread().wait(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } </code></pre> <p>After getting response I am using the following code to start the current thread again.</p> <pre><code> currentThread.interrupt(); </code></pre> <p>I think this is not the good way to do it. There must be a some other technique to handle this problem properly. Please let me know as soon as possible if any one knows solution for this.</p> <p>Thanks,</p> <pre><code> Vashishta </code></pre>
android
[4]
3,991,664
3,991,665
How to test localized string on simulator?
<p>I am using NSLocalizedString(); function for my localized strings. Even though i change my preferred language in simulator settings my string still get shown up in English.</p> <p>Can we test the NSLocalizedString(); from simulator? if so how?</p> <p>Can any one guide me through this please?</p> <p>-- Regards,</p> <p>U'suf</p>
iphone
[8]
4,178,292
4,178,293
Dynamically changing onscreen keyboard layout in android
<p>I would like to build a custom keyboard layout for a messenger app I am working on which is localized within the app. I currently noticed that keyboard settings could be selected from the settings to displayed preferred layout choice e.g english,chinese, french. My goal is to (1) Dynamically assign keyboard layout from within the app on specifying what language you would want to send the message as (2) Build 3 different keyboard layouts that are not included as the default locales of the device and be able to do as SAID IN 1 above.</p> <p>Ps, How can I dynamically change onscreen keyboard to display in different language formats AND how can i build a custom keyboard layout to allow users insert text.</p>
android
[4]
487,190
487,191
iPhone: Is it possible to put a link in Push-Notifications?
<p>Is it possible to put a link in Push-Notifications message? I wish to send video link as notification. </p>
iphone
[8]
4,914,331
4,914,332
ASP.Net: Get page url from inside a frame
<p>How can I get the top page URL from inside a frame?</p> <p>(in javascript it's implemented using : window.top.location)</p>
asp.net
[9]
2,061,981
2,061,982
java update properties file run time
<p>i am writing standalone java app for production monitoring. once it starts running the api is configured for default values which is set in .properties file. in running state the api's configuration can be changed and the .properties file should be updated accordingly. is there a way to achieve this ? or are there any other approaches to implement this ?</p> <p>Thanks in advance</p>
java
[1]
5,342,174
5,342,175
android: How to insert a bottom aligned view without layout.xml?
<p>I want to insert views dynamically by using addView method, like this.</p> <pre><code>TextView view = new TextView(this); view.setText("foo"); ViewGroup parentView = (ViewGroup) findViewById(R.id.main_layout); parentView.addView(view); </code></pre> <p>How can I align bottom the inserted view?</p>
android
[4]
3,985,410
3,985,411
How to reuse Activities? Not to create activity each time
<p>This topic is continue of this: <a href="http://stackoverflow.com/questions/7674477/">Android. How to start activity without creating new one?</a></p> <p>I have read that activities are destroyed when to click BACK button. They can be not destroyed when to move deeper to stack and then call activities back. using <code>android:launchMode="singleTask"</code> for example</p> <p>is it possible that activities to not be destroyed when I click button BACK and then run activity again?</p>
android
[4]
739,885
739,886
email queueing with c#
<p>not sure it is possible but I am looking for a solution that will queue email messages. </p> <p>Is there any way to write some sort of web app that will run and send certain amounts of emails to email server for delivery even after I submit my message and close webpage. May be some sort of daemon?</p>
c#
[0]
46,837
46,838
in ios how to create geo location based alarm?
<p>I want to create an alarm that will remind me based on any particular place. whenever I reached that place the alarm should start beeping.</p> <p>Please help someone I tried to search over internet but still not get</p>
iphone
[8]
5,036,829
5,036,830
hide show div (but display first 200px)
<p>I am using some code from a fiddle made by a member of StackOverflow. To hide show divs on click.</p> <p>My issue is I wish to extend this , I will explain.</p> <p>I have content loading from database, which lets say is approx 500px in height. But On page load, I only want to show the first 200px height of this content, so user can click "Show More" and the remainder of the div slides down.</p> <p>To keep things tidy, I would like to extend the use of the code , given on here if possible, so that my JS is tidy.</p> <p>The code to hide/show content thus far is:</p> <p>JS</p> <pre><code>$(document).ready(function() { $("#setup-ofi").click(function() { $("#closeable-ofi").slideToggle(function() { if ($(this).is(":visible")) { $("#setup-ofi").text("Hide Details \u25b2"); } else { $("#setup-ofi").text("Show Details \u25bc"); } }); }); </code></pre> <p>});</p> <p>The HTML</p> <pre><code>&lt;h3&gt;Property Details - &lt;span class="sub-searchBlue"&gt;&lt;a id="setup-ofi" href="javascript:;"&gt; Show Details &amp;#x25BC;&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt; &lt;div id="closeable-ofi" style="display:none"&gt; content of db shows here &lt;/div&gt; </code></pre> <p>FIDDLE : <a href="http://jsfiddle.net/3x2uG/" rel="nofollow">http://jsfiddle.net/3x2uG/</a></p>
jquery
[5]
2,461,568
2,461,569
loading pictures from folder
<p>hi how I can load a picture from spaciefied folder tnx in advanced</p>
c#
[0]
1,940,102
1,940,103
showing images moving using java script
<p>i want to Create new page named “MySlidShow.htm”, and put link to in PhotoGallary page. The slide show page has four links (previous, Start SlideShow, End Slide Show, Next). When user put the mouse over an image show this image description and date taken below it and pause the slide show if it is running, and when the moves the mouse away hide the description and date and resume the slide show. (Use array to store images name, and another to store images description and date taken (you may use associative array). can any one show me how or write me the code</p>
javascript
[3]
2,313,732
2,313,733
How do I add code automatically to a derived function in C++
<p>I have code that's meant to manage operations on both a networked client and a server, since there is significant overlap between the two. However, there are a few functions here and there that are meant to be exclusively called by the client or server, and accidentally calling a client function on the server (or vice versa) is a significant source of bugs.</p> <p>To reduce these sorts of programming errors, I'm trying to tag functions so that they'll raise a ruckus if they're misused. My current solution is a simple macro at the start of each function that calls an assert if the client or server accesses members they shouldn't. However, this runs into problems when there are multiple derived instances of classes, in that I have to tag the implementation as client or server side in EVERY child class.</p> <p>What I'd like to be able to do is put a tag in the virtual member's signature in the base class, so that I only have to tag it once and not run into errors by forgetting to do it repeatedly. I've considered putting a check in a base class implementation and then referring to it with something like base::functionName, but that runs into the same issue as far as needing to manually add the function call to every implementation. Ideally, I'd be able to have parent versions of the function called automatically like default constructors do.</p> <p>Does anybody know how to achieve something like this in C++? Is there an alternate approach I should be considering?</p> <p>Thanks!</p>
c++
[6]
4,130,287
4,130,288
Android Single Process Level Service
<p>Here's the scenario:</p> <p>I have a service that I want to start at device boot time. </p> <p>The service will listen for multicast packets and send notifications to the user.</p> <p>In order for the service to start running on system boot, I need to define a receiver listening for an intent contaning the following action <code>android.intent.action.BOOT_COMPLETED</code>, which will then start the service.</p> <p>If I have N number of applications, that all expect that service to be running, and I define the same receiver in all applications, I'm assuming N number of services will startup.</p> <p>Is there any way to prevent multiple instances of the same service from running?</p>
android
[4]
2,576,855
2,576,856
Did button actually click?
<p>I have some javascript that ends up programatically clicking on a button:</p> <pre><code> document.getElementById("myButton").click(); </code></pre> <p>This in turn results in the form being submitted using a function call:</p> <pre><code> &lt;form onsubmit="submit_this_form(this);return false;" action="" method="POST"&gt; </code></pre> <p>It seems that a good percentage of the time either the actual button click is not going through or the form is not being submitted. I think the button click is going through and I know the code is being called because I have a counter embedded and I can see it is executing. </p> <p>My question is...is there an event or a way to verify that the form actually posted? By the way, I don't have control of the HTML code so I can't change the tag content.</p>
javascript
[3]
2,536,744
2,536,745
Passing an empty array as default value of an optional parameter
<p>How does one define a function that takes an optional array with an empty array as default?</p> <pre><code>public void DoSomething(int index, ushort[] array = new ushort[] {}, bool thirdParam = true) </code></pre> <p>results in:</p> <p>Default parameter value for 'array' must be a compile-time constant.</p>
c#
[0]
5,398,799
5,398,800
Remove item in a Python kiwi objectlist
<p>I have an generic example from kiwi framework, my question is: How can I remove only a item from kiwi objectlist.</p> <p>Thanks for the time!</p> <pre><code>import gtk from kiwi.ui.objectlist import Column, ObjectList class Fruit: def __init__(self, name, cost): self.name = name self.cost = cost fruits = ObjectList([Column('name', data_type=str, editable=True, expand=True), Column('cost', data_type=int, editable=True)]) for name, cost in [('Apple', 4), ('Pineapple', 2), ('Kiwi', 8), ('Banana', 3), ('Melon', 5)]: fruits.append(Fruit(name, cost)) window = gtk.Window() window.connect('delete-event', gtk.main_quit) window.set_title('Editable Fruit List') window.set_size_request(230, 150) # ## remove fruits # fruits.remove(Fruit('Pineapple', 4)) #error window.add(fruits) window.show_all() gtk.main() </code></pre>
python
[7]
5,053,057
5,053,058
Python Relative import does not work from command line gives ValueError
<p>My Directory structure is as follows</p> <pre><code>microblog/__init__.py urls.py views.py wsgi.py settings/__init__.py testing.py base.py local.py </code></pre> <p>In testing.py I have a relative import </p> <pre><code>from .base import * ... ...more code </code></pre> <p>When I try to run the testing.py from the command line in the directory microblog/settings using python testing.py</p> <pre><code>from .base import * ValueError: Attempted relative import in non-package </code></pre> <p>Why does this not work. The settings directory is a valid package with a <strong>init</strong>.py . I do not get the ValueError from the command line only If I change the </p> <pre><code>from .base import * </code></pre> <p>to </p> <pre><code>from base import * </code></pre> <p>I am trying to understand why the relative local import fails and gives a ValueError when I run the "testing.py" package with a relative import in it from the command line.</p>
python
[7]
3,214,947
3,214,948
Reading data using tn.read_all() in python
<p>read_all()" to read data from a cisco device. some time it reads the data and sometime it won't read and gives empty string. I tried below 2 commands but still it's not consitently reading data.</p> <pre><code>data=tn.read_until("exit") data= tn.read_all() </code></pre> <p>please give some inputs i am new to python.</p> <p>code i am using:</p> <pre><code>_command2='show chassis' print 'Commands issued............' #ISSUE COMMANDS VIA TELNET tn.write("term len 0\r") #tn.read_until(" ") #tn.write(_command1+"\r") tn.write(_command2+"\r") tn.write("exit\r" ) print 'Read telnet data............' #READ TELNET DATA #data=tn.read_eager() data=tn.read_until("exit") #data= tn.read_all() #print data print 'Telnet data read successfully............' </code></pre>
python
[7]
4,460,114
4,460,115
Accesing variable declared without a name (just new keyword)
<p>I have a DataSet named dS in which i want to load XML.</p> <p>So i would use the function <code>dS.ReadXml();</code></p> <p>The paramter for <code>ReadXml</code> function is <code>XmlTextReader</code> Object.</p> <p>If i pass object as </p> <pre><code>ds.ReadXml(new XmlTextReader(Application.StartupPath + "\\MyDataSource.xml")); </code></pre> <p>the dataset would be loaded. But later on, i want to close that <code>XmlTextReader</code> object. Although i didn't declared it with a name like</p> <pre><code>XmlTextReader reader = new XmlTextReader(somepath); </code></pre> <p>How can i close the reader???</p>
c#
[0]
5,827,413
5,827,414
Javascript Simple Calculation giving NAN or 0
<p>Can anyone work out why this does not work. Produces NAN and if reset for a Number(document on var inputs produces 0. The script is supposed to add up an indefinite number of fields starting with an ID of product_total_price_PRI_ ... .</p> <p>Obviously I've missed something and have got a headache from trying to see it. </p> <pre><code>function getFields() { var inputs = document.getElementsByTagName('input'); var result = 0; for( var i = 0; i &lt; inputs.length; i++ ) { if( inputs[i].id.indexOf('product_total_price_PRI_') == 0 ); result += parseFloat(inputs[i].value); } alert(result); } </code></pre>
javascript
[3]
3,878,329
3,878,330
error in exporting textbox text to excel sheet
<p>I'm trying to export some values in textboxes to several columns (Date, Temperature) in an excel sheet (.xlsx file). But it generates an error called "the INSERT INTO statement contains the following unknown field name: 'Temperature'". And when i remove the Temperature column from INSERT INTO statement, it works. Please help. I have given the codings beow:</p> <pre><code> private void button2_Click(object sender, EventArgs e) { openFileDialog2.ShowDialog(); string Path = openFileDialog2.FileName.Replace("'\'", "'\\'"); try { string szConn = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +Path+ ";Extended Properties='Excel 8.0;HDR=YES;'"; OleDbConnection conn = new OleDbConnection(szConn); conn.Open(); OleDbCommand cmd = new OleDbCommand("INSERT INTO [Weather Report$]([Date],[Temperature]) VALUES('" + textBox1.Text + "','" + textBox3.Text + "')", conn); cmd.ExecuteNonQuery(); conn.Close(); } catch (Exception ex) { MessageBox.Show (ex.ToString()); } } </code></pre>
c#
[0]
2,515,818
2,515,819
Call to undefined method My_email::from()
<p>I have a problem creating a test library to send email. This is my code:</p> <pre><code>class My_email { public function my_send_mail() { $CI =&amp; get_instance(); $CI-&gt;load-&gt;library('email'); $CI-&gt;email-&gt;from('xxx@xxx.com', 'Sender name'); $CI-&gt;email-&gt;to('yyy@yyy.com'); $CI-&gt;email-&gt;subject('Test'); $CI-&gt;email-&gt;message('Testing'); return $CI-&gt;email-&gt;send(); } } </code></pre> <p>I get the error:</p> <pre><code>Call to undefined method My_email::from() </code></pre>
php
[2]
3,827,819
3,827,820
I am using addClass/removeClass and "data-" attribute to show/hide divs. How can I add next/previous?
<p>I am trying to work out the template for an ebook. This is what I have at present: <a href="http://jsbin.com/otakab/2/edit" rel="nofollow">http://jsbin.com/otakab/2/edit</a> But the next/previous doesn't work. Can you supply working code?</p> <pre><code>// Following function works $(function() { $(".pageNumbers a").on("click", function(e) { // Add highlight to the element clicked and remove highlighting from its siblings $(this).addClass("highlight").siblings().removeClass("highlight"); // Make use of our data attribute to show the correct page and hide the siblings $($(this).data('page')).show().siblings(".page").hide(); }); // Finally, dynamically click first page to start things off for the user //and provide proper highlighting and showing of text $("#a-1").click(); }); // Following function DOES NOT WORK $(function() { $(".direction a").on("click", function(e) { // Trying to show the next/previous hidden div $($(this).data('page')).show().siblings(".page").hide(); }); }); </code></pre>
jquery
[5]
3,610,549
3,610,550
tooltip which brings external page in it
<p>m looking for a tooltip which can dispaly external php page in to it and which can adjust itself up and down with respext to screen size,can some one suggest me jquery or javascript code.It should work on ajax page also.if i delete something by using ajax then tooltip should appear on ajax</p>
javascript
[3]
5,384,174
5,384,175
can I use ul li instead of select dropdown and with jquery make it part of a form?
<p>I went really long way trying to rewrite select to ul li and style it accordingly. But I'm getting really annoyed with the weight of code and minor annoyances on the way.</p> <p>So I'm thinking to ditch the idea completely, and just use normal ul li menu and some kind of javascript to make it function like select (for form submission etc).</p> <p>So is this possible? any example code you can give me?</p> <p>My concerns is Cross browser compatibility.</p>
jquery
[5]
3,424,316
3,424,317
How to "return" values in Shortcut for if-else
<p>How to return a value from a shortcut If-Else conditional statements ?</p> <p>It works just fine when I used the following Block of Code ,</p> <pre><code>var val =0; function slide() { if(val != 0 ) { val++ ; }else { return ; } //rest of my code } </code></pre> <p>The Problem is, I want to return values from shortcut IF-else conditions as follow's </p> <pre><code>var val=0; function slide() { val != 0 ? val++ : //here I want to return from function to stop execution of remaining Block; //rest of my code } </code></pre>
javascript
[3]
3,752,167
3,752,168
using eval in Java
<p>I am new to Java. I have a string like the following:</p> <pre><code> str="4*5"; </code></pre> <p>Now I have to get the result of 20 by using the string. I know in some other languages the eval function will do this. How do I do this in Java?</p>
java
[1]
3,951,639
3,951,640
Routing audio bluetooth headset
<p>I use this code for routing audio to headset - Galaxy 5 device 2.2. But this same code doesn't work in Android 2.3.3 Galaxy Y device!!! When I power on headset, the media sound stop working... </p> <pre><code>@Override public void onReceive(Context context, Intent intent) { Log.i(TAG,"onReceive - BluetoothBroadcast"); localAudioManager = (AudioManager) context.getSystemService("audio"); String TAG = "BluetoothReceiver"; String ACTION_BT_HEADSET_STATE_CHANGED = "android.bluetooth.headset.action.STATE_CHANGED"; String action = intent.getAction(); if(action.equals(ACTION_BT_HEADSET_STATE_CHANGED)) { int extraData = intent.getIntExtra(EXTRA_STATE , STATE_DISCONNECTED); if(extraData == STATE_DISCONNECTED){ localAudioManager.setBluetoothScoOn(false); localAudioManager.stopBluetoothSco(); localAudioManager.setMode(AudioManager.MODE_NORMAL); Log.i(TAG, "Bluetooth Headset Off " + localAudioManager.getMode()); }else{ localAudioManager.setMode(0); localAudioManager.setBluetoothScoOn(true); localAudioManager.startBluetoothSco(); localAudioManager.setMode(AudioManager.MODE_IN_CALL); Log.i(TAG, "Bluetooth Headset On " + localAudioManager.getMode()); } } } </code></pre> <p>Dears, please help me. </p> <p>Thanks! Mateus</p>
android
[4]
2,077,723
2,077,724
class instance member initialisation
<p>If a class has an instance member that is itself a class, does the constructor ALWAYS have to provide an initialisation for it in the constructor initialiser list?</p> <p>In some cases in my code this leads to very long initialiser lists, is this the way to do things? I only ask because it looks inelegant, but if it's how it's done then that's fine.</p> <p>is the same also the case for constant instance member variables?</p>
c++
[6]
3,674,324
3,674,325
What's actually going on in this AnonymousClass(variable) declaration?
<p>Trying to compile:</p> <pre><code>class AnonymousClass { public: AnonymousClass(int x) { } }; int main() { int x; AnonymousClass(x); return 0; } </code></pre> <p>generates errors from MSVC:</p> <pre><code>foo.cpp(13) : error C2371: 'x' : redefinition; different basic types foo.cpp(12) : see declaration of 'x' foo.cpp(13) : error C2512: 'AnonymousClass' : no appropriate default constructor available </code></pre> <p>g++'s error messages are similar:</p> <pre><code>foo.cpp: In function ‘int main()’: foo.cpp:13: error: conflicting declaration ‘AnonymousClass x’ foo.cpp:12: error: ‘x’ has a previous declaration as ‘int x’ foo.cpp:12: warning: unused variable ‘x’ </code></pre> <p>It's easily fixable by giving the <code>AnonymousClass</code> object an explicit name, but what's going on here and why? I presume that this is more declaration syntax weirdness (like the cases described in <a href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.2">Q10.2</a> and <a href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.21">Q10.21</a> of the comp.lang.C++ FAQ), but I'm not familiar with this one.</p>
c++
[6]
3,045,262
3,045,263
print difference between 2 strings in php
<p>I have an output stream that is saved in a string called $output1, this is displayed to the user. now if I have another stream called $output2 that is identical to $output1 plus a few lines, how can I output only the part of $output 2 that is not in $output1.</p> <p>For example:</p> <pre><code>$output1="this cat is"; $output2="this cat is mine"; </code></pre> <p>I want to output:</p> <blockquote> <p>this cat is mine</p> </blockquote>
php
[2]
5,677,791
5,677,792
Why isn't 0-padding allowed in Python?
<p>I've just noticed 0-padding is not allowed in Python and I was wondering why this choice was made?</p> <p>For example:</p> <pre><code>a = 09 </code></pre> <p>doesn't work while</p> <pre><code>a = 9 </code></pre> <p>does</p> <p>How's that?!</p> <p>Thank you very much for your answers!</p>
python
[7]
2,850,288
2,850,289
How to remove a property from a File-API object in JavaScript?
<p>I'm using the JavaScript "file" api to read information about images that will be uploaded, in order to generate a preview thumbnail before the actual upload occurs, based on a demo found here (<a href="http://www.html5rocks.com/en/tutorials/file/dndfiles/" rel="nofollow">JavaScript file api</a>).</p> <p>Using an file input with a "multiple" attribute, one or more files can be selected at the same time, like so: <code>&lt;input type="file" id="imageFiles" name="userfile[]" multiple /&gt;</code> </p> <p>Once the image(s) have been selected by the user, I inspect the element with firebug and I can see in the DOM that the "files" object contains information about each image selected.</p> <p>The "file" object will contain as many properties as files were selected and each property has information about each image. I could only describe the "file" object as an associative array in the sense that each property is an object in itself. </p> <p>What I want to do is be able to remove from the "file" object a given proprety, thus removing one of the images that will be uploaded, without having to select the images again. </p> <p>So far this is what I've tried and it does not work: </p> <pre><code>var getAllFiles = document.getElementById('imageFiles'); var allImages = getAllFiles.files; // returns an object with X properties delete allImages[X]; // "X" is whatever property key I'm passing in </code></pre> <p>I've tried the "splice()" method but it does not work either.</p> <p>Thank you very much.</p>
javascript
[3]
971,043
971,044
Tracing may slow the web site?
<p>I have ASP.NET web site in production and I enabled tracing in web.config file as debugging purpose in case there is any error. Is it possible that tracing may slow down the web site?</p> <p>The web site response (ex. in buttton event) is extremely slow. And, I am wondering if this has anything to do with the tracing.</p> <p>Thanks.</p>
asp.net
[9]
2,701,450
2,701,451
jquery get selected word
<p>i have a div with class='divclass' and some text inside it... now i want to display a popup when the user mouseover any word inside div... the popup will also display the word on which user has mousedover the mouse... how can we achieve this?..</p>
jquery
[5]
2,867,916
2,867,917
Unable to install apk file in my android mobile
<p>This is py struggling about installation of apk file in my android phone.</p> <p>I am using htc android phone in that i am trying to install my application.</p> <p>I developed application using eclipse ADT plugin and taken apk file and copied in my phone SD card -> Android folder.</p> <p>After that i installed Astro file manager in my phone and trying to browse my apk file but still i unable to find Android folder and my apk file in the Astro file manager.</p> <p>I just stuck up there.</p> <p>Can anybody fix my problem?</p> <p>Thanks and Regards,</p> <p>Py</p>
android
[4]
5,509,186
5,509,187
PHP: problems searching text in a file
<p>I think i was doing halfway good to get this to halfway work. Anyways the following code works to find it on the first line, but i have a script that creates each on an individual line. Please revise or create a completely new version of the following to make it to search for the form data on every line.</p> <pre><code>$search = $_POST['search']; $file = file("SLIST.txt"); foreach($file as $line) { $line = trim($line); if($line == $search) { echo $search . " WAS found in the database"; } else { echo $search . " was NOT found in the database"; } } </code></pre> <p>by form i mean there is a search form on the previous page. This page is the page where it tells you whether the text put into the search form matches a line in the file (ex: Line 1: BOOT Line 2: Tree Search entry: Tree Echo msg: Tree WAS found in the database.)</p> <p>It is currently not working like i intended.</p>
php
[2]
4,982,953
4,982,954
Is it possible to start a service with a shortcut?
<p>I'm trying to create a shortcut on the home screen that, when pressed, will start a service instead of an activity.</p> <p>Is it possible? How?</p> <p>Thanks!</p>
android
[4]
4,624,951
4,624,952
Python | How to append elements to a list randomly
<p>Is there a way to append elements to a list randomly, built in function</p> <p>ex:</p> <pre><code>def random_append(): lst = ['a'] lst.append('b') lst.append('c') lst.append('d') lst.append('e') return print lst </code></pre> <p>this will out put <code>['a', 'b', 'c', 'd', 'e']</code></p> <p>But I want it to add elements randomly and out put something like this: <code>['b', 'd', 'b', 'e', 'c']</code></p> <p>And yes there's a function random.shuffle() but it shuffles a list at once which I don't require, I just want to perform random inserts only.</p>
python
[7]
5,735,263
5,735,264
How to replace the image of the back button entirely with different image?
<p>Below is my coding </p> <pre><code>// Navigation logic may go here -- for example, create and push another view controller. NextViewController *nextViewController = [[NextViewController alloc] initWithNibName:@"NextViewController" bundle:nil]; [self.navigationController pushViewController:nextViewController animated:YES]; [nextViewController release]; UIImage *backImage=[UIImage imageNamed:@"backbutton.png"]; UIBarButtonItem * backBarButtonItem = [[UIBarButtonItem alloc] initWithImage:backImage style:UIBarButtonItemStylePlain target:nil action:nil]; self.navigationItem.backBarButtonItem = backBarButtonItem; [backBarButtonItem release]; } </code></pre>
iphone
[8]
3,444,585
3,444,586
Why does my ProgressDialog exit when I click on Activity?
<p>I am showing a ProgressDialog using the following code:</p> <pre><code>void showProccess() { p = new ProgressDialog(this); p.setTitle("PleaseWait"); p.setMessage("data loading"); p.show(); } </code></pre> <p>In Android 2.3.1 when a <code>ProgressDialog</code> is shown, I can't click on the <code>Activity</code>. But in Android 4.0.3, I click on <code>Activity</code> and the <code>ProgressDialog</code> will exit. I want the <code>ProgressDialog</code> to not exit, the same as Android 2.3.1. Can you help me? Thanks.</p>
android
[4]
3,656,386
3,656,387
PHP - Errors with DOmdocument
<p>Why I am getting the following error </p> <pre><code> Call to a member function getElementsByTagName() on a non-object </code></pre> <p>Error happens on following line:</p> <pre><code> $title = $htm-&gt;getElementsByTagName('title'); </code></pre> <p>when I run the following code:</p> <pre><code> $dom = new DOMDocument(); foreach ($all as $blog) { sleep(1); $htm = $dom-&gt;loadHTML(fetch_url('http://' . rtrim(preg_replace('/^http:\/\//i', '', $blog['blogurl']), '/'))); if ($htm) { //check TITLE $title = $htm-&gt;getElementsByTagName('title'); $title = $title-&gt;item(0)-&gt;nodeValue; if (preg_match('/private/i', $title)) { private_blog($blog['id']); $title = null; unset($title); gc_collect_cycles(); continue; } } } </code></pre>
php
[2]
2,281,866
2,281,867
Intranet web sites via VPN
<p>I have created an App that gets data from Web Services on an In*<em>TRA</em>*net web site. In order for my App to see these sites I have to turn on the VPN that is setup for our company intranet. So when I turn on the VPN it asked for authentication. That has to be turned on before my App launches because I know of no way to access the VPN via code (<em>Is there anything in the SDK for working with the VPN?</em>)</p> <p>The <strong>problem</strong> is that once my my App launches it needs to authenticate against the intranet web site (authentication <strong>can't</strong> be turned off for security reasons).</p> <p>So in this scenario:</p> <ol> <li>User turns on VPN, enters network credentials to get access to internal network</li> <li>User starts App that ask for network credentials (because web server asked for auth)</li> </ol> <p>So as you can see this is quite a pain (having to enter network credentials twice).</p> <p><strong>Anybody have any ideas on how I could get around this?</strong></p> <p>BTW - I'm using <a href="http://allseeing-i.com/ASIHTTPRequest/" rel="nofollow">ASIHTTPRequest</a> in my code.</p>
iphone
[8]
5,102,872
5,102,873
how to display the checked elements from a listview - android
<p>I have the following listview : <a href="http://www.vogella.de/articles/AndroidListView/article.html" rel="nofollow">http://www.vogella.de/articles/AndroidListView/article.html</a> the chaper: <code>8. Tutorial: Domain Model and Rows interaction</code> </p> <p>In MyList class, in the <code>OnCreate()</code> method I've added:</p> <pre><code>setContentView(R.layout.button), where the layout button is containting: &lt;ListView android:id="@android:id/list" ... &lt;/ListView&gt; </code></pre> <p></p> <p>After pressing the OK button I would like to print all the checked elements from the ListView. How to do that? Need help. Appreciate</p>
android
[4]
349,507
349,508
EditView in ListView row: focus lost when soft keyboard shows
<p>I have some EditViews in the rows of a ListView. This works just fine except when the soft keyboard raises and lowers.</p> <p>When I touch the EditView within the ListView with the soft keyboard down, focus jumps to the EditView, then the keyboard comes up, removes focus from the EditView and sets focus to the ListView, resulting in an odd user experience with the focus no-where visible.</p> <p>Touching the EditViews with the keyboard already showing works as you would expect. The problem seems to be with the soft keyboard lowering and raising and the ListView getting confused about where focus should be placed.</p> <p>I do have listView.setItemsCanFocus(true) for the ListView</p>
android
[4]
3,669,190
3,669,191
The difference between getch() and system("pause")
<p>What is the difference between getch() and system("pause") in the end of a c++ code</p>
c++
[6]
4,686,452
4,686,453
snippet: jQuery syntax highlighter
<p>I am using Snippet, a jQuery plugin for highlighting code. </p> <p><a href="http://www.steamdev.com/snippet/" rel="nofollow">http://www.steamdev.com/snippet/</a></p> <p>I got it working correctly for highlighting css, js, php etc. But it does not highlight my HTML. Here is my test page. </p> <p><a href="https://dl.dropbox.com/u/9883217/syntaxHighlighter/index.html" rel="nofollow">https://dl.dropbox.com/u/9883217/syntaxHighlighter/index.html</a></p> <p>any ideas on why it does not highlight my html?</p>
jquery
[5]
1,105,697
1,105,698
Javascript Absolute vs. Relative URI using .execCommand('insertHTML', false, html);
<p>I've been using a rteEditor very sucefully until now.</p> <p>The problem is in this line of code:</p> <pre><code>document.getElementById(rteName).contentWindow.document.execCommand('insertHTML', false, html); </code></pre> <p>I'm passing an ABSOLUTE path to the html var such as ("http://www.url.com/file.html").</p> <p>But when it execute this insert command the output is ("../file.html");</p> <p>Its possible to use a jQuery command instead?</p> <p>Any Suggestions?</p>
javascript
[3]
899,132
899,133
Script to Show/Hide Content Requires Two Clicks to Execute First Time
<p>We're using the following code to show/hide content when an image is clicked:</p> <pre><code> function toggle(image,list) { var listElementStyle=document.getElementById(list).style; if (listElementStyle.display=="none") { listElementStyle.display="block"; document.getElementById(image).src="images/down.png"; document.getElementById(image).alt="Close list"; } else { listElementStyle.display="none"; document.getElementById(image).src="images/up.png"; document.getElementById(image).alt="Open list"; } } </code></pre> <p>The function is invoked like this:</p> <pre><code>&lt;p&gt; &lt;img src="images/up.png" alt="Open List" id="img39384" onClick="toggle('img39384','ul39384');"&gt;Agriculture &lt;ul id="ul39384" class="catList"&gt; &lt;li&gt; &lt;a href="databases.jsp?cat=39386"&gt;Agriculture - Most Useful&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/p&gt; </code></pre> <p>The first time an "up.png" is clicked, it takes two distinct click to fire-off the script and show/hide content. After that first two-click invocation, a single click will fire the script. This behavior holds true in all browsers--IE, Firefox, Opera, Safari, and Chrome.</p> <p>What could be causing this behavior?</p>
javascript
[3]
1,196,307
1,196,308
How to increase webview height dynamically in android
<p>Hi can anyody tell how to increase the webview height dynamically in android .my webview content will come some time less and some time .I have to show webview full layout .</p> <p>Thanks</p>
android
[4]
3,967,447
3,967,448
getting data from database table using cursor in android
<p>I have one employee table which has column values ("store_loc_id","name","password","address_id","role_id", "retailer_id"). I want to get the name and password from this table using cursor. how can i do??</p>
android
[4]
4,954,022
4,954,023
Passing an array to a Java function
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/7521891/java-array-brackets-after-variable-name">java - Array brackets after variable name</a> </p> </blockquote> <p>When writing a Java function that accepts an array as a parameter, should the function definition have the brackets ("[]") on the type or the variable name?</p> <p>As in:</p> <pre><code>private int myFunction(int array[]) { //do stuff here } </code></pre> <p>or...</p> <pre><code>private int myFunction(int[] array) { //do stuff here } </code></pre> <p>They both "work", but is there a technical difference between the two?</p>
java
[1]
2,368,505
2,368,506
How to Mimic Yahoo mail's tabs using jQuery
<p>Attempting to Mimic the Yahoo Mail Tabs. Been able to set up the add-tab functionality. But can't get round to; i)ensuring that the user doesn't add duplicate Tabs ii)ensure that all tabs are closable apart from the first</p> <p>Anyone know how I can go about this?</p>
jquery
[5]
2,310,251
2,310,252
How do I find the last executed line of code in python?
<p>What is the best tool out there to find the VERY last line of code executed in a python program? Thanks!</p>
python
[7]
4,622,373
4,622,374
Why is my C# class telling me there's no constructor with zero arguments?
<p>I have the following:</p> <pre><code>public class TestService : BaseService, IDisposable { public TestService(IRepositoryProvider repositoryProvider) { } public IRepository&lt;Exam&gt; Exams { get { return GetStandardRepo&lt;Exam&gt;(); } } } </code></pre> <p>and</p> <pre><code>public class BaseService : IDisposable { public BaseService(IRepositoryProvider repositoryProvider) { CreateDbContext(); repositoryProvider.DbContext = DbContext; RepositoryProvider = repositoryProvider; } } </code></pre> <p>Can someone tell me why there's an error on the first class saying "Base Service does not take a constructor with zero arguments" ?</p>
c#
[0]
1,541,107
1,541,108
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]
1,456,563
1,456,564
Android Email(exchage server) takes more time on SSL while account configuration
<p>I observed that Android Email application takes more time while configuring the account <strong>on SSL</strong>. On SSL it takes 10 seconds to get the response back of OPTIONS command. Once the account is configured everything works fine. Anyone have any idea??? Thanks in advance...</p>
android
[4]
4,366,203
4,366,204
Remember Apps last screen in iPhone app
<p>I want to remember the last screen of my app, means if I reopen my app, app should navigate me to the last screen where I were just before exiting app. </p> <p>Thanks Saurabh</p>
iphone
[8]
5,498,483
5,498,484
ListView with rows containing a LinearLayout
<p>I'm trying to implement a list using the ListView, which contains rows built with a LinearLayout. This LinearLayout is composed of a checkbox and a textview. The layout of the row is named tasks_list_row.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;CheckBox android:id="@+id/checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;TextView android:id="@android:id/text1" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>Then from my code I initialize the list this way:</p> <pre><code>final String[] items_task = new String[] { "one", "two", "three" }; setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.tasks_list_row, items_task)); </code></pre> <p>But then I get an error: <strong>ArrayAdapter - You must supply a resource ID for a TextView</strong></p> <p>I then try to specify the TextView id this way:</p> <pre><code>setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.id.text1, R.layout.tasks_list_row, items_task)); </code></pre> <p>But I get a Resource not found error (R.id.text1 exists in the R.java file).</p> <p>What should I do?</p>
android
[4]
799,962
799,963
JavaScript for # collated copies from a PDF print button
<p>Trying to find a JavaScript that will allow me to print 2 collated copies of a pdf document from a Adobe Acrobat PDF Print Button that I have created. Can you assist with a script that would do that?</p>
javascript
[3]
2,700,207
2,700,208
Drawing Images to fit circle
<p>I'm making an inventory screen for a game I'm working on, and I'd like to be able to draw a series of panels representing each item in the inventory. I want to be able to fit those panels on a circular path. Here's a mock up I made of what I mean</p> <p><a href="http://fc02.deviantart.net/fs70/f/2010/280/7/2/khmp_magic_menu_concept_by_magna_alphamon-d30a7em.png" rel="nofollow">http://fc02.deviantart.net/fs70/f/2010/280/7/2/khmp_magic_menu_concept_by_magna_alphamon-d30a7em.png</a></p> <p>basically I'd like to be able to, give a radius, a center point, and the y co-ordinate to start drawing at, draw this series of panels so they align with the path of the circle like in the image. </p> <p>Computing the y dimension is easy, its just the startposition y + panel height * panel index, but I'm unsure how to compute the x for a variable radius/center point circle.</p> <p>Any help would be appreciated. </p> <p>This is in C#, but something similar in C/C++ will be fine as long as I can convert it</p> <p>Thanks in advance</p> <p>EDIT: To calirify, y's position is relative to the top or bottom of the screen and is independent of the circle. If a given y does not map to a point on the circle, then I'll discard that point and not draw the panel. </p> <p>While ideally I'd like to be able to use any elliptical shape (given two radii), a circle would be good too</p>
c#
[0]
3,870,510
3,870,511
Retrieve phone number from call log android
<p>I want to retrieve the number available in the call log in android application.</p> <p>I do not want to get all the call log and populate in my app activity. Instead I want to use existing android Intent to view and once selected the number from the list, I want the number back in my activity.</p> <p>I guess I will have to use <b>startActivityForResult</b> for this. But what I am confused is what will be the code in this method. I want only the number.</p> <p>Any help will be appreciated.</p> <p>Regards, Shankar</p>
android
[4]
5,722,178
5,722,179
How to make a shape with left-top round rounded corner and left-bottom rounded corner?
<p>I want to make a shape with with left-top rounded corner and left-bottom rounded corner:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;solid android:color="#555555"/&gt; &lt;stroke android:width="3dp" android:color="#555555" /&gt; &lt;padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" /&gt; &lt;corners android:bottomRightRadius="0dp" android:bottomLeftRadius="2dp" android:topLeftRadius="2dp" android:topRightRadius="0dp"/&gt; &lt;/shape&gt; </code></pre> <p>But the shape above didn't give me what I want. It gives me a rectangle without any rounded corners.</p> <p>Can anyone help?</p> <p>Thanks.</p>
android
[4]
4,279,355
4,279,356
How to put a csv data string in an array using PHP?
<p>We have split up a CSV file into individual lines and those lines have been stored into a database. Normally I would use fgetcsv to import each line of a file into an array when it is imported. However, since the CSV data is now stored in the database, I cannot use that function anymore. Is there an equivalent function that would import a single csv line as a string and then break it into and array? </p> <p>I realize I could just explode based on "," but there are some other issues with doing that like the way Excel uses quotations around some fields, etc. </p>
php
[2]
1,765,662
1,765,663
runtime.exec() taking infinite time to execute code
<p>I want to execute a command which takes 2 arguments. 1.input file name 2.output file name.</p> <p>The command is sixV1.1 outputFile.txt The code is:</p> <pre><code> String cmd= "sixV1.1 &lt;inputFile.txt &gt;outputFile.txt"; Process p=Runtime.getRuntime().exec(cmd); int retValue=p.waitFor(); </code></pre> <p>when the i run above code,it is taking infinite time. Is it possible to give &lt;, > charecters in cmd .Please suggest me.... </p>
java
[1]
3,548,437
3,548,438
SSL Loading external images
<p>I have a web application that is using SSL. Is there anyway to load external images without the SSL warning dialog? Perhaps suppress this warning or can anyone suggest a better way to load external?</p> <p>Thanks</p> <p>Jeff</p>
asp.net
[9]
4,629,213
4,629,214
In Python, None evaluates to less than zero?
<p><strong>In Python, <code>None</code> evaluates to less than zero?</strong></p> <pre><code>ActivePython 2.7.2.5 (ActiveState Software Inc.) based on Python 2.7.2 (default, Jun 24 2011, 12:21:10) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; None &lt; 0 True &gt;&gt;&gt; None == 0 False &gt;&gt;&gt; None &gt; 0 False &gt;&gt;&gt; </code></pre> <p>Is this expected?</p> <p>I would have guessed that <code>None</code> would either be equal to zero (through type coercion), or that all of these statements would return <code>False</code>.</p>
python
[7]
626,197
626,198
NSDate from string...?
<p>I am working on calendar application. In this i have some issues with date format..</p> <p>I am conflicting with two types of date formats..</p> <p>one is -- 02-10-2010</p> <p>second is - 02 Oct, 2010</p> <p>but i want these formats be same..</p> <p>any methods to convert from one format to second or second to first.. i searched date from string..but i cannot understand...</p>
iphone
[8]
1,209,268
1,209,269
Substituting in arraylists
<p>I have an hash map, which maps integers to array of ArrayLists. For example, my data structure is the following:</p> <pre><code>7-&gt;((7,5,**4,3,1**),(7,6,4,3,1)) 4-&gt;((4,2,1),(4,3,1)) </code></pre> <p>Here, 7 is key, and arraylist e.g is (7,5,4,3,1), the array of arraylist in turn is ((7,5,4,3,1),(7,6,4,3,1))</p> <p>4 is key, and arraylist e.g. is (4,2,1), the array of arraylist in turn is ((4,2,1),(4,3,1))</p> <p>I wish to substitute the key values (in any given arraylist) and the values following it to create other arraylists, one example of this is given below:</p> <pre><code>7-&gt;((7,5,**4,2,1**),(7,6,4,2,1),(7,5,4,3,1),(7,6,4,3,1)) </code></pre> <p><strong>the thing I am not getting is how to obtain this substitution....to create bigger arraylists</strong></p> <p>the thing I am not getting is how to obtain this substitution....to create bigger arraylists..i know the datastructure..but want to create arraylists by substitution as given in subsequent example</p> <p>Is there someway in java programming by which I may achieve this? I am a novice at Java programming...I thought long about this but could not move it...can someone please help</p>
java
[1]
2,540,854
2,540,855
How can i convert sqlDatareader to List<>
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1464883/how-can-i-easily-convert-datareader-to-listt">How can I easily convert DataReader to List&lt;T&gt;?</a> </p> </blockquote> <p>I want to return list which will store the <code>sqldatareader</code> value. how can i do this..</p>
c#
[0]
5,657,490
5,657,491
Posting a request from one servlet to another
<p>I am writing a small module where in i need to post an xml string as a parmeter from one servlet to another servlet . The receiving servlet parses the xml and then sends the appropriate response.</p> <pre><code> mimetype = request.getParameter("uploadFile"); mimetype = mimetype.substring(mimetype.indexOf(".") + 1); sessionKey = String.valueOf(1000); requesttype = "CliFileChkSync"; localURL = null; xmlString = generateXML(requesttype, sessionKey, resourceId, localURL, mimetype); HttpClient client = new DefaultHttpClient(); HttpGet httpget = new HttpGet(URLString+URLEncoder.encode(xmlString,"UTF-8"));; HttpResponse httpresponse = client.execute(httpget); System.out.println(httpresponse.toString()); </code></pre> <p>The above snippet generates the xmlstring and i try to send it as a parameter.I am getting the following exceptions.</p> <pre><code>Cannot start JMX connector: JmxConnector config: { name = system, Protocol = rmi_jrmp, Address = 0.0.0.0, Port = 8686, AcceptAll = false, AuthRealmName = admin-realm, SecurityEnabled = false}: java.io.IOException: Cannot bind to URL [rmi://raviteja-s.sisodomain.com:8686/jmxrmi]: javax.naming.NoPermissionException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.AccessException: Registry.Registry.rebind disallowed; origin unknown] SEVERE: java.io.IOException: Cannot bind to URL [rmi://raviteja-s.sisodomain.com:8686/jmxrmi]: javax.naming.NoPermissionException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.AccessException: Registry.Registry.rebind disallowed; origin unknown] </code></pre> <p>and a whole lots of them.</p> <p>Can you please help me where i am doing this wrong?Any links / references are highly helpful.</p>
java
[1]
3,286,853
3,286,854
Catch Commandline error
<p>I am trying to catch an error with an incorrect commandline parameter for the application of form </p> <pre><code>Myapp.exe myFile.txt </code></pre> <p>The application however throws an "Unhandled exception - The path is not of legal form". </p> <p>Below is my code and I am wondering why it does not show the message box as provided in the code? Thanks.</p> <pre><code>String[] cmdlineArgs = Environment.GetCommandLineArgs(); if (cmdlineArgs.Length == 2) { try { if (File.Exists(cmdlineArgs[1].ToString())) ConfigParameters.SetConfigParameters(cmdlineArgs[1].ToString()); else { MessageBox.Show("Configuration file does not exist.Restarting..."); Environment.Exit(1); } } catch (Exception ex) { } </code></pre>
c#
[0]
4,531,293
4,531,294
If an object is passed as an argument in a function, does it create a new instance?
<p>In this code:</p> <pre><code>function myFunction(obj) { console.log(obj); } var obj = { key : 'value', funct : function(){}, elem : document.getElementById('navigation').getElementsByTagName('a') } myFunction(obj); </code></pre> <p>Is the object "obj" printed in the console inside myFunction the same object i defined or is a new instance?</p> <p>Also, what if i pass it from myFunction to another function?</p>
javascript
[3]
3,924,805
3,924,806
delete parent and itself in jquery
<p>JQuery:</p> <pre><code>$('#imgDelete').live('click', function() { $(this).parent('td').remove(); }); </code></pre> <p>All <code>&lt;td&gt;</code> are generate pro-grammatically and bind.<code>imgDelete</code> is also bind inside for each <code>&lt;td&gt;</code>.But above code shouldn't able to remove parent. Dynamically generate columns are unable to delete or i m missing something. Thanks. </p>
jquery
[5]
5,620,388
5,620,389
pinch and expand UIView
<p>I'm planning to create a UIView with UIButtons and I want that UIView to add in a UIViewScroll. But my problem is that UIView is larger than the actual screen size of the phone, so I want a pinch or expand gesture to zoom in or zoom out the view. My question is how can I implement the resizing of the view including its sub views like the UIButtons? Should I recreate all the objects inside of the view with new dimensions?</p> <p>Thanks.</p>
iphone
[8]
1,893,984
1,893,985
PHP: How to add variables and quotes to a variable
<p>How can I add variables and quotes to a variable? </p> <p>in the output it just prints the variables This is the code I have tried</p> <pre><code> $pl2 = '{"comment":"' . $nmp3 . '","file":"' . $pmp3 . '"},'; </code></pre>
php
[2]
14,796
14,797
How to check that two integer typedefs are equivalent?
<p>I am using some libraries which have their own definitions for integer types. How can I check that two typedefs are for equivalent types? I asked in another question how to check that two typedefs are the same. However, suppose int and long int are both 32-bit on my compiler, and two libraries might use each. I want the check to report that typedef of int and typedef of long int are the same for this compiler (perhaps not for another). Thanks.</p> <p>This is not the same as the other question. The solution to the other question has (int) and (long int) fail the check, even if both are 32-bit. Now I want them to pass the check please.</p> <p>I am not using C++11.</p>
c++
[6]
1,851,882
1,851,883
C++: Reading Binary Files
<p>I have a Binary file that has several names followed by some details (50 bytes fixed). Each name is followed by 0X00 followed by the 50 byte details. I need to extract just the names from the file. i.e read all characters till 0x00, skip 50 bytes and continue till end of file.What is the best way to do it in C++. </p>
c++
[6]
5,272,157
5,272,158
Playing video using UIWebview
<p>detailVideo.h</p> <p><code><pre> @interface detailVideo : UIViewController { IBOutlet UIWebView *webview; NSString *urlAddress; } @property(nonatomic,retain)NSString *urlAddress;</p> <p>@end </pre></code></p> <p>detailVideo.m <code><pre>- (void)viewDidLoad {</p> <pre><code>NSString *reqUrl = urlAddress; //Create a URL object. NSURL *url = [NSURL URLWithString:reqUrl]; //URL Requst Object NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; //Load the request in the UIWebView. [webview loadRequest:requestObj]; // webView.opaque = NO; webview.delegate = self; </code></pre> <p>}</pre></code> The video is working fine.But if i click the Done button,it redircts some other page which consists Replay button.I want switch back from this view?</p> <p>How can i do it?</p>
iphone
[8]
5,719,004
5,719,005
Issue with jQuery and IE
<p>I just can't seem to figure out why my code is not working at all in IE. It works just fine in every other browser. Can anybody spot an issue?</p> <pre><code>$(document).ready(function (){ var timerId = 0; $("#timerwrap").ready(function(){ $("#timerwrap").html("Please wait &lt;span style='font-weight: bold !important;' id='show-time'&gt;4&lt;/span&gt; seconds"); console.log(timerId) if(timerId == 0){ timerId = window.setInterval(function() { var timeCounter = $("#show-time").html(); var updateTime = parseInt(timeCounter,10) - 1; $("#show-time").html(updateTime); if(updateTime &lt;= 0){ clearTimeout(timerId); $("#ltext").fadeOut('fast'); $("#closeme").delay(600).fadeIn('fast'); } }, 1000); } }); }); $(document).ready(function () { $("#closeme").click(function() { $("#rf").css("display", "none"); $("#toppy").css("display", "none"); }); }); $(document).ready(function () { $("#closelogo").click(function() { $("#rf").css("display", "none"); $("#toppy").css("display", "none"); }); }); </code></pre> <p>Any help would be really appreciated, thanks.</p>
jquery
[5]
1,377,706
1,377,707
How to create an Email Id using c#..?
<p>Hi I want to create a program that helps me to create an email id.I mean it fills the other details and I will only enter the captcha.. Is there any way to do it using c#..?</p>
c#
[0]
5,675,689
5,675,690
Turning a List<Class> object ToString()
<p>I created a List using a class</p> <pre><code>public static List&lt;Holding_Class&gt; Holding { get; set; } </code></pre> <p>Here is my class</p> <pre><code> class Holding_Class { public string Key { get; set; } public string RealID { get; set; } public string URL { get; set; } } </code></pre> <p>When I do a for loop on the class i try to reference key and a string and pass it into a void and all I get is System.Object as the string text. What Can I do to get Key's real text.</p> <pre><code> for (int i = 0; i &lt; Holding.Count; i++) { Process_HTML(htmlResultString,Holding[i].Key.ToString(); } </code></pre> <p>"System.Object[]" is the result from Holding[i].Key.ToString(). When i'm in debug I can see the real value.</p> <p>here is Process_HTML</p> <pre><code> public static void Process_HTML(string HTML, string key) { //do mysql work Console.WriteLine(key); } </code></pre> <p>It's nothing more then that</p> <p>Here is the population</p> <pre><code> foreach (DataRow realDtRow in Real.Rows) { Holding_Class Hold = new Holding_Class { Key = dtRow.ItemArray.ToString(), Real = realvinDtRow.ItemArray[0].ToString(), URL = realvinDtRow.ItemArray[0].ToString() }; Holding.Add(Hold); } </code></pre>
c#
[0]
5,323,965
5,323,966
how to react to an intent of the browser?
<p>Yo guys.</p> <p>You know when u do options/more/share page from the browser? Well I'd like an activity of mine to show up in the menu of all the apps capable of responding to that browser's intent. Thing is I dunno how to write the intent filter in the manifest. Also how do I access data like URL and title of the page which are supposedly add as extra in the intent?</p> <p>Cheers</p>
android
[4]
3,721,313
3,721,314
how locale aware is preg_replace in php?
<p>If I do, preg_replace('/[^a-zA-Z0-9\s-_]/','',$val) in a multi-lingual application, will it handle things like accented characters or russian characters? If not, how can I filter user input to only allow the above characters but with locale awareness?</p> <p>thanks!</p> <p>codecowboy.</p>
php
[2]
4,137,087
4,137,088
Javascript substring with escape characters
<p>i have a string like the following</p> <pre><code>var string1 = " folder\\subfolder1\\subfolder2 " </code></pre> <p>and i want to replace the "\" with "/" with string1.replace in order to be</p> <pre><code>var string2 = "folder/subfolder1/subfolder2" </code></pre> <p>I tried </p> <pre><code> var rep = path.replace("\\", "/"); </code></pre> <p>but is not working. Any help ?</p>
javascript
[3]
4,222,453
4,222,454
Structure error: Not recognized even though it is included
<p>More quetions: i get an unrecognized 'eld' from mai structure.</p> <p>header contains:</p> <pre><code>const int c=10; struct Array { int n; int els[c]; }; </code></pre> <p>The error i get is:</p> <blockquote> <p>error: request for member 'els' in 'A', which is of non-class type 'Array [(((unsigned int)(((int)a) + -0x000000001)) + 1)] {aka Array [(((unsigned int)(((int)a) + -0x000000001)) + 1)]}'</p> </blockquote> <p>Code:</p> <pre><code>Array arrayInp() /* Create 2 vectors by the length defined by the user*/ { int a,b,i; cout&lt;&lt;"enter length of the first array: "; cin&gt;&gt;a; cout&lt;&lt;"enter length of the second array: "; cin&gt;&gt;b; Array A[a],B[b]; cout&lt;&lt;"insert first array:"; for (int i=0;i&lt;a;i++) { cin&gt;&gt;A.els[i]; } cout&lt;&lt;"insert second array:"; for (int i=0;i&lt;a;i++) { cin&gt;&gt;B.els[i]; } return A,B; } </code></pre> <p>One more error, my return isent right can someone explain me a way how to return the array structures from the functions? after build errors:</p> <blockquote> <p>..\scr\main.cpp:32:10: warning: left operand of comma operator has no effect [-Wunused-value] ..\scr\main.cpp:32:10: error: could not convert '(0, ((Array*)(&amp; B)))' from 'Array*' to 'Array' ..\scr\main.cpp:11:10: warning: unused variable 'i' [-Wunused-variable] ..\scr\main.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]</p> </blockquote>
c++
[6]
2,445,030
2,445,031
Passing data from one php page to another is not working - why?
<p>Frustrated php novice here...</p> <p>I'm trying to pass a "type" value of either billto or shipto from ab.php to abp.php.</p> <p>ab.php snippet: </p> <pre><code>&lt;?php echo '&lt;a href="' . tep_href_link(FILENAME_ABP, 'edit=' . $bill_address['address_book_id'] . '&amp;type=billto', 'SSL') . '"&gt;' . tep_image_button('small_edit.gif', SMALL_IMAGE_BUTTON_EDIT) . '&lt;/a&gt;'; ?&gt; </code></pre> <p>This does add the &amp;type=billto to the end of the url. It looks like this: www.mydomain.com/abp.php?edit=408&amp;type=billto&amp;id=4a6524d</p> <p>abp.php snippet:</p> <pre><code>if ($HTTP_GET_VARS['type'] == 'billto') { then it does a db update... </code></pre> <p>The if returns false though (from what I can tell) because the update is not performed. </p> <p>I've also tried $_GET instead of $HTTP_GET_VARS.</p> <p>Because the code in abp.php isn't executed until after the user clicks a button, I can't use echos to check the value, but I can see the type in the url, so I'm not sure why it's not executing.</p> <p>Could really use some direction... whether it's what I need to change, or even just suggestions on how to troubleshoot it further. I'm in the middle of a huge learning curve right now. Thanks!!!</p> <p>edit: Sorry, I just realized I left out that after the db update the user goes back to ab.php. So the whole workflow is this:</p> <p>User goes to ab.php. User clicks link to go to abp.php. User changes data on abp.php. User clicks button on abp.php. Update to db is executed and user is sent back to ab.php.</p>
php
[2]
763,645
763,646
Iphone cocoa-touch animation suggestions
<p>I need a documents or blogs and so on.. I'm realy interesting the animating views, user interface elements on the cocoa-touch king of crash course and how to design them in the photoshop or like that.</p> <p>I found a few books about describing this subject. As i described the subject i realy need to crash information about these. I know i know, i think and heard somebodies says "you should read a lot of books for achieving this".</p> <p>Does anyone have any suggestions ? </p>
iphone
[8]
1,143,604
1,143,605
First 6 ListView elements are continuously being invoked with getView()
<p>When I check my logs, when using ListView, I see, that getView() method of a custom adapter is continuously invoked on first 6 elements, even if I scroll to the very end of the list. Has anyone seen behaviour like this?</p>
android
[4]
2,845,733
2,845,734
iPhone: Application submission in AppStore
<p>I want to submit my application in AppStore. After i have gone through the docs there, i see i should go to iTunes Connect and fill the form to submit my application in AppStore. If someone already did it, can you guys please share your suggestion? I did build 'Distribution' in my Xcode project and compressed my app ready, i want to upload it in AppStore as i have already a developer account. ** I also want to know, should my build be created using 'Distribution' configuration and built with Distribution provisional file? I have three provisional file created such as Main provisioning profile in 'Provisioning->Development' tab in Portal and Ad-hoc, AppStore provisional profiles in 'Distribution' tab in Portal. Which one i should use in Xcode and build my application to upload that in AppStore? Can i use any one of the three? **Can i go to iTunes Connect and fill the form to upload my app? During filling the form it asks for 'Does your product contain encryption?' Why is that and what does it mean? After further filling up the details, will it ask me to upload my Zipped application(myApp.app file) there? How would be the process further, just give me some brief idea please?</p> <p>Clave/</p>
iphone
[8]
5,924,748
5,924,749
using sleep(), I cannot get my values to echo
<p>I'm using a sleep function inside of a foreach loop and I'd like to echo the value inside the loop. Why isn't this working? The $test var inside the loop never changes from 0.</p> <pre><code>foreach($test as $val){ ob_start(); echo $test++; sleep(1); ob_end_flush(); } </code></pre>
php
[2]
1,835,686
1,835,687
What is the best way to start learning how to program?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/335063/whats-the-easiest-way-to-learn-programming">What&rsquo;s the Easiest Way to Learn Programming?</a> </p> </blockquote> <p>I'm very new to programming, but it has always interested me. I've tried to learn a couple of times except I don't know where to begin. What's a good language to learn first? What is a good website that can help me learn it?</p> <p>I once partitioned my hard drive and installed Ubuntu in an attempt to learn Python, but I was overwhelmed. I didn't know where to start or what to do.</p> <p>All suggestions, feedback, comments are welcome.</p>
python
[7]
2,711,695
2,711,696
jQuery deferreds
<p>I'm new to jquery deferreds. Here I have a simple <a href="http://jsfiddle.net/wadam1972/gEw2F/5/" rel="nofollow">example</a>. </p> <p>Can anybody tell me why the done function ("now it's my time") is fired before the other functions is done? </p> <p>The guys in this <a href="http://msdn.microsoft.com/en-us/scriptjunkie/gg723713" rel="nofollow">example</a> also create a deferred object and return a promise, so do I.<br> How must I change my little example to get the done function only fired after this 6 seconds (after the timeout)? </p> <p>Thanks alot in advance<br> Wolfgang</p>
jquery
[5]
2,011,898
2,011,899
How to get the value of file upload in textbox?
<p>I am working on a website and stuck in the following code. Here I have to get the value of file upload in textbox. I am using jquery code as follows,</p> <pre><code>$(document).ready(function() { $('input[name="product_picture"]').change(function() { var selectedValue = $(this).val(); $('input[name="product"]').val(selectedValue); }); }); </code></pre> <p>and my textbox and fileupload is,</p> <pre><code>&lt;input type="file" name="product_picture" value="" /&gt; &lt;input type="text" name="product" /&gt; </code></pre> <p>But the textbox value is showing with full path like <code>C:\fakepath\2.png</code>, But I need to get only <code>2.png</code> please help me out.</p>
jquery
[5]
4,742,712
4,742,713
jQuery animte position left top with hover
<p>basically when I hover normally over the box it moves and goes back to the position but when you hover fast several times box goes backwards and loses position, any idea why? Thanks!</p> <p>Also I need to grab current div position so im using <code>$(this)</code> when hover.</p> <p>here is the code: <a href="http://jsfiddle.net/JdMqM/1/" rel="nofollow">http://jsfiddle.net/JdMqM/1/</a></p> <p>html:</p> <pre><code>&lt;div class="box_wrap"&gt; &lt;div class="box"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>css:</p> <pre><code>.box_wrap { width: 200px; height: 200px; border: 1px solid red; position: relative; margin: 10px; } .box { top: 0; left: 0; background: green; position: absolute; width: 200px; height: 200px; } </code></pre> <p>js:</p> <pre><code>$('.box').hover( function(){ var h = $(this).height(); var w = $(this).width(); var t = $(this).position().top; var l = $(this).position().left; $(this).animate({ 'width': w + 20 + 'px', 'height': h + 20 + 'px', 'left': l + 20, 'top': t + 20 }, { duration: 200, queue: false }); }, function(){ var h = $(this).height(); var w = $(this).width(); var t = $(this).position().top; var l = $(this).position().left; $(this).animate({ 'width': w - 20 + 'px', 'height': h - 20 + 'px', 'left': l - 20, 'top': t - 20 }, { duration: 200, queue: false }); } ); </code></pre>
jquery
[5]