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,235,193 | 3,235,194 | Remove area code from Telephonenumber | <p>How to remove the coutrycode from telphonumber.</p>
<p>the number could come in this format.</p>
<pre><code>4770300000
004770300000
+4770300000
4670300000
</code></pre>
<p>I would like to remove countrycodes to be abile to match does number against.</p>
<pre><code>070300000
</code></pre>
| c# | [0] |
5,956,669 | 5,956,670 | How can i get CPU and Mainboard serial number with Qt/C++? | <p>I want to use CPU and Mainboard serial number for licensing. please help me how can i implement this operation in QT</p>
| c++ | [6] |
3,181,399 | 3,181,400 | java.sql.Date difference in months | <p>I have two java.sql.Date objects, and I need to calculate the number of months between the two. This should take into account percentage of months. For instance 10/1/2012 to 11/15/2012 should return 1.5 months. Is there an available library that can do this for me? Any recommendations?</p>
| java | [1] |
4,294,187 | 4,294,188 | PHP "You have () new comments on your clip", how? | <p>I want to do a function to my users, so on index.php there is e.g: </p>
<p>You have 2 new comments on your clip</p>
<p>How should i do this? I mean i want ideas to do this the easiest way. Table for the videos is member_videos, and tables for the comment is member_videocomments, a comment inside the table is connected by their "videoID", which is the id of the column in member_videos.</p>
<p>Should i do the classic, making a field, which all is 0, until it has been seen by the user its 1 or what should i do.</p>
| php | [2] |
1,571,599 | 1,571,600 | How to avoid the execution of an idempotent code? | <p>I have a class which has an init method which does initialization of the member variables.So I wanted the execution of that code to be run only once for any number execution of that class. So how to go about that?</p>
<p>please let me know if the question is not clear.</p>
<p>EDIT:</p>
<p>Actually I have some legacy code with thousands of classes having the big init methods. which does the initialization(with all static values) of the member variables. </p>
<p>And say suppose In a main method if I have a reference to any of these class. and I run the main method for 100 times then all 100 times it executes the same method which is a performance hit. So i thought of having the member variables as static and do the initialization only once for any number of execution. but I thought it will lead to a OutOfMemory as all the objects for those thousands of classes will remain in jvm till it dies.</p>
<p>Hope it is clear now.</p>
<p>Thanks.</p>
| java | [1] |
5,941,301 | 5,941,302 | pass fpassthru contents to variable | <p>here's a portion of my code (taken from google charts example here <a href="http://code.google.com/apis/chart/image/docs/post_requests.html" rel="nofollow">http://code.google.com/apis/chart/image/docs/post_requests.html</a>) that will display an image chart:</p>
<pre><code> $context = stream_context_create(
array('http' => array(
'method' => 'POST',
'content' => http_build_query($chart))));
fpassthru(fopen($url, 'r', false, $context));
</code></pre>
<p>The problem is instead of displaying the image directly, I'd like to pass the contents of fpassthru (which essentially is the image) to a variable.. perhaps something like</p>
<pre><code>$image = fpassthru(fopen($url, 'r', false, $context));
</code></pre>
<p>any idea? thanks</p>
| php | [2] |
5,780,860 | 5,780,861 | `sys.dont_write_bytecode` is True, but .pyc files are still generated | <p>I'm setting the <strong><em>PYHTONDONTWRITEBYTECODE</em></strong> environment variable to avoid .pyc files, and I have checked that <code>sys.dont_write_bytecode</code> is True.</p>
<p>But .pyc files are still generated everywhere.</p>
<p>PS: I'm using Python 2.6.6</p>
<p><strong>The reason is that my script is running under <code>env -i</code>.</strong></p>
| python | [7] |
2,500,813 | 2,500,814 | filter number from Phone book by replacing all special characters in Android? | <p>I am working with the contacts fetched from my default Phone book in Android. When I fetch contacts from phone book, sometime I am getting "-", "(" etc characters. </p>
<p>If the characters are known then I can easily remove them with <strong>relpace()</strong> method but my client complaint that some times they got to see % like symbols too in the number fetch from phone book.</p>
<p>Please suggest me, how can I filter the numbers fetch from Phone book, so that I can have <strong>only and only digits</strong> in my text field and no else characters.</p>
<p>Currently I am using <code>string.replace("-","");</code> for removing '-' from the contact number.</p>
| android | [4] |
3,720,405 | 3,720,406 | How to fix: unrecognized selector sent to instance | <p>I am having a problem that may be simple to fix, but not simple for me to debug. I simple have a button inside a view in IB; the file's owner is set to the view controller class I am using and when making the connections, everything seems fine, ie. the connector is finding the method I am trying to call etc.</p>
<p>however, I am receiving this error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIApplication getStarted:]: unrecognized selector sent to instance 0x3d19130'</p>
<p>My code is as follows:</p>
<p>RootViewController.h</p>
<pre><code>@interface RootViewController : UIViewController {
IBOutlet UIButton* getStartedButton;
}
@property (nonatomic, retain) UIButton* getStartedButton;
- (IBAction) getStarted: (id)sender;
@end
</code></pre>
<p>RootViewController.m</p>
<pre><code>#import "RootViewController.h"
#import "SimpleDrillDownAppDelegate.h"
@implementation RootViewController
@synthesize getStartedButton;
- (void)viewDidLoad {
[super viewDidLoad];
}
- (IBAction) getStarted: (id)sender {
NSLog(@"Button Tapped!");
//[self.view removeFromSuperview];
}
- (void)dealloc {
[getStartedButton release];
[super dealloc];
}
@end
</code></pre>
<p>Seems simple enough...any thoughs?</p>
| iphone | [8] |
2,698,317 | 2,698,318 | How to handle AVAudioplayer resume playback after interruption ends | <p>When incoming phone call ends i want AVAudioplayer to resume playback</p>
<p>I delegated AVAudioPlayerDelegate in h file</p>
<p>and used </p>
<pre><code>-(void)audioPlayerEndInterruption:(AVAudioPlayer *)audioPlayer
{
[self.audioPlayer play];
}
</code></pre>
<p>but when phone ends or gets declined it should resume avaudioplayer but it is not. Can anyone please tell if i m doing something wrong over here.</p>
<p>Appreciate help.</p>
| iphone | [8] |
3,605,943 | 3,605,944 | PHP dynamic dropdown menu list - default value | <p>I'm trying to create a default value for my dynamic drop down list. After the user selects one of the options, they submit and that value is stored as a variable in the next page that I can access using $_POST['land']</p>
<p>I have created the same dynamic list in the next page and want that 'land' to appear first in the dynamic drop down menu. So far this is just the main code to show the dynamic drop down list. Any help would be appreciated. Thanks!</p>
<pre><code> while($row = mysqli_fetch_assoc($result))
{
extract ($row);
echo "<option value='$place'>$place</option>\n";
}
</code></pre>
| php | [2] |
2,093,701 | 2,093,702 | How do I count the number of occurrences of a list of items in another .txt file? | <p>I have a list of words and I want to find how many times they occur in a .txt file. The word list is something like as follows:</p>
<pre><code>wordlist = ['cup', 'bike', 'run']
</code></pre>
<p>I want to be able to not only pick up these words, but also things like CUP, biker, running, Cups, etc. So I think I need a regular expression. Here is what I was thinking but it doesn't work:</p>
<pre><code>len(re.findall(wordlist, filename, re.I))
</code></pre>
<p>Thanks in advance!</p>
| python | [7] |
5,341,913 | 5,341,914 | In JS, how can I use a string to define a JS object parameter? | <p>I have a function defined that way:</p>
<pre><code>var myObject = new Object();
function myFunction(someString){
myObject.someString= 0;
}
</code></pre>
<p>The problem is <code>someString</code> is taken as the string <code>someString</code> instead of the value of that variable.</p>
<p>So, after I use that function several times over with different <code>someString</code>'s, I would like to get an object with all the values for each someString.</p>
<p>But when I loop through that object
The only result I get is <code>someString : 0</code></p>
<p>I want to get:</p>
<pre><code>John : 0
James : 0
Alex : 0 etc....
</code></pre>
<p>How do I do that? Thanks a lot in advance</p>
| javascript | [3] |
4,146,564 | 4,146,565 | Undefined symbols for architecture i386 while i m running? | <p>Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MFDocumentManager", referenced from:
objc-class-ref in SearchTextInPdfViewController.o
objc-class-ref in BasicLauncherController.o
"_OBJC_METACLASS_$_MFDocumentViewController", referenced from:
_OBJC_METACLASS_$_DocumentViewController in DocumentViewController.o
"_OBJC_CLASS_$_MFDocumentViewController", referenced from:
_OBJC_CLASS_$_DocumentViewController in DocumentViewController.o
"_initProfile", referenced from:
-[SearchManager startSearchOperationForSearchTerm:andPage:] in SearchManager.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status</p>
| iphone | [8] |
1,818,782 | 1,818,783 | Configure an Android application using property file | <p>I have an Android application that I need to install on diffferent devices with different configurations. I kept it in the <code>res/raw</code> folder, with data stored in <code>key=value</code> format. Can I access the value by passing the key? Can I change the <code>.properties</code> file from outside the application? Any suggestions?</p>
| android | [4] |
5,002,856 | 5,002,857 | Zooming in UIScrollView is not smooth | <p>I created a minesweeper clone game in iphone. My implementaion of the cells in the grid is this, I created a UIView and added buttons in the UIView and then I added the UIView in a UIScrollView, but every time I zoom out or zoom in using zoomToRect method of UIScrollView the zooming is not smooth and the zoom out was distorted. How can implement smooth zooming in UIScrollView?</p>
| iphone | [8] |
446,740 | 446,741 | Multiple Crawling using Scrapy | <p>How can i use Scrapy for crawling multiple URL.</p>
| python | [7] |
3,651,040 | 3,651,041 | Why doesn't C# allow implicit reference conversions from an interface-type to class-type? | <p>Given:</p>
<pre><code>public class T
{
public static implicit operator T(R r)
{
return new T();
}
}
public class S: R { }
public class R { }
</code></pre>
<p>If R were an interface, the code would not compile:</p>
<blockquote>
<p>user-defined conversions to or from an interface are not allowed</p>
</blockquote>
<p>Interfaces are essentially public/internal classes with all public members and no implementation. So what is the purpose of having this restriction?</p>
| c# | [0] |
4,375,994 | 4,375,995 | Notification.Builder and FLAG_INSISTENT | <p>I like the ease of use of <code>Notification.Builder</code> but it seems not support the insistent mode of notifications.</p>
<p>Is there a way to set the flag <code>FLAG_INSISTENT</code> from the <code>Notification.Builder</code>?</p>
| android | [4] |
1,874,039 | 1,874,040 | How to send picture, video file as as multi part form data to server using post method? | <p>I need to send the picture , video file to server as a multi part form data using post method.
How to achieve this.
Thanks in advance.</p>
| android | [4] |
5,758,360 | 5,758,361 | how a function not being static can be used in main which is static | <p>According to my knowledge, we can only use static data in a static function.</p>
<p>But, our <code>main()</code> function is static - i.e. <code>Public static void main</code>. How can we use other functions of some xyz class which is not static in our main function which is static?</p>
| c# | [0] |
4,413,334 | 4,413,335 | Add hidden div (including it's content) into the DOM | <p>I have a hidden div that I want to add (append) into another position in the DOM. The code have I have is not working as expected;</p>
<pre><code>$('[class*="time-span"]').on('click', function() {
var modelPanel = $('.model-detail-panel');
modelPanel.contents().wrap('<div class="model-detail-panel" id="model-detail">').insertAfter('.timeline');
modelPanel.slideToggle('fast', function() {
$('html,body').animate({
scrollTop: $(this).offset().top
}, 500);
});
});
</code></pre>
<p>The content of the div 'model-detail-panel' is being inserted into the right location, but the actual surrounding div is not getting inserted. Why would this be and are the methods I've used the most appropriate ones to achieve this?</p>
<p>Thanks in advance...</p>
| jquery | [5] |
1,201,670 | 1,201,671 | Creating XLS file (Greek Characters) | <p>I want to create a an XLS file with some info from the database and the data i want to retrieve from the database are all Greek characters.I have this code and when i execute the code i got only some symbols.Anyone knows what i have to change to get Greek characters properly?
Edit: The problem is both with the data that i retrieve from the Mysql Database and the headings
Here is the code</p>
<pre><code>$sql = "SELECT tmima,sex,surname,address,postcode,phone1,phone2 FROM student"; //the query
$result = $db->prepare($sql);
$result->execute();
$column = $result->columnCount();
$header = "";
$head = array("Τμήμα","Φ","Επίθετο","Όνομα","Μητρώο"); //headings of the XLS
for($i = 0; $i < $column;$i++ ){
$header .= $head[$i]."\t";
}
$data = "";
while($row = $result->fetch(PDO::FETCH_ASSOC)/*mysql_fetch_row($rec)*/){
$line = '';
foreach($row as $value){
if((!isset($value)) || ($value == " ")){
$value = "\t";
}else{
$value = str_replace( '"' , '""' , $value );
$value = '"' . $value . '"' . "\t";
}//end of if-else
$line .= $value;
}//end of foreach
$data .= trim( $line ) . "\n";
}//end of while($row = mysql_fetch_row($rec))
$data = str_replace("\r" , "" , $data);
if ($data == ""){
$data = "\n No Record Found!\n";
}
header('Content-Description: File Transfer');
header('Content-Type: application/ms-excel; charset=utf8');
header("Content-Disposition: attachment; filename=Student_data.xls");
//header("Content-Transfer-Encoding: binary ");
header("Expires: 0");
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header("Pragma: public");
print "$header\n$data";
</code></pre>
| php | [2] |
956,215 | 956,216 | Two pipe symbols (OR) in this Javascript line | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2851404/what-does-options-options-mean-in-javascript">What does “options = options || {}” mean in Javascript?</a> </p>
</blockquote>
<p>I have seen this in JS:</p>
<pre><code>item = item || {};
</code></pre>
<p>I'm guessing it's some variation of a ternary operator but what does is actually do?</p>
| javascript | [3] |
1,185,777 | 1,185,778 | filter out dates that have already passed | <p>Need some help here. I am nearly done, but stuck on how to filter out dates in the past. For example, I dont want dates from yesterday to appear as an otpion. Below is my code so far.</p>
<pre><code> <select name="choose_date" id="choose_date">
<?php
if (isset($datesavailable) && is_array($datesavailable))
{
foreach($datesavailable as $val)
{
rsort($val);
echo' <option value="'.$val.'">'.$val.'</option>\n';
}
}
?>
</select>
</code></pre>
<p>Thanks for your time in advance. </p>
| php | [2] |
3,614,628 | 3,614,629 | Least Common Multiple of given numbers | <blockquote>
<p><strong>Possible Duplicates:</strong><br>
<a href="http://stackoverflow.com/questions/3154454/what-is-the-most-efficient-way-to-calculate-the-least-common-multiple-of-two-inte">what is the most efficient way to calculate the least common multiple of two integers</a><br>
<a href="http://stackoverflow.com/questions/147515/least-common-multiple-for-3-or-more-numbers">Least common multiple for 3 or more numbers</a> </p>
</blockquote>
<p>Whats the simple logic for calculating LCM of given numbers?</p>
| c++ | [6] |
1,709,922 | 1,709,923 | how can i get chinese word using google api with JSON | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6177615/how-can-i-get-chinese-romanization-from-google-api-with-json">how can I Get Chinese Romanization from google API with JSON</a> </p>
</blockquote>
<p>hay everyone.I'm translating English to Chinese using Google translate api with JSON.its work fine. but I also want to get one more word something like phonetic word.</p>
<p>ex. when I translate God to Chinese it gives chinese word as well as shan word beneath phonetic word. can anyone pls help me how can i get this word. </p>
<p>I'm using below link</p>
<p><a href="http://ajax.googleapis.com/ajax/services/language/translate?q=god&v=2.0&langpair=en|zh" rel="nofollow">http://ajax.googleapis.com/ajax/services/language/translate?q=god&v=2.0&langpair=en|zh</a></p>
| iphone | [8] |
2,347,481 | 2,347,482 | How to compare zero integer with value | <p>In database, Student_id is containing 0 value. I want to check it in if condition, but required result is not achieved. I have tried following scenarios in if condition:</p>
<pre><code>if(is_null($item['student_id'])) {}
if($item['student_id'] === 0){}
if($item['student_id'] == 0){}
if(intval($item['student_id']) == 0){}
if(strval("$item['student_id']") == "0"){}
</code></pre>
<p><strong>Note:</strong> Currently Iam trying to print some message in if conditions. But on student_id = 0, nothing is printed. If student_id is other than 0, then print is working fine.</p>
<p>Can some one guide me what Iam doing wrong and how it can be rectified.</p>
<p>I have added var_dump</p>
<pre><code> array
'_id' =>
object(MongoId)[2]
public '$id' => string '50906d7fa3c412bb040eb577' (length=24)
'student_id' => int 0
'type' => string 'exam' (length=4)
'score' => float 54.653543636265
array
'_id' =>
object(MongoId)[6]
public '$id' => string '50906d7fa3c412bb040eb578' (length=24)
'student_id' => int 0
'type' => string 'quiz' (length=4)
'score' => float 31.950044967421
array
'_id' =>
object(MongoId)[2]
public '$id' => string '50906d7fa3c412bb040eb579' (length=24)
'student_id' => int 0
'type' => string 'homework' (length=8)
'score' => float 14.850457681164
</code></pre>
| php | [2] |
3,972,343 | 3,972,344 | Declaring byte array for getting bytes from a file | <p>Basically I'm reading all the bytes from a file into a byte array using stream reader.</p>
<p>The array I have declared looks like this : <code>byte[] array = new byte[256];</code></p>
<p>The size of the array 256 can read the whole bytes from the file? Saying that a file has 500 bytes instead of 256?</p>
<p>Or the each element from the array has the size 256 bytes?</p>
| c# | [0] |
662,368 | 662,369 | Changing the user language in an asp.net application based on user choice | <p>I have web application which supports globalization. So i need to provide user a choice to select a language one he/she logs in. Now the problem is where do i have to make changes to set the user's preferred language.</p>
| c# | [0] |
4,023,311 | 4,023,312 | how to use append function for 2D list in python | <p>Need Help As soon as possible .</p>
<p>Thank you in advance</p>
| python | [7] |
5,164,603 | 5,164,604 | Why can't I reference a class in another namespace in another project within the same solution? | <p>I have created another namespace in another project but within the same solution. When I type using this other namespace it shows up. But I cannot see any public class within that namespace. What's wrong ?</p>
| c# | [0] |
2,531,734 | 2,531,735 | Android View Flipper Custom Drawing | <p>I have a few doubts about view flipper</p>
<p>I am using viewflipper to go to another view using scroll_left
animation.</p>
<p>i have kept 2 linearlayouts inside the ViewFlipper</p>
<p>now i want 4 views....</p>
<p>like 1st view contains 3 btns.</p>
<p>1st btn click -> 2nd view scrolls in -> back pressed 1st view scrolls
back
2nd btn click -> 3rd view scrolls in -> back pressed 1st view scrolls
back
3rd btn click -> 4th view scrolls in -> back pressed 1st view scrolls
back</p>
<p>so, how am i going to arrange 4 linearlayouts to work in flipNext ....</p>
<p>now ideally 2, 3, 4 views are in only second level of navigation. I
want to draw a line, point or rectangle when 2, 3, 4 views come up,
but they all are different shapes. So what would be the method to draw
that ? </p>
| android | [4] |
5,145,047 | 5,145,048 | DataGridView Binding from Multiple columns | <p>I have a confusion.. The confusion is this that i am having a datagridview on my windows form. I want to ask that, can a datagridview can be bind from multiple tables having same column Names? </p>
<p>One table has columns Quantity, Particular and Rate
Other table has also the same column Names as above.
Can these two tables can be bind to a single datagridview?
My question is that is this possible? </p>
| c# | [0] |
1,596,522 | 1,596,523 | C# User Input into a 2 Dimensional Array | <p>I'm completely new to C# and well I would like simple code to create a matrix from user input</p>
<p>E.G.</p>
<pre><code> int [,] matrix1 = new int [2,2]
// now using input i'd like to add integers into the array
matrix1[0,1] = Int32.Parse(Console.ReadLine()); // this is for user input
</code></pre>
<p>and so on.</p>
<p>Thanks for the help</p>
| c# | [0] |
6,020,120 | 6,020,121 | Why am I Not able to send http request over WIFI to a machine on the local network from my android device | <p>I am on WIFI and my Android device is connected. </p>
<p>In the android device I open a browser and go to <a href="http://192.168.1.12" rel="nofollow">http://192.168.1.12</a> - This is the IP address of the machine/server on the local network. I get the home page from this machine into my browser on the android device (because there is web server installed and it is a server machine).</p>
<p>Through my Java program - HttpPost is working very well for external sites like <a href="http://www.yahoo.com" rel="nofollow">http://www.yahoo.com</a> through WIFI - but it is NOT working for a server on the LAN</p>
<pre><code>HttpClient hc = new DefaultHttpClient();
HttpPost post = new HttpPost("http://192.168.0.12/");
HttpResponse rp = hc.execute(post);
</code></pre>
<p>The above code DOES NOT work and http response status 404. But if I change the above url to say "http://www.yahoo.com" it works and response status is 200</p>
<p>Can anyone help please</p>
| android | [4] |
5,820,244 | 5,820,245 | jQuery dynamic jcarsoul make it as autorun | <p>I am using this the <a href="http://sorgalla.com/projects/jcarousel/examples/dynamic_ajax_php.html" rel="nofollow">jCarousel</a> jQuery plugin.</p>
<p>How to change the click mode to automatically run mode?</p>
<p>The present scenario: when you click NEXT it shows the next three images.
When you click BACK it shows the previous three images.</p>
<p>I want to change this scenario to:</p>
<p>When it loads, the plugin should start running (image). I also need the NEXT and BACK button. When the user click the back button, then it should show the previous three images and run the image towards back.</p>
<p>Is it possible?</p>
| jquery | [5] |
1,231,904 | 1,231,905 | USB modem serial port | <p>I have made an application that is depends on connecting to a serial port then reciving SMS and reading it from GSM module by C#. When i run this code by GSM module it works well but when i run this code by USB module it dosen't see the SIM card and when i connect to the port that USB operates on it tell me that the requested port is usd and the other ports not work well. the recived SMS appears on the USB application only </p>
<p>how can i work on the same port that USB operate on or how can i prevent USB to read SMS by its application
can </p>
| c# | [0] |
3,095,551 | 3,095,552 | How to put this element to first place using jquery | <p>I want to make id="a" element div to be the first div in the div.b element.</p>
<p>Here is the code:</p>
<pre><code><div class='b'>
<div>a</div>
<div>a</div>
<div id="a">I want to put this div to be the first div</div>
</div>
</code></pre>
| jquery | [5] |
5,521,529 | 5,521,530 | paging and sorting using jquery | <p>I want to use paging and sorting using jquery.I want to embed this with jsp/servlets at back end.</p>
| jquery | [5] |
1,270,586 | 1,270,587 | Android textview hides when opening keyboard | <p>if I click on my EditText and the keyboard opens my EditText is about 3px small.. unreadable.</p>
<p>My EditText is on a textview within a fragment that is used as a tab of my actionbar.</p>
<p>Any ideas how to prevent this behaviour?</p>
| android | [4] |
2,496,544 | 2,496,545 | How to redirect from one page to another in HTML site using HTML button | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2201522/how-to-make-a-page-redirect-using-javascript">How to make a page redirect using Javascript?</a> </p>
</blockquote>
<p>i have an HTML pages i want to use to redirect from one page to another like response.redirect in ASP.Net. i think i must use JavaScript.</p>
| javascript | [3] |
4,167,850 | 4,167,851 | writing to a file with python | <p>This is a continuation from a question that I had yesterday. I am trying to open a text file that contains a list of numbers. I want to write these numbers to a new file multiple times. The purpose of the loop is to be able to write the source list multiple times. In this example, I want to print a list of 100 numbers 10 times so I end up with a list of 1000 numbers in my output file. This is the code that I am working with:</p>
<pre><code>i = 10
while i > 0:
with open ('C:/TestReq_100 Records.txt', 'r') as ipf:
for line in ipf:
num = line.strip()
filename = 'processed.txt'
with open('processed.txt', 'w') as opf:
opf('%s' %num)
## print num
i = i - 1
</code></pre>
<p>If I comment out the code related to writing to file and use the print command in the interpreter, the code does what I want. I just can't seem to get the same output in a text file. Again, I am not a student. Just trying to create files for use in my Company's software for testing purposes...thanks!</p>
| python | [7] |
2,098,824 | 2,098,825 | Java compile time error in case of casting | <p>The below code gives me compile time error <strong>Type mismatch: cannot convert from int to byte</strong></p>
<pre><code>int i = 10;
byte b = i;
</code></pre>
<p>but the below doesn't</p>
<pre><code> final int i = 10;
byte b = i;
</code></pre>
<p>I don't understand why compiler is behaving in case of final?</p>
| java | [1] |
4,752,488 | 4,752,489 | Page not refreshing properly | <p>Easy answer fix by the first comment. Sorry page didn't have a redirect now it is fixed and working great.</p>
<pre><code><?php
if (isset($_GET['logout'])) {
$root = $_SERVER['DOCUMENT_ROOT'];
require_once("$root/busapp/helpers/session.php");
if ((isset($sesh_user_id)) || (isset($sesh_admin)) || (isset($sesh_email))) {
$_SESSION = array();
}
if (isset($_COOKIE[session_name()])) {
setcookie(session_id(), '', time() - 3600);
}
session_destroy();
}
?>
</code></pre>
| php | [2] |
4,019,472 | 4,019,473 | php find line number for a particular keyword | <p>say I have a paragraph of text, with some new lines/line breaks. I would like to find the occurance of a certain keyword, and return the line numbers of those keywords. How do I do that? Thanks!</p>
| php | [2] |
818,665 | 818,666 | PropertyChangeSupport leaks this reference | <p>I have a bean which contains a private field PropertyChangeSupport pcs. If i invoke pcs = new PropertyChangeSupport(this) inside bean constructor then i'm not sure whether this approach potentially dangerous or not. What do you think about leaking this reference in constructor in this situation? </p>
| java | [1] |
1,876,947 | 1,876,948 | click on an image to load another image in jquery | <p>I have an image displaying using the jquery. When mouse over to that image, I like the mouse to change to be clickable and when clicked, I like to load another image. This is my code and not working. Any ideas?</p>
<p>html code:</p>
<p>jquery code:</p>
<pre><code>$("#div1").click(function () {
var img_cpu = "http://192.168.101.1/cpu.png";
var myImage = new Image();
$(myImage).load(function () {
$("#div2").html(myImage)
}).error(function () {
$('#div2').hide();
})
.attr('src', img_cpu)
});
</code></pre>
| jquery | [5] |
2,391,026 | 2,391,027 | firebug like jquery implementation | <p>I want to implement a firebug like highlight when my cursor hovers an element </p>
<pre><code>$("*").mouseover(function()
{
$(this).css({border:'1px solid blue'});
})
.mouseleave(function()
{
$(this).css({border: ''});
});
</code></pre>
<p>but it doesnt change the css when the cursor hovers an inner element, the outer element still has its style changed instead of reverting back to its original css due to <code>mouseleave()</code></p>
| jquery | [5] |
2,395,168 | 2,395,169 | jquery autoscroll | <p>Can anyone suggest a good simple jQuery vertical autoscroller script? one that's not bloat, I just need for it to auto start and scroll 6 or more <code>li</code>in a div. i tried the <strong>jquery.autoscroll.js</strong> but couldn't get it to auto start.</p>
<pre><code>$.fn.autoscroll.defaults = {
start: {
step: 50,
scroll: true,
direction: "down",
pauseOnHover: true
},
delay: 5000,
ffrw: {
speed: "fast",
step: 100
}
};
</code></pre>
| jquery | [5] |
872,039 | 872,040 | Python - issues with numbers in pathnames | <p>I need to open all PDFs in a certain directory, so I first generate a list of the file paths using os.path:</p>
<pre><code>filenames = [
normpath(join(directoryname, filename))
for filename in listdir(directoryname)
if filename.lower().endswith('.'+extension)
]
</code></pre>
<p>So an item in that list looks like this:
D:\\Folder\\2010\\file.pdf</p>
<p>Then I'd like to open each file in a for-loop:</p>
<pre><code>for file in filenames:
PdfFileReader(file(file, 'rb'))
</code></pre>
<p>but there seems to be an issue with the 2010, because I get this error:</p>
<pre><code>IOError: [Errno 2] No such file or directory: 'D:\\Folder\\x810\\file.pdf'
</code></pre>
<p>I'd like to do something along the lines of</p>
<pre><code>PdfFileReader(file(r'D:\\Folder\\2010\\file.pdf', 'rb'))
</code></pre>
<p>how would I do that in the above example where the path is passed as a variable?
Or are there any better ways to do this?</p>
<p>I'm using Windows and Python 2.6.</p>
<p>Thanks in advance!</p>
| python | [7] |
4,588,625 | 4,588,626 | What is the difference between #import and #include in C++? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/172262/c-include-and-import-difference">C++ include and import difference</a> </p>
</blockquote>
<p>Can someone explain the difference and where may I use one versus the other?</p>
| c++ | [6] |
4,924,843 | 4,924,844 | Can I control open file dialog in web browser? | <p>I am making an automated tool for uploading files. So we need to get object of already opened file dialog box of web browser control of c#. </p>
<p>How to get that object to set my file path and then click OK?</p>
| c# | [0] |
3,644,654 | 3,644,655 | how to call the array in $$variable | <pre><code>$var = "array";
$$var=array("1","2");
</code></pre>
<p>How can I call the array in <code>$$var</code> without using <code>foreach</code>? I want a method like <code>$$var[0]</code>, but this doesn't work.</p>
| php | [2] |
5,914,273 | 5,914,274 | How to remove random rows of zero quantities of a multiple array in C#? | <p>How to remove random rows of zero quantities (all in string types) of a multiple array in C#? Coded please! :))</p>
<p>Ex: index Code,Color, Quantities, RetailPrice, WholeSalePrice </p>
<pre><code>0 1002, red, 0, 150, 100
1 1003, blue, 0, 160, 100
2 1004, yellow, 3, 180, 130
3 1004, green, 6, 140, 103
4 1008, pink, 8, 200, 140
5 1008, black, 0, 200, 140
6 1008, white, 0, 200, 140
7 1008, blue, 0, 200, 140
8 1008, purple, 4, 200, 140
9 1009, light blue, 2, 280, 210
10 1000, stripe, 4, 170, 115
11 1003, white, 2, 230, 175
12 1009, white, 2, 230, 175
13 1001, white, 0, 230, 175
14 1000, black, 0, 230, 175
</code></pre>
<p>Result:
index Code,Color, Quantities, RetailPrice, WholeSalePrice </p>
<pre><code>1 1004, yellow, 3, 180, 130
2 1004, green, 6, 140, 103
3 1008, pink, 8, 200, 140
4 1008, purple, 4, 200, 140
5 1009, light blue, 2, 280, 210
6 1000, stripe, 4, 170, 115
7 1003, white, 2, 230, 175
8 1009, white, 2, 230, 175
</code></pre>
<p>Any one can help please?</p>
| c# | [0] |
2,880,792 | 2,880,793 | Can I do this? $("msgcntDiv").data("newMessageCnt.php"); | <p>I have a variable in a span tag:</p>
<pre><code> echo "<span class='headings_sub' id='msgcntDiv'>You have ".$numOfMessages." </span>";
</code></pre>
<p>My script:</p>
<pre><code> <script>
$(document).ready(function() {
var reload = function(){
$("msgcntDiv").load("newMessageCnt.php");
}
window.setInterval(function() {
$("#msgcntDiv").load(reload);
}, 10000);
});
</script>
</code></pre>
<p>"newMessageCnt.php" has one line:</p>
<pre><code><?php
include('header_application.php');
$pageValue = "dashboard";
$obj_clean->check_user();
echo $numOfMessages = $obj_clean->getUnopenedMessagesCount($_SESSION['user_id']);
?>
</code></pre>
| jquery | [5] |
5,382,669 | 5,382,670 | How to get Android 2 project types available in Eclipse? | <p>I just upgraded to the Android 2 SDK. (I was at v1.5) I believe I followed all the instructions correctly, I installed the new SDK and then went into Eclipse and ran a software update from dl-ssl.google.com/android/eclipse. But when I then went to create a new project (after restarting Eclipse) all I had to choose from were 1.5 Android projects. </p>
<p>To be honest, the steps for upgrading the SDK could be a little easier so it's entirely possible I missed something. I'm glad Google has an auto-update feature starting with Android 1.6 but unfortunately I'm out of luck since I'm on 1.5.</p>
| android | [4] |
4,914,029 | 4,914,030 | Android:Recently Added songs list using media store | <p>I am working on simple audio media player. I am using media store to get information of all songs stored on the sdcard. So far So good. Everything is working fine. </p>
<p>But I am stuck now. How can I get last added (recently added) songs using media store?</p>
<p>Regards,
Niral</p>
| android | [4] |
3,581,811 | 3,581,812 | not able to use calls in Fragment ever thought i import the corresponding library | <p>SO here is my understanding of the purpose of importing fragment library(the v4.jar).
Because the developer wants to use and follow the new Fragment's way of coding, but using this will result compatibility issue on older devices that runs on android 2.xx, therefore, in the project that uses fragment, the developer has to import the v4.jar library so that the older devices know what fragment APIs and are able to call them in the app.
If this is correct, I suppose after importing the library, the android:minSdkVersion should be able to set to older version such as 8 (93% of the market), not l0, because the project had already import the library. </p>
<p>But When I am using the method from the fragment, for example, the instantiate method, I got this error:</p>
<p>Call requires API level 11 (current min is 8): android.app.Fragment#instantiate</p>
<p>So apparent the sdk wants me to switch my android:minSdkVersion to 11, but then what is the purpose of importing the library? And by doing so older device that running on android 2.xx will not be able to use this app.
Can someone explain this issue ?</p>
| android | [4] |
988,022 | 988,023 | How to launch gtalk from another app in android | <p>I just want to know how to fire intent to launch google talk from my application.
Is it possible to do so?</p>
| android | [4] |
3,555,217 | 3,555,218 | How can I locate links involving PDF's on an html page and then append the front of the link with an absolute path? | <p>I have an html page with a number of links on it. Some of the links connect to .pdf. </p>
<p>Is it possible to write javascript that upon the loading of the page -</p>
<ul>
<li><p>it scans through the html file and locates all links that are linking to .pdf</p></li>
<li><p>then appends the front of that url with a hard coded front end?</p></li>
</ul>
<p>All links on the page are relative, and I am having issues when these .pdf links are pulled up on an android tablet. But when I use the absolute path, it handles it no problem. So I just want to append the absolute path on the .pdf links.</p>
| javascript | [3] |
4,434,003 | 4,434,004 | Append code into wp-config.php | <p>We have multiple wordpress sites and need to update the wp-config for w3 total cache. We have to append <code>define('WP_CACHE', true);</code> into the wp-config.php file. Is it possible to do this via ssh. I don't want to have to go in and open each config file and add it myself.</p>
<p>Your help will be much appreciated.</p>
| php | [2] |
3,927,296 | 3,927,297 | encoding from any language to utf in php | <p>I insert from csv characters from different languages.. </p>
<p>I apply this to every set of characters:</p>
<pre><code> private function process_elements($element){
utf8_encode($element);
return $element;
}
</code></pre>
<p>The problem is when they go into the database, they go like this:</p>
<pre><code>???????? ?? ???????????? ????? ??????? ??? ???????...
</code></pre>
<p>When I retrieve them from the databse, I also get this.</p>
<p>This happens with greek. However, when I retrieve greek pages (through scrapping), who are on a utf encoded page. The characters look like this:</p>
<pre><code>Δες webcam δωμάτια | Gr.ImLive.com
</code></pre>
<p>which is okay, because when i use the utf8_encode function, they look normal on the screen..</p>
<p>But when the data is taken from the csv and be put into the database, i get those question marks..</p>
<p>Is there a way to encode form any language to utf.. why retrieving data from csv and a utf8 encoded webpage makes such a difference.. they look the same.. how do I address that problem?</p>
| php | [2] |
1,576,679 | 1,576,680 | How to get data from serial port to usb on android application? | <p>I'm new in android.I have android tablet,usb to serial port cable and gprs device.</p>
<p>The gprs device will be connected using the serial port.</p>
<p>So now, how can i get data from gprs device to android app using usb to serial port cable.</p>
<p>Please let me know.</p>
| android | [4] |
3,580,032 | 3,580,033 | converting videos with php and ffmpeg | <p>how can i upload and convert the video to mp4 behind the scene so that if user uploads a video than the user could work/visit on rest of site and once the video is converted it displays in the users control panel....!!
i want to do this without ffmpeg........
if there is no way out than i will want to use ffmpeg.....!!</p>
| php | [2] |
4,297,991 | 4,297,992 | Cannot implicitly convert type 'int' to 'bool' | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/871530/help-converting-type-cannot-implicitly-convert-type-string-to-bool">Help converting type - cannot implicitly convert type ‘string’ to ‘bool’</a> </p>
</blockquote>
<p>I am very new to the language n I am not a good programmer. This code is giving me error: </p>
<blockquote>
<p>cannot implicitly convert type int to bool.</p>
</blockquote>
<p>I am not sure what I am doing wrong.
Can some tell me what I am doing wrong. Any help would be appreciated n any recomendation would also help.</p>
<pre><code> using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class mysteryVal
{
public const int limitOfGuess = 5;
// Data member
public int mystVal;
private int numOfGuess ;
private randomNumberMagnifier mag = new randomNumberMagnifier();
public int randomMag(int num)
{
return num + mystVal;
}
// Instance Constructor
public mysteryVal()
{
mystVal = 0;
numOfGuess = 0;
}
public void game(int user)
{
int userInput = user;
if (numOfGuess < limitOfGuess)
{
numOfGuess++;
if (userInput = mag.randomMagnifier())
{
}
}
}
}
}
</code></pre>
| c# | [0] |
301,612 | 301,613 | WWF 4.0 How can I get access to GetExtension<UserSession>() from xaml condition | <p>How can I get access to "ActivityContext.GetExtension()" from xaml condition in WWF 4.0?</p>
<pre><code><If Condition="[ActivityContext.GetExtension<UserSession>().IsAdmin]"
</code></pre>
<p>Please, help. Write for all checks differences CodeActivity is very hard way :(</p>
| c# | [0] |
2,150,647 | 2,150,648 | Python API to fetch the public key from public key server | <p>Is there any Python API which can fetch the public key from the public key server?</p>
| python | [7] |
1,169,042 | 1,169,043 | How to set class="active" in jquery | <p>I have a sample code:</p>
<pre><code><div class="box">
<div id="banks">
<ul>
<li class="active1">Bank1</li>
<li">Bank2</li>
</ul>
</div>
<div id="buttons">
<ul>
<li class="active2">USD</li>
<li>EURO</li>
</ul>
</div>
</div>
</code></pre>
<p>And jquery:</p>
<pre><code><script>
$(document).ready(function(){
$('.box li').click(function(){
$('#banks li').removeClass('active1');
$('#buttons li').removeClass('active2');
$(this).addClass('active1');
$(this).addClass('active2');
});
});
</script>
</code></pre>
<p>OUPUT: Error when click on:</p>
<pre><code><div class="box">
<div id="banks">
<ul>
<li class="active2 active1">Bank1</li>
<li class="active2">Bank2</li>
</ul>
</div>
<div id="buttons">
<ul>
<li class="">USD</li>
<li class="">EURO</li>
</ul>
</div>
</div>
</code></pre>
<p>How to using jquery exactly for add class for 2 id are (banks and buttons) with 2 class are (active1, active2)</p>
| jquery | [5] |
2,257,789 | 2,257,790 | Removing instances of a particular tag that contains a specific attribute | <p>I'm trying to use jQuery to remove all instances of <code><br type="_moz /></code> from within a page. I'm completely stuck as to how about accomplishing this. </p>
| jquery | [5] |
5,072,859 | 5,072,860 | How to refresh parent window's grid view only when model popup is closed in asp.net? | <p>I am working with asp.net and model popup. in popup window when i edit the changes it must get reflect on paren windows grid view. so any one tell me how to refresh paren window's grid view only without reloading entire page after closing popup.</p>
<p>Thank in advance.</p>
| asp.net | [9] |
4,275,095 | 4,275,096 | How to create findViewById parm dynamically or programmatically at runtime | <p>I have an xml layout that will display a grid made up of textviews within tablerows. The textview names are cell00, cell01, etc. At runtime, my program will determine which cell needs to be changed. </p>
<p>Is there a way get format a name so that it can be passed to the findViewById method at runtime? For example, if cell00 is needed, how can I generate the parm in this code?</p>
<pre><code>TextView currcell = (TextView) findViewById(R.id.cell00)
</code></pre>
<p>Something like “cell”+00 doesn’t compile because the findViewById method doesn’t accept a String type. I don’t want have every textview name in the grid hardcoded in the program – there must be a better way. </p>
<p>Thank you for any help you can provide.</p>
| android | [4] |
2,462,507 | 2,462,508 | Display elements one after another | <p>I am trying to display elements one after another... For example if there are 10 elements in a div, I want to display one after one. But only one Item at a time. I have written the below code but it is not working as expected.. </p>
<pre><code> function fades(c) {
var x = c;
c.fadeIn(3000, function () {
if (c.is('last-child')) {
c.fadeOut(3000);
fades(c);
}
else {
c.fadeOut(3000);
fades(c.next());
}
});
}
</code></pre>
<p>Thanks</p>
| jquery | [5] |
1,902,746 | 1,902,747 | PHP deprecated code? | <p>HI all</p>
<p>Running PHP Version 5.2.11 and we've been given a site which we're told was running on an earlier version (4 possibly).</p>
<p>We've an odd problem where several pages which have a bunch of forms which update the MySql are not working. The problem is where the variables used in the update script are not being defined anywhere in the php before hand. eg.</p>
<pre><code>UPDATE users SET FirstName='$form_firstname'WHERE UserID='$id'"
</code></pre>
<p>Now if we change it to..</p>
<pre><code>$form_firstname = $_POST['form_firstname'];
UPDATE users SET FirstName='$form_firstname'WHERE UserID='$id'"
</code></pre>
<p>then the update works. We could do this for every single variable defined in every update statement but I'm thinking that seen as this must have worked previously we're looking at some deprecated code somewhere that forms these variables. I've looked for any </p>
<pre><code>import_request_variables
</code></pre>
<p>statements but nada.</p>
<p>Can anyone think of anything that would be turned off by default in a new server that would cause this or does this variable have to be declared somewhere?</p>
<p>Cheers muchly</p>
| php | [2] |
4,340,084 | 4,340,085 | Make all elements draggable if they have the same ID | <p>Using JQuery, I'm trying to make multiple elements draggable when the elements all have the same ID. Is is possible to do this using JQuery?</p>
<p>(Here, there are two divs with the id "draggable", and I'd like to make both of them draggable.)</p>
<p>The relevant code is here: <a href="http://jsfiddle.net/zcJwu/" rel="nofollow">http://jsfiddle.net/zcJwu/</a></p>
<pre><code><!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Draggable - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<style>
#draggable { width: 150px; height: 150px; padding: 0.5em; }
</style>
<script>
$(function() {
$( "#draggable" ).draggable();
});
</script>
</head>
<body>
<div id="draggable" class="ui-widget-content">
<p>Drag me around</p>
</div>
<div id="draggable" class="ui-widget-content">
<p>Drag me around</p>
</div>
</body>
</html>
</code></pre>
| jquery | [5] |
606,197 | 606,198 | Why both IIS And Asp.net Authentication | <p>I like to share my views(actually confusion) regarding authentication process in asp.net .</p>
<p>There are so many combination of authentication shared between iis and asp.net itself which I need to clarity.</p>
<p>I will appricate you , if you will provide me infomration in detail( if possible with some example and code), as I am not getting proper clarification from so many days.</p>
<p>My questions are :-</p>
<p>1) Why there are two phases of authentication for asp.net application i.e. a) windows authentication is in both iis and asp.net b) passport authentication is also in both</p>
<p>2) If I had configured Integrated windows authentication in iis and used a)Windows b) Passport c)Forms d)None authentication in asp.net what difference it will bring</p>
<p>3) How to use passport authentication. Even I set passport authentication in iis and asp.net it doesn't given me any configuration screen to configured user for passport authentication.</p>
<p>4) If I am using basic or digest authentication in iis what change it also bring when I use different authentication in asp.net</p>
<p>5) Please provide me information in details , difference between forms and none authentication in asp.net , as i can use same login form for authenticatin in both of this cases, so what change it will bring</p>
<p>Regards,
Ashish Khandelwal</p>
| asp.net | [9] |
2,490,924 | 2,490,925 | Android SQLiteOpenHelper : onCreate() method is not called. Why? | <p>I am trying to make my first android app. I heard that the SQLiteOpenHelper.onCreate() method process to create tables if the database is not created. However, the onCreate() method did not work even thought I tried to debug. Please look at the code below and give me any suggestions. Any help will be appreciated.</p>
<pre><code>=================================================================
public class NameToPinyinActivity extends Activity {
DatabaseOpenHelper helper = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.nametopinyin);
Button searchButton = (Button) findViewById(R.id.search);
searchButton.setOnClickListener(new ButtonClickListener());
helper = new DatabaseOpenHelper(NameToPinyinActivity.this);
}
=================================================================
public class DatabaseOpenHelper extends SQLiteOpenHelper {
/** DB Name */
private static final String DB_NAME = "pinyin";
/** CREATE TABLE SQL */
private static final String CREATE_TABLE_SQL = "CREATE TABLE UNICODE_PINYIN"
+ "(ID INTEGER PRIMARY KEY AUTOINCREMENT, "
+ "UNICODE TEXT NOT NULL, PINYIN TEXT NOT NULL)";
public DatabaseOpenHelper(Context context) {
super(context, DB_NAME, null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.beginTransaction();
try {
db.execSQL(CREATE_TABLE_SQL);
db.setTransactionSuccessful();
} catch (Exception e) {
e.printStackTrace();
} finally {
db.endTransaction();
}
}
=================================================================
</code></pre>
| android | [4] |
3,702,082 | 3,702,083 | Android Add Link to a preference activity - how? | <p>What is the way to add a clickable link to my preference activity?</p>
| android | [4] |
5,857,572 | 5,857,573 | creating a file | <p>I want to create a file but the below code doesn't create any file.</p>
<pre><code>package InputOutput;
import java.io.*;
public class FinalProject{
private File f;
public File createFile() throws IOException{
f = new File("E:\\Programming\\Class files\\practice\\src\\InputOutput\\helpSystem.txt");
return f;
}
public static void main(String[] args) throws IOException{
FinalProject fp = new FinalProject();
fp.createFile();
}
}
</code></pre>
| java | [1] |
5,120,045 | 5,120,046 | Is the order objects are return by a jQuery selector specified? | <p>All jQuery selectors return an array of objects. Are these objects always in the same order as they are in the HTML? Can I rely on this?</p>
| jquery | [5] |
2,163,203 | 2,163,204 | How to identify '\t' in a file? | <p>I'm using this code to read a line of text from a file : </p>
<pre><code>BufferedReader br = new BufferedReader(new FileReader("myFile.txt"));
String line = br.readLine();
</code></pre>
<p>If the line contains tabs : (\t) then this character is not read correctly. It just appears as an empty space. How can I determine if a tab character is contained in the line of text currently being read ?</p>
| java | [1] |
2,310,720 | 2,310,721 | jQuery hover opacity IE8 | <p>This is for a thumbnail - a simple opacity set then hover function.</p>
<p>What am I missing? This is working in most browsers (including IE7) but in IE8 I get nothing.</p>
<pre><code><script type="text/javascript">
$(function() {
// set opacity on page load
$(".image-thumb").css("opacity", "0.6");
// on mouse over
$(".image-thumb").hover(
function() {
// animate opacity to full
$(this).stop().animate({
opacity: 1
}, "slow");
},
// on mouse out
function() {
// animate opacity
$(this).stop().animate({
opacity: 0.6
}, "slow");
}
);
})
</script>
</code></pre>
| jquery | [5] |
4,384,204 | 4,384,205 | Cannot Find Symbol compiler message | <p>Hello all I'm a java newbie and I'm getting a compiler error message:</p>
<pre><code>src\LU62XnsCvr.java:33: cannot find symbol
symbol : constructor File(java.lang.StringBuffer)
location: class java.io.File
static File Rqst_File = new File(RqstFile_DSN) ;
^
</code></pre>
<p>In my java program I have coded:</p>
<pre><code> static StringBuffer RqstFile_DSN = new StringBuffer() ;
static StringBuffer RespFile_DSN = new StringBuffer() ;
static File Rqst_File = new File(RqstFile_DSN) ;
</code></pre>
<p>Any ideas as to why the compiler can't find the RqstFile_DSN "symbol" ?
I'm assuming that the "symbol" is the variable I've defined RqstFile_DSN </p>
<p>Thanks</p>
| java | [1] |
1,926,647 | 1,926,648 | python stdout carriage return | <p>i am running a for loop on a given set of files..and for monitoring purpose it writes output on which files are being currently processed..</p>
<pre><code>sys.stdout.write("\rProcessing.... "+ j)
sys.stdout.flush()
</code></pre>
<p>where j is filenames</p>
<p>output of script...</p>
<pre><code>Processing.... /etc/sysconfig/rhn/sources0.examplewn-slepcsbals-ipv6f
</code></pre>
<p>problem is that the carriage return "\r" does not clear the previous filename clearly and has previous filenames on it.</p>
<p>any idea how i can fix this..and make it more clear</p>
| python | [7] |
1,710,998 | 1,710,999 | Exclude child checkbox from parent toggle | <p>I have a series of content and header divs to display some data. In addition each header has a checkbox.</p>
<pre><code><div id="content-1">
<div class="head"><input type="checkbox" name="check-1"/> Header</div>
<div class="content">Content</div>
</div>
<div id="content-2">...</div>
<div id="content-3">...</div>
</code></pre>
<p>I use to following jQuery to show/hide a content div by clicking on the respective header div.</p>
<pre><code>$(".head").toggle(
function(){ $(this).nextAll().slideDown('200'); },
function(){ $(this).nextAll().slideUp('200'); }
);
</code></pre>
<p>The problem is that clicking the checkbox shows/hides the content div and the checkbox can not be checked/unchecked. I want the content toggle to only occur when clicking the head div, and for the checkbox to function as normal.</p>
<p>Any help greatly appreciated.</p>
| jquery | [5] |
737,003 | 737,004 | How to create objects dynamically with C#? | <p>I'm trying to create objects dynamically but I don't know how to. What I need is, I have a class for that object, and objects properties are stored in the database. Then I'll need to compare the properties of each object to get the desired result. </p>
<p>So I need to dynamically create objects on the fly with the properties loaded from database.</p>
| c# | [0] |
2,754,338 | 2,754,339 | application supporting multiple language | <p>how to make my application support multiple language and automatically use the language defined for IOS user</p>
| iphone | [8] |
4,003,837 | 4,003,838 | Jquery - Apply rule if item contains one string OR another string | <p>Hopefully I can explain this better than I can Google it!</p>
<p>I have a Jquery rule that detects a certain word then applies a class to that elements parent container which works as hoped.
Instead of simply duplicating this rule for additional words I would like to just include them in the rule effectively as an "OR".</p>
<p>This is what I have that works:-</p>
<pre><code>$(".container:contains(Word1)").each(function(){
$(this).closest("#containerParent").addClass("newClass");
});
</code></pre>
<p>This is the none-working attempt:-</p>
<pre><code>$(".container:contains(Word1)"|".container:contains(Word2)").each(function(){
$(this).closest("#containerParent").addClass("newClass");
});
</code></pre>
<p>As an alternative I could make it a function of course, but I would like to do it "properly" or in a cleaner way.</p>
<p>What do you think?</p>
| jquery | [5] |
5,831,953 | 5,831,954 | Compressing Bitmaps in Memmory | <p>I am creating an Activity that reads all images from the device. I use the following code</p>
<pre><code>ContentResolver crThumb = context.getContentResolver();
BitmapFactory.Options options = new BitmapFactory.Options();
b = MediaStore.Images.Thumbnails.getThumbnail(
crThumb,
Long.parseLong(url),
MediaStore.Images.Thumbnails.MINI_KIND, options);
return b;
</code></pre>
<p>I display these bitmaps, in a GridView, however after sometime my activity crashes as there is not enough memory. How can i compress the bitmap in memory, before reading it ?</p>
<p>Kind Regards</p>
| android | [4] |
5,976,520 | 5,976,521 | how to using JExcelApi for reading and writing excel file in android app | <p>i downloaded JExcelApi for reading and writing excel file in android app. how can i import it to my eclipse or android sdk or anything before can import that to my code like this:</p>
<pre><code>import jxl.*;
</code></pre>
<p>excuse me for my poor english</p>
| android | [4] |
1,997,049 | 1,997,050 | How to send key-ins to certain windows | <p>I'm looking to write a relatively simple key macro for my own edification and also for my own use.</p>
<p>I intend for it to be able to run in the background when I run other programs, and at the press of a button will enter certain text into the active window. To be more specific, I want to go in a video game and use it to automatically send messages instead of having to type them. </p>
<p>I Googled around a bit, but apparently I'm not using the right keywords because I'm not really sure where to start. The closest I came was finding the Keystroke class, but that appears to be used for receiving keystrokes, not sending them.</p>
<p>I would appreciate and info regarding, or directing me to a resource for, these issues (how to send keystrokes to windows and anything about targeting which window etc).</p>
| java | [1] |
2,197,512 | 2,197,513 | Android:Simulator instance newly opens every time | <p>I have been trying to search about this issue in the forums etc. but have not found any solutions yet. I have installed Eclipse 3.7.1 and using Android 3.0. When i want to debug the Android project, i select Debug As->Android application, simulator opens after a few mins but doesn't launch my app even after did lock swipe, but app is being installed. But, my biggest problem is, every time when i select Debug As->Android application, it always opens new simulator instance instead of launching my app in the existing launched simulator. Its killing, i'm not able to Debug my app at all directly.
Could someone please help me to set it properly?</p>
<p>Thank you!</p>
<p>CONSOLE: (every time when launches the new simulator)</p>
<pre><code>Android Launch!
adb is running normally.
Performing com.company.myproject.SplashScreenActivity activity launch
Automatic Target Mode: Preferred AVD 'avd3.2' is not available. Launching new emulator.
Launching a new emulator with Virtual Device 'avd3.2'
2012-02-12 13:45:13.478 emulator-arm[2522:80b] Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.
emulator: WARNING: Unable to create sensors port: Connection refused
</code></pre>
| android | [4] |
5,180,289 | 5,180,290 | asp.net webforms create user wizard with new steps | <p>i am using the create user wizard, and it works great with the default 2 steps
1 - enter all the info
2 - the complete button</p>
<p>step 1 has some extra data in it, and I hook into the created user event in order to kick off some other processes.</p>
<p>I want to create a middle step for the user to confirm what they have captured in the previous step.</p>
<p>to do this i add a new step with the wizard, this gives me a button.</p>
<p>But the problem is that step 1 still creats all the user information in my db, i only want that to happen after step 2</p>
| asp.net | [9] |
3,776,476 | 3,776,477 | if ($(function () { }); is legitimate code, why isn't $(foo())? | <p>So, we should all know about the jQuery document-ready handler:</p>
<pre><code>$(function () {
// stuff here
});
</code></pre>
<p>So basically, if the first parameter for the <code>$</code> function is a function, then we run it on document startup, right?</p>
<p>Then why won't this work?</p>
<pre><code>$(foo());
</code></pre>
| jquery | [5] |
4,173,692 | 4,173,693 | jQuery selector for last created div element | <p>I have several divs that are generated dynamically after a file is uploaded. Each file upload creates a div in this format:</p>
<pre><code><div id="uploadifive-fileupload-queue" class="uploadifive-queue">
<div class="uploadifive-queue-item complete" id="uploadifive-fileupload-file-0">
<div id="inputs">
some text
</div>
</div>
</div>
</code></pre>
<p>Every item uploaded increments the id of the uploadifive-queue-item class to uploadifive-fileupload-file-0, uploadifive-fileupload-file-1, uploadifive-fileupload-file-2, etc.</p>
<p>What I am trying to do is add a class to <code>#inputs</code>, but only the one just created.</p>
<p>I've tried the following, but it applies the class to the wrong div (usually the first div)</p>
<pre><code> $('#fileupload').uploadifive({
'buttonClass' : 'btn btn-primary',
'buttonText' : 'Select Thumbnail',
'dnd' : false,
'fileSizeLimit' : 1000,
'method' : 'post',
'simUploadLimit' : 1,
'uploadScript' : './upload/',
'onUploadComplete' : function(file, data) {
$('#inputs:last').addClass('alert-error');
}
});
</code></pre>
<p><code>#fileupload</code> is just the name of the form, here's the HTML:</p>
<pre><code><form id="fileupload">
<input type="file" name="userfile" size="20" />
</form>
</code></pre>
<p>The divs are added directly underneath and are inside the same container.</p>
<p>How can I select the correct div? </p>
| jquery | [5] |
2,350,557 | 2,350,558 | show timer in label | <p>As in most games i hv seen the timer in a format "01:05"</p>
<p>I m trying to implement a timer, and on reset i need to reset the timer to "00:00".</p>
<p>This timer value should be in label.</p>
<p>How to create a timer which is incrementing? like 00:00---00:01---00:02..........somthing like dat.</p>
<p>suggestions</p>
<p>regards</p>
| iphone | [8] |
2,168,449 | 2,168,450 | How to create post thumbnail | <p>I am working on the WordPress Twenty Ten theme, and I want to display post thumbnails. I have followed the steps below:</p>
<ul>
<li><p>Added following code in functions.php file:</p>
<pre><code>if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
}
</code></pre></li>
<li><p>I have also defined post thumbnail size,</p>
<pre><code>set_post_thumbnail_size( 150, 150 );
</code></pre></li>
<li><p>And I configured the media settings from the admin panel of WordPress to not to crop image. but this is cropping the image.</p></li>
<li><p>Using this in loop.php file,</p>
<pre><code>the_post_thumbnail(array(150,150);
</code></pre></li>
</ul>
<p>I do not want to crop the image. How can I do this? Please help where I am wrong in my process.</p>
<p>Thanks in advance.</p>
| php | [2] |
5,653,994 | 5,653,995 | change focus into particular div | <p>how can i change focus into particular div after any event via jquery?</p>
| jquery | [5] |
528,477 | 528,478 | Android: Clicking children individually within a GridView | <p>This is in the initial Activity when my app starts up. The gridview contains six click able icons that i want to all go to different activities. I have aboslutely no problem starting up a new activity for another thing to do in my app. I created one activity just to work with initially, a 'contact us' form. I want only one of these icons to go to that activity, however i can't find a way to make it so the onItemClickListener callback registers individual clicks for each icon and launches the appropriate activity; currently, no matter which icon i click, they all go to the same activity. See below for my code:</p>
<pre><code> GridView gridview = (GridView) findViewById(R.id.gridview);
gridview.setAdapter(new ImageAdapter(this));
gridview.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View v, int position, long id)
{
Intent myIntent = new Intent();
myIntent.setClassName("com.beneast.main", "com.beneast.main.ContactUs");
startActivity(myIntent);
};
});
</code></pre>
<p>I am a bit of a noob at doing this as you can plainly see, this app is getting developed as i learn more stuff. But thanks for any help.</p>
| android | [4] |
5,631,727 | 5,631,728 | error control operator not working | <p>My question is similar to this <a href="http://stackoverflow.com/questions/4330494/preventing-warnings-from-fsockopen">one</a>. However, the <a href="http://php.net/manual/en/language.operators.errorcontrol.php" rel="nofollow">error control operator</a> does not work for me.</p>
<p>With the following code:</p>
<pre><code>$this->fp = @fsockopen($this->ip, $this->port, $errno, $errstr, $this->timeout);
</code></pre>
<p>I still get an error message:</p>
<p><code>fsockopen(): unable to connect to xxx.xxx.xxx.xx:xxxxx (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. )</code> </p>
<p>Is it possible that I can have error control operators disabled?</p>
| php | [2] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.