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
1,056,968
1,056,969
selector with 9 patch
<p>I'm try to create selector to CheckBox and replace the android:button with the selector. In the selector i had two 9patch image , but for some reason that not work good. the 9patch images are ok. This the selector code:</p> <pre><code>&lt;selector android:constantSize="false" xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_checked="false" android:drawable="@drawable/bopen" /&gt; &lt;item android:state_checked="true" android:drawable="@drawable/bclose" /&gt; &lt;item android:drawable="@drawable/bclose" /&gt; &lt;/selector&gt; </code></pre> <p>What can i do ?</p>
android
[4]
5,769,494
5,769,495
Stop images on sd card from showing up in gallery?
<p>I keep some png files on the user's sd card. Some users report that these images are showing up in their gallery application. Sounds like the gallery implementation on some devices search out any image files they can find on the sd card and show it in the gallery. Is there a way to tell the system not to include these images in the gallery? It's just an annoyance to the users.</p> <p>Thanks</p>
android
[4]
921,605
921,606
how to get access to newly added functions inside a javascript class
<p>If in a Javascript class there are few properties which are added initially and were available through prototype.Now if some new properties or functions are added to the class ,how can they be accessed to all existing and newly created functions. Note that the class is not readily available to everyone.</p> <pre><code>function Foo(){ this.name=""; this.place=""; } </code></pre> <p>In <code>House.js</code> i had used <code>Foo.prototype=House();</code></p> <p>In <code>college.js</code> i had used <code>Foo.prototype = College();</code></p> <p>now this Foo() is modified to</p> <pre><code>function Foo(){ this.name=""; this.place=""; var books=function Books(){...some implementaion}; } </code></pre> <p>What will happen if <code>House.books</code> before and after modification of the class.</p>
javascript
[3]
3,700,555
3,700,556
Refresh an element in jquery
<p>I have a anchor element on a page that i need to refresh every 5 seconds. It is only one anchor so i do not need a cycle plugin here.</p> <p>How can I refresh the element i want without reloading the page. Any plugins?</p>
jquery
[5]
2,683,847
2,683,848
How to update an item in core data
<p>I am using Core Data. I retrieve data in a NSMutable array using some NSPredicate. Now I want to update some items. Let say I have a name string or some BOOL which I want to update. So how to do that. Like Is there any way I can update with respect to ID or something, becoz I dont get all the items from the managedObjectContext.</p>
iphone
[8]
1,859,553
1,859,554
Using 'is not' in Python
<p>I am trying to cursor search through some records in an access table from a field called DEV_TYPE. I want to compare each record against a list of know values I have built earlier in my script:</p> <blockquote> <p>(devcatList)</p> </blockquote> <p>I want to print out any values that do not occur in the list. Some of the values in the records are Null as well. I want to set my if statement to only print out values that do not occur in the list, but I also do not want to print out 'None' for the Null values. My script is as follows:</p> <pre><code>if field.name == "DEV_TYPE": for iRow in arcpy.SearchCursor(fc): if not iRow.DEV_TYPE is None or iRow.DEV_TYPE not in devcatList: print str(iRow.OBJECTID) + " - " + str(iRow.DEV_TYPE) </code></pre> <p>I've played around with the '<code>if not x is None</code>' to '<code>if x is not None</code>'. Changed the '<code>or</code>' to and '<code>and</code>' (even though it was counter intuitive), but my printouts either return all values or no values or only '<code>None</code>'....basically everything I don't want. I'm sure I'm doing something silly. Can someone point out what my silliness is?</p> <p>Thanks, Mike</p>
python
[7]
6,013,662
6,013,663
Function returning NaN when I try to generate basic math operations
<p>I am trying to generate randomly basic math operations(addition, subtractions, multiplication and division) and sometime my function returns NaN. I used function parseInt(), but I still have the same problem. I will appreciate if anybody can help me with any suggestion. Thank you in advance!</p> <pre><code>Here is my code: function randNum(min,max) { var num = min+Math.floor((Math.random()*(max-min+1))); return num; } var choose, operator, firstNum, secondNum,rightAnswer; function getProb() { var chooseOp=randNum(1,4); choose=parseInt(chooseOp); if (choose==1) { oprator="+"; var choose1=randNum(0,10); var choose2=randNum(0,10); firstNum=parseInt(choose1); secondNum=parseInt(choose2); document.getElementById("mathProb").innerHTML=firstNum+operator+secondNum+"="; rightAnswer=choose1 + choose2; } else if (choose==2) { operator="-"; var choose1=randNum(0,10); var choose2=randNum(0,10); firstNum=parseInt(choose1); secondNum=parseInt(choose2); document.getElementById("mathProb").innerHTML=firstNum+operator+secondNum+"="; rightAnswer=firstNum - secondNum; } else if (choose==3) { operator="x"; var choose1=randNum(0,10); var choose2=randNum(0,10); firstNum=parseInt(choose1); secondNum=parseInt(choose2); document.getElementById("mathProb").innerHTML=firstNum+operator+secondNum+"="; rightAnswer=choose1 * choose2; } else if (choose==4) { operator="/"; var choose1=randNum(0,10); var choose2=randNum(0,10); firstNum=parseInt(choose1); secondNum=parseInt(choose2); document.getElementById("mathProb").innerHTML=firstNum+operator+secondNum+"="; rightAnswer=choose1/choose2; } } </code></pre>
javascript
[3]
3,275,464
3,275,465
Need help splitting a string into 3 variables
<p>I would like to split a string of characters into 3 variables. When I just run a <code>.split()</code> I get <code>['AAA00000011']</code>. I would like this to be split like:</p> <pre><code>var1 = AAA var2 = 0000001 var3 = 1 </code></pre> <p>The user is typing in these values into the command line on windows machine. </p> <p>My Code:</p> <pre><code>barcode = raw_input('Please enter your barcode') print "this is the barcode all split up", barcode.split() </code></pre>
python
[7]
4,622,177
4,622,178
validation regularexpression
<p>i have text box in that user have to enter only text. user shouldn't enter digits and special character also.help me thanku</p>
asp.net
[9]
5,850,124
5,850,125
Is there any way to execute some code when a thread is killed via clearInterval?
<p>Is there anything like a "dispose" function or "thread shutdown hook" for a specific thread running via setInterval?</p>
javascript
[3]
4,765,499
4,765,500
Images are loading in random order?
<p>Thanks in advance to anyone who takes time to respond. I truly appreciate this site! I've got a function that loads all images it finds in a given directory (see below). The problem I'm trying to resolve is that the images are loaded in a random order.</p> <p>I'd like the images to be loaded by alpha order based on their filename (widget-1.jpg would load before widget-2.jpg for example).</p> <p>Function is below...</p> <pre><code>function get_images() { global $options; foreach ($options as $value) { if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); } } if($my_custom_images !== "") { echo $my_custom_images; } else { $dir = 'wp-content/uploads/'; $url = get_bloginfo('url').'/wp-content/uploads/'; $imgs = array(); if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (!is_dir($file) &amp;&amp; preg_match("/\.(bmp|jpeg|gif|png|jpg|)$/i", $file)) { array_push($imgs, $file); } } closedir($dh); } else { die('cannot open ' . $dir); } foreach ($imgs as $idx=&gt;$img) { $class = ($idx == count($imgs) - 1 ? ' class="last"' : ''); echo '&lt;img src="' . $url . $img . '" alt="' .$img . '"' . $class . ' /&gt;'; } } } </code></pre>
php
[2]
5,923,144
5,923,145
jQuery, make .click() which is within the last else statement, run the first if statement?
<p>Is it some how possible, to make the <code>$sliderPane.click();</code> which is located in the last <code>else</code> statement, run the first <code>if</code> statement? </p> <p>Any clever ideas would be great thanks.</p> <pre><code>$tabTwitter.on('click', function () { if ( twitterOpen == true ) { twitterOpen = false; $panelTwitter.fadeOut(500); $sliderPane.animate({ "left" : 0 }, 500, function() { $sliderPane.removeAttr('style'); }); } else if ( facebookOpen == true ) { facebookOpen = false; $panelFacebook.fadeOut(500); twitterOpen = true; $panelTwitter.fadeIn(500); } else { twitterOpen = true; $panelTwitter.fadeIn(500); $sliderPane.css({ "left":0,"cursor":"pointer" }).animate({ "left" : "-490px" }, 500, function() { $('body,html').animate({ scrollTop: headerHeight - 69 }, 800); return false; }).click(); } }); </code></pre>
jquery
[5]
3,265,276
3,265,277
Using insertBefore with the result of $.get
<p>Im trying to make this work with jQuery</p> <pre><code>var ng = $.get('/static/views/ng.html'); $('#myHeader').insertBefore(ng); </code></pre> <p>the ng.html contains this</p> <pre><code>&lt;div id="ng"&gt; &lt;div class="c all"&gt;&lt;/div&gt; &lt;div class="f all"&gt;&lt;/div&gt; &lt;div class="p all"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>It doesn't trow any error or so, I figure that it is the $.get that doesn't return a correct object but don't know how to continue.</p> <p>Any ideas?</p> <p>Thanks</p>
jquery
[5]
4,533,295
4,533,296
Creating a csv-file, doesn't work with right-click save-as
<p>I have a script that generates data in csv format which is sent to the user along with a set of headers that tell the browser it is a .csv file. Everything works great when users (left)click on the link to the script, they are presented with a download dialog with the filename ending in .csv and it suggests using excel, or calc, to open it. However, when users right-click and choose Save As it is being saved with the php script name.</p> <p>Here is the header code:</p> <pre><code>header("Pragma: public"); header("Expires: 0"); // set expiration time header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); $val = date("m_d_Y_g_i"); Header('Content-Disposition: attachment; filename="personal_information_'.$val.'.csv"'); </code></pre> <p>So again, when users left-click it saves the file as personal_information_date.csv; when they right click it saves as download.php. I'm using FF3. Oddly enough, IE7 does not have this problem.</p> <p>Any ideas?</p>
php
[2]
897,393
897,394
need understanding following code?
<p>Could someone explain to me how the following code works? I've spent a bit of time trying to understand it, but it's beyond me. This is my code:</p> <pre><code>$('.acc_trigger').removeClass('active').next().slideUp(); $(this).toggleClass('active').next().slideDown(); </code></pre> <p>The JSFiddle is <a href="http://jsfiddle.net/kjHUv/7/" rel="nofollow">here</a>.<br> <b>Edit</b> I think so i understand it first it will hide all and show the current one thats selected thanks.</p>
jquery
[5]
683,106
683,107
Java: Taking a Image and turning it into Black in White with RGB
<p>So I am doing a group project for my programming class, we are makeing a photo editing program and one of my parts of the program is taking the image and turning it into black and white using rgb. I was wondering what would be the best value or way in RGB to achieve black and white? </p>
java
[1]
5,510,240
5,510,241
C++ delete storage space in a different function from where it was allocated
<p>Will I get undefined behavior if I delete a storage space in a different function from where the space was originally allocated?</p> <pre><code>typedef struct { unsigned int Data1; unsigned int Data2; unsigned int Data3; }TData; void CreateStorage(void) { TData *TempData = new TData; DeleteStorage((unsigned char*)TempData); } void DeleteStorage(unsigned char *StorageToDelete) { delete (TData*)StorageToDelete; } </code></pre>
c++
[6]
5,089,508
5,089,509
Problem with the innerHTML the content of a DIV
<p>For some reason, I can't change the contents of a DIV in either IE or Firefox. Any ideas where I might be going wrong?</p> <p>JavaScript</p> <pre><code>function displayTable() { document.getElementById('retailerDiv').innerHTML = '&lt;a&gt;HEY!&lt;/a&gt;'; } </code></pre> <p>HTML</p> <pre><code>&lt;input type="text" id="userQuery" onkeydown="displayTable()"/&gt; &lt;br/&gt; &lt;div id="retailerDiv"&gt; Now &lt;/div&gt; </code></pre>
javascript
[3]
3,223,887
3,223,888
Set opacity to ImageButton?
<p>I want to set opacity to my ImageButton, so when it is unselected, I can see the background a bit, and when I press on it - it becomes normal(no transparency). </p>
android
[4]
604,619
604,620
get Javascript to not appear as code on the page
<p>I don't know much about this, just having recently started with JavaScript, so simple language would be greatly appreciated.</p> <p>Whenever I insert JavaScript on a page, it appears in the preview as text on the page and when I update my site it also appears this way. How would I fix this?</p> <p>Thank you in advance.</p>
javascript
[3]
5,542,230
5,542,231
explode and in_Array search not working
<p>OK here is the code codepad here <a href="http://codepad.org/ZQz0Kn3R" rel="nofollow">http://codepad.org/ZQz0Kn3R</a> </p> <pre><code>function processContent($content, $min_count = 2, $exclude_list = array()) { $wordsTmp = explode(' ', str_replace(array('(', ')', '[', ']', '{', '}', "'", '"', ':', ',', '.', '?'), ' ', $content)); $words = array(); $wordsTmp2 = array(); $omit = array('and', 'or', 'but', 'yet', 'for', 'not', 'so', '&amp;', '&amp;amp;', '+', '=', '-', '*', '/', '^', '_', '\\', '|'); if(count($exclude_list)&gt;0){ $omit = array_merge($omit, $exclude_list); } foreach ($wordsTmp as $wordTmp) { if (!empty($wordTmp) &amp;&amp; !in_array($wordTmp, $omit) &amp;&amp; strlen($wordTmp) &gt;= $min_count) { $words[] = $wordTmp; } } return $words; } </code></pre> <p>OK this is my function which should return array of words by filtering from <code>$omit</code> variable. But when i use it the words in first <code>$omit</code> array are only filtered, The second merged from the <code>$exclude_list</code> is not filtered.</p> <p>I use my function this way :</p> <pre><code>$filter_array = explode("\n", words list separated by \n new line here); print_r(processContent('String gere for filtering', $min_word_length, $filter_array)); </code></pre> <p>The variable <code>$filter_array</code> is passed in to the exclude_list also is merged to omit variable but does not get filtered in return value. only first <code>$omit</code> value is filtered. Is there something wrong in code??</p>
php
[2]
693,139
693,140
BinaryWrite vs WriteFile
<p>What should I use for writing a file to the response? There are two different options as I see it. Option one is to read the file into a stream and then write the bytes to the browser with</p> <pre><code>Response.BinaryWrite(new bytes[5]) </code></pre> <p>Next option is to just write the file from the file system directly with Response.WriteFile. Any advantages/disadvantages with either approach?</p> <p>Edit: Corrected typos</p>
asp.net
[9]
3,851,701
3,851,702
Why the following upload if condition does not work?
<p>So I have an upload script, and I want to check the file type that is being uploaded. I only want pdf, doc, docx and text files</p> <p>So I have:</p> <pre><code>$goodExtensions = array('.doc','.docx','.txt','.pdf', '.PDF'); $name = $_FILES['uploadFile']['name']; $extension = substr($name, strpos($name,'.'), strlen($name)-1); if(!in_array($extension,$goodExtensions) || (($_FILES['uploadFile']['type'] != "applicatioin/msword") || ($_FILES['uploadFile']['type'] != "application/pdf"))){ $error['uploadFile'] = "File not allowed. Only .doc, .docx, .txt and pdf"; } </code></pre> <p>Why I'm getting the error when testing and including correct documents?</p>
php
[2]
3,813,890
3,813,891
PHP Validation Question
<p>Is there a way I can check if a user entered only 4 numbers and not 4 letters using PHP? If so how?</p>
php
[2]
3,220,416
3,220,417
Variable Content Streaming in PHP
<p>I wrote a toPdf class in PHP that has the ability to stream it to the browser. If the file is not marked as savable, I need to perform clean up after I stream it. Since that is not possible, I'm wondering if there is a way to read the file into a variable, perform my clean up, send the headers, then start the file steam?</p> <p>Thanks!</p>
php
[2]
4,079,162
4,079,163
C# - Create a custom event log
<p>How do I programmatically check for/create a custom event log to be viewed in Windows XP/2003 event viewer?</p> <p>Right now I can create entries in the 'Application' log but want to have custom logs for my various applications.</p> <p>I am using C# - .NET Framework 3.5</p>
c#
[0]
5,936,195
5,936,196
How to apply custom image to checkbox in android
<p>Hi, I'm trying to apply custom image to checkbox in android,for this I create an check_custom.xml file in which I define custom image for different states of check box like: </p> <pre><code>&lt;item android:state_checked="true" android:drawable="@drawable/btn_check_on" /&gt; &lt;!-- checked --&gt; &lt;item android:state_checked="false" android:drawable="@drawable/btn_check_off" /&gt; &lt;!-- unchecked --&gt; &lt;item android:state_focused="true" android:drawable="@drawable/btn_check_onfocus" /&gt; &lt;!--on focus--&gt; &lt;item android:drawable="@drawable/btn_check_off" /&gt; &lt;!-- default --&gt; </code></pre> <p>Three different images on three states on checked,on focus and on unchecked, and then I assign this xml file to background attribute of check boxes,but I'm not getting required result, this technique apply the custom image as well as default image both, please kindly help me what's wrong with this any help in this regard is greatly appreciated. Thanks.</p>
android
[4]
3,659,436
3,659,437
Implement typedef in Java
<p>I have a type Time32 that is used in generics as <code>Work&lt;Time32&gt;</code> so i made a class Time32. I also have to implement </p> <pre><code>typedef UInt(5) Time32 </code></pre> <p>Here UInt means the unsigned int. Java doesn't have unsigned int, so i made my own class.</p> <pre><code>public class UInt { private final int size; public UInt(int x) { this.size=x; } public int getSize() { return size; } } </code></pre> <p>But i don't understand how i can implement the typedef in java. Please help. Thanks.</p> <p>I need to keep the UInt class as i have some other variables that will use the Uint like <code>UInt(20) Load</code> or <code>UInt(10) Force</code></p>
java
[1]
1,031,262
1,031,263
No Exception thrown on connection timeout in specific cases for File upload
<p>Following code is being used to upload files to a server.</p> <pre><code> public static boolean uploadFile(String serverUrl, String filePath) { boolean status = false; try { File file = new File(filePath); HttpParams httpParameters = new BasicHttpParams(); int timeoutConnection = 3000; HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection); // Set the default socket timeout (SO_TIMEOUT) // in milliseconds which is the timeout for waiting for data. int timeoutSocket = 5000; HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket); HttpClient httpClient = new DefaultHttpClient(httpParameters); HttpPost postRequest = new HttpPost(serverUrl); FileBody bin = new FileBody(file); MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.STRICT); reqEntity.addPart(IShipdocsMobileConstants.CUSTOM_FILE_TAG, bin); postRequest.setEntity(reqEntity); HttpResponse response = httpClient.execute(postRequest); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { status = true; } } catch (Exception e) { status = false; } return status; } </code></pre> <p>An exception is thrown when there is no connection while a file starts to upload files but no exception is thrown when a file has already started uploading &amp; after sometime(maybe after 50% upload) , connection is lost. </p> <p>Currently I am using both WiFi &amp; GPRS activated SIM for upload . </p> <p>Any other parameters which needs to be added to the above code to get the Exception.</p> <p>Any hints/suggestions welcome.</p>
android
[4]
2,749,634
2,749,635
Custom Control Event Not Firing First Time
<p>My application runs from a single page (default.aspx) and loads custom controls based on what the user selects (this is done in the LoadPage event). </p> <p>The problem is that the FIRST time some new controls are loaded onto the page and a button is clicked, the page is NOT firing the Click event. This also happens when using a GridView and other controls.</p> <p>However, if I simply reload the page a second time, the events are fired properly. (this works successfully every time)</p> <p>Two questions: 1) Why would this occur? 2) How can I troubleshoot it better? I've tried checking the Request.Form(__EVENTTARGET) (which is blank)</p> <p>There are times when it works properly which suggests a PostBack issue - but it's not obvious.</p>
asp.net
[9]
3,241,742
3,241,743
It is not updating the row in table PDO
<p>Can someone tell me why this code is not updating the the column in these rows please</p> <pre><code>$q2 = $db-&gt;prepare("insert into stat (clan_id,abbreviation) values (:cid,:abb) ON DUPLICATE KEY UPDATE abbreviation=:abb"); $q2-&gt;execute(array( ":cid"=&gt;$somevalue, ":abb"=&gt;$abbrev )); </code></pre> <p>abbreviation is my unique key in this table, there are more values but I removed some for clarity.</p> <p>Edit: Problem still exists, the PDO is adding new entries, however when it comes across a duplicate it is not updating</p> <p>here is the table structure, there maybe something wrong here?</p> <pre><code>CREATE TABLE IF NOT EXISTS `stats` ( `id` int(11) NOT NULL AUTO_INCREMENT, `clan_id` varchar(168) NOT NULL, `abbreviation` varchar(64) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `abbreviation` (`abbreviation`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=155146 ; </code></pre>
php
[2]
4,044,287
4,044,288
Javascript does not execute Object methods
<p>I'm trying to build some objects to make my life a bit easier, but somehow I can't get it working. I got the following code:</p> <pre><code>function Paragraph(className, innerHTML, parentId) { this.className = className; this.innerHTML = innerHTML; this.parentId = parentId; } Paragraph.generateParagraph = function() { console.debug(this.parentId); // Expect 'testDiv' alert(this.parentId); // Expect 'testDiv' }; function initialize() { var paragraph = new Paragraph('testClass', 'testTitle', 'testDiv'); paragraph.generateParagraph; } window.onload = initialize; </code></pre> <p>When I try to execute this code nothing happens. I expect the console.debug and alert in the <i>generateParagraph</i> method to be executed.</p> <p>Any help would be appreciated!</p>
javascript
[3]
3,176,669
3,176,670
add/delete/modify values in "default.properties"
<p>How can I add/delete/modify values in "default.properties" for Android.</p> <p>Any examples?</p> <p>Thanks, Sana.</p>
android
[4]
3,891,829
3,891,830
I'm not sure how to structure my arithmetic methods
<p>I'm kind of new to Java. I want a method that will use submethods(?). I want something like this:</p> <pre><code>Math.Addition(1, 1, X in this case, integer of users choice for the output); </code></pre> <p>The output would be stored in the variable X. But I also want to do something like this:</p> <pre><code>Math.Subtraction(2, 1, X); </code></pre> <p>How would I do this?</p>
java
[1]
4,823,916
4,823,917
C++: Data alignment and efficient use of memory (in both time and space)
<p>Cheers every!</p> <p>I want to store some data in memory in a structure, or in an array. My problem is data alignment. I cant really use a 8 byte data next to a char since they will take up 16 bytes together.</p> <p>Now I would live happy with a single 8 byte field, like a char and using the remaining 7 bytes to store other data.</p> <p>How do I do that? What are the performance penalties to pay? Thanks people.</p>
c++
[6]
4,440,901
4,440,902
Authentication for Videoview in android
<p>I'm using a <strong>Videoview</strong> to play http video.That Http video url needs <strong>Authentication</strong>.</p> <p>So please let me know how authentication can be set to the VideoView?If not is there any other alternative for viewing authenticated video.?</p> <p>Thanks &amp; Regards, Sree Harsha .</p>
android
[4]
3,571,207
3,571,208
Draw image in triangle region iphone
<p>I draw an triangle using these piece of code</p> <pre><code>CGPoint center; center = CGPointMake(x1, x2); CGContextMoveToPoint(context, center.x, center.y); for(int i = 0; i &lt; 3; i++) { switch (i) { case 0: CGContextAddLineToPoint(context, y1, y2); break; case 1: CGContextAddLineToPoint(context, z1, z2); break; case 2: CGContextAddLineToPoint(context, x1, x2); break; default: break; } } </code></pre> <p>Now the triangle has drawn in my uiview.I have an image size should be (420*300).I want to load this image in the triangle region . (Not out of this triangle region).</p> <p>Can anyone help me ? </p> <p>Thanks in advance.....</p>
iphone
[8]
3,143,176
3,143,177
Object of class A cannot be create directly but only by class B
<pre><code>class A { public function foo() { } } class B { $a = new A; public function go() { } } </code></pre> <p>I want A object cannot be created directly.But only by class B. How i can do this.</p>
php
[2]
2,594,225
2,594,226
Android Application
<p>I am developing image editor. Through which ill be able to edit the pics. Am stuck some where in between. 1) I am using arraylist. whenever shifting b/w screen occurs that arraylist gets refreshed.I have used static keyword. 2) Or any one can tell me plz how can i create objects at run time... </p>
android
[4]
1,556,996
1,556,997
Timer class and C#
<p>I have a program written in C#. I want the Timer class to run a function at a specific time.</p> <p>E.g : run function X at 20:00 PM</p> <p>How can I do that using the Timer class?</p>
c#
[0]
1,544,506
1,544,507
A couple of questions regarding jQuery's $(document).ready and its use
<p>I have been writing some basic Javascripts, and I am finally giving in to try to learn jquery (less than 24hrs). I am having a problem with understanding syntax with simple lessons/codes that I am tweaking for my purpose.</p> <p>Does everything has to be wrapped inside a separate $(document).ready(function())?</p> <p>Or just have 1 $(document).ready(function()) statement and stuff everything inside of it? Including custom functions.</p> <p>What happens when you put one inside another?</p> <p>Sorry for simple question, but the examples online or in my book has the declaration wrapped around the executing code.</p>
jquery
[5]
3,528,684
3,528,685
i had created a splash screen and added an image to it, but when i run this in emulator the image is not getting displayed
<p>i had created a splash screen and added an image to it, but when i run this in emulator the image is not getting displayed, my .xml code is this</p> <pre><code>enter code here&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" tools:context=".SplashScreenActivity" /&gt; &lt;ProgressBar android:id="@+id/progressBar1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/textView1" android:layout_toLeftOf="@+id/textView1" /&gt; &lt;ImageView android:id="@+id/imageLoading1" android:layout_height="wrap_content" android:layout_width="match_parent" android:visibility="visible" android:src="@drawable/splash"/&gt; </code></pre> <p></p> <p>and the .java code is this</p> <pre><code> Thread splashTread = new Thread() { @Override public void run() { try { int waited = 0; boolean active = false; while(active &amp;&amp; (waited &lt; 300)) { sleep(100); if(active) { waited += 100; } } } catch(InterruptedException e) { // do nothing } finally { startActivity(new Intent(SplashScreenActivity.this,MainActivity.class)); finish(); //startActivity(new Intent("com.splash.com.MyApps")); //startActivity( new Intent(getApplicationContext(), Myapps.class)); } } }; splashTread.start(); } </code></pre> <p>please can anybody tell where i have gone wrong??</p>
android
[4]
4,669,803
4,669,804
My message wont show on my textbox?
<p>I am trying to fill a form (Movie information such as Title, Year and Genre) and then show it in a textbox (enable=false). I have 2 classes and a Form (with 2 textboxes (for user input), 2 buttons, 1 to register the movie infos, and 1 to show the infos in a 3rd textbox (the one that is Disabled).</p> <pre><code>class Movies { public string Title { get; set; } public int Year { get; set; } public string ReturnMovie() { return Title + " (" + Year.ToString() + ")"; } } class Genres { public string Genre { get; set; } public string ReturnGenre() { return Genre; } } </code></pre> <p><strong>MainForm:</strong></p> <pre><code> bool btnRegisterClicked = false; Movies m1 = new Movies(); Genres g1 = new Genres(); private void btnRegister_Click(object sender, EventArgs e) { btnRegisterClicked = true; if (btnRegisterClicked == true) { if (txtTitle.Text.Length == 0) { MessageBox.Show("Enter a title for the movie."); btnRegisterClicked = false; } else if (txtYear.Text.Length &lt; 4) { MessageBox.Show("Enter a valid year."); btnRegisterClicked = false; } else if (chkGenre.SelectedIndex == -1) { MessageBox.Show("Select the genre(s) of the movie."); btnRegisterClicked = false; } else { txtTitle.Text = m1.Title; txtYear.Text = m1.Year.ToString(); chkGenre.Text = g1.Genre; } txtTitle.Clear(); txtYear.Clear(); chkGenre.ClearSelected(); } } private void btnShow_Click(object sender, EventArgs e) { txtShow.Text = m1.ReturnMovie() + g1.ReturnGenre(); } } </code></pre> <p>What am I doing wrong ?</p>
c#
[0]
2,222,394
2,222,395
Sending an Image to a server to create Blob key in android
<p>I want to send an image captured by camera to a server, which creates blob key. I am not getting how to send that image to the server. In which format is the image is sent? </p> <p>I am trying to send parameters through <code>HttpParams</code>.</p> <p>This is my code but the data is not going to server. What is the problem?</p> <pre><code>String name=tname.getText().toString(); String addr=taddr.getText().toString(); String age=tage.getText().toString(); String cnct=tcnct.getText().toString(); String gen=tgen.getText().toString(); String wtm=twtm.getText().toString(); ba1=Base64.encodeToString(imageform, 0); Date d=new Date(); String date=d.toString(); InputStream i1; String back=""; HttpParams p=new BasicHttpParams(); p.setParameter("vname",name); p.setParameter("address", addr); p.setParameter("age", age); p.setParameter("contact", cnct); p.setParameter("gender", gen); p.setParameter("whomto", wtm); p.setParameter("myFile", ba1); try { HttpClient httpclient = new DefaultHttpClient(p); HttpPost res=new HttpPost(result); HttpResponse response = httpclient.execute(res); HttpEntity entity = response.getEntity(); i1 = entity.getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(i1,"iso-8859-1"),8); StringBuilder sb = new StringBuilder(); if ( reader.readLine() == null) { Log.e("inside if","No data"); } else { String line = reader.readLine(); i1.close(); back=sb.toString(); } </code></pre> <p>I am not getting any errors or exceptions.</p>
android
[4]
2,003,077
2,003,078
How to make android phone ring?
<p>I would like to make a android phone ring through code. For example a app installed and the use recieves a call a app listens for this. If a certain number calls then a specific ringtone plays. How do i go about make code to make a android phone ring?</p>
android
[4]
2,293,172
2,293,173
Connection reset by peer when calling .net web service from android
<p>I developed a simple android application that calls a .net web service using ksoap2-android library version 2.6.0 . The problem is that it sometimes throws "Connection reset by peer" exception. I can't figure out the cause of this problem since it appears when using 3G network.</p> <p>Thanks in advance.</p> <p>Regards, Reem Al-Hanbali</p>
android
[4]
5,879,729
5,879,730
Jquery Check stylesheet and do action
<p>me again! I'm learning a lot from this site! </p> <p>Now.. i want to know how do i check with jQuery what stylesheet i'm using and perform an action. In the case, place a favicon..</p> <p>i have this script for change stylesheet on my page:</p> <pre><code>$("#painel_faccao li a").click(function() { $("link#faccao").attr("href",$(this).attr('rel')); $.cookie("css",$(this).attr('rel'), {expires: 365, path: '/'}); return false; }); </code></pre> <p>and my favicon on page:</p> <pre><code>&lt;link id="favicon" rel="shortcut icon" type="image/png" href="favicon.png" /&gt; </code></pre> <p>i know i must use this:</p> <pre><code>$("#favicon").attr("href","favicon2.png"); </code></pre> <p>but i don't know how to make jquery check the stylesheet.. </p> <p>someone can help me?</p>
jquery
[5]
4,000,165
4,000,166
td colspan does not work while using jquery show/hide()
<p>I have a table of content</p> <pre><code>&lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;First Name &lt;/th&gt; &lt;th&gt;Last Name &lt;/th&gt; &lt;th&gt;Description&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr class="odd"&gt; &lt;td&gt;John&lt;/td&gt; &lt;td&gt;Deo&lt;/td&gt; &lt;td&gt;&lt;a class="personal-checking-more-link"&gt;More&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td style="display:none" colspan="3"&gt;Description goes for 1st row&lt;/td&gt;&lt;/tr&gt; &lt;tr class="odd"&gt; &lt;td&gt;Jaden&lt;/td&gt; &lt;td&gt;Aidan&lt;/td&gt; &lt;td&gt;&lt;a class="personal-checking-more-link"&gt;More&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td style="display:none" colspan="3"&gt;Description goes for 2nd row&lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt; </code></pre> <p> When I click on <b>More</b> then 1st row Description will shown. it shows perfactly but colspan does not work. </p> <p>here is my js code</p> <pre><code>personalChecking = function () { $('a.personal-checking-more-link').click(function() { $(this).parent().parent().next().toggle('slow'); }); } $(document).ready(personalChecking); </code></pre> <p>Thanks in advance</p>
jquery
[5]
2,774,517
2,774,518
Split the date in c#
<p>For Ex You date enter in the various form in textbox</p> <ol> <li>12/Augest/2010</li> <li>augest/12/2010</li> <li>2010/12/Augest</li> </ol> <p>and out put is three textbox First is day show= 12 textbox second is Months show= augest textbox third is Year show= 2010</p>
c#
[0]
2,927,751
2,927,752
Java cast parent to child?
<p>Here is my code:</p> <pre><code>for (DrawableEntity entity : drawableEntityList) { if (entity instanceof Beam) { (Beam) entity.age += timeElapsed; } else if (entity instanceof Block) { } } </code></pre> <p>Basically <code>drawableEntityList</code> is a <code>Vector</code> of <code>DrawableEntitys</code>, and I want to iterate through everything in the <code>Vector</code>. Then depending on if they are subclass <code>Beam</code> or subclass <code>Block</code> I want to do something different.</p> <p>The problem is that I'm trying to change a variable that only the subclasses have, I figured I could cast with (Beam) but it doesn't work.</p> <p>Is it not possible to cast a parent class to a child class?</p>
java
[1]
3,870,124
3,870,125
submit a form using external js
<p>How to submit a form using external js ? using form name or id is not working, Showing this error TypeError: document.forms.adminForm.submit is not a function</p> <blockquote> <p>document.forms["adminForm"].submit();</p> </blockquote> <p>adminForm is name &amp; id of the form</p>
javascript
[3]
2,077,255
2,077,256
PHP Multiarray LOOP WHERE CLAUSE
<p>hey guys i would like to repeat this statement 13 times by change this statement within a loop or something. "WHERE spending.SectorID = 1,2,3,4,5,6,7,8,9,10,11,12,13" how can i successfully do it without typing this code 12 more times. and i would to display the data individually though~ like where sectorid = 1; belong to a table with a button to initiate that particular query</p> <pre><code>&lt;?php $spendingname= array(); $spendingpercent = array(); $spendingid = array(); mysql_select_db($database_conn2, $conn2); $query_Spending = "SELECT CONCAT(spending.SectorID, spending.ExpenditureID) AS 'SpendingID', expenditure.ExpenditureName, spending.SpendingPercent, spending.SectorID FROM spending INNER JOIN expenditure ON spending.ExpenditureID = expenditure.ExpenditureID WHERE spending.SectorID = 1"; $Spending = mysql_query($query_Spending, $conn2) or die(mysql_error()); $totalRows_Spending = mysql_num_rows($Spending); while($row_Spending = mysql_fetch_assoc($Spending)) { $spendingname[] = $row_Spending['ExpenditureName']; $spendingpercent[] = $row_Spending['SpendingPercent']; $spendingid[]= $row_Spending['SpendingID']; } mysql_free_result($Spending); ?&gt; </code></pre>
php
[2]
342,607
342,608
How does jquery work? i use dreamweaver cs5
<p>I went to jquery and downloaded the file you need and added it my my HTML(root folder) as it states and I put my style <code>text/javascript</code> in but it doesn't seem to be working. Please help me learn how to add jquery to my site; it's very frustrating. I know the code that has to be at the top which is below. What is the code for JSQuery and where does it go on the HTML document? </p> <pre><code> &lt;script src="jquery-1.7.2.min.js" type="text/javascrpt"&gt;&lt;/script&gt; </code></pre>
jquery
[5]
3,241,777
3,241,778
Android Status Bar Notification not working when application exits
<p>I am setting up multiple notifications in my application when my application starts and each with unique ID but I get notifications only when my application is ON as soon as I exit from my application, I dont get notifications. What can be the possible problem ?</p>
android
[4]
2,191,519
2,191,520
How to store data in php file itself?
<p>I am making a system which would ask user for mysql details. I want those details to be written in a settings.php file.</p> <p>Settings file contains the following data:</p> <pre><code>$host = ""; $database = ""; $user = ""; $password = ""; $localelang = ""; </code></pre>
php
[2]
4,042,705
4,042,706
PHP Dates in local time
<p>I have a hosting account on a USA based server. I want to produce an output file with a date/time that is local for me ( in England, UK).</p> <p>How do I convert the date/time to my local time, and cater for day light saving when appropriate.</p> <p>thanks</p>
php
[2]
482,425
482,426
issue with a android linear layout
<p>i have a problem with the linear layout of android.</p> <p>i have something like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/myimg" android:contentDescription="@string/desc" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/a" /&gt; &lt;EditText android:id="@+id/editText1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="number" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>the problem is, that on some bigger devices everything is good. but on smaler devices i just see the image and the textview and edittext is not visible. and its not possible to scroll down.</p> <p>how to avoid this?</p>
android
[4]
3,653,204
3,653,205
Rendering dynamic text on camera image
<p>I want to display the 4 text views on 4 corners of the camera. This text is to be retrieved from a database i.e the the input for the text view is to be given dynamically. Can any one please help me with how to go about doing that?</p>
android
[4]
3,016,187
3,016,188
break the foreach loop without completion
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/456276/exiting-foreach-loop-in-c-sharp">Exiting Foreach loop in C#</a> </p> </blockquote> <p>I need to compare two registry key i.e HKEY_USER and HKEY_CURRENT_USER.</p> <pre><code>I am using two methods..both are having foreach loops.. </code></pre> <p>The first method calls another method which also having foreach loop. After performing required operation the condition should go to the first loop which is in the first method and also where the condition goes to the next loop..</p> <p>Simply, breaking the inner loop and maintaining the outer loop.</p> <p>I want to break the inner loop after executing the specific method..</p> <pre><code> string[] mainkeys1 = mckey.GetSubKeyNames(); foreach (string skey1 in mainkeys1) { ckey = skey1; mckey = l1.OpenSubKey(_ckey); int mcnt2 = mckey.SubKeyCount; if (mcnt2 &gt; 0) { Getvaluescur(); RegistryKey l2 = mckey; string[] mainkeys2 = mckey.GetSubKeyNames(); foreach (string skey2 in mainkeys2) { ckey = skey2; mckey = l2.OpenSubKey(_ckey); int mcnt3 = _mckey.SubKeyCount; if (mcnt3 &gt; 0) .... .... </code></pre> <p>The above code is also inside the Foreach loop.. I want to break the loop after executing the required methods..</p> <p>Can anyone guide me to break the Foreach loop without completion..</p> <p>Thank you..</p>
c#
[0]
4,416,937
4,416,938
display_errors in ini_set doesn't work
<p>I have a problem with ini_set('display_errors', 'off').</p> <p>To quickly give you a run-through I have two files in the same folder:</p> <p>1) "php.ini", where "display_errors = on" is set. 2) "iniTest.php" which has the following code:</p> <pre><code>ini_set('display_errors', 'off'); $conn = mysql_connect('localhost','excamplehidden','examplehidden') or trigger_error("SQL", E_USER_ERROR); $db = mysql_select_db('examplehidden',$conn) or trigger_error("SQL", E_USER_ERROR); mysql_query("SELECT * FROM `FakeTable`") OR die(mysql_error()); ini_set('display_errors', 'on'); </code></pre> <p>When I run this page in a browser I still get:</p> <p>"Table 'examplehidden.FakeTable' doesn't exist"</p> <p>Where I expect to get nothing because I want to hide errors.</p> <p>What am I doing wrong?</p>
php
[2]
4,770,883
4,770,884
javascript-multiple-input-textbox-validation
<p>I have <code>n</code> number of textboxes on a form. After the user enters a value in a textbox, I need to check that it's not a duplicate of any of the other textboxes. For example:</p> <pre><code>Textbox[0] : 1 Textbox[1] : 2 Textbox[2] : 3 Textbox[4] : 1 </code></pre> <p>It should alert saying that '1' has been entered twice.</p> <p>I tried the following:</p> <pre><code>function findDuplicates ( obj ) { var inputs = document.getElementsByName('analog_idorder[]'); var answers= new Array(); for(var ii = 0; ii &lt; inputs.length; ii++) { if(inputs[ii].type == 'text') { for(var jj = 0; jj &lt; answers.length; jj++) { if(answers[jj] == inputs[ii].value) alert('Duplicate Id_order number'); return false; } answers.push(inputs[ii].value); } } return true; } </code></pre> <p>But only the first two textboxes validate.</p> <p>Let me know how I can solve this problem.</p>
javascript
[3]
1,837,476
1,837,477
Convert array to have specific keys which have prefix "suf_"
<p>I have an associative array. In this array some keys have prefix "suf_". how I create a new array with these suffixed key and value? see the example below</p> <pre><code>Array ( [buildings_sum] =&gt; [accidental_damage] =&gt; 0 [landslip_cover] =&gt; 0 [loss_of_rent] =&gt; [loss_period] =&gt; [contents_sum] =&gt; [suf_household_contents_sum] =&gt; [damage_cover] =&gt; 0 [suf_tobacco_stock_sum] =&gt; [stock_sum] =&gt; [suf_buisness_interruption] =&gt; gb [suf_buisness_interruption_indemnity] =&gt; 24 Months [suf_increased_cost] =&gt; vb [suf_increased_cost_indemnity] =&gt; 24 Months [employer_liability] =&gt; 0 [liability_sum] =&gt; 2000000 [property_owner_liability] =&gt; 1000000 [goods_sum] =&gt; hvb [freezer_stock] =&gt; bv [money_night_safe] =&gt; vb [money_locked_safe] =&gt; bv [money_not_locked_safe] =&gt; cv [private_dwelling_money] =&gt; fcv [suf_change_machine_money] =&gt; cfv [suf_gaming_machine_money] =&gt; 0 [personal_accident] =&gt; cfv [glass] =&gt; cv [book_debts] =&gt; cv [suf_cover_guest] =&gt; 0 [terrorism_cover] =&gt; 0 [legal_expenses_cover] =&gt; 0 [loss_of_licence] =&gt; 0 [risks_cover] =&gt; 0 [voluntary_excess] =&gt; 250 [compulsory_excess] =&gt; h ) </code></pre>
php
[2]
921,608
921,609
send broadcast from Service to Activity?
<p>I'm having a problem with sending a broadcast from a Service to an activity.</p> <p>This is what I have in my Service class:</p> <pre><code>Intent intent = new Intent(); intent.setAction(BROADCAST_ACTION); sendBroadcast(intent); </code></pre> <p>I have many Activities and in one of my activities I have this:</p> <pre><code> class MyBroadcast extends BroadcastReceiver { @Override public void onReceive(Context ctxt, Intent i) { System.out.println("received"); } }; </code></pre> <p>The problem I have is that my broadcast receiver doesn't receive anything!!</p> <p>Help!</p> <p>EDIT: </p> <p>If I have many activities how can send a broadcast message to all of them. In other words can I apply the same broadcast receiver to all the activities !?</p>
android
[4]
5,622,457
5,622,458
How do I get information from a List Item onClick?
<p>I am using a listView that is being populated from a database. I know that I can use the onClick listener to get the position. But once I have the position how do I get further information? For instance, if there is a name textView in the list item, how do I get that?</p> <p> </p> <pre><code> &lt;LinearLayout android:layout_alignParentTop="true" android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content"&gt; &lt;TextView android:id="@+id/textName" android:layout_weight=".65" android:layout_height="wrap_content" android:textStyle="bold" android:textSize="16sp" android:text="Item Label" android:layout_width="0sp" android:textColor="#FFFFFF" android:layout_marginLeft="10px"&gt;&lt;/TextView&gt; &lt;TextView android:layout_height="wrap_content" android:id="@+id/textTime" android:layout_width="0sp" android:layout_weight=".35" android:text="Time" android:layout_gravity="right" android:gravity="right" android:textSize="12sp" android:textColor="#FFFFFF" android:layout_marginRight="10px"&gt;&lt;/TextView&gt; &lt;/LinearLayout&gt; &lt;TextView android:layout_width="wrap_content" android:id="@+id/textAddress" android:text="address" android:layout_height="wrap_content" android:layout_marginLeft="30sp" android:layout_below="@+id/linearLayout1" android:layout_alignLeft="@+id/linearLayout1" android:textColor="#FFFFFF"&gt;&lt;/TextView&gt; &lt;TextView android:layout_width="wrap_content" android:layout_toRightOf="@+id/textAddress" android:text="" android:layout_height="wrap_content" android:layout_alignTop="@+id/textAddress" android:layout_alignBottom="@+id/textAddress" android:id="@+id/textCross" android:textColor="#FFFFFF"&gt;&lt;/TextView&gt; &lt;/RelativeLayout&gt; </code></pre> <p></p>
android
[4]
5,370,171
5,370,172
Can ByteBuffers be used as 'long living' static objects?
<p>I need to store certain ByteBuffer objects as static fields in my classes. Are there any concerns about storing them as long living objects or should I create them on demand? I frequently need access to those objects.</p>
java
[1]
3,625,526
3,625,527
Click Event not working in windows mobile 6.0 application
<p>I am currently doing a project on windows mobile application 6.0 all the application was working fill till i add a .dll file now it shows the error as shown below <img src="http://i.stack.imgur.com/izy4x.png" alt="enter image description here"></p> <p>The events are not working after adding that dll</p>
c#
[0]
3,263,241
3,263,242
store comparators objects in array
<p>I have defined 4 comparators for my object like this:</p> <pre><code>public static Comparator&lt;mObject&gt; comp0 = new Comparator&lt;mObject&gt;() { @Override public int compare(mObject l, mObject r) { ...compare } }; public static Comparator&lt;mObject&gt; comp1 = new Comparator&lt;mObject&gt;() { @Override public int compare(mObject l, mObject r) { ...compare } }; public static Comparator&lt;mObject&gt; comp2 = new Comparator&lt;mObject&gt;() { @Override public int compare(mObject l, mObject r) { ...compare } }; public static Comparator&lt;mObject&gt; comp4 = new Comparator&lt;mObject&gt;() { @Override public int compare(mObject l, mObject r) { ...compare } }; </code></pre> <p>Now i want to create an array with the 4 comparators ,like this :</p> <pre><code>public final static Comparator&lt;mObject&gt;[] Object_comparators = { comp0, comp1, comp2, comp3}; </code></pre> <p>but Eclipse underlines everything between {..} like it is an error .Why is it ,and how could i fix it ?</p>
java
[1]
4,408,839
4,408,840
How to handle high website traffic in PHP
<p>I have a website, and the server is always down. When many people access the website, the server becomes very very slow. I am using PHP. Any suggestion for this?</p> <p>Thank you a lot.</p>
php
[2]
299,426
299,427
Load new events in android calendar
<p>I do not speak very good English but I try to explain my problem. I am creating an application based on a Timetable for my school and I have created my own calendar. My aplication is conected to XML service. Is there any event that when changed from week or month I load events that week or month?</p> <p>Thanks.</p>
android
[4]
3,809,583
3,809,584
Add an asterisk after text embedded in <p> via using jquery
<pre><code>&lt;p id="p1"&gt; Please select one option. &lt;/p&gt; </code></pre> <p>I wanna add an asterisk right after '<strong>Please select on option</strong>'. i.e. <strong>Please select one option.*</strong></p> <p>I tried: <code>$('#p1').html($(this).append('&lt;span&gt;*&lt;/span&gt;'));</code> Nothing happened.</p> <p>I tried: <code>$('#p1').after('&lt;span&gt;*&lt;/span&gt;')</code> The asterisk is on the line below <p> Any idea?</p>
jquery
[5]
3,013,374
3,013,375
when want to edit data see last value (no value that i enter now)
<p>I fill textboxes with data that i get from database and put a button on page that user can edit data and click on this button then from code behind i set changes to database</p> <p>but when i want to send data (for example <code>txtName.Text</code> that source value is "John" and i change it to "Tom") to database i see <code>txtName.Text</code> is "John" (means last value no new value)</p> <p>why?</p> <pre><code>//Load Data protected void Page_Load(object sender, EventArgs e) { DataSet ds = .... txtName.Text = ds.Tables[0].Rows[0][1].ToString(); } //Update protected void reg_Click(object sender, EventArgs e) { string name=txtName.Text; //i change value of txtName.Text but see value as same as value in ds.Tables[0].Rows[0][1].ToString() that i select from DB } </code></pre>
asp.net
[9]
253,106
253,107
How can changes to Java Control Panel settings be saved?
<p>I've just downloaded the latest JRE on a computer running a clean install of Windows 7. Now I want to do three things:</p> <ol> <li>disable automatic updating</li> <li>remove the icon from the system tray</li> <li>reduce the amount of space Java uses for temporary files</li> </ol> <p>I was able to do 2 and 3 by going to the Java Control Panel (systray icon > properties, or Control Panel > Java), unchecking the box/changing the number, and selecting "Apply" and "OK." However, I cannot do 1.</p> <p>My steps so far: go to the Update tab, deselect "Check for Updates Automatically," click "Never Check" instead of "Check Monthly" and see the "Advanced" button get grayed out. Click "Apply" and "OK" and restart. After the machine reboots, open the Java Control Panel... and "Check for Updates Automatically" is enabled again.</p> <p>A few years ago I had the same problem with a much earlier version of Java. It eventually resolved itself, I assume because it was fixed in a later release. Am I stuck waiting for a fix again, or is there something I can do?</p> <p>I don't really see my other software interfering, but for completeness, here's everything else I've installed so far:</p> <ul> <li>ThinkVantage Toolbox (I'm using a ThinkPad)</li> <li>Symantec Endpoint Protection</li> <li>Firefox 3.6</li> <li>IE 9 beta</li> <li>VLC player</li> <li>Pidgin</li> </ul>
java
[1]
5,552,720
5,552,721
How can i read MS-Word bookmark from java
<p>How can i read <strong>bookmark of MS-Word</strong> from <strong>Java</strong> application?</p>
java
[1]
4,464,038
4,464,039
How to add floating images on the camera's preview in android app
<p>I want to develop an android app,and it provides a camera preview,I want to add some floating images on that preview,they can randomly float on the screen.I have no idea how to implement it.please help...</p>
android
[4]
30,797
30,798
Append is null error?
<p><strong>edit</strong>: I don't get any errors anymore, but executing this code:</p> <pre><code>$("#button-container").append(".tbox"); </code></pre> <p>only places ".tbox" text next to the button that is created when you open the modal. It doesn't get appended to the modal.</p> <p><a href="http://nightlifebratislava.com/demos" rel="nofollow">Here is the demo page</a></p> <p>Clicking the "open modal" link, a button is created. I tried to append that to the modal with no luck. Any idea why?</p>
jquery
[5]
2,992,965
2,992,966
Frost Bite 2 example wanted
<p>I want to make my own Battlefield game, but I can not find any full sourcecodes on Battlefield 3. Can anyone tell me where to find it. I have been looking all over the web to find it.</p>
java
[1]
5,293,077
5,293,078
ASP.NET- Instantiate a Web User Control in App_Code class
<p>Files:</p> <p>Website\Controls\map.ascx</p> <p>Website\App_Code\map.cs</p> <p>I'd like to create a strongly typed instance of map.ascx in map.cs</p> <p>Normally, in an aspx, you would add a &lt;%Register... tag to be able to instantiate in codebehind. Is this possible in an app_code class? I'm using .NET 3.5/Visual Studio 2008</p> <p>Thanks!</p>
asp.net
[9]
4,677,859
4,677,860
How do I add leading zeroes to String.Format parameters?
<p>I have the following code:</p> <pre class="lang-cs prettyprint-override"><code>string textTransDate = String.Format("{0}-{1}-{2} {3}:{4}", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute); </code></pre> <p>I want to add leading zeroes to the month and day parameters if they are less than 10, how would I accomplish this?</p>
c#
[0]
4,589,408
4,589,409
Making/Allowing single execution of method, in Java
<p>I have a class with two methods load() and getValue(). The load function loads a set of key value pairs from a file onto a hashMap and the getValue(Object key) method is used to extract values for keys passed to it. </p> <p>My problem is that I want to create an Object of the class such that load() should be executed only once (to load values into memory) and thereafter the getValue() method should be able to work on this data, each time its called. </p> <p>What is the best approach to solve this problem? I am quite new to Java and OOP, so please feel free to modify either the question or the title to make it more clear. </p>
java
[1]
5,457,223
5,457,224
java program to retreive page source from google search automatically
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2085454/search-word-in-google-and-want-to-find-hits-of-each-word-using-java-program">search word in google and want to find hits of each word using java program</a> </p> </blockquote> <p>hi friends, I want to write java program to retrieve page source from google search automatically. Its very urgent.Give any suggestions. </p>
java
[1]
3,506,536
3,506,537
Safe decoding in python ('?' symbol instead of exception)
<p>I have code:</p> <pre><code>encoding = guess_encoding() text = unicode(text, encoding) </code></pre> <p>when wrong symbol appears in text UnicodeDecode exception is raised. How can I silently skip exception replacing wrong symbol with '?' ?</p>
python
[7]
2,553,539
2,553,540
iPhone-SDK:Questions about iPhone RingTone and Video access:
<p>I have two questions here. 1.) Is it possible to access ring tones/put our custom ring tones programmatically using our client app in iPhone? Does the latest SDK support?</p> <p>2.) A client iPhone app - Is it possible to download a Video file from server and put into iPhone device any of the folder (or) Video folder?</p> <p>Please reply if you know the details...</p> <p>Clave/</p>
iphone
[8]
2,529,070
2,529,071
Listen to certain events ( object listener )
<p>Let's say I have a simple code wich increments variable "counter" by 1, every 5 seconds. I would like to stop timer , when "counter" reaches 5. I would like to use <strong>object listener</strong> for this ( listens to certain events ). Is this possible? </p> <pre><code>public class CallMe{ static int counter = 0; public static void main(String[] args) { // This code increments counter variable by 1, every 5 seconds. Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { counter++; System.out.println(counter); } }, 1000, 5000); } </code></pre> <p>}</p>
java
[1]
2,171,051
2,171,052
Creating a drawable rectangle in xml with one gradient on the top half and another on the bottom half
<p>I'm trying to create a drawable in xml, a rectangle with one gradient on the top half, and another on the bottom half. This is NOT the way to do it, apparently:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item&gt; &lt;shape android:shape="rectangle"&gt; &lt;gradient android:startColor="#5a5a5a88" android:endColor="#14141488" android:angle="270" android:centerX="0.25"/&gt; &lt;/shape&gt; &lt;/item&gt; &lt;item&gt; &lt;shape android:shape="rectangle" android:top="80px"&gt; &lt;gradient android:startColor="#5aff5a88" android:endColor="#14ff1488" android:angle="270" android:centerX="0.25"/&gt; &lt;/shape&gt; &lt;/item&gt; &lt;/layer-list&gt; </code></pre> <p>How can I do this, preferably in a way that makes it stretchable to any height?</p>
android
[4]
5,547,340
5,547,341
print statement in for loop only executes once
<p>I am teaching myself python. I was thinking of small programs, and came up with an idea to do a keno number generator. For any who don't know, you can pick 4-12 numbers, ranged 1-80, to match. So the first is part asks how many numbers, the second generates them. I came up with</p> <pre><code>x = raw_input('How many numbers do you want to play?') for i in x: random.randrange(1,81) print i </code></pre> <p>Which doesn't work, it prints x. So I am wondering the best way to do this. Make a random.randrange function? And how do i call it x times based on user input. </p> <p>As always, thank you in advance for the help</p>
python
[7]
945,540
945,541
Go back to the previous page twice on click
<p>I'm having this script </p> <pre><code>$('#verder').click(function(){ if(document.referrer.indexOf(window.location.hostname) != -1){ parent.history.back(); return false; } }); </code></pre> <p>so on click of #verder it will go back like you clicked ones on the back button of your browser.</p> <p>so now my problem i need to make it go back 2 times.</p> <p>how can i fix this?</p> <p>Thank you in advance! </p>
jquery
[5]
1,427,826
1,427,827
Encoding non-English characters
<p>I'm having a bit of trouble here and I was hoping someone throws me a hint :)</p> <p>I'm getting some GET VARS with JS but I have trouble with non-latin charsets: cyrillic for example. The cyrillic var appears correct in the url but when I retrieve it with JS I get some dummy string.</p> <p>I was wondering of a function similar to "unescape" for such a case.</p> <p>Alternatively, if someone knows a way I could convert a cyrillic string to the same dummy string I get from the URL, it will still do me the trick, since all I need is compare.</p> <p>:) Thanks! Martin</p>
javascript
[3]
805,463
805,464
Android ApiDemos TextAlign not aligning in test program outside of demo program
<p>I cut out the code for the <code>Graphics-&gt;Text Align</code> activity from the <code>ApiDemos</code> for Android, and pasted it into a new activity. When I run it on larger higher density screens (both on my physical phone, and on a 480x800 emulator), the text does not scale to fill the screen. </p> <p>I have put the code in <code>BeyondCompare</code> and cannot find anything significantly different between the 2 activities, yet when run outside of the <code>ApiDemos</code> program, it does not scale properly. When run from the <code>ApiDemos</code> program, it scales fine; I have even made the <code>TextAlign</code> activity the only one that runs from the <code>ApiDemos</code> and it still scales fine.</p> <p>I checked the manifests of both programs and there does not appear to be anything that would cause the canvas to stop scaling appropriately. The activity creates a <code>SimpleView</code> class when it starts, so it does not appear to be using XML for the layout.</p> <p>What am I missing? Please help!</p>
android
[4]
5,391,492
5,391,493
Android animating image pieces and device compatibility
<p>I am creating an application which on one view has an image of an elephant. this elephant needs to animate various parts of his body such as eyes, trunk, spraying water, and also the background/horizon movements. I have briefly tried positioning each element(eye, trunk, etc) in a <code>RelativeLayout</code> using margins and relative positions so that the picture looks correct.</p> <p>When i change the screen size via eclipse layout editor everything gets out of place. I read that using <code>RelativeLayout</code> with margins and relative positions will be the best alternative to <code>AbsoluteLayout</code>, but i can't seem to get each piece in the right spot while keeping some compatibility of devices.</p> <p><strong>What is the best way of positioning pieces of the image to complete a full image which will also allow me to animate/translate/rotate/etc each piece and support a large variety of devices?</strong></p> <p>I thought that maybe using OpenGL or Canvas might be the way this is done properly, but i don't see how these would resolve the problems i've mentioned.</p> <p>I have created the iOS version of this application and it was extremely easy to set this up. I don't quite understand how applications line up sprites to make a scene which is compatible among a large variety of screen sizes/densities.</p>
android
[4]
1,976,913
1,976,914
How to do my own custom list?
<p>How to do my own custom list? I mean, that each element of list will be looking like I want.</p>
android
[4]
3,671,172
3,671,173
How can I obtain the ID from the following example string?
<p>I use the following method to pad out a ID for a property on our website:</p> <pre><code>function generateAgentRef($id,$length=5,$strPrefix='1'){ return $strPrefix . str_pad($id,$length,0,0); } </code></pre> <p>Basically it will prefix 1 and then pad out the id with 0's until the string reaches $length.</p> <p>But, I now have a requirement to revert this process. For example if I have the following IDs: 100650,100359,100651,100622,100112,100687, how can I get the ID e.g. 650, 359, 651, 622, 112, 687?</p> <p>Hope this explains what I'm trying to achieve.</p> <p>The ID in the database will never start with 0, so I was thinking of iterating over the components of the string and detecting when I hit something other than 0 and then splitting the string.</p>
php
[2]
1,124,393
1,124,394
Accessing an item of an array with jquery?
<p>How would I access the div with a text node of 2?</p> <pre><code>&lt;script&gt; $(document).ready(function() { alert($('.content').length); $('.content').click(function(e) { // ... }) }); &lt;/script&gt; &lt;div class='content'&gt;1&lt;/div&gt; &lt;div class='content'&gt;2&lt;/div&gt; &lt;div class='content'&gt;3&lt;/div&gt; &lt;div class='content'&gt;4&lt;/div&gt; </code></pre>
jquery
[5]
3,415,062
3,415,063
Is it possible to work android 2.2 application on other android versions (1.5 to 2.1)?
<p>I developed one application based on android 2.2 version. Is it possible to work that application on other android versions (1.5 to 2.1)? </p>
android
[4]
4,238,477
4,238,478
how to receive data from several sockets in terms of multithreading?
<p>I want to rephrase my previous question <a href="http://stackoverflow.com/questions/9727521/should-i-replace-all-my-new-thread-with-task-factory-startnew">Should I replace all my &quot;new Thread&quot; with &quot;Task.Factory.StartNew&quot;?</a></p> <p>I need to listen for several udp sockets</p> <pre><code>................ s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); ........ public void Receive() { byte[] buffer = new byte[65536]; while (true) { try { count = s.Receive(buffer); } catch (Exception e) { Console.WriteLine(e.Message); return; } if (count &gt; 0) { OnNewDatagram(new NewDatagramEventArgs(buffer, count)); } } } </code></pre> <p>So I need to launch several "Receive()" methods (one for each socket). Now I'm using one Thread for one socket:</p> <pre><code>socketA = new... .... threadA = new Thread(Receive); ..... threadA.Start(); socketB = new... .... threadB = new Thread(Receive); ..... threadB.Start(); </code></pre> <p>What should I use:</p> <ul> <li>one thread for one socket</li> <li>one thread for all sockets(how?)</li> <li>one task for all sockets</li> <li>one task for one socket</li> <li>other?</li> </ul> <p><strong>upd</strong> I have only 2-3 sockets, so it's probably better to use one-socket-one-thread model instead of Socket.Select... or one-socket-one-task model?</p>
c#
[0]
3,078,100
3,078,101
How to remove everything within a DIV except for one element?
<p>I have the following HTML:</p> <pre><code>&lt;div class="item"&gt; &lt;img src="http://mintywhite.com/images/wg/0904/05rssfeedicons/rss-feed-icons11.jpg"/&gt; TEXT NODE &lt;span class="some_class"&gt;What the funk?&lt;/span&gt; &lt;form&gt;What the monkey&lt;/form&gt; &lt;/div&gt; </code></pre> <p>I want to remove everything within <code>div.item</code> except for the image. I tried using this bit of code, but the text node still remains within the <code>div</code>.</p> <pre><code>$('.item').contents().not('img').remove(); </code></pre> <p>Any suggestions?</p> <p>Here's my JSFiddle that you can fiddle with: <a href="http://jsfiddle.net/pSmDW/" rel="nofollow">http://jsfiddle.net/pSmDW/</a></p>
jquery
[5]
5,057,607
5,057,608
Problem with e.Graphics.DrawImage()
<p>This is my code and when I call this code from localhost, printer worked,but from anoder IP noting.I think DrawImage function not worked.Who can help me.I check the Bitmap object properly created and Image exist.</p> <pre><code>protected void printButton__Click(object sender, EventArgs e) { System.Drawing.Printing.PrintDocument document = new System.Drawing.Printing.PrintDocument(); document.PrintPage += new PrintPageEventHandler(document_PrintPage); document.Print(); } void document_PrintPage(object sender, PrintPageEventArgs e) { string s = Server.MapPath("Temp.jpg"); Bitmap objBmpImage = new Bitmap(s); e.Graphics.DrawImage( objBmpImage, 10, 10, 200, 100); } </code></pre>
c#
[0]
3,289,308
3,289,309
How can 2 local Java applications interact?
<p>Having 2 bare console Java applications running on the same machine at the same time I want to have, for example, something like a <code>friend.println(String s)</code> im my first app causing the second app to output <code>s</code> to its stdout (while there is to be silence in the first app stdout).</p> <p>How to implement this?</p>
java
[1]
4,201,339
4,201,340
How can I create a variable from another variable but without spaces in C#
<p>I have variables like this:</p> <pre><code>var a = "a variable"; var b = "test"; </code></pre> <p>Is there a simple function I could call on the variables that would remove the spaces?</p>
c#
[0]
769,684
769,685
I want to be clicking on the button automatically
<p>I want to be clicking on the button automatically</p> <p>But how?</p> <p>I tried this but did not succeed</p> <pre><code> &lt;html&gt; &lt;head&gt; &lt;script&gt; $(function(){ $("a").click(function(){ alert("hillo"); }); }); $("a").click(); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;a href="http://google.com"&gt;google&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>This well was used only but also did not succeed</p> <pre><code>$("a").click(); </code></pre>
jquery
[5]
347,312
347,313
what's the advantage to use "import static"?
<p>What's the good point to use "import static"?</p>
java
[1]