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
509,834
509,835
setting in one class and getting from another class
<p>this is really basic I know, but I just can't see what the problem is... all I want to do is set the value of a variable from one class into an "intermediary" class and retrieve it in a third class (because filterArray will get called from other classes as well, and I want them all to read the same data). But if I do:</p> <pre><code>b =new GetSet() b.setBdl(extras); JSONArray arr= getData.filterArray(); </code></pre> <p>using</p> <pre><code>class GetSet { private Bundle params; public GetSet() { } public Bundle getBdl() { return this.params; } public void setBdl(Bundle bdl) { params = bdl; } } </code></pre> <p>then in the filterArray method, if I try </p> <pre><code> Bundle params = new GetSet().getBdl(); </code></pre> <p>I get all sorts of run time errors, and if I try</p> <pre><code>Bundle params = GetSet.getBdl(); </code></pre> <p>it tells me I can't make a static reference to a non-static method. Where am I going wrong?</p>
java android
[1, 4]
1,609,867
1,609,868
Generate questions randomly and non repaeted from the xml file in android
<p>I have a xml file having 50 different questions and i need only 15 out of them randomly and non-repeated.I used the code below</p> <pre><code>int n = ((int)(Math.random()*100))%50; if(temp&lt;15) { for(int i=0;i&lt;temp;i++) { System.out.println("hello naresh"); if(n==check[i]) { n=((int)(Math.random()*100))%50; } } check[temp]=n; } temp++; return n; </code></pre> <p>But by using this some questions are repeated.Please suggest me something which help me to generate the non-repeated questions.</p>
java android
[1, 4]
5,045,970
5,045,971
In Java, what happens when you have a method with an unspecified visibility keyword?
<p>I have been working with android for a few years now, not once have I had a teacher or anyone to tell me what to do. This whole time I have wondered to myself this.</p> <p>When you have a method I generally see...</p> <pre><code>public void method(){ //Stuff } </code></pre> <p>or</p> <pre><code>private void method(){ //stuff } </code></pre> <p>I know that a void is a method with no return value, and that public is the visibility of the method in a way but would it matter if I just used something like this...</p> <pre><code>void method(){ //stuff } </code></pre> <p>Because then the methods visibility would just be default anyway?</p> <p>I have no idea if I am right or not, is it just good practice to specify "public" or "private" ?</p>
java android
[1, 4]
5,508,367
5,508,368
How do you dynamically change intent.category.LAUNCHER to intent.category.DEFAULT?
<p>I need to create an application which will be hidden from the user. But before it gets hidden, I need to set some configuration on the GUI and after that I must hide the icon from the applications list. If I remove the</p> <pre><code>&lt;category android:name="android.intent.category.LAUNCHER" /&gt; </code></pre> <p>the application is not shown on the application list. But my configuration GUI is also not shown. I need to show an Activity and after I make my configuration then I hide the application. I've searched here around but I have been unable to find a solution. How can I dynamically change</p> <p><code>&lt;category android:name="android.intent.category.LAUNCHER" /&gt;</code> <br> to <br> <code>&lt;category android:name="android.intent.category.DEFAULT" /&gt;</code> ?</p>
java android
[1, 4]
4,301,998
4,301,999
Neater way of checking adding/removing a CSS class using 'hasClass' in jQuery?
<h2>Overview</h2> <p>From time to time in jQuery I want to check a condition of some kind, and then based on the result add/remove a cssClass to an element.</p> <p>Before calling add(remove)Class, I always check to see if that class isn't (or is) applied already.</p> <h2>In code, this translates to</h2> <pre><code>var myElement = $('#something'), someClass = 'coolClass'; if (someCondition) { // addClass, but only if that class isn't already on this element if (!myElement.hasClass(someClass)) { myElement.addClass(someClass); } } else { // otherwise, removeClass, but only if it's already on this element if (myElement.hasClass(someClass)) { myElement.removeClass(someClass); } } </code></pre> <h2>Is there a neater way of writing the above?</h2> <p>I'm sure there must be a nicer way of doing this, as the nested if statements smell to me.</p> <h2>Clarity on toggling</h2> <p>Just a clarifying note (added after the answers below). It is important to note here than <code>toggleClass(className)</code> will not suffice as I <em>explicitally</em> want to remove or add based on a condition check - and need to account for the 'toggle' going out of sync. (Adam gives an example in a comment on Rob's answer below).</p>
javascript jquery
[3, 5]
5,433,018
5,433,019
Color Dodge Blend Bitmap
<p>I have two bitmaps topBitmap and bottomBitmap and I need to blend the two bitmaps using color dodge in android. I could not find color dodge in PorterDuffXfermode. Is there any way to do it with ot without the use of a Canvas? </p> <p>Kindly let me know how to blend two bitmaps using color dodge mode in android.Thanks in advance.</p>
java android
[1, 4]
3,861,422
3,861,423
Raw javascript instead of jquery (example follows)
<p>this is my first question here. I have the following jquery code:</p> <pre><code>$(document).ready(function(){ $("a").click(function(){ $(this).parent("li").css({textDecoration: "line-through"}); return false; }); }); </code></pre> <p>that works just fine. It strikes through the parent li of any clicked anchor (there are many anchors and lists in the html, not just one). But i want just this functionality, nothing else. Isn't this an overkill to include the whole jquery library?</p> <p>Unfortunateley i don't know raw javascript very well, can someone convert this for me? I would be grateful.</p> <p>EDIT: Wow i am amazed at speed and the quality of the answers! So first of all a big THANKS to all of you! I will either go for jonathon's (edit2: roland's) solution or just include jquery after all. Thanks again!</p>
javascript jquery
[3, 5]
2,706,179
2,706,180
My ellipsis function is taking the wrong string
<p>I have an ellipsis function in php to truncate my string.</p> <pre><code>$HashTagText = "#apple, #ball #cat , #dog"; </code></pre> <p>the ellipsis function gives results like - <code>#apple, #ball #c...</code><br/></p> <p>It shows OK but when I click on <code>#c...</code> then the link passes <code>#c...</code> value instead of <code>"cat"</code> after I click on <code>"#c..."</code> string.</p> <p>jQuery code</p> <pre><code>$(".thumb_hash a").click(function(){ var HashIdbase = $(this).attr('id'); HashId = HashIdbase.replace( /,/g, "" );/* remove comma from right side*/ $('.loading').show(); $.post("&lt;?php echo site_url('hashSearchFromLightbox');?&gt;",{HashId:HashId},function(data){//store in session window.location = "&lt;?php echo site_url('home')?&gt;";//refresh controller }); }); </code></pre> <p>my ellipsis function</p> <pre><code> function ellipsisCheck($text, $max=100, $append='&amp;hellip;') { if (strlen($text) &lt;= $max) return $text; $out = substr($text,0,$max); return $out.$append; } </code></pre> <p>function used in span class="thumb_hash" </p> <pre><code> $HashTagText1=ellipsisCheck($HashTagText,27); $ExpHashTagText=explode('#',$HashTagText1); foreach ($ExpHashTagText as $value)&lt;br/&gt; { if($value !=null) { echo "&lt;a href='#' id='$value'&gt;#".$value."&lt;/a&gt;"; } } </code></pre> <p>I need that when I click on dotted string(#c..) then it take value "cat" for storing insession variable.</p>
php javascript
[2, 3]
1,021,172
1,021,173
Calculate date difference in integer value
<p>I have two date fields with IDs gp_vdate_from and gp_vdate_to. And I have a hidden div which is populated by a dynamic table. The div gets visible on click of a button after entering date fields. I did something like this to calculate the date difference </p> <pre><code>function parseDate(str) { var mdy = str.split('-') return new Date(mdy[2], mdy[0]-1, mdy[1]); } function daydiff(first, second) { return Math.floor((second-first)/(1000*60*60*24)) } var diff=(daydiff(parseDate($('#gp_vdate_from').val()), parseDate($('#gp_vdate_to').val()))); </code></pre> <p>The date entered is in the format 10-2-2012. But I am not able to give to get the difference? Can someone point out why?</p>
javascript jquery
[3, 5]
3,573,513
3,573,514
jQuery event handler not working
<pre><code>&lt;form id='new_key' action='/foo/bar' method='post'&gt; &lt;input type="text" id="u"&gt; &lt;input type="submit" value="submit"&gt; &lt;/form&gt; </code></pre> <p>I can bind a jquery event to this element like:</p> <pre><code>&lt;script type="text/javascript"&gt; $('#new_key').ready(function() { alert('Handler for .submit() called.'); return false; }); </code></pre> <p>It works as expected</p> <p>but if i do:</p> <pre><code>&lt;script type="text/javascript"&gt; $('#new_key').submit(function() { alert('Handler for .submit() called.'); return false; }); </code></pre> <p>it dont work. does anybody knows why? what am i missing?</p>
javascript jquery
[3, 5]
4,831,483
4,831,484
calling Jquery from PHP
<p>having trouble calling a Jquery function from within PHP. I'm getting a syntax error when I'm using the below code:</p> <pre><code>if(!empty($_POST['selectAGE'])){ $username = $_POST['selectAGE']; } if(empty($_POST['selectAGE'])){ echo '&lt;script type="text/javascript"&gt;' , '$("#selectAGE").prepend("&lt;option value=''&gt;&lt;/option&gt;").val('');' , '&lt;/script&gt;'; } </code></pre> <p>Am I not escaping properly or something?</p> <p>further to this, I'm then checking this select box by using </p> <pre><code>if ( form.selectAGE.selectedIndex == 0 ) { alert ( "Enter the correct Age." ); return false; } </code></pre> <p>however, once the form has been submitted, it eliminates the prepended 'empty' value and now the one you've selected is selectedindex 0. so the above check returns that you haven't entered it. How can I amend the line above to take this into account?</p>
php jquery
[2, 5]
1,119,397
1,119,398
Javascript: Clicking a wrapper element but not a child element
<p>I am writing some javascript (jQuery) that enables a div wrapped around a checkbox, when clicked, will toggle the checkbox element. However, the problem I'm running into is that when you click on the checkbox, it doesn't work because it's being toggled twice (at least I think that's what's happening). </p> <p><a href="http://jsfiddle.net/misbehavens/WV7sp/" rel="nofollow">Here's a demo.</a></p> <p>Here's the code:</p> <pre><code>$('.checkbox-wrapper').click(function(){ var $checkbox = $(this).find('input[type="checkbox"]'); if ($checkbox.is(':checked')) { $checkbox.attr('checked', false); } else { $checkbox.attr('checked', true); } }); </code></pre> <p>How can I make it so that clicking the checkbox works as normal, but if you click in the surrounding area, it toggles the checkbox?</p> <h2>Solution:</h2> <p>Thanks to jAndy's comment for showing how this can be done by checking the event.target property:</p> <pre><code>$('.checkbox-wrapper').click(function(e){ if( e.target.nodeName === 'INPUT' ) { e.stopPropagation(); return; } var $checkbox = $(this).find('input[type="checkbox"]'); if ($checkbox.is(':checked')) { $checkbox.attr('checked', false); } else { $checkbox.attr('checked', true); } }); </code></pre> <p>And as others have pointed out, this may not be the best example since you get the same functionality (without needing javascript) by wrapping the checkbox with a label tag instead of a div tag. <a href="http://jsfiddle.net/misbehavens/cuhwE/" rel="nofollow">Demo</a></p>
javascript jquery
[3, 5]
5,590,808
5,590,809
accessing ASP.NET controls in Javascript
<p>I have following Javascript line in my ASP.NET web app:</p> <pre><code>document.getElementById('&lt;%=myTextBox[0].ClientID %&gt;').value = "test"; </code></pre> <p>how can I access myTextBox elements? for instance I want to change 5th element of this server side array, I want to pass a server side parameter to my function, how can I do it?</p> <p>for instance:</p> <pre><code>server side: ddl.Attributes.Add("onChange", "return OnFoodChange(this,'" + i + "');"); javascript function: function OnFoodChange(myCmb,myIndex) </code></pre> <p>using <code>document.getElementById('&lt;%=myTextBox[myIndex].ClientID %&gt;').value = "test";</code> gives me error, it says that myIndex is not defined, I think because myIndex is used like a server side parameter, how can I solve it?</p> <p>it is my full JavaScript function:</p> <pre><code> function OnFoodChange(myCmb,myIndex) { //alert('5'); try{ var q = document.getElementById('&lt;%= HFFoodPrice.ClientID %&gt;').value.toString(); var q2 = q.split(';'); var index = 0; //alert(myCmb.selectedIndex.toString()); //var e = document.getElementById(myCmb); var strUser = myCmb.options[myCmb.selectedIndex].value; document.getElementById('&lt;%=myTextBox[0].ClientID %&gt;').value = strUser; for (var j = 0; j &lt; q2.length; j++) { if (q2[j] != '') { var q3 = q2[j].split(','); { } } } } catch(err) { alert(err.message); } } </code></pre>
javascript asp.net
[3, 9]
3,481,191
3,481,192
Javascript in ASP.NET: Conditionally making href/http request?
<p>I'm really new to ASP.NET and javascript so I'm rather lost on how to do a lot of things. But what I really need to do right now is this:</p> <p>The website I'm working on has a link that makes makes an http request, and is located inside a grid, as such:</p> <pre><code>&lt;a target="_blank" href='&lt;%# Eval ( "ServerURL","{0}Thing.aspx") %&gt;'&gt; </code></pre> <p>What I need to do is write a javascript function at the top that takes the place of this line, so that I can check another element in the grid, and only make the http request when that other element is of a certain value. I tried rewriting it as such:</p> <pre><code>&lt;a target="_blank" href='javascript:Call(&lt;%# Eval ( "ServerURL","{0}Thing.aspx") %&gt;);'&gt; </code></pre> <p>and the function Call at the top:</p> <pre><code>&lt;script type="text/javascript"&gt; function Call (url){ return url; } &lt;/script&gt; </code></pre> <p>But all it does is open a new tab with about:blank for the url. What is it that I should be doing here?</p>
javascript asp.net
[3, 9]
5,330,845
5,330,846
How can I create subdomains on my main domain?
<p>As you all know few sites offer feature which let you specify what type of url you would like to have. Mostly they are of type:</p> <pre><code>ABC.somedomain.com DEF.somedomain.com </code></pre> <p>(Mostly these sites are blog/genealogy site.)</p> <p>I do not quiet understand how does it all work. Can you explain me how can I achieve this or point me in right direction? Also how can I test this on localhost to really see if all is working fine. I have this doubt in my mind since many months but it never got cleared.</p> <p>Thanks in advance:)</p>
c# asp.net
[0, 9]
4,398,475
4,398,476
smtp web.config configuration and usage
<p>I have the following problem:</p> <p>Using asp.net C# and calling several places in code to send email to the user.</p> <p>However the from address in different sections of the code is different, and I have only one email address configured in web.config. This causes email sent from non-configured email addresses to go to users' junk box, how do I prevent this.</p> <p>I have the following in web.config. So if from any place in the code the from address i not [email protected], it will go to users' junk box.</p> <pre><code> &lt;smtp deliveryMethod="Network"&gt; &lt;network host="smtp.site.com" userName="[email protected]" password="mypassword" /&gt; &lt;/smtp&gt; </code></pre> <p>Here is c# code:</p> <pre><code>MailMessage message = new MailMessage(); message.From = new MailAddress("forgotyourpassword@abc"); message.To.Add(new MailAddress(this.txt_Email_Pass.Text)); message.Subject = "Welcome to abc"; message.Body ="abc"; SmtpClient client = new SmtpClient(); client.Send(message); </code></pre>
c# asp.net
[0, 9]
6,018,945
6,018,946
Javascript/jQuery to resize randomly the pictures on load?
<p>Instead of creating thumbnails for my images, I would like to show the original images in my page. For viewing purposes, I still need to resize these images but instead of adding a <code>width:200px</code> on them, I want to display each image in a div container but with size randomly chosen from three choices.</p> <p>These 3 types of div containers (and therefore the images appearance) will have 3 different sizes, all with the same width. 300x100, 300x200, 300x400.</p> <p>Of course, upon refresh, the images may have a different size now.</p> <p>How can I do this ?</p>
javascript jquery
[3, 5]
1,172,371
1,172,372
Java game: temporarily draw image based on int field
<p>I'm new to <code>Java</code> and am making a game for <code>Android</code>.</p> <p>I have a score counter in my game, and when the counter reaches a certain number I want a message to flash on the screen letting the player know they've reached level 2, etc. </p> <p>All the other elements of <code>nextLevel</code> I have been able to implement easily, because these updated elements are supposed to retain their changes while in any given level. However, I'm confused about how to draw this "Level 2" image for only a few seconds once the player crosses the appropriate score threshold.</p> <p>I tried using a boolean (nextlevel) like this:</p> <pre><code>if (nextLevel){ if (levelStart &lt; 70){ paint5.setAlpha(255-(levelStart*4)); paint7.setAlpha(255-(levelStart*4)); g.drawString(String.valueOf(scoremult), g.getWidth()/2, g.getHeight()/2-100, paint5); g.drawString("x", (g.getWidth()/2)-40, g.getHeight()/2-100, paint7); levelStart++; } else { levelStart = 0; } } </code></pre> <p>But because <code>nextLevel</code> stays true the whole time the player is in the level, the message is drawn and fades over and over. What I want is something like an event trigger, where once the threshold is crossed, the draw loop runs until complete regardless of what else is happening in the program.</p> <p>Here is how the 2nd level is implemented:</p> <pre><code>if ((score&gt;=50)&amp;&amp;(score &lt; 125)){ level = 1.2; scoremult = 2; recentinterval = 27; nextlevel = true; </code></pre> <p>Any suggestions?</p>
java android
[1, 4]
5,657,590
5,657,591
Android LinearLayout get views/rows that are on the screen
<p>Let's say I have a <code>LinearLayout</code> set to vertical and i've added 100 views to it each view is 50dp high. A user is going to scroll and fling up and down on that <code>LinearLayout</code>.</p> <p>I need to know the index numbers of the views that are on the screen. i.e if they fling down to the middle and stop, and see 5 items on their screen, i'd need to infer 50-55.</p> <pre><code> &lt;LinearLayout android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="fill_parent" android:id="@id/listing_main"&gt; &lt;/LinearLayout&gt; </code></pre> <p>I've tried a bunch of ways to infer the current visible views - like taking the <code>scrollY</code> position and the height of my items...doesn't seem to work out.</p> <p><code>view.getScrollY()</code> seems totally arbitrary compared to the other scroll mesurements</p>
java android
[1, 4]
4,327,330
4,327,331
Getting attr value and
<p>Here's what I'm trying to do:</p> <p>I make a GET request with jquery, and need the response.</p> <p>In the response there is a dynamic variable that contains an array of values where I need to get a single value </p> <pre><code>$.ajax({ type: "GET", url: "http://site.com", success: function(response) { $("#price").html(response); var price = ("#price").(".item").attr("item-id"); console.log(price); } }); </code></pre> <p>For example what I am trying to get in the response is</p> <pre><code>&lt;script&gt; Item568 = { id: "568", name: "Pants", cost: "56" }; &lt;/script&gt; </code></pre> <p>How can I get the cost value "56" from the response of a GET request? Thanks</p> <p>Here is a example of the response:</p> <pre><code>&lt;div class="item" item-id="568"&gt; </code></pre> <p>I need to take item-id value, then find the dynamic variable name on the page as above. (Item568)</p>
javascript jquery
[3, 5]
3,914,997
3,914,998
Execute HTML5 data- string as JavaScript (without eval)?
<p>I have the following div:</p> <p><code>&lt;div id="foo" data-callback="function(){console.log(1)}"&gt;&lt;/div&gt;</code></p> <p>I want to be able to execute the div's callback string as a JavaScipt function like this:</p> <p><code>($('#foo').data('callback'))()</code></p> <p>But this obviously won't work. Is there any way to do this?</p> <p>Here's a <a href="http://jsfiddle.net/CXfaw/" rel="nofollow">JSFiddle</a>.</p>
javascript jquery
[3, 5]
2,308,517
2,308,518
Events with and without delegates in ASP.NET
<p>In some ASP.NET examples i see that events are used with delegates <a href="http://www.dotnetjohn.com/articles.aspx?articleid=62" rel="nofollow">like this</a> and sometimes without them <a href="http://asp.net-tutorials.com/user-controls/events/" rel="nofollow">like this</a>.</p> <p>Please explain!</p>
c# asp.net
[0, 9]
474,358
474,359
Show/hide views with checkbox
<p>I want to show or hide some elements (textviews and edittexts) with checkbox. I set their visibility to gone in layout file. Showing them when user checks the box works, but the when user unchecks it, they don't hide. (android 1.5 and 1.6)</p> <p>My code:</p> <pre><code>cb=(CheckBox)findViewById(R.id.cek); cb.setOnClickListener(new OnClickListener() { // checkbox listener public void onClick(View v) { // Perform action on clicks, depending on whether it's now checked if (((CheckBox) v).isChecked()) { tv1.setVisibility(0); //visible==0 et3.setVisibility(0); } else if (((CheckBox) v).isChecked() == false) { tv1.setVisibility(2); //gone=2 et3.setVisibility(2); } } }); </code></pre>
java android
[1, 4]
855,258
855,259
Dynamically changing the jQuery sortable placeholder value
<p>How do I use an if statement in the jQuery sortable plugin to dynamically determine the placeholder class?<br/><br/> If the item is being dragged around in <code>#listA</code> then I want the placeholder class to be <code>.ImInListA</code><br/> If the item is being dragged around in <code>#listB</code> then I want the placeholder class to be <code>.ImInListB</code></p> <p><br/> jQuery</p> <pre><code>$( "#listA, #listB" ).sortable({ connectWith: ".connected_sortable", placeholder: //if the current item is being dragged in #listA //use css class selector .ImInListA //else //use css class selector .ImInListB }).disableSelection(); </code></pre> <p>HTML:</p> <pre><code>&lt;ul id="listA" class="connected_sortable"&gt; &lt;li value="1"&gt;list_a_1&lt;/li&gt; &lt;/ul&gt; &lt;ul id="listB" class="connected_sortable"&gt; &lt;li value="2"&gt;list_b_2&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Thanks!</p>
javascript jquery
[3, 5]
1,696,174
1,696,175
Android RelativeLayout change color onClick
<p>How do i change the color of a Relative Layout i use as a clickable on Click like the normal Button? Like i want a visual feedback the layout was pressed.</p> <p>I tried it with a selector bound to the background property like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_focused="true" android:color="@android:color/black"/&gt; &lt;item android:state_pressed="true" android:state_enabled="false" android:color="@android:color/black" /&gt; &lt;item android:color="@android:color/white"/&gt; &lt;/selector&gt; </code></pre> <p>and used it in the Layouts backround...</p> <p><code>android:background="@color/layout_selector"</code></p> <p>but this gives me an Inflate Exception...</p> <p>Any ideas?</p>
java android
[1, 4]
1,794,668
1,794,669
How to open .xlt file in .net?
<p>I have an .XLT file which i want to read/write in .net. Can it be opened using .net framework ? As far as i know XLT is Excel Template I have an .XLT file which is like a registration form wherein i want to fill the cells from .net .Is it possible? </p>
c# asp.net
[0, 9]
1,506,253
1,506,254
How can i check if imageview is empty or not
<p>i have an application that has form and there is some fields the user should fill it ,i want to put the button "Next" disable until the user fill this fields. </p> <p>the fields is:(iamgeView, EditText,Spinner..)</p> <p>i know how to check the text Edit but how can i check if the user fill the image and spinner or not (image view will let the user choose an image from native gallery)</p> <p>What i want: how can i check if the user fill the image and spinner or not? this is my code to check the Edit Text</p> <pre><code> private boolean checkEditText2(EditText edit) { return edit.getText().length() == 0; } </code></pre>
java android
[1, 4]
1,383,415
1,383,416
WebView.getContentHeight() always returns 0
<p>I'm attempting to display an HTML string in a WebView named webDescription. Because this HTML can sometimes be lengthy, I want to limit the height of the WebView to a maximum dimension and allow the content to scroll within the view.</p> <p>I am using the following code to wait until the page finishes loading, check the content height and set the height of the enclosing (parent) TableRow to a maximum of 150.</p> <pre><code> webDescription.setWebViewClient(new WebViewClient() { public void onPageFinished(WebView view, String url) { // do your stuff here Log.i("EVENTDETAIL", "Web view has finished loading"); Log.i("EVENTDETAIL", "Description content height: " + view.getContentHeight()); if ( view.getContentHeight() &gt; 150 ) { LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, 150); view.setLayoutParams(params); } } }); </code></pre> <p>However, view.getContentHeight() always returns 0; thus, the LayoutParams of the parent TableRow never get changed.</p> <p>Can anyone offer any insight into this and how I might fix my problem? Thanks so much for your consideration.</p>
java android
[1, 4]
3,343,112
3,343,113
Problem with at sign in div name
<p>I have a page which has some divs. Each div id starts with the word divfor and have a suffix after that. Like divforjohn, divforjim ... etc. These suffixes come from database.</p> <p>My problem is when i try to load something in that div it creates problem if it have the @ sign in it. So, if I do something like below:</p> <pre><code> $("#divfor"+divsuffix).html('some text goes here.'); </code></pre> <p>then it doesnot make any problem if the divname is <code>divforjohn</code> but doesnot work if the divname is <code>divforjohn@x</code>.</p> <p>So, how can I address a div that has @sign in its id? or its a limitation/bug of jquery?</p> <p>Thx.</p>
javascript jquery
[3, 5]
5,545,763
5,545,764
How can I change time format of TimePickerDialog dynamically?
<p>I have a button, on click on the which the time format of a TimePickerDialog should change from 12 hours to 24 hours and vice versa.</p> <p>I know I have to use onPrepareDialog(), but how can I change the time format inside onPrepareDialog ? Any help is appreciated!</p> <p>Thank you.</p>
java android
[1, 4]
4,124,768
4,124,769
Bug error: trying to set asp.net radiobuttonlist selected item from codebehind return an error
<p>When using the following code, this error is returned: <em>'rblPermisSejourA' has a SelectedValue which is invalid because it does not exist in the list of items.</em></p> <pre><code>&lt;asp:RadioButtonList ID="rblPermisSejour" runat="server" DataSourceID="EntityDataSourcePermisSejour" DataTextField="Libelle" DataValueField="Id" AppendDataBoundItems="True" RepeatDirection="Horizontal"&gt; &lt;asp:ListItem Selected="True" Text="" Value="-1"&gt;Aucun&lt;/asp:ListItem&gt; &lt;/asp:RadioButtonList&gt; &lt;asp:RadioButtonList ID="rblPermisSejourA" runat="server" DataSourceID="EntityDataSourcePermisSejour" DataTextField="Libelle" DataValueField="Id" AppendDataBoundItems="True" RepeatDirection="Horizontal"&gt; &lt;asp:ListItem Selected="True" Text="" Value="-1"&gt;Aucun&lt;/asp:ListItem&gt; &lt;/asp:RadioButtonList&gt; protected void ws2_OnDeactivate(object sender, EventArgs e) { rblPermisSejourA.SelectedValue = rblPermisSejour.SelectedValue; } </code></pre> <p>Note that "rblPermisSejour" is in a wizard step and "rblPermisSejourA" in another wizard step that is not yet activated (no id and no title for the step in witch there is the "rblPermisSejourA"). When this step is activated, all is working well. <br/> But with the same code and same operation <strong>with another RadioButtonList it's working very well</strong> and this <strong>within the same context</strong> (wizard step not activated).</p>
c# asp.net
[0, 9]
5,296,732
5,296,733
Programmatic RelativeLayout
<p>I'm attempting to programmatically add several Tiles which extend from TextViews into a RelativeLayout.</p> <p>My code is as follows.</p> <pre><code> RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); for (int i = 0; i &lt; characters.length; i++) { Tile tile = new Tile(this); tile.setText(Character.toString(characters[i])); tile.setId(i); if (i != 0) { params.addRule(RelativeLayout.RIGHT_OF, i - 1); } _display.addView(tile, params); } } </code></pre> <p>So I'm creating a new instance class of LayoutParams called params and adding a rule to align each tile to the right of the previous tile. When I run the app it appears that the tiles are just overlapping over each other. Any suggestions?</p>
java android
[1, 4]
621,238
621,239
Calling dynamic jQuery plugin with dynamic parameters in Javascript
<p>Suppose we need to dynamically construct plugin calls such as </p> <pre><code>$('#myDiv').myPlugin({a:'a',b:'b'}); </code></pre> <p>will be something like:</p> <pre><code>function funcCallBuilder(selector, func, opts){ //dynamically construct plugin call here } </code></pre> <p>using:</p> <pre><code>funcCallBuilder('#myDiv', 'myPlugin', {a:'a',b:'b'}); </code></pre> <p>Can someone point out the correct way of doing this?</p>
javascript jquery
[3, 5]
4,041,992
4,041,993
Android java Finding a location and tapping there
<p>So, I used this code</p> <pre><code> public void loadLevel(float x, float y) { if(PopUpsGone == true) { if(x &gt; 106 &amp;&amp; x &lt; 243 &amp;&amp; y &gt; 375 &amp;&amp; y &lt; 465) { Toast.makeText(getApplicationContext(), "1", Toast.LENGTH_LONG).show(); } if(x &gt; 7 &amp;&amp; x &lt; 215 &amp;&amp; y &gt; 83 &amp;&amp; y &lt; 245) { Toast.makeText(getApplicationContext(), "2", Toast.LENGTH_LONG).show(); } if(x &gt; 306 &amp;&amp; x &lt; 458 &amp;&amp; y &gt; 66 &amp;&amp; y &lt; 212) { Toast.makeText(getApplicationContext(), "3", Toast.LENGTH_LONG).show(); } if(x &gt; 461 &amp;&amp; x &lt; 620 &amp;&amp; y &gt; 9 &amp;&amp; y &lt; 127) { Toast.makeText(getApplicationContext(), "4", Toast.LENGTH_LONG).show(); } } } </code></pre> <p>To tap at certain areas, when I did it on my emulator it worked perfect but when I did it on a different phone It wouldn't work or I would have to tap a bunch of times.</p> <p>What's the best way to tap on a certain areas for different screens</p>
java android
[1, 4]
1,783,055
1,783,056
Memory leack caused by executing "su"
<pre><code>Process process = Runtime.getRuntime().exec("su"); </code></pre> <p>When running above command on <strong>rooted</strong> phone everything works fine</p> <p>But when i try same code on <strong>non-rooted</strong> device its causing memory leak, i can see multiple instances of my app in task manager and they cant bee killed. The more times i run this code memory gets less and less until phone totally freezes and i have to restart</p> <p>This is the exception i get </p> <pre><code>01-24 11:06:56.459: E/App (8307): Error running exec(). Command: [su] Working Directory: null Environment: null </code></pre> <p>Why is this hapening and how can i prevent it?</p>
java android
[1, 4]
2,095,098
2,095,099
delete record in jqgrid in asp.net
<p>i want to delete a record in jqgrid. for this i have the image and when the user clicks on this the record is getting deleted.but i want to show the confirm box and when true then only the record should get deleted. so any one can tell how to call javascript in jqgrid. my jqgrid is jQuery(document).ready(function() { jQuery("#list47").jqGrid({ url: 'AddFilterGrid.aspx?Show=ViewFilter', datatype: "json", id: "FilterName", colNames: ["SubCategory", "Filter", 'Delete','Edit'], colModel: [ { name: 'CategoryName', index: 'CategoryName', width: 150, align: 'left', sortable: true, sorttype: 'text' }, { name: 'FilterName', index: 'FilterName', width: 150, align: 'left', sortable: true, sorttype: 'text' }, </p> <pre><code> { name: 'f', index: 'f', width: 100, align: "center", formatter: 'showlink', formatter: formateadorLinkDelete }, { name: 'FilterId', index: 'FilterId', width: 100, align: "center", formatter: 'showlink', formatter: formateadorLinkEdit }, ], height: 280, width: 650, //autowidth: true, mtype: "GET", pager: '#plist47', rowNum: 10, rowList: [10,20,30,40], repeatitems: false, viewrecords: true, sortname: 'FilterName', viewrecords: true, sortorder: "desc", gridview: true, imgpath: '/Scripts/themes/redmond/images' }); }); </code></pre>
asp.net jquery
[9, 5]
4,892,404
4,892,405
javascript string remove a character at position X and add to start
<p>If I have a string and a number:</p> <pre><code>var str='Thisisabigstring'; var numb=7; </code></pre> <p>I'm trying to remove the character at position <code>'numb'</code> from the string and then put it at the beginning of the string. </p> <p>Trying for output like:</p> <pre><code>'aThisisbigstring'; </code></pre> <p>How can I do this with javascript/jquery?</p>
javascript jquery
[3, 5]
369,556
369,557
Getting window height with jquery
<p>So basically, I want a div called #content to have a css top value of 200px if the browser height is less than 440px. However, this seems to not be working. What am I doing wrong?</p> <pre><code>var boh = $(window).height(); var bohi = parseInt(boh); if(bohi &lt; 440) { $("#content").css("top","200px"); } else { //this part works, so it's hidden } </code></pre>
javascript jquery
[3, 5]
3,371,613
3,371,614
Problem with jQuery mouseleave firing when container has select box
<p>I have a two containers -- one is nested inside of another. When I hover over the parent, I want the child container to appear. When I mouseout, I want the child container to fadeout. The problem I'm having is the child container has a form that contains a "select box". When the user selects the select box -- the mouseleave event is accidentally fired. </p> <p>How can I stop the select box from tripping the mouseleave event?</p> <p>You can see my working code here: <a href="http://jsfiddle.net/rsturim/9TZyh/3/">http://jsfiddle.net/rsturim/9TZyh/3/</a></p> <p>Here's a summary of my script:</p> <pre><code>$('#parent-container').live("mouseenter", function () { var $this = $(this), $selectOptionsContainer = $this.find('#child-container'); $selectOptionsContainer.stop().fadeTo('slow', 1.0); }).live("mouseleave", function (e) { var $this = $(this), $selectOptionsContainer = $this.find('#child-container'); $selectOptionsContainer.stop().hide(); }); </code></pre> <p><strong>edit</strong>: appears fine in WebKit-based browsers. Fails in Firefox and IE7-IE9.</p>
javascript jquery
[3, 5]
5,016,766
5,016,767
Dropdownlist data binding inside detailsview in asp.net
<p>I have detailsview that will be used to edit customer records. Inside this detailsview, I have a dropdownlist that shows list of countries.</p> <p>I have a table called CountryList that will populate list of countries to the above dropdownlist.</p> <p>User can edit and save data without any issue.</p> <p>But, assume that customer record has the country selected as "Australia" and if I delete Australia from the CountryList and try to edit the customer inside the details view, I am getting below error.</p> <pre><code>SelectedValue which is invalid because it does not exist in the list of items </code></pre> <p>I know the reason because the </p> <pre><code>SelectedValue='&lt;%# Bind("Country") %&gt;' </code></pre> <p>and it can't find it in the list.</p> <p>So my question is, how to overcome this issue ? </p> <p>After searching the web, I found that I can override the Databind but I am not sure how to do this. Have no idea how to override and can someone please give me sample code ? </p> <p>Also is there any other solution for this such as validate it before set ? </p> <p>Thank you.</p>
c# asp.net
[0, 9]
575,929
575,930
dynamically create a row of text box and label while click on add button using asp.net
<p>In my Table in Every row I had label and text box.in page load I show 3 text boxes and 3 labels.But When I click Add more button Every click we need create one label and One text box Dynamically...By Using Asp.net ,C#.net please help me I am stuck here.</p>
c# asp.net
[0, 9]
537,945
537,946
how to access parent window object using jquery?
<p>How to acess parent window object using jquery?</p> <p>This is my Parent window variable , I want to set its value after closing child window .</p> <pre><code>$('#serverMsg').html('some text here'); </code></pre>
javascript jquery
[3, 5]
5,971,922
5,971,923
Retrieve size of background image after scaling with jQuery?
<p>I have the following simple code to get me the background-image dimensions, but it grabs the size of the original image, not the scaled one I have in my div. I want to get pixel dimensions after scaling, is there any way to do that?</p> <pre><code>var actualImage = new Image(); actualImage.src = $("#chBox").css('background-image').replace(/"/g, "").replace(/url\(|\)$/ig, ""); actualImage.onload = function () { width = this.width; height = this.height; } </code></pre> <p>EDIT:</p> <p>The CSS to scale the background-image:</p> <pre><code>#chBox { height:100%; width:100%; background-repeat:no-repeat; background-image: url(../content/frog/1.jpg); background-position: center; -webkit-background-size: contain; /*for webKit*/ -moz-background-size: contain; /*Mozilla*/ -o-background-size: contain; /*opera*/ background-size: contain; /*generic*/ } </code></pre>
javascript jquery
[3, 5]
3,158,161
3,158,162
change src image onload
<p>script:</p> <pre><code> function SetProductImageLeft (img,idProduct){ var address="Image/ProductImage/"+id+".png"; $(img).attr('src', address); } </code></pre> <p>html:</p> <pre><code>&lt;img onclick="alert();SetProductImageLeft(this,1);" onload="alert();SetProductImageLeft(this,1);" &gt; &lt;img onclick="alert();SetProductImageLeft(this,2);" onload="alert();SetProductImageLeft(this,2);" &gt; &lt;img onclick="alert();SetProductImageLeft(this,3);" onload="alert();SetProductImageLeft(this,3);" &gt; </code></pre> <p>onclick show alert(); and run function success but onLoad does not show alert(); and function;</p> <p>i like show image when page load.set images in onload</p>
php javascript jquery asp.net
[2, 3, 5, 9]
2,901,673
2,901,674
JQuery not removing added element
<p>What I want to do is add and remove list items. I have got it to add new items to the list and I can remove existing ones but not the ones that have been added. It seem like it would work but it doesn't. Any help would be appreciated! Here the code: </p> <p><strong>JQuery:</strong></p> <pre><code>&lt;script type="text/javascript"&gt; $(function(){ $('a#add').click(function(){ $('&lt;li&gt;&lt;a href="#" id="remove"&gt;--&lt;/a&gt;List item&lt;/li&gt;').appendTo('ul#list'); }); $('a#remove').click(function(){ $(this).parent().remove(); }); }); &lt;/script&gt; </code></pre> <p><strong>HTML:</strong></p> <pre><code>&lt;a href="#" id="add"&gt;Add List Item&lt;/a&gt; &lt;ul id="list"&gt; &lt;li&gt;&lt;a href="#" id="remove"&gt;--&lt;/a&gt; List item&lt;/li&gt; &lt;li&gt;&lt;a href="#" id="remove"&gt;--&lt;/a&gt; List item&lt;/li&gt; &lt;li&gt;&lt;a href="#" id="remove"&gt;--&lt;/a&gt; List item&lt;/li&gt; &lt;li&gt;&lt;a href="#" id="remove"&gt;--&lt;/a&gt; List item&lt;/li&gt; &lt;/ul&gt; </code></pre>
javascript jquery
[3, 5]
1,632,545
1,632,546
Automatically check checbox when submitting a form
<p>I have a form with a check box and a submit button. I would like the checkbox to be checked automatically when I submit the form.</p> <p>How can I do that with jquery or javascript?</p>
javascript jquery
[3, 5]
4,058,266
4,058,267
ProgressDialog not responding
<p>Hello guys why when i add ProgressDialog it become not responding</p> <pre><code> ProgressDialog dialog = ProgressDialog.show(AppsInspectorActivity.this, "", "Scanning package " + pkgInfo.packageName, true); dialog.setCancelable(true); dialog.show(); </code></pre> <p>at above <code>Log.v(TAG, "Scanning package " + pkgInfo.packageName);</code></p> <pre><code>private List&lt;PackageInfo&gt; getAdPackages() { </code></pre> <p>[HEAVY STUFF]</p> <pre><code> return new ArrayList&lt;PackageInfo&gt;(adPackages); } </code></pre> <p>}</p>
java android
[1, 4]
4,668,957
4,668,958
jquery delay only works on one element
<p>Im trying to fade in 3 divs all at the same time. They all have same class .box but only the first on fades in?</p> <p>CSS:</p> <pre><code>.box{display:none} </code></pre> <p>JS:</p> <pre><code>$(".box").delay(1800).fadeIn(1000); </code></pre> <p>HTML:</p> <pre><code>&lt;div class="box"&gt;ONE&lt;/div&gt; &lt;div class="box"&gt;TWO&lt;/div&gt; &lt;div class="box"&gt;THREE&lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
2,606,883
2,606,884
Accessing child elements in jquery
<pre><code>&lt;div id="main"&gt; &lt;div id="1"&gt; &lt;div&gt;contents..&lt;/div&gt; &lt;div&gt;contents..&lt;/div&gt; &lt;/div&gt; &lt;div id="2"&gt; &lt;div&gt;contents..&lt;/div&gt; &lt;div&gt;contents..&lt;/div&gt; &lt;/div&gt; &lt;div id="3"&gt; &lt;div&gt;contents..&lt;/div&gt; &lt;div&gt;contents..&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>How can i access all <code>div object</code> into a single array who have <code>contents in there innerHTML</code>?</p> <p><strong>EDIT</strong></p> <p>OK I tried this :</p> <pre><code>var totaldiv = $("#main").children(); var totalElements = []; var c = 0; $.each(totaldiv, function (i, v) { $(totaldiv[i]).children().each(function () { totalElements[c++] = $(this); }); }); </code></pre> <p>Is there any more efficient way to do this?</p>
javascript jquery
[3, 5]
1,886,182
1,886,183
Response is not available in this context?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/8586201/response-is-not-available-in-context-how-to-solve-it">Response is not available in context? How to solve it?</a> </p> </blockquote> <p>I want to sent a pdf file to client as attachement. I try to use Response object to achieve it. But come up with error.</p> <pre><code>Response.Buffer = false; Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); //Set the appropriate ContentType. Response.AppendHeader("Content-Disposition", "attachment; filename="+Server.MapPath(@".\test.pdf")); Response.ContentType = "Application/pdf"; //Write the pdfStream into Response Response.BinaryWrite(pdfData); Response.Flush(); Response.End(); </code></pre> <p>But always throw the "Response is not available in this context". If anyone can help me?</p> <p>PS:I save a pdf file as stream(pdfData).</p> <p>Thanks in advance.</p>
c# asp.net
[0, 9]
5,957,297
5,957,298
code of website which can create user page after sign up in asp.net 4.0
<p>I am making a website which can have members page. That is when a new member sign up a new page get generated where he can update his information just like Facebook.</p> <p>I want the code just like facebook where user gets registered and a new profile page is generated and when that same member log in other time he simply gets to that page which is his costume page (profile) just like Facebook.</p>
c# php asp.net
[0, 2, 9]
433,055
433,056
How to pass javascript object from one page to other
<p>I want to pass javascript object from one page to other page so anyone can tell me how to do it?</p> <p>Is that possible to do so using jQuery?</p>
javascript jquery
[3, 5]
2,062,982
2,062,983
fadeOut -> fadeIn doesn't work properly
<p>JS code:</p> <pre><code>var forma = $('form#mali_oglas'), pomoc = $('div[role=pomoc]'), div = $('.mali_oglas_pomoc'), input = forma.find('input, textarea'); input.on('click', function(){ var name = $(':input:focus').attr("name") pomoc.fadeOut('fast', function(){ div.find("[data-pomoc='" + name + "']").fadeIn('slow'); console.log(name); }); }); </code></pre> <p>HTML code:</p> <pre><code>&lt;div class="mali_oglas_pomoc"&gt; &lt;div data-pomoc="name" role="pomoc"&gt; 1Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi pretium, urna nec varius sollicitudin, erat urna accumsan sapien, vel interdum enim risus id mi. Class aptent taciti sociosqu ad litora. &lt;/div&gt; &lt;div data-pomoc="body" role="pomoc"&gt; 2Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi pretium, urna nec varius sollicitudin, erat urna accumsan sapien, vel interdum enim risus id mi. Class aptent taciti sociosqu ad litora. &lt;/div&gt;..... &lt;/div&gt; </code></pre> <p>CSS for the div in question:</p> <pre><code>div[role="pomoc"] {position: absolute; top: 45px; right: 0;width: 250px; display: none} div[role="pomoc"]:first-child {display: block} </code></pre> <p>It is working, but a bit strange. First it is applying <strong>display block</strong> to the targeted div, then fading it out and fading in. What is going on?</p> <p>Link: <a href="http://jsfiddle.net/AY2B3/" rel="nofollow">http://jsfiddle.net/AY2B3/</a></p>
javascript jquery
[3, 5]
138,040
138,041
Adjusting jQuery script to add height to parent element
<p>I'm using Soh Tanaka's script to toggle open and closed div content in the accordion style.</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; $(document).ready(function(){ //Hide (Collapse) the toggle containers on load $(".toggle_container").hide(); //Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state) $("h3.trigger").click(function(){ $(this).toggleClass("active").next().slideToggle("slow"); return false; //Prevent the browser jump to the link anchor }); }); &lt;/script&gt; </code></pre> <p>I'm trying to adapt this script so that the toggle also adds an increase of 50px to the height of a container div with the id of #join_find_talk. Help, please... </p> <p>You can see it in action here: <a href="http://www.snakeandherring.com.au/join/" rel="nofollow">http://www.snakeandherring.com.au/join/</a></p>
javascript jquery
[3, 5]
2,806,630
2,806,631
Save Canvas image (Post the data string to PHP)
<p>I'm looking to learn Javascript and have been wanting to for a while, I got a little tutorial on how to create a HTML5 Canvas drawing application, I'm trying to modify it so I can save the image to my MySQL database. So far, the code below simply redirects to my PHP file and does have the code I'd like, but it's a little big so I was wondering if there was a way to reduce that or possibly even _POST it to the PHP script.</p> <pre><code> saveAsPNG : function(oCanvas, bReturnImg, iWidth, iHeight) { if (!bHasDataURL) { return false; } var oScaledCanvas = scaleCanvas(oCanvas, iWidth, iHeight); var strData = oScaledCanvas.toDataURL("image/png"); window.location.href = "http://localhost/save_server/?image=" + strData; if (bReturnImg) { return makeImageObject(strData); } else { saveFile(strData.replace("image/png", strDownloadMime)); } return true; }, </code></pre> <p>I'm using window.location.href to send the data. Any help would be appreciated. The URL which it currently gives is...</p> <p>localhost/save_server/?image=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4EAAAIUCAYAAACkdimIAAAgAElEQVR4Xu3XQQEAAAgCMelf2iA3GzD8sHMECBAgQIAAAQIECB... You know what? It is so big, I'm not even going to post it here.</p> <p>Thanks for any help in advance!</p>
php javascript
[2, 3]
6,016,482
6,016,483
jQuery document.ready vs pageLoad
<p>I've picked up an existing project from another developer and ive noticed in the code that they are executing js code within three different event handlers...</p> <pre><code>function pageLoad() { //execute code } $(document).ready(function() { //execute code }); $(function() { //execute code }); </code></pre> <p>My question is - arent they all exactly the same? Or at least the last two? I understand that pageLoad is called by the .NET framework so it's not dependent on the jQuery library having loaded like the second two are - that's my understanding anyway - is that about correct?</p>
javascript jquery
[3, 5]
5,798,695
5,798,696
How to Add File Upload Control in TableCell using C#
<p>I am creating the grid view in code behind using TableCell and GridViewRow</p> <p>The data is fetched from the database table.</p> <p>My code is : </p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; public partial class gv1 : System.Web.UI.Page { SqlConnection cn; SqlCommand cmd; DataSet ds; SqlDataAdapter da; protected void Page_Load(object sender, EventArgs e) { cn = new SqlConnection("Data Source=AMIR-PC\\MOHEMMAD;Initial Catalog=CRM_InvestPlus;Integrated Security=True"); } protected void Button1_Click(object sender, EventArgs e) { cn.Open(); cmd = new SqlCommand("Select * from Customer_Master", cn); da = new SqlDataAdapter(cmd); ds = new DataSet(); da.Fill(ds); cn.Close(); GridView gr1 = new GridView(); Table t = new Table(); gr1.Controls.Add(t); for (int i = 0; i &lt; 6; i++) { GridViewRow row = new GridViewRow(i, i, DataControlRowType.DataRow, DataControlRowState.Normal); TableCell cell1 = new TableCell(); TableCell cell2 = new TableCell(); TableCell cell3 = new TableCell(); cell1.Text = ds.Tables[0].Rows[i][0].ToString(); cell2.Text = ds.Tables[0].Rows[i][1].ToString(); cell3.Text = ds.Tables[0].Rows[i][2].ToString(); row.Cells.Add(cell1); row.Cells.Add(cell2); row.Cells.Add(cell3); gr1.Controls[0].Controls.AddAt(i, row); } form1.Controls.Add(gr1); } } </code></pre> <p>The Gridview is generated fine. But my problem is to display the FileUploadControl in the place of Cell3(i.e. I want to place the FileUploadControl in Cell3) </p> <p>Please help.. </p> <p>Thanks in advance...</p>
c# asp.net
[0, 9]
3,320,373
3,320,374
ASP.NET relative path
<p>I have an ASP.NET project I'm currently working on. There is a C# file (dbedit.cs) that is used to directly access and edit 2 XML database files. How can I create a relative path of the XML files (both in the same directory) to dbedit.cs? It needs to be portable so it can't be hard-coded in. dbedit.cs is also accessed from two other projects that are in the same solution, so the assembly path of dbedit.cs is different depending on which project is accessing it.</p> <p>This doesn't work for that reason:</p> <pre><code>(new System.Uri(Path.GetDirectoryName(Assembly.GetAssembly(typeof(dbedit)).CodeBase))).LocalPath; </code></pre> <p>Any help would be greatly appreciated.</p>
c# asp.net
[0, 9]
1,085,423
1,085,424
JQuery DIalog and ASP.NET Repeater
<p>I have an ASP.NET repeater that shows a list of items with a delete LinkButton.</p> <p>I want to setup the Delete LinkButtons to show a JQuery Dialog for a confirmation. If the "OK" button is clicked, I want to do the postback.</p> <p>The obvious problem is that each LinkButton in the repeater will have it's own ID and I don't want to have to duplicate all the javascript for the dialog.</p> <p>Suggestions ? </p>
asp.net javascript jquery
[9, 3, 5]
730,086
730,087
List view row pressed
<p>I have a list view with couple of items and i set this function get call when a row in the list view is clicked.</p> <p>I want to open new activity and send him an object from an array of objects. I have a problem with this line :</p> <pre><code>Intent i = new Intent(this, Item_Activity.class); </code></pre> <p>because the <code>this</code> is now no the activity.</p> <p>this is the code:</p> <pre><code>lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position, long arg3) { Intent i = new Intent(this, Item_Activity.class); Item item = m_items.get(position); i.putExtra("object", item); startActivity(i); } }); </code></pre>
java android
[1, 4]
761,424
761,425
JavaScript rollover image gallery not working in Chrome or IE
<p>I set up a small image gallery that functions with JavaScript Rollovers. I have also added a bit of jquery to augment the images. My problem is that everything works perfectly in Firefox, but not in IE or Chrome. Everything will display in IE and Chrome, but when you click on a thumbnail, the large image won't populate.</p> <p>Current page code:</p> <pre><code>&lt;a href="#" onmouseup = "window.document.gallery.src = 'images/Gallery/Landscapes_Album/slides/Tern Lake Sunset.jpg'"&gt; &lt;img src="images/Gallery/Landscapes_Album/thumbs/Tern Lake Sunset.jpg" width="80" height="80" class="gallery-thumb" id="In"/&gt;&lt;/a&gt; </code></pre> <p>Current jquery code:</p> <pre><code>// jQuery fade-in and fade-out $(function() { // OPACITY OF BUTTON SET TO 50% $(".gallery-thumb").css("opacity","0.5"); // ON MOUSE OVER $(".gallery-thumb").hover(function () { // SET OPACITY TO 100% $(this).stop().animate({ opacity: 1.0 }, "slow"); }, // ON MOUSE OUT function () { // SET OPACITY BACK TO 50% $(this).stop().animate({ opacity: 0.5 }, "slow"); }); }); </code></pre>
javascript jquery
[3, 5]
2,865,677
2,865,678
how do listeners in java work
<p>I would like to know if it is possible to create a listener to a listener. For example if I have a listener for a button, can I create a listener to that listener such that once the button is pressed the listener of the button listener would be notified.</p> <p>My other concern is if I have a function call which has some listeners inside it would these listeners be destroyed on the return of the function call. For example can I have a function that I call in the beginning of the program that has listeners to listeners from my main program?</p>
java android
[1, 4]
2,664,844
2,664,845
how to get value of a #t=querystring in asp.net?
<p>I use Request.QueryString["var"] to pull the value of <a href="http://test.com/test.aspx?var=test" rel="nofollow">http://test.com/test.aspx?var=test</a> into a string</p> <p>the same thing doesn't work for test.aspx#var=test</p> <p>how can I get it from that version of a querystring?</p>
c# asp.net
[0, 9]
5,699,818
5,699,819
How can I detect when the user is leaving my site, not just going to a different page?
<p>I have a handler for onbeforeunload</p> <pre><code>window.onbeforeunload = unloadMess; function unloadMess(){ var conf = confirm("Wait! Before you go, please share your stories or experiences on the message forum."); if(conf){ window.location.href = "http://www.domain.com/message-forum"; } } </code></pre> <p>but I'm not sure how to know if the url they clicked on the page is within the site.</p> <p>I just want them to alert them if they will leave the site.</p>
javascript jquery
[3, 5]
4,589,288
4,589,289
Random colored Text jquery
<p>I want to type a block of text into a div and have every word separated by a space, and/or comma be a different color of the rainbow, except for black or white. How would I do this?</p>
javascript jquery
[3, 5]
4,132,841
4,132,842
Android Add 7.5 hours to a specific date
<p>In my Android application, I have 3 spinners for Hour/Minute/ and PM or AM. I'd like to add 7.5 hours in that to get the needed time for the user to sleep. This android application of mine is a calculator of a user's sleep. For example, I'd like to wake up at 7:00 AM. BY 11:15 PM you should now be sleeping. Please give me some directions on how to do this. I'm in dire need of help. Thanks. Appreciate your help.</p> <p>like this: </p> <pre><code> /** * Get sleeping times corresponding to a local time * * @param wakingTime * time to wake up ! * @return list of times one should go to bed to */ public static Set&lt;Date&gt; getSleepingTimes(Date wakingTime) { Set&lt;Date&gt; result = new TreeSet&lt;Date&gt;(); Calendar calendar = Calendar.getInstance(); calendar.setTime( wakingTime ); calendar.add( Calendar.MINUTE, -14 ); calendar.add( Calendar.MINUTE, -( 2 * 90 ) ); for ( int i = 3; i &lt;= 6; i++ ) { calendar.add( Calendar.MINUTE, -90 ); result.add( calendar.getTime() ); } return result; } // end of getSleepingTimes method </code></pre>
java android
[1, 4]
381,476
381,477
Writing in files ASP.NET C# and NOT locking them afterwards
<p>I am getting this error: The process cannot access the file (...) because it is being used by another process. I have tried to use <code>File.WriteAllText</code>; </p> <pre><code>StreamWriter sw = new StreamWriter(myfilepath); sw.Write(mystring); sw.Close(); sw.Dispose(); </code></pre> <p>;</p> <pre><code>using (FileStream fstr = File.Create(myfilepath)) { StreamWriter sw = new StreamWriter(myfilepath); sw.Write(mystring); sw.Close(); sw.Dispose(); fstr.Close(); } </code></pre> <p>All I am trying to do is to access a file, write on it, then close it. I might be making a silly mistake but I would like to understand what I am doing wrong and why. How to make sure that the file is closed and not to cause this error again.</p> <p>Helped by the answers so far I did this:</p> <pre><code>using (FileStream fstr = File.Open(myfilepath,FileMode.OpenOrCreate,FileAccess.ReadWrite)) { StreamWriter sw = new StreamWriter(fstr); sw.Write(mystring); sw.Close(); } </code></pre> <p>It seems to be better because it seems to close/stop the process of my file if I try to access another file on the second time I access the page. But if I try to access the same file on a second time, it gives me the error again.</p>
c# asp.net
[0, 9]
2,132,795
2,132,796
How do i get domain url without using httpcontext.current
<p>How do i get domain url without using httpcontext.current because i am using global.asax directly there is no way to have an access current context</p>
c# asp.net
[0, 9]
3,028,499
3,028,500
Gridview template Javascript databinding
<p>I have a gridview. I want to bind something like:</p> <pre><code>&lt;asp:TemplateField //stuff&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lblEx" runat="server" text='&lt;%# SomeJavascriptFunction( Eval("BOUND_FIELD_FROM_DB") ) %&gt;' &gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre> <p>This exact syntax doesn't appear to be working - it's telling me the function isn't declared (it is). I'm thinking it's looking for SomeJavascriptFunction() in the code-behind. Is there some way to make this work?</p> <p>I can't seem to find the correct verbiage in my searches - results all seem to be regarding binding a gridview through javascript, which is not exactly correct.</p> <p><strong>EDIT:</strong></p> <p>I do have a code-behind version implemented and working - I'd just like to take the processing load off the server.</p>
javascript asp.net
[3, 9]
4,182,819
4,182,820
How to show popup window when cookie expires using forms authentication in asp.net
<p>I have to redirect to another page in another application. How to show popup window when cookie expires using forms authentication in asp.net so that before redirect to another page. i.e. In which http: module should I inject logic as cookie is expired and redirect to another application page.</p> <p>Thanks in advance.</p>
c# asp.net
[0, 9]
407,737
407,738
foreach statement (get string values)
<p>Can someone please help me out? My code for splitting the strings is working however, i still need to use the splitted string my page. How can i achieve this? Here's my current code</p> <pre><code> private void SplitStrings() { List&lt;string&gt; listvalues = new List&lt;string&gt;(); listvalues = (List&lt;string&gt;)Session["mylist"]; string[] strvalues = listvalues.ToArray(); if (listvalues != null) { foreach (string strElement in listvalues) { string[] prods = strElement.ToString().Split("|".ToCharArray()); string prodName = prods[0].ToString(); Response.Write(prodName); } } } </code></pre> <p><a href="http://i46.tinypic.com/11b18ol.jpg" rel="nofollow">link text</a></p> <p>how can i replace the response.write with any label or literal? when i tried to use a literal on the code it displays one single string not all of the strings that's been splitted.</p> <p>any ideas?</p>
c# asp.net
[0, 9]
1,874,314
1,874,315
HttpHandler not rewriting
<p>I am writing a simple HttpHandler for URL rewriting, but I'm hitting a brick wall.</p> <p>I have created a HttpHandler class that's really simple just to test things:</p> <pre><code>public class HttpHandler : IHttpHandler { public void ProcessRequest(HttpContext context) { context.RewritePath("default.aspx", false); //Rewriter.Rewrite(context); } public bool IsReusable { get { return true; } } } </code></pre> <p>I then have the following verb in the web.config:</p> <pre><code>&lt;httpHandlers&gt; &lt;add verb="*" path="*" type="Tizma.CMS.Runtime.HttpHandler"/&gt; &lt;/httpHandlers&gt; </code></pre> <p>I basically want all incoming URL's to go through this rewritter. When I run this, ProcessRequest fires, but the RewritePath never gets to default.aspx.</p> <p>Please bare in mind this is just a test and eventually default.aspx will be passed a query string along the lines of ?pageid=2 I just wanted to figure out how httphandlers worked first.</p> <p>What am I doing wrong?</p>
c# asp.net
[0, 9]
2,207,299
2,207,300
Validation with specfic input types generated from an XML
<p>I am in the midst of trying to come up with the best way for some validation within a generic MVC based XML which outputs the following.</p> <pre><code>&lt;input name="xxxx" value="xxxx" ValidationType="Email" IsRequired="True" /&gt; </code></pre> <p>Basically if things contain certain elements, we validate it, if it's required than we do, if not, we don't etc etc. I tried some things but it seems the best way to do this would be a the JQuery "contains" method. I also know that that "ValidationType" is not really a valid attribute of input, but the XML outputs it this way. Any feedback would be appreciated. Thanks. I'm trying to do this as non complicated as possible :)</p>
javascript jquery
[3, 5]
2,778,448
2,778,449
Program for printing
<p>I want to write a program for printing stuff on a paper, roughly what commands or classes do i need to use in c++ or php to get me started ?</p>
php c++
[2, 6]
433,879
433,880
detecting a user-modified vs a js-modified input value
<p>I have 1 input that requires two different type of methods to be called when the input value is changed 1st by javascript and 2nd by the user. </p> <p>Any clues on how I could differentiate these types of changes to the input?</p>
javascript jquery
[3, 5]
3,696,189
3,696,190
when do you need to use $(document).ready()?
<p>I'm curious what situations exactly require the use of jquery's $(document).ready() or prototype's dom:loaded or any other variant of a handler for this event.</p> <p>In all the browsers i've tested, it's entirely acceptable to begin interacting with html elements and the DOM immediately after the closing tag. (e.g.</p> <pre><code>&lt;div id="myID"&gt; My Div &lt;/div&gt; &lt;script type="text/javascript"&gt; $('#myID').initializeElement(); &lt;/script&gt; </code></pre> <p>So at this point i'm wondering whether $(document).ready() is merely there to reduce the thinking involved in writing javascript code that runs during page load. In the case of using $(doucment).ready() there is regularly rendering issues such as popping and 'artifacts' between the browser first starting to draw the page and the javascript actually executing when the page is 'ready'.</p> <p>Are there any scenarios where $(document).ready() is required?</p> <p>Are there any reasons I shouldn't be writing initialization scripts as demonstrated?</p>
javascript jquery
[3, 5]
4,722,882
4,722,883
Where to keep a querystring parameter in session?
<p>Users will get to my site using a specific parameter, e.g. : <a href="http://www.mysite.com/whatever/?keepTrackOfThisValue=foo" rel="nofollow">http://www.mysite.com/whatever/?keepTrackOfThisValue=foo</a> or <a href="http://www.mysite.com/who/cares/?keepTrackOfThisValue=bar" rel="nofollow">http://www.mysite.com/who/cares/?keepTrackOfThisValue=bar</a></p> <p>I would like to store the value of this peculiar parameter in Session everytime I found it in the QueryString. I'm currently using the Session_Start event in Global.asax in order to store this but I would like to override the value each time the parameter value change, which is not possible my way.</p> <p>Where would you do this ?</p>
c# asp.net
[0, 9]
3,902,979
3,902,980
if statement in gridview template filed
<p>I have a gridview. its data source is a datatable that is loaded from the database. In this gridview, i have a template column. The content of this column is not directly pulled from the database but instead, i use the id of the current item to make a name and look for that name in a directory of images. The template field is:</p> <pre><code>&lt;asp:TemplateField&gt; &lt;itemtemplate&gt; &lt;img src='../user/images/&lt;% =itemType %&gt;&lt;%# DataBinder.Eval(Container.DataItem, "id") %&gt;.jpg?' alt='&lt;%# DataBinder.Eval(Container.DataItem, "Title") %&gt;' /&gt; &lt;/itemtemplate&gt; &lt;/asp:TemplateField&gt; </code></pre> <p>Not all the items have images so I would like to check if this file exists. If it does, I'd like to use the above code to place it, if it doesn't i'd like to leave the field empty. In the .cs file this is a matter of an if statement with the condition set to File.Exist(). But I could not find the syntax to do it in the .aspx file. Is this possible and if so how? Thanks.</p>
c# asp.net
[0, 9]
3,646,986
3,646,987
How to load parsed aspx into string variable
<p>I am attempting to load a parsed aspx file into a string. The reason for this is because I have a page with a fair amount of html on it which also has sections that need to be processed in order to insert the correct information. This page then needs to be displayed as a confirmation page as well sent in a confirmation email when the user submits a form.</p> <p>Displaying the confirmation page is simple enough, but my idea to prevent code duplication is to render the aspx file to a string variable to use as the content of the email as well.</p> <p>I realize that I could add all the content as a huge multi-line string and load it onto the aspx page, and then into the email, but this solution feels messy to me and will require an application re-compile should I ever want to change the content.</p> <p>Perhaps somebody can suggest a better way to achieve what I am attempting?</p> <p>The code I have come up with is below, but I am nit sure if it is possible to somehow catch the output from ProcessRequest before it gets sent to the browser:</p> <pre><code>IHttpHandler handler = PageParser.GetCompiledPageInstance("/SubmitConfirmation.aspx?appid=" + this.Id, "SubmitConfirmation.aspx", HttpContext.Current); handler.ProcessRequest(HttpContext.Current); string str_out = ???; </code></pre> <p>Basically what I am trying to achieve is the same as the following PHP code would do:</p> <pre><code>&lt;?php ob_start(); include("SubmitConfirmation.php"); $str_out = ob_get_contents(); ob_end_clean(); ?&gt; </code></pre> <p>Any suggestions are welcome.</p>
c# asp.net
[0, 9]
4,877,123
4,877,124
Get link if user selected text is contained within a link
<p>Okay, so I am trying to figure out how to get a link href if the user has highlightened text is contained within a text...</p> <p>So for example if the following is a link</p> <pre><code>&lt;a href="http://www.google.com"&gt;Find us on Google&lt;/a&gt; </code></pre> <p>and the user hightlights the text "Google"</p> <pre><code>&lt;a href="http://www.google.com"&gt;Find us on Google&lt;/a&gt; </code></pre> <p>So the question is: After the user highlights text (as in to copy and paste it) they well hit a button and it will return what the link is for the selected text.</p> <p>I hope I made this clear, wasn't really sure how to phrase it.</p>
javascript jquery
[3, 5]
23,094
23,095
How to get document height and width without using jquery
<p>How to get document height and width in pure javascript i.e without using jquery. I know about $(document).height() and $(document).width(), but i want to do this in javascript.</p> <p>I meant page's height and width.</p>
javascript jquery
[3, 5]
5,601,376
5,601,377
HtmlEncode List<string> values
<p>I have cell values saved in List like this</p> <pre><code>public List&lt;string&gt; Cell { get; set; } </code></pre> <p>I want do htmlEncode to each value of this list. can anyone help me with this??</p>
c# asp.net
[0, 9]
5,085,496
5,085,497
How do I find out the first digit of a textbox value in asp.net/javascript?
<p>I would like to find the first digit of the value in a textbox in order to execute some conditional code. I can get the textbox by using getElementById, and would like to execute my code if the first digit contained within the textbox is 7, 8, or 9.</p> <p>How can I test to see if the first digit of my textbox is between 7 and 9?</p>
asp.net javascript
[9, 3]
2,903,732
2,903,733
jQuery to Select elements that does not contain a certain value
<p>I am using the following jQuery code to count the number of text fields that have a value that is the same as its title attribute.</p> <pre><code>$(".textfield").val( $(".textfield").attr('title') ).size(); </code></pre> <p><strong>Problem:</strong> How do I count the number of text fields that <strong>do not</strong> have a value equal to its title attribute?</p>
javascript jquery
[3, 5]
1,737,561
1,737,562
Create audio tag in html4 issue
<p>I am trying to create audio tag in html4.</p> <p>I have</p> <pre><code>var audioPlayer=document.createElement('audio'); var audioSource=document.createElement('source'); audioSource.src=audioFileName; audioSource.type="type='audio/mp3'"; audioPlayer.appendChild(audioSource); audioPlayer.width=320; audioPlayer.className='text_audio'; audioPlayer.id='audio_id'; audioPlayer.style.margin=0; audioPlayer.controls='controls'; $('div').append(audioPlayer); </code></pre> <p>I can see the control bar but it has trouble playing my mp3 file. Are there anyways to do this in Html4?</p> <p>Thanks a lot!</p>
javascript jquery
[3, 5]
824,032
824,033
remove classes added by Jquery
<p>I am working on an accordion and Jquery is adding classes, I want to stop jquery to add some classes. how can I do that? Below is the code but Jquery keeps on adding .ui-state-default to some visited elements.</p> <pre><code>if($check.hasClass('.ui-state-default')){ $(this)('.columns &gt; span').removeClass('ui-state-default'); $(this)('.columns &gt; span').addClass('ui-state-active'); }else { $(this)('.columns &gt; span').removeClass('ui-state-active'); $(this)('.columns &gt; span').addClass('ui-state-default'); } </code></pre>
javascript jquery
[3, 5]
2,982,072
2,982,073
Android: Two ScaleAnimations performed sequentially
<p>I want to animate a scale an ImageView vertically, wait, then perform another scale on the same ImageView. I've simplified the code below but it's essentially what I want to do:</p> <pre><code>ScaleAnimation animate = new ScaleAnimation(1,1,1,2); animate.setDuration(1000); animate.fillAfter(true); ScaleAnimation animateAgain = new ScaleAnimation(1,1,2,1); animate.setDuration(1000); animate.fillAfter(true); view.startAnimation(animate); view.startAnimation(animateAgain); </code></pre> <p>I've tried multiple ways of waiting for the first animation to finish (Thread.sleep etc.) but it doesn't seem to make any difference. I assume the animation is rendered in the onDraw method or something? I'm not entirely sure how scale animations work so I can't really grasp how to solve my problem.</p> <p>What's the simplest way of doing what I want to accomplish?</p> <p>Thanks guys :)</p>
java android
[1, 4]
3,204,724
3,204,725
Scroll images over and over again without having to click the next or previous button
<pre><code>&lt;script&gt; $(document).ready(function () { var speed = 600; $('#navPrev').click(function () { $('#carouselul').animate({ marginLeft: '-280px' }, speed); }); $('#navNext').click(function () { $('#carousel ul').animate({ marginLeft: '1px' }, speed); }); }); $('#carousel ul').toggle( function() { $('#drop').hide('drop', { direction: 'right' }, 1000); }, function() { $('#drop').show('drop', { direction: 'down' }, 500); } ); &lt;/script&gt; &lt;style type="text/css"&gt; #container {height:100px; width:500px; font-family:Tahoma;} #carousel { height:100px; width:500px; border:1px solid #000; overflow:hidden;} #carousel ul { list-style-type:none;margin-top:4px; width:2000px; margin- left:0; left:0; padding-left:1px;} #carousel li { display:inline;} #carousel ul li img{ width:90px; height:90px; border:1px solid #ccc; float:left; } #navPrev {float:left;} #navNext {float:right;} &lt;/style&gt; </code></pre> <p>Hopefully, it's complete now.</p>
javascript jquery
[3, 5]
3,859,819
3,859,820
Why is $ undefined when jQuery is loaded?
<p>I have this in the head of a page:</p> <pre><code>&lt;script type="text/javascript" src="scripts/jquery-1.9.1.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function () { $("#ListBoxSegment").change(function () { GetAccountOpportunityTypes($(this).val()); }); $("#ListBoxType").change(function () { GetNumberOfContacts(); }); }); </code></pre> <p>Running the page gives this error:</p> <pre><code>0x800a1391 - Microsoft JScript runtime error: '$' is undefined </code></pre> <p>Why is $ undefined when jQuery is loaded in the line above?</p> <p>IT WAS FIXED BY LOADING FROM THE URL: </p> <pre><code> &lt;script src="http://code.jquery.com/jquery-1.9.1.min.js"&gt;&lt;/script&gt; </code></pre> <p>But still a little strange that it wouldn't load from local.</p>
javascript jquery
[3, 5]
932,129
932,130
Using unbind, I receive a Javascript TypeError: Object function has no method 'split'
<p>I've written this code for a friend. The idea is he can add a "default" class to his textboxes, so that the default value will be grayed out, and then when he clicks it, it'll disappear, the text will return to its normal color, and then clicking a second time won't clear it:</p> <pre><code>$(document).ready(function() { var textbox_click_handler = function clear_textbox() { $(this).removeClass('default'); $(this).attr('value', ''); $(this).unbind(textbox_click_handler); }; $(".default").mouseup(textbox_click_handler); }); </code></pre> <p>The clicking-to-clear works, but I get the following error:</p> <pre> Uncaught TypeError: Object function clear_textbox() { ... } has no method 'split' </pre> <p>what is causing this? How can I fix it? I would just add an anonymous function in the mouseup event, but I'm not sure how I would then unbind it -- I could just unbind everything, but I don't know if he'll want to add more functionality to it (probably not, but hey, he might want a little popup message to appear when certain textboxes are clicked, or something).</p> <p>How can I fix it? What is the 'split' method for? I'm guessing it has to do with the <code>unbind</code> function, since the clearing works, but clicking a second time still clears it.</p>
javascript jquery
[3, 5]
2,500,381
2,500,382
Deserialize javascript objects to generic list in c# handler
<p>Im creating some javascript items in a loop</p> <pre><code>var licenseList = {}; $($licenses).each(function (index) { var license = {}; var editedValues = {}; license.PRODUCT_KEY = $(this).parent('div.licensewrapper').data('productkey'); $(this).find('input:text').each(function (i, val) { if ($(val).attr('data-default-value') != $(val).val() &amp;&amp; $(val).val() &gt; 0 &amp;&amp; $(val).data('isValid') != false) { var pogKey = $(val).data('product_option_group_key'); var editedValue = $(val).val(); editedValues[pogKey] = editedValue; license.editedValues = editedValues; } }); //licenseList[index] = license; //liceneList.push(license); //if array... }); </code></pre> <p>I've commented out my current solutions. But i dont think any of the two are equal to a generic list when derelializing them in c#. Whats the corrent way to do it in this case? Thanks</p>
c# javascript jquery asp.net
[0, 3, 5, 9]
3,388,020
3,388,021
Repeter With multiple data source of type class
<p>Hi I have 5 different classes. And using single repeater I want to populate the each class data without writing any data binding code except assigning DataSource and DataBinding. the header values should be populated based upon the class members. I think I can use reflection. But I need clear idea. And if i use reflection, is there a possibility of violating security. </p>
c# asp.net
[0, 9]
3,639,081
3,639,082
Is there a way where I can hold all potential arguments in an array?
<p>Hey again (on a roll today).</p> <p>In jQuery/Javascript is there a way of effectively having this:</p> <pre><code>var myArray = [ 'zero', 'one', 'two', 'three', 'four', 'five' ]; //get input from user if (inputFromUser == anythingInArray) { alert("it's possible!); } </code></pre>
javascript jquery
[3, 5]
5,097,233
5,097,234
How to check if value from a cell in a column is !=NULL?
<p>I'm trying on gridview updated to check if a cell from a certain column is != NULL ( to check if the user wrote something into the cell)</p> <p>My problem is I don't know how to get the "x column" value from cell.</p>
c# asp.net
[0, 9]
5,724,513
5,724,514
Issue comparing string with datetime in javascript
<p>script is ---</p> <pre><code> function TimeSpentForFutureDate() { var toDate = new Date(); toDate.setMinutes(0); toDate.setSeconds(0); toDate.setHours(0); toDate.setMilliseconds(0); //Here after selecting future date also, this condition is failing.The textbox // containing a future date if (document.getElementById('&lt;%= txtDate.ClientID%&gt;').value &gt; toDate) { var timespent = jPrompt('Enter Time Spent:', '', 'Enter Time Spent', function (r) { if (r) { document.getElementById('&lt;%= hiddenFieldFutureDateSelectTimeSpent.ClientID%&gt;').value = r; jAlert('You entered ' + r); } else { var todaysDate = new Date(); jAlert('You had not entered the Time Spent', 'Message'); } }); } else { document.getElementById('&lt;%= hiddenFieldFutureDateSelectTimeSpent.ClientID%&gt;').value = timespent; document.getElementById('&lt;%= txtDate.ClientID%&gt;').value = toDate; } } </code></pre> <p>In the above code I'm checking that if text box 'txtDate' will contain a future date.</p> <p>[ i.e date greater then today's date it will prompt for entering time spent and then store that time spent into an hidden field.]</p> <p>I'm not able to convert a string into date time object for comparison. Please help me to resolve this issue.</p> <p>Thanks in advance.</p>
javascript asp.net
[3, 9]
123,880
123,881
Load the document into the iframe jquery
<p>I want to access the currently loaded document of an iframe and link that document to another iframe, for this I tried:</p> <pre><code> $("#if1").attr("src", $("#if2").attr("src")); </code></pre> <p>But this loads the document again. I want to access the document already loaded in <code>#if1</code>. How can I do this?</p>
javascript jquery
[3, 5]
2,984,089
2,984,090
Doctype issue using jquery plugin
<p>i am using jquery chart it works fine when i remove DocType on the page but it shows give error if i add doc type in the page Any help please Doctype is as follow</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; </code></pre> <p>and jquery code is as follow</p> <pre><code>&lt;script type="text/javascript"&gt; var gauge = bindows.loadGaugeIntoDiv("gauges/g_speedometer_03.xml", "gaugeDiv"); var t = 0; var interval = 100; function updateGauge() { t += interval; var value = 80 + 80 * Math.sin(t / 3000) gauge.needle.setValue(value); gauge.label.setText(Math.round(value)); } setInterval(updateGauge, interval); &lt;/script&gt; </code></pre>
jquery asp.net
[5, 9]
2,911,337
2,911,338
Replace numeric value with another
<p>I have a span in my HTML as follows, which I am assigning the text from code behind:</p> <pre><code>&lt;span id="NewL1" visible="false" runat="server"&gt;&lt;span runat="server" id="NewL"&gt;&lt;/span&gt;&lt;/span&gt; </code></pre> <p>The text would be something like : "you have 3 notifications."</p> <p>I want to change the numeric value in jQuery. I have tried this but nothing happens:</p> <pre><code>var notification = $("#NewL"); var numb = notification.text().match(/\d/g); var finalTotalCount = parseInt(numb) - 1; notification.text(notification.text().replace(numb, finalTotalCount )); </code></pre> <p>What I am doing wrong?</p>
javascript jquery
[3, 5]
703,333
703,334
jquery swap images on click and hide then
<p>I'm trying to build a menu. OVer a canvas I load different images and position them using CSS. Currently I operate with SHOW / HIDE with a lots of code duplication. My questions are: - instead of just hidding an image, how can I change it on click with another one? and then again hide it, if I should click another button? - is it possible to write all this code somehow simpler?</p> <p>Thanks a lot...</p> <pre><code> $("#ten").click(sizeTen); function sizeTen(){ cb_ctx.lineWidth = 10; clickSound(); $(this).hide(); $("#twenty").show(); $("#forty").show(); $("#sixty").show(); } $("#twenty").click(sizeTwenty); function sizeTwenty(){ cb_ctx.lineWidth = 20; clickSound(); $(this).hide(); $("#tenClick").show(); $("#ten").show(); $("#forty").show(); $("#sixty").show(); } $("#forty").click(sizeForty); function sizeForty(){ cb_ctx.lineWidth = 40; clickSound(); $(this).hide(); $("#ten").show(); $("#twenty").show(); $("#sixty").show(); } $("#sixty").click(sizeSixty); function sizeSixty(){ cb_ctx.lineWidth = 60; clickSound(); $(this).hide(); $("#ten").show(); $("#twenty").show(); $("#forty").show(); } </code></pre>
javascript jquery
[3, 5]
2,879,486
2,879,487
If less than double digits add 0, javascript
<p>Hopefully this makes sense,</p> <p>I have a javascript countdown on my page, when it drops down to single digits, such as '9 days' I need to append a 0 to the beginning. </p> <p>I'm not sure if this is possible with Javascript so thought I'd ask here, My current code im using is</p> <pre><code>&lt;!-- countdown --&gt; today = new Date(); expo = new Date("November 03, 2011"); msPerDay = 24 * 60 * 60 * 1000 ; timeLeft = (expo.getTime() - today.getTime()); e_daysLeft = timeLeft / msPerDay; daysLeft = Math.floor(e_daysLeft); document.getElementById('cdown').innerHTML = daysLeft </code></pre>
javascript jquery
[3, 5]