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 |
---|---|---|---|---|---|
652,105 | 652,106 | Get Email Message from any email service provider | <p>I've a html message form box where user can send message with php. </p>
<p>Now I'm trying to get email message from any email service provider, Like: yahoo, gmail, hotmail etc. Is there any way to get email message from any email service provider. </p>
<p>Your suggestion are welcome. </p>
| php | [2] |
5,781,988 | 5,781,989 | Jquary droppable ignore the z-index? | <p>My problem, the drop-function starts when i sort the list. </p>
<p><strong>js</strong></p>
<pre><code>$(document).ready(function rt()
{
$("#div1").draggable();
$("#k1").sortable({ revert: '100' });
$('#droparea').droppable({ accept: 'li', drop: function() { alert('ssss'); } });
});
</code></pre>
<p><strong>html</strong></p>
<pre><code> <div id="div1" style="z-index:5;">
<ul id="k1" style="width:350px; height:200px; background-color:#ffffff; margin:20px; padding:10px; border:1px solid #000000; ">
<li>One</li>
<li>two</li>
<li>three</li>
</ul>
</div>
<div id="droparea" style="position:absolute; top:0px; left:0px; width:100%; height:100%; background-color:#cccccc; z-index:1;"></div>
</code></pre>
<p>working example
<a href="http://www.jsfiddle.net/V9Euk/130/" rel="nofollow">http://www.jsfiddle.net/V9Euk/130/</a></p>
<p>Tabks in advance.
Peter</p>
| jquery | [5] |
5,724,483 | 5,724,484 | jQuery validator to allow only basic characters | <p>I want to allow basic characters <code>A-Z, a-z,0-9</code>, and basic special characters <code>~``!@#$%^&*()_+-=[]{};'\:"|,./<>?</code> availalbe on a standard english keyboard to be only typed in a text area.<br>
Looking for help ! </p>
| jquery | [5] |
3,815,532 | 3,815,533 | Custom Liking Function - Do I need User Login? | <p>I've recently implemented a working custom liking/disliking function for my comics site.</p>
<p>but I feel it’s pushing me towards implementing a login system for all users… which I really don’t want to have to do (for my sake and my fans' sake)</p>
<p>Currently, the function works by:</p>
<blockquote>
<p>1) Passing button value (id = 'like' or id = 'dislike') via Jquery to
php script</p>
<p>2) script will first check if an ip exists in the database against
that given comic id... if not it will insert user's IP and current
comic ID and increment total likes for a given comic id... if it
already exists, it will remove that user’s information and decrement
total likes.</p>
</blockquote>
<p>The issue is, what happens if multiple fans “like” or “dislike” a comic from the same IP (net café, etc), or the same user goes and likes a comic from another computer…
So I was thinking the way to solve that would be generate a unique value for the user’s session and store it against their IP. </p>
<p>But what if that user wanted to come back at a later point after their unique session ID has expired and change their like to a dislike… how would the computer know it’s them?
Or what happens if the same user expires their session ID somehow (logs off then logs back in, closes browser, etc) and now can vote multiple times?</p>
<p>In this case, do I have to create a login system?</p>
<p>Thanks</p>
| php | [2] |
2,022,331 | 2,022,332 | Whats wrong with setting nullable double to null? | <blockquote>
<p><strong>Possible Duplicates:</strong><br>
<a href="http://stackoverflow.com/questions/2766932/why-cant-i-set-a-nullable-int-to-null-in-a-ternary-if-statement">Why can't I set a nullable int to null in a ternary if statement?</a><br>
<a href="http://stackoverflow.com/questions/858080/nullable-types-and-the-ternary-operator-why-wont-this-work">Nullable types and the ternary operator. Why won't this work?</a> </p>
</blockquote>
<p>Whats wrong with the below</p>
<pre><code>public double? Progress { get; set; }
Progress = null; // works
Progress = 1; // works
Progress = (1 == 2) ? 0.0 : null; // fails
</code></pre>
<blockquote>
<p>Type of conditional expression cannot be determined because there is no implicit conversion between 'double' and '<null>'</p>
</blockquote>
| c# | [0] |
380,818 | 380,819 | .click not fired for <p> tag within jQuery dialog | <p>I am having issues with the .click function working for a <p> tag within a jQuery dialog.</p>
<p>I have a a p tag that looks like below, inside a jQuery dialog.</p>
<pre><code><p class="userColor" id="CMP|8|25691/XX|25691/59|59" style="text-decoration:underline;cursor:pointer;">59 - GRAPE</p>
</code></pre>
<p>div</p>
<pre><code><div id="colorPickerWindow" style="width: auto; min-height: 89px; max-height: none; height: auto;" class="ui-dialog-content ui-widget-content">
<p class="userColor" id="CMP|8|25691/XX|25691/20|20" style="text-decoration:underline;cursor:pointer;">20 - RED</p>
</div>
</code></pre>
<p>I have tried .click and .on and I have tried both using a selector, but I cannot get the a click action to fire for the P tag.</p>
<p>jQuery</p>
<pre><code>$(".userColor").on({
click:function(){}
});
</code></pre>
<p>What is the correct jQuery to get a click event to fire within a jQuery dialog?</p>
| jquery | [5] |
1,900,638 | 1,900,639 | How to find out if there is data to be read from stdin on Windows in Python? | <p>This code</p>
<pre><code>select.select([sys.stdin], [], [], 1.0)
</code></pre>
<p>does exactly what I want on Linux, but not in Windows.</p>
<p>I've used <code>kbhit()</code> in <code>msvcrt</code> before to see if data is available on stdin for reading, but in this case it always returns <code>0</code>. Additionally <code>msvcrt.getch()</code> returns <code>'\xff'</code> whereas <code>sys.stdin.read(1)</code> returns <code>'\x01'</code>. It seems as if the msvcrt functions are not behaving properly.</p>
<p>Unfortunately I can't use TCP sockets as I'm not in control of the application talking my Python program.</p>
| python | [7] |
647,194 | 647,195 | imploding array_keys from Facebook JSON data | <p>Need some help with the sample code provided the facebook. I can't get it to return a series of IDs that I need to run a sql query against.</p>
<pre><code> $friends = '{
"data": [
{
"name": "Paul",
"id": "12000"
},
{
"name": "Bonnie",
"id": "120310"
},
{
"name": "Melissa",
"id": "120944"
},
{
"name": "Simon",
"id": "125930"
},
{
"name": "Anthony",
"id": "120605"
},
{
"name": "David",
"id": "120733"
}
]
}';
$obj = json_decode($friends);
print $obj->{'data'}[0]->{'name'};
</code></pre>
<p>I can return the "Paul"</p>
<p>what I want is to return all the id's using implode(array_keys($obj),",")</p>
<p>I am only getting data to return.</p>
<p>What I'd like to do is retrieve all the IDs separated by a comma.</p>
<p>Thanks!</p>
| php | [2] |
3,919,257 | 3,919,258 | How can I access the button placed in datalist I want to access button text that's bind with the database table field | <pre><code><asp:DataList ID="DataList2" runat="server" DataSourceID="SqlDataSource2" onitemcommand="DataList2_ItemCommand">
<ItemTemplate>
<div class="style49">
<table style="width:100%;">
<tr>
<td class="style50">
<asp:Image ID="Image3" runat="server" Height="61px"
ImageUrl='<%# Eval("F_Image") %>' Width="48px" />
</td>
<td>
<asp:LinkButton ID="LinkButton3" runat="server" Height="25px"
TabIndex="1" Text='<%# Eval("Name") %>'
Width="92px" CommandName="view_frnd">
</asp:LinkButton>
</td>
</tr>
</table>
</div>
</ItemTemplate>
</asp:DataList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [Friends] WHERE ([Email] = @Email)">
<SelectParameters>
<asp:SessionParameter Name="Email" SessionField="uid" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
protected void DataList2_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "view_frnd")
{
Response.Write(e.CommandName.ToString());
}
}
</code></pre>
<p>Is succsessfully execute but I want to text of linkbutton that's bind with database table field. How can I access linkbutton3 text?</p>
| c# | [0] |
4,970,968 | 4,970,969 | How to convert seconds to DD:HH:MM:SS | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1322732/convert-seconds-to-hh-mm-ss-with-javascript">convert seconds to HH-MM-SS with javascript?</a> </p>
</blockquote>
<p>I want to convert seconds to DD:HH:MM:SS format. I searched and found about dateJs but I couldnt understand it. Is there any simple method to convert seconds - 2490453 to DD:HH:MM:SS format? I am kinda newbie in Jquery so please help me!!</p>
| javascript | [3] |
918,308 | 918,309 | How to change iPhone app name according to language selected? | <p>Is it possible to change app name according to the user's language preferences?</p>
<p>e.g If English is the language of user's iPhone then app name is "Hello" and if the language is French it would be "Bonjour". </p>
<p>Thanks in advance. </p>
| iphone | [8] |
3,817,767 | 3,817,768 | What's the purpose of is_uploaded_file()? | <p>Docs say:</p>
<blockquote>
<p>Returns TRUE if the file named by filename was uploaded via HTTP POST</p>
</blockquote>
<p>How could <code>$_FILES['blah']['tmp_name']</code> possibly not be the result of a POST upload? PHP created this filename. </p>
<blockquote>
<p>This is useful to help ensure that a malicious user hasn't tried to
trick the script into working on files upon which it should not be
working--for instance, /etc/passwd.</p>
</blockquote>
<p>I understand that I should carefully check the file contents and size. But how could an attacker control whatsoever the <strong>temp filename</strong> of the uploaded file?</p>
<p>Or does <code>is_uploaded_file()</code> do some other checks?</p>
<p>Thanks for shedding some light.</p>
| php | [2] |
996,991 | 996,992 | confguring wpf application to call com component | <p>Is there an alternative to CoInitialize() in C#/WPF application to load and use COM components? Is there any settings i need to check while creating the WPF application for COM compliance?</p>
| c# | [0] |
5,615,268 | 5,615,269 | PHP - get called functions list | <p>In PHP, get_included_files(). It return an array with the names of included files.</p>
<p>In this way, Is any way to get an array with the names of called functions with parameters?</p>
| php | [2] |
4,396,985 | 4,396,986 | getElementsByTagName is returning empty list in Chrome (but not in firefox) | <p>I have js function which is trying to set XMLDoc object and also setting one of the global parameter (modelingDiagram).</p>
<p>While trying to get elements by tag name, it is returning always empty list (but not in firefox).
During debugging I come to know that it is returning empty list for any tag that I try in watch area -
xmlDoc.getElementsByTagName('Processes'); OR xmlDoc.getElementsByTagName("desc");</p>
<p>Following is the js function. Commented area indicates where I got the exception.</p>
<pre><code>function setXmlDoc(text)
{
if (window.ActiveXObject){
var doc=new ActiveXObject('Microsoft.XMLDOM');
doc.async='false';
doc.loadXML(text);
} else {
var parser=new DOMParser();
var doc=parser.parseFromString(text,'text/xml');
}
xmlDoc = doc;
modelingDiagram = xmlDoc.getElementsByTagName('Processes')[0].getElementsByTagName('ModelingDiagram');
//Uncaught TypeError: Cannot call method 'getElementsByTagName' of undefined
}
</code></pre>
<p>text variable contains xml in string format- </p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<Processes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="">
<Process>
<desc value="Z45 Accounting">Z45 Accounting</desc>
<height value="541">541</height>
<width value="411">411</width>
<xval value="50">50</xval>
<yval value="50">50</yval>
<Flowelements>
....
....
....
</code></pre>
<p>I could not able to make out what is that Chrome is expecting here to get the proper list?</p>
| javascript | [3] |
1,922,232 | 1,922,233 | xml files in android : How to design them and access in java code | <p>How to edit xml files within layout directory in android. And how can I use controls (defined in xml file) in my java code. </p>
| android | [4] |
5,352,507 | 5,352,508 | How to determine a web visitor's country of origin? | <p>How to determine a web visitor's country of origin?</p>
| php | [2] |
2,769,152 | 2,769,153 | How to extract UIBarButtonItem Icons from the iPhone SDK? | <p>I'd like to extract the default UIBarButtonItem icons from the iPhone SDK. I imagine they're probably stored in the iPhoneSimulator platform as alpha-channel-only PNGs, but I've yet to find it.</p>
<p>The one I'm looking for is UIBarButtonSystemItemReply. (For those suspicious that there's even a valid use case for this, I'm looking to use this on a table row header where the user can post replies, row-wise)</p>
| iphone | [8] |
3,865,423 | 3,865,424 | Date conversion in php 1970-01-01 | <p>Hi all I am using date conversion as bellow </p>
<pre><code>$startdate='12/10/2012';
$newstartdate = date('Y-m-d',strtotime($startdate));
</code></pre>
<p>some time it works but some time it shows <strong>1970-01-01</strong></p>
<p>Example: 12/10/2012 works
13/10/2012 does not works shows 1970-01-01</p>
| php | [2] |
3,370,405 | 3,370,406 | How to change a text with jquery | <p>h1 with id of toptitle is dynamically created and I am not able to change it.
It will have a different title depends on a page. Now when it is Profil, I want to change it to "New word" with jquery.</p>
<pre><code>Changing only when it is Profile
<h1 id="toptitle">Profil</h1>
to
<h1 id="toptitle">New word</h1>
</code></pre>
<p>Nore: If the text is Profil then change it to New word.</p>
<p>Any help will be appreciated.
Thanks in advance.</p>
| jquery | [5] |
3,946,699 | 3,946,700 | php mail: check whether server needs authentication or not? | <p>On some servers, the PHP <code>mail()</code> function requires SMTP authentication (i.e., we have to provide an email address and password). How do I determine through a PHP script if the server requires authentication or not?</p>
| php | [2] |
1,870,739 | 1,870,740 | Accesing Amazon for my App | <p>I am developing an app for which i need to access amazon. That is, I want to access the mp3 based on the user's selection. Is there any SDK available for amazon that I could use in my app. </p>
<p>Any help is appreciated.</p>
| android | [4] |
5,769,163 | 5,769,164 | Nesting if else statements in PHP to validate a URL | <p>I'm currently writing up a function in order to validate a URL by exploding it into different parts and matching those parts with strings I've defined. This is the function I'm using so far: </p>
<pre><code>function validTnet($tnet_url) {
$tnet_2 = "defined2";
$tnet_3 = "defined3";
$tnet_5 = "defined5";
$tnet_7 = "";
if($exp_url[2] == $tnet_2) {
#show true, proceed to next validation
if($exp_url[3] == $tnet_3) {
#true, and next
if($exp_url[5] == $tnet_5) {
#true, and last
if($exp_url[7] == $tnet_7) {
#true, valid
}
}
}
} else {
echo "failed on tnet_2";
}
}
</code></pre>
<p>For some reason I'm unable to think of the way to code (or search for the proper term) of how to break out of the if statements that are nested.</p>
<p>What I would like to do check each part of the URL, starting with <code>$tnet_2</code>, and if it fails one of the checks (<code>$tnet_2</code>, <code>$tnet_3</code>, <code>$tnet_5</code> or <code>$tnet_7</code>), output that it fails, and break out of the if statement. Is there an easy way to accomplish this using some of the code I have already?</p>
| php | [2] |
4,955,710 | 4,955,711 | Java - alternative to InputStreamReader? | <p><strong>Has been resolved. Ignore</strong></p>
<p>I have an <code>InputStream</code> that provides lines of output at set intervals. I need this wrapped up in a <code>BufferedReader</code> somewhere else, so I tried wrapping it up in an <code>InputStreamReader</code> with</p>
<pre><code>myReader = new InputStreamReader(new MyStream(soureFile,interval));
</code></pre>
<p>However, now <code>myReader</code> blocks at the first <code>read()</code> until my stream made the entire output available. Is there some alternative to InputStreamReader that doesn't do that?</p>
<p>(Just for sake of completeness: Yes, I tested my InputStream - it's really the InputStreamReader that's doing the blocking).</p>
| java | [1] |
4,869,174 | 4,869,175 | Jquery .find.animate to break and repeat | <p>I have the following jquery function that aimates my text. Basically it finds all the elements I ask it to and it animates them. The problem is, as you can see, is that it find ALL the elements at once and animate them all simultaneously. I want each element(h2, h3 and span) to be animated separately from one another. </p>
<p>Any suggestions? Maybe some kind of a break between the .find commands?
Thanks!</p>
<pre><code> $nextSlide.find('div.ei-title > h2')
.css( 'margin-right', 50 + 'px' )
.stop()
.delay( this.options.speed * this.options.titlesFactor )
.animate({ marginRight : 0 + 'px', opacity : 1 }, this.options.titlespeed, this.options.titleeasing )
.end()
.find('div.ei-title > h3')
.css( 'margin-right', -50 + 'px' )
.stop()
.delay( this.options.speed * this.options.titlesFactor )
.animate({ marginRight : 0 + 'px', opacity : 1 }, this.options.titlespeed, this.options.titleeasing )
.end()
.find('div.ei-title > span.custom1')
.css( 'margin-right', -50 + 'px' )
.stop()
.delay( this.options.speed * this.options.titlesFactor )
.animate({ marginRight : 0 + 'px', opacity : 1 }, this.options.titlespeed, this.options.titleeasing )
.end
.find('div.ei-title > span.custom2')
.css( 'margin-right', -50 + 'px' )
.stop()
.delay( this.options.speed * this.options.titlesFactor )
.animate({ marginRight : 0 + 'px', opacity : 1 }, this.options.titlespeed, this.options.titleeasing )
.end
</code></pre>
| jquery | [5] |
5,615,460 | 5,615,461 | bind function to an element that created by javascript | <p>i want to create a calendar with javascript: </p>
<p>i'm create elements by this function:</p>
<pre><code>createElem : function (name, attrs){
var el = document.createElement(name);
for(var key in attrs) {
el.setAttribute(key, attrs[key]);
}
return el;
}
</code></pre>
<p>table :</p>
<pre><code>var tb=this.createElem("table", {"class":"p-calendar", id: "p-calendar"});
</code></pre>
<p>rows and cells :</p>
<pre><code>for(var i=2; i<to; i++){
tb.insertRow(i);
for(var j=0; j < 7; j++){
tb.rows[i].insertCell(j);
.
.
</code></pre>
<hr>
<p>so in my loop:</p>
<pre><code>tb.rows[i].cells[j].className="day"; // it's work
</code></pre>
<p>but :</p>
<pre><code>tb.rows[i].cells[j].onclick = function(){
tb.rows[i].cells[j].id = "today";
} // Unable to set property 'id' of undefined or null reference
</code></pre>
<ol>
<li><strong>Why does the error?!</strong></li>
<li><strong>what is best way to bind function to an element that created by
javascript?</strong></li>
</ol>
<p>Thanks in advance.</p>
| javascript | [3] |
4,748,117 | 4,748,118 | shorthand variable assignment | <p>In java I'm trying to use shorthand variable assignment like below. Currently <code>owner</code> is assigned on a different line but I'd like to put it on the same line as below. This isn't working - is it not possible or is there another route?</p>
<pre><code> if ((User owner = search.getOwner()) instanceof User && owner.getId() != null) {
searchQuery.append("owner_id = :ownerId AND ");
queryMap.put("ownerId", owner.getId());
}
</code></pre>
<p>Thanks</p>
| java | [1] |
345,844 | 345,845 | Java, which version to learn? | <p>I wanna start learning Java.
I have a book that covers Java 5.0, but i hear that in few days there'll be a new version of Java, so i wanna ask if it will be better to wait for some new book, or to start with 5.0?</p>
<p>thanks</p>
| java | [1] |
4,863,333 | 4,863,334 | Extract Track Information from the uploaded song | <p>I would like to extract some of the information of the uploaded <code>.mp3</code> files like artist, album, and album art and use it to store them in database and also extract the album art and save it on a separate server folder.</p>
<p>How?</p>
| php | [2] |
2,710,248 | 2,710,249 | AsyncTask won't stop even when the activity has destroyed | <p>I have an AsyncTask object which starts executing when the activity is created and does stuff in the background (downloads upto 100 images). Everything works fine but there is this peculiar behavior which i'm not able to understand. </p>
<p>For eg: when the android screen's orientation changes then the activity is destroyed and created again. So I override the onRetainNonConfigurationInstance() method and save all the downloaded data executed in the AsyncTask. My purpose of doing this is to not have AsyncTask run each time activity is destroyed-created during orientation changes, but as i can see in my logs the previous AsynTask is still executing. (The data is saved correctly though)</p>
<p>I even tried to cancel the AsynTask in the onDestroy() method of the activity but the logs still show AsynTask as running.</p>
<p>This is really strange behavior and would really be thankful if someone can tell me the correct procedure to stop/cancel the AsynTask.</p>
<p>Thanks</p>
| android | [4] |
2,291,455 | 2,291,456 | Is chain of StringBuilder.append more efficient than string concatenation? | <p>According to Netbeans hint named <strong>Use chain of .append methods instead of string concatenation</strong></p>
<blockquote>
<p>Looks for string concatenation in the parameter of an invocation of the append method of StringBuilder or StringBuffer.</p>
</blockquote>
<p>Is StringBuilder.append() really more efficient than strings concatenation?</p>
<p>Code sample</p>
<pre><code>StringBuilder sb = new StringBuilder();
sb.append(filename + "/");
</code></pre>
<p>vs.</p>
<pre><code>StringBuilder sb = new StringBuilder();
sb.append(filename).append("/");
</code></pre>
| java | [1] |
5,022,818 | 5,022,819 | shared preference and clear history/data | <p>If I use sharedpreference in android to store the data locally on a device for lifetime of application (until app is uninstalled), is there a risk of losing it when user opts to "clear data" from android's -> menu-> settings->manage applications>clear data. Please advise, thanks.</p>
| android | [4] |
4,212,775 | 4,212,776 | Rainbow animated text jQuery destroying innerHTML | <p>I have a simple markup</p>
<pre><code><a href="/u1"><span style="color:#FF0000"><strong>Mr.EasyBB</strong></span></a>
</code></pre>
<p>This is the jQuery caller for the API Rainbow</p>
<pre><code>$('a[href="/u1"]').rainbow({
colors: [
'#FF0000',
'#f26522',
'#fff200',
'#00a651',
'#28abe2',
'#2e3192',
'#6868ff'
],
animate: true,
animateInterval: 100,
pad: false,
pauseLength: 100,
});
</code></pre>
<p>Though whenever I make it go it shows the HTML as the link. To better understand please visit the jsfiddle I have provided since this is so strange!</p>
<p><a href="http://jsfiddle.net/sr5df/" rel="nofollow">http://jsfiddle.net/sr5df/</a></p>
<p>If someone knows of a fix please help me out here, this is just mind boggling.
</p>
| jquery | [5] |
4,350,398 | 4,350,399 | What is the purpose of a private class in c#? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3235283/is-it-possible-to-have-a-private-class">Is it possible to have a private class?</a> </p>
</blockquote>
<p>Please explain why a developer would create private class. What is the purpose of a private class?</p>
<p>Example:</p>
<pre><code>private class ClassB
{
public DoSomething()
{
}
}
</code></pre>
| c# | [0] |
3,438,708 | 3,438,709 | Accessing outer class properties | <p>How can I access outer class properties in JavaScript?</p>
<p>For example:</p>
<pre><code>var outer = {
outerField: 15,
inner: {
innerFunc: function () {
// <-- How can I get access to outerField here?
}
}
};
</code></pre>
| javascript | [3] |
3,231,417 | 3,231,418 | Jquery Select DIV below Table | <p>I have some simple markup:</p>
<pre><code><table>
<tr>
<td>Menu Item</td>
</tr>
</table>
<div>
<table>
<tr>
<td>Menu Item Sub Menu</td>
</tr>
</table>
</div>
</code></pre>
<p>Im currently hiding the DIV, however if you click the in the first table I want it to .show() the Table in the div.</p>
<p>Does that make sense?</p>
<p>I should really get my head around, parent(), next(), find()</p>
| jquery | [5] |
3,283,079 | 3,283,080 | Syntax error on token "QUOTE", VariableDeclaratorId expected after this token | <p>I've posted a bigger chunk of the code below. You can see that initially QUOTE was procedural- coded in place. I'm trying to learn how to use declarative design so I want to do the same thing but by using resources. It seems like I need to access the string.xml thru the @R.id tag and identify QUOTE with that string value. But I don't know enough to negotiate this. Any tips? Thanks!</p>
<p>public class circle extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new GraphicsView(this));
}</p>
<p>static public class GraphicsView extends View {</p>
<pre><code> //private static final String QUOTE = "Happy Birthday to David.";
private final String QUOTE = getString(R.string.quote);
</code></pre>
<p>.....
@Override
protected void onDraw(Canvas canvas) {
// Drawing commands go here</p>
<pre><code> canvas.drawPath(circle, cPaint);
canvas.drawTextOnPath(QUOTE, circle, 0, 20, tPaint);
</code></pre>
| android | [4] |
1,460,187 | 1,460,188 | simple html dom not working correctly | <p>This is my code:</p>
<pre><code><?php
include("includes/simple_html_dom.php") ;
$url_to_get = "http://getconfused.net/" ;
$homePage = file_get_html($url_to_get);
$allLinks = $homePage->find('a');
foreach ( $allLinks as $link)
{
$href = $link->innertext ;
echo $href . "</br>" ;
}
?>
</code></pre>
<p>Simple. Just fetch a page, find any links and print the innertext(<code><a >innertext</a></code>) . But for some reason simple html dom here is skipping a lot of links. TO be specific, its missing all the links from the first div (<code><div id="getconfused"></code>) of the page.
Why ? what can one do to remedy the problem?</p>
| php | [2] |
3,635,662 | 3,635,663 | related to variables | <p>_Shopid =0;</p>
<p>_forename=””;</p>
<p>_dateofbirth=?</p>
<p>id is int represented by 0 </p>
<p>forename is string represented by double qoutations like ""</p>
<p>how to represent dateof birth </p>
| c# | [0] |
256,956 | 256,957 | How do I update a variable from javascript setInterval? | <p>Say I have an object:</p>
<pre><code>var myObj = function {
this.count = 0;
}
myObj.prototype {
setCount : function() {
var interval = setInterval(function() {
this.count++;
}, 500);
}
}
</code></pre>
<p>The issue is count is always undefined within the setInterval so i can never increment the count variable within myObj to be something other than 0.</p>
| javascript | [3] |
2,900,884 | 2,900,885 | Are these two ways of constructing an object in JavaScript equivalent? | <p>Given:</p>
<pre><code> function A(name) {
this.name = name;
}
</code></pre>
<p>is:</p>
<pre><code> var a1 = new A("A1");
</code></pre>
<p>exactly equivalent to:</p>
<pre><code> var a1 = {};
A.call(a1, "A1");
a1.__proto__ = A.prototype;
</code></pre>
<p>?</p>
<p>Thanks</p>
| javascript | [3] |
1,050,695 | 1,050,696 | How to Configure all MachineToApplication settings in your application's root? | <p><code>Default allowDefinition='MachineToApplication'</code> </p>
<p>I have been looking around on different sites and fora, and i have a similar problem than some people had before... it is an error to use a section registered as allowDefinition='MachineToApplicat</p>
<p>How to use this solution:</p>
<p>Configure all MachineToApplication settings in your application's root,
and remove all MachineToApplication settings from your application's
subdirectories.</p>
| asp.net | [9] |
2,379,326 | 2,379,327 | C++ friend class data access | <p>C++ newbie here.</p>
<p>I am a science guy writing a cfd (ish) code. I have created a class for all solving functions, and one that handles operations on a grid. The grid class wants to be able to see a few of the variables stored in the solving class, as passing them all to the grid class seems like a bit of effort.</p>
<p>So in my research I came across friend classes, but can't seem to get it to work. Please see the fully cut back example below. Class A is the solver, and it creates a grid class B. Even though I have written friend class B, I still get the following compile error (g++):</p>
<p>In member function 'void B::testB()':</p>
<p>error: 'a1' was not declared in this scope</p>
<p>Here is the code:</p>
<pre><code>#include <iostream>
using namespace std;
class B {
private:
int b1;
public:
void testB(){
cout<<a1<<endl;
};
};
class A {
friend class B;
private:
int a1;
public:
void testA(){
a1=2;
B b;
b.testB();
};
};
int main(){
A a;
a.testA();
}
</code></pre>
| c++ | [6] |
2,629,306 | 2,629,307 | Thread returns error in android 4.0.3 version | <p>I have a question that I have a splash screen in my android app in which I am using thread to wait for 8 seconds, it is running fine in 1.6,2.1,2.2,2.3.3, 3.0, 3.1 but returns error when I want to run the same in 4.0.3 version of android, I don't know why? Please suggest me the right solution for the same. Below I mentioned error stack and my code also.</p>
<p><strong>Error Stack:</strong></p>
<pre><code>01-05 10:16:06.417: E/AndroidRuntime(589): FATAL EXCEPTION: Thread-75
01-05 10:16:06.417: E/AndroidRuntime(589): java.lang.UnsupportedOperationException
01-05 10:16:06.417: E/AndroidRuntime(589): at java.lang.Thread.stop(Thread.java:1076)
01-05 10:16:06.417: E/AndroidRuntime(589): at java.lang.Thread.stop(Thread.java:1063)
01-05 10:16:06.417: E/AndroidRuntime(589): at com.shipface.common.SplashScreen$1.run(SplashScreen.java:34)
</code></pre>
<p><strong>Code:</strong></p>
<pre><code>public class SplashScreen extends Activity {
/** Called when the activity is first created. */
Thread splash;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
splash = new Thread(){
@Override
public void run(){
try {
synchronized(this){
// Wait given period of time or exit on touch
wait(4000);
Intent intent = new Intent(SplashScreen.this,HomeActivity.class);
startActivity(intent);
finish();
}
}
catch(InterruptedException ex){
}
finish();
stop();
}
};
splash.start();
}
}
</code></pre>
| android | [4] |
2,719,275 | 2,719,276 | Android. How insert text in active EditText in other app? | <p>How to insert text in active EditText in another application?
It's really?</p>
| android | [4] |
4,683,553 | 4,683,554 | Java Process can't get ErrorStream message | <p>everyone, I have a process that needs to get standard output and log/error/exception output from the subprocess. The standard output is fine, but I can't get ErrorStream, therefore the program is stuck there because of that. Here is my simple code. There is nothing magic, but why can't I get the error stream here? Thanks for looking at it.</p>
<pre><code> BufferedReader standard =
new BufferedReader(new InputStreamReader(process.getInputStream()));
BufferedReader error =
new BufferedReader(new InputStreamReader(process.getErrorStream()));
String line = null;
while ((line = standard.readLine()) != null) {
System.out.println(line);
}
while ((line = error.readLine()) != null) {
System.out.println(line);
}
</code></pre>
<p>Now, as suggested, i used two threads to process the output and error streams, but still had the same problem, as follows. Can anybody give me some insights? Thanks.</p>
<pre><code> ProcessBuilder pb = new ProcessBuilder(listArgs);
pb.redirectErrorStream();
Process process = pb.start();
StreamThread output = new StreamThread(process.getInputStream());
StreamThread error = new StreamThread(process.getErrorStream());
output.start();
error.start();
while (true) {
try {
output.join();
break;
}
catch (InterruptedException ie) {
ie.printStackTrace();
}
}
</code></pre>
<p>The definition of the StreamThread:</p>
<pre><code> public static class StreamThread extends Thread{
private InputStream input = null;
public StreamThread(InputStream in){
input = in;
}
String line = null;
public void start(){
BufferedReader reader = new BufferedReader(new InputStreamReader(input));
try{
while( (line=reader.readLine()) != null ){
System.out.println(line);
}
reader.close();
}catch (IOException e){
e.printStackTrace();
}
}
}
</code></pre>
| java | [1] |
5,261,814 | 5,261,815 | IBM as/400 developer kit for java | <p>i am going to work on application which access some files from as/400 server.can anyone help me for installing as/400 developer kit in java so that i can start getting files from that server.</p>
<p>please help me.</p>
| java | [1] |
656,770 | 656,771 | How to calculate average word length | <p>I have tried to calculate the average word length but I keep getting an error appear.</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.IO;
using System.Text;
namespace textAnalyser
{
public class Analyser
{
public static void Main()
{
// Values
string myScen;
string newScen = "";
int numbChar = 0;
string userInput;
int countedWords = 0;
//User decsion on how to data is inputted
Console.WriteLine("Enter k for keyboard and r for read from file");
userInput = Convert.ToString(Console.ReadLine());
//If statement, User input is excecuted
if (userInput == "k")
{
// User enters their statment
Console.WriteLine("Enter your statment");
myScen = Convert.ToString(Console.ReadLine());
// Does the scentence end with a full stop?
if (myScen.EndsWith("."))
Console.WriteLine("\n\tScentence Ended Correctly");
else
Console.WriteLine("Invalid Scentence");
</code></pre>
<p>Calculating the number of characters in a word</p>
<pre><code>// Calculate number of characters
foreach (char c in myScen)
{
numbChar++;
if (c == ' ')
continue;
newScen += c;
}
Console.WriteLine("\n\tThere are {0} characters. \n\n\n", numbChar);
// Calculates number of words
countedWords = myScen.Split(' ').Length;
Console.WriteLine("\n\tTherer are {0} words. \n\n\n", countedWords);
</code></pre>
<p>This is where I have tried to calculate the average word length
//Calculate Average word length</p>
<pre><code>double averageLength = myScen.Average(w => w.Length);
Console.WriteLine("The average word length is {0} characters.", averageLength);`}
</code></pre>
| c# | [0] |
105,569 | 105,570 | Passing variable in jQuery through bind doesn't seem to work | <p>Here's my code that does work:</p>
<pre><code>function mouseOver()
{
$(".beaver").fadeIn(100);
}
function mouseOut()
{
$(".beaver").fadeOut(100);
}
$("#group_beaver").bind('mouseenter', mouseOver).bind('mouseleave', mouseOut);
</code></pre>
<p>But why doesn't this work?</p>
<pre><code>function mouseOver(variable)
{
$(variable).fadeIn(100);
}
function mouseOut(variable)
{
$(variable).fadeOut(100);
}
$("#group_beaver").bind('mouseenter', mouseOver('.beaver')).bind('mouseleave', mouseOut('.beaver'));
</code></pre>
| jquery | [5] |
4,684,719 | 4,684,720 | overuse of jQuery's on method? | <p>I am using Google Analytic's event tagging on a somewhat complicated code base. Instead of going through every file and finding where all of the necessary events are, I was thinking of creating new events using jQuery's on method to delegate them. Should I be concerned about any potential performance issues by going along this route?</p>
| jquery | [5] |
4,047,718 | 4,047,719 | .val() of jquery not working for select element on IE | <p>I tried all these for selected value of select element </p>
<pre><code>inventory_rule = $("#inventory_rule :selected").attr('value');
inventory_rule = $("#inventory_rule option:selected").val();
inventory_rule = $("#inventory_rule").attr('value');
inventory_rule = $("#inventory_rule").val();
</code></pre>
<p>these all worked well in mozilla but not in IE</p>
<p>is any alternative</p>
| jquery | [5] |
2,395,250 | 2,395,251 | Jquery push elements in an array | <p>I am not sure if there is a mistake in my existing code or the functionality in Jquery Array is like below:</p>
<pre><code>var categories = [];
$(this).children('categories').each(function() {
categories.push($(this).find('name').text());
});
</code></pre>
<p>Now when I have the below XML node :</p>
<pre><code><categories>
<name>a</name>
<name>b</name>
<name>c</name>
</categories>
</code></pre>
<p>I see that in Firebug the categories array has one element - "abc" but actually it should be as index 2 with values as 'a','b' and 'c'</p>
<p>Is there something wrong in my code?</p>
| jquery | [5] |
1,127,745 | 1,127,746 | Why can a constructor be called only once per instance? | <p>Why are constructor calls in Java allowed only once per instance? If would be useful to set multiple instance variables in one call rather than calling several setters.</p>
| java | [1] |
1,184,163 | 1,184,164 | Is Universal application can deploy on iOS 3.0? | <p>Is it possible?</p>
| iphone | [8] |
1,194,034 | 1,194,035 | What is the best way to pass server side variables to JavaScript on the client side? | <p>Our application uses a lot of configuration options. Those options need to be reflected on the client side in the form of User preferences, site wide preferences, etc.</p>
<p>Currently, we pass server side settings down to the client side in the form of JSON that is stored in custom attributes in the markup for a specific element (and no, our application currently doesn't worry about W3C validation). We then retrieve the data from the custom attribute, and parse it into a JSON object for use in script using jQuery.</p>
<p>One drawback to this is referencing attributes on elements from within event handlers. I know this is frowned upon, as it can create circular references, and subsequently memory leaks. I would much prefer to use jQuery's data function, but you can't invoke this from the server side at page render time.</p>
<p>What does everyone else do in this type of scenario?</p>
| javascript | [3] |
1,492,554 | 1,492,555 | Is there an alternative to startActivity()? | <p>I am making my first android application, and it requires switching between activities very frequently. I know I can call finish() to end the current Activity, but I was wondering if there was a way to not call finish() or startActivity(), but to somehow return to the old instance of that Activity? Not using the back button either.</p>
<p>If anyone has any ideas please let me know.
Thanks</p>
| android | [4] |
3,962,134 | 3,962,135 | How to keep track of the id that is being passed to other web page? | <p>I am fairly new to html and js.
Let say if I have the following codes in index.html:</p>
<pre><code><a href='edit.html?id=1>item1</a>
<a href='edit.html?id=2>item2</a>
<a href='edit.html?id=3>item3</a>
</code></pre>
<p>then I create a page named edit.html
But How do I keep track of the id(1 or 2 or 3) that is being passed to edit.html using jquery or js? </p>
<p>Please help..</p>
| jquery | [5] |
4,448,080 | 4,448,081 | Android: How to Upload Images from the SD Card | <p>In my application, I want to upload the images from the SD card with restricting the user to upload only less than 2mb. How can I accomplish this?</p>
| android | [4] |
3,403,275 | 3,403,276 | jQuery Check for Hidden DIVs then display message | <p>I've some code where I'm showing/hiding DIVs based on choices made in 2 select drop downs. This is working great. Now, I'm trying to display a "no results" message when nothing matches the choices.</p>
<p><a href="http://jsfiddle.net/Psykopup/hDWAh/" rel="nofollow">My Fiddle</a></p>
<p>It's almost working. The problem is that the "no results" message shows when it needs to, but doesn't hide when should. Any assistance would be greatly appreciated.</p>
| jquery | [5] |
1,904,620 | 1,904,621 | Execution time of for loop over elements is faster than the inner AJAX call can respond | <p>I have function LoadTempMovieList(), and need to load movies from sessionStorage. But it seems that the execution time of the for loop is faster than the AJAX call I'm making can respond, so the order of final output is not correct sometimes. How can I solve this problem?</p>
<pre><code>function LoadTempMovieList(){
var obList = [];
if(sessionStorage.struct != null){
alert(sessionStorage.struct);
obList = sessionStorage.struct.split(",");
for(var i=0; i<obList.length;i++){
MovieLoader(obList[i],"movie");
//it use setTimeOut(), the problem also present
}
}
}
</code></pre>
<p>update</p>
<pre><code>function MovieLoader(name,type,movieArray){
$.ajax({
...
data:{shortName:name,type:type},
dataType:'html',
success:function (html){
if(html!="0"){
...
}else{
...
}
}
});
}
</code></pre>
| javascript | [3] |
4,289,634 | 4,289,635 | Banking Certification for Java Developer | <p>Can anyone suggest me, banking certification details for working people
1. Institutions Details
2. Exam Names
3. How can we take the test.</p>
<p>Thanks in advance</p>
| java | [1] |
2,549,520 | 2,549,521 | Converting a range or partial array, in the form "3-6" or "3-6,12", into an array of integers, like 3,4,5,6,12 | <p>I'm a little baffled by this one, and I'm struggling to find any similar examples online at the moment.</p>
<p>Working in PHP, I want to take input, probably from a form field, of a either a "list of values", a "range" or a combination of the two, in the form;</p>
<pre><code>3,5,6,9,11,23
</code></pre>
<p>or</p>
<pre><code>3-20
</code></pre>
<p>or</p>
<pre><code>3-6,8,12,14-50
</code></pre>
<p>I want to return these as an array of integers, so, for example</p>
<pre><code>3,4,5,6,8,12,14,15,16...
</code></pre>
<p>I won't type them all out, but the idea is quite obvious!</p>
<p>Is there either a function available that does this, or where would I start in writing one?</p>
| php | [2] |
883,023 | 883,024 | Best way to parse this string | <p>In PHP what is the most efficient way to parse this string into an associative array?</p>
<pre><code>%STCITY^LASTNAME$FIRSTNAME$MIDDLENAME^ADDRESS1$ADDRESS2^?;UNIQUEID=YYMMDDYYMMDD=?
</code></pre>
| php | [2] |
2,548,036 | 2,548,037 | where can I found the file in the host machine when installed it using `adb push /data/hello.apk` on simulator | <p>I am assuming that , in the host machine , i can find a file calling <code>$(PREFIX)/data/hello.apk</code>. But I did not find it , either in <code>android-sdk-linux_x86/platforms/android-8/data</code> nor in <code>~/.android/avd/myAvd</code>
`</p>
| android | [4] |
1,653,272 | 1,653,273 | get millisecond part of time | <p>I need to get milliseconds from the timer</p>
<pre><code> // get timer part
time_t timer = time(NULL);
struct tm now = *localtime( &timer );
char timestamp[256];
// format date time
strftime(timestamp, sizeof(timestamp), "%Y-%m-%d_%H.%M.%S", &now);
</code></pre>
<p>I want to get like this in C#: </p>
<pre><code>DateTime.Now.ToString("yyyy-MM-dd_HH.mm.ss.ff")
</code></pre>
<p>I tried using %f or %F but it does work with C++. how can I get %f for miliseconds from tm?</p>
<p>Thanks in advance</p>
| c++ | [6] |
5,288,276 | 5,288,277 | How to go to particular page in grid view | <p>I have grid view with 1,2,3,4,.... at the bottom in a.aspx
when I click a button in b.aspx I need to go to a particular page in grid (i.e I have to 2 page of grid when I press button) </p>
| asp.net | [9] |
5,973,316 | 5,973,317 | drawing an image in a customized UIView | <p>I'm drawing an image... but my problem is that if there's another imageview in the view, my drawn image (green circle) is not visible, seems it's a lower layer than the imageView.</p>
<p>First, what I've do is that I subclass UIView, MyDrawView, in this is class I do the drawing functionality.
Then, I set in IB the view to be MyDrawView.</p>
<p>Here's my sample code:
<a href="http://snipplr.com/view/37149/draw-image/" rel="nofollow">http://snipplr.com/view/37149/draw-image/</a></p>
<p>Can you advise me how to fix this problem?</p>
<p>Thanks</p>
| iphone | [8] |
726,681 | 726,682 | How can private member variables in a superclass be accessed in a subclass? | <p>I want to do something like:</p>
<pre><code>/*
* Superclass.h
*
*/
class Superclass
{
const int size;
public:
Superclass():size(1){}
~Superclass(){}
};
/*
* Subclass.h
*
*/
#include "Superclass.h"
class Subclass : public Superclass
{
public:
Subclass(){size;}
~Subclass(){}
};
</code></pre>
| c++ | [6] |
4,142,291 | 4,142,292 | Image should not lose quality and add white spaces around the image | <p>Hi guys i have a bitmap with size 600*420 and i need to post the image in size 900*900..so the image is stretched.but i don't want it to be stretched i need that image to add white spaces and save the quality.</p>
| android | [4] |
2,901,333 | 2,901,334 | PHP's IF and ELSE at one time | <p>A code with the missing condition in the statement if:</p>
<pre><code>if ( ... ) {
echo 'BBB';
}
else {
echo 'AAA';
}
</code></pre>
<p>Question: What should I write in a missed condition that the output of this code was a line:
AAABBB</p>
| php | [2] |
5,461,919 | 5,461,920 | Dealing with extremely large strings | <p>Hey all, I am writing a logviewer application. These logs are between 100-200 megs (almost never larger than that) of pure text. </p>
<p>My application will be not only used to make the reading of said logs easier, but to offer tons of options on parsing (filters/searches, ect). Anywho, the files are on a network drive so I currently use FileStream and BufferedStream to read them in, which depending on the file takes about 15 seconds.</p>
<p>My first question is there a faster way to do this? ReadLine made parsing easier, but clocked in at about 25 seconds.</p>
<p>Secondly, if the user is just playing around with one file alot (using different combos of filters and searches, whats the best way to deal with it in the applications memory? I mean I could just re-read it each time but thats silly. I tried storing the whole file in a global StringBuilder which seemed to work, but I couldnt pass it on to other functions (OutOfMemoryException).</p>
<p>Whats the best way to deal with what ends up being a gigantic string? (Keep in mind no manipulations are being made, just pure reads/filter out what the user dosn't want to see.</p>
<p>Thanks guys!</p>
| c# | [0] |
3,278,421 | 3,278,422 | Jquery How to use .live on draggable | <p>I am using dragabble method from jquery ui. How to apply live() on draggable.</p>
<pre><code>$("#image").draggable({ containment: [10, 150, 0, 0], scroll: false});
</code></pre>
<p>What I tried is this </p>
<pre><code>$("#image").live("draggable", function () {
.draggable({ containment: [10, 150, 0, 0], scroll: false});
</code></pre>
<p>But this is not working.</p>
<p>Thanks</p>
| jquery | [5] |
5,410,904 | 5,410,905 | How to import variables into different files in python | <p>I am new to python scripting.</p>
<p>I have 3 files.</p>
<ol>
<li>a.py</li>
<li>b.py</li>
<li>c.py</li>
</ol>
<p>In the files:</p>
<ul>
<li><p>a.py : having all variables deceleration</p></li>
<li><p>b.py : I am importing the a.py to use the variables declared in a.py like <code>import a</code></p></li>
<li><p>c.py: I need to use the initialized variables. i imported the a.py . but i am unable to use those defined variables.</p></li>
</ul>
<p>can anyone tell me how to use the variables in c.py.</p>
<p>a.py: declaration </p>
<pre><code>Variable_a = ' '
</code></pre>
<p>b.py:</p>
<pre><code>import a
Variable_a = "value"
</code></pre>
<p>how to use the above <code>Variable_a</code> value in c.py.</p>
| python | [7] |
3,774,794 | 3,774,795 | I want to start new Activity when i click on ListView's content | <pre><code>ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
Intent i = new Intent(this, contents.class);
startActivityForResult(i, 1);
</code></pre>
<p>But when i click on ListView it encounters en error. Tell me where i m wrong????</p>
| android | [4] |
4,302,276 | 4,302,277 | Making not editable EditText component | <p>I have an edit text. How can i make it non editable from the code.
By giving the tag android:editable we can do in the layout.. But i need to do it in the code...Pls Help</p>
| android | [4] |
4,889,661 | 4,889,662 | How can I set session timeout for 2-3 days in PHP? | <p>I would like to set my sessions to last for 2-3 days so that my users will not have to login to get data after days of being idle.</p>
<p>Please help me with the code to achieve this.</p>
| php | [2] |
1,620,073 | 1,620,074 | to add scrollbar within window | <p>I have 3 accordions in a same page.On the above of accordion there is header page.I want that headerpage should become still and on the part of accordions a scrollbar is there.so that when i scroll the page only inner page get scrolled instead of whole page .suggest using javascript</p>
| javascript | [3] |
2,720,829 | 2,720,830 | Can Server.MapPath used in c# files? | <p>i was trying to get physical path of a file, and got the information that <code>Server.MapPath</code> will give you. But for me in my windowform i am not getting that even i used namespace using <code>System.Web;</code> but still not getting?
for example if i have a file named "myTestClass.xml" somewhere in my system, and i need to get the physical path, what i need to do in button click event </p>
| c# | [0] |
2,139,766 | 2,139,767 | Enable input based on corresponding radio button | <p>I have a form with multiple options for Amounts to be sent to CC processing. I'd like the user to select the type of payment which then activates the amount input fields. I'm attempting to do this by setting the id of the radio button to correspond to the amount input field. How can I enable the input Amount field based on the radio button selected?</p>
<p>HTML</p>
<pre><code><input name="doantion-type" id="general" type="radio" value="General" />
<input name="doantion-type" id="occasion" type="radio" value="Occasion" />
<input name="doantion-type" id="building" type="radio" value="Building" />
<input name="doantion-type" id="program" type="radio" value="Program" />
<input id="general" autocomplete="off" class="input required" type="text" size="30" name="Amount">
<input id="occasion" autocomplete="off" class="input required" type="text" size="30" name="Amount">
<input id="building" type="hidden" value="1000" name="Amount">
<input id="program" type="hidden" value="180" name="Amount">
</code></pre>
<p>jQuery </p>
<pre><code>$("input[name=Amount]").prop('disabled', true);
$('input[name=doantion-type]:radio').click(function() {
var selectedDonation = '#' + $(this).attr('id');
//alert(selectedDonation);
$(selectedDonation).prop('disabled', false);
});
</code></pre>
| jquery | [5] |
1,570,724 | 1,570,725 | loading the dialog box when the page is loading | <p>i want to load a dialogue box before the page is load</p>
<p>like this
<a href="http://www.balam.in/personal/triponetDemo/pre-loader.html" rel="nofollow">Demo here</a>
in this demo it brings data by Ajax but in my case I did not use the Ajax to bring the data ? any idea please..</p>
| jquery | [5] |
4,735,443 | 4,735,444 | Registering derived classes in central list | <p>I have a central list of implementations of an interface and would like for derived classes to be able to register themselves in that list without having to add them in some central place. For example:</p>
<pre><code>// interface.h
struct MyInterface;
std::vector<MyInterface*>& InterfaceList();
struct MyInterface {
MyInterface() {
InterfaceList().push_back(this);
}
virtual ~MyInterface() {}
// ...
};
// derived.cpp
#include "interface.h"
class MyImplementation: public MyInterface {
public:
MyImplementation() {
}
// ...
};
MyImplementation impl;
</code></pre>
<p>This doesn't seem to work. For reasons I don't understand, the constructor of MyInterface never gets called - I would have thought that the instance of the derived class would call it at startup. I know it's possible to do something along these lines since I've seen other libraries doing it - but haven't managed to figure out what it is that I'm doing wrong.</p>
<p>Thanks :)</p>
<p>Edit: Sorry, missed a pair of braces and a reference. InterfaceList() is a function that returns a reference to a vector.</p>
<p>Edit part 2: Have now got it working in a reduced example, but can't get it to work in the files for the derived implementations - but that technique is working in another project. There must be something slightly different in those files which is causing it to fail - but it appears the problem isn't in the code I posted. Don't really want to post big chunks of my employer's projects though so I guess I'll have to keep fiddling myself. Thanks for the suggestions so far though :)</p>
| c++ | [6] |
2,842,831 | 2,842,832 | Find - using PHP and wrap everything after in <span> | <p>I am printing using PHP</p>
<pre><code><?php echo $article->link($article->title()); ?>
</code></pre>
<p>This string holds something like </p>
<pre><code>"Team Member - Job Title"
</code></pre>
<p>What id like to do is wrap everything after the dash in a span so i can change its colour.</p>
<p>Any help would be greatfully appreciated. </p>
| php | [2] |
3,923,736 | 3,923,737 | Capturing part of string from a txt file? | <p>I have a text file like this, separated by ";"
1022-3, 1603-4, 2012-5, 2489-6;</p>
<p>Gotta catch the first part before the "-" and pass to variable, and compare with milliseconds, if is equal the number, capture the number after of "-".
And do so with the next number after the semicolon, and so front.</p>
<pre><code>public static long MilliSeconds() {
// get Calendar instance
Calendar now = Calendar.getInstance();
return now.getTimeInMillis();
}
</code></pre>
<p>And the beginning of the code to do what I need this here</p>
<pre><code>private void LerArquivo() {
String lstrNomeArq;
File arq;
String lstrlinha;
long tempoInicio = 0;
long tempoDecorrido = 0;
try {
tempoDecorrido = (RecordSound.MilliSeconds() - tempoInicio);
lstrNomeArq = "/Android/data/br.com.couldsys.drumspro/cache/GravaSound.TXT";
String conteudotexto = "";
arq = new File(Environment.getExternalStorageDirectory(),
lstrNomeArq);
BufferedReader br = new BufferedReader(new FileReader(arq));
// pega o conteudo do arquivo texto
conteudotexto = br.readLine();
String capturaIndex = ("Conteudo do texto: "
+ conteudotexto.substring(
conteudotexto.indexOf("-") + 1,
conteudotexto.indexOf(";",
conteudotexto.lastIndexOf("-"))));
if (tempoDecorrido == capturatempo) {
DrumsProActivity.vsm.playSound(capturaindex);
// ler a nova linha
// se chegar ao final do string então para o while
if (conteudotexto.length() > 0) {
executar = false;
}
}
} catch (Exception e) {
trace("Erro : " + e.getMessage());
}
}
</code></pre>
| android | [4] |
3,568,478 | 3,568,479 | <authentication mode="Windows"/> | <p>I had this error when I browse new web site that site sub from sub </p>
<p><a href="http://sharp.elarabygroup.com/ha/deault.aspx" rel="nofollow">http://sharp.elarabygroup.com/ha/deault.aspx</a></p>
<p><strong>ha is new my web site</strong> </p>
<p></p>
<p>Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.</p>
<p>Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.</p>
<p>Source Error:</p>
<p>Line 61: ASP.NET to identify an incoming user.
Line 62: -->
Line 63:
Line 64: section enables configuration
Line 65: of what to do if/when an unhandled error occurs </p>
| c# | [0] |
2,152,213 | 2,152,214 | android - how to stop startup applications | <p>How I can programmatically find the list of applications that starts on device startup.
Is there any way to programmatically reset applications property to prevent run on startup .?</p>
<p>Thanks</p>
| android | [4] |
5,748,219 | 5,748,220 | How to Connect to rild Socket | <p>I'm trying to write an app to talk to the rild. And Yes, I know this is not politically correct, but it's an embedded industrial telemetry app so I'm not concerned about user experience, portability and all that stuff.</p>
<p>The problem is that when I try to connect, I get a java.io "Permission denied" exception. Can anybody help me?</p>
<p>The phone (Nexus One) is rooted with Cyanogenmod 7 and the app is running as superuser using the "SuperUser" app from Market.</p>
<p>My Code (abbreviated):</p>
<pre><code>try {
mSocket = new LocalSocket();
mSockAddr = new LocalSocketAddress( "rild", LocalSocketAddress.Namespace.RESERVED );
mSocket.connect( mSockAddr );
}
catch( Exception e ) {
dbg.p( "connect failed: "+e );
}
</code></pre>
<p>I see the rild (and rild-debug) sockets in /dev/socket.</p>
<pre><code>srw-rw---- 1 root radio 0 Feb 13 19:14 rild
srw-rw---- 1 radio system 0 Feb 13 19:14 rild-debug
</code></pre>
<p>Could it be that the Dialer app is already connected and hogging the socket?</p>
<p>BTW I initially tried to use the frameworks but got a humongus boatload of errors mostly about java and and third party classes unknown, so I gave up after days of hair-pulling. I've also STFW and this site - lot's of dancing around the issue but no concrete advice.</p>
<p>Any help greatly appreciated.
-John</p>
| android | [4] |
4,698,026 | 4,698,027 | C#: Convert a UInt16 in string format into an integer(decimal) | <p>Here's the problem.</p>
<p>I ,for example,have a string "2500".Its converted from byte array into string.I have to convert it to decimal(int).</p>
<p>This is what I should get:</p>
<pre><code>string : "2500"
byte[] : {0x25, 0x00}
UInt16 : 0x0025 //note its reversed
int : 43 //decimal of 0x0025
</code></pre>
<p>How do I do that?</p>
| c# | [0] |
1,216,054 | 1,216,055 | how to conver java class into visual class in eclipse? | <p>i have swing code which is written in eclipse with out help of visual editor(not choose the class as visual class), now i need to modify that code using visual editor, how can i convert the a java class into visual class?</p>
| java | [1] |
136,697 | 136,698 | PHP-Visitor from google | <p>How can I find with p h p if someone comes to my website from google? </p>
<pre><code><?php
if (isset($_COOKIE['source'])) {
$arr = explode("=",$_COOKIE['source']);
$_SESSION['source'] = $arr[1];
unset($_COOKIE['source']);
}
?>
</code></pre>
<p>This is how I get the source, to know where was the visitor before my site and I want to set <code>$_SESSION['source']="google"</code> if he was searching on Google to find my page.</p>
| php | [2] |
712,110 | 712,111 | What is PHP function overloading for? | <p>In languages like Java, overloading can be used in this way:</p>
<pre><code>void test($foo, $bar){}
int test($foo){}
</code></pre>
<p>Then if you called <code>test()</code> with 2 arguments e.g <code>test($x, $y);</code>, the first function would be called. If you passed only 1 argument e.g <code>test($x);</code>, the 2nd function would be called.</p>
<p>From the manual it seems that php 5 does have overloading, but what is it for? I can't seem to understand the manual on this topic..</p>
| php | [2] |
2,231,735 | 2,231,736 | verifying my understanding about pointers | <p>I just want to make sure if I understand the properties of pointers. So if I have something like this:</p>
<pre><code>#include <iostream>
using namespace std;
class Person
{
public:
Person(){myBook = new Book(4);}
void printPerson()
{
int i =0;
while(i<n)
{
cout<<myBook[i].n<<endl;
i++;
}
}
private:
Book *myBook;
int n;
};
class Book
{
public:
Book(int num)
{
int n =0;
}
int n;
};
</code></pre>
<p>Since the instance of Person class is a pointer, when I try to make a copy constructor and assignment operator=, I have to allocate a new Book for the new Person object. am I right? thx</p>
| c++ | [6] |
1,852,496 | 1,852,497 | problems with file I/O while running python 3.2 scripts in windows cmd, but not in IDLE | <p>I am a python noob, and am having problems running programs with open() functions in cmd prompts. The code runs as expected in the python shell with IDLE, but everytime I open it by doubleclicking the icon coresponding to the script( I have .py associated with python), I get errors like </p>
<p><code>what file test.txt (I entered input)<br>
file 2 atest2.txt (I entered intput)<br>
Traceback (most recent call last):<br>
File "C:\Users\Matthew\Desktop\file_io\find_differences_in_files.py", line 3,
in <module><br>
f=open(c,"r") # open c<br>
IOError: [Errno 22] Invalid argument: 'test.txt\r'</code></p>
<p>Similar problems occur in multiple similar programs, but here is a sample of code( FYI, this code finds the first difference in two .txt files) that worked in IDLE but not in cmd. Anybody have any clue what is going wrong?</p>
<pre><code>c=input("what file") # get file 1
d=input("file 2") # get file 2
f=open(c,"r") # open c
g=open(d,"r") # open d
p=f.readlines() # get every line of f
q=g.readlines()
i=0
while i<len(p) and i<len(q):
if p[i]!=q[i]:
break # stop counting up
i+=1
x=p[i] # store different line
y=q[i] # store different line
j=0
while j<len(x) or i<len(y):
if x[j]!=y[j]:
break # stop counting up
j+=1
print("The difference is in line %s column %s" % (i+1,j+1))
c=input("press enter")
</code></pre>
| python | [7] |
4,613,834 | 4,613,835 | How do I pass a struct from a class to a winform | <p>I tried to do something like this:</p>
<pre><code> m_mystruct = (Form1.mystruct)m_myclass.mystruct;
</code></pre>
<p>where both structs have same definition.</p>
<p>C# doesn't want to do the cast.</p>
<p>Update: instead of why, I modify my question </p>
<p>How do I pass a struct from a class to a winform ?</p>
| c# | [0] |
3,869,654 | 3,869,655 | C++ line output | <pre><code>cout << boolalpha ("1" < "0") << endl;
</code></pre>
<p>I was compiling this recently as a spin off from some course work I was doing. Why does this produce <code>true</code> when I execute it? </p>
<pre><code>cout << boolalpha (string("1") < string("0")) << endl;
</code></pre>
<p>does the comparison as expected.</p>
| c++ | [6] |
5,014,525 | 5,014,526 | get array values in python | <p>I have the values arr1 as 25,26 and arr2 values as A,B</p>
<p>Its always that the number of values in arr1 and arr2 are equal</p>
<p>My question is that</p>
<pre><code> for i in arr1.split(","):
print i //prints 25 and 26
</code></pre>
<p>is it not possible to get the values of arr2 in the same loop or should another loop be written only for this purpose.Basically the idea is that map the values of arr1 and arr2</p>
| python | [7] |
1,088,819 | 1,088,820 | alphabatically retreving data in php | <p>hi im very new to php and i did some small project(medicare system)
i created a database called "chapa",
and created a table called "drug".</p>
<p>there is a field called "des" in that table "des"=description
my table fields are =codeno!qty!size!des!rate
all i want is that "des" to be shown in alphabatically with other fields </p>
<p>that means the data which i enterd to "des" should be retrive with alphabatically </p>
<p>i'm asking the way that i can retreive these data in "des"
thanks</p>
| php | [2] |
4,542,505 | 4,542,506 | how to convert datarow into datatable | <pre><code>DataRow[] row = table.Select("Weight='57'");// has 1 record
DataTable dt = new DataTable();
foreach (DataRow dr in row)
{
dt.ImportRow(dr);
}
dt.AcceptChanges();
</code></pre>
<p>my row has 1 record. when i try to convert datarow[] row into datatable
it runs fine. when i check my <strong>table</strong> <strong>dt</strong> it does not contain any record in it
. what is the issue in it</p>
<p>thank you</p>
| asp.net | [9] |
2,535,417 | 2,535,418 | How to convert bool [] into byte [] | <p>I have bool array:</p>
<pre><code>bool[] b6=new bool[] {true, true, true, true, true, false, true, true,
true, false, true, false, true, true, false, false };
</code></pre>
<p>How can I convert this into an array of bytes such that</p>
<ul>
<li>byte[0]=0xFB </li>
<li>byte[1]=AC </li>
<li>etc</li>
</ul>
| c# | [0] |
2,168,450 | 2,168,451 | Can we ignore screen orientation OR Do we have to handle it? | <p>Although I know how to handle <strong>screen orientation</strong> in an <em>IPhone</em> application. Is there possibly a way we can ignore it? Either by means of some <em>code</em> or may be setting it somewhere. For example in <em>Android</em> we can <a href="http://stackoverflow.com/questions/1410504/android-how-to-make-application-completely-ignore-screen-orientation-change">ignore screen orientation</a> by making few changes. Is there some way in <em>IPhone</em> too? </p>
<p>Thanks<br>
Nitish</p>
| iphone | [8] |
2,932,180 | 2,932,181 | jquery copy content to another text box | <p>I have following 2 fields in my large form...</p>
<pre><code> <p><input type="text" name="name" id="proname" value="" /></p>
<p><input type="text" name="var" id="provarname" value="" /></p>
</code></pre>
<p>I want that #provarname should get value live automatically from #proname, for example if we enter Design watch in #provarname, same time #provarname should get value design-watch(small letters and space replaced with -) , and i have written following jquery code which is not working in same manner...</p>
<pre><code>$(document).ready(function() {
$('#proname').live('change',function() {
var pronameval = $(this).val();
$('#provarname').val(pronameval.replace(' ', '-'));
});
});
</code></pre>
<p>Please help to fix it, thanks.</p>
| jquery | [5] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.