Unnamed: 0
int64 302
6.03M
| Id
int64 303
6.03M
| Title
stringlengths 12
149
| input
stringlengths 25
3.08k
| output
stringclasses 181
values | Tag_Number
stringclasses 181
values |
|---|---|---|---|---|---|
2,433,497
| 2,433,498
|
stop the following activity if home key or pressed back is pressed - Android
|
<p>I have a problem and that is my SplashScreen I have. It is built as an intro and after 3 seconds it shows the main menu of the program.
Anyway, if I press down Back or Home button during the time the SplashScreen shows, it closes, but the activity I have chosen to follow after the SplashScreen will still run after the three seconds.</p>
<p>My code: <strong>**<em>UPDATED CODE</em>**</strong></p>
<pre><code> Handler ur = new Handler();
myRun = new Runnable() {
public void run() {
mainIntent = new Intent(SplashScreen.this,MyApp.class);
SplashScreen.this.startActivity(mainIntent);
SplashScreen.this.finish();
overridePendingTransition(R.anim.fadein,
R.anim.fadeout);
}
};
ur.postDelayed(myRun, SPLASH_DISPLAY_TIME);
}
protected void onStop() {
super.onStop();
ur.removeCallbacks(myRun);
}
</code></pre>
<p>Even if I have an onStop() in this SplashScreen, the next activity will still run after the SPLASH_DISPLAY_TIME. </p>
<p><strong>Since I changed the code I got Force Close after I pressed the Home button and the SplashScreen disappeared, also, I cannot launch my second activity.</strong> </p>
|
java android
|
[1, 4]
|
4,304,137
| 4,304,138
|
Programmatically View image hash values
|
<p>How to Programmatically View image hashes in C# or PHP ?</p>
|
c# php
|
[0, 2]
|
951,492
| 951,493
|
IE7 - Prevent unresponsive script error
|
<p>The following code is used as a visual filter on an application I'm building. Basically, when a user types something into the textbox with id 'filter', the code below runs to hide those that match. </p>
<pre><code>$('#filter').keyup(function() {
delay(function(){
$(".patient:not(:contains('" + $('#filter').val() + "'))").fadeOut();
$(".patient:contains('" + $('#filter').val() + "')").fadeIn();
}, 300 );
});
</code></pre>
<p>The code works fine in Firefox and Chrome, but in IE7 two things happen that I don't like:-</p>
<p>1) The selected divs dont fadeOut/In - they just appear..
2) Occasionally, I get an error from IE that the script is taking too long and may become unresponsive.</p>
<p>In terms of problem 2 I've read that returning control to the browser (again maybe using a timeout) might prevent the issue but I'm not sure if this is possible using my code or how to do it. </p>
<p>Can you guys help?</p>
<p>(PS - for the record, I HAVE to use IE7 in my organisation. Bad, I know, but I can do nothing about this, just in case your solutions involve changing browser :))</p>
|
javascript jquery
|
[3, 5]
|
1,962,472
| 1,962,473
|
How to get the tagname and its href of selected anchor text
|
<p>When I select a link (with no ids or classes) within a paragraph, I need to get the selected links href value. How do I do it in jQuery? I am using <code>document.getSelection()</code> method for that. But I don't see any method in <code>document.getSelection()</code> which returns the href value.</p>
<p>When I select the link by dragging the mouse, I am able to get the href value like below.</p>
<pre><code>currentLink = document.getSelection().anchorNode.parentElement.href;
</code></pre>
<p>But when I select the link by double clicking the text, the above command will not return the href value. Please help.</p>
|
javascript jquery
|
[3, 5]
|
1,068,923
| 1,068,924
|
How to get content from dynamically added controls
|
<p>This is how my web page looks like:
<img src="http://i.stack.imgur.com/dMVBt.png" alt="enter image description here"></p>
<p><strong>PosisionDataView</strong> is a web user control, which contains textboxes for product name and note plus some additional controls.</p>
<p><strong>QuantityView</strong> is also a web user control, which contains textboxes for quantity and price plus some additional controls.</p>
<p>The user can dynamically add QuantityView's and PositionView's to the page. This happens this way:</p>
<ul>
<li>The user clicks the ButtonAddQuantityView or ButtonAddPositionView</li>
<li>jquery's ajax method is called, which calls a method on my web service, which returns QuantityView or PositionView in html format</li>
<li>the received control is appended to the QuantityPlaceholder or to PositionsPlaceholder</li>
</ul>
<p>This all works pretty smooth, but what is the best method to parse this mess after postback? For example the QuantityView contains the textbox txtQuantity and in Request.Form collection I get these values for quantities:</p>
<ul>
<li>ctl00$ContentPlaceHolder1$PositionView$ctl00$QuantityView$ctl00$txtQuantity: 1</li>
<li>ctl00$txtQuantity: 2,4</li>
<li>ctl00$QuantityView$ctl00$txtQuantity: 3</li>
</ul>
<p>In reallity position 1 contains quantities 1 and 2, and position 2 contains quantities 3 and 4, but the Request.Form is a mess...</p>
|
c# jquery asp.net
|
[0, 5, 9]
|
5,545,229
| 5,545,230
|
Overwrite .data() if a condition is met
|
<p>I am doing a image Tool tip (larger preview),
it ads a .data() of the replaced source. but on .error i want the same data to have a different value.
It seems like that doesn't overwrite the .data("lrgSrc") on .error </p>
<pre><code>$ImgTipCanid.each(function() {
var t = $(this).attr("src");
var tt = t.replace(/medium/,"Large");
var ttt = t.replace(/medium/,"Full");
var noPic = t.indexOf("nopic");
if(noPic === -1) {
$(this).addClass("hovelble").data("lrgSrc",tt)
$(this).error(function(){
$(this).data("lrgSrc",ttt);
});
}
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,305,022
| 4,305,023
|
Using jQuery, how do I get the index of an element found in XML?
|
<p>I have an XML file setup like so:</p>
<pre><code><entry name="bob"></entry>
<entry name="ryan"></entry>
<entry name="joe"></entry>
...
<entry name="etc"></entry>
</code></pre>
<p>Next, I have a line of code that picks out a name from the XML like so:</p>
<pre><code>var $user= $('entry[images="' + userName + '"]', xml);
</code></pre>
<p>But how do I find out what the index of $user is in the overall XML? Example: if userName was 'joe', I should get the number '2' back. Any suggestions?</p>
|
javascript jquery
|
[3, 5]
|
3,295,253
| 3,295,254
|
Determine distance from the top of a div to top of window with javascript
|
<p>How do I determine the distance between the very top of a div to the top of the current screen? I just want the pixel distance to the top of the current screen, not the top of the document. I've tried a few things like <code>.offset()</code> and <code>.offsetHeight</code>, but I just can't wrap my brain around it. Thanks!</p>
|
javascript jquery
|
[3, 5]
|
2,090,572
| 2,090,573
|
How To Override Datalist To Be Rendered Into Divs Instead Of Table?
|
<p>i want to render datalist to divs instead of table, and the repeat columns will fixed by float style on div.</p>
<p>so any one know a an override render method do that.</p>
<p>Thanks</p>
|
c# asp.net
|
[0, 9]
|
3,376,863
| 3,376,864
|
How to I rewrite this so that its not a random number search?
|
<p>Im new to jquery, how would I re-write this string so that it displayed a result of 60 each time?</p>
<pre><code>var i = Math.ceil(Math.random()*60)
</code></pre>
<p>thanks</p>
|
javascript jquery
|
[3, 5]
|
5,781,567
| 5,781,568
|
Convert DOM Element/Object to jQuery Element/Object
|
<p><code>.get()</code> converts a jQuery object to a DOM element that Javascript can use without jQuery.</p>
<p>If I have a DOM element, how can I convert it to a jQuery object?</p>
|
javascript jquery
|
[3, 5]
|
2,875,648
| 2,875,649
|
Auto link specific words and phrases
|
<p>Can I use jQuery, another library or standard javascript to list a series of words and phrases that I would like to be auto linked?</p>
<p>For example:</p>
<p>Word / phrase 1: link to www.something.com <br/>
Word / phrase 2: link to www.somethingelse.com <br/>
Word / phrase 3: link to www.anotherlink.org</p>
<p>And so on.</p>
<p>Thanks in advance for your help!</p>
|
javascript jquery
|
[3, 5]
|
4,915,266
| 4,915,267
|
Jquery filter syntax
|
<p>If I want to filter a set of links against an array and then style those not in the array as unavaible, how would I do that.</p>
<p>Here is what I have:</p>
<pre><code>if (this.id == '93') {
$links.filter(function() {
}).addClass('unavailable');
</code></pre>
<p>But I don't know how the syntax for checking against an array.</p>
|
javascript jquery
|
[3, 5]
|
1,827,344
| 1,827,345
|
How to convert JavaScriptSerializer serialized DateTime string to JavaScipt Date object
|
<p>After serializing an object with <strong>DateTime</strong> field with <strong>JavaScriptSerializer</strong>, I see that <strong>DateTime</strong> field looks like this:</p>
<pre><code>EffectiveFrom: "/Date(1355496152000)/"
</code></pre>
<p>How can I convert this string to JavaScript Date object?</p>
|
javascript asp.net
|
[3, 9]
|
5,969,529
| 5,969,530
|
Convert jQuery click event to run periodically
|
<p>I'm using this jQuery plugin here: <a href="http://css-tricks.com/examples/MovingBoxes/" rel="nofollow">http://css-tricks.com/examples/MovingBoxes/</a></p>
<p>Has anyone used it or can you take a look at the jQuery code, how can i set the function to run periodically rather than on click events?</p>
<p>Thanks</p>
|
javascript jquery
|
[3, 5]
|
5,373,389
| 5,373,390
|
set dropdownlist value to textbox in jQuery
|
<p>If my dropdown has a value selected, I want to show the selected item text in my textbox. If not, I want to empty it.</p>
<pre><code><asp:DropDownList ID="ddl" runat="server" AutoPostBack="true" onselectedindexchanged="ddlSelectedIndexChanged" Width="200px" onchange="ddlChange()">
</asp:DropDownList>
<asp:TextBox ID="hdntxtbxTaksit" runat="server" Visible="false"></asp:TextBox>
</code></pre>
<p>How can I do this?</p>
|
javascript jquery
|
[3, 5]
|
1,509,091
| 1,509,092
|
Handle clicks on an element but not clicks on links within that element
|
<p>How do I handle clicks on an element but not clicks on links within that element?
Say I have the following</p>
<pre><code><div class="section">
Some text blah blah
<a href="#">Link</a>
</div>
<script>
$(".section").click(function() {
// code to expand/collapse section
});
</script>
</code></pre>
<p>And I want users to be able to click on .section in order to expand/collapse it but I don't want that to happen if they clicked on a link within that section.</p>
|
javascript jquery
|
[3, 5]
|
5,110,616
| 5,110,617
|
ExpandlableListView Styling
|
<p>Hi i dynamically created a ExpandableListView and im using an Adapter to fill it with 3 groups containing 1 child each.</p>
<p>I just cant find out how to change the color of my Group Text and Child text. (its currently black so i can only see my text when i click the group or child)</p>
<p>Setting a color in the</p>
<pre><code>public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
TextView textView = getGenericView();
textView.setText(getGroup(groupPosition).toString());
textView.setTextColor(R.color.white);
return textView;
}
</code></pre>
<p>Doesnt do anything.</p>
<p>Would appreciate some pointers how to solve this.</p>
<p>It seems that R.color.white defined in my resources doesnt work.</p>
<p>I tried <code>textView.setTextColor(Color.WHITE);</code></p>
<p>and this fixed the problem still trying to figure out why the other way didnt work..</p>
|
java android
|
[1, 4]
|
1,962,129
| 1,962,130
|
error paging and editing in gridview
|
<p>I had gridview which retrieve Products from database by sqldatasource1 ,and my manager asked me to filter this gridview by DDL to filter gridview with specfic Model ,I add some function on gridview as edit,paging .I did my code well and gridview filtred by the Model_Id which come from DDL .But when I tried to edit any product or navigate through paging I faced this error (The GridView 'GridView1' fired event PageIndexChanging which wasn't handled. )when paging ,And this for editing (The GridView 'GridView1' fired event RowEditing which wasn't handled.)
So please any one help me.</p>
<p>(CS)</p>
<pre><code> protected void Page_Load(object sender, EventArgs e)
{
BindGridFunction();
}
private void BindGridFunction()
{
if (DDLModel.SelectedIndex < 0)
{
GridView1.DataSource = SDSModel;
GridView1.DataBind();
}
else
{
GridView1.DataSource = SDSModel2;
GridView1.DataBind();
}
}
</code></pre>
|
c# asp.net
|
[0, 9]
|
4,927,624
| 4,927,625
|
Get child elements from a parent but not first and last
|
<p>I would like to know how could I write a jQuery selector that get all children from a parent element except first and last child?</p>
<p>Example of my current HTML:</p>
<pre><code><div id="parent">
<div>first child( i don't want to get)</div>
<div>another child</div>
<div>another child</div>
<div>another child</div>
(...)
<div>another child</div>
<div>another child</div>
<div>last child (i dont want to get neither)</div>
</div>
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,784,520
| 4,784,521
|
Jquery exclude first td on click event?
|
<p>How to exclude the first td on the click event of jquery that I created below? I want to exclude the all first td of the rows on the click event that produces dialog box.</p>
<pre><code>jQuery("#list tbody tr").click(function(){
//some code here
});
<table>
<tr>
<td>first</td>
<td></td>
<td></td>
</tr>
<tr>
<td>first</td>
<td></td>
<td></td>
</tr>
</table>
</code></pre>
|
javascript jquery
|
[3, 5]
|
544,131
| 544,132
|
IPhone over Android and vice versa
|
<p>I develop applications on both <strong>IPhone</strong> and <strong>Android</strong>. As a part of my organization's <em>Technical Session</em> program I have myself delivering the next session on <strong>IPhone or Android</strong>. Getting the session made me start comparing both technologies, which believe me, is really a tough job. As a programmer in both technologies I often think how will the <em>Application</em> seem to be if I used the other one. Which further makes me list out pron and cons of both.<br>
<strong>Android a ahead of IPhone</strong>:<br>
There are couple of factors where <strong>Android</strong> steps ahead of <strong>IPhone</strong>. </p>
<ul>
<li><p>Multiple apps at same time </p></li>
<li><p>Information visible on home screen </p></li>
<li><p>Better notifications </p></li>
<li><p>Hardware flexibility </p></li>
</ul>
<p><strong>IPhone ahead of Android</strong>:<br>
Following are the factors: </p>
<ul>
<li><p>UI Smoothness and Consistency </p></li>
<li><p>Language support </p></li>
<li><p>Accessibility options </p></li>
<li><p>Battery life </p></li>
<li><p>Resource efficiency </p></li>
<li><p>Hardware quality </p></li>
<li><p>Better App Store </p></li>
</ul>
<p>However, as a programmer, I want my session to be more of <em>technical</em> rather than a being a general overview of both technologies. For which I need some help. For instance <strong>Android's</strong> memory management is way ahead of that of <strong>IPhone's</strong>. On the other hand <strong>IPhone's</strong> <em>UI</em> has no comparison at all.<br>
What more points(technical) can I include in my session. Also, kindly correct me if I am wrong somewhere above. </p>
<p>Nitish </p>
|
iphone android
|
[8, 4]
|
699,097
| 699,098
|
In an Asp.net MVC view, how do I use jQuery to parse the XML just returned from a controller
|
<p>In my MVC view (using VS 2012 RC), I'm attempting to parse the XML freshly returned from my Controller.
Here is my view code:</p>
<pre><code>@model RzMvc.Models.PortfolioResponse
@{
ViewBag.Title = "PortfolioList";
}
<script type="text/javascript">
$(displayXmlResponse);
function displayXmlResponse(){
var resp = $("#xmlResp");
$("#xmlTest").append(resp.children());
var xml = $("xmlResp").text;
xmlDoc = $.parseXML(xml),
$xml = $(xmlDoc),
$title = $xml.find("portfolioSummary");
$("#xmlTest").append($title.text());
}
</script>
<h2>PortfolioList</h2>
<div>
<p id="xmlTest"></p>
<p id="xmlResp" >@Model.XmlPortfolioResponse</p>
</div>
</code></pre>
<p>The browser output looks like this:</p>
<blockquote>
<p>PortfolioList</p>
<p>Portfolio Listing</p>
<p>System.Xml.XmlDocument</p>
</blockquote>
<p>Any guidance would be greatly appreciated. Here's part of my Controller code:</p>
<pre><code> public ActionResult PortfolioList()
{
XmlDocument xmlResponse = new XmlDocument();
xmlResponse.LoadXml(portfoliosResponse);
var portf = new PortfolioResponse { XmlPortfolioResponse = xmlResponse };
return View(portf);
}
</code></pre>
<p>Model code is:</p>
<pre><code>namespace RzMvc.Models
{
public class PortfolioResponse
{
public XmlDocument XmlPortfolioResponse { get; set; }
}
}
</code></pre>
|
jquery asp.net
|
[5, 9]
|
912,703
| 912,704
|
How can I get this function to return value retrieved using jQuery.ajax?
|
<p>I need to return dynamic loaded content. I thought this was the way to do it, but the function returns blank. What do I need to do in order to set <code>htmlCode</code> with the html code retrieved from <code>jQuery.ajax</code>?</p>
<pre><code> // Get directory listing
function getHTML(instance, current_path, dir) {
var htmlCode = '';
jQuery.ajax({
type: "POST",
url: "../wp-content/plugins/wp-filebrowser/jquery.php",
dataType: 'html',
data: {instance: instance, current_path: current_path, dir: dir},
success: function(html){
htmlCode = html;
},
error: function(e) {
htmlCode = '[Error] ' + e;
}
});
return htmlCode;
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,097,690
| 5,097,691
|
window.showModalDialog dialogWidth property not working in IE
|
<p>I have a 2.0 framework ASP.Net page that runs in our controled environment (IE 7).
The <code>dialogWidth</code> property seems not to be working. The scrip is as follows:</p>
<pre><code>var win = window.showModalDialog ('Page.aspx', 'PopupPage', 'dialogHeight:600px,dialogWidth:800px,resizable:0');
</code></pre>
<p>The <code>dialogHeight</code> works fine but no matter what I change the <code>dialogWidth</code> to - it seems to be limited to a width of about 250px. In the configuration above the modal popup is higher that it is wide - even though width is 800 and height is 600.</p>
|
asp.net javascript
|
[9, 3]
|
2,333,204
| 2,333,205
|
Removing the element from the DOM is not removing the effects of javascript code inside that DIV element
|
<p>I dynamically load the whole page inside one DIV element with the help of javascript. But when I close the div I am using <code>("#Viewer").remove()</code> . But still the javascrpit/jquery loaded inside that element is in work. How can I remove the effect of that too.</p>
<p>There is one Viewer DIV. Into which I am loading the whole another page. When I close this I use <code>("#Viewer").remove()</code> . When it is first loaded there are some animations and transitions associated with it are happening on other data loaded afterwords. </p>
<p>Please help.
Thank you.</p>
|
javascript jquery
|
[3, 5]
|
779,823
| 779,824
|
3 / 2 = 1.0? really?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3144610/java-integer-division-how-do-you-produce-a-double">Java Integer Division, How do you produce a double?</a> </p>
</blockquote>
<pre><code>double wang = 3 / 2;
Log.v("TEST", "Wang: " + Double.toString(wang));
</code></pre>
<p>Logcat output...</p>
<pre><code>07-04 09:01:03.908: VERBOSE/TEST(28432): Wang: 1.0
</code></pre>
<p>I'm sure there's an obvious answer to this and probably I'm just tired from coding all night but this has me stumped. </p>
|
java android
|
[1, 4]
|
1,580,497
| 1,580,498
|
jQuery string manipulation performance vs. PHP
|
<p>Im building a custom jquery modal box that loads an external html template file that contains variables that need to be replaced. For instance: [user-name]</p>
<p><strong>I know I have 2 options for modifying the template file:</strong></p>
<ul>
<li>use find and replace in jquery</li>
<li>process the template server side and
simply send the result to jquery</li>
</ul>
<p>From a user performance stand point, which would be faster?</p>
|
php javascript jquery
|
[2, 3, 5]
|
4,813,337
| 4,813,338
|
How to solve this simple jQuery issue?
|
<p>I'm new to jQuery and JavaScript in general. I noticed that if you insert an element via jQuery into the DOM and try to perform an action on that element later, it fails. For example:</p>
<p>I am adding a class of "listenToField" to all the input elements on the page:</p>
<pre><code>$(function() {
$('input').addClass('listenToField');
});
</code></pre>
<p>Then when I add the second function:</p>
<pre><code>$(function() {
$('input').addClass('listenToField');
// second function
$('.listenToField').keydown(function() {
alert('Hi There')
});
});
</code></pre>
<p>It does not alert 'Hi There'.</p>
<p>However if I hardcode the class "listenToField" into the HTML inputs, the alert works. How can I still have it work when jQuery inserts the class dynamically without resorting to hard coding?</p>
|
javascript jquery
|
[3, 5]
|
5,031,967
| 5,031,968
|
jQuery click event to change php session variable
|
<p>What would be the best approach to this?</p>
<p>Because, as I found (and it made total sense, only after having tried it :p) that you can't set a PHP variable on javascripts conditions. (duurrhh)</p>
<p>The only solution I can come up with is to do an AJAX call to a small PHP file that handles the session variables</p>
<pre><code>elm.click(function() {
$.post("session.php", { "hints":"off" });
turnOffHints();
}
</code></pre>
<p>And then let the <code>session.php</code> deal with setting the new variable.</p>
<p>But it sorta feels like a waste to do a full http request only to set one variable in PHP...</p>
|
php jquery
|
[2, 5]
|
4,346,349
| 4,346,350
|
Show modal when using javascript confirm
|
<p>I have the following function that will show a modal:</p>
<pre><code>confirmModal: function (message) {
// CODE TO SHOW MODAL HAS BEEN REMOVED FOR THIS QUESTION //
}
</code></pre>
<p>And because it's been namespaced it's called like: <code>uiModal.confirmModal('Test message');</code></p>
<p>Inside the modal I have two buttons:</p>
<pre><code><button class="cancel">Cancel</button>
<button class="ok">Ok</button>
</code></pre>
<p>Now what I want to do is two things:</p>
<ol>
<li><p>When I do something like: <code>onsubmit="confirm('Are you sure?');"</code> or <code>onclick="confirm('Are you sure?');"</code> it will show the modal instead of an alert box. Note that it needs to work for both links and form submits.</p></li>
<li><p>The two buttons in the modal need to either cancel or allow the request to happen. I have already got the cancel to close the modal fine so it's just a case of allowing or denying the request to happen.</p></li>
</ol>
<p>Can anyone help? I've looked at some other questions on here and seen bits about using <code>window.location($(this).attr('href'))</code> but that would only work on links and not for the submit of a form.</p>
<p>I've also looked at doing window.confirm = uiModal.confirmModal('message'); but how would I use that in my example of an onclick or onsubmit</p>
<p>Thanks</p>
|
javascript jquery
|
[3, 5]
|
5,832,277
| 5,832,278
|
Can't understand how to do it with javascript and jquery code
|
<p>Sorry guys for asking that dumb question but I have problem with that thing.
Have such script, it should return true or false, but after drawing that html pop-up window and getting response from that methods. </p>
<pre><code> $("#pageInfo a.btnDel").click(function () {
$("#cmsSmallPopUpWindowMessage").html("<h2>Do you really want to delete this page?</h2><center><div style='width:130px'><ul class='bactions'><li><a id='cmsSmallPopUpWindowBYes' href='javascript:void(0)'><span><span>Yes</span></span></a></li><li><a id='cmsSmallPopUpWindowBNo' href='javascript:void(0)'><span><span>No</span></span></a></li></ul><div class='archor'></div></div></center>");
$.blockUI({ message: $("#cmsSmallPopUpWindow"), css: { width: "530px", border: "0px", backgroundColor: "transparent"} });
setTimeout(function () {
$.unblockUI();
}, 6000);
$("#cmsSmallPopUpWindowBNo").click(function () {
$.unblockUI();
return false;
});
$("#cmsSmallPopUpWindowBYes").click(function () {
$.unblockUI();
location.reload();
return onDelete($(this).attr('href'));
});
return true; // this should change for "false" or "true" but after click on "yes" or "no"
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,778,706
| 5,778,707
|
What is the difference between ResolveUrl and ResolveClientUrl?
|
<p>I have been using ResolveUrl for adding CSS and Javascript in ASP.NET files.</p>
<p>But I usually see an option of ResolveClientUrl. What is the difference between both? </p>
<p>When should I use ResolveClientUrl?</p>
|
c# asp.net
|
[0, 9]
|
5,580,781
| 5,580,782
|
Trying to animate with on change
|
<p>I am trying to animate the width of something when the .change() function is called, but it doesn't seem to be working.</p>
<p>Any idea why?</p>
<p>Here is my code:</p>
<pre><code>$(document).ready(function(){
$('#code').change(function(){
//on change animate a width of +16px increase.
$(this).animate({width: '+=16'});
});
});
</code></pre>
<p>Here is a js fiddle with the issue recreated: <a href="http://jsfiddle.net/BUSSX/" rel="nofollow">http://jsfiddle.net/BUSSX/</a></p>
|
javascript jquery
|
[3, 5]
|
3,414,966
| 3,414,967
|
How to find parent of the control using div id
|
<p>I want to find parent using div id. I mean using $("#btn").parents("divid"). Is it possible using Jquery</p>
|
jquery asp.net
|
[5, 9]
|
4,051,563
| 4,051,564
|
Which technology should i use to develop a high performance web application
|
<p>HellO Everyone,</p>
<p>I have couple of ideas in my brain which i would like to bring out before its too late. Basically i want to develop a web application which i could sell it to clients. So which technology shall i use to accomplish this. I have been a C and C++ software developer but its been a very long time since i have developed one. So the things i would like to know is</p>
<p>1) Scalability and Performance ?
2) Easy way to develop web application in a faster manner ?
3) Any Framework ?
4) Application server ?
5) and which programming language ?</p>
<p>Thank You</p>
|
c# java python
|
[0, 1, 7]
|
5,077,249
| 5,077,250
|
jquery hover options then click to load page
|
<p>My problem:</p>
<p>I have a row of div tags that act as header to columns when the user hovers over them the div changes to sort options such as ASC and DESC. What i need them to do is when the user clicks on one of the options an alert will pop up with the click option the value and the div class name. </p>
<p>example if the user clicked on ASC an alert would pop up saying headerID ASC 1 or headerID DESC 2 if clicked on desc.</p>
<p>For the life of me I can not figure this out. Right now I'm testing with alert then I will be using .load() to load a page with sorting option </p>
<p>div = headerID </p>
<p>sort = ASC </p>
<p>value = 1 </p>
<p>or </p>
<p>div = headerID </p>
<p>sort = DESC </p>
<p>value = 2 </p>
<p>depending on what was clicked.</p>
<p>demo of what I already have <a href="http://jsfiddle.net/hmeHn/1/" rel="nofollow">http://jsfiddle.net/hmeHn/1/</a></p>
|
php jquery
|
[2, 5]
|
1,554,042
| 1,554,043
|
How do I execute an event using jQuery through an html object(button) created through Javascript?
|
<p>I'm just new here. So here's where I'm stuck:</p>
<p>I created an html table using javascript. I have a button,which when clicked, will create set of tables with exactly the same structure but the objects(eg. button, text) inside those tables have different ID's. Now when I try to execute a click function using jQuery with a button on one of the produced tables, it won't work. How do I go around here? Thanks in advance!</p>
<p>Here's a sample function which creates the html table(with unique ID's) in javascript:</p>
<pre><code>function CreateTables() {
var html = ' ';
var valPrompt = prompt("How many tables would you like to add?");
parseInt(valPrompt);
for (i = 1; i <= valPrompt; i++) {
html += "<table>" + "<tr>" + "<td>" + "Text goes here" + "</td>" + "<td>" + "<input type='text' id='txtTEXT" + i + "'/>" + "</td>" + "<td>" + < input type = 'button'
id = 'btnALERT" + i + "' / > +"</td>" + "</tr>" + "</table>"
}
document.getElementById('HtmlPlaceHolder').innerHTML = html;
}
</code></pre>
<p>So, if we review the code, Sets of table with buttons(btnALERT) with unique ID's will be created if the function <strong>CreateTables</strong> is executed. In order to select the objects, I suppose I'll be using jQuery. So for example, if I bind a handler in btnALERT1(produced by CreateTables) say a click function in order to alert a simple "Hello", how will I do this? My code for this doesn't seem to work:</p>
<pre><code>$(document).ready(function() {
$('#btnALERT1').click(function() {
alert("Hello");
});
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,471,174
| 2,471,175
|
select elements outsde of plugin chaining this keyword
|
<p>hi im creating a plugin with chaining the problem is I want to select elements outside of the THIS element e.g</p>
<pre><code>return $this.each(function() {
$('body $left .filter-wrapper input[type=checkbox]', document).change(function() {
alert('changed');// I want to break out side the scope how do i do that
and select element that aren't in $('mygrid').Grid()
// ive tried $('body $left .filter-wrapper input[type=checkbox]')
// that doesn't work either
}).find(this).filter(....).click(function() {
// this refers to mygrid which is what i want but the ubove code doen't work
}).find(....).click(function(){
// do more stuff here
}).bind('....')
});
</code></pre>
<p>$('mygrid').Grid()</p>
|
javascript jquery
|
[3, 5]
|
2,011,810
| 2,011,811
|
How do I use JQuery to disable a submit button?
|
<p>So that it's no longer clickable.</p>
|
javascript jquery
|
[3, 5]
|
2,666,086
| 2,666,087
|
extract out text in each line and put it in seperate variables with javascript
|
<p>I have the following address which is in a paragraph with no great way to select the individual text areas within. I do not have access to this code. I want to extract out each line and put the text values in a variable for each type. Not sure what would be the best way to do it. </p>
<p>Use <code>.split('<br>')</code> ?
then use <code>.split('&nbsp;')</code> to separate the state from the zip
same with city and state
I am a little lost here.</p>
<p>Here are the variables I would like. </p>
<p>company name,
person's name,
address1,
city,
state,
country,
zip code,
phone,</p>
<p>Here is the paragraph that i have. I do not need the '(Residential Address)'</p>
<pre><code><p>
XYZ Inc<br>
John&nbsp;Smith<br>
555 Anywhere Street<br>
New York, NY&nbsp;11150<br>
United States<br>
212-555-1212<br>
(Residential Address)
</p>
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,383,500
| 3,383,501
|
Javascript string variable that contains PHP code
|
<p>I basically just want to append a javascript variable to an HTML div with JQuery. However I need to append some PHP code as a string, it doesn't need to execute it just needs to show up as a plain old string string.</p>
<p>The following code doesn't seem to append because I think it is still recognized as PHP syntax. </p>
<pre><code>var script = '<?php wp_list_pages(); ?>';
divName.innerHTML = script;
</code></pre>
<p>Any help would be much appreciated.</p>
|
php javascript jquery
|
[2, 3, 5]
|
5,139,450
| 5,139,451
|
How I can I make jQuery go directly to <h2 id="id-name">?
|
<p>I want to make jQuery navigates directly (no animation need) to a id that I pass in a variable.</p>
<p>I have various marks like <code>id="content"</code>, <code>id="edit"</code>, <code>id="..."</code> that are <code><h2></code> titles. Doing validation with PHP I will output a variable like <code>var NAVIGATE_TO = <?php echo $where_failed;?></code> and I want to move the website to that <code>id</code> position.</p>
<p>Like if I do <code>domain.tld/page#edit</code> or <code>#content</code> but with jQuery because when I load the page my PHP framework doesn't allow me to indicate the hash.</p>
|
javascript jquery
|
[3, 5]
|
4,524,066
| 4,524,067
|
Message queue for real time chat , ASP.NET
|
<p>How do i create message queuing mechanism for real time chat in asp.net ? At least post some points to start with because for now i'm using synchronous calls to DB for any change. </p>
|
c# asp.net javascript
|
[0, 9, 3]
|
5,410,446
| 5,410,447
|
How to read all the values inside an multiple form with jquery
|
<p>I'm trying to get my uploading script to work with jquery but having problems with fetching the values (files) that are queued up in a multiple form.</p>
<p>I can get it to work so i can select like 10 files in a single input but when i'm trying to fetch those values i only get the first file of the 10 i added simultaneously. I can upload the files and fetch its values but i want to make it to work with jqeury as well something i can't get to work. Here is the code:</p>
<pre><code> <!DOCTYPE html>
<html lang="en-us">
<head>
<script src="jquery-min.js"></script>
<script>
$(document).ready(function() {
$("form").change(function() {
var form = $(".forms").val();
$(".files").append("Files:"+form);
});
});
</script>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" class="forms" value="" name="upload[]" multiple>
<button type="submit">Upload!</button>
</form>
<div class="files"></div>
<?php var_dump($_FILES);?>
</body>
</html>
</code></pre>
<p>So when i drag and select the files and adds them then only the first value gets assigned to "div.files". So my question is how do i read the array of the files inside of it so i just don't get the first one?</p>
<p>Here is an image that displays the problem: <a href="http://i.stack.imgur.com/lOAvk.png" rel="nofollow">http://i.stack.imgur.com/lOAvk.png</a></p>
|
php jquery
|
[2, 5]
|
2,855,853
| 2,855,854
|
how to erase the file contents of text file in python and c++?
|
<p>i have text file which i want to erase in C++ and python . How to do it?Do i have to assign the file pointer to a null value string?</p>
|
c++ python
|
[6, 7]
|
5,376,462
| 5,376,463
|
Determine image src in onload and onerror event handlers in IE
|
<p>How can I determine the image src of the image that triggered the event in the onload and onerror event handlers in IE? This example code I threw together:</p>
<pre><code><script language="javascript" type="text/javascript" src="jquery.js"></script>
<script language="javascript" type="text/javascript">
function loadImages() {
var goodImage = new Image();
var missingImage = new Image();
$(goodImage).bind('load', function(event){
$("#log").append( $(event.target).attr('src') + ' WAS FOUND <br>');
});
$(missingImage).bind('load', function(event){
$("#log").append( $(event.target).attr('src') + ' WAS FOUND <br>' );
});
$(goodImage).bind('error', function(event){
$("#log").append( $(event.target).attr('src') + ' IS MISSING <br>');
});
$(missingImage).bind('error', function(event){
$("#log").append( $(event.target).attr('src') + ' IS MISSING <br>');
});
goodImage.src = 'GOOD-IMAGE.GIF'; // this image exists
missingImage.src = 'MISSING-IMAGE.GIF'; // this image doesn't exist
}
</script>
</head>
<body onload="loadImages();">
<div id="log"></div>
</code></pre>
<p>works in FF but in IE8 it prints out undefined for the $(event.target).attr('src') part. I thought jQuery was supposed to normalize the event object for IE so that it acted like other browsers? I've tried a number of permutations but haven't been able to get anything to work in IE8.</p>
<p>Anyway if anyone has a suggestion on how to figure out the image src in the onload and onerror event handlers that works in IE I would really appreciate it. Or even how to figure out after the images have loaded which have loaded and which haven't (but not graphically - I need to generate an array containing the filenames of the images that didn't load). Thanks!</p>
|
javascript jquery
|
[3, 5]
|
4,615,575
| 4,615,576
|
ASP.NET - How to check value of a textbox in a user control from a page?
|
<p>I have an aspx page that contains a user control. The user control has a textbox and the page has a submit button.</p>
<p>How can I check if the textbox in the user control is not null and display an alert if it is - from the page?</p>
|
javascript asp.net
|
[3, 9]
|
5,643,477
| 5,643,478
|
how can i trigger click function as auto (every 15 second)
|
<p>For example if i have a random div..</p>
<pre><code>$("#random").click(function{
$("#random").toggle("slow");
});
</code></pre>
<p>How can i trigger to click function as auto(every 15 seconds).</p>
<p>Thanks for helps..</p>
|
javascript jquery
|
[3, 5]
|
3,009,960
| 3,009,961
|
Javascript/jQuery issue
|
<p>I'm trying to make radio buttons that when you have them active, it displays a dropdown. I can already make it display, but when I click on another radio button, it shows one, but doesn't hide the other...
Code:</p>
<pre><code><input type='radio' name='op' onchange='$("#ban_length").fadeToggle();'/>
<input type='radio' name='op' onchange='$("#rank_list").fadeToggle();'/>
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,699,071
| 1,699,072
|
how to press a button one , and then the second one stops?
|
<p>How can I make presses button in the Second one and then stops and then pressed again in the Second one and then stops</p>
<p>But pressure All buttons in second one</p>
<p>I want to press a button 1, and then the second one stops
and then press the button 2, then the second one stops
and then press the button 3, then the second one stops
and then press the button 4, then the second one stops
and then press the button 5, then the second one stops </p>
<p>How ??!!</p>
<p>i try this </p>
<p><strong>jquery</strong></p>
<pre><code><script>
function fs (){
alert("hello");
}
setTimeout(function() {
$("#a tr").each(function(){
$(this).find("input[type=submit]").click();
});
}, 1000);
</script>
</code></pre>
<p><strong>HTML</strong></p>
<pre><code><body>
<table id='a' border='2'>
<tr>
<td>1 = <input type='submit' value='send' onclick=' fs ()'/></td>
</tr>
<tr>
<td>2 = <input type='submit' value='send' onclick=' fs ()' /></td>
</tr>
<tr>
<td>3 = <input type='submit' value='send' onclick=' fs ()'/></td>
</tr>
<tr>
<td>4 = <input type='submit' value='send' onclick=' fs ()'/></td>
</tr>
<tr>
<td>5 = <input type='submit' value='send' onclick=' fs ()' /></td>
</tr>
</table>
</body>
</code></pre>
<p><strong>But pressure All buttons in second one</strong> >_<</p>
|
javascript jquery
|
[3, 5]
|
2,483,364
| 2,483,365
|
Callback after loading scripts works when preceded by alert and doesn't when I delete the alert
|
<p>First, I load some scripts. Then, once they're loaded, I bind those scripts to the relevant objects. Everything works great when I have the alert() statement there, and fails (i.e. jEditable does not bind) when I don't.</p>
<pre><code>// Load two scripts, execute editor_callback when both are loaded
$(document).ready(function() {
var scripts = 0;
var update_scripts = function() {
scripts++;
if (scripts == 2) {
editor_callback();
}
};
// Load jEditable
$.getScript('js/jquery.jeditable.min.js', update_scripts());
// Load Elastic textareas (if needed)
if (!jQuery().elastic) {
$.getScript('js/jquery.elastic.js', update_scripts());
}
else {
update_scripts();
}
});
function editor_callback() {
//alert ("In editor_callback()");
$('.edit_area').editable('editable/update', {
type : 'textarea',
cancel : 'Cancel',
submit : 'OK',
indicator : 'Saving...',
tooltip : 'Click to edit...'
});
$('textarea').live("click", function() {$(this).elastic()});
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
361,478
| 361,479
|
Trim or replace all commas and spaces from the String
|
<p>Hi i am developing android application.Now i stuck in one problem. Let me give you a example to understand my problem.</p>
<p><strong>What I have is : kushal,mayurv,narendra,dhrumil,mark, ,,,, ,</strong></p>
<p><strong>What i want is : kushal,mayurv,narendra,dhrumil,mark</strong></p>
<p>Any help is appreciated.</p>
|
java android
|
[1, 4]
|
5,564,378
| 5,564,379
|
How can I remove all classes starting with a prefix
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2644299/jquery-removeclass-wildcard">JQuery removeClass wildcard</a><br>
<a href="http://stackoverflow.com/questions/6055355/jquery-select-an-element-that-the-class-starts-with">jQuery - Select an element that the class starts with</a> </p>
</blockquote>
<p>I have some divs that that belong to zone (a div may have class "zoneA", another div may have class "zoneB", etc.). I want to be able to select multiple divs of that kind, and set a new class to them. </p>
<p>So I would like to do something like:</p>
<p><code>$(".selected-divs").removeClass("zone*").addClass(".zone-new")</code></p>
<p>How can I remove all classes in this maner?</p>
|
javascript jquery
|
[3, 5]
|
381,019
| 381,020
|
Convert simple php code to python
|
<p>I want to convert my php code to python code. Is it possible </p>
<pre><code>$secret = 'segredo'; // To make the hash more difficult to reproduce.
$path = '/p/files/top_secret.pdf'; // This is the file to send to the user.
$expire = 1096891200; // At which point in time the file should expire. time() + x; would be the usual usage.
$md5 = base64_encode(md5($secret . $path . $expire, true)); // Using binary hashing.`$md5 = strtr($md5, '+/', '-_'); // + and / are considered special characters in URLs, see the wikipedia page linked in references.
$md5 = str_replace('=', '', $md5); // When used in query parameters the base64 padding character is considered special.
</code></pre>
<p>I want to convert above php code to python. Is there exist some tool for conversion ?</p>
<p>This code is simple unique url generator for nginx HttpSecureLinkModule.</p>
|
php python
|
[2, 7]
|
2,487,657
| 2,487,658
|
Packaging android code into jar file
|
<p>I am trying to package the android code into a jar file so that I can use it in another project. But when I do that I get the following error messages. I am not sure how to do this correctly if someone has done it please post a link and some details would be really helpful.</p>
<p>Thanks</p>
<pre><code>Error generating final archive: Found duplicate file for APK: AndroidManifest.xml
Origin 1: C:\Users\Admin\workspace\Test\bin\resources.ap_
Origin 2: C:\Users\Admin\workspace\Test\lib\JarLib.jar
</code></pre>
<p>I have to use it in lots of project so I want to compile it as jar just like other libraries available online such as twitter4j, googleAnalytic, androidsupportlibrary and I need to know which folder are compulsory to include in Jar file. I have tried building it by excluding the resources folder and using eclipse->export, though it builds the jar but upon including it in another test project displays the above errors messages.</p>
|
java android
|
[1, 4]
|
6,030,355
| 6,030,356
|
How to use zindex in JavaScript
|
<p>What is the syntax for zindex?</p>
<p>I tried like this </p>
<pre><code>document.getElementById('iframe_div1').style.zIndex =2000;
document.getElementById('iframe_div1').style.z-index =2000;
</code></pre>
<p>It is not working, it doesn't even show an error.</p>
<p>This is my snippet. It is working fine in HTML, but I want to set this CSS property in jQuery or JavaScript. The top/position attributes are not working...</p>
<blockquote>
<p>z-index:1200px; top:450px; position:absolute; right:300px;</p>
</blockquote>
<pre><code>document.getElementById('iframe_div1').style.display='block';
$("#iframe_div1").css("z-index", "500");
$("#iframe_div1").css("right", "300");
$("#iframe_div1").css("top", "450");
document.getElementById('iframe_div1').style.position = "absolute";
</code></pre>
<p>This snippet is not as perfect as I expect. I want to move my div center of the page, but it just moving my div to the bottom of the page.</p>
|
javascript jquery
|
[3, 5]
|
3,011,803
| 3,011,804
|
how many string can display on full screen
|
<p>I've large string, i want to split it. i got screen width and height using below code,</p>
<pre><code>DisplayMetrics metrics = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
screenHeight = metrics.heightPixels;
screenWidth = metrics.widthPixels;
</code></pre>
<p>I want to know how many character to display on screen. </p>
<p>how to calculate ? and split the string.?</p>
|
java android
|
[1, 4]
|
2,258,602
| 2,258,603
|
Odometer Speedometer jquery plugin
|
<p>Is there any plugin who give's the chart type = ODOMETER ?</p>
<p>incrideble how is so hard to find this, even highchart's that i'm using ( very good chart library ) dont have a odometer, dont know why.</p>
<p>i found some "speedometer", <a href="http://jacob-king.com/demo/speedometer" rel="nofollow">Demo</a> but wont help-me.</p>
<p>anyone know any plugin or something like who work with odometer's ?</p>
<p>Thanks.</p>
|
javascript jquery
|
[3, 5]
|
1,988,778
| 1,988,779
|
conflict mulitple .load() events of jquery
|
<p>i have load the data with the <code>$('#result').load('test.php')</code> file, that is completely working properly. </p>
<p>here is the <code>test.php</code> screenshoot
<img src="http://i.stack.imgur.com/adgb7.jpg" alt="enter image description here"></p>
<p>now here is my loaded file in lightbox:
<img src="http://i.stack.imgur.com/8SHof.jpg" alt="enter image description here"></p>
<p>In my <code>test.php</code> file i also load another file in a lightbox with on click event. The lightbox appear correctly with the new loaded file. here is the code to call the lighbox:</p>
<pre><code>jQuery('#wt_opp_coll .coun').click(function(){
jQuery(this).jpLightBox({
width: 500,
height: 250,
url: 'components/content/test_file.php'
//message: 'Just Testing the file'
});
});
</code></pre>
<p>with this my new loaded file that is <code>test_file.php</code> appearing well in the lightbox but my last loaded file <code>test.php</code> disappearing on lightbox, as you see on the second screenshoot only lightbox appear not the details in the background like first screenshoot. </p>
<p>Please help me to stop disappearing my last loaded file(<code>test.php</code>) also.</p>
<p><strong>NOTE:</strong> i have also use <code>.load()</code> function in lighbox to load the url.</p>
|
javascript jquery
|
[3, 5]
|
2,096,429
| 2,096,430
|
C# asp.net why does my manual __doPostBack only run once?
|
<p>In my code I create the menu items dynamically:</p>
<pre><code>string listClientID = BulletedList1.ClientID.Replace('_', '$');
int counter = 0;
foreach (DataRow dataRow in database.DataTable.Rows)
{
// Add Button
ListItem listItem = new ListItem();
listItem.Value = "buttonItem" + Convert.ToString(dataRow["rank"]);
listItem.Text = " " + Convert.ToString(dataRow["title"]);
listItem.Attributes.Add("onclick", "__doPostBack('" + listClientID + "', '"+ counter.ToString() +"')");
BulletedList1.Items.Add(listItem);
counter++;
}
</code></pre>
<p>This menu is inside a update panel:</p>
<pre><code><div id="MenuItemBox">
<asp:BulletedList
ID="BulletedList1"
runat="server"
OnClick="MenuItem_Click"
>
</asp:BulletedList>
</div>
</code></pre>
<p>What I want is when a listitem is clicked it performs a postback. But when I run this, the onclick event is only runned once. </p>
<p>For example. I have 4 listitems. When I click the first item the first time the onclick event is executed. Now I click the second item, the onclick event is also executed. But when I now click the first item again the onclick event is not fired.</p>
<p>When I check the error console in FireFox or Oprah I don't get any errors.</p>
<p>So my question is: how can I fix this and what am I doing wrong?</p>
|
c# asp.net
|
[0, 9]
|
4,955,158
| 4,955,159
|
What is "focused" regarding android apps?
|
<p>I keep seeing "focused" and hearing about "focusing" within the development of Android apps. My question is: What is focusing, and how is it applied within Android apps? Is it important? What can you do with it?</p>
<p>I'm sorry if this has been asked, I looked but didn't see anything that clearly explained it. I've looked the the Android development guide, but I couldn't find a decent explanation of what it is and how it works. </p>
|
java android
|
[1, 4]
|
4,089,992
| 4,089,993
|
replacing div content with a click using jquery
|
<p>I see this question asked a lot in the related questions, but my need seems very simple compared to those examples, and sadly I'm just still too new at js to know what to remove...so at the risk of being THAT GUY, I'm going to ask my question...</p>
<p>I'm trying to switch out the div contents in a box depending on the button pushed. Right now I have it working using the animatedcollapse.toggle function, but it doesn't look very good. I want to replace it with a basic fade in on click and fade in new content on next button. </p>
<p>Basic idea:</p>
<pre><code><div>
<ul>
<li><a href="this will fade in the first_div"></li>
<li><a href="this will fade in the second_div"></li>
<li><a href="this will fade in the third_div"></li>
</ul>
<div class="first_container">
<ul>
<li>stuff</li>
<li>stuff</li>
<li>stuff</li>
</ul>
</div>
<div class="second_container">
<ul>
<li>stuff</li>
<li>stuff</li>
<li>stuff</li>
</ul>
</div>
<div class="third_container">
<ul>
<li>stuff</li>
<li>stuff</li>
<li>stuff</li>
</ul>
</div>
</div>
</code></pre>
<p>I've got everything working with the animated collapse, but it's just an ugly effect for this situation, so I want to change it out.</p>
<p>Thanks!
Joel</p>
|
javascript jquery
|
[3, 5]
|
5,741,833
| 5,741,834
|
How do I select a drawing on canvas?
|
<p>I wish to create a click-able object on a tag with javascript/jQuery.</p>
<p>This obviously dosen't work.</p>
<pre><code>var cow = new Object();
cow = ctx.drawImage(tile,cursorH,cursorV);
$(cow).click{function(){
alert('You clicked a cow!');
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,922,590
| 3,922,591
|
using Jquery to show one error message at a time
|
<p>I'm trying to show one error message at a time and then once that error has been corrected to show the next error.</p>
<p>For example there is validation on three textbox (Date, Month & Year) once the date textbox is valid then the month error message choudl show.</p>
<p>The code I have so far for this is: </p>
<pre><code>var pi_ArrayValidationResult;
var pi_EachValidator = function(delegate) {
if (typeof (Page_Validators) !== undefined) {
for (var i = 0; i < Page_Validators.length; ++i) {
delegate(Page_Validators[i]);
}
}
};
var pi_CheckValidators = function() {
var fields = {};
pi_EachValidator(function(val) {
if (fields[val.controltovalidate] === undefined) {
fields[val.controltovalidate] = true;
}
fields[val.controltovalidate] = fields[val.controltovalidate] && val.isvalid;
});
for (var field in fields) {
if (fields.hasOwnProperty(field)) {
$('#' + field)
.parent('div.fm-req')
.toggleClass('fm-error', !fields[field]);
</code></pre>
<p>This section is the bit that needs modification, to show one error then the next once the previous error is corrected:</p>
<pre><code> $('#' + field).siblings('span').hide();
$('#' + field).siblings('span').each(function() {
var $this = $(this);
if (!$this.isvalid) {
$this.show();
return false;
}
});
}
}
};
return {
init: function(args) {
var fnOld = ValidatorUpdateIsValid;
ValidatorUpdateIsValid = function() {
fnOld();
pi_CheckValidators();
}
}
};
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,908,967
| 5,908,968
|
how to set X Y and hight width for scoll view
|
<p>I have scroll-view and table-layout , row-table .</p>
<p>now i want to set X and Y margins and high and width for each one in programming code not xml .</p>
<p>note , I'm using Absolute layout for this activity .</p>
<p>this is my full code of activity : </p>
<p>public class ListActivity extends Activity {</p>
<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
AbsoluteLayout ff = (AbsoluteLayout) this.findViewById(R.id.AbsoluteLayout1);
TableLayout tl = new TableLayout(this);
TableRow tr = new TableRow(this);
TextView tv = new TextView(this);
ScrollView myScrollView = new ScrollView(this);
// adding scrollview to current layout
ff.addView(myScrollView);
// adding TableLayout to current myScrollView
myScrollView.addView(tl);
/* not working
ViewGroup.LayoutParams lp = new LayoutParams(100 ,100);
myScrollView.setLayoutParams(lp);*/
myScrollView.setPadding(0, 210, 120, 0);
/* not working
LayoutParams layoutParams = new LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT);
myScrollView.setLayoutParams(layoutParams); */
tr.addView(tv);
tv.setText("gewgewg");
tv.addView(tr);
}
}
</code></pre>
|
java android
|
[1, 4]
|
1,372,066
| 1,372,067
|
Why won't this Javascript Function Work?
|
<p>I have a JavaScript function that is not working now that I put in a new one under it. Here is what is in the head of my document.</p>
<pre><code> <head>
<link rel="stylesheet" href="9j3nz/style.css" type="text/css">
<script src="jquery.js"></script>
<script src="processing.js"></script>
<script type="text/javascript">
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
<script type="text/javascript">
function stopRKey(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (node.type=="text"))
$("label#enter_error").show();
{return false;}
}
document.onkeypress = stopRKey;
</script>
</head>
</code></pre>
<p>Everything is working fine except the isnumberkey function that was previously working. Nothing has changed in my HTML. Any help is appreciated. Thanks!</p>
<p>I am calling the isnumberkey function as follows:</p>
<pre><code> onkeypress="return isNumberKey(event)"
</code></pre>
<p>What might be keeping this from working? It has only started acting up since I put in the Stop Enter Key function.</p>
<p>EDIT:</p>
<p>After removing the Stop Enter Key function the isnumberkey event works again. I think they are interfering with each other some how.</p>
|
javascript jquery
|
[3, 5]
|
366,104
| 366,105
|
Android listing contacts sync sources
|
<p>Does anyone knows how to get the contacts sync sources in android? like google source, facebook source or from the phone contacts.</p>
|
java android
|
[1, 4]
|
4,117,191
| 4,117,192
|
Using JavaScript to populate the content in a div
|
<p>I've tried a few ways of doing this, the problem is our site is within a custom built CMS that won't allow us to use anything other than HTML and some JavaScript (it's very picky).</p>
<p>What I need to do is have a page within the CMS replace the content of one div on the page with the content of an outside php page.</p>
<p>Here's the code I'm currently using:</p>
<pre><code><script type="text/javascript">
$.ajax({
url: "http://website.com/files/table.php",
success: function(response){
$("#budget").append(response);
}
});
</script>
<div id="budget"></div>
</code></pre>
<p>The sole content on the php page is a huge table (content being populated from a DB table). Inside the CMS that does not yield anything (literally blank), but on my test html page (not within the CMS) it works just fine. Does anyone know of any other possible solutions working with these types of restraints?</p>
|
javascript jquery
|
[3, 5]
|
5,947,573
| 5,947,574
|
Visual Studio 2010 working directory
|
<p>I'm developing a C# asp.net web application. I'm basically done with it, but I have this little problem. I want to save xml files to the "Users" folder within my project, but if I don't psychically hard code the path "C:......\Users" in my project it wants to save the file in this "C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0\Users" folder, this is an annoying problem because I can't use the hard coded directory on our web hosts server. Also, I have a checkbox list that populates from the the "DownloadLibrary" folder in my project, and its suppose to download the files from that fold but its also looking to the "C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0\" folder for download even though its populating from the correct folder. I'm very confused by this, its the first time something like this has ever happened to me. Can anyone please help me with this, its the only thing standing in my way to complete this project.</p>
|
c# asp.net
|
[0, 9]
|
2,487,876
| 2,487,877
|
Passing PHP variable into JavaScript
|
<p>I've a PHP session variable, <code>$_SESSION['user']</code>, alive throughout the session. In the head section, I've my JavaScript file included, <code>scripts.js</code>. </p>
<p>How do I pass the session variable into the JavaScript file if I want something like the following.</p>
<pre><code>$.("#btn').click (
function() {
alert('<?php echo $_SESSION['user']; ?>');
}
)
</code></pre>
<p>As the <code><?php ?></code> isn't recognized in the JavaScript file, the code above doesn't work. So I've to put in the PHP file itself, but how do I keep it in the JavaScript file?</p>
|
php javascript
|
[2, 3]
|
5,754,138
| 5,754,139
|
how to auto redirect a page based on given time? should i use javascript ? how?
|
<p>let's say i have this code</p>
<pre><code>$itemtoDisplayTime = $model->getItemTime() // e.g 03:00pm
$currentTime = date('H:i'); //this is the system clock/time
</code></pre>
<p>is it appropriate to use javascript to automate the process of redirection without having to refresh the page ?
if so, how ?</p>
<p>let's say the $itemDisplayTime is now equal to $currentTime , how to use these variables in javascript or jquery if possible </p>
|
php javascript jquery
|
[2, 3, 5]
|
2,971,953
| 2,971,954
|
Does Javascript has a function like FindControlRecursive?
|
<p>Each row of a ListView has a checkbox. When the user clicks <strong>Delete Selected row(s)</strong> LinkButton, only rows that have the checkbox checked are deleted. I'm thinking about getting all the checkboxes in an array first then loop through to see which one was checked.</p>
<p>This is what I have tried.</p>
<pre><code> function CheckBoxBeforeDeleteing() {
var lv = document.getElementById("MainContent_ListView1");
//var inputs = lv.childNodes;
//alert(inputs.Length);
alert("Test");
}
</code></pre>
<p>If I don't comment out the 2 lines, the function is not even executed. It looks like I need to go deeper. Does Javascript has something function like the C#'s <strong>FindControlRecursive</strong>?</p>
|
javascript asp.net
|
[3, 9]
|
1,521,771
| 1,521,772
|
How to keep an absolutely positioned element directly over the position of inline one?
|
<p>This is a follow up question to <a href="http://stackoverflow.com/questions/2233097/how-can-i-stop-an-iframe-reloading-when-i-change-its-position-in-the-dom">http://stackoverflow.com/questions/2233097/how-can-i-stop-an-iframe-reloading-when-i-change-its-position-in-the-dom</a> if you want the background.</p>
<p>I have an inline div <code><div id="leaderboard-slot"></div></code> (with a fixed width and height) and another div ("leaderboard-loader") further down the page with the actual content for that div. </p>
<p>For various reasons (see previous thread), I am unable to simply do an appendChild or similar. </p>
<p>Instead, I'm hoping to position leaderboard-loader such that it takes up the space "reserved" by leaderboard slot. I've used some jQuery methods to do this:</p>
<pre><code>var loader = $('leaderboard-loader');
var dest = $('leaderboard-slot');
var pos = dest.getPosition();
loader.setStyle('top', pos.y + 'px');
loader.setStyle('left', pos.x + 'px');
</code></pre>
<p>which I fire on document load and resize. However, if other elements within the page cause a reflow, then the target div moves, but the loader doesn't.</p>
<p>Is there a safe way of doing this - it needs to work when I know nothing else about the page (ie I can't just make this call on any other methods that might cause a reflow, because I don't know what those are).</p>
<p>Any help would be much appreciated - thank you :)</p>
|
javascript jquery
|
[3, 5]
|
4,463,124
| 4,463,125
|
Ideas with REGEX Formatting
|
<p>Can anyone help please.
I am trying to figure out a Regex format for some data, but am struggling with its complexities.</p>
<p>I want to format some Latitude EditText in the format </p>
<p>"N5123.5" </p>
<p>The first digit must be either N or S (or n or s)
There must be then exactly 4 numerics, exactly 1 full stop
and then exactly 1 digit. Therefore the length must be exactly 7 characters long.
I have tried various although the one I believed it to be was</p>
<pre><code>static final Pattern LAT_PATTERN = Pattern.compile("^[NSns]{1}[0-9]{4}[.]{1}[0-9]{1}");
</code></pre>
<p>However this doesn't work.
Any experts out there could help please.</p>
|
java android
|
[1, 4]
|
2,286,258
| 2,286,259
|
Controlling speed of animation via a selector form
|
<p>I want to make the speed of an animation selectable. I've written the following code but I cant work out whats stopping it from working. If I remove $("#speed").val(); and replace it with a value, it works fine.
Any ideas will be greatly received!</p>
<pre><code><div class="lowerthird"> </div>
<button onclick="lowerthirdout();">Lower Third Out</button>
<select id="speed">
<option value="1000">Fast</option>
<option value="2000">Medium</option>
<option value="5000">Slow</option>
<option value="0">None</option>
</select>
function lowerthirdout(){
var speed = $("#speed").val();
$(".lowerthird").animate({
left: "640px",
}, speed );
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
17,979
| 17,980
|
Can PHP handle enterprise level sites as well as Java
|
<p>PLEASE NO FLAMING! </p>
<p>I really would love a few objective opinions about the issue. I have a project that has been strongly developed in PHP but have clients that are concerned that Java would be a better solution. I know sites such as Flickr and Digg are run on PHP, but I am concerned that PHP's lack of a running environment may destroy my project. </p>
<p>Example. PHP (that I know of) does not have an easy way to fork another process, nor is there an easy way to start a deamon to run background processes (cron jobs are a little ugly).</p>
<p>I would hate to rewrite a great piece of software, so I am in need of some solid advice. </p>
|
java php
|
[1, 2]
|
2,246,904
| 2,246,905
|
In Web Development - What ASP.net can do that PHP cannot do?
|
<p>Just thinking if it's necessary to learn ASP.net.</p>
<p>Also, which is faster to develop? If I learn ASP.net now..</p>
<p>I will be using one of those languages for my first Web Application.</p>
<p>thanks!</p>
|
php asp.net
|
[2, 9]
|
150,925
| 150,926
|
over text mark another text
|
<p>I'm looking for js code (maybe jquery) that will mark some text when I overmouse on another text (they both will have the same ID)</p>
<p>I have number of URLs and I want that overmouse on them will change table cell color</p>
<p>for example: </p>
<p>overmouse on url1 will mark cell ID 20</p>
<p>overmouse on url2 will mark cell ID 18</p>
<p>Thanks</p>
|
javascript jquery
|
[3, 5]
|
1,458,008
| 1,458,009
|
Uncaught TypeError: Object [object Object] has no method 'apply'
|
<p>I am receiving this Uncaught TypeError on a new website I am creating, but I can't work out what is causing the error.</p>
<p>I have recreated the issue at the link below, if you take a look at your browsers JS console you'll see the error occurring, but nothing else happens.</p>
<p><a href="http://jsfiddle.net/EbR6D/2/" rel="nofollow">http://jsfiddle.net/EbR6D/2/</a></p>
<p>Code:</p>
<pre><code>$('.newsitem').hover(
$(this).children('.text').animate({ height: '34px' }),
$(this).children('.text').animate({ height: '0px' }));
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,022,874
| 4,022,875
|
Different format for same Android contact phone number
|
<p>So let's say the SMS conversation is like this:</p>
<ol>
<li>hey nice to meet you (sent by me)</li>
<li>yea nice to meet you too (received)</li>
<li>let's hang out sometime (replied by me)</li>
</ol>
<p>The numbers associated with the other person look like this (by checking msg details):</p>
<ol>
<li>4161234567</li>
<li>+14161234567</li>
<li>+14161234567</li>
</ol>
<p>The number stored in my contact's info is (1). How would I access all SMS between myself and this contact all at once?</p>
|
java android
|
[1, 4]
|
1,647,423
| 1,647,424
|
webforms ajax file upload
|
<pre><code><form id="Form1" method="post" runat="server">
<uc1:PageHeaderDisplay id="pageHeaderDisplay1" runat="server"></uc1:PageHeaderDisplay>
<asp:HiddenField runat="server" ID="postedFormData" />
<div style="display: none;" class="uploadxmlcontainer">
Upload XML: <asp:FileUpload runat="server" ID="fileUpload" onChange="$('.uploadFile').click();" /><asp:Button runat="server" CssClass="uploadFile" Text="Upload" OnClick="UploadFile" style="display: none;" />
</div>
</code></pre>
<p>I have a fileupload control inside the original asp.net webforms form. What would be the easiest way to implement a non-postback solution? My problem is that when the user, for example, add some table rows using jquery -> uploads a file = the rows dissapear because of the postback.</p>
<p>Can i use a plugin like ajaxforms for asp.net webforms? Or can you make an iframe that posts to the main page? Im looking for a simple solution, if possible :-)</p>
<p>Any help is much appreciated! Thanks</p>
|
jquery asp.net
|
[5, 9]
|
4,054,835
| 4,054,836
|
How to capture clicked button in js functions?
|
<p>I have to buttons like this:</p>
<pre><code><input type='submit' id='submit' class='processAnimation'>
<input type='reset' id='reset' class='processAnimation'>
</code></pre>
<p>Now I have two js function. First function is called when ajax request is started and seconf function is called when ajax request is completed.</p>
<pre><code>this.showLoading = function () {
backupsource = $('.processAnimation').attr('class');
$('.processAnimation').removeAttr('class').addClass('disabled-btn processAnimation');
$('.processAnimation').attr( 'backupsource', backupsource );
}
this.hideLoading = function () {
backupsource = $('.processAnimation').attr('backupsource');
if( backupsource != undefined ) {
$('.processAnimation').removeAttr('class').addClass( backupsource );
$('.processAnimation').removeAttr('backupsource');
}
}
</code></pre>
<p><strong>EDIT</strong>: Above two functions are working and moving flower replaced clicked button. When request is complete then button is back. Problem is that when I click one button it replace all buttons(class=procesAnimation) with moving flower. </p>
<p>Thanks</p>
|
javascript jquery
|
[3, 5]
|
1,686,861
| 1,686,862
|
Object [object Object] has no method - Please help me, I'm stuck
|
<p>I am struggling since a few days ago with a problem with a jQuery plugin named "<strong>Smoothdivscroll</strong>".</p>
<p>Have found that jQuery is getting this <strong><em>Uncaught TypeError: Object [object Object] has no method 'smoothDivScroll'</em></strong> even when the script is loaded, Jquery too and all looks fine, <a href="http://www.ukkis.com/index.php?option=com_adsmanager&view=list&Itemid=95" rel="nofollow">the link is here</a>.</p>
<p>And the div it should be scrolling is this one:</p>
<p><img src="http://i.stack.imgur.com/3GPBB.png" alt="enter image description here"></p>
<p>I have tried all ways I see on the web, using <strong>noconflict, jQuery(function</strong> instead of $ , and my head is stuck with this one :( also I dont have too much experience using javascript, so its possible something I have miss and <strong>will love to learn how to solve this if happens again</strong>.</p>
<p>Thank you,</p>
<p>Phillippe</p>
|
javascript jquery
|
[3, 5]
|
3,007,593
| 3,007,594
|
Check if an element exists in the DOM
|
<p>The following snippet is not working for me. Basically I want to check if there is an input element with the name "documents[]" and the value item.id and return void.</p>
<p>I thought this line would do it: <code>$("input [name='documents[]'][value='"+item.id+"'") != false</code>. </p>
<p>However the statement returns true every time. I have looked at the documentation for the jQuery constructor and it doesn't mention anything about returning false if no element is found for the selector. </p>
<p>How can I tell if the selector doesn't match any elements?</p>
<pre><code> $.ajax({
url:'/myid/documents/json_get_documents/'+request.term,
dataType:"json",
success: function(data) {
response($.map(data, function(item){
if($("input [name='documents[]'][value='"+item.id+"'") != false) {
return; //This item has already been added, don't show in autocompete
}
return {
label: '<span class="file">'+item.title+'</span>',
id: item.id,
value: 'Search by title'
}
}))
}
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,261,535
| 1,261,536
|
Dynamically change style of panels through javascript
|
<p>I am trying to display a new panel after the user clicks an add button, for some reason this is not working (it refreshes the page as well, even though my button has a return true) I have tried different ways, but nothing seems to work that well.</p>
<pre><code><asp:Button ID="btnAdd" runat="server" Text="Add Property" CssClass="btn" OnClientClick="addProperty(); return false;" />
<script type="text/javascript">
var num = 1;
function addProperty()
{
num++;
var panelName = "<%=pnlProperty" + num.toString() + ".ClientID%>";
alert(panelName);
document.getElementById(panelName).style.display="inline";
}
</script>
</code></pre>
<p>Any helps would be great!</p>
|
c# javascript asp.net
|
[0, 3, 9]
|
3,778,827
| 3,778,828
|
Code questions for Jquery
|
<p>Which code will work fastest?</p>
<pre><code>for(i=0; i<100; i++) {
jQuery("#myDiv").append("<span>" + i + "</span>");
}
//
var i, markup = "";
for (i=0; i<100; i++) {
markup += "<span>" + i + "</span>";
}
//
jQuery("#myDiv").append(markup);
//
var i, markup = "";
for (i=0; i<100; i++) {
markup += "<span>" + i + "</span>";
}
//
jQuery("#myDiv").append("<div>" + markup + "</div>");
//
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,029,327
| 1,029,328
|
How can I play audiobooks from current position (where it stopped) in android media player?
|
<p>I am working with android application where I want play audiobooks from current position of books (eg:0:04/6:35 ) now I want play it and should start from 0:05 not from starting like 0:00.How can I achieve this please anyone help me out to get a solution.</p>
|
java android
|
[1, 4]
|
1,090,051
| 1,090,052
|
Ipad hover event jQuery
|
<p>Im trying to create a false hover event for my site using jQuery...</p>
<p>I have created the following only all the child elements in my list now return false also as opposed to linking to the correct page...</p>
<pre><code>if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
$("ul.sf-menu li.i").click(function(e) {
e.preventDefault();
});
}
</code></pre>
<p>Has anybody an idea on an alternative method that could work?</p>
<hr>
<p>HTML</p>
<pre><code><ul class="sf-menu"> <li><a href="index.html">Home</a><li class="i"><a href="wedding-hire.html">Weddings</a>
<ul>
<li><a href="peel-suite.html">Peel Suite</a></li>
<li><a href="the-hall.html">The Hall</a></li>
<li><a href="the-grounds.html">The Grounds</a></li>
<li><a href="food-and-drink.html">Food &amp; Drink</a></li>
<li><a href="pricing.html">Pricing</a></li>
</ul>
</li>
</code></pre>
<p></p>
|
javascript jquery
|
[3, 5]
|
4,540,965
| 4,540,966
|
Run SpeechRecognizer during call
|
<p>Is there a way to run SpeechRecognizer while being in a call? I have done it this way:</p>
<ul>
<li><code>BroadcastReceiver</code> handles change in phone state (e.g. offhook).</li>
<li>the <code>SpeechRecognizer</code> is started in the current (main) thread, as it can only be started in the main thread. The application context is used for the recognizer (the current context, given to the broadcast receiver, can't start be used)</li>
</ul>
<p>But unfortunately, the person on the other side can't hear me (the speech recognition works fine though). In away, the recognizer has "consumed" my voice and doesn't send it over.</p>
<p>I'm aware that doing things in the main thread during call is dangerous, but is there a way to run the recognizer somehow during call?</p>
<p>Update: I am trying the <code>TelephonyManager</code> listener instead of a <code>BroadcastReceiver</code>, but some internal services blow with NPEs.</p>
|
java android
|
[1, 4]
|
493,360
| 493,361
|
Combining function and callback parameter to create new function
|
<p>I have a wrapper around the jQuery animate function, which accepts a callback parameter to fire after the animation is completed. I want to "build" that callback by combining a user-passed callback and internal code. For example, the user passes <code>function Foo</code> as his callback. I want the actual callback to be <code>function Foo(); function Bar();</code> where <code>function Bar()</code> is internally defined. Here's an example of what I'm trying to achieve: </p>
<pre><code>MainSubController.prototype.changeMain = function($newMain, subWinCallback) {
$mainWinCpy.animatePositionChange(lastSubWinPos, this.subWinSize,
function() {self.subWins.push($mainWinCpy); subWinCallback(); });
}
</code></pre>
<p>I think I could do it by building an intermediary partial function, but I'm not sure, and if I could, I don't know how to go about doing it. </p>
<p>Edit: The problem with the above code is that subWinCallback is not executed, or, it's not executing at the right time. </p>
|
javascript jquery
|
[3, 5]
|
1,882,981
| 1,882,982
|
Is jQuery UI tabs broken in rc6?
|
<p>I've been using jQuery UI v1.6rc2 for a while, and wanted to upgrade to 1.6rc6 to see that they haven't made any breaking changes. It seems they have; all of my tabs stop working whenever I switch to rc6.</p>
<p>There seems to be two things wrong. First, the manual advocates using the following:</p>
<pre><code>$('#container').tabs();
</code></pre>
<p>However, with rc2 I've always had to do this:</p>
<pre><code>$('#container > ul').tabs();
</code></pre>
<p>So when rc6 is in effect, none of these methods work.</p>
<p>Also, Firebug reports the following error when rc6 is installed:</p>
<pre><code>$.Event is not a function.
this.namespace+'-state-disabled').attr("...event[prop]=event.originalEvent[prop];}}
</code></pre>
<p>All Javascript/jQuery executed before the call to .tabs() work fine. It breaks in both Firefox and Chrome.</p>
|
javascript jquery
|
[3, 5]
|
3,426,999
| 3,427,000
|
NumberFormatException when passing variable through Android Intent
|
<p>I'm trying to pass 2 variables through a couple of Android Activities. One of them keeps turning up as null on the last page:</p>
<p>The first Activity:</p>
<pre><code>Intent intent= new Intent(RoundOptionActivity.this, MoveOptionActivity.class);
intent.putExtra("numRounds", "5");
startActivity(intent);
</code></pre>
<p>The second Activity:</p>
<pre><code>Bundle extras = getIntent().getExtras();
if(extras !=null) {
numRounds = Integer.parseInt(extras.getString("numRounds"));
}
.........
Intent intent = new Intent(MoveOptionActivity.this, MoveActivity.class);
intent.putExtra("numRounds", numRounds);
intent.putExtra("playerChoice", playerChoice);
startActivity(intent);
</code></pre>
<p>(Note that at this point I printed numRounds in LogCat and it was set to the right number, and not null)</p>
<p>The Third Activity:</p>
<pre><code>Bundle extras = getIntent().getExtras();
if(extras !=null) {
playerChoice = Integer.parseInt(extras.getString("playerChoice"));
numRounds = Integer.parseInt(extras.getString("numRounds"));
}
</code></pre>
<p>At this point, the application crashes at the line where I try to parse numRounds to an integer, with a NumberFormatException complaining that it can't parse a null value. There's never a problem with playerChoice, only numRounds. I've tried handling numRounds the exact same way as playerChoice, but nothing seems to work. What's going on? D:</p>
|
java android
|
[1, 4]
|
4,438,503
| 4,438,504
|
HttpContext.GetGlobalResourceObject Always null from Class Library
|
<p>I have a resx file in App_GlobalResources in my web application, called with:</p>
<pre><code>Resources.GetResource("ResourceFileName", "Resource")
</code></pre>
<p>The helper method lives in a separate class library to get resource values:</p>
<pre><code>using System.Resources;
using System.Web;
public static class Resources
{
public static string GetResource(string resource, string key)
{
try
{
string resourceValue = (string)HttpContext.GetGlobalResourceObject(resource, key);
return string.IsNullOrEmpty(resourceValue) ? string.Empty : resourceValue;
}
catch (MissingManifestResourceException)
{
return string.Empty;
}
}
}
</code></pre>
<p>If I hit F5, everything works fine. If I deploy to a web server, <strong>all</strong> calls to GetGlobalResourceObject come back as null.</p>
<p>The resources exist. How do I get them out?</p>
<p>Thanks,</p>
<p>Richard</p>
|
c# asp.net
|
[0, 9]
|
2,403,998
| 2,403,999
|
Prevent a function from being fired too rapidly
|
<p>I have a function. It is being triggered from many other functions in the script. Sometimes very rapid and maybe almost simultaneously</p>
<p>How can I prevent it from being triggered too rapidly within short time? By setting a delay or timer of some sort? I want to minimize the database calls the function is making</p>
<p>But there should be no delay in the function if it's not needed.. Meaning: First call = no delay. All other calls = only delay if previous call was less than x seconds ago.
And if the delay is set to let's say 5 seconds, the function should only wait 1 second if the previous call was made 4 seconds ago.. Hope you understand what I mean ;)</p>
<pre><code>function checkusers() {
$.ajax({
url: '/checkusers_in_db.php',
type: 'POST'
});
};
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,082,302
| 5,082,303
|
how to add single quotes to string in c#?
|
<p>I am adding mutliple values to single string , all the values should be like in this format <code>'',''</code> but I am getting <code>"'',''"</code> instead.</p>
<p>How can I remove these double qoutes? Here's the code I'm using:</p>
<pre><code>string one = "\'"+ names[0, 0] +"\'"+","+"\'" + names[1, 0]+"\'";
string[] splitted = one.Split('\'');
string ones = "'" + splitted[1] + "'" +","+ "'" + splitted[3] + "'";
</code></pre>
|
c# javascript asp.net
|
[0, 3, 9]
|
5,380,919
| 5,380,920
|
Getting error while building android
|
<p>For some days I used to build android successfully.
But from last 2-3 days i was unable to build it. its giving some errors like:</p>
<blockquote>
<p>packages/apps/Calculator/src/com/android/calculator2/CalculatorDisplay.java:19:
cannot access android.content.Context bad class file:
android/content/Context.class(android/content:Context.class) unable to
access file: corrupted zip file Please remove or make sure it appears
in the correct subdirectory of the classpath. import
android.content.Context;
^ make: <em>*</em>
[out/target/common/obj/APPS/Calculator_intermediates/classes-full-debug.jar]
Error 41</p>
</blockquote>
|
java android
|
[1, 4]
|
1,315,701
| 1,315,702
|
Is it possible to bind two separate functions to the same event
|
<p>Basically I'd like to bind function A to all inputs. Something like this:</p>
<pre><code>$('input').bind('change', function() { bla bla bla });
</code></pre>
<p>And then later I would like to bind something different in addition like this:</p>
<pre><code>$('#inputName').bind('change', function() { do additional processing..});
</code></pre>
<p>Is that possible? Does it work? Am I missing the syntax? Is that fine actually fine (meaning I have a bug elsewhere that's causing one of these not to bind)?</p>
|
javascript jquery
|
[3, 5]
|
2,743,601
| 2,743,602
|
Pushing to multidimensional object
|
<p>I'd like to end up with an object like:</p>
<pre><code>{"Red 1":53,"Blue 2":26,"Green 3":25}
</code></pre>
<p>From the following example:</p>
<p>Was trying to push the data from inside .each to the object, but it being multidimensional, i'm not sure how to accomplish this:</p>
<pre><code>//html
<div class="test">
<div class="color">Red 1</div>
<div class="value">53</div>
</div>
<div class="test">
<div class="color">Blue 2</div>
<div class="value">26</div>
</div>
<div class="test">
<div class="color">Green 3</div>
<div class="value">25</div>
</div>
//js
var dataPoints = {};
var colorTitle = '';
var colorValue = '';
$('.test').each(function(index) {
colorTitle = $(this).find('.color').html();
colorValue = $(this).find('.value').html();
dataPoints.push({colorTitle:colorValue});
});
</code></pre>
<p>The code above clearly does not work, but I wanted to demonstrate basically what I am trying to do.</p>
<p>Tried this approach as well:</p>
<pre><code>dataPoints[index][colorTitle] = colorValue;
</code></pre>
<p>Which doesn't work either. Probably missing something all together, but any help is appreciated! Thanks</p>
|
javascript jquery
|
[3, 5]
|
5,561,308
| 5,561,309
|
Pass a query in URL using jquery
|
<p>I want to pass a $_GET[''] to a php file, when a word is clicked in a div,it must display data from the db.</p>
<p> It displays the data without the query.</p>
<p>The process.php contains SQL statement to query the db and display values.</p>
<p>Thanks
Jean</p>
|
php jquery
|
[2, 5]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.