Unnamed: 0 int64 65 6.03M | Id int64 66 6.03M | Title stringlengths 10 191 | input stringlengths 23 4.18k | output stringclasses 10 values | Tag_Number stringclasses 10 values |
|---|---|---|---|---|---|
4,535,705 | 4,535,706 | Error in JavaScript return code? | <p>Here is the javascript code:
There is an error in code where nightSurcharges is added to total cost even if pickUptime is less than 20.</p>
<pre><code>function TaxiFare() {
var baseFare = 2;
var costPerMile = 0.50;
var nightSurcharge = 0.50; // 8pm to 6am, every night //its flat 0.50 and not per mile
var milesTravelled = Number(document.getElementById("miles").value) || 0;
if ((milesTravelled < 1) || (milesTravelled > 200)) {
alert("You must enter 1 - 200 miles");
document.getElementById("miles").focus();
return false;
}
var pickupTime = Number(document.getElementById("putime").value) || 0;
if ((pickupTime == "") || (pickupTime < 0) || (pickupTime > 23)) {
alert("The time must be 0-23 hours");
document.getElementById("putime").focus();
return false;
}
var cost = baseFare + (costPerMile * milesTravelled);
// add the nightSurcharge to the cost if it is after
// 8pm or before 6am
if (pickupTime >= 20 || pickupTime < 6) {
cost += nightSurcharge;
}
alert("Your taxi fare is $" + cost.toFixed(2));
}
</code></pre>
<p>I want nightSurcharge to be added only when pickupTime is >=20, but that's not working right now.
Any help is appreciated. Thanks</p>
| javascript | [3] |
5,990,141 | 5,990,142 | Ways of impersonation c# ws2008 | <p>I want to run application under ws2008 in the context of different user. I use System.Diagnostic.Process with user, password and domain. When I use this method and user belongs only to iis_iusrs group I get "The directory is invalid" message.</p>
<p>When I run runas command from cmd auth as a user I can run application.</p>
<p>Is there other way to run application in context of other user ?</p>
| c# | [0] |
4,380,516 | 4,380,517 | JNotify-Code-file-not-found | <p>Hi when I am using JNotify litener.
I got this exception as stack trace:</p>
<pre><code> java.io.FileNotFoundException: D:\test\dfgdf.txt (The process cannot access the file because it is being used by another process)
created D:\test : dfgdf.txt
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at java.io.FileReader.<init>(FileReader.java:41)
at listener.Listener.readTextFile(Listener.java:37)
at listener.Listener.fileCreated(Listener.java:25)
at net.contentobjects.jnotify.win32.JNotifyAdapterWin32.notifyChangeEvent(Unknown Source)
at net.contentobjects.jnotify.win32.JNotifyAdapterWin32$1.notifyChange(Unknown Source)
at net.contentobjects.jnotify.win32.JNotify_win32.callbackProcessEvent(Unknown Source):
........................................................
</code></pre>
| java | [1] |
174,833 | 174,834 | Need suggestions on Javascript for image rollover with text change in <div> | <p>I'm trying to write a javascript that will do two things. First when you roll over a thumbnail of a picture it loads the larger view in a div container. That part works. But the other thing is that there is a description that goes with each picture that needs to load in a different div container. So far I get the one description loaded and then it gets stuck and the next won't load. I think I just need a little push with the type of objects and methods and such to use. I'm obviously not an experienced javascripter.</p>
<p>Thanks in advance for any suggestions you can offer</p>
<p>Sue B.</p>
| javascript | [3] |
1,653,739 | 1,653,740 | Can I cheaply call a Java method to get the current method's name? | <p>Basically I have a logging statement inside of a method. Whenever the method is called, I want to easily call the name of the method, and append it to the logging statement. This is done to minimize the number of hard coded lines in my application. Is this possible to do it cheaply?</p>
| java | [1] |
2,192,822 | 2,192,823 | java program to get the current date without timestamp | <p>I need a java program to get the <strong>current date without timestamp</strong></p>
<pre><code>Date d = new Date();
</code></pre>
<p>gives me date and timestamp
But i need only date, without timestamp. I use this date to compare with another date object that does not have timestamp. </p>
<p>on printing </p>
<pre><code>System.out.println("Current Date : " + d)
</code></pre>
<p>of d it should print May 11 2010 - 00:00:00 .</p>
| java | [1] |
5,634,624 | 5,634,625 | why is jquery easing not so smooth | <p>I have a image that I ease into view with jQuery. </p>
<pre><code><style>
#box
{
position:relative;
left:-400px;
height:50px;
width:100px;
}
</style>
$(document).ready(function()
{
var method;
$("#clickme").toggle(function()
{
method = $("#box").attr("class");
$("#box").animate({left:"50%"},{duration: 1000,easing: method});
},function()
{
method = $("#box").attr("class");
$("#box").animate({left:"-400px"},{duration: 1000,easing: method});
});
});
</code></pre>
<p>It is about 400x600px and the rendering of the image sliding in is smooth but chunky.</p>
<p>It will during the animation look like this at times:</p>
<pre><code>| |
| |
| |
| |
| |
| |
</code></pre>
<p>If | are the edges of the image.</p>
<p>Is this just because of my browsers/computers rendering capabilities?
Chrome/FF/Safari on a Netbook.</p>
| jquery | [5] |
3,843,886 | 3,843,887 | Redirecting with 404 doesnt work | <p>I havea code that should redirect in case it doesnt have some request parameter set correctly.</p>
<pre><code> if(!is_numeric($_GET['id'])){
header("HTTP/1.0 404 Not Found");
header('Location: '.$url);
exit();
}
</code></pre>
<p>Problem is that whenever I check with Firefoxes plugin, live HTTP headers, I see 302 temporary redirect. why is that? why no 404 response is given?</p>
| php | [2] |
3,307,150 | 3,307,151 | How can I display an element only if user is logged in? | <p>I am trying to display a div only if the user is logged in, therefore only if <code>$_SESSION['MM_Username']</code> exists and is equal to something so to achieve this I came up with the following code. The session variables are set and I know they exist however when I log out I still see the div: </p>
<pre><code><ul id="example-1" class="sticklr" style="list-style:none;display:<?php if ($_SESSION['MM_Username']=='' & $_SESSION['MM_Username']==NULL){echo('none');}?>">
</code></pre>
<p>How can I debug this to see whats the problem, or if someone knows a better way to display a div only if user is logged in please let me know .</p>
| php | [2] |
5,464,192 | 5,464,193 | comparing dates in php | <p>In the following php code, I am trying to show only those products from products.xml file that are stored in the last month. But my code does not work. Please help me in getting correct output. I also need to show products that are stored in the last 24 hours and last week.</p>
<pre><code>$current_month = date("m");
$last_month = date('m', strtotime(date('-m')." -1 month"));
$xml = simplexml_load_file("products.xml");
$products = array();
foreach ($xml->product as $product) {
if ($product->date('m') == $last_month) {
$products[] = array( 'name' => (string)$product->name,
'details' => (string)$video->details );
}
}
</code></pre>
| php | [2] |
2,016,733 | 2,016,734 | Creating an array in PHP | <p>If I wanted to create an array in PHP with the following format, what would be the best way to approach it? Basically I want to declare the array beforehand, and then be able to add the values to <code>person_id</code>, <code>name</code> and <code>age</code>.</p>
<pre><code>'person_id' => array('name'=>'jonah', 'age'=> 35)
</code></pre>
| php | [2] |
3,922,150 | 3,922,151 | Android - How Set a Bitmap as a facebook profile picture for logged in user | <p>I need to allow the logged in user to change his profile pic using a Bitmap that I have in the app using android development. Or how can I upload it and enter directly to the cropping page to set let the user set it his profile pic.</p>
<p>Any idea!?!?! is it possible ??</p>
<p>thank you</p>
| android | [4] |
799,596 | 799,597 | jQuery - How do I bind events to hidden elements that will be shown later? | <p>I am trying to attach 'click' events to all elements of a particular class. The problem is some of the elements are on a tab that is hidden (display: none) at the time that the event is bound. (.bind()). It seems that when these elements are shown the events are no longer bound.</p>
<pre><code>$('a.someClass').bind('click', function(){
alert("test");
});
</code></pre>
<p>The hidden elements do not appear to have a click event bound. If I select the hidden elements:</p>
<pre><code>$('a.someClass:hidden').bind('click', function(){
alert("test");
});
</code></pre>
<p>It seems the click event is not bound when these elements are no longer hidden. Has anyone experienced this? Is there a way to bind and event to elements irregardless of their display property?</p>
<p>Thanks</p>
| jquery | [5] |
2,272,523 | 2,272,524 | php registration form problem | <pre><code> $error1='';
$error2='';
$error3='';
$error4='';
$error5='';
$error6='';
$yourname='';
$email='';
$email2='';
$password='';
$password2='';
$country='';
if (isset($_POST['Registerme']))
{
$_POST['yourname']=$yourname;
$_POST['email']=$email;
$_POST['email2']=$email2;
$_POST['password']=$password;
$_POST['password2']=$password2;
$_POST['country']=$country;
if($yourname==''){
$error1='name required';
}
if($email==''){
$error2='email required';
}
if($email2==''){
$error3='required field';
}
if($password==''){
$error4='password required';
}
if($password2==''){
$error5='required field';
}
if($country==''){
$error6='country required';
}
if(empty($error1) && empty($error2) && empty($error3) && empty($error4) && empty($error5) && empty($error6))
{echo 'mysql query goes here and add the user to database';}
}///main one
else {$error1='';
$error2='';
$error3='';
$error4='';
$error5='';
$error6='';}
</code></pre>
<p>this is a registration validation script. in my registration form there are two email and password filelds.second fields are for confirmation.i want to check weather user typed same information in that both field.if i want to do that in this script should i use another if statement? or i should use else if? i am confused about that step...</p>
| php | [2] |
3,297,089 | 3,297,090 | Selecting previous label element JQUERY | <p>So I have a form;</p>
<pre><code><label for="name">Job Date</label><br /><input id="name" class="required" title="Enter a name!" name="name" type="text" />
</code></pre>
<p>and some Jquery to cycle through each input with class "required" and see if it is empty/blank and if so give this input a red border color, and also the label assosciated with it a red color;</p>
<pre><code>function checkreview()
{
var errors = "";
$(".required").each(function (i)
{
if($(this).val() == "")
{
errors += $(this).attr('title')+'<br />';
$(this).css('border-color','#FF0000');
//need to select previous label and set color to red
}
});
}
</code></pre>
<p>So I need a selector that will select the previous label and allow me to give it .css('color','FF0000').</p>
<p>Any ideas how to select the previous label in JQUERY?</p>
| jquery | [5] |
4,214,929 | 4,214,930 | Call trace in Android | <p>I want to know how to do method tracing for Android applications. I mean, a sequence of calls on each object, not a stack trace.</p>
<p>It's very similar to <a href="http://stackoverflow.com/questions/1025681/call-trace-in-java">this question (Call trace in java)</a>, but on different platforms (jvm-PC vs dvm-Android). I have no control over the start arguments of dalvik, thus I cannot specify a java agent (or am I wrong here?). Is there another way to do method tracing?</p>
<p>Thanks!</p>
| android | [4] |
5,936,524 | 5,936,525 | Chrome not detecting jquery change method for textbox | <p>I have only an alert statement in my change handler.
I referred <a href="http://stackoverflow.com/questions/7117819/jquery-change-isnt-working-in-chrome">Jquery .change isn't working in Chrome</a>, and used toUpperCase(), it still not helps :(. </p>
<p>Please suggest me other ways.</p>
<p>Here is the code:</p>
<pre><code>jQuery('#reporter').change(function(e) {
alert('hi');
this.value = this.value.toUpperCase();
});
</code></pre>
| jquery | [5] |
1,671,400 | 1,671,401 | Class reference in Java | <p>Hello Guys :D
Why can't I execute the following code withoud getting a runtime exception? How should it be rewritten? I am migrating from C++ where I could easily do that I suppose :D.</p>
<pre><code>class MyJavaClass {
public static void main(String args[]) {
Dog bushui_RIP = new Dog();
Dog fellow = null;
bushui_RIP.bark(fellow);
fellow.bark();
}
}
class Dog {
public void bark(Dog buddy) {
buddy = this;
}
public void bark() {
System.out.println("I am barking!!!");
}
}
</code></pre>
| java | [1] |
5,904,122 | 5,904,123 | How an embeded image be sent from an Android email client? | <p>I have to embed an image from SD card in the email and send it.I am trying with HTML tags but its not working.can anyone help me?</p>
| android | [4] |
4,339,587 | 4,339,588 | is it possble to retreive page source from google search automatically by using java program? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2156111/java-program-to-retreive-page-source-from-google-search-automatically">java program to retreive page source from google search automatically</a> </p>
</blockquote>
<p>hi friends,
I just give any word in google search and search the output for that particular word. I want java program to retrieve page source from google search automatically for that particular word. Its very urgent. Give any suggestions. Thanks</p>
| java | [1] |
564,096 | 564,097 | c++ int to string | <p>I am trying to convert int to string and after that merge string with the new string from int.
Like it is done in this example a_http://www.cplusplus.com/forum/beginner/1057/</p>
<p>Any hints what did i mess up?</p>
<p><a href="http://img571.imageshack.us/img571/6027/001kb.jpg" rel="nofollow">http://img571.imageshack.us/img571/6027/001kb.jpg</a></p>
| c++ | [6] |
5,026,659 | 5,026,660 | MediaRecorder.setMaxDuration(int timer) what happens when timer expires | <p>According to the documentation, <a href="http://developer.android.com/reference/android/media/MediaRecorder.html#setMaxDuration(int" rel="nofollow">http://developer.android.com/reference/android/media/MediaRecorder.html#setMaxDuration(int</a>)</p>
<p>the recording stops when the timer expires. </p>
<p>By stop, do they mean it calls internally recorder.stop() and then restores the state the app was in before calling recorder.start()?</p>
| android | [4] |
1,800,770 | 1,800,771 | Can someone explain what the third expression in python's indexing syntax represents? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/509211/good-primer-for-python-slice-notation">Good Primer for Python Slice Notation</a> </p>
</blockquote>
<p>I first ran across it last night for reversing a string <code>"Hello"[::-1]</code> and I can't figure out how it actually works.</p>
<pre><code>"Hello"[::-1] # returns "olleH"
[1,2,3,4,5][::-1] # returns [5,4,3,2,1]
"Hello"[1:5:1] # returns "ello"
"Hello"[1:5:2] # returns "el"
</code></pre>
<p>My searches for "third expression in python index" have come up empty. What is this expression and how does it work. Obviously ::-1 reverses the list but I can't figure out what the other, positive values represent.</p>
| python | [7] |
5,156,857 | 5,156,858 | Marshal exception in JAVA RMI | <p>What could be the possible reasons that may cause MARSHAL exception in <code>JAVA RMI</code>.
i cant share my code (its a long code)..
Thanks in advance..</p>
| java | [1] |
2,393,760 | 2,393,761 | How to Load ID and Name parallely to One combo box at same time in C# .net | <p>I want answer in C# language and .Net framework </p>
| c# | [0] |
5,242,683 | 5,242,684 | Disable ListView Scrolling to Top | <p>I have a listview to which items are added dynamically to the top of the list. I show some latest events occurring at the top of the list. The problem is, these events occur very frequently, like 5 events in a second. This makes the list go down. Suppose user is looking at one event, then when new event occurs it pushes the event he was reading below, and that disappears. I want the new events to be added at the top but it should be shown only when he scrolls up. I call notifydatasetchanged on the adapter once new events occur and this pushes the list down. Is there anyway I can freeze the scrolling. I tried to disable the scrolling by setTranscriptMode. But it doesn't seem to help. Kindly give me some hints and point me </p>
| android | [4] |
1,416,540 | 1,416,541 | How can I remove added points from field? | <p>I can add points in the field but I cannot remove them. This is the code I am currently using:</p>
<pre><code>public class Vertex
{
public Point p { get; private set; }
public int ident {get; private set; }
public int dist { get; set; }
public Vertex(Point p, int ident)
{
this.p = p;
this.ident = ident;
}
}
</code></pre>
| c# | [0] |
1,723,216 | 1,723,217 | Call break in nested if statements | <p>I have the following situation:</p>
<pre><code>IF condition THEN
IF condition THEN
sequence 1
ELSE
break //?
ENDIF
ELSE
sequence 3
ENDIF
</code></pre>
<p>What is the result of the break statement? Does it break the outer if statement? Because this is what I actually need.</p>
| javascript | [3] |
5,464,314 | 5,464,315 | PHP error - cannot redeclare function | <p>I have a JavaScript function making a call to a PHP script. So far so good. A problem happens when I try to do this:</p>
<pre><code>$hike_id = mysql_real_escape_string($_GET['hike_id']);
</code></pre>
<p>When I import my connection file, it gives me an error that the functions in that file have already been defined and the error is this:</p>
<pre><code>[Fri Jun 10 12:34:43 2011] [error] [client 75.24.105.18] PHP Fatal error: Cannot redeclare hassuspicioushackerstrings() (previously declared in /home/webadmin/comehike.com/html/connect.php:16) in /home/webadmin/comehike.com/html/connect.php on line 40
</code></pre>
<p>The error it is referring to is a function that is in the connect script.</p>
<p>But if I remove the </p>
<pre><code>include '../connect.php';
</code></pre>
<p>Then it will just tell me that I can not use the mysql_real_escape_string function. So I am kind of stuck between not being able to use either option.</p>
| php | [2] |
4,742,371 | 4,742,372 | Android Bluetooth extend signal range | <p>Is there any possibility to extend the bluetooth signal strength from default discoverable devices. I need to find and pair the device available at certain xx distance.So i need to connect the devices with some boost up mechanism.Whether the the android bluetooth allows to achieve signal boost up.</p>
| android | [4] |
922,883 | 922,884 | PHP function unique_id(), where can I see the code for the function? | <p>I couldn't find the actual function's code as I am interested in how it creates the id, e.g. where it gets the time from.</p>
| php | [2] |
5,815,855 | 5,815,856 | PHP within .JS file | <p>I would love to post some starting code in this question, but to be honest, I' stumped.</p>
<p>I'm looking for a way to use PHP within my .JS file.</p>
<p>I would like to be able to use real PHP functions inside my "stuff.js" and then be able to include it using:</p>
<pre><code><script type="text/javascript" src="whatever.js"></script>
</code></pre>
<p>Any thoughts? Thanks.</p>
| php | [2] |
5,050,161 | 5,050,162 | Open Multiple Windows via PHP | <p>fairly simple question and I haven't seen anything asked with this exact scenario laid out.</p>
<p>I have a form on a page. "Page 1"
The form's action is calling a PHP document, and the target is set to _blank. "Page 2"
The PHP document processes the information, then sets the header info to a specific page. "Action 1"</p>
<hr>
<p>I would like for "Action 1" to instead open multiple pages; I know of several ways to do this via javascript, however, I would like to stay entirely within the PHP file if at all possible.</p>
| php | [2] |
5,274,839 | 5,274,840 | How do I loop through all dynamically created radiobuttons and how do I identify them? | <p>I've got an app that dynamically adds radiobuttons from json data. I don't really know how to find out which ones are selected though. There are the <code>radioButton.isSelected()</code> and the <code>radioGroup.getCheckedRadioButtonId()</code> but since it's dynamically created I cannot use names for all the objects.</p>
<p>Is there a way to add them to a group upon creation and cycle through all of them later? I've got multiple radiogroups and not all of them but most are supposed to be checked. </p>
<p>I'm using api lvl 7 (2.1) and I'm fairly new to this. Please explain in detail.</p>
| android | [4] |
3,614,097 | 3,614,098 | Accessing a class member variable of type Array using __get or similar | <p>Previously a class which I'm now rebuilding had a member variable <code>$settings</code> which was an array of settings, strangely enough.</p>
<pre><code>class MyClass {
public $settings = array();
public function __construct() {
if( empty( $this->settings ) ) {
$this->settings = require( 'settings.php' ); // e.g. return array('setting1'=>4);
}
}
}
</code></pre>
<p>These settings were accessed by <code>$object->settings['keyname'];</code></p>
<p>The means by which these keys are accessed has been moved into a method now. However, the application itself is riddled with calls to <code>$object->settings['keyname']</code>. I was wondering is there a way which I can catch any calls to the <code>$settings</code> member variable and return it using the new function.</p>
<p>I've looked at <code>__get($name)</code> but <code>$name</code> only contains <code>settings</code> rather than the array key which I need. What I'd need to pass would be the keyname to the my <code>$object->get()</code> method.</p>
<p>The reason I want to do this is so that I can trigger errors in a log file showing me where the deprecated calls to <code>$object->settings[]</code> are without breaking the application. Obviously setting $setting to private would give me lots of fatal errors and I could work through but there are multiple developers working on this codebase which I'd prefer not to break. If I could implement this as a temporary solution it'd help.</p>
<p>I realise there are repositories etc which we could use so that I could work on it separately and check it in afterwards but I'm looking for a quick, temporary solution as we're porting our codebase to Git soonish.</p>
| php | [2] |
2,058,180 | 2,058,181 | jQuery Select first and second td | <p>How can I add a class to the first and second td in each tr?</p>
<pre><code><div class='location'>
<table>
<tbody>
<tr>
<td>THIS ONE</td>
<td>THIS ONE</td>
<td>else</td>
<td>here</td>
</tr>
<tr>
<td>THIS ONE</td>
<td>THIS ONE</td>
<td>else</td>
<td>here</td>
</tr>
</tbody>
</table>
</div>
</code></pre>
<p>For the first td, this does nothing?</p>
<pre><code>$(".location table tbody tr td:first-child").addClass("black");
</code></pre>
<p>Can I also use second-child?</p>
| jquery | [5] |
2,526,012 | 2,526,013 | Compile both 32 and 64 bit from the same projects? | <p>I am using Pcapdot.Net DLLs, both 32 and 64 bit.
Is it possible to create one project with 32 and 64 DLLs so that after compiling it will create 2 different EXE files for 32 and for 64 bit?</p>
| c# | [0] |
5,669,494 | 5,669,495 | i have some problem with left join JPQL | <p>there is something wrong with ths way i use left join,
and i dont understand what am i doing wrong.</p>
<p>can you see it?</p>
<pre><code>select distinct r.globalRuleId,
r.ruleId,
sv.validFrom,
pm.moduleId,
nvl(min(rai.failedOnRegistration),0)
from TRules r,
TSlaVersions sv,
TModuleFormulas mv,
TPendingModule pm,
left join TRulesAdditionalInfo rai on r.ruleId = rai.ruleId
where r.slaVersionId = sv.slaVersionId
and r.formulaId = mv.pk.formulaId
and mv.pk.moduleId = pm.moduleId
group by r.globalRuleId,
r.ruleId,
sv.validFrom,
pm.moduleId
order by pm.moduleId
</code></pre>
| java | [1] |
3,559,865 | 3,559,866 | Unknown Java Result Message | <p>I was running a code to retrieve XML documents from the web and simultaneously parsing them to extract some information. I was doing it for about 5000 documents. After a certain point the code hung up. The process had not completed. So I stop it and got the following message. </p>
<pre><code>`Java Result: 2147483647`
</code></pre>
<p>What does it mean? Thanks</p>
| java | [1] |
2,574,792 | 2,574,793 | Error in Switch cases of ZXing project in android | <p>I have downloaded the ZXing project from the <a href="http://code.google.com/p/zxing/downloads/detail?name=ZXing-2.0.zip&can=2&q=" rel="nofollow">http://code.google.com/p/zxing/downloads/detail?name=ZXing-2.0.zip&can=2&q=</a> and followed all the steps of <a href="http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/" rel="nofollow">http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/</a>.</p>
<p>But my ZXing project is giving error in switch cases of ZXing Library.</p>
<p>Error is in following code </p>
<pre><code>private final Handler handler = new Handler() {
@Override
public void handleMessage(Message message) {
switch (message.what) {
case R.id.search_book_contents_succeeded:
handleSearchResults((JSONObject) message.obj);
resetForNewQuery();
break;
case R.id.search_book_contents_failed:
resetForNewQuery();
headerView.setText(R.string.msg_sbc_failed);
break;
}
}
};
</code></pre>
<p>error is in switch statement
error is "<strong>case expressions must be constant expressions</strong>"</p>
<p>Any Idea ? Thanxs </p>
| android | [4] |
2,714,807 | 2,714,808 | Update pre-compiled files in ASP.NET | <p>After publishing asp.net web site, I got mant ASP_Web_xxxxx.dll.
After deploying these files to production server, <strong>how do I know which file to be replaced</strong>, if I modify one codebehind or .aspx file and re-publishing the web site?</p>
<p>Thanks.</p>
| asp.net | [9] |
3,792,173 | 3,792,174 | smtp server authentication | <p>I am new with php.my website is hosted on plesk server.mail function does not work properly.when submitted the form A warning occured :smtp server authentication required in mail().How can i remove it.</p>
| php | [2] |
835,646 | 835,647 | How to render Html to image format? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/334532/render-html-as-an-image">Render HTML as an Image</a> </p>
</blockquote>
<p>I have the the html "My test Text"
Now I want to render this html to image format.
I have the code which render teh simple text to image . I want to render html with style implemented on it in a image format.
How can I do it in C#?
is there any way without using the third part software.</p>
<p>Thanks
Dalvir</p>
| asp.net | [9] |
5,176,677 | 5,176,678 | How to display a button on page after a period of time in ASP.NET? | <p>I want the button to display exactly 2 minutes after the page loads. Is this possible?</p>
| asp.net | [9] |
4,017,595 | 4,017,596 | continued : unable to post fields to the next page in php and HTML | <p>So I have fields that are generated dynamically in a different page and then their results should posted to <code>story.php</code> page. fields is going to be : <code>*noun1 *noun2 *noun3</code> and story is going to be : somebody is doing *noun1 etc. What I want to do is to replace <code>*noun1</code> in the story with the <code>*noun</code>, I have posted from the previous page ( I have <code>*noun1</code> posted from the previous page ) but the code below is not working :</p>
<pre><code>$fields = $_POST['fields'];
$story = $_POST['story'];
$fieldsArray = split(' ', $fields);
for ($i = 0; $i < count($fieldsArray); $i++) {
${$fieldsArray[$i]} = $_POST[$fieldsArray[$i]];
}
// replace words in story with input
for ($i = 0; $i < count($story); $i++) {
$thisWord = $story[$i];
if ($thisWord[0] == '*')
$story[$i] = ${$thisWord.substring(1)};
}
$tokensArray = split(' ',$tokens);
echo $story;
</code></pre>
| php | [2] |
1,917,624 | 1,917,625 | Random.nextFloat is not applicable for floats? | <pre><code>float minX = 50.0f;
float maxX = 100.0f;
Random rand = new Random();
float finalX = rand.nextFloat(maxX - minX + 1.0f) + minX;
</code></pre>
<p>"The method nextFloat() in the type Random is not applicable for the arguments (float)"</p>
<p>Um, what?</p>
| java | [1] |
235,505 | 235,506 | How do you shuffle a non-standard deck of cards? | <p>I am making a program to play a game of UNO. In the UNO deck, some cards are repeated, and therefore I cannot just make a list of integers; I have to use objects. I plan on using a LinkedList for the deck, but I am aware that shuffles on a LinkedList are horridly slow. </p>
<p>My question is, should I....</p>
<ol>
<li>Avoid a LinkedList entirely and just go with an ArrayList</li>
<li>Use an ArrayList or similar, shuffle, then put the contents into the LinkedList</li>
<li>Construct an ArrayList, then make my own shuffling routine (aka not using Random) that adds to the LinkedList as we go</li>
<li>Shuffle the LinkedList anyway (as in, it's not really that bad)</li>
</ol>
<p>This is not for homework; it is to assist in having fun :)</p>
| java | [1] |
4,641,221 | 4,641,222 | Can I iterate through an array in C# using something like a foreach | <p>I would like to do something like a foreach on an array of strings. I know I can do it with a for loop and incrementing but just wondering if there is something similar to the foreach:</p>
<pre><code>foreach (var test in testlist)
</code></pre>
<p>Thanks </p>
| c# | [0] |
3,636,887 | 3,636,888 | Need in String that contain few word that each first letter of the word will be upper case | <p>I have a String that contain few word i need that each first letter of the word will be upper case </p>
<p>Example:
String Name= "jean cristoff";</p>
<p>result:
Jean Cristoff</p>
<p>how can i do that?</p>
<p>Thanks for helping!!</p>
| java | [1] |
899,802 | 899,803 | auto suggest/ auto complete in a textarea | <p>I have a small requirement like . i need to fetch all record from table or store elements in key=>value pair. so that when a user types in the key . it should show the value part of it and if he presses enter button ,it should use it or else continue with typing. I need to use jquery framework.</p>
<p>Is there any plugin already available for it . or how do i do it.</p>
<p>ex : bp => blood pressure.</p>
| jquery | [5] |
3,206,217 | 3,206,218 | want a ImageView to come from upside down | <p>i have a window and a imageview in it and i want the <code>imageview</code> to come from upside down animated effect how i do that</p>
<pre><code>ImageView img_sliding=(ImageView)findViewById(R.id.img_sliding);
</code></pre>
| android | [4] |
162,001 | 162,002 | PHP: Shorten URL by cutting it from the center? | <p>i've seen in many forums that they cut the url from the center and add 3 dots if it's long in order to shorten it.</p>
<p>Example: <a href="http://stackoverflow.com/questions/1899537/ajaxify-multipart-encoded-form-upload-forms">http://stackoverflow.com/questions/1899537/ajaxify-multipart-encoded-form-upload-forms</a> ---Will be---> <a href="http://stackoverflow.c...ed-form-upload-forms" rel="nofollow">http://stackoverflow.c...ed-form-upload-forms</a></p>
<p>How to do that using pure php?</p>
<p>Thank you</p>
| php | [2] |
4,860,253 | 4,860,254 | Low Autocorrelation Binary Sequence problem? Python troubleshooting | <p>I'm trying to model this problem (for details on it, <a href="http://www.mpi-hd.mpg.de/personalhomes/bauke/LABS/index.php" rel="nofollow">http://www.mpi-hd.mpg.de/personalhomes/bauke/LABS/index.php</a>)</p>
<p>I've seen that the proven minimum for a sequence of 10 digits is 13. However, my application seems to be getting 12 quite frequently. This implies some kind of error in my program. Is there an obvious error in the way I've modeled those summations in this code?</p>
<pre><code>def evaluate(self):
self.fitness = 10000000000 #horrible practice, I know..
h = 0
for g in range(1, len(self.chromosome) - 1):
c = self.evaluateHelper(g)
h += c**2
self.fitness = h
def evaluateHelper(self, g):
"""
Helper for evaluate function. The c sub g function.
"""
totalSum = 0
for i in range(len(self.chromosome) - g - 1):
product = self.chromosome[i] * self.chromosome[(i + g) % (len(self.chromosome))]
totalSum += product
return totalSum
</code></pre>
| python | [7] |
1,859,354 | 1,859,355 | Is there a certain size of the uniqid function? | <p>I'm just wondering, does anyone know, whether uniqid function in PHP has a certain size? And If so, how many strings is it? I'm a bit confused as PHP manual says, that uniqid is 23 characters long when extended entropy used. But based on my observation, it varies between 26 to 28 characters.</p>
| php | [2] |
5,230,396 | 5,230,397 | Content of a .aspx file replaced by clinet side HTML | <p>I have hosted a site on server. Problem is, content of a particular .aspx file (index.aspx/content.aspx) is periodically replaced by clinet side HTML code(the source we see in browser by right click>view source).</p>
<p>What can be reason behind this?</p>
<p>Thanks</p>
<p>Suren </p>
| asp.net | [9] |
2,471,504 | 2,471,505 | Saving program working data | <p>When the program runs, the intermediate data must save in the user's computer.</p>
<p>Now I use .txt files, encoding with AES.</p>
<p>But file/code user can break, delete....</p>
<p>Maybe is better decision?</p>
| c# | [0] |
2,308,417 | 2,308,418 | formating text from database | <p>I had Datalist which retrieve aportion of atext from database and this text must be format .as if there is (.) .it started in new line.
So how can I do that?</p>
<pre><code><asp:DataList ID="DataList1" runat="server">
<ItemTemplate>
<div class="scrollerDiv_open_about m10 ad_mun_font">
<asp:Image ID="Image1" runat="server" ImageUrl='<%#Eval("Id","~/Handlers/AboutUsImage.ashx?Id={0}") %>'
Width="178" Height="115" Style="float: left; padding: 10px 10px 0 10px" />
<span class="ad_mun_font_h"><asp:Label
ID="LblHeader" runat="server" Text='<%# Eval("Header") %>'></asp:Label></span>
<p>
<asp:Label ID="LblText" runat="server" Text='<%# Eval("Text") %>'></asp:Label>.</p>
</div>
</ItemTemplate>
</asp:DataList>
</code></pre>
| c# | [0] |
3,963,363 | 3,963,364 | Find node with lowest numeric value in array | <p>I have this following array output:</p>
<pre><code>Array (
[0] => SimpleXMLElement Object ( [0] => 32.4 km )
[1] => SimpleXMLElement Object ( [0] => 10.2 km )
[2] => SimpleXMLElement Object ( [0] => 205 km )
[3] => SimpleXMLElement Object ( [0] => 50.8 km )
)
</code></pre>
<p>I am trying to get the shortest distance from a particular address and from this result the shortest is 10.2 km. How can I compare all the km distance and just display the one with the smallest number?</p>
<p>My main goal here is the get the shortest distance based on this array result.</p>
| php | [2] |
5,530,282 | 5,530,283 | No Appropriate Default Constructor For Node struct (C++ Syntax) | <p>No error</p>
<pre>
// list.h
//...
list::node::node(const winery &winery)
{
}
void list::insert(const winery& winery)
{
//const char *Names = winery.getName();
node *new_node = new node( winery );
}
</pre>
<p>Adding the list::node::node(const winery &winery ) function
to the list.cpp file enables allocation of the node.</p>
<p>however, it forces me to add a dfault constructor to the winery class:</p>
<pre>
class winery
{
public :
winery(const char * const name, const char * const location,
const int acrces, const int rating);
winery();
virtual ~winery(void);
//...
</pre>
<p>And thereby havinvg to provide the body of the default ctor.
Is there a way to have it work without declaring and defining a default ctor to the winery class?</p>
| c++ | [6] |
5,085,945 | 5,085,946 | Initializing table with variable argument list | <p>In my code I want to be able to do</p>
<pre><code>Table<double> tbl;
tbl.Create(2, 2, 1.0, 2.0, 3.0, 4.0);
</code></pre>
<p>and via the constructor too</p>
<pre><code>Table<double> tbl(2, 2, 1.0, 2.0, 3.0, 4.0);
</code></pre>
<p>From my experience the use of ellipses (...) leads to several hard to trace bugs, so I've come up with the following to initialize my table:</p>
<pre><code>void Create(size_t rows, size_t columns, T val0)
{
ASSERT(rows * columns == 1);
Create(rows, columns);
_data[0] = val0;
}
void Create(size_t rows, size_t columns, T val0, T val1)
{
ASSERT(rows * columns == 2);
Create(rows, columns);
_data[0] = val0;
_data[1] = val1;
}
void Create(size_t rows, size_t columns, T val0, T val1, T val2)
{
ASSERT(rows * columns == 3);
Create(rows, columns);
_data[0] = val0;
_data[1] = val1;
_data[2] = val2;
}
</code></pre>
<p>I think you get the idea. However, this becomes rather annoying if I want functions for say up to 50 elements. Not to mention the fact I'll have to write all these constructors too. Isn't there another way to handle this more elegantly?</p>
<p>EDIT: Maybe I should explain why I don't want to use ellipses (...) in this case. Let's consider the following code:</p>
<pre><code>Table<double> tbl(2, 2, 1.5, 2.1, 3, 4.5);
</code></pre>
<p>The compiler interprets the 5th argument as type <code>int</code> and this is clearly not intended.</p>
| c++ | [6] |
5,127,048 | 5,127,049 | javascript - Closed tab automatically for all browser | <p>I want to closed browser tab after pop up 'Thank you' disappeared.</p>
<pre><code><script language='javascript'>
alert('Thank you.');
window.close();
</script>
</code></pre>
<p>But It didn't works. Why???</p>
<p>Please to help.</p>
<p><strong>Noted: Support for all web browser.</strong></p>
<p>Thanks</p>
| javascript | [3] |
3,262,747 | 3,262,748 | jQuery: Trying to display a box when hovering over an image | <p>I have a JSFiddle up and running that displays what I'm trying to accomplish: <a href="http://jsfiddle.net/qnWpy/8/" rel="nofollow">http://jsfiddle.net/qnWpy/8/</a></p>
<p>The bug I'm running into here is that when ever the mouse is hovering over the .description class the box shows and then disappears. I suspect this happens because at the time I am hovering over the .description class and there is no jQuery code connected to it. How can I get rid of this bug?</p>
| jquery | [5] |
3,082,017 | 3,082,018 | Implementing SSO between 3 websites | <p>I am sorry if this question has already been asked, I couldn`t find it.</p>
<p>My organization has two websites:</p>
<ol>
<li>www.abc.com</li>
<li>www.abc.online-rewards.com</li>
</ol>
<p>User starts by logging in to www.abc.com and for going to the other website (www.abc.online-rewards.com), the user has to log in again. I want to eliminate this issue by creating a dashboard (dashboard will display employees info and his rewards, so that they can be redeemed through second website).</p>
<p>Can anybody help me with this issue. Any help will be much appreciated.</p>
| c# | [0] |
2,531,697 | 2,531,698 | Redirect to Home page if user already logged in, in same browser asp .net c# | <p>I want to make application that if user in logged in the web site in one tab of browser and if he open application in second tab than he should not redirect to login page but he should redirect to Home page. just like Facebook or yahoomail in asp.net C#</p>
<p>please help</p>
| asp.net | [9] |
755,875 | 755,876 | how to detect logout of asp.net 4 session | <p>How do you detect when a user logs out using the ASP.Net 4 session management? I have a site that is using the <LoginTemplate> with a <LoginStatus> control. When the user clicks the "Log out" link, it should fire the LoggingOut event of the LoginStatus, but I cannot get it to do so. Is there another way to detect when the user logs out of the application? Session_End isn't being fired because the session itself is still valid, just that the user isn't logged in.</p>
| asp.net | [9] |
2,046,617 | 2,046,618 | Stripping Comments out of a file in PHP | <p>I have to parse various files that contain comments of differing types. I have been trying to figure an easy way to strip out these comments, but nothing good so far. I have full line comments that start with both # and ; and comments that start after relevant data. Best example:</p>
<pre><code>data
data
#comment
;comment
data ;comment
data #comment
</code></pre>
<p>Any help in stripping these comments? And perhaps blank lines as well?</p>
| php | [2] |
4,721,911 | 4,721,912 | Partial Interface in C# | <p>Does C# allows partial interface? i.e., in ManagerFactory1.cs class, I have </p>
<pre><code>public partial interface IManagerFactory
{
// Get Methods
ITescoManager GetTescoManager();
ITescoManager GetTescoManager(INHibernateSession session);
}
</code></pre>
<p>and in ManagerFactory.cs class, I have:</p>
<pre><code>public partial interface IManagerFactory
{
// Get Methods
IEmployeeManager GetEmployeeManager();
IEmployeeManager GetEmployeeManager(INHibernateSession session);
IProductManager GetProductManager();
IProductManager GetProductManager(INHibernateSession session);
IStoreManager GetStoreManager();
IStoreManager GetStoreManager(INHibernateSession session);
}
</code></pre>
<p>Both ManagerFactory and ManagerFactory1 are located in the same assembly. </p>
| c# | [0] |
6,024,567 | 6,024,568 | Is it possible to use a dedicated IP as source IP? | <p>The title may sound a bit odd but I wanted to keep the title short.</p>
<p>So I have here a Socket which connects to some server for testing purpose.</p>
<p>Now when I get the IP from the client socket (server side) it will give me one IP (external one).</p>
<p>But I have another IPv4 dedicated IP, can I use that as source?</p>
| java | [1] |
5,902,062 | 5,902,063 | Should I check internet connection everytime I call a webservice? | <p>I just want to know the best practise to test internet connection availability.<br>
My application uses internet connection for everything.<br>
If I am checking every time that google.com is available or not then definitely I am causing a delay to user to fetch his data every time he is making a request to my server.</p>
<p>So my question is should I check connection availability every time I make a web service request or I should use some kind of global internet checker which should keep the state of internet connection in a particular time period? </p>
<p>Thank you very much.</p>
| iphone | [8] |
863,514 | 863,515 | C# Random Numbers | <p>Ok, So Im using <code>int indexSelector = RandomNumber(1, 14);</code> to create a random number and pull the matching index out of an array. But it seems to only be calling 3 or 4 numbers. Like the items being pulled out are very similar. </p>
<p>Whats going on?</p>
| c# | [0] |
2,375,736 | 2,375,737 | start application knowing package name | <p>Can someone tell me how to start new application knowing only its package name? I do not have information about what activity is the main one.</p>
| android | [4] |
6,818 | 6,819 | Unsure how to write method in Java like template in c | <p>I want to implement a function with signature</p>
<pre><code>static boolean checkAnyOutOfBoundary(int[] index,ArrayList<ArrayList<T>> list)
</code></pre>
<p>Where I want to substitute T with other self-created class(DocScore). I tried to substitute T with Object. But when I try to instantiate the list instance, like</p>
<pre><code>ArrayList<ArrayList<Object>> DocScoreList = new ArrayList<ArrayList<Object>>();
for (int i = 0; i < index.length; i++)
DocScoreList.add(root.children.get(i).docList);
The type of root.children.get(i).docList is ArrayList<DocScore>
</code></pre>
<p>I can not add element into DocScoreList. Does anybody know how can I implement this?</p>
| java | [1] |
2,714,017 | 2,714,018 | Strategy to keep csv string and Dictionary<string,string> synchronized at all times | <p>If I have a comma separated list string property:</p>
<pre><code>"age:123,name:john,last:doe"
</code></pre>
<p>And another property of Dictionary type.</p>
<p>How could I keep both of these properties synchronized such that added to either one will update the other.</p>
<p>example:</p>
<pre><code>obj.CsvString += "address:123 drive";
</code></pre>
<p>or</p>
<pre><code>obj.SomeDic.Add("address", "123 drive");
</code></pre>
<p>How could I do this? Should there be other methods to adding/removing?</p>
| c# | [0] |
5,569,797 | 5,569,798 | open a downloaded pdf file in a new window | <p>When I was using the below code for downloading apdf file, a dialog box will appears having open,save,and cancel buttons. If I click 'open' button,the pdf file will be opened in the same window.</p>
<pre><code>{
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", string.Concat("inline;filename= " + filename + ""));
Response.TransmitFile("D:\\local\\Projects\\intranet\\Intranet\\Intranet\\Intranet\\PaySlip\\" + filename + ".pdf");
Response.End();
}
</code></pre>
<p>Now,how can I opened the pdf file in a new window? Can I opened the file in another window by changing the code?</p>
<p>Please help me..</p>
| c# | [0] |
2,301,163 | 2,301,164 | jQuery not recognizing scroll trigger | <p>Ok so I have the most simple script..</p>
<pre><code>$('#feed').scroll(function() {
alert('works');
});
#feed
{
width:339px;
padding-left:10px;
float:right;
font-size:12px;
min-height:400px;
height:100%;
max-height:400px;
background-image:url('pics/fbfeedback.png');
background-position:0 0;
background-repeat:no-repeat;
overflow:auto;
}
</code></pre>
<p>But it just won't trigger, I can't wrap my mind around it.
It works when I do line
alert('works');
On first row so the script is included correctly.
It just wont trigger the event..I have no error in console either.
I've set the breaking point to row one, and changed the #feed to window, still wont trigger...
Im going crazy, it has to be a really small error.</p>
| jquery | [5] |
142,393 | 142,394 | Directory Permission Watcher in c# | <p>I have created the program which is monitoring a directory (e.g. <code>\\server\share\folderXYZ</code>) for changed events (like created, deleted, renamed and permission changes). I also got the notification if anything changed but I can't get exact details what has changed.</p>
<p>For example I have changed the permission for above directory from folder properties (Properties -> Security -> Edit ->Add new user or group or change permission for user and groups). File system watcher give notification if something changed but I can't get other details like:</p>
<ol>
<li>For which user permission has changed?</li>
<li>Who changed the user permissions?</li>
<li>If any new group has been added(need to get all users in the group if new group added)?</li>
<li>If any new user is added to group and who added and need to get added user details?</li>
<li>If any user or group is removed than removed group or user details?</li>
<li>If any permission is added or changed for user than what permission are added or changed?</li>
<li>If any permission are changed for group than what permission changed?</li>
</ol>
<p>Example Scenarios:</p>
<p>Action: At 11am, the Admin added User A to Trainees (Existing group)</p>
<p>Expected Result:<br>
Access to <code>\\server\share\folderXYZ</code> changed: <code>User A</code> now has Read access, given by Admin at 11am, because he is now member of Trainees, which has Read Access.</p>
<p>Hope question is clear. I have done lots of search and couldn't find the solution. Please let me know if any API or Service available or any alternatives available?</p>
<p>-Thanks</p>
| c# | [0] |
4,487,193 | 4,487,194 | non static variable data_in cannot be referenced from a static context | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2559527/non-static-variable-cannot-be-referenced-from-a-static-context-java">non-static variable cannot be referenced from a static context (java)</a> </p>
</blockquote>
<p>i got the above error while compiling the following java code.
i am new to this language and i am not so sure about the code.i can clear normal errors but this one i dont understand what it is.please help me</p>
<pre><code>public class Kari_Server
{
ServerSocket server_socket=new ServerSocket(666);
Socket soc=server_socket.accept();
DataInputStream data_in=new DataInputStream(soc.getInputStream());
DataOutputStreamdata_out=newDataOutputStream(soc.getOutputStream());
int a=1;
int i;
public void screen()throws Exception
{
Robot robo=new Robot();
BufferedImage screen_shot=robo.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
ImageIO.write(screen_shot,"JPG",new File("C:\\windows\\temp\\screen_shot"+a+".jpg"));
FileInputStream file_in=new FileInputStream("C:\\windows\\temp\\screen_shot"+a+".jpg");
byte[] mybyte=new byte[1024];
try
{
while((i=file_in.read(mybyte))>-1)
data_out.writeUTF(mybyte,0,i);
}
catch(Exception e) {}
}
public static void main(String args[])throws Exception
{
Kari_Server kari=new Kari_Server();
while(true)
{
String s1=" ";
s1=data_in.readUTF();
if(s1=="attack")
kari.screen();
else
System.exit(0);
}
}
}
</code></pre>
| java | [1] |
3,708,317 | 3,708,318 | how to make a pop-out for printing? | <p>Need to make a function that would open a popout with a div inheriting innerhtml from another div on that page.</p>
<p>For example, the initial div might have some sort of a table, therefor when the user presses the print button, this div would open in a new popout. :)</p>
<p>EDIT:</p>
<p>Thanks, got it working!</p>
<pre><code>function opentrint( ) {
var $toprint = $('#divToPrint').html();
myWin=window.open('','myWin','menubar,scrollbars,left=30px,top=40px,height=400px,width=600px');
myWin.document.write($toprint);
}
</code></pre>
| jquery | [5] |
5,000,798 | 5,000,799 | How to display float values like $0.00 in textfield in iphone? | <p>Im new to iphone, i have one textfield, when i click custom number button the value will print in the textfield, If i enter a value in textfield Example(1234), but i want float value like 0.00. how?</p>
<p>Example</p>
<p>text1.text = [[NSString alloc] initWithFormat:@"%@%d", text1.text, num.tag]; </p>
<p>1234</p>
| iphone | [8] |
5,728,850 | 5,728,851 | Is assigning a reference to a reference a valid operation? | <p>I have the following code:</p>
<pre><code>void cStatisticDBSerializer::GetStats (std::map <std::string, long long >& ioCounterStats,
std::map <std::string, long long >& ioGaugeStats,
bool iSwitch)
{
// Before getting the stats, clear the containers
ioCounterStats.clear ();
ioGaugeStats.clear ();
std::map <std::string, long long >& lStats = ioCounterStats;
if (iSwitch)
{
lStats = ioGaugeStats;
}
// Do something with lStats
}
</code></pre>
<p>The question is: Is it valid to assign the function input reference to the local variable lStats? For some reason, this compiles fine, but does not behave as expected. However, if I change lStats to a pointer and assign it as follows (e.g.):</p>
<pre><code>std::map <std::string, long long >* lpStats = &ioCounterStats;
</code></pre>
<p>It works just fine. </p>
<p>Could somebody please explain what's going on here. Thanks!</p>
| c++ | [6] |
2,410,221 | 2,410,222 | return or print in __str__ method in python | <p>In the multiple choice question I'm stucked in, there are three options.
Here goes the question:</p>
<p>Which of the following is a definition of the _<em>str</em>_method?</p>
<pre><code>1. def __str__(self):
print "(%s, %s, %s)" % (self._n, self._p, self._b)
2. def __str__(self):
return "(%s, %s, %s)" % (self._n, self._p, self._b)
3. Both
</code></pre>
<p>I tested both of them, and both worked, but it is said that (2) is the answer.</p>
<p>The answers of all other similar questions also say that the function with 'print' is not the right one.</p>
<p>Is the answer wrong? </p>
<p>Thanks</p>
| python | [7] |
1,291,970 | 1,291,971 | What's the fastest selector | <p>Just trying to improve my selector. I have a lot of rows, but i need to exclude rows that has "table_row valuetemplate" class.</p>
<pre><code><table>
<tr class="table_row"></tr>
<tr class="table_row"></tr>
<tr class="table_row"></tr>
<tr class="table_row valuetemplate"></tr>
</table>
</code></pre>
<p>I know this very fast :</p>
<pre><code>$(".table_row")
</code></pre>
<p>This one is much slower:</p>
<pre><code>$(".table_row:not(.valuetemplate")
</code></pre>
<p>Is this the only way to exclude?</p>
| jquery | [5] |
4,250,278 | 4,250,279 | Datalist paging in asp.net? | <p>In asp.net Web application, i write code for datalist paging like this :</p>
<pre><code>PagDat = new PagedDataSource();
PagDat.AllowPaging = true;
PagDat.PageSize = 10;
PagDat.CurrentPageIndex = **currentpage**;
PagDat.DataSource = ds.Tables[0].DefaultView;
dtlstMagazine.DataSource = PagDat;
dtlstMagazine.DataBind();
</code></pre>
<p>In this "currentpage" is a integer varaible which i declared as a static. I think it could be conflict when more user access this page am i right?</p>
| asp.net | [9] |
758,150 | 758,151 | How to change centre point of shape's linear gradient? | <p>I have a shape defined as follows:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="90"
android:endColor="@color/white"
android:startColor="@color/grey"
android:type="linear" />
</shape>
</code></pre>
<p>The gradient transitions from grey to white evenly from bottom to top, reaching the colour that is between grey and white in the middle. I would like to change the mid-point of the gradient to be closer to the bottom, so that the shape is more white than grey, if that makes sense?! Anyone know how to do this, or whether this is not possible? I have tried setting the <code>android:centerY</code> attribute to <code>0.1</code> and <code>0.9</code> but I see no visible difference.</p>
| android | [4] |
5,831,193 | 5,831,194 | How to find sibling tag using javascript | <p>I have the following HTML</p>
<pre><code> <div>
<label for="username">Username:</label>
<input type="text" name="username" id="username" />
<span>some text here</span>
</div>
</code></pre>
<p>now I have referenced the input "username" in javaScript using getElementById rather easily but I need to locate (via javascript) the text of the label associated with the input, I'm thinking something like this: </p>
<blockquote>
<p>document.getElement(thisName).parent.getElementsByTagName('label')[0].innerHTML;</p>
</blockquote>
<p>Any help is appreciated</p>
| javascript | [3] |
3,197,827 | 3,197,828 | redirect to a new screen from browser | <p>I am using epi twitter to show tweets in my application. My first activity has a login button.
If I click the login button it opens the browser and then I login and it again redirects back to my application.
what I want to do is to start a new activity i.e open up a new screen and display the tweets as soon as the browser redirects , but I have to click on the login button again to go to the next screen.
I used on resume function but it dint help.</p>
| android | [4] |
710,193 | 710,194 | Bare bones Message example needed, from AsyncTask to UI thread, not using Services | <p>I am looking for simple example code for setting up a Message in an AsyncTask and handling it in the Handler in the UI thread. </p>
<p>The examples I've seen deal with this inside a Service, and my app is not currently using any Services. Can a Message be used without a Service?</p>
<p>Example code would be appreciated!</p>
| android | [4] |
3,606,832 | 3,606,833 | Copy Paste In JavaScript | <p>). This is an age-old question, but I'm still having trouble with it. You see, I'm trying to paste some Excel data in a Text Area, but the silly browsers freeze for long periods of time when doing this, because of God-knows-what "smart" parsing they do. I can't get rid of that (file upload is out of the question, my boss wants me to paste rows from Excel in a Text Area). </p>
<p>The good news is that pasting in a standard textbox WORKS. But I can't force them to paste there. So I am trying to catch the paste event in the Text Area and then throw the text over to the textbox. Unfortunately, I stopped short at the pasting part. I can't paste the text via JS into the simple textbox.</p>
<p>So my question is: how do you paste a text, how do you invoke it via JS? There are some solutions which only work in IE, that's not good, of course ::- ).</p>
<p>Any help is greatly appreciated ::- D.</p>
| javascript | [3] |
1,530,792 | 1,530,793 | C++ class that mandates const objects | <p>First let me ask a general question:</p>
<ul>
<li>It seems to me that C++ is a language whose point is to provide tons of capabilities, to give the programmer the greatest possible flexibility in doing things in whatever way he finds suitable. In other words, it's a flexible language that allows the programmer to express himself in more ways than probably any other language that I've seen. Is this right?</li>
</ul>
<p>Then a specific one:</p>
<ul>
<li>Why doesn't C++ seem to support creating classes whose objects can be only <code>const</code>? In other words, classes where you get a compile-time error if you try to create a non-<code>const</code> object of it. This seems like a natural thing to do in many cases, yet C++ doesn't allow it.
What is the reason behind this? (Sure, I can make all the members <code>const</code>, but that is somewhat of a copout.)</li>
</ul>
| c++ | [6] |
3,302,354 | 3,302,355 | JavaScript: Set border radius | <p>How can I set the -moz-border-radius with pure JavaScript (no jQuery, no plugins etc)?</p>
<pre><code>document.getElementById('id')
</code></pre>
| javascript | [3] |
4,848,496 | 4,848,497 | Android command line build (Mac), no Google APIs | <p>I'm trying to build an application which uses Google maps and I can't find maps.jar in my project directory, can't import com.google.android.apps.MapActivity, and so on. The project was originally created without Google APIs, then updated on the command line to change to the correct target. My project.properties file now says this:</p>
<pre><code>target=Google Inc.:Google APIs:10
</code></pre>
<p>...which I presume is correct.
I can see the Google APIs in the sdk.dir ($HOME/bin/android-sdk-mac_x86) but they don't seem to be included in the app. Can anyone suggest as to why this might be?</p>
<p>The reason for developing on the command line is that as a Vim fan I like using Eclim (http://eclim.org/). </p>
| android | [4] |
2,771,857 | 2,771,858 | convert string from money format to float in js | <p>I'd like to convert a money formatted string into a float in javascript.</p>
<p>ex:
'$1,000.20' convert to a float 1000.20</p>
<p>'USD 1,000.20' convert to a float 1000.20</p>
<p>I'm also interested to know how to replace alphabetic characters to say '*'</p>
<p>How can this be implemented?</p>
| javascript | [3] |
4,635,277 | 4,635,278 | 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,645,525 | 3,645,526 | Argument Exception Unhandled when using Image.FromStream() | <p>I am trying to save an image from a stream and I get Argument Exception Unhandled error on the Image.FromStream() line. I've searched a lot and tried many solutions offered since it seems to be a common problem but nothing is working. </p>
<p>The error:System.ArgumentException was unhandled; Message=Parameter is not valid; Source=System.Drawing</p>
<pre><code>MemoryStream mm = new MemoryStream(imageByte);
Console.Write(imageByte);
Image image = System.Drawing.Image.FromStream(mm); //error occurs here
image.Save("Received.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
</code></pre>
<p>A strange thing is that if I run the same code on a 32 bit system, the error it gives is "A generic error occurred in GDI+". </p>
<p>A bit more about 'imageBytes':
I am transmitting an image by converting it into a hex string. The data I sent is by wireless means (Zigbee) and upon receiving it, I write it to a text file from which I use this to get imageBytes:</p>
<pre><code>int NumberChars = hexString.Length;
byte[] imageByte = new byte[NumberChars / 2];
for (int i = 0; i < NumberChars; i += 2)
{
imageByte[i/2] = Convert.ToByte(hexString.Substring(i, 2), 16);
}
</code></pre>
| c# | [0] |
5,009,672 | 5,009,673 | How to drag and drop views in Android tablet app? | <p>I want to show a dashboard like interface in my Android tablet app where the user can drag and drop listviews using touch. Is there a library that i can use to give d&d to my app?</p>
| android | [4] |
3,331,304 | 3,331,305 | How do I import quickgraph library to my project | <p>I'v got quickgraph from <a href="http://quickgraph.codeplex.com/releases/view/20160" rel="nofollow">http://quickgraph.codeplex.com/releases/view/20160</a>
but I couldn't figure out how to import it because there wasn't any .dll files in the package </p>
| c# | [0] |
4,236,800 | 4,236,801 | Cant understand this stack trace | <p>I have a published app and received a stack trace from a crash:</p>
<pre><code>android.view.WindowManager$BadTokenException: Unable to add window -- token
android.os.BinderProxy@4051d698 is not valid; is your activity running?
at android.view.ViewRoot.setView(ViewRoot.java:535)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:203)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:117)
at android.view.Window$LocalWindowManager.addView(Window.java:424)
at android.app.Dialog.show(Dialog.java:241)
at android.app.ProgressDialog.show(ProgressDialog.java:107)
at android.app.ProgressDialog.show(ProgressDialog.java:90)
at com.mytaxicontrol.MyTaxiControlActivity$executeGEO.void onPreExecute()(Unknown Source)
at android.os.AsyncTask.execute(AsyncTask.java:391)
at com.mytaxicontrol.MyTaxiControlActivity$37.void run()(Unknown Source)
at android.app.Activity.runOnUiThread(Activity.java:3743)
at com.mytaxicontrol.MyTaxiControlActivity.void geo()(Unknown Source)
</code></pre>
<p>Looks like a progress Dialog can't be shown. Here's the relevant code:</p>
<pre><code>public void onPreExecute() {
if(isGeoRunning)return;
if (loading == null || !loading.isShowing())
loading = ProgressDialog.show(co, "",
"Retrieving Geolocation...", true);
}
</code></pre>
<p>Note that co=this and has been initialized in onCreate()
What is my problem?</p>
| android | [4] |
3,068,742 | 3,068,743 | how to send data in url in a different way then by using get method | <p>I want to my adress look like this: <code>www.example.com/112112/example</code>
Where <code>112112</code> is a data, that I want to work with in a php script. How to do this? For some reasons, I dont want to the adress look like <code>www.example.com?id=112112</code></p>
| php | [2] |
3,912,579 | 3,912,580 | most negative value for python | <p>I expect the most negative for python is <code>-maxint-1</code></p>
<p>I expect having -2, will make integer overflow.</p>
<pre><code>from sys import maxint
maximum_int = maxint
minimum_int = -maxint - 2
# 2147483647
# -2147483649
print maximum_int
print minimum_int
</code></pre>
<p>Yet. Correct result is displayed, and a value which is more negative than <code>-maxint-1</code> is shown.</p>
<p>May I know why?</p>
| python | [7] |
3,231,690 | 3,231,691 | adding images along with text in listview in android | <p>I am developing an android application which involves list along with images.can anyone tell how can i do this..</p>
<p>Thanks in advance
Tushar</p>
| android | [4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.