Unnamed: 0 int64 65 6.03M | Id int64 66 6.03M | Title stringlengths 10 191 | input stringlengths 23 4.18k | output stringclasses 10 values | Tag_Number stringclasses 10 values |
|---|---|---|---|---|---|
4,701,811 | 4,701,812 | PHP function does not return alphanumeric string | <p>I constructed a php function given below to return a string for eg. 007ABX, but function does not return that string..</p>
<pre><code>function abc($aa)
{
//some code goes here
$az = range('a', 'z');
$r = array_rand($az, 2);
$str = $az[$r[0]] . $az[$r[1]];
$new =$aa.$str;
return $new;
}
$ab = abc($aa);
echo $ab //$ab does not print anything here.
</code></pre>
| php | [2] |
2,510,241 | 2,510,242 | Using querySelectorAll(). Is the result returned by the method ordered? | <p>I'm trying to make a js code that works with multiple pages.
I'm trying to use querySelectorAll() to obtain the elements form the DOM.</p>
<p>I need the elements to be ordered. In order to do that I may use xPath or selectors (I'd prefer to use selectors but xPath is also ok). The problem is:<br>
Are the elements in the NodeList returned by querySelectorAll() ordered against the order that the tags appear in the HTML?</p>
<p>Note: I'd like to add the tag: querySelectorAll</p>
| javascript | [3] |
4,237,797 | 4,237,798 | PHP String help required | <p>I need to call the following parameters on a string</p>
<pre><code>control_lbsresulted.php?lat=-25.74546&long=28.11222&dist=300&msisdn=0831231234
</code></pre>
<p>I have this string currently </p>
<pre><code><a href="control_lbsresulted.php?msisdn=<? echo $rows['msisdn']; ?>" class="update">Look Up</a>
</code></pre>
<p>I can only seem to get the above to draw the MSISDN for me, do i need to add semi-colon with spacing to get the other as required as such:</p>
<pre><code><a href="control_lbsresulted.php?msisdn=<? echo $rows['msisdn']; ?> , dist=<? echo $rows['dist']; ?>" class="update">Look Up</a>
</code></pre>
| php | [2] |
1,699 | 1,700 | is it safe to use Debug Folder files for distribution? | <p>is it safe to use Debug Folder files for distribution ? or I should use release folder .</p>
<p>I use vs 2008 express edition .</p>
| c# | [0] |
5,016,146 | 5,016,147 | how to eliminet same data Table View When get data using NSXMlParsing | <p>XML Categary tag is same data For me i got twice in table View please give me reply fast.</p>
<p>if in application xml some data are repeat like if we have recipe Many of recipe belongs same landmark so for in my app that all are show repeatedly in table view i want to element same name in xmL (i want to group by them). </p>
<p>Thank you my friend in advance</p>
| iphone | [8] |
3,385,924 | 3,385,925 | Web Form Validator Layout Issue | <p>I have a Div that holds a RadioButtonList with 2 values and a required field validator.</p>
<p><img src="http://i.stack.imgur.com/BvE60.jpg" alt="enter image description here"></p>
<p>As you can see the validator wraps to the next line (Circled). I am trying to get it to display next to the RadioButtonList (where the red dot is). No matter what I do it remains on the next line.</p>
<p>I have made the cell wider with no effect. I have set Display to Dynamic, no effect. With all the other controls on the form (textboxes & Drop downs) the validator displays correctly but this one wont. It is the same in Design mode as it is when I run the app.</p>
| asp.net | [9] |
893,097 | 893,098 | i want to convert List<object> to ArrayList but not getting any output | <p>here is my code...</p>
<pre><code>[WebMethod]
public ArrayList GetDataByModuleName(string ModuleName)
{
ArrayList m = (ArrayList)BAL_GeneralService.GetDataByModuleName(ModuleName);
return m;
}
</code></pre>
<p>but not getting any output...</p>
| asp.net | [9] |
1,876,721 | 1,876,722 | iphone developer program gap | <p>I have a client that has around 200 employees. They don't qualify for the enterprise account, but need more devices than the standard business account (currently 100).</p>
<p>Does anyone know how to handle the middle ground? Are you allowed to have multiple accounts to handle this?</p>
<p>Thanks!</p>
<p>Rob</p>
| iphone | [8] |
4,305,590 | 4,305,591 | Print to console using System.out.write | <p>It is homework question.</p>
<p><strong>Question:</strong></p>
<blockquote>
<blockquote>
<p>"Use an array of integers with size 10 and print the content of the array using write( ) method.</p>
<p>Note: Please do not use System.out.println( ) method."</p>
</blockquote>
</blockquote>
<p>This is what I have tried so far, but it doesn't work.</p>
<pre><code>int i = 0;
while (i != array.length) {
byte[] temp = new byte[4];
temp[0] = (byte) (array[i] & 256);
array[i] = array[i] >> 8;
temp[1] = (byte) (array[i] & 256);
array[i] = array[i] >> 8;
temp[2] = (byte) (array[i] & 256);
array[i] = array[i] >> 8;
temp[3] = (byte) (array[i] & 256);
System.out.write(temp, 0, 4);
i++;
}
</code></pre>
<p>I can't find a way to do this, please help me out.</p>
<p>Thanks in advance. :)</p>
| java | [1] |
5,196,716 | 5,196,717 | Updating deprecated Code | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6044995/is-using-globalshttp-get-vars-deprecated">Is using $GLOBALS['HTTP_GET_VARS'] deprecated?</a><br>
<a href="http://stackoverflow.com/questions/8561822/invalid-arguements-in-php">Invalid arguements in php</a> </p>
</blockquote>
<p>I get the following response when I run script in a WAMP environment:</p>
<blockquote>
<p>Warning: Invalid argument supplied for foreach() in
C:\wamp\www\GeCard\eCardScript_ecards\ecard_lib.php on line 17</p>
<p>Warning: Invalid argument supplied for foreach() in
C:\wamp\www\GeCard\eCardScript_ecards\ecard_lib.php on line 21</p>
</blockquote>
<p>This is my code:</p>
<pre><code>function getPostGetVars() {
global $HTTP_POST_VARS,$HTTP_GET_VARS;
foreach ($HTTP_POST_VARS as $key => $value) { //This is line 17
global $$key;
$$key = $value;
}
foreach ($HTTP_GET_VARS as $key => $value) { //This is line 21
global $$key;
$$key = $value;
}
}
</code></pre>
<p>I am told that this code is deprecated. Can this piece of code be easily updated to eliminate the warnings?</p>
| php | [2] |
5,019,853 | 5,019,854 | Nested php includes using './' | <p>I have several PHP files include()ing other files from several other directories.</p>
<p>In one of those included files: <code>foo/bar.php</code>, I want bar.php to include 3 other files contained in the directory foo. However bar.php is actually included by another file in another directory, which is included by yet another file, and so on.</p>
<p>If I did:</p>
<pre><code>include('./apple.php');
include('./orange.php');
</code></pre>
<p>In <code>foo/bar.php</code>, will it include the correct files from the <code>foo</code> directory regardless of which file included bar.php in itself?</p>
| php | [2] |
1,726,801 | 1,726,802 | Python datatype suitable for my cache | <p>I'm searching for the a datatype for a cache, basically I need the functionality of a dict, i.e. random access based on a key, which has a limited number of entries so that when the limit is reached the oldest item gets automatically removed.
Furthermore I need to be able to store it via shelve or pickle and rely on Python 2.4.
Should I subclass dict and add a list to it? Any suggestions?</p>
<p><strong>Edit:</strong><br />
I have not mentioned the scale, I need to keep track of already read items which consist of a signature by which they are identified and I only want to keep track of about a few hundred of them.
collections.deque seem nice but that's a list and I need random access. So dict would seem suitable, however somehow I need to expire items if the limit is hit which means I need to keep track the order in which they have been added.</p>
| python | [7] |
4,289,764 | 4,289,765 | jquery image hotspots | <p>I'm looking for a jquery script that lets me add hotspots to an image.
They way I imagine it to work is like this.</p>
<p>I can drag an image to a location on the image.
The location = the dragged image X Y coordinates is retrievable.</p>
<p>Thats it, does anyone know of a script that can help me do that?</p>
| jquery | [5] |
881,858 | 881,859 | is it possible to write python scripts which can do router configuration without telnetting into the router? | <p>i want to do router configuration using python , but dont want to use any application level protocol to configure it . Is it possible to deal it on a hardware level ? Please do tell if the question is vague or if it needs more explanation , then I would put more details on as to what I have my doubt in </p>
| python | [7] |
1,033,661 | 1,033,662 | How do I mail the error context? (Make a string of it) | <p>Consider the custom error fucntion:</p>
<pre><code>function customError($errNumber, $errString, $errFile, $errLine, $errContext)
</code></pre>
<p>The <code>$errContext</code> provides a lot of useful information to debug with. How can I put this into a string and mail it?</p>
<p><strong>My first attempt:</strong></p>
<pre><code>$mailContent = "Error \n";
foreach($errContext as $errType => $stringOrArray)
{
$mailContent .= "\n$errType =>";
if(is_array($stringOrArray))
{
$mailContent .= " Array\n";
foreach($stringOrArray as $key => $value)
{
$mailContent .= "\n $key => $value";
}
$mailContent .= "\n";
}
else
$mailContent .= " $stringOrArray";
}
</code></pre>
<ul>
<li>This does not work with objects (yet).</li>
<li>This is not very elegant.</li>
</ul>
<p>Is there an easy way that I do not know about?</p>
<p>Thanks in advance!</p>
| php | [2] |
3,447,028 | 3,447,029 | Java PreparedStatement(ResultSet) closing for no reason | <p>I am using PreparedStatements[] to do SQL in my app(JAVA).However, for some reason, some of the statements I can call more than once, like my checkLoginDetails() method. But some others,when I try to call more than once, says connection closed:(. Please can someone tell me why it is doing this, and how to fix.</p>
<p>Thanks alot</p>
| java | [1] |
1,078,312 | 1,078,313 | jQuery conflicts (not in Chrome) | <p>I am writing a widget and am depending on jQuery so i need to use the noconflict in order to avoid problems for pages where site owners are also running jQuery.</p>
<p>I have this so far:</p>
<pre><code>(function () {
var js13;
var script = document.createElement('script');
script.src = 'http://xxx.xxx.xxx.xxx:8080/socket.io/socket.io.js';
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
var script = document.createElement('script');
script.src = 'http://code.jquery.com/jquery-1.8.3.js';
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
var script = document.createElement('script');
script.src = 'http://code.jquery.com/ui/1.9.2/jquery-ui.js';
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
script.onload = scriptLoadHandler;
function scriptLoadHandler() {
js13 = window.jQuery.noConflict(true);
main();
}
/******** Main function ********/
function main() {
js13(document).ready(function ($) {
main widget code is here.....
} // main
})();
</code></pre>
<p>Any ideas what could be wrong? I am getting (Safari):</p>
<pre><code>Type Issue
'undefined' is not an object (evaluating 'window.jQuery.noConflict')
</code></pre>
<p>Need it to work in all browsers, no matter what jQuery or other scripts a page is running.</p>
<p>Another problem is that <a href="http://xxx.xxx.xxx.xxx:8080/socket.io/socket.io.js" rel="nofollow">http://xxx.xxx.xxx.xxx:8080/socket.io/socket.io.js</a> is not always loading..</p>
<p>I neeed that to load before the rest loads</p>
| jquery | [5] |
127,438 | 127,439 | How can I set variable 'allow_url_fopen' in .htaccess or php file? | <p>How can I turn on <code>allow_url_fopen</code> in <code>.htaccess</code> or a PHP file?</p>
| php | [2] |
949,289 | 949,290 | Once the server is down, this snippet is keep calling the server repeately, how to stop? | <p>Once the server is down, this snippet is keep calling the server repeatedly, how could I make it stop the repeated calling once the request fails? Maybe a catch/error block? But I'm not sure how to implement it. Thanks!</p>
<pre><code>HttpURLConnection httpConn = null;
InputStream is = null;
OutputStream os = null;
String xmlResponse = null;
try {
//Open Connection
String CollectionId="123";
String GetHTML="1";
String urlString = "http://tester.com/webservices/ContentWS.asmx/GetCollection?CollectionId="+CollectionId+"&GetHTML="+GetHTML;
System.out.println(urlString);
//String encodedUrl = URLEncoder.encode(urlString,"UTF-8");
URL url = new URL(urlString);
httpConn = (HttpURLConnection)url.openConnection();
//Setup Request
httpConn.setRequestMethod("GET");
httpConn.setDoOutput(true);
httpConn.setReadTimeout(10000);
httpConn.connect();
xmlResponse = convertStreamToString(httpConn.getInputStream());
}
catch (IOException e) {
e.printStackTrace();
}
String htmlContent = "";
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
InputSource input = new InputSource();
input.setCharacterStream(new StringReader(xmlResponse));
Document doc = db.parse(input);
NodeList nodes = doc.getElementsByTagName("Item");
// iterate the Items
int i = 0;
int j = 0;
Date now = new Date();
for (i = 0; i < 2; i++) {
//Grab HTML to append to htmlContent
NodeList teaser = doc.getElementsByTagName("Html");
Element line = (Element) teaser.item(i);
htmlContent += getCharacterDataFromElement(line);
}
}
catch (Exception e) {
e.printStackTrace();
}
htmlContent = ...
</code></pre>
| java | [1] |
3,911,718 | 3,911,719 | call a java function when we press browser close button | <p>how we can call a java function when we press browser close button...mins when when we close the browser...</p>
| javascript | [3] |
114,227 | 114,228 | byte array to Int Array | <p>I am reading a file by using:</p>
<pre><code>int len = (int)(new File(args[0]).length());
FileInputStream fis =
new FileInputStream(args[0]);
byte buf[] = new byte[len];
fis.read(buf);
</code></pre>
<p>As I found <a href="http://java.sun.com/developer/technicalArticles/Programming/PerfTuning/" rel="nofollow">here</a>. Is it possible to convert <code>byte array buf</code> to an <code>Int Array</code> ? Is converting the <code>Byte Array</code> to <code>Int Array</code> will take significantly more space ?</p>
<p>Edit: my file contains millions of ints like,</p>
<p>100000000 200000000 ..... (written using normal int file wirte). I read it to byte buffer. Now I want to wrap it into IntBuffer array. How to do that ? I dont want to convert each byte to int.</p>
| java | [1] |
358,776 | 358,777 | Why could wget not work with PHP's exec function? | <p>My script tries to exec() wget but seems to fail (though, no error raises up). What could be the problem? Should I tune PHP somehow? I just installed Apache and PHP on Ubuntu...</p>
| php | [2] |
4,518,483 | 4,518,484 | How return correct checking float.Parse(String)? | <p>In my project I have a textBox. I assume user type in it float variable or text.
If user types in it float variable I need to check this variable it is actually float type.
I guess some how return true/false from float.Parse(String). It is posible??? </p>
| c# | [0] |
3,212,462 | 3,212,463 | Is it possible to create a custom notification with controls such as buttons in Android? How? | <p>According to the <a href="http://developer.android.com/guide/topics/ui/notifiers/notifications.html#CustomExpandedView" rel="nofollow">Android Developers' Guide</a>, it is possible to create a custom notification view. However, is it possible to create one with controls such as buttons and text views? If yes, how?</p>
<p>Note that I think it has something to do with <a href="http://developer.android.com/reference/android/app/PendingIntent.html" rel="nofollow">PendingIntent</a>.</p>
| android | [4] |
3,819,462 | 3,819,463 | Fire event on enter key press for a asp.net textbox | <p>i have one </p>
<pre><code><asp:TextBox ID="txtAdd" runat="server" />
</code></pre>
<p>control, now after write something in this textbox, and user press ENTER key , i want to run some code from codebehind</p>
<p>what should i do?</p>
<p>Edited : </p>
<p>using Jquery i captured ENTER key button and fired some hidden button event</p>
<pre><code>$(document).ready(function(){
$(window).keydown(function(e){
if(e.keyCode == 13) $('#<% addbtn.ClientID %>'.click();
});
});
</code></pre>
<p>but is there any better way ?</p>
| asp.net | [9] |
3,577,449 | 3,577,450 | Not able to pull the SQlite database file from Eclipse file explorer | <p>I am not able to pull a SQLite database file from the directory <code>data/data/package/database</code>.
I gave up pulling the file from the device, but it's showing:</p>
<blockquote>
<p>failed to pull the section</p>
</blockquote>
<p>How do I fix this problem.</p>
| android | [4] |
4,717,152 | 4,717,153 | Post content without params using DefaultHttpClient in android | <p>I would like to post the content to the server url without any params from the below code </p>
<pre><code>String data = "DQoJPElQQ29tbWFuZCBDb21t+PElQQ29tbWFuZHM+DQoJPElQQ29tbWFuZCBDb21t+DQoJPElQQ29tbWFuZCBDb21t";
try {
nameValuePairs.add(new BasicNameValuePair("mydata", data));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = client.execute(httppost);
str = new Scanner(response.getEntity().getContent(), "UTF-8").useDelimiter("\\A").next();
Log.v("srv response:", str);
} catch (SecurityException e) {}
</code></pre>
<p>I need to post the data to the server without params like "mydata" // <code>nameValuePairs.add(new BasicNameValuePair("mydata", data));</code></p>
<p>I don't want to <code>UrlEncodedFormEntity</code> the data, I need to post simply exact data what I have in String data</p>
<p>any one have idea ?? how to manage ?</p>
| android | [4] |
2,932,986 | 2,932,987 | msvcprt and crt | <p>I have editbin msvcprt and look for scanf for instance but i can't find it.</p>
<p>Does it mean crt is not encapsulate in msvcprt ?
Does it mean cin function doesn't use scanf ?</p>
| c++ | [6] |
654,778 | 654,779 | How to re-open same activity after application forcly stopped? | <p>In my Android application i have a requirement to re open the same activity from where the application shut down or we manually force stopped it. </p>
<p>I can able to display the same activity but my application is losing all the datas. If you have any solution then please post.</p>
<p>Thanks</p>
| android | [4] |
3,698,213 | 3,698,214 | C# - Install .Net framework4 | <p>I want to ask about .net framework4 . it take along time through installing, is there a way to shorten the time of installing .</p>
<p>for example, can I make program to install it manually by installing only dlls that I use in my application?</p>
| c# | [0] |
3,055,914 | 3,055,915 | setText(getString(R.strings.whatever) or setText(R.strings.whatever)? | <p>Both work, obviously if you start concatenating you'll need get string in order to avoid displaying an int. </p>
<p>Question: which is the most 'elegant' or 'recommended' to use?</p>
<p>Thank you</p>
| android | [4] |
4,518,753 | 4,518,754 | count rows in a text file | <p>I have the following rows in a text file and I need to know how many rows end with a Y and how many end with a N.</p>
<p>there is a space after the Y and after the N.</p>
<p>The faster the better as it might contain a million or so rows.(so I would prefer not to loop through every line)</p>
| c# | [0] |
2,161,149 | 2,161,150 | Loop through tables last row and set the data cell values | <p>I am using <code>clone()</code> to add new row to the table. But the clone is copying the <code><td></code> ID values also. How can I change the ids and the values of the rows that were copied? Also, I have a <code><select></code> in one <code><td></code> cell how can I attach onchange event to this select.</p>
| jquery | [5] |
3,633,047 | 3,633,048 | Resize a UIBarButtonItem when the title gets too wide | <p>Some background: I wanted to have 3 buttons on a <code>UIToolBar</code>. I managed to get the middle one centered and everything by putting it into a <code>UIToolBar</code> itself into a <code>UIView</code>. </p>
<p>Everythings looks just like it should apart from when the title of the middle buttons gets too big.
It then gets displayed under the left or right buttons.</p>
<p>I can't get the <code>UIToolBar</code> or the <code>UIBarButtonItems</code>'s width to be able to resize them when they're too big.
The 'UIBarButtonItem' has a really nice <code>width</code> property that would allow me to resize the control if it's too big.
But I can't know when it's too big!</p>
<p>EDIT: I did the hard way in the end. I calculate the size of the text and compare it to the maximum pixel size I saw fit on the device. Ugly but it works.</p>
<pre><code>+ (CGFloat)calculateTextWidth:(NSString *)text
{
CGSize fullSize = [UIScreen mainScreen].applicationFrame.size;
UIGraphicsBeginImageContext(fullSize);
CGContextRef context = UIGraphicsGetCurrentContext();
// calculate the text size
CGContextSelectFont(context, "Helvetica", 17, kCGEncodingMacRoman);
CGContextSetTextMatrix(context, CGAffineTransformMakeScale(1.0, -1.0));
CGContextSetTextDrawingMode(context, kCGTextInvisible);
// measure the text
CGPoint initialTextPosition = CGContextGetTextPosition(context);
CGContextShowTextAtPoint(context, 0, 0, [text cStringUsingEncoding:NSASCIIStringEncoding], text.length);
CGPoint finalTextPosition = CGContextGetTextPosition(context);
return finalTextPosition.x - initialTextPosition.x;
}
</code></pre>
| iphone | [8] |
5,229,944 | 5,229,945 | How to save the code object in file? | <p>How to save the code object (_ _ code _ _) in file? </p>
<pre><code>>>> c
<code object foo at 0x022E7660, file "<console>", line 1>
>>> pickle.dump(c, f)
Traceback (most recent call last):
File "<console>", line 1, in <module>
_pickle.PicklingError: Can't pickle <class 'code'>: attribute lookup builtins.code failed
>>> f.write(c)
Traceback (most recent call last):
File "<console>", line 1, in <module>
TypeError: 'code' does not support the buffer interface
</code></pre>
| python | [7] |
5,962,209 | 5,962,210 | A few questions about C++ classes | <p>I have two basic questions. The first one is about function in other classes. If I have a header file with a class in it and I want to use that function in another class I have created, do I always have to construct a class object to run a function in that class like: </p>
<pre><code>someclass class; <----object construction
class.somefunction();
</code></pre>
<p>Is there a way just to call the function with the object construction? </p>
<p>And the second question is it okay to put multiple small classes in one header file?</p>
| c++ | [6] |
942,632 | 942,633 | How to target list items per two lists instead of even or odd | <p>As the title says I want to give different bg colors per 2 lists with jQuery...
For example:</p>
<pre><code><li><!-- blue --></li>
<li><!-- blue --></li>
<li><!-- red --></li>
<li><!-- red --></li>
</code></pre>
<p>Thanks in advance!</p>
<p>Update:
The following code indicates odd and even lists, I wonder if there is a way to target per 2 lists like that... instead of <code>:odd</code> or <code>:even</code> how can I accomplish this? </p>
<pre><code>$("li:odd").addClass("blue");
$("li:even").addClass("red");
</code></pre>
| jquery | [5] |
1,463,831 | 1,463,832 | accessing a singleton as a concatenated variable | <p>How can I get something like this to work</p>
<pre><code>$name = 'Config';
$static = $name . '::init()';
$static->test();
</code></pre>
<p>how can I access the test method from that setup?</p>
<p>I want to piece together a couple of variables to build up a dynamic singleton call.</p>
<p>so <code>$name</code> could be 'Db', 'Array' etc.</p>
| php | [2] |
5,764,708 | 5,764,709 | How to create a save option ? to save change that is made in .txt file from python | <p>this is my assignment:
Description: We are interested to develop a Costumer Management System for a company, which stores customers and orders information and helps system user to search, edit, and enter data. Each customer has a <code>CustomerNumber</code> (ID), <code>Name</code>, <code>Address</code>, and <code>Phone</code> which can be stored in a list such as <code>[1, “Amin Milani Fard”, “Columbia College”, 778]</code>. Each order has an <code>OrderNumber</code>, <code>CostumerNumber</code>, <code>OrderDate</code>, and <code>OrderedItemsList</code> such as <code>[5,1,”20/06/2011”, [“XYZ”, “ABC”, “LMNOP”]]</code>.</p>
<p>You will be given two input text files, customer.txt containing list of costumers, and orders.txt containing list of orders. First you need to read the input file and then based on the user choice apply a search, edit, add, or remove on customer and/or order list. Your program should repeat showing a menu as the following while the user did not entered 9 to quit:</p>
<pre><code>**** Welcome to My Customer Management System ****
Please select an option
1. Load the input files
2. Search a customer
3. Search an order
4. Add a new customer
5. Add a new order
6. Delete a customer
7. Delete an order
8. Save data in files
9. Quit
</code></pre>
<p>im having problem with save data in files, i just dont get it this part. I thought when u make changes in option 4 ,5,6,7 it will automatically save. Is there anyway to save a txt file from python?</p>
| python | [7] |
2,951,954 | 2,951,955 | How to solve DATA null issue that occured when capturing image through camera | <p><BR>
I am writing an Android application where I need to display Image Captured through Camera.
I am using Android 2.1 I tested in emulator. I am trying to capture the image , but how to display the captured Image on Screen.
<br>
My activity is as follows:</p>
<pre><code>public class ImageCaptureActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Uri mImageCaptureUri = Uri.fromFile(new File(
"/sdcard/gift2.JPG"));
Intent intent = new Intent(
"android.media.action.IMAGE_CAPTURE");
intent.putExtra(
android.provider.MediaStore.EXTRA_OUTPUT,
mImageCaptureUri);
startActivityForResult(intent, 0);
}
protected void onActivityResult(int requestCode,
int resultCode, Intent data) {
if (requestCode == 0
&& resultCode == Activity.RESULT_OK) {
Toast.makeText(getBaseContext(), "ImageCaptured",
Toast.LENGTH_LONG).show();
Uri chosenImageUri = data.getData();
Bitmap mBitmap = null;
try {
mBitmap = Media.getBitmap(
this.getContentResolver(),
chosenImageUri);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ImageView img = new ImageView(this);
img.setImageBitmap(mBitmap);
setContentView(img);
}
}
</code></pre>
<p>When I execute this class . After capturing image through camera and clicking "ok" I am getting null pointer exception at the statement "Uri chosenImageUri = data.getData();" <br>
Can anyone help me in sorting out this issue.</p>
<p><br>
Thanks in Advance.</p>
| android | [4] |
3,364,246 | 3,364,247 | Convert a string to Decimal(10,2) | <p>how can i convert a string to a Decimal(10,2) in C#?</p>
| asp.net | [9] |
4,096,354 | 4,096,355 | how to avoid Form Re submission in php | <p>I have a form in dashboard.php to create invoice and this is submitted to invoice.php</p>
<p>Now my invoice.php inserts the Invoice and the customer into the database and then shows me a invoice order filling form.</p>
<p>if i refresh this page, it inserts a new invoice for the same customer, how do i avoid this.</p>
<p>I was reading that we could avoid it by redirection, but in my case how do i use it. Some thing like a PRG(post/redirect/get) how to use it?</p>
<p>Do i need to make an intermediate page before going to insert items to invoice</p>
| php | [2] |
3,034,945 | 3,034,946 | GCJ cannot find GCCMain class | <p>I am new to linux and programming in general and I can't even seem to get the simple Hello World code to run. Below is what i have done and the error I am receiving, I am using Cygwin. Can anyone help me? </p>
<pre><code>theys@THEYS1 ~/java
$ vim test.java
theys@THEYS1 ~/java
$ ls
helloworld.java test.java
theys@THEYS1 ~/java
$ uname -a
CYGWIN_NT-6.1-WOW64 THEYS1 1.7.15(0.260/5/3) 2012-05-09 10:25 i686 Cygwin
theys@THEYS1 ~/java
$ cat test.java
public class test {
public static void main (String [] args) {
System.out.println ("Hello World!");
}
}
theys@THEYS1 ~/java
$ gcj --main=test -o test test.java
Exception in thread "main" java.lang.NoClassDefFoundError:
org.eclipse.jdt.internal.compiler.batch.GCCMain
at gnu.java.lang.MainThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException:
org.eclipse.jdt.internal.compiler.batch.GCCMain not found in
gnu.gcj.runtime.SystemClassLoader{urls=[],
parent=gnu.gcj.runtime.ExtensionClassLoader {urls=[], parent=null}}
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at gnu.java.lang.MainThread.run(Unknown Source)
</code></pre>
| java | [1] |
4,833,705 | 4,833,706 | How to turn off animation effect like change activity slide effect | <p>i am developing android application.</p>
<p>i have a question.</p>
<p>how to turn off animation effect like change activity slide effect.</p>
<p>for only my application.</p>
<p>thank you</p>
| android | [4] |
2,655,285 | 2,655,286 | JQuery component id contain [ ] | <p>Hw can i select component with id, which contain [ ] symbols?</p>
<p>for example:</p>
<pre><code><div id=divtables[COURSE_SUBJECTS][141][TITLE]>gg</div>
</code></pre>
<p>Tnx.</p>
| jquery | [5] |
6,012,754 | 6,012,755 | android- How to differentiate the Emulator and Device Programatically | <p>In My application one button is there. if you click on that button we are getting current Location. Based on this current Location i am doing some operations. In device it is working properly. But in emulator we are not getting the current Location thats why i am using the Some default Latitude and Longitude values for emulator. But i want to differentiate the emulator and device. It means we are running in the device means it takes the geocode locations. suppose we are running in the emulator means it takes the default latitude and longitude values. How to implement it pro-grammatically. can anybody help me.</p>
<p>thanks</p>
| android | [4] |
2,170,009 | 2,170,010 | How to display data in grid without wrapping the data? | <p>I have a grid control which is bound to a <code>DataTable</code>. I'm facing a problem in the display of data. Though each line in <code>DataColumn</code> of grid having enough space yet the data is being wrapped to next subsequent lines. But I need the data to be displayed without wrapping. Is it possible?</p>
| asp.net | [9] |
2,436,878 | 2,436,879 | Modern implementation of Spring Remoting or EJB3 | <p>Im working on a "what is possible with the latest and greatest" prototype. One major issue that has been a big thorn in the side of myself and my AS/400 admin is when the existing system spins up, there are 35 individual applications, that each connect to 8 databases, and run a connection pool of 5 connections per. for you math wizards out there, thats 1400 individual database connections to the server on startup and over the course of a typical day maybe 40 are ever used.</p>
<p>What I would like to do in this prototype is move all database functions to a central library (api). From that point, I would like to deploy this API individually and have the 35 applications simply open service classes remotely and pass objects back and forth. end result being the applications no longer have to create database connections, they simply call remote methods and we can tune the central api accordingly to handle the load.</p>
<p>Back in the day, EJB3 would have been the way to go. the integration with security policies is nice, but i always had performance issues with it. Spring remoting running hessian looks promising, seeing im using spring everywhere else. but it has been YEARS since i have had to do anything like this so i was wondering what you guys suggest to use to accomplish this.</p>
<p>thanks</p>
| java | [1] |
5,291,671 | 5,291,672 | How to get flat list in list comprehension from lists of arbitrary number of elements? | <p>I have something like this:</p>
<pre><code>[e for e in ([n for n in xrange(random.randrange(1, 5))] for x in xrange(10))]
</code></pre>
<p>It produces:</p>
<pre><code>[[0, 1, 2, 3], [0, 1, 2], [0], [0], [0, 1], [0], [0, 1], [0, 1, 2, 3], [0, 1, 2], [0, 1, 2]]
</code></pre>
<p>And I need the same but in flat structure.</p>
<p>For now I use something like:</p>
<pre><code>l = []
[l.extend(e) for e in ([n for n in xrange(random.randrange(1, 5))] for x in xrange(10))]
</code></pre>
<p>But is there something less obsucre to achieve this 'unpacking' of arbitrary length list inside comprehension?</p>
| python | [7] |
4,023,845 | 4,023,846 | Extracting URL data from moz_places table within Places.Sqlite in C# | <p>I have created a program to copy out the places.sqlite file to USB storage, however I am needing to access this file to extract all URLs from the moz_places table. What would be the best method to achieve this?</p>
<p>Thanks,
Jason</p>
| c# | [0] |
4,226,660 | 4,226,661 | How do I retain an Android alertdialog sometime | <p>I have an AlertDialog in the activity I used, as: </p>
<pre><code>AlertDialog.Builder ad = new AlertDialog.Builder(this);
ad.setTitle("Unanswered Questions");
ad.setMessage("You have not answered all the questions.");
ad.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.wait(5000);
dosometing();
}
});
ad.show();
</code></pre>
<p>I want click OK, it does not disappear. I click OK,and do <code>dosometing()</code>,then it disappear. I meet question, when i click OK,the dialog disappear. I know I can use activity and theme deal with this problem. if I can use the AlertDialog,</p>
<p>Thank you.</p>
| android | [4] |
4,361,859 | 4,361,860 | Can we design singleton by setting all the data member and method of a class to be static? | <p>how to answer this question?</p>
| c++ | [6] |
2,390,406 | 2,390,407 | after multiplication with two variables then how to display result of that when tab press | <p>after multiplication with two variables in c sharp then how to display the result of that when tab press.</p>
| c# | [0] |
4,306,431 | 4,306,432 | Retreive an image in asp.net | <p>how can i retreive an image in asp.net called "dddd" from a file system and show it on the web page?</p>
| asp.net | [9] |
1,762,114 | 1,762,115 | Android: How to create popup with choices | <p>I want to do something like this: user clicks on a button "Choose color", and a simple popup with e.g. 5 colors appears. I could do this with PopupWindow and inner ListView, but is there a simpler solution, like a specific widget for this?</p>
<p>How it should look like: <img src="http://1.bp.blogspot.com/_9l0GmPwgCzk/SeAfVu4IazI/AAAAAAAAADs/ZZYmkwOOYTk/s400/device.png" alt="alt text"></p>
| android | [4] |
1,088,129 | 1,088,130 | Multiple Uploadifive in one page is not working | <p>Hello I take my chances here at stack, because uploadify forums is not very responsive and full of spam, </p>
<p>I am using uploadifive w/ drag and drop it was amazing but multiple upload buttons in one page is not working. Below is my code:</p>
<p>HTML</p>
<pre><code><input type="file" name="file_upload_1" id="file_upload_1"/>
<input type="file" name="file_upload_2" id="file_upload_2"/>
</code></pre>
<p>JS</p>
<pre><code>$('#file_upload_1').uploadifive({
'auto' : true,
'method' : 'post',
'queueID' : 'queue',
'fileType' : ['text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel','application/force-download'],
'uploadScript' : 'upload.php',
'onUploadComplete' : function(file, data) {
console.log(data);
}
});
$('#file_upload_2').uploadifive({
'auto' : true,
'method' : 'post',
'queueID' : 'queue',
'fileType' : ['text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel','application/force-download'],
'uploadScript' : 'upload.php',
'onUploadComplete' : function(file, data) {
console.log(data);
}
});
</code></pre>
| jquery | [5] |
1,681,119 | 1,681,120 | how to save the state of radio buttons | <p>I have made 4 radio buttons and want to save the state when any of them is clicked and then want to use that saved state in the application.How can i do that?</p>
<pre><code> myOption1.setChecked(true);
myOption2.setChecked(true);
myOption3.setChecked(true);
myOption4.setChecked(true);
</code></pre>
| android | [4] |
5,999,635 | 5,999,636 | How do I split an integer into 2 byte binary? | <p>Given</p>
<pre><code>private int width = 400;
private byte [] data = new byte [2];
</code></pre>
<p>I want to split the integer "width" into two bytes and load data[0] with the high byte and data[1] with the low byte.</p>
<p>That is binary value of 400 = 1 1001 0000
so data[0] should contain 0000 0001
and data[1] should contain 1001 0000</p>
| java | [1] |
4,681,584 | 4,681,585 | Use services in android to synchronize with http://www.worldtimeserver.com | <p>Hi I am developing Excel for android, I have created all layout and other stuff now I have to create a service which will synchronize with <a href="http://www.worldtimeserver.com" rel="nofollow">http://www.worldtimeserver.com</a> to get time and it will print that time in first cell of my excel sheet. How can I achieve this? I know basic stuff of service, but how can I get time from that website?</p>
<p>Edit----
I have found solution of that problem, we can read webpage in android by following code</p>
<pre><code>URL url = new URL("http://www.worldtimeserver.com/current_time_in_PK.aspx");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(5000); // 5 seconds
conn.setRequestMethod("GET");
conn.connect();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
//Do what ever you want here ,(HTML code every individual line of website will be read //here) }
</code></pre>
| android | [4] |
3,194,843 | 3,194,844 | How to create a step method | <p>I want to schedule a method to handle my application logic in a game-y way. In game engines there's usually a schedule/enqueue to add scheduled children to any given scene. A scheduled method is one that is run usually on a separate thread a fixed number of times a second (if possible) and takes care of the application state (log in, log out, idle) and all operations related to said state.</p>
<p>What is the Android equivalent of this for an Activity?</p>
| android | [4] |
627,789 | 627,790 | Unexpected output from php -v | <p>Just ran php -v on my Centos 5 server and got the following message back.</p>
<pre><code>Failed loading /usr/lib64/php/modules//php_ioncube_loader_lin_5.1_x86_64.so: /usr/lib64/php/modules//php_ioncube_loader_lin_5.1_x86_64.so: undefined symbol: zend_unmangle_property_name_ex
PHP 5.2.17 (cli) (built: Jan 7 2011 10:39:29)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
</code></pre>
<p>PHP seems to be running okay, but I don't like the look of that message. What does this message mean, and what should I do? (I don't want to upgrade to 5.3 as some client sites still use deprecated in PHP 5.3 functions.) </p>
| php | [2] |
4,903,981 | 4,903,982 | How to multiply textbox with gridview columns | <p>I have write this code to create a gridview with 3 columns</p>
<pre><code>DataTable dt = new DataTable();
dt = new DataTable();
dt.Columns.Add("ID", typeof(int)).AutoIncrement = true;
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Price(Grouch)/Hectares", typeof(float));
DataColumn[] keys = new DataColumn[2];
keys[0] = dt.Columns["ID"];
dt.PrimaryKey = keys;
dt.Rows.Add("1", "Seaside Location", 1.5);
Session[key] = dt;
return dt;
</code></pre>
<p>I would like to add in this code a textbox with the quantity.</p>
<p>When i give the quantity i want in another textbox to have the total.</p>
<p>for example 2*1.5=3</p>
<p>How can i do that?</p>
<p>My huge problem is that i dont know how to take the values of the 3rd column.The value 1.5 in this example.</p>
| asp.net | [9] |
3,329,164 | 3,329,165 | How can I stop the iPhone from displaying a transform change until after the screen is redrawn | <p>I have found the UIScrollView's zooming mechanism to be clunk and essentially unusable. So instead, I'm rolling my own. I have a UIView that resizes itself with the pinch-zoom, and that's working fine. When the zoom is complete, the view needs to reset its transform and redraw the images.</p>
<p>The zoom works essentially in the same way the UIScrollView does. It sets the <code>transform</code> property of the UIView until complete. Then, when the zoom finishes, I want to reset the <code>transform</code> to <code>CGAffineTransformIdentity</code>, resize the frame to be the size it was before, and tell the view to redraw itself at the new size.</p>
<p>It all works pretty well, except when I change the transform to identity then redraw the image, there is a slight flicker before the image completely redraws. This is due to the fact that I'm using a subclass of CATiledLayer, since the view can be of arbitrary size.</p>
<p>I've overridden the <code>fadeDuration</code> to be zero, but there is still a flicker while the transform is reset before the redraw is finished. Is there any simple way to overcome this without creating another view to draw with then replacing it?</p>
| iphone | [8] |
422,361 | 422,362 | CFBundleDisplayName has no function | <p>I add the codes </p>
<pre><code>CFBundleDisplayName="MyAppInFrench";
</code></pre>
<p>to the file Localizable.strings of fr.lproj</p>
<p>and I also set 'Application has localized display name' to checked.</p>
<p>But app name in French environment still display 'MyAppInEnglish",</p>
<p>it look likes CFBundleDisplayName does not work</p>
<p>Welcome any comment</p>
| iphone | [8] |
2,999,750 | 2,999,751 | void type not allowed here (java) (s != null) | <p>I have this code, it says void type not allowed here (where I put the //error comment)
When I delete the &&..... it wont give the error</p>
<pre><code>public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == ok) {
Contact nweC = null;
String vnm = tfVoor.getText();
String anm = tfAchter.getText();
String em = tfEmail.getText();
if (em.trim().length() > 0 && !hetBoek.heeftContact(em)) {
nweC = new Contact(vnm, anm, em);
} else {
tfEmail.setText("");
JOptionPane.showMessageDialog(null, "Onjuist emailadres", "Mislukt", JOptionPane.PLAIN_MESSAGE);
}
//error if (nweC != null && hetBoek.voegContactToe(nweC)) {
JOptionPane.showMessageDialog(null, "Toevoegen gelukt", "Succes", JOptionPane.PLAIN_MESSAGE);
}
} else if (ae.getSource() == cancel) {
tfVoor.setText("");
tfAchter.setText("");
tfEmail.setText("");
} else if (ae.getSource() == toon) {
String s = hetBoek.toString();
JOptionPane.showMessageDialog(null, s, "Druk op OK",
JOptionPane.PLAIN_MESSAGE);
}
}
</code></pre>
<p>I hope someone can help me! thanks</p>
| java | [1] |
171,104 | 171,105 | What does this typedef line mean? | <p>I'm working on a C++ project and one of the libraries that I'm using has the following line:</p>
<pre><code>typedef void (*thread_startfunc_t) (void *);
</code></pre>
<p>Can someone please explain what this is doing. Thanks</p>
| c++ | [6] |
2,498,319 | 2,498,320 | MAP COLLECTION is it possible with Android Apps? | <p>Hi can we implement the Map Collections for android? or is it just the arrays? I'm trying to implement a Yellow Pages app and I was wondering if I could use a map to have names and numbers as keys and values.</p>
| android | [4] |
3,342,457 | 3,342,458 | No Marked Color in Seekbar | <p>Hy!</p>
<p>I want to remove the marked color (yellow) in a seekbar.</p>
<p>Code:</p>
<pre><code><SeekBar
android:id="@+id/seekBar1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:max="20"
android:progress="10"
android:secondaryProgress="0"/>
</code></pre>
<p>Is there a easy way to do that?</p>
<p>thx</p>
| android | [4] |
999,404 | 999,405 | using IPC under Service | <p>Please can anyone tell me what is, and when would it be good to use "IPC" ?</p>
<p>thanks,</p>
<p>ray.</p>
| android | [4] |
3,558,058 | 3,558,059 | why return type of read() is integer? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6826875/issue-regarding-the-return-value-of-the-read-function-in-java">Issue regarding the return value of the read() function in java?</a> </p>
</blockquote>
<p>As per the documentation the <strong>read()</strong> method of <strong>java.io.FileInputStream</strong> class reads next byte of the input stream, then why it's return type is integer, why not byte.</p>
<p>Is there any issue behind this?</p>
| java | [1] |
2,153,810 | 2,153,811 | How to retrieve a field array from an object array? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5174115/sorting-a-vector-of-objects-by-a-property-of-the-object">Sorting a vector of objects by a property of the object</a> </p>
</blockquote>
<p>I have a structure like below:</p>
<pre><code>strcut Point
{
int x;
int y;
int z;
};
</code></pre>
<p>I also have a generic sorting function for integers:</p>
<pre><code>void sort(vector<int>);
</code></pre>
<p>In my program, I need to sort an array of points std::vector frequently using different fields (i.e. x, y, or z). What can I do to convert an array of Points into an an array of integers efficiently?</p>
| c++ | [6] |
5,915,970 | 5,915,971 | calculate month out of number of days in year | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2427555/python-question-year-and-day-of-year-to-date">Python Question: Year and Day of Year to date?</a> </p>
</blockquote>
<p>Is there a method in Python to figure out which month a certain day of the year is in, e.g. today is day 299 (October 26th). I would like to figure out, that day 299 is in month 10 (to compile the string to set the Linux system time).
How can I do this?</p>
| python | [7] |
5,747,900 | 5,747,901 | returning value to main C# | <p>I'll start by saying that i am no beginner in C# but not very much more and need help returning value to main. Or rather tell me what is the "correct" way. </p>
<p>I want to return a fail value (simply -1) from the application, in case of any exception and ending up in a catch. In that case passing info to main to return -1. </p>
<p>The way I solved it was by just adding a static global variable mainReturnValue (to be able to access it from main), and setting its value to -1 in the catches. </p>
<p>Is that a correct way of doing it, based on my current code? </p>
<p>If anyone is wondering the applications is executed without user interaction and that's why I need to catch the exit state. The form/GUI just displays info about the progress, in case it's started manually. </p>
<pre><code>namespace ApplicationName
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{ ...
static int mainReturnValue = 0; //the return var
static int Main(string[] args)
{
Application.Run(new Form1(args));
return mainReturnValue; //returning 0 or -1 before exit
}
private void Form1_Load(object sender, System.EventArgs e)
{
the code..in turn also calling some sub functions such as DoExportData...and I want to be able to return the value to main from any function...
}
private int DoExportData(DataRow dr, string cmdText)
{
try { ... }
catch
{ mainReturnValue = -1; }
}
</code></pre>
<p>Thanks.</p>
| c# | [0] |
3,823,062 | 3,823,063 | Client server interaction | <p>Hi guys i am new to android, can anyone guide me how server interact with client. Please give some useful links for simple client server interaction with source file. </p>
| android | [4] |
4,668,899 | 4,668,900 | How do I list all images in a folder using C#? | <p>I need to list all of the images in a folder using C#.</p>
<p>I searched Stack Overflow and found some threads talking about it, but the questions were covering PHP. I need to do this with C#.</p>
| c# | [0] |
1,097,619 | 1,097,620 | extract boolean checks to local variables | <p>Sometimes i extract boolean checks into local variables to achief better readability. </p>
<p>What do you think? </p>
<p>Any disadvantages? </p>
<p>Does the compiler a line-in or something if the variable isn't used anywhere else? I also thought about reducing the scope with an additional block "{}".</p>
<pre><code>if (person.getAge() > MINIMUM_AGE && person.getTall() > MAXIMUM_SIZE && person.getWeight < MAXIMUM_WEIGHT) {
// do something
}
</code></pre>
<p><hr /></p>
<pre><code>final boolean isOldEnough = person.getAge() > MINIMUM_AGE;
final boolean isTallEnough = person.getTall() > MAXIMUM_SIZE;
final boolean isNotToHeavy = person.getWeight < MAXIMUM_WEIGHT;
if (isOldEnough && isTallEnough && isNotToHeavy) {
// do something
}
</code></pre>
| java | [1] |
2,568,791 | 2,568,792 | Show a bulleted list from Strings.xml file in android | <p>I have a problem that I want to show a bulleted list contents which is resided in strings.xml file as an array elements. Then the problem is that how to convert the array elements in Html List format? Can any one suggest any solution regarding the same.</p>
<p>Thanks in advance</p>
| android | [4] |
2,044,932 | 2,044,933 | Start out processing in ASP.NET once the page has been loaded and displayed | <p>I have an ASP.Net application that uses a MasterPage. I have one page which includes two panels whose visibility is set dependent on the postback arguments to the page. In one condition I want some processing to occur but only after the whole page has been loaded as the panel will show a loading panel. </p>
<p>Ideally I wish to start this processing from code behind. Is this possible to do after the page is displayed?</p>
| asp.net | [9] |
3,352,443 | 3,352,444 | php getting contents of multiple urls | <p>i am trying to get constants of webpages and disply on my page.
i have following code</p>
<pre><code>$items = array();
$items[] = "http://www.domain.com?id=1";
$items[] = "http://www.domain.com?id=2";
$items[] = "http://www.domain.com?id=3";
$items[] = "http://www.domain.com?id=4";
$items[] = "http://www.domain.com?id=5";
foreach ($items as $value) {
$text = file_get_contents($value);
echo $text;
}
</code></pre>
<p>i got error</p>
<pre><code>file_get_contents can't be empty
</code></pre>
<p>i think file_get_contents get called before it finish getting data from first site,
this is my thinking.</p>
<p><strong>how to solve this issue as some times i must have urls in 100s</strong></p>
<p>dear i am getting this error</p>
<pre><code>Warning: file_get_contents() [function.file-get-contents]: Filename cannot be empty in /Applications/XAMPP/xamppfiles/htdocs/test/test.php on line
</code></pre>
<p>but this also shows the constants of first few pages then start giving this error.</p>
<p>i have checked and all urls are perfect.</p>
<p>Thanks </p>
| php | [2] |
294,126 | 294,127 | Search for elements that matches a pattern in PHP | <p>I have a string like <code>sub_category-21,cross_category-23,sub_category-33,sub_category-93,cross_category-69</code>.</p>
<p>I want to obtain the numbers for sub_category and the ones for cross category.</p>
<p>What I've done since now is seperate it in an array:</p>
<pre><code>$categories = explode(",", $_POST["categories"]);
$sub_categories = array();
$cross_categories = array();
foreach($categories as $category)
{
}
</code></pre>
<p>How I can do it?</p>
<p>Thank you in advance!</p>
| php | [2] |
4,049,621 | 4,049,622 | whats wrong with all jquery functions | <p>can anyone tell me why this code is not running as expected </p>
<pre><code> $(document).ready(function () {
$('#search_box').on('paste keyup change', 'input', function () {
alert("hi");
}
});
});
</code></pre>
<p>the code is working in another page, when i copied it its not working .
I know it has to be simple but I dont get it.</p>
| jquery | [5] |
2,521,102 | 2,521,103 | How do i convert hexadecimal to string? | <p>i am having string with some hexadecimal values.
Example:</p>
<pre><code><font color=**"&#x26;amp&#x3B;****amp&#x3B**;**amp&#x3B;&#x23;x23&#x3B;**336699">Hi How ARE YOU</font>
</code></pre>
<p>i want to store above string to database. in this string i found some Hexadecimal value .
while storing i want convert hexadecimal to string.
is there any solution in C#.net.</p>
| c# | [0] |
4,446,055 | 4,446,056 | PHP Preserve scope when calling a function | <p>I have a function that includes a file based on the string that gets passed to it i.e. the action variable from the query string. I use this for filtering purposes etc so people can't include files they shouldn't be able to and if the file doesn't exist a default file is loaded instead.
The problem is that when the function runs and includes the file scope, is lost because the include ran inside a function. This becomes a problem because I use a global configuration file, then I use specific configuration files for each module on the site.
The way I'm doing it at the moment is defining the variables I want to be able to use as global and then adding them into the top of the filtering function.</p>
<p>Is there any easier way to do this, i.e. by preserving scope when a function call is made or is there such a thing as PHP macros?</p>
<p><strong>Edit:</strong> Would it be better to use extract($_GLOBALS); inside my function call instead?</p>
<p><strong>Edit 2:</strong>
For anyone that cared. I realised I was over thinking the problem altogether and that instead of using a function I should just use an include, duh! That way I can keep my scope and have my cake too.</p>
| php | [2] |
4,407,123 | 4,407,124 | loading image from a sql database to tableview cell | <pre><code>ContactInfo *data = [self.contacts objectAtIndex:[indexPath row]];
cell.textLabel.text = data.name;
cell.detailTextLabel.text = data.designation;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
NSString *filePath = [[NSBundle mainBundle] pathForResource:data.image ofType:@"png"];
NSLog(@"%@",filePath);
UIImage *image1 = [UIImage imageWithContentsOfFile:filePath];
cell.imageView.image = image1;
return cell;
</code></pre>
<p>Here i get the right cell data and the detail text label but the image view does not come it takes some other image with . If any one can advice . </p>
| iphone | [8] |
3,862,925 | 3,862,926 | How to remove duplicate slashes from file path | <p>This question HAS been asked before and got closed WITHOUT any answers</p>
<p>Second time lucky, my previous question got closed: <a href="http://stackoverflow.com/questions/14903375/php-clean-up-path-with-duplicate-slashes">php clean up path with duplicate slashes</a> looks like I was missing the question mark to make it obvious what my question was. </p>
<p>QUESTION:</p>
<ol>
<li>How can I remove the duplicate slashes from a string? See code below with examples.</li>
<li>How well does windows(wamp) support file paths using forward slashes? It feels wrong writing c:/wamp but appears to work fine as the reason why I am unsure.</li>
</ol>
<p>CODE:</p>
<pre><code><?php
function clean($full_path){
return str_replace(array("\\", "//", "\/", "/\"), DIRECTORY_SEPARATOR, $full_path);
}
$paths = array(
'var/www/tpl//main.tpl',
'C:\wamp\www\/tpl\\main.tpl',
'C:\wamp\www/\tpl\main.tpl');
foreach($paths as $path){
echo "Before: $url\nAfter: ".clean($path)."\n---------------------\n";
}
?>
</code></pre>
| php | [2] |
217,974 | 217,975 | Javascript : code for 2 dropdown box ( Hours : Minutes) | <p>Can anyone help me on how to code in javascript for time which consist of 2 dropdown boxes:-</p>
<p>Hours : Minutes</p>
<p>There will be 0-12 list for Hours dropdown box</p>
<p>and 0-59 list for Minutes dropdown box.</p>
<p>Thank you..</p>
| javascript | [3] |
5,073,743 | 5,073,744 | php function returns false | <p>The following PHP function returns the n-th weekday of a month, e.g. the 3rd Wednesday in January 2012 in the form 18-1-2012:</p>
<pre><code><?php
function giveNthDay($month, $year, $no, $day) {
$counter = 0;
for($i=1;$i<=31;$i++) { //Schleife für 31 Tage
if(!checkdate($month, $i, $year)) { //wenn datum nicht existiert (bspw. 30. februar) zu nächstem schleifendurchlauf springen
continue;
} else {
if(date('l', strtotime($i.'-'.$month.'-'.$year))==$day) { //wenn generiertes Datum gleicher Wochentag wie gesuchter Tag $day
$counter++; //dann $counter um eins erhöhen
if($counter==$no) { //falls $counter==$no, also falls bspw. DRITTER ($no==$counter==3) Mittwoch gefunden, Datum zurückgeben
return $i.'-'.$month.'-'.$year;
}
}
}
}
return false; //existiert nicht, bspw. fünfter Sonntag gibt es nicht in jedem Monat
}
?>
</code></pre>
<p>If the date doesn't exist (e.g. 5th Friday in January 2012), it returns false.</p>
<p>This works fine for examples like:</p>
<pre><code>giveNthDay(1, 2012, 3, "Wednesday");
giveNthDay(1, 2020, 3, "Wednesday");
giveNthDay(1, 2031, 3, "Wednesday");
</code></pre>
<p>but from </p>
<pre><code>giveNthDay(1, 2038, 3, "Wednesday");
</code></pre>
<p>on, it returns false even though every January has more than 3 Wednesdays!</p>
<p>I tried hard to find out what the reason for this strange behaviour is but I can't figure it out. Can anyone help me?</p>
| php | [2] |
4,844,754 | 4,844,755 | How to embed extra information in a View in android? | <p>I am beginning android development and in my sample application I have a ListView which I populate as follows:</p>
<pre><code>ListView listView = (ListView) findViewById(R.id.listView1);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, getEntityLabels());
listView.setAdapter(adapter);
</code></pre>
<p>The <code>getEntityLabels()</code> is a function that returns a list of strings.</p>
<p>In the underlying model, the labels are not unique. Instead each entity has an <code>id</code> field which is unique for every entity.</p>
<pre><code>class Entity{
int id;
String label;
}
</code></pre>
<p>When the user clicks on an item in the ListView, I would like to do some processing. So, I added an ItemClickListener as follows:</p>
<pre><code>listView.setOnItemClickListener(new OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3)
{
//I would like to get the Id of the Entity, not just the label
}});
</code></pre>
<p>The processing depends on the <code>id</code> of the entity. However, as the view in the list is just a text and contains only the label, I cannot access it.</p>
<p>Is there a way to embed some information like id(in my case) with the views or an alternate way to get the <code>id</code>s?</p>
<p>I am aware of the way where I can override the <code>toString()</code> method of <code>Entity</code> to return label and use <code>ArrayAdapter<Entity></code> instead of <code>ArrayAdapter<String></code>. However, I am not looking for this. I am looking for a more generic way where I can embed any information with any View, if possible!</p>
| android | [4] |
4,602,819 | 4,602,820 | How to pass Object from java class to another java class | <p>I am created an object of a class in one java class as:</p>
<p><code>ABC ab = new ABC();</code></p>
<p>I want to access this <code>Object ab</code> in <code>class XYZ</code>. How to make this Object available in class XYZ? How is this do-able?</p>
| java | [1] |
4,286,154 | 4,286,155 | How to put string in bundle | <p>I have in my code this piece of code</p>
<pre><code>ResourceBundle resbundle=ResourceBundle.getBundle("test", Locale.getDefault());
resbundle.getString("compileItem");
</code></pre>
<p>How to put another string in this bundle ?</p>
| java | [1] |
4,222,952 | 4,222,953 | Changes to Python since Dive into Python | <p>I've been teaching myself Python by working through <a href="http://www.diveintopython.net/" rel="nofollow">Dive Into Python</a> by Mark Pilgrim. I thoroughly recommend it, as do <a href="http://stackoverflow.com/questions/34570/what-is-the-best-quick-read-python-book-out-there/34608#34608">other Stack Overflow users</a>.</p>
<p>However, the last update to Dive Into Python was five years ago. I look forward to reading the new <a href="http://diveintopython3.net/" rel="nofollow">Dive into Python 3</a> When I make the switch to 3.x, but for now, using django means I'll stick to 2.x.</p>
<p>I'm interested to know what new features of Python I'm missing out on, if I've used Dive Into Python as my primary resource for learning the language. A couple of examples that I've come across are</p>
<ul>
<li>itertools</li>
<li>ElementTree</li>
</ul>
<p>Is there anything else I'm missing out on?</p>
<p>edit: As Bastien points out in his answer, I could just read the <a href="http://docs.python.org/whatsnew/" rel="nofollow">What's New in Python</a> pages, but sometimes it's fun to discover a useful tip on Stack Overflow rather than struggle through the complete, comprehensive answer in the official documentation.</p>
| python | [7] |
3,064,853 | 3,064,854 | Create Downloadble link of app | <p>can anyone tell me how could i create a down loadable link for my android app for users.
so that i can send them a mail. and as user click on that mail from mobile my app start installation. how could i do this...</p>
| android | [4] |
1,039,010 | 1,039,011 | Is it necessary to use the "typeof" operator to check if a variable exists in javascript? | <p>When I'm writing code that relies on objects created by another script file referenced from the same page I often find myself having to test for the existence of some global variable or another.</p>
<p>I'd expect that the logical idiom to do that would be as follows:</p>
<pre><code>if (window.myLibrary) myLibrary.someFunction();
</code></pre>
<p>However after some research on stackoverflow, the consensus seems to be that the correct idiom is this:</p>
<pre><code>if (typeof myLibrary != "undefined") myLibrary.someFunction();
</code></pre>
<p>This idiom is given in several answers on stackoverflow, the most prominent example being this one:</p>
<p><a href="http://stackoverflow.com/a/519157/1469919">How can i check whether a variable is defined in javascript</a></p>
<p>However, I can't find any explanation for why the second version is preferable. All the recommendations for it are in the form "just use this." Can someone please explain why using the typeof operator is superior to checking for the object by referencing it as a property of the window object?</p>
| javascript | [3] |
5,013,031 | 5,013,032 | How can I download additional extension not supported in mobile safari? | <p>Qrafter is iPhone application to read the QRCode.
(http://itunes.apple.com/us/app/qrafter-qr-code-reader-generator/id416098700?mt=8).</p>
<p>if Qrafter is installed in your iPhone and you click a Vcf extension file in mobile safari,
iPhone will launch the Qrafter and read the Vcf file!
(Vcf is not supported extension officially in mobile safari)</p>
<p><strong>How can I develop this function like this?</strong></p>
| iphone | [8] |
532,703 | 532,704 | Integer to byte casting in Java | <p>In Java we can do </p>
<pre><code>byte b = 5;
</code></pre>
<p>But why can't we pass same argument to a function which accepts <code>byte</code></p>
<pre><code>myObject.testByte(5);
public void testByte (byte b)
{
System.out.println("Its byte");
}
</code></pre>
<p>It gives following error </p>
<pre><code>The method testByte(byte) in the type Apple is not applicable for the arguments (int)
</code></pre>
<p>PS: May be a silly question, I think I need to revise my basics again. </p>
<p>Thanks.</p>
| java | [1] |
5,657,550 | 5,657,551 | calling multiple functions sequentially in jquery | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/14365318/delay-to-next-function-in-method-chain">Delay to next function in method chain</a> </p>
</blockquote>
<p>Yup! I tried. Googled it and also read everything here but couldn't really understand. What if my functions aren't ajaxified. In that scenario, how to use jquery deffered pipeline?</p>
<p>Well, the scenario is this - say there are 4 functions...</p>
<pre><code>function fn1()
{
setTimeout(function()
{
$("#div_result_area").append('Calling from function 1<br/>');
},5000);
}
function fn2()
{
setTimeout(function()
{
$("#div_result_area").append('Calling from function 2<br/>');
},4000);
}
function fn3()
{
setTimeout(function()
{
$("#div_result_area").append('Calling from function 3<br/>');
},3000);
}
function fn4()
{
setTimeout(function()
{
$("#div_result_area").append('Calling from function 4<br/>');
},1000);
}
</code></pre>
<p>Now, when I am calling these in my button click event, one by one, it doesn't work. Here is the button click event - </p>
<pre><code>$("#cmd_sync_tally").click(function(event){
event.preventDefault();
fn1();
fn2();
fn3();
fn4();
});
</code></pre>
<p>The result should have been like first function 1 executes & writes the value, then function 2 and so on. But the result is totally different.</p>
<pre><code>Calling from function 4
Calling from function 3
Calling from function 2
Calling from function 1
</code></pre>
<p>Since this is a test case, in real scenario, the functions where created to promote modularity and clean reading. I wonder, how to make these calls sequential, so that functions execute one after another.</p>
<p>Requesting your expert advice. </p>
| jquery | [5] |
3,912,760 | 3,912,761 | Reading string from a byte[] | <p>I have a byte array such as <code>0x21, 0x0D, 0x01, 0x03, 0x31, 0x32, 0x33</code> which containts the ascii string <code>"123"</code> with a length of 3. <code>(string starts at 0x03, 0x31, 0x32, 0x33)</code>
I'm learning, So would somebody be able to show me how to get the output <code>"123"</code> from it and put it inside a <code>char*</code>? Many thanks</p>
<pre><code> BYTE Data[] = { 0x0D, 0x01, 0x03, 0x31, 0x32, 0x33 };
int Length = Data[2];
//Extract string "123" from Data and store as char* ?
</code></pre>
| c++ | [6] |
5,626,049 | 5,626,050 | what's difference of these code? And why? | <p>I think it will be same,but it not. please tell me why?
thanks. </p>
<pre><code>var a,b;
function setA(x){
a = x;
}
function setB(x){
var a = 'a2';
setA(x);
b = x;
alert(a); //
}
setB('b')
</code></pre>
<hr>
<pre><code>var a,b;
function setB(x){
function setA(x){
a = x;
}
var a = 'a2';
setA(x);
b = x;
alert(a); //
}
setB('b')
</code></pre>
<p>I think it will be same,but it not. please tell me why?
thanks. </p>
| javascript | [3] |
5,837,604 | 5,837,605 | Display data from database from ID | <p>I have a database set up and I use 'user_id' for example to displays the name, age, address etc. I want to display all information with just the id in php. This then echos in another page. Currently i have to do this:</p>
<pre><code>$row=mysql_fetch_array($result);
$_SESSION['Name'] = $row['Name'];
$_SESSION['Address'] = $row['Address'];
</code></pre>
| php | [2] |
5,453,572 | 5,453,573 | BroadcastReceiver for ACTION_MEDIA_BUTTON not working emulator using sdkversion 8 to 11 | <p>I wrote some service which uses BroadcastReceiver to capture one of media buttons ("down button"), and it not works emulator</p>
<p>When I tried to run in on sdk version 8 to 11 it doesn't work (my application doesn't receive intent "android.intent.action.MEDIA_BUTTON".i use registerMediaButtonEventReceiver() on AudioManager in order to receive the events.
Content of manifest:</p>
<pre><code><receiver android:name=".MediaReceiver">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</code></pre>
<p></p>
<p>Activity</p>
<pre><code> @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
context=this;
setContentView(R.layout.main);
this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
mAudioManager = (AudioManager)this.getSystemService(Context.AUDIO_SERVICE);
mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
mRemoteControlResponder = new ComponentName(getPackageName(),
MediaReceiver.class.getName());
@Override
public void onResume() {
super.onResume();
mAudioManager.registerMediaButtonEventReceiver(
mRemoteControlResponder);
}
@Override
protected void onDestroy() {
super.onDestroy();
mAudioManager.unregisterMediaButtonEventReceiver(
mRemoteControlResponder);
}
@Override
public void onReceive(Context context, Intent intent)
{ Log.i("TAG", "111111111111111111onReceive");
Toast.makeText(context, "BUTTON PRESSED!", Toast.LENGTH_SHORT).show();
String v_IntentAction = intent.getAction();
if (Intent.ACTION_MEDIA_BUTTON.equals(v_IntentAction)) {
</code></pre>
<p>it not work............</p>
| android | [4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.