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 |
|---|---|---|---|---|---|
5,761,670 | 5,761,671 | Javascript syntax | <p>How do you say <code>if (A == 0) OR (B == 0)</code>?</p>
| javascript | [3] |
3,424,858 | 3,424,859 | Im trying to dump the contents of a variable being called asychronously | <p>The function looks like this:</p>
<pre><code>public function insert_record($table, $dataobject) {
$dataobject = (array)$dataobject;
$columns = $this->get_columns($table);
$cleaned = array();
$fp = fopen('../../data.txt', 'w');
foreach ($dataobject as $field => $value) {
//fwrite($fp, print_r($field), print_r($value) );
// fwrite($fp, print($field), print($value) );
// fwrite($fp, var_export($value) );
}
fclose($fp);
}
</code></pre>
<p>I am trying, and failing miserably, to see inside the $dataobject variable. I am writing to a file because this function is called asynchronously and so I cannot break and var_dump().</p>
<p>Any ideas how I can look/dump/print/echo the contents of that variable?</p>
<p>thank you.</p>
| php | [2] |
5,596,528 | 5,596,529 | javascript web workers - how do I pass arguments? | <p>Found the answer some some of my problems, html5 web workers!!!</p>
<p>How do I pass an argument to a web worker though using this basic example?</p>
<p>contents of worker.js:</p>
<pre><code>function doSomething() {
postMessage( ' done');
}
setTimeout ( "doSomething()", 3000 );
</code></pre>
<p>js code:</p>
<pre><code> var worker = new Worker('worker.js');
worker.onmessage = function (event) {
alert(event.data);
};
</code></pre>
| javascript | [3] |
3,022,084 | 3,022,085 | Enumeration type with some same values | <p>Why declaration of two enums type with same values in same block is not allowed in C++?</p>
<pre><code>enum math_students {A,B,C};
enum comp_students {D,E,A}; // illegal
</code></pre>
| c++ | [6] |
1,665,061 | 1,665,062 | Create Asp.net Reset Button | <p>Is there any ways to create reset button to clear all text in text fields in asp form? When user hits the reset button, all text entered by them will clear and they are enable to enter back text in the area.</p>
| asp.net | [9] |
996,949 | 996,950 | Javascript split function in chrome gives unexpected results | <p>Here is the piece of code </p>
<pre><code>str = "a,b,c";
name = str.split(",");
</code></pre>
<p>The <code>name</code> variable shows up as 'object' type in Firefox and 'string' type in chrome
Why is that happening ?
Here is the jsfiddle <a href="http://jsfiddle.net/XujYT/17/" rel="nofollow">http://jsfiddle.net/XujYT/17/</a></p>
<p>Also the <code>name</code> variable stores the value <code>"a,b,c"</code> instead of the split array in chrome
<a href="http://jsfiddle.net/XujYT/23/" rel="nofollow">http://jsfiddle.net/XujYT/23/</a></p>
| javascript | [3] |
5,653,215 | 5,653,216 | converting array to another array | <p>hello friends I have this array</p>
<pre><code> Array
(
[fieldset_name] => Personal Details
[field_name] => applicant_name
[field_label] => Your Name
[field_type] => text
[css_classes] => required
[minlength] => 4
[maxlength] => 10
[default_value] =>
[help_text] =>
)
Array
(
[fieldset_name] => Personal Details
[field_name] => applicant_address
[field_label] => Address
[field_type] => textarea
[css_classes] => required
[minlength] => 4
[maxlength] => 10
[default_value] =>
[help_text] =>
)
</code></pre>
<p>and I want the result should be as </p>
<pre><code>Array(
"Personal Details" => array(
array(
'fieldset_name' => "Personal Details"
field_name => applicant_name
field_label => Your Name
),
array(
'fieldset_name' => "Personal Details"
field_name => applicant_address
field_label => Address
),
)
)
</code></pre>
<p>So how to do this</p>
| php | [2] |
5,566,033 | 5,566,034 | jquery validation with onblur/onfocus | <p>I've added onfocus and onblur to my text input of a form.</p>
<pre><code><form id='AddCameraFormWebcam' name='' method='post' action='<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>'>
<label for="CameraName">Camera name:&nbsp;</label>
<input id="CameraName" name="camera_name" size="24" maxlength="36" value="Enter label for camera" onfocus="if(this.value==this.defaultValue){this.value=''; this.style.color='#000';};" onblur="if(this.value==''){this.value=this.defaultValue; this.style.color='#666';}" />
...
<button type='submit' class='submit_camera' name='addcamera' value='Add'>Add</button>
</form>
</code></pre>
<p>This now breaks my validation I had with jquery:</p>
<pre><code>$(".submit_camera").click(function() {
$("#AddCameraFormWebcam").validate({
rules: {
camera_name: {
required: true,
cameravalidation: true,
minlength: 3,
maxlength: 32
}
},
messages: {
camera_name: {
required: "Enter a label for your camera",
minlength: jQuery.format("At least {0} characters required!"),
maxlength: jQuery.format("Maximum {0} characters allowed!")
}
}
});
});
</code></pre>
<p>Someone can now submit without typing anything for the camera name because <code>Enter label for camera</code> will get submitted to the server. How can I still show an error?</p>
| jquery | [5] |
5,828,352 | 5,828,353 | how to 'bake' parameters into click() call jquery? | <p>I've got an ajax call that collects XML, and based on that data creates a number of divs on which I attach click() jquery listeners. When clicked, I want those divs to call a function and to pass a parameter into that function. However, by the time the click is called the value of the parameter has changed. Here's an example from a <a href="http://jsfiddle.net/snTEf/1/" rel="nofollow">jsfiddle I built</a> to demonstrate the problem:</p>
<pre><code> $(document).ready(function() {
function x() {
$.ajax({
type: "POST",
url: "/echo/xml/",
dataType: "xml",
data: {
xml: "<the>xml</the>"
},
success: function(xml) {
console.log('success');
$('#test').show();
var text = "CORRECT";
$('#test').click(function() {
insertText(text);
console.log(text);
});
text = "WRONG";
}
});
}
x();
});
function insertText(t) {
$('#test').html(t);
}
</code></pre>
<p>I want the text to show up as CORRECT, not WRONG.</p>
<p>I know this is a bit of a convoluted example but I'm trying to simulate my actual code as much as possible in terms of scope and what is going on. By the time the <code>click()</code> function gets called based on a click, the value of <code>text</code> has changed. Is there some way to 'bake' the value of <code>text</code> into the <code>click()</code> call at the time I create it? I'll be creating a number of these through a <code>for</code> loop as it runs through the XML and don't want to hang on to all that data into variables for use later.</p>
| jquery | [5] |
1,832,166 | 1,832,167 | generators that defer to sub-generators | <p>I yould like to have generators that defer to other generators, e.g.</p>
<pre><code>def gx():
for i in [1, 2, 3]:
yield i
def gy():
for i in [11, 12, 13]:
yield i
def gz():
"""this should defer to gx and gy to
generate [1, 2, 3, 11, 12, 13]"""
for i in gx(): yield i
for i in gy(): yield i
</code></pre>
<p>Is the explicit loop in gz() the only way to do this, or are there better alternatives?</p>
| python | [7] |
1,937,752 | 1,937,753 | How to reduce image size after loading from url in android? | <p>I'm getting image from the web when the image size is large i'm getting the following error</p>
<pre><code>java.lang.OutOfMemoryError: bitmap size exceeds VM budget
</code></pre>
<p>My code is as follows i'm loading the image by using the <code>LoadImageFromWebOperatins</code> method.</p>
<pre><code>animation.addFrame(LoadImageFromWebOperations(feed.getItem(i).getImage()), 2500);
animation.addFrame(LoadImageFromWebOperations(feed.getItem(i).getImage1()), 2500); animation.setOneShot(false);
iv.setBackgroundDrawable(animation);
iv.post(new Starter());
private Drawable LoadImageFromWebOperations(String url) {
try {
InputStream is = (InputStream) new URL(url).getContent();
Drawable d = Drawable.createFromStream(is, "src name");
return d;
} catch (Exception e) {
System.out.println("Exc=" + e);
return null;
}
}
</code></pre>
<p>In this case how do i solve this error? please provide solution for this.</p>
| android | [4] |
2,830,734 | 2,830,735 | What's the difference in these ways of determining uploaded file size in PHP? | <p>I came across this piece of code where programmer determines uploaded file size like this:</p>
<pre><code>$file_size = @filesize($_FILES[$upload_name]["tmp_name"]);
</code></pre>
<p>AFAIK one can simply do: </p>
<pre><code>$_FILES[$upload_name]["size"];
</code></pre>
<p>Are there reasons to use filesize() function over reading file size from $_FILES array?</p>
| php | [2] |
3,555,246 | 3,555,247 | exceptions in program | <p>I tried to execute the following piece of code.If i enter the site names with http [for eg:<code>http://www.google.com</code>] am getting correct output.Otherwise I am getting force close. Even I am catching the activitynotfoundexception then also I am getting <code>ActivityNotFoundException</code>.</p>
<p>Help me.</p>
<pre><code>try {
Button browse=(Button)findViewById(R.id.Browse);
browseURl=(EditText)findViewById(R.id.BrowseUrl);
browse.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent invokeURI=new Intent(Intent.ACTION_VIEW,Uri.parse(browseURl.getText().toString()));
startActivity(invokeURI);
}
});
} catch (ActivityNotFoundException ex) {
// TODO: handle exception
Log.e("BrowseURI","Failed Browsing the given URI",ex);
}
</code></pre>
| android | [4] |
4,169,493 | 4,169,494 | multiple replace of a letter | <p>I have a string variable <code>var str = 'this is eeeeeeee';</code>. I want to replace each letter e in this string. When I do <code>str.replace('e', 'E');</code> it does it only to the first e</p>
| javascript | [3] |
4,920,283 | 4,920,284 | Declaring a global variable inside a function | <p>I have two PHP files. In the first (join php) I set a cookie based on a $_GET value, and then call a function which then sends this value on to the other file. This is some code which I'm using in join.php:</p>
<pre><code> include('/inc/processJoin.php');
setcookie("site_Referral", $_GET['rid'], time()+10000);
$joinProc = new processJoin();
$joinProc->grabReferral($_COOKIE["site_Referral"]);
</code></pre>
<p>The other file (processJoin.php) will then send this value (among others) to further files which will process and insert the data into the database.</p>
<p>The problem I'm having is that when the grabReferral function in processJoin.php is called, the $referralID variable isn't being defined on a global scale - other functions in processJoin.php can't seem to access it to send to other files/processes.</p>
<p>I've tried this in processJoin.php:</p>
<pre><code> grabReferral($rid){
global $ref_id;
$ref_id = $rid;
}
someOtherFunction(){
sendValue($ref_id);
}
</code></pre>
<p>But the someOtherFunction can't seem to access or use the $ref_id value. I've also tried using <code>define()</code> to no avail. What am I doing wrong?</p>
| php | [2] |
3,072,939 | 3,072,940 | How to sort environment variables in python | <p>I am printing environment variables, but there are not printed in a sorted way :</p>
<pre><code> for variable in os.environ:
print(" " + variable + "=" + os.environ.get(variable))
</code></pre>
<p>I would like to sort os.environ. I tried to put os.environ in a list(), but the sort function is not working.</p>
<p>Any clue?</p>
<p>Thank you</p>
| python | [7] |
3,061,645 | 3,061,646 | Undefined offset with an array | <p>Why can't I use variable which contains a number to specify an array value:</p>
<pre><code>$info(array)
$mySQLHeadings(array)
$infoString(empty String)
$mySQLHeadingString(empty string)
for ($i=0; $i<=count($info) ; $i++){
if($info[$i] != ""){
$mySQLHeadingString .= $mySQLHeadings[$i] . ",";
$infoString .= "'". $info[$i] ."',";
}
}
</code></pre>
<p>PHP says it's an undefined offset $i in the arrays. How can I correct it or do something similar. Thank you so much.</p>
| php | [2] |
5,813,566 | 5,813,567 | Creating a dialog for a link with jQuery | <p>I´m trying to use jQuery-UI´s dialog to create a confirmation dialog attached to a link, but it´s not working and the documentation for dialogs at jQuery-UI´s home seems to be lacking.</p>
<p>I want to display a dialog explaining what action will be taken with any extra data the user may need to take the decision and asking for confirmation when a link is clicked, but once the dialog is created it "steals" the text from the link, and leaves nothing in place for the user to click.</p>
<p>Does anyone knows how to do what I´m trying, or at least knows a link for a better documentation for jQuery-UI?</p>
| jquery | [5] |
4,764,216 | 4,764,217 | Issues while verifying if the build was successful | <p>I'm creating a build for distribution & it shows Build Succeeded message along with some warnings. I tried to verify if the build was successful by following the iphone developer user guide, according to which an "embedded.mobileprovision” file should be created.
Is it necessary that code should be free of warnings to get a successful build along with
"embedded.mobileprovision” file?. </p>
| iphone | [8] |
5,945,459 | 5,945,460 | android 4 my first app development | <p>When i try to create a virtual device in eclipse I get the following error
Unable to find a 'userdata.img' file for ABI armeabi to copy into the AVD folder.
My SDK manager shows that the ARM EABI v7 system image is already installed. I am using Windows XP OS and eclipse juno version please help me out.</p>
| android | [4] |
2,608,019 | 2,608,020 | How to implement SharedPreferences with RadioButtons in Android | <p>I'm a newb to Android, so please be patient.</p>
<p>I'm trying to set up a new app and it needs to look like this:</p>
<p><img src="http://i.stack.imgur.com/IMhd8.png" alt="enter image description here"></p>
<p>Each category has a number of options. Each option has two Strings to denote the option's name and its configuration information. The user selects an option by tapping on the radio button. There should be two radio groups: one for each category. The image doesn't show it, but there should be "save" and "cancel" buttons at the bottom of the screen. </p>
<p>For the layout, I called getAll in order to display the key and value (which are just TextViews). This is where I'm lost.</p>
<ol>
<li>I don't know how to link the Preference with a RadioButton.</li>
<li>I don't know how to save the changes (because I don't know how to link the Preference to a RadioButton).</li>
<li>I'd also like to implement something like a dirty bit to denote whether there was really a change before saving, but I don't know what the Android best practice for this is.</li>
</ol>
<p>As you can see, I'm completely lost. So, any help would be really, greatly appreciated.</p>
| android | [4] |
4,441,145 | 4,441,146 | OnClientClick and Calling Custom JavaScript Function | <p>I am using the following code to call a javascript function but the OnClientClick expression is never evaluated. </p>
<pre><code><asp:Button ID="btn1" UseSubmitBehavior="false"
OnClientClick='moveComment(txtComment_<%# Eval("Container.DataItemIndex") %>)'
runat="server" Text="add comment"/>
</code></pre>
| asp.net | [9] |
5,637,857 | 5,637,858 | Is The ASP.NET "DataSourceHelper" Class Essentially The Dal? | <p>I've seen the a class named DataSourceHelper, with an attribute of DataObject(true), in a couple of modern open source ASP.NET projects. </p>
<p>Is the use of such a class now an ASP.NET idiom, and if so is it the equivalent of the DAL?</p>
| asp.net | [9] |
5,973,935 | 5,973,936 | javascript sort array double sort | <p>I have an array <code>MyArrayOfItems</code> of <code>Item</code> objects with objects that look like this:</p>
<pre><code>Item
{
ContainerID: i, // int
ContainerName: 'SomeName', // string
ItemID: j, // int
ItemName: 'SomeOtherName' // string
}
</code></pre>
<p>I want to sort this array so that it's sorted by <code>ContainerID</code> and then by <code>ItemName</code> alphabetically.</p>
<p>I have a custom sort function that so far looks like this:</p>
<pre><code>function CustomSort(a, b) {
Item1 = a['ContainerID'];
Item2 = b['ContainerID'];
return Item1 - Item2;
}
MyArrayOfItems.sort(CustomSort);
</code></pre>
<p>This sorts by ContainerID but how do I then sort by ItemName?</p>
<p>Thanks.</p>
| javascript | [3] |
457,892 | 457,893 | How do I animate css properties before and after user events using jQuery? | <p>I am trying to get a simple effect working in jQuery, and only have a few hours of experience with it, so have a lot to learn.</p>
<p>I managed to get this code working:</p>
<pre><code> <script type="text/javascript" >
$(document).ready(function() {
lastBlock = $("#a1");
maxWidth = 415;
minWidth = 75;
$("ul li a").hover(function() {
$(lastBlock).animate({ width: minWidth + "px" }, {
queue: false,
duration: 600
});
$(this).animate({ width: maxWidth + "px" }, {
queue: false,
duration: 600
});
lastBlock = this;
});
});
</script>
</code></pre>
<p>Which gives me exactly what I want, a 6 pane horizontal accordion effect. Each pane however has a 75x75 image on the upper left, which is always visible no matter which pane is active (and it is this image that when hovered over caused the pane to open).</p>
<p>What I want to do is for the image on the selected 'pane' to drop the top margin down to 10px, and then put it back to 0px when a new one is selected, i.e. so the selected panes image is always 10px lower than the other 5 images.</p>
<p>I suspect this should be easy, but not quite grasping the syntax yet.</p>
<p>Thanks.</p>
| jquery | [5] |
2,383,437 | 2,383,438 | Looking for a general file content conversion helper library | <p>My task is to develop class which convert file from one type to another. Files hold certain scientific data and have a very systematic structure (headers, comments, datas). I have already read <a href="http://stackoverflow.com/questions/5285671/best-practise-for-converter">Best practise for converter</a>, but I wonder is there any .NET library which could help me.</p>
| c# | [0] |
4,671,744 | 4,671,745 | call retrieve function in paulirish/infinite-scroll | <p>I want to manually trigger the next page load in paulirish/infinite-scroll. I found a function called </p>
<pre><code>retrieve: function infscr_retrieve(pageNum) {
}
</code></pre>
<p>I tried to call it directly using something like this.</p>
<pre><code> var contentScroll = $('#content');
contentScroll.infinitescroll({
//bla...........
});
contentScroll.infinitescroll.retrieve(2);
</code></pre>
<p>error retrieve is not a function.
Anyone know how I could go about calling this method. </p>
| jquery | [5] |
3,306,212 | 3,306,213 | Graphics.DrawString() throws GDI+ exception when Graphics.ScaleTransform() was called with small scale factors | <p>I want to restrict the function calling the <code>DrawString()</code> method when the font becomes zero.</p>
| c# | [0] |
1,606,448 | 1,606,449 | Is it possible to use Java EE and Java ME in my Java SE program? | <p>Can I use Java EE and Java SE technologies in my Java SE programming?</p>
| java | [1] |
62,958 | 62,959 | Slide upping in jquery with ids | <pre><code>var Ids = $('.head:has(:checkbox:checked)')
.map(function() { return this.id })
.get(); alert(Ids);
</code></pre>
<p>i have ids with above code.However,
i cannot slide up with these Ids with </p>
<p>Why this does not work ? </p>
<pre><code>function(response){
alert("Başarıyla silindi");
$('#'+Ids).each('slow', function() {
}).slideUp();
</code></pre>
| jquery | [5] |
1,664,293 | 1,664,294 | python filter can't output | <p>i create filter by python to the log file
like</p>
<pre><code> Sat Jun 2 03:32:13 2012 [pid 12461] CONNECT: Client "66.249.68.236"
Sat Jun 2 03:32:13 2012 [pid 12460] [ftp] OK LOGIN: Client "66.249.68.236", anon password "gxxglxxxxt@google.com"
Sat Jun 2 03:32:14 2012 [pid 12462] [ftp] OK DOWNLOAD: Client "66.249.68.236", "/pub/10.5524/100001_101000/100022/readme.txt", 451 bytes, 1.39Kbyte/sec
</code></pre>
<p>the script is</p>
<pre><code>import time
f= open("/opt/CLiMB/Storage1/log/vsftp.log")
def OnlyRecent(line):
if time.strptime(line.split("[")[0].strip(),"%a %b %d %H:%M:%S %Y") < time.time()-(60*60*24*2):
return True
return False
for line in f:
if OnlyRecent(line):
print line
f.close()
</code></pre>
<p>but when i run this script, it didn't show anything.
Why it can't shows records happened in 2 days.
And Since the log file is very large, and records are sorted by time, so how to speed up to find records.</p>
<p>Thanks</p>
| python | [7] |
5,296,806 | 5,296,807 | Why does the Soft Keyboard appear? | <p>I'm using the Android emulator to test my first Android application. While there is a functioning hard keyboard at the right side of the emulator window, the soft keyboard shows up when editing in an <code>EditText</code> control.</p>
<p>I'm aware of the option to hide the soft keyboard by using an instance of <code>InputMethodManager</code>, however I'm wondering why the soft keyboard does appear at all (when the hard keyboard is available).</p>
<p>To me, as a user, the soft keyboard in this case is rather distracting, hence I'd like to get rid of it if useful. - This question is about the practical context (i.e., is there any use of the soft keyboard when there is a hard keyboard, do real-world devices behave similarly to the emulator) and about general strategies to address the issue.</p>
<p>Thanks. I'll be upvoting any helpful hints.</p>
| android | [4] |
3,381,808 | 3,381,809 | Can (x==0) be more efficient than (0==x)? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4624536/which-one-will-execute-faster-ifflag-0-or-if0-flag">Which one will execute faster, if(flag==0) or if(0==flag)?</a> </p>
</blockquote>
<p>I usually write my equality conditions as:</p>
<pre><code>if(0==x)
</code></pre>
<p>as many people do, instead of</p>
<pre><code>if(x==0)
</code></pre>
<p>so that the compiler will tell me when I accidentally type = instead of ==.</p>
<p>Someone told me that some compilers implement this as two register loads, instead of one using a not-equal-zero operation, and so it is less efficient. </p>
<p>Anyone know if this is a reasonable comment?</p>
| c++ | [6] |
4,192,338 | 4,192,339 | How to read compacted javascript? | <p>There are many compacted javascript source code in web and I am wonder how to transfer it to the normal code and make it readable? Are there any exsited tools or scripts?</p>
| javascript | [3] |
2,219,792 | 2,219,793 | Unexpected operator is/as behavior when casting an int[] to object | <p>Could someone please explain why this is happening?</p>
<pre><code>var y = new int[]{1,2};
Console.WriteLine(y is uint[]); // false
Console.WriteLine(((object)y) is uint[]); // true
</code></pre>
| c# | [0] |
328,070 | 328,071 | Java, convert zip byte[] to unzip byte[] | <p>I have <code>byte[]</code> of zip file. I have to unzip it without creating new file, and get <code>byte[]</code> of that unzip file.
Please help me to do that</p>
| java | [1] |
5,221,517 | 5,221,518 | Is there any point in implementing LVL Licensing for a 1$ paid app on android | <p>I'm about to release my first android app which I'm planning on being a paid app costing roughly 1 US Dollar.</p>
<p>Is there any point in licensing & obfuscating this? For me the effort of finding and manually installing an "knock off" version wouldn't be worth the saving or the risk of the app having been changed to include malware. The idea that an android user with a $500+ handset would worry about the cost of a $1 app seems odd.</p>
<p>So the question is there much point in implementimenting licensing to copy protect a $1 app. I would prefer an answer that is backed with some stats.</p>
| android | [4] |
2,459,791 | 2,459,792 | Replace all line break in a string with <br /> tag in javascript | <blockquote>
<p><strong>Exact duplicate: <a href="http://stackoverflow.com/questions/784313/read-line-break-in-a-string-with-javascript">Read line break in a string with javascript</a></strong></p>
</blockquote>
<p><hr /></p>
<p>Does anyone know how I can read the line break from a value with javascript and replace all the line breank with br tag?</p>
<p>Example:</p>
<p>A Variable passed from php as below:</p>
<pre><code> "This is man.
Man like dog.
Man like to drink.
Man is the king."
</code></pre>
<p>I would like my result to look something like this after the Javascript convert it... </p>
<pre><code> "This is man<br /><br />Man like dog.<br />Man like to drink.<br /><br />Man is the king.";
</code></pre>
| javascript | [3] |
4,004,100 | 4,004,101 | How to assign/set attribute in JQuery | <p>I am working on other developer's code and i am not an JQuery expert so i need little help.</p>
<p>the below code works fine if i have multiple employeeIds but since the scanrio has changed and i will be having only one employeeId so my question is how can i replace the <code>each function</code> with a single node. </p>
<p>each/map:</p>
<pre><code> var employeeid = $("#<%= gridview1.ClientID %> [id*='myDiv']").map(function () { return $(this).attr("EmployeeId"); }).get().join(',');
</code></pre>
<p>i attemp to write:</p>
<pre><code> var employeeid = 'A23433';
</code></pre>
<p>but the problem is that i need a way to set the attribute (EmployeeId)</p>
| jquery | [5] |
4,976,349 | 4,976,350 | two service with the same intent filter | <p>I have two applications installed on my device,each with a service component in it and these two service has the same intent filter declaration,like this:</p>
<pre><code><intent-filter>
<action android:name="com.example.intent.action.SHOW"/>
</intent-filter>
</code></pre>
<p>And I start the service in this way: <br/></p>
<pre><code>Intent intent = new Intent();
intent.setAction("com.example.intent.action.SHOW");
startService(intent);
</code></pre>
<p>I found that one of these two services started,but I am not sure how this happened.As we know,if we write two activities with the same intent filter declaration,a dialog will be poped up and let the user chooses a activity to complete the action.What got me confused is that how Android chooses the service to be started in these who has the same intent filters,what's the strategy of making this decision?</p>
<p>Thanks in advance!</p>
<p>update:<br/>
Yury is right, here is code snippet from frameworks/base/services/java/com/android/server/pm/PackageMangerService.java on ICS:</p>
<pre><code>public ResolveInfo resolveService(Intent intent, String resolvedType,
int flags) {
List<ResolveInfo> query = queryIntentServices(intent, resolvedType,
flags);
if (query != null) {
if (query.size() >= 1) {
// If there is more than one service with the same priority,
// just arbitrarily pick the first one.
return query.get(0);
}
}
return null;
}
</code></pre>
<p>As we can see,if there are more than one service match the requested intent, Android will arbitrarily pick one to start. But, which service will be actually started is unexpected.</p>
| android | [4] |
5,945,367 | 5,945,368 | how to send ajax request in jQuery with data encoded | <p>when i send ajax request i got the error that</p>
<pre><code> $.ajax({
type: "POST",
url: furl2,
cache: false,
contentType: "application/json;charset=utf-8",
data: { id: id, url: $("#id" + id + " .customURL").val() },
success: function (msg) {
//some code here
},
});
}
</code></pre>
<p>i got the error that id is undefined even i put them.</p>
<p>how i can send a ajax request to server using ajax.</p>
| jquery | [5] |
4,327,737 | 4,327,738 | Android + setOnClickListener sets setClickable to true by default? | <p>I have a ButtonView in an xml layout and set the focusable/clickable attributes to false. I'm attempting to prevent click events on the ButtonView until a flag is set to true. Anyway, this works fine until I write the setOnClickListner code on the ButtonView. It seems to automatically set setClickable() to true. Is there a way to prevent this, or is this the default behavior? I figured I could set the listener at any time, and ignore events until I set setClickable() on the Button. Thanks, any help is appreciated! </p>
| android | [4] |
4,415,467 | 4,415,468 | get the profile state | <p>Is it possible to get the profile of the phone, whether it is in silent mode or general mode? I want to check it in a broadcast receiver. </p>
<p>The thing is I don't want to switch the profile. I just want to get the state.</p>
| android | [4] |
4,079,492 | 4,079,493 | search for form elements in HttpWebresponse-C# | <p>I have a HTTPPPot whose return I capture using :</p>
<pre><code>WebResponse webResponse = httpWebRequest.GetResponse();
Stream responseStream = webResponse.GetResponseStream();
StreamReader responseReader = new StreamReader(responseStream);
string responseString = responseReader.ReadToEnd();
</code></pre>
<p>In the response string, the client returns the following</p>
<pre><code><input type="hidden" name="Location" value="sometext.txt"><input type="hidden" name="tableid" value="2"><input type="hidden" name="GroupID" value="1236781329">
</code></pre>
<p>Based on the above, I need to obtain the values of each form element. I do know the names of the hidden form elements. Is there a quick way to obatin this without reading the entire response line by line and determining if the line contains any pattern that I am lookinng for?</p>
| c# | [0] |
584,162 | 584,163 | UIBarButton item | <p>I want to add custom button in the navigation bar..<br>
can any one suggest how to add?</p>
| iphone | [8] |
3,218,932 | 3,218,933 | Javascript Shorthand | <p>Is there a shorthand version of the following:</p>
<pre><code>(a > 0 && a < 1000 && b > 0 && b < 1000 && c > 0 && c < 1000)
</code></pre>
<p>Many thanks.</p>
| javascript | [3] |
1,579,755 | 1,579,756 | Accessing dictionary in session | <p>Let's say I have a dictionary that I want to store in the session. This dictionary will be storing a list of object with a date as the key.</p>
<pre><code>Dictionary<DateTime, List<MyObjects>> SessionDictionaryMyObjects = new...
</code></pre>
<p>How do I put a list MyList in the dictionary with the key 31/1/2011 and how do I retrieve the list for 1/19/2011 from the dictionary?</p>
<p>Thanks.</p>
| asp.net | [9] |
2,121,856 | 2,121,857 | Accessing asp.net tablerow child control by type | <p>I'm iterating through a collection of asp:tablerows to be able to get or set the text in a textbox that is nested in the third cell of the row; I'm doing this by type rather than by ID because the cell ID's in that column aren't totally consistent--thus I can't really call FindControl() to achieve this. I've resorted to casting the third control in the TableRow to a TableCell and then Casting the first control in that cell to a TextBox. Not quite correct, as I'm getting an index out of range exception thrown. The problem mainly lies in the Controls.Count() property of the third cell, which comes to zero. </p>
<p>Not sure if there's a better way to access the textbox---should I resort to FindControl()?</p>
<p>The code:</p>
<pre><code>foreach (TableRow row in tblProviders.Rows) {
string value = ((TextBox)((TableCell)row.Controls(2)).Controls(0)).Text;
...
}
</code></pre>
<p>My searches here only yielded use of FindControl(), so that may be the only way...</p>
<p>Thanks!</p>
| asp.net | [9] |
675,238 | 675,239 | motion effect to increase hight | <p>Lets say that I have this code</p>
<pre><code>$(document).ready(function() {
$("#changeText").click(function() {
$("#textBox").html("My<br><br><br>text<br><br><br>is<br><br><br>changed!");
});
});
</code></pre>
<p>The new text will make the #textBox div slightly taller.Is there any way to apply an effect to increase the height of the div slowly in a motion?</p>
| jquery | [5] |
1,647,952 | 1,647,953 | Python - use lists instead of strings? | <p><a href="http://stackoverflow.com/questions/1228299/change-one-character-in-a-string-in-python">From an S.O answer</a>:</p>
<p>"Don't modify strings.</p>
<p>Work with them as lists; turn them into strings only when needed.</p>
<p>... code sample ...</p>
<p>Python strings are immutable (i.e. they can't be modified). There are a lot of reasons for this. Use lists until you have no choice, only then turn them into strings."</p>
<p>Is this considered best practice? </p>
<p>I find it a bit odd that Python has methods that return new modified strings (such as upper(), title(), replace() etc.) but doesn't have an insert method that returns a new string. Have I missed such a method?</p>
<p>Edit: I'm trying to rename files by inserting a character:</p>
<pre><code>import os
for i in os.listdir('.'):
i.insert(3, '_')
</code></pre>
<p>Which doesn't work due to immutability. Adding to the beginning of a string works fine though:</p>
<pre><code>for i in os.listdir('.'):
os.rename(i, 'some_random_string' + i)
</code></pre>
<p>Edit2: the solution:</p>
<pre><code>>>> for i in os.listdir('.'): │··
... os.rename(i, i[:4] + '_' + i[4:])
</code></pre>
<p>Slicing certainly is nice and solves my problem, but is there a logical explanation why there is no insert() method that returns a new string? </p>
<p>Thanks for the help.</p>
| python | [7] |
5,042,862 | 5,042,863 | Steps to create inhouse distribution in iphone | <p>I am having enterprise account. Can anyone tell the clear steps to distribute the package via URL.</p>
<p>Thanks in Advance</p>
| iphone | [8] |
1,105,182 | 1,105,183 | Is there some way I could combine this C# code? | <p>I have the following code. It looks to me like there is a way I could combine it into one statement but I am not sure how to do this. </p>
<pre><code>List<SelectListItem> items = new List<SelectListItem>();
var emptyItem = new SelectListItem(){
Value = "",
Text = "00"
};
items.Add(emptyItem);
ViewBag.AccountIdList = new SelectList(items);
</code></pre>
<p>Can someone tell me if it's possible to simplify this. </p>
<p>Thanks,</p>
| c# | [0] |
5,403,560 | 5,403,561 | Sanitising a POST array for INSERT query | <p>Morning SO,</p>
<p>I have a checkbox array (name = "cat[]") in a form which at present, contains six values, 1- 6 (it may contain more in the future). A user can select any number of these. </p>
<p>These values are then collected in:</p>
<pre><code>$_SESSION['cat'] = $_POST['cat'];
</code></pre>
<p>(They're in a session because there's a step or two before the actual insert query)</p>
<p>What i want to do is Sanitise them. I have tried </p>
<pre><code>$_SESSION['cat'] = (int)$_POST['cat'];
</code></pre>
<p>But that seems to strip all values from it. </p>
<p>Can someone help with the appropriate method of sanitising this for safe insertion into a database?</p>
<p>Thanks in advance, as always,
Dan</p>
| php | [2] |
4,312,817 | 4,312,818 | Android: How to implement Action Bar on Tabhost | <p>here is my code for the tabhost in my java class</p>
<pre><code>TabHost tabHost = getTabHost();
TabHost.TabSpec sp;
Intent in;
in = new Intent().setClass(Main.this, ScheduleActivity.class);
sp = tabHost.newTabSpec("Tab1").setIndicator("Schedule").setContent(in);
tabHost.addTab(sp);
in = new Intent().setClass(Main.this, PatientActivity.class);
sp = tabHost.newTabSpec("Tab2").setIndicator("Patient").setContent(in);
tabHost.addTab(sp);
in = new Intent().setClass(Main.this, ContactActivity.class);
sp = tabHost.newTabSpec("Tab3").setIndicator("Contact").setContent(in);
tabHost.addTab(sp);
tabHost.setCurrentTab(0);
</code></pre>
<p>and i wanted to implement the action bar that hides the tabs when a tab is selected, Here is the picture my tab activity, i have 3 tabs wherein every time i click a tab and goes to an activity.. it hides that 3 tabs</p>
<p><img src="http://i.stack.imgur.com/XHdHf.png" alt="enter image description here"></p>
| android | [4] |
926,316 | 926,317 | MANIFEST.MF issue | <p>hi
I have created a jar inside this folder: '/usr/local/bin/niidle.jar' in eclipse.
And I have another jar inside /usr/local/bin/niidle.jar.
In my niidle.jar file,there is one 'lib' folder and in that 'lib'
folder,there is another jar file 'hector-0.6.0-17.jar'.
I have added this 'hector-0.6.0-17.jar' file in MANIFEST.MF as follows:</p>
<hr>
<pre><code>Manifest-Version: 1.0
Main-Class: com.ensarm.niidle.web.scraper.NiidleScrapeManager
Class-Path: hector-0.6.0-17.jar
</code></pre>
<hr>
<p>But when I run this using command:</p>
<pre><code>>>java -jar /usr/local/bin/niidle.jar arguments...
</code></pre>
<p>It is not working..
It is showing error message:-</p>
<pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: me/prettyprint/hector/api/Serializer
at com.ensarm.niidle.web.scraper.NiidleScrapeManager.main(NiidleScrapeManager.java:21)
Caused by: java.lang.ClassNotFoundException: me.prettyprint.hector.api.Serializer
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 1 more
</code></pre>
<hr>
<p>What is the problem,Please tell me solution for this Exception...</p>
| java | [1] |
5,154,061 | 5,154,062 | The icon app android is small | <p>i have a problem to display icon app. The icon show small.
And the size is 128x128 px.
I tried different posibilities...
Somepeople suggestion?</p>
| android | [4] |
2,404,707 | 2,404,708 | how can i edit and run the python nltk program | <p>how can i edit and run the python nltk program</p>
| python | [7] |
4,016,912 | 4,016,913 | jQuery - How to get text inside of container that is not part of children | <p>Let's have html code like this:</p>
<pre><code><div id="d1"><span>1.</span>Hallo <span>Kitty, </span><div>How are you?</div></div>
</code></pre>
<p>It is just example, there may be different children elements inside.</p>
<p>How can I get text inside of <code>d1</code> container that is not part of children elements?</p>
<p>For the example above it shold be just <code>"Hallo "</code></p>
| jquery | [5] |
614,421 | 614,422 | jQuery .val() Internet Explorer | <p>When I test script below in IE, after click on <code>input</code> the cursor moves to the begining of the input.</p>
<pre><code>[texttext{I click here}ext ] --> [{cursor goes here after click}texttextxt ]
$(".chrome-input").focus(function (){
$(this).val("test");
});
</code></pre>
| jquery | [5] |
3,075,193 | 3,075,194 | Is there a faster way to draw text? | <p>Shark complains about a big performance hit with this line, which takes like 80% of CPU time. I have a counter that is updated very frequently and performance seriously sucks.</p>
<p>It's an custom UILabel subclass with -drawRect: implemented. Every time the counter value changes, this is used to draw the new text:</p>
<pre><code>[self.text drawInRect:textRect withFont:correctedFont lineBreakMode:self.lineBreakMode alignment:self.textAlignment];
</code></pre>
<p>When I comment this line out, performance rocks. Its smooth and fast. So Shark isn't wrong about this. But what could I do to improve this? Maybe go a level deeper? Does that make any sense?</p>
<p>Probably drawing text is really so incredible heavy...?</p>
| iphone | [8] |
4,583,398 | 4,583,399 | Change Value of Textbox by Jquery | <p>Change value of HTML textbox which has readonly property by jquery code</p>
| jquery | [5] |
2,091,399 | 2,091,400 | Error in "C:\Users\lenovo\Desktop\android-sdk_r06-windows\android-sdk-windows>>SDK Setup.exe" | <p>Ihave had "Failed to fetch URL <a href="https://dl-ssl.google.com/android/repository/repository.xml" rel="nofollow">https://dl-ssl.google.com/android/repository/repository.xml</a>, reason: Connection timed out: connect" Error for 2 weeks. What shoul I do? Please help...</p>
| android | [4] |
2,697,459 | 2,697,460 | Dynamically created controls are wiped out on button click | <p>I have webform where a set of controls are generated in a Panel control during a SelectedIndexChanged event of a dropdown. That all works fine.</p>
<p>However, when I enter values in those controls and I click on my submit button, the controls are wiped out along with the data I entered.</p>
<p>I can only create the controls in that SelectedIndexChanged event because that's where I get the info to generate the dynamic controls.</p>
<p>What I'd like to do is keep those controls displayed with the data I entered and use the data I entered to do something else (like it happens in WinForms.)</p>
<p>Is this doable?</p>
<p>Thanks!</p>
| asp.net | [9] |
2,074,538 | 2,074,539 | Program received signal: “0”. warning: check_safe_call: could not restore current frame | <p>Mi app closes with this error, when running an AdHoc build of my app in the device. I never have any problems in the simulator.</p>
<p>What's the exact meaning of this problem ?</p>
| iphone | [8] |
664,476 | 664,477 | What is the best book to learn website development using PHP? | <p>I am a techie with expertise in Java and C++. I have no knowledge of web technologies. I want to create a new website and for this, I want to learn web development using PHP. </p>
<p>I did some research online and came across recommendations that suggest using multiple books to learn the same - "Head First Php & MySql" , "Learning PHP, MySql and Javascript" etc.</p>
<p>But my learning style is more suited to picking up one single book and reading it cover to cover. I would appreciate a suitable book recommendation for this. Thanks!</p>
| php | [2] |
1,914,709 | 1,914,710 | Call Class Method from another Class | <p>So in Python, I am wondering if there is a way to call a class method from another class? I am attempting to spin my own MVC framework in Python and I can not for the life of me figure out how to invoke a method from one class in another class.</p>
<p>Below is basically what I want to happen:</p>
<pre><code>class A:
def method1(arg1, arg2):
# do code here
class B:
A.method1(1,2)
</code></pre>
<p>I am slowly getting into Python from PHP so I am looking for the Python equilvant of PHP's call_user_func_array()</p>
| python | [7] |
5,913,672 | 5,913,673 | Can not include php file | <p>I am developing a simple website in PHP. I need to include a file named: 'variables.php'.
but I seem to get error when I do it in an iframe in the page.</p>
<pre><code>1- include('../includes/variables.php');
2- include('c:\wamp\www\site\includes\variables.php');
</code></pre>
<p>I have googled it and tried in so many different ways but seem to get no point in them.
I wonder if anybody could help me with this.</p>
| php | [2] |
1,711,562 | 1,711,563 | Width Height and Crop ratio in img src tag | <p>i want to pass the width & height and crop ration in img src tag.My aim is to resolve the problem of the staratching the image because actual image size is too large and thumbnail of this too short so i want to fix the width & height of the image and want to sote this in a folder. </p>
| php | [2] |
4,866,982 | 4,866,983 | Javascript within page to open fullscreen | <p>I have a htm page that I need to update so that when it is opening it will open at fullscreen. What is the code that I need to place within this page to do so?</p>
| javascript | [3] |
2,287,236 | 2,287,237 | How to Highlight a paricular tab in Android so that other tabs were made partially visible in Android | <p>I am writing an Android App which used TabHost. I created 3 Tabs. Now my doubt is when I click a tab it should come forward and other tabs should be visible partially in such a way that the width of middleTab should increase evenly in left and right directions, so that the other tabs in left and right should slip out of window partially.How can this be achieved in android. It should be some thing like the CurrencyConverter market App in Android. Can any one help me in sorting out this issue. <br><br></p>
<p>Thanks in Advance,</p>
| android | [4] |
3,828,380 | 3,828,381 | I am getting the error certificate identity appears more than once in the key chain | <p>When i got this error I checked in my organizer window and found a duplicate identity in my nameI tried to delete the duplicate identity in my organizer window. But i am not able to select or delete it.Please help me to delete this duplicate identity.</p>
| iphone | [8] |
3,693,676 | 3,693,677 | Best practices to handle JSON data for API SDK | <p>The company I work for has an API and I am porting that API over to PHP. Right now, the API returns to me a large JSON object and I'm trying to figure out how I should handle the data. I could have a whole bunch of "get" methods, like:</p>
<pre><code>$t = new APIThing();
$t->getJSONObjects();
for ($i=0; ...) {
$t->getHeadline($i);
}
</code></pre>
<p>Or, I could return the JSON object and let people play with the data themselves, so that would be something like this</p>
<pre><code>$t = new APIThing();
$t->getJSONObjects();
foreach ($t as $u) {
echo $u->headline;
}
</code></pre>
<p>So what do you think? Just expose the JSON object or wrap the whole thing up into functions?</p>
| php | [2] |
4,517,105 | 4,517,106 | if strings are immutable in c#, how come I am doing this? | <p>I read today, in c# strings are immutable, like once created they cant be changed, so how come below code works</p>
<pre><code>string str="a";
str +="b";
str +="c";
str +="d";
str +="e";
console.write(str) //output: abcde
</code></pre>
<p>How come the value of variable changed??</p>
| c# | [0] |
3,280,971 | 3,280,972 | How do I use retina.js with a sprite sheet (without explicit image tag) | <p>I am using retina.js and it appears you need to explicitly use an image tag in your HTML for it to work, i.e. img src="/images/my_image.png" This is my problem. I have applied a class instead to populate the list item. I have followed everything else exactly (js tag before the closing body tag etc.)</p>
<pre><code><ul id="mobileTop">
<li class="smoothScroll"><a href="#mobile" id="home" class="mobile_sprite">work</a></li>
<li class="smoothScroll"><a href="#faq" id="faq" class="mobile_sprite">faq</a></li>
</ul>
</code></pre>
| jquery | [5] |
5,791,175 | 5,791,176 | Null Pointer Exception When Search a Char Sequence in a string | <p>I am parsing an xml using DOM Parser. I get a doc and then from that doc i get a url. when i search through that url for a particular char sequence i receive a null pointer exception.
This is what i am doing:</p>
<pre><code> Boolean var = false;
String url = theElement.getChildNodes().item(5).getNodeValue();
if (url.contains("-b-")) // this throws exception
{
var = true;
}
</code></pre>
<p>Please any suggestions...</p>
| android | [4] |
2,786,982 | 2,786,983 | Which javascript they are using at the given link? | <p>Can anybody inspect which javascript they are using for the floating baloons? - <a href="http://themeforest.net/bundles/birthday" rel="nofollow">http://themeforest.net/bundles/birthday</a> </p>
<p>I was looking with the firebug for a while, but cant get which would be the right one. Thanks!</p>
| javascript | [3] |
4,727,291 | 4,727,292 | How to send SMS using WAP in android? | <p>I need to send SMS without displaying the number of the sender. The name of sender should be displayed while receiving the SMS. I heard WAP can be used to send that type of sms with only name and not the number. But I don't have any idea how to apply that. Can anybody please help me. </p>
| android | [4] |
5,050,794 | 5,050,795 | Focus removed even after event returns false (cancelled event) | <p>I have implemented hotkeys using <a href="https://github.com/jeresig/jquery.hotkeys/" rel="nofollow">jquery.hotkeys</a></p>
<pre><code> $("textarea").bind("keydown", "tab", function() {
alert("tab");
return false;
});
</code></pre>
<p>But I noticed that after the function returns, the focus is not in the textbox anymore. Its not in the next control too. I could do this.focus(), but I wonder why after returning false, the focus will be gone? also I am curious where did the focus go to</p>
<p><a href="http://jsfiddle.net/Tu6vF/1/" rel="nofollow">http://jsfiddle.net/Tu6vF/1/</a></p>
| jquery | [5] |
1,931,101 | 1,931,102 | Is there a way to automatically answer incoming cell calls? | <p>Is there a way to automatically answer an incoming cell call from an android application? I know it can be detected etc. but can it be programmatically answered?</p>
| android | [4] |
2,453,322 | 2,453,323 | How to run an executable with time and memory usage limit? | <p>I want to run an executable and limit its memory and time usage. Of course
I want to know if it breached any of these things and if not I want the
data how much was used. What could I use from the .NET to do this?</p>
| c# | [0] |
3,037,994 | 3,037,995 | How to create new MIME type in Android DownloadProvider? | <p>I want to download a .JSON file from the tomcat server via Android DownloadManager. Is it possible to include the new MIME type like "application/json" in the android downloadprovider?..</p>
<p>Thanks in advance,
Bala</p>
| android | [4] |
4,492,615 | 4,492,616 | How do i write this piece of code in jquery? | <p>How do i write this piece of javascript code in Jquery</p>
<pre><code><script>
function init() {
alert('hi: ');
}
var previousOnload = window.onload;
window.onload = function() {
if (previousOnload) {
previousOnload();
}
init();
}
</script>
</code></pre>
| jquery | [5] |
2,397,347 | 2,397,348 | Android keystore - signed without "alias_name" | <p>Quick question I couldn't find an answer for on Google.</p>
<p>I signed my app and accidentally left the "alias_name" as alias_name.</p>
<p>Does it really matter? (app uploaded to Market fine...)</p>
<p>Thanks</p>
| android | [4] |
4,915,274 | 4,915,275 | jquery how to detect the change of a hidden field | <p>I need to detect when a hidden field is changed.
I would like to do some actions each time the value of this hidden changes</p>
<p>I`ve read jquery documentation and found the change(fn), but it says it would only trigger when the focus is released.</p>
<p>would that work for a hidden field?
I think hidden fields do not have a focus event</p>
<p>any help will be greatly appreciated
thanks </p>
| jquery | [5] |
1,275,033 | 1,275,034 | Failed to set event handler in javascript | <p>I want to add an event handler for input text controls. The controls is generated dynamically. My code is like:</p>
<p><strong>JavaScript</strong>:</p>
<pre><code>var settings_check = new Array("checkVMName()","checkDiskMB()","checkMemMB()","checkEsx()","checkDatastore()");
...
_inputbox = document.createElement("input");
_inputbox.type = "text";
_inputbox.id = settings[zindex];
_inputbox.onblur = settings_check[zindex];
_hint = document.createElement("hint");
_hint.id = settings[zindex] + "_Label2";
_hint.innerText = settings_hint[zindex];
mycurrent_cel2.appendChild(_inputbox);
mycurrent_cel2.appendChild(_hint);
</code></pre>
<p>But this way doesn't work. I checked the HTML with Firebug, and no "onblur" attribute for the input text control at all. </p>
<p><strong>HTML</strong></p>
<blockquote>
<pre><code><tr>
<td>....</td>
<td><input type="text" id="Datastore">
<hint id="Datastore_Label2">start with /</hint>
</td>
</tr>
</code></pre>
</blockquote>
<p>I also tried other ways to set event handler like</p>
<pre><code>_inputbox.onblur = function(){alert("test");};
</code></pre>
<p>or</p>
<pre><code>_inputbox.setAttribute("onblur",func);
</code></pre>
<p>Neither works. :(</p>
<p>If I manually add onblur=function(){...} for the input text control in the HTML with Firebug and execute, the onblur does work. So the question is: how can I set event handler for a control in JavaScript? Is there anything wrong in my code? Thanks.</p>
| javascript | [3] |
983,651 | 983,652 | Get PHP file out of a variable? | <p>How can I out from a variable like this:
<code>$var1 = "www.game.mysite.com/folder/page.php?var1=1&var2=2";</code></p>
<p>And then I want somehow to get only the "page.php", what ever it is set to be?</p>
<p>Any ideas how to do this?</p>
| php | [2] |
1,581,182 | 1,581,183 | error while trying to connect with a cisco 2600 router through python in windows | <pre><code>The code i have given is
import telnetlib
HOST="X"
user ="X"
password="X"
en_password="x"
tn=telnetlib.Telnet(HOST)
Traceback (most recent call last):
File "<pyshell#15>", line 1, in <module>
tn=telnetlib.Telnet(HOST)
File "C:\Python27\lib\telnetlib.py", line 209, in __init__
self.open(host, port, timeout)
File "C:\Python27\lib\telnetlib.py", line 225, in open
self.sock = socket.create_connection((host, port), timeout)
File "C:\Python27\lib\socket.py", line 567, in create_connection
raise error, msg
error: [Errno 10060] 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></pre>
<p>This is the error that i am getting while i am trying to connect to the 2600 router . How to remove this error , and connect to the router through a python script?</p>
| python | [7] |
2,825,372 | 2,825,373 | How to graph equations in math IT? | <p>I found this library (<a href="http://math-it.org/index.html" rel="nofollow">http://math-it.org/index.html</a>) but no examples so as not to use it. I want to do is to plot an equation (2x +5 = 50).
So any example or explanation is very helpful.
Thank you.</p>
| java | [1] |
4,834,793 | 4,834,794 | Enterprise web application review | <p>I need to conduct an independent assessment of an asp.net enterprise web application. </p>
<p>What are the things I should look out for in terms of security, performance, and deployment architecture.</p>
<p>Thank you </p>
| c# | [0] |
69,779 | 69,780 | android 2.2 and 2.3 | <p>why android 2.2 phones not upgradeable to 2.3? Is there any hardware requirement?</p>
| android | [4] |
887,937 | 887,938 | msg plugin in ajax request | <p>I am currently looking at this <a href="http://dreamerslab.com/demos/jquery-blockui-alternative-with-jquery-msg-plugin" rel="nofollow">plugin</a> as blockui does not seem to work for me. I am using:</p>
<pre><code>beforeSend: function () {
$.msg({
autoUnblock: false
});
}
</code></pre>
<p>and would like to 'unblock' it in success, error etc.</p>
<p>Would this be possible? Thanks.</p>
| jquery | [5] |
2,010,039 | 2,010,040 | how to identify whether x and y coordinates are in rectangel using ontouchlistener? | <pre><code>public void hatdraw(Canvas canvas,float x,float y) {
mBitmaps = BitmapFactory.decodeResource(this.getResources(),
R.drawable.hat);
srcRect=new Rect(0,0,60,60);
xrect=(int)x;
yrect=(int)y;
Log.d("hatdraw","xrect,yrect"+xrect +yrect);
desRect=new Rect(xrect,yrect, xrect+ (srcRect.right - srcRect.left),
yrect + (srcRect.bottom -srcRect.top));
canvas.drawBitmap(mBitmaps,srcRect,desRect, null);
}
</code></pre>
| android | [4] |
2,544,806 | 2,544,807 | Signaling that the values of a variable have been rejected | <p>In C# I'm writing a class that checks the values of its properties with a setter method:</p>
<pre><code>private int _grade
public int Grade {
get { return _grade;}
set { if (value >= this.lowerLimit) _grade = value; }
}
</code></pre>
<p>I would like to signal to the application if a value was rejected. I had considered refactoring to use a setGrade function that returns a bool (accepted / rejected) but the ability to do someInstance.Grade++ and someInstance.Grade*=2 are important. Simple functions incrementGrade and divideGrade will make the code a mess, and there will certainly be some function that I forgot to implement (too much coupling).</p>
<p>My current solution is to check the value of someInstance.Grade after setting it, to ensure that it has been set. But it seems to me that this is just moving the mess from the class to the application. Indeed, it is the responsibility of the application to ensure that the value was properly set.</p>
<p>How do those more experienced handle this? Thanks!</p>
| c# | [0] |
1,828,527 | 1,828,528 | [__NSDate timeIntervalSinceNow]: message sent to deallocated instance | <p>App crashed with the message when hitting rewind twice just to test app on iPhone device <code>[__NSDate timeIntervalSinceNow]: message sent to deallocated instance</code></p>
<pre><code>-(void)pauseTimer{
pauseStart = [[NSDate dateWithTimeIntervalSinceNow:0] retain];
previousFireDate = [[timer fireDate] retain];
[timer setFireDate:[NSDate distantFuture]];
}
-(void)dealloc
{
[audioPlayer release];
[pauseStart release];
[previousFireDate release];
[super dealloc];
}
-(void)playpauseAction:(id)sender {
if([audioPlayer isPlaying])
{
[sender setImage:[UIImage imageNamed:@"Play Icon.png"] forState:UIControlStateSelected];
[audioPlayer pause];
[self pauseTimer];
[self pauseLayer:self.view.layer];
}else{
[sender setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateNormal];
[audioPlayer play];
[self resumeTimer];
[self resumeLayer:self.view.layer];
if(isFirstTime == YES)
{
self.timer = [NSTimer scheduledTimerWithTimeInterval:11.0
target:self
selector:@selector(displayviewsAction:)
userInfo:nil
repeats:NO];
isFirstTime = NO;
}
}
}
-(void)rewind:(id)sender{
[timer invalidate];
audioPlayer.currentTime = 0;
MainViewController *viewController = [[[MainViewController alloc] init]autorelease];
viewController.view.frame = CGRectMake(0, 0, 320, 480);
[self.view addSubview:viewController.view];
[self.view addSubview:toolbar];
[self playpauseAction:_playButton];
}
</code></pre>
<p>when hitting rewind button again and purposely to test app on iphone device app crashes and gives message <strong>[__NSDate timeIntervalSinceNow]: message sent to deallocated instance</strong> </p>
<p>Any ideas what is wrong.</p>
<p>Appreciate help.</p>
<p>Thanks.</p>
| iphone | [8] |
2,569,385 | 2,569,386 | How do I downgrade Java from 1.6.0 to 1.5.0 in Ubuntu? | <p>I need to downgrade Java in Ubuntu. Current version is 1.6.0, I have to use JDK 1.5.0 for my Android platform.</p>
<p>How to do it? Remove it and reinstall?</p>
| java | [1] |
5,683,796 | 5,683,797 | Is it impossible to declare methods in an anonymous object? | <p>The term anonymous object could be a confusing term so allow me to clarify: by anonymous object I mean the declaration of an object in the same way you would define an anon function.</p>
<p>example:</p>
<pre><code>someFunction=function(){}
someObject={}
</code></pre>
<p>but more specifically anonymous in the way that they can be placed anywhere a variable of such an object or function could be placed. Best (and directly relevant) example being <code>Object.create</code>, now like one would use <code>window.setTimeout(function(){},ms)</code> (that own function's querks aside) whereas you would just place a function in a variable's stead, I want to be able to do this: <code>object.Create(some__proto__object,{cake:false})</code> which is all fine and dandy until I attempt to include methods. Then it throws <strong>TypeError: descriptor must be object.</strong> </p>
<p>So I do some testing in console, I put in <code>{}</code> all good, <code>{cake:"cheesecake",taste:"delicious"}</code> ok, </p>
<pre><code>variable={
cake:"cheesecake",
taste:"celicious",
stateTheCatch:function(){console.log('The cake is a pie!')}
}
</code></pre>
<p>it works, but</p>
<pre><code>//In practical use:
//Object.create(inheritanceObject,
{
cake:"cheesecake",
taste:"celicious",
stateTheCatch:function(){console.log('The cake is a pie!')}
}//);
</code></pre>
<p>is broken, and not counted as an object. Why is this bad? Because you type it like that in the second argument for <code>Object.create</code> besides using an identifier. So and clues why it doesn't work like that?</p>
| javascript | [3] |
2,483,756 | 2,483,757 | Finding the number of function parameters in JavaScript | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4848149/get-a-functions-arity">Get a function's arity</a> </p>
</blockquote>
<p>Say I have:</p>
<pre><code>function a(x) {};
function b(x,y) {};
</code></pre>
<p>I want to write a function called numberOfParameters that returns the number of parameters that a function normally accepts. So...</p>
<pre><code>numberOfParameters(a) // returns 1
numberOfParameters(b) // returns 2
</code></pre>
| javascript | [3] |
5,549,264 | 5,549,265 | Is it possible to center align the data in a grid control? | <p>Is it possible to center align the data in a grid control? If so please help.</p>
| c# | [0] |
10,682 | 10,683 | How to sort Set by not unique data? | <p>I have the following code:</p>
<pre><code>public class EnglishWord implements Comparable<EnglishWord> {
private String word;// unique
private int occurenceNumber; //not unique
public EnglishWord(String word, int occurenceNumber) {
this.word = word;
this.occurenceNumber= occurenceNumber;
}
public boolean equals(EnglishWord anotherWord) {
return word.equals(anotherWord.getWord());
}
public int compareTo(EnglishWord anotherWord) {
return occurenceNumber - anotherWord.getOccurenceNumber;
}
</code></pre>
<p>I want to add all <code>EnglishWord</code>s in to a <code>Set</code> where there's exactly one <code>EnglishWord</code> object for each unique <code>word</code>. I want the <code>Set</code> to be sorted by <code>occurrenceNumber</code>. The code I have already sorts the words by <code>occurrenceNumber</code>, but doesn't add <code>EnglishWord</code> with unique <code>occurrenceNumber</code> to the <code>Set</code>. As code, here is what I mean:</p>
<pre><code>Set<EnglishWord> mySet= new TreeSet<EnglishWord>();
mySet.add(new EnglishWord("hello",8));
mySet.add(new EnglishWord("hi",8));
</code></pre>
<p>After this, <code>mySet</code>'s size is 1.</p>
| java | [1] |
4,005,963 | 4,005,964 | Function Print PHP echo | <p>Someone knows what's my wrong code :</p>
<pre><code>$text = str_replace(":-)", "<img src='emoticons/smile.gif'>", $text);
</code></pre>
<p>When I try to print the text using PHP echo, it show :</p>
<pre><code><img src='emoticons/smile.gif'>
</code></pre>
<p>All I want to do is to show the image when I input :-)</p>
<p>Thank you.</p>
<p>As per details, this is my code below :</p>
<pre><code>function sendChat() {
$from = $_SESSION['username'];
$to = $_POST['to'];
$message = $_POST['message'];
$_SESSION['openChatBoxes'][$_POST['to']] = date('Y-m-d H:i:s', time());
$messagesan = sanitize($message);
if (!isset($_SESSION['chatHistory'][$_POST['to']])) {
$_SESSION['chatHistory'][$_POST['to']] = '';
}
$_SESSION['chatHistory'][$_POST['to']] .= <<<EOD
{
"s": "1",
"f": "{$to}",
"m": "{$messagesan}"
},
EOD;
unset($_SESSION['tsChatBoxes'][$_POST['to']]);
$sql = "insert into chat (chat.from,chat.to,message,send) values ('".mysql_real_escape_string($from)."', '".mysql_real_escape_string($to)."','".mysql_real_escape_string($message)."',NOW())";
$query = mysql_query($sql);
echo "1";
exit(0);
}
function sanitize($text) {
$text = htmlspecialchars($text, ENT_QUOTES);
$text = str_replace("\n\r","\n",$text);
$text = str_replace("\r\n","\n",$text);
$text = str_replace("\n","<br>",$text);
$text = str_replace(":-)", "<img src='emoticons/13.gif'>", $text);
return $text;
}
</code></pre>
| php | [2] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.