Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
3,013,037
3,013,038
Handling 'units' in an RTS game - c++
<p>I'm currently in the process of making a simple RTS style game in c++.</p> <p>What i'm wondering is how to handle the creation of new units in the game (ie. making marines from the barrack). How would i store these units?</p> <p>I was thinking of having a class 'unit' which would then be inherited by specific unit types (ie. marines, firebats, etc) but if i create an array for these (ie. Marines myMarines[20]) that will create a hard cap on these units.</p> <p>How do i create such an array that can be expanded at will? Thank you!</p>
c++
[6]
457,628
457,629
How to get the cell values from column1 and column 3 and put in map as key value pair using excel in java
<p>I have read the sheet 1 column and put in array list having [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday].</p> <pre><code>Id Apps Remarks ------------------------------------------------------------ 1 laucher Sunday will be holiday. 2 ninja Monday prevails ground. 3 car kamal act in Wednesday movie. 4 angrybird Cyclone form may be on Thursday. 5 zedge Keeps going to temple every Friday. 6 skype We wen movie to AGS on Saturday. </code></pre> <p>This is the excel file with three columns namely id, apps and remarks. I need to get the cell value from <em>column1</em> and the corresponding values from <em>column3</em> like </p> <pre><code>1 Sunday will be holiday. 2 Monday prevails ground. etc... </code></pre> <p>then store it as key value pair in <code>Map</code> using Java. Now compare the value from map contains with the above array list value (ignorecase). How to code this in Java?</p>
java
[1]
5,556,467
5,556,468
The length of list is five but I want a length of list 150
<pre><code>static final ArrayList&lt;HashMap&lt;String,String&gt;&gt; arraylistobject = new ArrayList&lt;HashMap&lt;String,String&gt;&gt;(); private void populateList() { HashMap&lt;String,String&gt; temp = new HashMap&lt;String,String&gt;(); temp.put("pen","MONT Blanc"); temp.put("price", "200 rs"); arraylistobject.add(temp); HashMap&lt;String,String&gt; temp1 = new HashMap&lt;String,String&gt;(); temp1.put("pen","Gucci"); temp1.put("price", "300 rs"); arraylistobject.add(temp1); HashMap&lt;String,String&gt; temp2 = new HashMap&lt;String,String&gt;(); temp2.put("pen","Parker"); temp2.put("price", "400 rs"); arraylistobject.add(temp2); HashMap&lt;String,String&gt; temp3 = new HashMap&lt;String,String&gt;(); temp3.put("pen","Sailor"); temp3.put("price", "500 rs"); arraylistobject.add(temp3); HashMap&lt;String,String&gt; temp4 = new HashMap&lt;String,String&gt;(); temp4.put("pen","Porsche Design"); temp4.put("price", "600 rs"); arraylistobject.add(temp4); </code></pre>
android
[4]
4,109,045
4,109,046
python - nested try/except question
<pre><code>try: for i in list: try: #python code... except Exception,e: #error handler except Exception, e: #error handler </code></pre> <p>If in the nested try/except it errors out, does the loop continue running?</p>
python
[7]
2,498,631
2,498,632
Generate a raw preview of files which outputs formatting
<p>Building a <code>Raw</code> view of text in my application, like pastebin does:</p> <p><a href="http://pastebin.com/raw.php?i=nfVT7b0Z" rel="nofollow">http://pastebin.com/raw.php?i=nfVT7b0Z</a></p> <p>So, I wrote the script which just echos out the <code>$contents</code>, but newlines, spaces, and tabes are not being proceeded. Looking at the pastebin source above, you will notice they don't wrap the text in any HTML tags such as <code>&lt;pre&gt;</code>. How then are they getting the text to format?</p> <p>Are they using some special header?</p>
php
[2]
1,855,029
1,855,030
Dynamic Structure in C++
<pre><code>struct testing { char lastname[20]; }; testing *pt = new testing; pt-&gt;lastname = "McLove"; </code></pre> <p>and I got </p> <blockquote> <p>56 C:\Users\Daniel\Documents\Untitled2.cpp incompatible types in assignment of 'const char[7]' to 'char[20]'</p> </blockquote> <p>Why ?</p> <p>Thanks in advance.</p>
c++
[6]
113,056
113,057
Weird Issue with the info/second View on iPod
<p>I just started testing my App on my iPod, and I have to click numerous times the info light button which is attached to my second view to show. I have to click it probably 10-15 times, then it finally triggers the second view to show. Of course in Simulator it works fine, but on the iPod it's rather weird that I have to keep hitting it to finally work. Then, sometimes it works without trying to hit it a ton of times. It's rather buggy. Curious if my code is crappy or what other issues are making this feature act weird.</p> <p>Here is my code</p> <pre><code>-(IBAction)infoButtonPressed:(id)sender { SecondViewController *second = [[SecondViewController alloc] initWithNibName: nil bundle:nil]; second.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:second animated:YES]; } </code></pre>
iphone
[8]
176,526
176,527
Cannot reduce visibility of method inherited method from parent
<p>Today when I was doing program in inheritance I got this compiler error saying "You cannot reduce the visibility of a inherited method". I went through lot of documents and articles but still I dint get why we should not reduce the visibility.</p> <p>I have the following code </p> <pre><code>class parent{ public void func() { System.out.println("in Parent"); } } public class TestClass extends parent { public static void main(String args[]) { parent obj=new TestClass(); obj.addTest(); } private void func() { System.out.println("in child"); } } </code></pre> <p>Here parent class has <code>func()</code> method which is public and overridden by the subclass <code>TestClass</code> which is private. Now the compiler throws the error that I cannot the reduce the visibility. To say technically, whenever I create a object of <code>TestClass</code> assigning to the type parent object, since the <code>func()</code> method is overridden, TestClass's func() is going to get called always, then why we should take care of visibility? whats the reason behind this error ? Can someone please explain me clearly ?</p>
java
[1]
1,103,897
1,103,898
Best Python Tips for Beginners
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/70577/best-online-resource-to-learn-python">Best online resource to learn Python?</a> </p> </blockquote> <p>Great tutorials for Python Novice</p>
python
[7]
5,042,134
5,042,135
Problem understanding Importer Protocol in Python
<p>I'm having some trouble understanding the Importer Protocol as per <a href="http://www.python.org/dev/peps/pep-0302/" rel="nofollow">http://www.python.org/dev/peps/pep-0302/</a>. Should the <code>fullname</code> argument of <code>finder.find_module(fullname, path=None)</code> <strong>never</strong> include a . (dot)?</p> <p>That is, if you want to find module <code>abc.efg.hij</code>, you must call <code>finder.find_module('hij', path='abc.efg')</code>. Calling <code>finder.find_module('abc.efg.hij')</code> would be <strong>absolutely incorrect</strong>.</p> <p>Is this correct?</p>
python
[7]
1,082,582
1,082,583
Loading Images issue in UITableViewCell
<p>I get Images from a URL using XML Parsing. I loaded the all images from url in to UITableViewCell using Parsing. But when i press the scrollbar in UITableView, it make slowly to loading images.</p> <p>I used the following code.</p> <pre><code>NSString *image1 =[images objectAtIndex:indexPath.row]; NSLog(@"Images ..... = %@",image1); NSData *mydata = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:[images objectAtIndex:indexPath.row]]]; UIImage *myimage = [[UIImage alloc] initWithData:mydata]; UIImageView *imageView = [ [ UIImageView alloc ] initWithImage: myimage ]; imageView.frame = CGRectMake(0.0f, 00.0f, 60.0f, 63.0f); [cell.contentView addSubview:imageView]; </code></pre> <p>If anybody knows that there is any solution to increasing Loading speed, please help me.</p> <p>Thanks.</p>
iphone
[8]
1,995,400
1,995,401
Which C++ library provides a map with a key of any type that does not enforce implementing a compare function?
<p>What I'm looking for is something like this:</p> <pre><code>class my_class { ... }; typedef LIBRARY_NAME::map&lt;my_class&gt; my_class_map; </code></pre> <p>thanks</p>
c++
[6]
5,276,149
5,276,150
Error in search code of php
<p>I want to search my database named phpsearch and column college and I am using an explode function to separate the terms with spacing and not commas. I have a doubt regarding the i term as the error says i is not defined but I though php is a language where you don not have to specify datatypes not declare variable </p> <p>the code is </p> <pre><code>&lt;?php $k = $_GET['k']; $terms = explode(" ",$k); $query = "SELECT * FROM colsearch WHERE "; foreach ($terms as $each) { $i++; if($i == 1) $query .= "college LIKE '%$each%' "; else $query .= "OR college LIKE '%$each%'"; } mysql_connect("localhost","root",""); mysql_select_db("phpsearch"); $query = mysql_query($query); $numrows = mysql_num_rows($query); if($numrows&gt;0){ while ($row = mysql_fetch_assoc($query)) $id = $row ['id']; $college = $row ['college']; $govpriv = $row ['govpriv']; $description = $row ['description']; $departments = $row ['departments']; $fees = $row ['fees']; $location = $row ['location']; $facilities = $row ['facilities']; $fests = $row ['fests']; $placements = $row ['placements']; $link = $row ['link']; echo "&lt;h2&gt;&lt;a href = '$link'&gt;$college&lt;/a&gt;&lt;/h2&gt;$description&lt;br/&gt;&lt;br/&gt;"; } else { echo "No results found for $k"; } mysql_close(); ?&gt; </code></pre> <p>What is the error? I tried all possible ways.</p>
php
[2]
4,682,303
4,682,304
JQuery: Checkbox as radiobutton, without default selection
<p>I have a dynamically generated list, of random length from zero items up, where each item includes by a checkbox. Unlike radio buttons, all of the checkboxes can be unchecked, but like radio buttons only one can <em>be</em> checked. To enforce this, I am using JQuery (based on the answer given here: <a href="http://stackoverflow.com/questions/881166/jquery-checkboxes-like-radiobuttons">jQuery - checkboxes like radiobuttons</a>)</p> <p>My code as it currently stands is:</p> <pre><code>var $radiocheck = $('input.radiocheck'); $radiocheck.click(function() { if($(this).is(':checked')) { $(this).attr('checked', false); } else if($(this).not(':checked')) { $radiocheck.removeAttr('checked'); $(this).attr('checked', true); } }); </code></pre> <p>...but it doesn't work (checkboxes remain unchecked on click). Any help is appreciated!</p>
jquery
[5]
310,375
310,376
Shorten Array in PHP?
<p>I want to shorten an array so it only contains 30 elements. If for example I have an array of 100 elements is it possible to take it and chop of (as to speak) 70 of those elements?</p>
php
[2]
1,497,236
1,497,237
treeview expand/collapse javascript
<p>in my asp.net treeview if i click one parent node then it should be extended if i click again on that node it should be collapsed in treeview... is any javascript availabe for this? or any code in selected node changed?</p>
asp.net
[9]
3,689,905
3,689,906
answer please about 'self'
<p>So, I don't understand how 'self' is never defined, but it's always used. </p> <p>Ex: </p> <pre><code> def __init__(self,parent,id): wx.Frame.__init__(self,parent,id,"My Frame",size=(300,200)) panel=wx.Panel(self) self=self.CreateStatusBar() menu=CreateMenuBar() first=wx.Menu() first.Append(NewId(),"Close window","Yup") menu.Append(first,"File") </code></pre> <p>I'm not sure if this is correct, and I'm still working out the bugs, and this is just part of the script, but howcome you don't define <code>self</code>? You can just go <code>self.CreateStatusBar()</code>. How does Python know what <code>self</code> is? Please explain in simple words. </p> <p>Thanks! :)</p>
python
[7]
493,655
493,656
Upgrading the version of libxml2 that my PHP installation uses
<p>I'm running into some problems upgrading the version of libxml2 that my local PHP install is using. I originally posted about this <a href="http://webmasters.stackexchange.com/questions/29706/problem-upgrading-mediawiki-1-5-8-to-mediawiki-1-19-libxml2-inadequate-on-serve/29730#29730">here</a>, but I've now got some more information so thought it was worthwhile reposting.</p> <p>I run PHP via XAMPP 1.0.1 installed on OS X 10.7. The version of libxml2 that PHP can see (according to phpinfo()) is 2.7.2. I've used MacPorts to istall libxml2 version 2.7.8, but it seems that PHP is still pointing at version 2.7.2.</p> <p>How can I go about configuring PHP to use libxml2 version 2.7.8?</p>
php
[2]
550,430
550,431
How to get asp CssClass in jquery
<p>can you help me to get asp CssClass in jquery in validation rule. here is my code let me know where i did the mistake?</p> <p></p> <pre><code> $(document).ready(function() { $("#aspnetForm").validate({ debug:true, ignore:("ignore"), rules: { &lt;%=txtFirstname.UniqueID %&gt;: { required: true }, &lt;%=cmbTitle.UniqueID %&gt;: { required: true } </code></pre> <p>}</p>
asp.net
[9]
5,118,992
5,118,993
iPhone application terminate its own after completing user action
<p>This is my first question in Stack Overflow. Following is my code</p> <pre><code> BOOL result=[ServiceUtil backup:(NSString *)phoneNumber :(NSString *)emailID :(NSString *)json :(NSString *)count]; if (result == TRUE) { NSLog(@"I am Inside Loop"); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Confirmation" message:@"Successfully Backup your contacts. Backup token is sent to your mail" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; } </code></pre> <p>"backup" method in "ServiceUtil" class returns TRUE and entered the if loop. But application terminate before showing the alert.</p>
iphone
[8]
3,742,929
3,742,930
Xcode 3.2.6 Release configuration is missing
<p>Hello I am trying to submit app to appstore. </p> <p>I had release option in Xcode.But some setting has been changed and now I am having only debug option. No release ,No distribution .</p> <p>what Can I do?</p> <p>Please Help </p>
iphone
[8]
732,484
732,485
Undefined variable notice (PHP)
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index">PHP: &ldquo;Notice: Undefined variable&rdquo; and &ldquo;Notice: Undefined index&rdquo;</a> </p> </blockquote> <p>I have a member.php page which contains this piece of code:</p> <pre><code>&lt;?php if (isset($_SESSION['teacherusername'])) { $username = $_SESSION['teacherusername']; } ?&gt; </code></pre> <p>Now in the teacherlogin.php I use "include" to include the code from the member.php page. The problem I have is that if I open up the teacherlogin.php page, it gives me an undefined variable error stating: <code> Notice: Undefined variable: username in ... on line 25</code></p> <p>Why is it stating it is undefined because I have defined it in the member.php page?</p> <p>Below is the code in the teacherlogin.php:</p> <pre><code>&lt;?php // PHP code session_start(); ini_set('display_errors',1); error_reporting(E_ALL); // connect to the database include('connect.php'); include('member.php'); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); die(); } // required variables (make them explciit no need for foreach loop) $teacherusername = (isset($_POST['teacherusername'])) ? $_POST['teacherusername'] : ''; $teacherpassword = (isset($_POST['teacherpassword'])) ? $_POST['teacherpassword'] : ''; $loggedIn = false; $active = true; if ($username){ echo "You are already Logged In: &lt;b&gt;{$_SESSION['teacherforename']} {$_SESSION['teachersurname']}&lt;/b&gt; | &lt;a href='./teacherlogout.php'&gt;Logout&lt;/a&gt;"; } else{ echo "Please Login"; } ?&gt; </code></pre>
php
[2]
5,061,018
5,061,019
prevent default event in onclick
<p>How to prevent default in onclick method. I have a method in which I am also passing a custom value</p> <pre><code>&lt;a href="#" onclick="callmymethod(24)"&gt;Call&lt;/a&gt; function callmymethod(myVal){ //doing custom things with myVal //here I want to prevent default } </code></pre>
javascript
[3]
2,647,527
2,647,528
Removing redundant symbols from string
<p>Let's say I have a string like that: <code>'12,423,343.93'</code>. How to convert it to <code>float</code> in simple, effective and yet elegant way?</p> <p>It seems I need to remove redundant commas from the string and then call <code>float()</code>, but I have no good solution for that.</p> <p>Thanks</p>
python
[7]
1,184,976
1,184,977
jquery transfer effect not working for oppsite process
<p>i have following code . when click on #eve element it works but when i click on home link it is not working.</p> <pre><code> &lt;style type="text/css"&gt; #eve{min-height: 200px;width: 200px;background-color: #666600;top: 57px;left: 212px} .ui-effects-transfer { border: 1px solid #9999ff } &lt;/style&gt; &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="transfer.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $("#eve").click(function () { $(this).effect("transfer",{to: $("#home")}, 500,function(){$(this).hide()}); }); $("#home").click(function () { $("#eve").show() $("#eve").effect("transfer",{to: $("#here")}, 500,function(){$("#eve").show()}); }); }); &lt;/script&gt; </code></pre> <p>Home end</p>
jquery
[5]
2,503,091
2,503,092
date_default_timezone question
<p>I wrote a pretty long function that will calculate the differences in timezones across the U.S. relative to the server timezone. I have noticed that by using default_timezone_set() that I can get the same data back that my function calculates. I have chosen not to use the default_timezone_set function because I am afraid that this changes the time on a global level and that if another request somewhere else is occurring within my app, that the wrong time will be used; that is, the time that is being calculated at that moment using the default_timezone_set function.</p> <p>Can someone verify this for me? Can I just use the timezone_set function without having to worry about the possibility of incorrect times being used in other functions? Hope this is clear.</p>
php
[2]
1,512,856
1,512,857
Drag and Drop Java GUI
<p>I am looking to create a GUI in Java, where I place controls or elements on a left pane and can drag them onto a designer pane, similar to creating a model in Visio. </p> <p>The current one I'm looking at is JGraphx <a href="http://www.jgraph.com">http://www.jgraph.com</a>, it allows you to create graphs etc.</p> <p>Are there any other projects out there that support this, or tools etc. </p> <p>Thanks in advance</p>
java
[1]
1,165,049
1,165,050
How do we call a super class method if we already have a super class of sub class?
<p>My Question is like that if there is a child class extend by father class and which is extended by Grandfather class then how can child class directly access the Grandfather's method.</p>
java
[1]
2,556,544
2,556,545
Creating a prompt that has a time delay?
<p>I'm trying to create a prompt that has a time delay, the value that is written in the prompt is then used in other areas of the form. I have written some javascript coding but I believe there is a minor thing that i am doing wrong as currently the prompt and delay are working, but because the setTimeout function is being used, that is what is being displayed in the form, instead of the content of the prompt. This is my Javascript?</p> <pre><code>var name = setTimeout(function(){ prompt("What is your name?", "Type your full name here")},750); document.write("Document Written By: " + name + " (" + day + "/" + month + "/" + year + ") ") </code></pre>
javascript
[3]
1,102,240
1,102,241
Parse error: syntax error, unexpected $end in /home/rixo/public_html/login/register.php on line 103
<pre><code>Username: &lt;input type="text" id="username" name="username" size="32" value="&lt;?php if(isset($_POST['username'])){echo $_POST['username'];}?&gt;" /&gt;&lt;br /&gt; </code></pre> <p>This is all the code -</p> <pre><code>&lt;form action="&lt;?=$_SERVER['PHP_SELF']?&gt;" method="post"&gt; Username: &lt;input type="text" id="username" name="username" size="32" value="&lt;?php if(isset($_POST['username'])){echo $_POST['username'];}?&gt;" /&gt;&lt;br /&gt; Password: &lt;input type="password" id="password" name="password" size="32" value="" /&gt;&lt;br /&gt; Re-password: &lt;input type="password" id="password_confirmed" name="password_confirmed" size="32" value="" /&gt;&lt;br /&gt; Email: &lt;input type="text" id="email" name="email" size="32" value="&lt;?php if(isset($_POST['email'])){echo $_POST['email'];}?&gt;" /&gt;&lt;br /&gt; &lt;input type="submit" name="register" value="register" /&gt;&lt;br /&gt; </code></pre> <p></p> <p>Heres the rest of the code on Paste bin - <a href="http://pastebin.com/2bZujt4a" rel="nofollow">http://pastebin.com/2bZujt4a</a></p> <p>I keep getting this error - Parse error: syntax error, unexpected $end in /home/rixo/public_html/login/register.php on line 103</p> <p>The above piece of code is line 103 where the problem seems to be. Does anyone know what could be causing it please?</p> <p>-Thanks in advance</p>
php
[2]
2,242,122
2,242,123
How to inform your (not started) app from a Boot_completed receiver?
<p>I have registered a BOOT_COMPLETED Receiver in my application, i want to listen for changes on SMS Database. </p> <p>The BroadcastReceiver starts a temporary Service which registers the ContentObserver. Now i want to notify my main activity (which is not started) that the Observer was registered successful. (I want to do this, because if a user installs the app for the first time he don't restart his phone but needs the ContentObserver too. If you have another idea how to do that you can post it. I just want the information that the observer is registered already)</p> <p>My idea was to notify the activity with a static attribute: MyActivity.sObserverRegistered = true</p> <p>But i think that is not good and doesn't work because the activity isn't started and this is ignored. Any idea how to solve the problem?</p> <p>thanks</p>
android
[4]
2,312,051
2,312,052
Button click event handler before page load
<p>I will describe my problem in simple way so it's not exactly what I'm trying to do but the idea is the same.Here is the problem:<br> I create dynamic buttons from code behind.I get some id from query string,create button with that id ,dynamic add event handler to click event,and add button to placeholder.I store the list of id-s in session and in page load method recreate these buttons and add to placeholder.One of the id-s is CurrentId and it's also stored in session.Buttons click handler do something like this</p> <pre><code>Button b=(Button)sender; Session["CurrentId"]=Convert.ToInt32(b.ID); </code></pre> <p>In page load when I create buttons I want to set button text property different from others if <code>id==Convert.ToInt32(Session["CurrentId"])</code> when list of id-s are gotten from session.But problem is that click event handler is called after page load,and when I create buttons in page load ,CurrentId in session hasn't been channged by click event handler.Can you suggest any solution to this situation?</p>
asp.net
[9]
3,730,529
3,730,530
compare two strings in java
<p>I created one Java program to compare two strings:</p> <pre><code>String s1 = "Hello"; String s2 = "hello"; if (s1.equals(s2)) { System.out.println("hai"); } else { System.out.println("welcome"); } </code></pre> <p>It displays "welcome". I understand it is case sensitive. But My problem is that I want to compare two strings without case sensitivity I.e I expect the output to be "hai".</p>
java
[1]
2,524,880
2,524,881
c++ execution screen not stable
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2529617/how-to-stop-c-console-application-from-exiting-immediately">How to stop C++ console application from exiting immediately?</a> </p> </blockquote> <p>I am running a simple program, written in Dev C++ 4.9.9.2 IDE in Windows 7:</p> <pre><code>// my second program in C++ #include &lt;iostream&gt; using namespace std; int main () { cout &lt;&lt; "Hello World! "; cout &lt;&lt; "I'm a C++ program"; system("pause"); return 0; } </code></pre> <p>This compiles successfully, but when I run it, the terminal screen comes for a second and then vanishes. How can I keep the output screen of the program visible?</p>
c++
[6]
2,317,918
2,317,919
how to identify incoming call using android?
<p>I want to record incoming call,any body knows please give some idea about that,other wise give some idea about How to know about incoming call,</p> <p>Thanks All</p>
android
[4]
341,292
341,293
Select application to open links with in Android
<p>I want to write an app that allows me to remotely start downloading a torrent on my desktop from my phone. How can I change android to open magnet links with my app? I'm trying to find a non-browser specific solution that can be executed on install without the user having to go through settings.</p> <p>EDIT:</p> <p>Something like this?</p> <pre><code> &lt;intent-filter&gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;category android:name="android.intent.category.BROWSABLE" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;data android:scheme="magnet" /&gt; &lt;data android:host="*" /&gt; &lt;data android:mimeType="application/myApp" /&gt; &lt;/intent-filter&gt; </code></pre>
android
[4]
3,917,366
3,917,367
get information of app in android
<blockquote> <p>hello expert,<br> i want to get information of all apk in mobile, like name,icon,date etc....<br> i refer <a href="http://www.androidsnippets.com/get-installed-applications-with-name-package-name-version-and-icon" rel="nofollow">check it</a> but there are not satisfied solution. so can you help me? </p> </blockquote>
android
[4]
2,884,836
2,884,837
sending to an email with contact form asp.net
<p>How would I go about sending an email to a specified email address with a contact form in asp.net? The website is hosted though a hosting company. thanks</p>
asp.net
[9]
1,710,471
1,710,472
Disable Task Manager using c# from Limited User Account
<p>I need to disable and enable the taskmanager from my application. I am doing this for my Kiosk application. I know i can do this by changing the Key in registry using below code. But the problem is my kiosk application will run in limited user account which does not allow the application to change key in registry level.</p> <p>Code working perfectly in Administrator account : </p> <pre><code> RegistryKey regkey; string keyValueInt = "1"; string subKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"; regkey = Registry.CurrentUser.CreateSubKey(subKey); regkey.SetValue("DisableTaskMgr", keyValueInt); regkey.Close(); </code></pre> <p>How can i achieve this in Limited user account ?</p>
c#
[0]
1,547,412
1,547,413
Writing a string which contains " "
<p>I have a string from an xml document:</p> <pre><code>&lt;title type="html"&gt; </code></pre> <p>Is there a way for me to write this string like <code>"&lt;title type="html"&gt;"</code>? I've had similar problems writing javascript as a string but I did see some solutions in the past (which I can't remember)?</p> <p>Thanks</p>
c#
[0]
3,184,274
3,184,275
Printing odd numbers
<p>I would like help to find a short and small program in C++ to print out all odd number from 1 to 100 using a loop. Is that possible?</p>
c++
[6]
1,552,762
1,552,763
How to parse children recursively using jQuery
<p>I am having my jQuery code as following (which is working fine):</p> <pre><code>$('[RptrRowEnableAutoHeight=""True""]').each(function () { var ch = 10; $(this).children().each(function(){ch += $(this).height();}); $(this).height(ch); }); </code></pre> <p>The above works only for the immediate children of the root element. How can I achieve the same for all nested child elements.</p> <p>This is a special case for us as the layout was developed using absolute positioning (almost everywhere). At this moment, we are unable to modify entire layout with flow-layout.</p> <p>In simple, I would like to have all (container) controls to expand (their height/width) automatically to enclose their child elements in a proper fashion (without any scrollbars/hiding).</p> <p>thanks</p>
jquery
[5]
207,062
207,063
How to become a good Python coder?
<p>EDITED ALL GREAT COMMENTS - THANK YOU</p> <p>I started with c++ but as we all know, c++ is a monster. I still have to take it and I do like C++ (it takes programming a step further) </p> <p>However, currently I have been working with python for a while. I see how you guys can turn some long algorithm into simple one.</p> <p>I know programming is a progress, and can take up to years of experience. I also know myself - I am not a natural programmer, and software engineering is not my first choice anyway. However, I would like to do heavy programming on my own, and create projects.</p> <p>How can I become a better python programmer?</p> <p>Thank you. </p>
python
[7]
748,695
748,696
Attach function to DOMWindow Object
<p>I have this nice little snippet i've made for getting browser position:</p> <pre><code>if (!window.position) { window.position = function() { return navigator.appName.toLowerCase().indexOf("explorer") &gt;= 0 ? { x: window.screenLeft, y: window.screenTop } : { x: window.screenX, y: window.screenY }; }; }; </code></pre> <p>It works great, what i'm wondering is, anyone know (i can't seems to find/remember if it exist) if there is something like a "_prototype" so that I can attach the function permanently. This would be useful in the case I have something like:</p> <pre><code>var bob = window.open(...); </code></pre> <p>So then I could say:</p> <pre><code>var bobSposisition = bob.position(); // and of course get the same thing on bob tht i'm getting on my current parent window. </code></pre>
javascript
[3]
2,346,416
2,346,417
Javascript combining a reg expression and string
<p>I have a string which contains a nonvariable part, a variable numnber and another nonvariable part. I want to user <code>replace()</code>, to change only the variable part into a value a user chooses. I'm a noob at javascript, and even a bigger noob in reg expressions, so sorry if this is something trivial.</p> <p>Anyway, i have a string like this:</p> <pre><code>"first nonvar part: "+any_integer+"last nonvar part". </code></pre> <p>i'd like to use regexp to replace any_integer. </p> <p>Can i somehow combine string and regular expression matching to match the string by it's non variably parts with an unknown number in between?</p> <p>So i can use:</p> <pre><code>replace("first nonvar part: "+any_number+"last nonvar part","first nonvar part: "+user_input+"last nonvar part") </code></pre> <p>or something similar.</p> <p>Many thanks</p>
javascript
[3]
1,329,344
1,329,345
exceptions.TypeError: can only concatenate tuple (not "int") to tuple
<p>I called this:</p> <pre><code>for count in result: print "Exist: %s" % count self.IdCode = count self.IdCode += 1 </code></pre> <p>and received this error:</p> <pre><code>exceptions.TypeError: can only concatenate tuple (not "int") to tuple </code></pre> <p>What's going on here?</p>
python
[7]
5,169,011
5,169,012
Get parent object within jQuery callbacks
<p>This is my issue:</p> <pre><code>var greatapp = { start : function(){ $.AJAX({ url : 'foo.com', success : function(data){ greatapp.say(data); } }) }, say : function(s){ console.log(s); } } </code></pre> <p>What i don't like about this example is the fact that i repeat my self in the <code>success</code> function by defining the object's name instead of just <code>this</code> which obviously won't work because it's in an <em>external</em> function.</p> <p>How to only have the name <code>greatapp</code> one time in a JS object?</p>
javascript
[3]
4,194,527
4,194,528
Setting the listview position to the top
<p>I have a listview declared "android:stackFromBottom="true"" in xml so that it loads the elements bottom up.</p> <p>I am loading 20 elements from the DB and then adding it to the Listview, and then loading another 20 items when we reach to top while scrolling.</p> <p>my code snippet:</p> <pre><code> myListView.setOnScrollListener(new OnScrollListener() { private int lastItem = 0; AsyncReadMore task; @Override public void onScrollStateChanged(AbsListView view, int scrollState) { } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (firstVisibleItem == 0 &amp;&amp; totalItemCount &gt; 0 &amp;&amp; AppData.messageShown &lt; AppData.TotalMessageCount) { lastItem = totalItemCount; // mDummy.LoadMessageInBackground(ReplyActivity.this,mMessageAdapter,myListView); if (task != null &amp;&amp; task.getStatus() == AsyncTask.Status.RUNNING) { return; } task = new ReadMore(); task.execute(); } } }); </code></pre> <p>but, the lisview again comes to the bottom after reloading, I want it to be at the same position where the next 20 elements were added. I tried listview.setselection(position) after notifydatasetchanged(). but of no use.</p>
android
[4]
4,490,798
4,490,799
why this function getContentHeight();return always 0
<p>I use this function to get the height of page web.But this function alwaya return 0 </p> <pre><code> WebView objectview; int i = objectview.getContentHeight(); </code></pre>
android
[4]
5,620,503
5,620,504
Graph an equation in java
<p>Question: Anyone know a Java API that serves to graph mathematical equations, ie the input is x ^ 2 = 5 and make the graph. I do not want something you have to spend points to make the graph. Thanks for your time.</p>
java
[1]
2,175,565
2,175,566
Android Activity
<p>if i create static button in one activity and use in another activity it shows error as </p> <pre><code>/********************************* 01-12 19:57:17.030: DEBUG/PhoneWindow(21860): couldn't save which view has focus because the focused view com.android.internal.policy.impl.PhoneWindow$DecorView@2f5671b8 has no id. *************************************/ </code></pre> <p>my code is ::</p> <pre><code>public static LoginButton bttn; findViewById(R.id.login).setOnClickListener(new OnClickListener(){ public void onClick(View v) { // TODO Auto-generated method stub bttn = (LoginButton)findViewById(R.id.login); startActivity(new Intent(Account.this,Example.class)); } }); </code></pre> <p>In 2nd activity i use this static button as</p> <pre><code>Account.bttn.init(this, mFacebook); </code></pre>
android
[4]
2,007,402
2,007,403
How can i echo a variable inside of this?
<p>Hello how can I add an echo $name inside of this line ?</p> <pre><code>&lt;?php echo do_shortcode('[latestbyauthor author="HERE" show="3"]'); ?&gt; </code></pre>
php
[2]
628,598
628,599
Preferred Method of PHP Byte Encoding
<p>I am writing a web app for a company that wants to host the app on its servers. I want to protect the source code for two reasons. The first is the obvious closed source business model. The second is source code protection. I don't want them to be able to edit the source code (They aren't competent). I've looked into things like the Zend Encoder. What have you used? Are there free options? Do they run on Windows and/or Linux?</p>
php
[2]
1,208,781
1,208,782
creation of new pages with dynamic content
<p>For my final year project I'm building a learning website. Now everytime I want to add a new course, I've got to code the new page.</p> <p>Is there a way where after just adding the course name &amp; clicking on <kbd>add course</kbd> button on a specific page, the new course page will be created with just the contents to be filled out later? Kind of how wordpress is.</p>
php
[2]
5,152,572
5,152,573
Help Array and File
<p>Very new to PHP and ran into some trouble and was wondering if anyone could help. I'm having problems with an array of names that are looked up in a database. When I use just the array of names it gets processed correctly. When I try and read a file of those same names only the last name gets displayed. My question is how can I get all names displayed for the file array?</p> <p>Please see examples and code below. Thanks for your time.</p> <p>//This works -- Sample 1</p> <p>$x=array("joe", "paul", "tom");</p> <p>//This does not -- Sample 2</p> <p>$x = file("name.txt"); //Same names from the array above are in this file</p> <p>Here is the full code below.</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Name Check&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;?php $con = mysql_connect("localhost","xxxxxxxx","xxxxxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxxxxxxxxx", $con); //$x=array("joe", "paul", "tom"); //displays all names correctly in Sample 1 below $x = file("name.txt"); //only displays the last name in the file. Sample 2 below foreach ($x as $test) { $result = mysql_query("SELECT * FROM categories WHERE Name='$test' Limit 0, 1"); while($row = mysql_fetch_array($result)) { echo $row['Name']; echo " " . $row['Sport']; echo "&lt;br /&gt;"; } } ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <hr> <p><strong>Sample 1 output</strong></p> <p>joe basketball</p> <p>paul basketball</p> <p>tom baseball</p> <p><strong>Sample 2 output</strong></p> <p>tom baseball</p> <hr> <p>Here is the contents of name.txt, that was requested. Thanks!</p> <pre><code>joe paul tom </code></pre>
php
[2]
1,330,560
1,330,561
PHP and db connections
<p>When I load a php page on my browser, it connects to the DB and runs some sql... let's say I now follow a link and it takes me to another page within the same website. What happened server wise? Did my first connection to the DB close, and re-opened again? Is that what happens in most cases?</p>
php
[2]
4,421,276
4,421,277
How to effectively convert double to int in c++?
<p>Sorry for not being specific, I just thought the context isn't important.</p> <p>Anyway the question can be seen as an extension of my other question on <a href="http://stackoverflow.com/questions/14000715/progressbar-range-and-position-how-to-handle-big-numbers-in-c">Progressbars in win32</a> should I put the whole code here or the link is enough ?</p> <p>The problem in its simplest form can be described as :</p> <pre><code>double d1 = x.xxxxxx; double d2 = x.xxxxxx; double d3 = x.xxxxxx; double d4 = x.xxxxxx; double d5 = x.xxxxxx; ... ... double dn = x.xxxxxx; int i1 = (int)d1; int i2 = (int)d2; int i3 = (int)d3; int i4 = (int)d4; int i5 = (int)d5; ... ... int in = (int)dn; int i = i1+i2+i3+i4+i5+...+in; double d = d1+d2+d3+d4+d5+...+in; now i needs to be not less then d - 0.5; </code></pre> <p>How to do that ?</p> <p>EDIT : Code modified. EDIT 2 : The number of n can not be predicted, and it is possible that d1,d2,...,dn are less then 1, something like, 0.345627.</p>
c++
[6]
285,683
285,684
Javascript - If not in array then add - if in array then update qty
<p>Below is my code for a simple shopping cart, the only problem is the items from the first box work fine, however the second box does not.</p> <p><a href="http://itsuite.it.brighton.ac.uk/ols11/cart/" rel="nofollow">http://itsuite.it.brighton.ac.uk/ols11/cart</a> - add the "bumblebee" item, and then repeat and it counts correctly. Now try the second drop down a few times.</p> <p>Javascript:</p> <pre><code>var ids = [] var names = [] var qtys = [] var prices = [] var total = [] function newcart (id, desc, qty, price) { var lengthofid = ids.length var i = 0 while (i &lt; lengthofid) { if (id == ids[i]) { qtys[i] = parseInt(qtys[i]) + parseInt(qty) prices[i] = parseInt(prices[i]) + parseInt(price) i = lengthofid + 1; }else{ ids.push(id) names.push(desc) qtys.push(qty) prices.push(price) } i++ } if ( i == 0 ) { ids.push(id) names.push(desc) qtys.push(qty) prices.push(price) } alert(names) alert(qtys) } </code></pre> <hr>
javascript
[3]
2,161,736
2,161,737
How to write app for multiple screen resolutions?
<p>I want to know the best way of writing an app for multiple screen resolutions?</p>
android
[4]
115,216
115,217
Resources$NotFoundException when Resource exists
<p>I'm trying to set a drawable to an <code>ImageView</code> from inside a custom <code>SimpleCursorAdapter</code>. This is the code I'm using.</p> <pre><code>@Override public void bindView(View view, Context context, Cursor cursor) { super.bindView(view, context, cursor); ImageView i = (ImageView) view.findViewById(R.id.icon); switch(Integer.parseInt(cursor.getString(4))){ case 0: Drawable drawable = null; try { drawable = Resources.getSystem().getDrawable(R.drawable.andro_icon); } catch (NotFoundException e) { e.printStackTrace(); } i.setImageDrawable(drawable); </code></pre> <p>But this catches a <code>Resources$NotFoundException</code> :</p> <pre><code>02-29 06:39:48.467: W/System.err(13511): android.content.res.Resources$NotFoundException: Resource ID #0x7f02000c </code></pre> <p>The resource <code>R.drawable.andro_icon</code> exists, the code compiles without any problem, I tried cleaning and rebuilding the project and restarting eclipse. What's happening here?</p>
android
[4]
4,370,825
4,370,826
How to do it multiple select by id?
<p>I have many divs in ids:</p> <pre><code>&lt;div class="nameclass" id="name&lt;?= $id; ?&gt;"&gt; something &lt;/div&gt; </code></pre> <p>And I want to put css to all, but by id not class:</p> <pre><code>$('div.nameclass').css(...); // Not this way $('#name&lt;????&gt;').css(...); // this way </code></pre> <p>How to do it?</p>
jquery
[5]
3,011,003
3,011,004
"Uint32", "int16" and the like; are they standard c++?
<p>I'm quite new to c++, but I've got the hang of the fundamentals. I've come across the use of "Uint32" (in various capitalizations) and similar data types when reading other's code, but I can't find any documentation mentioning them. I understand that "Uint32" is an unsigned int with 32 bits, but my compiler doesn't. I'm using visual c++ express, and it doesn't recognize any form of it from what I can tell.</p> <p>Is there some compilers that reads those data types by default, or have these programmers declared them themselves as classes or #define constants?</p> <p>I can see a point in using them to know exactly how long your integer will be, since the normal declaration seems to vary depending on the system. Is there any other pros or cons using them?</p>
c++
[6]
1,157,145
1,157,146
no suitable method for sort error
<pre><code>import java.util.Scanner; import java.util.ArrayList; import java.util.Collections; import java.util.Collection; public class ClearlyAnArrayList { public static void main(String[] args){ Scanner kb=new Scanner(System.in); ArrayList&lt;Integer&gt;ints=new ArrayList&lt;Integer&gt;(); int num=kb.nextInt(); while(num!=-1){ ints.add(num); } sortPrint(ints); } public static void sortPrint(Collection&lt;Integer&gt;ints){ Collections.sort(ints); for(Integer i:ints){ System.out.printf("%d\n",i); } } } </code></pre> <blockquote> <p>This is the code I'm compiling with blueJ When I compile it I get a lengthy error which starts off "<code>no suitable method for sort(java.util.Collection&lt;java.lang.Integer&gt;)</code>" and then goes on to say more stuff I don't understand.</p> </blockquote> <p>The solution to this was that I was using a List which is not a collection and <code>Collections.sort()</code> expects a List</p> <blockquote> <p>Also is there a better way than singular <code>import</code> statements for all my utils?</p> </blockquote> <p>The solution given was </p> <pre><code>import java.util.*; </code></pre>
java
[1]
703,543
703,544
pdf download from mysql database
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1204630/create-a-pdf-file-with-php">Create a PDF file with PHP</a> </p> </blockquote> <p>i need help..i want a php code to download information stored in the mysql database and save it in a pdf file.. so far, below is the code i have but it's not printing anything.. please help me to modify it or send me another better code. thanks..</p> <pre><code>&lt;?php $host = 'localhost'; $user = 'root'; $pass = 'hello'; $db = 'version'; $table = 'childinfo'; $file = 'export'; $csv_output; $link = mysql_connect($host, $user, $pass) or die("Can not connect." . mysql_error()); mysql_select_db($db) or die("Can not connect."); $gotten =mysql_query("select sex,childnumber from child_nfo"); $row =mysql_fetch_assoc($gotten); $bytes = $row[imgdata]; header("Content-type: application/pdf"); header('Content-disposition: attachment; filename="thing.pdf"'); print $bytes; ?&gt; </code></pre>
php
[2]
4,445,007
4,445,008
Adding blank space as one of my variable
<p>I want to write some data about the person's in a file. And while adding those data i want to add blank space if a particular data for that person is not available.</p> <p>ex: I want to have " " in place of SSN if person doesn't have one.</p> <p>Thanks,</p>
c#
[0]
888,219
888,220
The type org.apache.axiom.om.OMElement cannot be resolved. It is indirectly referenced from required .class files
<p>Actually i added axis2-adb-1.1.jar file into build path and i have import statement "import org.apache.axis2.rpc.client.RPCServiceClient;". </p> <p>Then i created an instance for it and i used that instance in the following statement.</p> <pre><code>Object[] response = serviceClient.invokeBlocking( name, inputParams, returnTypes); </code></pre> <p>Here, serviceClient is an instance of "RPCServiceClient".</p> <p>But i am getting error The type org.apache.axiom.om.OMElement cannot be resolved. It is indirectly referenced from required .class files.</p> <p>Anyone could help me to sort out this issue.</p>
java
[1]
1,128,537
1,128,538
Select object which was created in plugin
<p>I am creating various objects with my plugin, then I append more objects to them, and so when i do that i need to select those fresh objects. </p> <p>I have made very simple jsfiddle here: <a href="http://jsfiddle.net/6zBGj/2/" rel="nofollow">http://jsfiddle.net/6zBGj/2/</a></p> <p>And now as you can see I append <code>item</code> div to the <code>$container</code> and so when user clicks on <code>item</code> i want to do something, but i can't find a way to select it.</p> <p>Please keep in mind that this is a plugin, and i do not want to select it like this: <code>$(".container .item")</code> I need to work with each individual object separately. </p> <p>P.S don't mind messy code it's just an example.</p>
jquery
[5]
830,626
830,627
Passing different number of arguments to a params method at runtime
<p>I have method with <code>params object[] args</code> and would like to pass parameters at runtime depending on condition. It can be zero objects or one, two objects parameters. </p> <p>How to build <code>params object[] args</code> at runtime?</p>
c#
[0]
2,268,382
2,268,383
Find appended text from txt file
<p>i want to write a code in a way,if there is a text file placed in a specified path, one of the users edited the file and entered new text and saved it.now,i want to get the text which is appended last time. here am having file size for both before and after append the text</p> <p>my text file size is 1204kb from that i need to take the end of 200kb text alone is it possible</p>
c#
[0]
1,982,952
1,982,953
Searching for two integers root**pwr = integer(user's input)
<p>A question from a book I have found.</p> <blockquote> <p>Write a program that asks the user to input an integer and prints two integers, root and pwr, such that 0 &lt; pwr &lt; 6 and root**pwr is equal to the integer user entered. If no such pair exists, print that it is impossible to find such a pair.</p> </blockquote> <pre><code>integer = 3 #there will be raw_input but I use it as an example root = 0 for pwr in range(1,6): if root**pwr != integer: pwr += 1 print pwr else: print root, pwr if pwr &gt; 5: pwr = 1 root += 1 </code></pre> <p>I did not complete program yet because I cannot get loop right. The problem is that I receive output 2, 3, 4, 5, 6 and then loop terminates. However, I did use restart on pwr variable in the last if statement code block you see. However, it stops to execute anyway. What is the problem here?</p>
python
[7]
4,090,723
4,090,724
activity not getting loaded when user called a number from contact list its getting launched after the calling screen
<p>I m doing a simple project in which user gets notified of its agenda when he receives the call or perform a call. </p> <p>I have done these things but had a problem when user calls a number in contact list by selecting it through contact list the <code>activity</code> is not popup at start up its gets launched after the calling screen it works fine if user type the number and then press a calling button the <code>activity</code> gets pop up properly.</p> <p>But don't know why its not working properly when user calls from contact list or call log.</p> <p>I have used the <code>Broadcast Receiver</code>.</p> <p><code>android.intent.action.PHONE_STATE</code> for getting receiver when incoming call. <code>android.intent.action.NEW_OUTGOING_CALL</code> and for getting receiver when outgoing call.</p> <p>I think <code>NEW_OUTGOING_CALL</code> is giving the problem as its run when the outgoing call is made by typing the mobile no. </p> <p>please help me out</p>
android
[4]
2,573,012
2,573,013
How to integrate apple payment gate way with iphone?
<p>I want to integrate Apple Payment Gateway with my iPhone app.</p> <p>i.e</p> <p>Suppose user wants to purchase gold from the online store. He/she can do payment through apple payment gatway.</p> <p>If anybody know than give me advise.</p>
iphone
[8]
5,369,476
5,369,477
Python2.6 IF Using AND OR
<p>I can't compare one variable with multiple values.</p> <p>For example I need that variable called <code>_query</code> must be different from <code>Sleep</code> and <code>Binlog</code>.</p> <pre><code>if (query != "Sleep") or (query != "Binlog Dump"): print query[4] </code></pre> <p>With the above code my script is not working. Could you help me?</p> <p>Thanks.</p>
python
[7]
4,386,821
4,386,822
Printing All Values via File Writer
<p>I want to print all the letter that the user will input but the thing is, my program only prints the last value that the user will input, and only the last value is recorded in <code>Ascii.txt</code>. It should look like this</p> <p>for example : the user input A,B,c,C</p> <p>I want also to delete the comma but I can't :(</p> <p>output in "Ascii.txt" should be:</p> <pre><code>A = 65 B = 66 c = 99 C = 67 </code></pre> <p>please dont laugh at me because im still a student and new to programming, thank you very much</p> <pre><code>import java.io.*; public class NewClass2{ public static void main(String args[]) throws IOException{ BufferedReader buff = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Please Enter letters separated by comma: "); String str = buff.readLine(); for ( int i = 0; i &lt; str.length(); ++i ) { char c = str.charAt(i); int j = (int) c; System.out.println(c +" = " + j); { try { FileWriter fstream = new FileWriter("Ascii.txt"); BufferedWriter out = new BufferedWriter(fstream); out.write(c+" = "+j); out.close(); }catch (Exception e){ } } } } } </code></pre>
java
[1]
427,958
427,959
OnClickListener of ImageButton android
<p><strong>I have implement one application in which four image button and on image button has four animal picture like this :</strong> </p> <p>![image][1]</p> <pre><code> deer.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { .. . .. . . . }); Fox.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { .. . .. . . . }); lion.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { .. . .. . . . }); monkey.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { .. . .. . . . }); </code></pre> <p>Now problem is when i am click on lion , other 3 clickListner are not disable.so when user click on lion at that time click on deer flag will true both. or some time flag will true all.</p> <p>in simple language i want disable remain clickListner if i am click on any one. </p> <p>so can you help me.?</p> <p>thanks nik.</p> <p>[1]: </p>
android
[4]
520,792
520,793
Allowing only numeric typing
<p>I Have this javascript code to allow only numeric input on textboxes</p> <pre><code> function CheckNumeric(e) { if (window.event) // IE { if ((e.keyCode &lt; 48 || e.keyCode &gt; 57) &amp; e.keyCode != 8) { event.returnValue = false; return false; } } else { // Fire Fox if ((e.which &lt; 48 || e.which &gt; 57) &amp; e.which != 8) { e.preventDefault(); return false; } } } </code></pre> <p>The problem is that it's also preventing the "TAB" button ! wich i like to allow it.</p> <p>i wish you could help me do that.</p>
javascript
[3]
5,996,935
5,996,936
Best practice switching place of two items in an array
<p>What is best practice for switching two items place in an Array via JavaScript?</p> <p>For example if we have this array <code>['one', 'two', 'three', 'four', 'five', 'six']</code> and want to replace two with five to get this final result: <code>['one', 'five', 'three', 'four', 'two', 'six']</code>.</p> <p><img src="http://i.stack.imgur.com/CK1DO.png" alt="enter image description here"></p> <p>The ideal solution is short and efficient. </p> <p>Update:</p> <p>The <code>var temp</code> trick is working and I know it. My question is: is using <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array#Methods" rel="nofollow">JavaScript native Array methods</a> faster or not? </p> <p>Something like <code>array.splice().concat().blah().blah()</code> seems is faster and use less memory. I didn't develope a function that using Array methods but I'm sure it's possible.</p>
javascript
[3]
3,971,775
3,971,776
javascript problem in firefox
<p>I used a javascript function. It includes form.reset(). It is working finely most browser except in firefox. In firefox, the most of controls are clear but not included hidden fields. I want to clear hidden field in reset. I don't want to use looping. How to do this?</p>
javascript
[3]
587,570
587,571
Sorting Multiple arrays in Desc order in PHP
<p>I need to sort following array in desc order by <code>ref_no</code>. Eg: At location <code>[0]</code> there should be property with id <code>16</code> (since it's <code>ref_no</code> is greater) and at <code>[1]</code> property with id <code>10</code>. </p> <p>*Please note: The size of main array is dynamic and that of Property array remains same.</p> <pre><code>Array ( [0] =&gt; Array ( [Property] =&gt; Array ( [id] =&gt; 10 [member_id] =&gt; 2 [ref_no] =&gt; 333 } ) [1] =&gt; Array ( [Property] =&gt; Array ( [id] =&gt; 16 [member_id] =&gt; 4 [ref_no] =&gt; 509 } ) ) </code></pre>
php
[2]
479,430
479,431
Reading Text from a richTextbox and save to database in c#
<p>how to read Text from a rich text box and save it to database as text in windows Forms c# </p>
c#
[0]
959,357
959,358
Where I can find jquery.param implementation code?
<p>I would like to know where I can find the implementation code for jquery.param.</p>
jquery
[5]
3,915,505
3,915,506
Can I debug my applications on my phone without root?
<p>I recently screwed up and installed an OEM update without thinking it would cause me to lose root. Sadly, my phone isn't popular enough for the root for this SW version to be out... </p> <p>So then, can I still deploy applications to my phone? </p>
android
[4]
2,892,622
2,892,623
find all occurrences of text within html document with next and previous options using javascript
<p>I have implemented a text search in html using javascript also I am able to highlight it, now I am looking to navigate within the html document using a next and previous buttons, If anyone can suggest some options and solutions that would be really great. Thanks in advance. </p> <p>For reference I am using the below code for highlighting the search text. </p> <pre><code>function MyApp_HighlightAllOccurencesOfStringForElement(element,keyword) { if (element) { if (element.nodeType == 3) { // Text node while (true) { var value = element.nodeValue; // Search for keyword in text node var idx = value.toLowerCase().indexOf(keyword); if (idx &lt; 0) break; // not found, abort var span = document.createElement("span"); var text = document.createTextNode(value.substr(idx,keyword.length)); span.appendChild(text); span.setAttribute("class","MyAppHighlight"); span.style.backgroundColor="yellow"; span.style.color="black"; text = document.createTextNode(value.substr(idx+keyword.length)); element.deleteData(idx, value.length - idx); var next = element.nextSibling; element.parentNode.insertBefore(span, next); element.parentNode.insertBefore(text, next); element.parentNode.insertBefore(); element = text; MyApp_SearchResultCount++; // update the counter } } else if (element.nodeType == 1) { // Element node if (element.style.display != "none" &amp;&amp; element.nodeName.toLowerCase() != 'select') { for (var i=element.childNodes.length-1; i&gt;=0; i--) { MyApp_HighlightAllOccurencesOfStringForElement(element.childNodes[i],keyword); } } } } } </code></pre>
javascript
[3]
4,933,499
4,933,500
FIFO code explanation
<p>Is the following code an example of a FIFO ordering?</p> <p>The problem consists of implementing a FIFO queue.</p> <p>In a nutshell: a random number of cars (going north or south) drive along a two lane road. They must traverse a bridge which is one way.</p> <p>The bridge access is dependent on the arrival time. First come First served.</p> <p>Can I say that through this statement</p> <pre><code>semaphore = new Semaphore(capacita,true); </code></pre> <p>cars cross the bridge according their arrival order?</p> <p>Here I can't figure out how it works and how it can be related to the previous statement</p> <pre><code>lock = new ReentrantLock(true); </code></pre> <p>Can someone help me?</p> <p>thanks </p> <pre><code>public Ponte(int capacita){ nNordTraversing = 0; nSudTraversing = 0; nNordWaiting = 0; nSudWaiting = 0; semaphore = new Semaphore(capacita,true); lock = new ReentrantLock(true); waitingCond = lock.newCondition(); bridgeCond = lock.newCondition(); } </code></pre>
java
[1]
1,088,605
1,088,606
Define object defaults for JavaScript function parameters
<p>I have a little class that extends the Date object in JavaScript. One method just returns the current Date in UTC.</p> <pre><code>Date.prototype.nowUTC = function(options) { var now = new Date(); return new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds()); } </code></pre> <p>What I'd like to do is define the options parameter as an object that will contain hours, minutes, and seconds, which will be added to the time. For example, </p> <pre><code>Date.prototype.nowUTC = function(options) { var now = new Date(); return new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours() + options.hours, now.getUTCMinutes() + options.minutes, now.getUTCSeconds()) + options.seconds; } </code></pre> <p>Is there a way to pre-define these values, so I don't have to check if it's defined before adding it or set a default? (such as <code>function(options = {'hours' : null, 'minutes' : null, 'seconds' : null) {}</code>) Id prefer to handle the parmeter like - as one object - instead of passing separate params for each value.</p> <p>Thank you!</p>
javascript
[3]
4,086,418
4,086,419
How to find max number of columns and rows from array in php
<p>I upload a csv and expload it to an array.</p> <pre><code>array(6) { [0]=&gt; string(64) "Criteron A-1 bla ,Criteron A-2 bla,Criteron A-3 bla,Criteron A-4 bla,Criteron A-5 bla" [1]=&gt; string(64) "Criteron B-1 bla,Criteron B-2 bla,Criteron B-3 bla,Criteron B-4 bla,Criteron B-5 bla" [2]=&gt; string(51) "Criteron C-1 bla,Criteron C-2 bla,Criteron C-3 bla,Criteron C-4 bla" [3]=&gt; string(38) "Criteron D-1 bla,Criteron D-2 bla,Criteron D-3 bla" [4]=&gt; string(64) "Criteron E-1,Criteron E-2,Criteron E-3,Criteron E-4,Criteron E-5" [5]=&gt; string(51) "Criteron F-1,Criteron F-2,Criteron F-3,Criteron F-4" } </code></pre> <p>The original csv has 6 rows and max 5 columns as you see in the above. </p> <p>In order to put these data in a table, I need to know number of rows and maximum number of columns.</p> <p>I can find number of rows by using count(). I am thinking to use substr_count() of comma "," for each array and find max then add one to that max to find out the max number of column. (I haven't figure it out how to code the second part yet, though)</p> <p>I am wondering if you know a better way.</p> <p>Thanks in advance.</p>
php
[2]
5,643,741
5,643,742
Java - How to create tabs look like words or excel 2007
<p>i have problem, i need make an application user interface looklike word or excel but different feature, in word or excel 2007 you can see tab on top of application. My problem is how to create these tabs look like this? what's component i need to use? ( Tabs are Home - Insert - Page layout and so on ... )</p> <p>look line image below:</p> <p>http://www.galcho.com/Blog/content/binary/Word2003Menus.jpg</p> <p>and other question is how to store session if using java application? store session in file ?</p>
java
[1]
2,774,971
2,774,972
How to clear folder contents on application close
<p>i want to delete all items from my custom made folder, but i want to do it when the application closes as the user no longer needs a handle on these files anymore.</p> <p>Where in the c# code should i write such a method? For example is there a application.shutdwon event or something :$</p> <p>Thanks</p>
c#
[0]
1,731,304
1,731,305
Handling B64 encoded data in Python
<p>In my Google App Engine based app, I am fetching data from a SOAP webservice. The problem is that one of the tag contains binary 64 encoded data. I decode it using </p> <pre><code>decodedStr = base64.b64decode(str(content)) </code></pre> <p>It seems that the decoding is not done correctly a I get garbage data in decodeStr. I think the problem is that the content string is falsely parsed as a unicode string instead of simple byte string</p> <p>Can any Python guru tell me how to handle b64 encoded data in Python?</p> <p>For now I am using this workaround</p> <pre><code>fileContent = str(fileContent) fileContent = fileContent[3:-3] self.response.out.write(base64.b64decode(fileContent)) </code></pre>
python
[7]
5,354,246
5,354,247
List collection that replaces numbers with words
<p>I am trying to improve a list collection that i have to replace values that are divisible by two and 10 and replace everything that is divisible by two with dTwo and ten with dTen?</p> <p>My code works with one divisible statment but not two.</p> <pre><code> var num = new List&lt;string&gt;(); for (int n = 0; n &lt; 101; n++) { num.Add(n % 2 == 0 ? "dTwo" : n.ToString()); num.Add(n % 10 == 0 ? "dTen" : n.ToString()); } </code></pre>
c#
[0]
3,170,874
3,170,875
how to redirect to onother page after if condition is satified in php?
<p>I have used a php code for redirect to another page, but its not working.I am at loss. please help me. I am giving the code snippet.</p> <pre><code>if($row-&gt;cnt==1){ echo "Succes."; // header ('Location:HomePage.php); header("Location:http://localhost/library/HomePage.php"); } </code></pre>
php
[2]
15,813
15,814
How to extract data in Map<String,Integer> from JSONArray
<p>I have array ( JSONArray object ) with values like </p> <pre><code>[["one",1],["two",2],["three",3]...] </code></pre> <p>How to extract this to Map ? I can get single JSONObject from array but how to extract from that ?</p>
android
[4]
3,380,770
3,380,771
Code outside functions
<p>I have written this code outside all functions:</p> <pre><code>int l, k; for (l = 1; l &lt;= node; l++) { for (k = 1; k &lt;= node; k++) { flow[i][j] = capacity[i][j]; flow[j][i] = 0; } } </code></pre> <p>It is giving me the following error on compilation:</p> <pre><code>shalini@shalini-desktop:~$ g++ -o output fords.cpp fords.cpp:63: error: expected unqualified-id before ‘for’ fords.cpp:63: error: expected constructor, destructor, or type conversion before ‘&lt;=’ token fords.cpp:63: error: expected constructor, destructor, or type conversion before ‘++’ tok </code></pre>
c++
[6]
636,077
636,078
How to make a menu using UL LI sortable in jquery
<p>How you i make my menu sortable so i can move there position around</p> <pre><code> &lt;ul id="nav-one" class="nav"&gt; &lt;li&gt; Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt; Members &lt;ul&gt; &lt;li&gt;&lt;a href="?p=view_users" target="_self"&gt;All Users&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; </code></pre> <p>can someone lead me down the right path please</p> <p>Thank you,</p>
jquery
[5]
5,374,048
5,374,049
Concatenating with DropDownList items ASP.Net
<p>I have a databound dropdownlist on my asp.net page. </p> <pre><code>&lt;asp:DropDownList ID="ddlCases" runat="server"&gt;&lt;/asp:DropDownList&gt; </code></pre> <p>I am populating ddlCases as</p> <pre><code>ddlCases.DataSourse = SelectItems(); ddlCases.DataValueField = "itemid"; ddlCases.DataTextField = "itemname"; ddlCases.SelectedIndex = 0; ddlCases.DataBind(); </code></pre> <p>SelectItems() return a datatable. What I want to do is to concatenate each item with a sequence number(1,2,3..) in which sequence they appear in the dropdownlist something like 1. itemname1 2. itemname2 3. itemname3</p> <p>What are my options for achieving this?? Regards, ZB</p>
asp.net
[9]
569,852
569,853
Can "soft references" exist in Python?
<p>In other languages (e.g. Java), object references can be Strong, Weak, Soft or Phantom (<a href="http://weblogs.java.net/blog/enicholas/archive/2006/05/understanding_w.html">http://weblogs.java.net/blog/enicholas/archive/2006/05/understanding_w.html</a>).</p> <p>In Python, references are Strong by default and the WeakRef module allows weak references.</p> <p>Is it possible to have "soft references" in Python?</p> <p>In my particular case, I have a cache of objects that are time-consuming to create. Sometimes there may be no references to a cached object, but I don't want to throw the cached object away if I don't have to (i.e. if memory is plentiful).</p>
python
[7]
1,764,005
1,764,006
javascript get unique key values
<p>I have an array which contains the following items:</p> <pre><code>var jobName = getNextJobName(); var Details = getNextJobDetails(); var item = { Name: jobName, Details: Details }; array.push(item); </code></pre> <p>I want to extract all the unique names (from the Name field). (in order to create a new object which groups all the details for a specific job).</p> <p>Could you please show me an efficient way to do this?</p>
javascript
[3]
4,498,402
4,498,403
Playing audio that is retrieved from url
<p>I am getting a list of songs and its corresponding images from a url.The url is a json url. When i click the list a corresponding song is played. I have used AVFoundation Framework to play the song. Now the issue is that i need to play the next song after the playing of first song is completed. The corresponding images also must load. If i click the next or previous button the corresponding songs must be played. What is the best possible mechanism to attain it??? </p> <p>I have read about the Audio Queues and Audio Units but not sure how to use them. I'll be really helpful if i am provided with some sample code of how to do it.</p>
iphone
[8]
4,722,819
4,722,820
Android funf framework - Stale Data Exception
<p>So, I started with the WifiScanner tutorial and used the funf-0.3.0.jar to use all the builtin probes. However, some of the builtin probes (CallLogProbe, SMSProbe, ContactProbe, ImagesProbe, VideosProbe, BrowserSearchesProbe, BrowserBookmarksProbe) are throwing StaleDataExceptions like this: </p> <pre><code>03-09 11:58:34.851: E/AndroidRuntime(14559): android.database.StaleDataException: Attempted to access a cursor after it has been closed. 03-09 11:58:34.851: E/AndroidRuntime(14559): at android.database.BulkCursorToCursorAdaptor.throwIfCursorIsClosed(BulkCursor ToCursorAdaptor.java: 75) 03-09 11:58:34.851: E/AndroidRuntime(14559): at android.database.BulkCursorToCursorAdaptor.getCount(BulkCursorToCursorAdapt or.java: 81) 03-09 11:58:34.851: E/AndroidRuntime(14559): at android.database.AbstractCursor.isLast(AbstractCursor.java:221) 03-09 11:58:34.851: E/AndroidRuntime(14559): at android.database.CursorWrapper.isLast(CursorWrapper.java:142) 03-09 11:58:34.851: E/AndroidRuntime(14559): at edu.mit.media.funf.probe.ContentProviderProbe $ContentProviderIterator.hasNext(ContentProviderProbe.java:213) 03-09 11:58:34.851: E/AndroidRuntime(14559): at edu.mit.media.funf.probe.ContentProviderProbe.sendProbeData(ContentProvider Probe.java: 131) 03-09 11:58:34.851: E/AndroidRuntime(14559): at edu.mit.media.funf.probe.ContentProviderProbe $1.run(ContentProviderProbe.java:86) 03-09 11:58:34.851: E/AndroidRuntime(14559): at java.lang.Thread.run(Thread.java:856) </code></pre> <p>Does anyone have suggestions about why this is happening and how to fix it ?</p>
android
[4]
1,363,126
1,363,127
jquery elements exclusion from an existing collection
<p>I would like to know if there is a way in jQuery to exlucde a group of elements from a previously selected collection of items. I know I can use ":not" to add exclussion rules when referencing a group of items, but that is not the same question, since I want to know if it is possible to substract a group of elements from a different group of elements already referenced.</p> <p>¿why is that? because imagine the first group is created according to a set of dynamic rules and some elements could have been added or removed, and when I want to substract the second set of elements from the first group, I dont really know which elements are in the first group. That is, there is no such rule that can be applied using selectors to obtain what I am looking for.</p> <p>The idea is something like this:</p> <pre><code>var a = $("selection rules"); var b = $("selection rules2"); //elements from both groups could be removed or new ones added dinamically var c = b.substract(a); </code></pre>
jquery
[5]