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,737,527
2,737,528
Bluetooth limitations
<p>While using bluetooth to share files from one android mobile as server and many mobiles (20-30) can download files simultaneously from that server. What are the limitation of bluetooth api in android ? Is it possible ?</p> <p>How do you prefer to do this? On bluetooth or via wifi ? Thanks</p>
java android
[1, 4]
5,522,219
5,522,220
Passing value JavaScript to a Java class file
<p>I have three string values in JavaScript. And I have a method <code>getValues(String val1, String val2, String val3)</code>. This metod is outside the JavaScript. I want to call this method using that above three values.</p>
java javascript
[1, 3]
2,572,650
2,572,651
php javascript cleartimeout() not working
<p>I have a setTimeout and clearTimeout where the setTimeout is working fine but clearTimeout is not working, can anyone help me?</p> <p>code:</p> <pre><code>&lt;script type="text/javascript"&gt; var i = 0; var status = setTimeout(function () { if (i &lt;= 2) { metrics_status(); i++; } else { clearTimeout(status); }; }, 3000); &lt;/script&gt; &lt;div id="ReloadMetrics"&gt;&lt;/div&gt; </code></pre>
php javascript jquery
[2, 3, 5]
3,991,334
3,991,335
Targeting CSS on div range
<p>I have an element I populate with $.ajax now I want to fade all the custom loaded elements, the element is already pre-populated with 20 elements when the page loads, I don't want to target those 20. Essentially, how can I target the latter 17 divs assuming I have 37 divs total? Currently I use:</p> <pre><code>while ($(".info #future&gt;center&gt;div").length&gt;20) { $(".info #future&gt;center&gt;div:last-child").remove(); } </code></pre> <p>to remove them, but now I also want a fading effect to be applied prior, assigning anything to their class is not an option since that property is already taken.</p>
javascript jquery
[3, 5]
5,544,818
5,544,819
Arrange controls in panel in ASP.NET
<p>I want to arrange the controls in a Panel control. For example, I have four labels and four textboxs, I want to put them in a panel like a table without using the VS designer, only use the code. Does anyone do it before?</p> <p>Best Regards,</p>
c# asp.net
[0, 9]
1,893,959
1,893,960
Change outerHTML in javascript or jquery
<p>I want to change the outerHTML and this is what I do:</p> <pre><code>$(data.description)[0].outerHTML = $(data.description)[0].outerHTML.replace('red', 'black'); </code></pre> <p>The value is:</p> <pre><code>$(data.description)[0].outerHTML: "&lt;p style="color: red;"&gt;desc1&lt;/p&gt;" </code></pre> <p>and it doesn't get changed. How to change it?</p> <p>data.description has this value:</p> <pre><code>&lt;p style="color: red;"&gt;desc1&lt;/p&gt;&lt;p style="color: red;"&gt;desc2&lt;/p&gt; </code></pre> <p>And I want only $(data.description)[0] changed.</p> <p>Here is my whole code:</p> <pre><code>var ingsLines = $(data.description); for (var i =0; i &lt; ingsLines.length; i++) { if (someCondition) { $(data.description).eq(i).css('color', 'black'); } } try{$('#myTextarea').html(data.description);}catch(err){} </code></pre> <p>And the code changes the value, it puts black instead of red, but data.description stays with red.</p>
javascript jquery
[3, 5]
3,464,995
3,464,996
Not able to get '.' dot pressed event in android onkeypressed
<p>Hi i am trying to get the event when i press . dot in android key board </p> <pre><code> public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == '.') { Log.d("dot pressed" "dot presed"); where i am getting wrong? </code></pre>
java android
[1, 4]
5,868,702
5,868,703
how can i add head text in javascript alert dialog box
<p>I need to add Header text in javascript alert dialog box, that text having some forecolor and textfont will be bold. it is possible to create on javascript alert dialog box.</p>
c# javascript
[0, 3]
3,155,530
3,155,531
Passing values from ASP.NET to PHP
<p>Is there anyway to pass values from ASP.NET to PHP easily using Session or any other? I tried in the below way but it didn't work for me. Anybody either correct the below code or suggest me a way to pass values from ASP.NET to PHP without using URL query string.</p> <p>ASP.NET code.</p> <pre><code>protected void Button1_Click(object sender, EventArgs e) { HttpCookie cookie = new HttpCookie("myvalue1"); cookie.Value = "joe@example.com"; Response.Redirect("Default.php"); } </code></pre> <p>PHP code.</p> <pre><code>&lt;?php session_start(); $_COOKIE['myvalue1']; $cookies = getCookies(); $sessionId = $cookies['myvalue1']; ?&gt; </code></pre>
php asp.net
[2, 9]
3,239,183
3,239,184
How validate content of Input box with jquery or javascript
<p>How can i validate content of a input box? that when a user for example write in that inbox <code>http://www.example.com</code> input box turn it into <code>www.example.com</code> .in other words its valide frist http and if its exist remove it automatically and insert the correct and show the correct in that input-box ?</p>
javascript jquery
[3, 5]
975,967
975,968
Is there a shorter way to write this Jquery code?
<p>If I need to preselect a dropdown option with a certain value, I can use this:</p> <pre><code>$('select option[value="123"]').attr('selected', 'selected'); </code></pre> <p>but if I need to preselect an option based on the text it contains I need to do all this:</p> <pre><code> $('select option').each(function() { var $this = $(this); if($this.text() == 'My Text') { $this.attr('selected', 'selected'); } }); </code></pre> <p>Is there a way to do it without looping through all the option tags like the first way but based on text instead of value?</p>
javascript jquery
[3, 5]
883,817
883,818
Get unique List elements based on a substring
<p>I have an ArrayList(String) which contains a list of formatted dates like this:</p> <pre><code>element 1: "2012-5-1" element 2: "2012-8-10" element 3: "2012-12-5" element 4: "2013-12-21" element 5: "2013-12-13" element 6: "2014-5-8" </code></pre> <p>What is the most efficient/framework way to create another list or normal primitive array that contains the unique year entries? For example my new list would contain:</p> <pre><code>element 1: "2012" element 2: "2013" element 3: "2014" </code></pre>
java android
[1, 4]
2,703,784
2,703,785
resize image in div tag when broser resize
<pre><code>&lt;div id="banner"&gt; &lt;script type="text/javascript" src="gallery/js/jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="gallery/js/swfobject.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="gallery/js/flashgallery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; jQuery.flashgallery('gallery/gallery.swf', 'gallery/config.xml',{ width:'100%', height:'100%', background: 'transparent'}); &lt;/script&gt; &lt;/div&gt; </code></pre> <p>can some body help me to resize image in div tag it is displayed using jqurery.flassgallery from last one day i am trying for this plz if any body gives me mail i will mail the code</p>
php javascript jquery
[2, 3, 5]
5,865,785
5,865,786
javascript not working
<p>I have following javascript code. Its a timer code. Timer stops if quiz is 3 for 3 seconds and starts after 3 seconds for 20 seconds. But this code is not working for if quiz is anything else than 3. Can anyone help me with this?</p> <pre><code>&lt;script type="text/javascript"&gt; var days = 0 var hours = 0 var minutes = 0 var seconds = 20 var delay_countdown = &lt;?php echo ($quiz == 3) || 0 ; ?&gt;; function setCount () { document.getElementById("remain").innerHTML = seconds+" seconds"; SD=window.setTimeout( "setCount()", 1000 ); if (delay_countdown) { return } seconds--; if (seconds &lt; 0){ minutes--; seconds = 59 } if (minutes &lt; 0){ hours--; minutes = 59 } if (hours &lt; 0){ days--; hours = 23 } } &lt;/script&gt; </code></pre>
php javascript
[2, 3]
3,404,002
3,404,003
can i change printer_write in another language?
<p>I am trying to print a page. I use <code>printer_select_font</code> to change the font and then I use <code>printer_draw_text</code> to print, but it is slow.</p> <p>So my questions is, can I change <code>printer_write</code> in another language? Thanks in advance. </p> <p>I use this code:</p> <pre><code>$handle = printer_open(); printer_start_doc($handle, "My Document"); $handle = printer_open(); printer_set_option($handle,PRINTER_FORMAT_CUSTOM,'2x2'); $handle = printer_open(); printer_start_doc($handle, "My Document"); printer_start_page($handle); $font = printer_create_font("Saumil_guj2", 15, 9, 100, false, false, false, 0); printer_select_font($handle, $font); $dyna=10; if($_SESSION['slip_setting']['soc_name']=="full") { printer_draw_text($handle, $_SESSION['society_info']['soc_name_eng'], 10, $dyna); $tot=$dyna+15; } </code></pre>
php jquery
[2, 5]
5,979,806
5,979,807
show decimal places on client side division
<p>I am populating a template field using the following code</p> <pre><code>&lt;%# ((ListData)Container.DataItem).TotalMinutes / 60.00 %&gt; </code></pre> <p>However, sometimes the returned value shows up like 40.5 or 29 or 34.75.</p> <p>I would like it to always show the 2 decimal places whether it is 40.50 or 29.00 or 34.75. The 2 decimal places should always show.</p> <p>I also tried</p> <pre><code>&lt;%# string.Format("{0:###.##}", (double)((PendingApprovalListData)Container.DataItem).TotalMinutes / 60D)%&gt; </code></pre>
c# asp.net
[0, 9]
3,886,187
3,886,188
Update 2 exact same images source using javascript
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5958617/update-2-exact-same-images-source-using-javascript">Update 2 exact same images source using javascript</a> </p> </blockquote> <p>I using PHP captcha called Cryptographer captchan.fr site</p> <p>I need to use 2 captcha on same page but i have problem they do get generated but when i click refresh only first one refreshes, refresh code looks like this.</p> <pre><code>document.images.captcha.src='cryptographp.html?cfg=0&amp;&amp;'+Math.round(Math.random(0)*1000)+1; </code></pre> <p>I tried this code but it only works for first one anyway</p> <pre><code>document.getElementById('captcha').src='cryptographp.html?cfg=0&amp;&amp;'+Math.round(Math.random(0)*1000)+1; </code></pre> <p>Now i wanted to do something like this i added name="captcha" to image but this does not work for some reason can someone help me fix it?</p> <p><code>document.getElementsByName('captcha').src='cryptographp.html?cfg=0&amp;&amp;+Math.round(Math.random(0)*1000)+1;</code></p> <p>I also have jquerry attached to page if thats easier.</p> <p>i tried to remove id and use class but still this does nothing</p> <pre><code>$('.captcha').src='cryptographp.html?cfg=0&amp;&amp;'+Math.round(Math.random(0)*1000)+1; </code></pre> <p>because saying undefined reference.</p>
javascript jquery
[3, 5]
5,366,173
5,366,174
Use a variable derived from Javascript into an ASP tag
<p>I'm having difficulty in using a variable derived from Javascript into an ASP tag . </p> <pre><code>&lt;script language="javascript"&gt; if (arg) { var text_box_to_fill = arg.sendValue_Code; document.getElementById( document.getElementById("&lt;%= "+text_box_to_fill+".clientID %&gt;").value = selected_libelle_value; } &lt;/script&gt; </code></pre> <p>Any suggestions?</p>
javascript asp.net
[3, 9]
3,141,984
3,141,985
How do i get relative dimensions of scrollbale window viewport
<p>I am having a Tooltip (larger image view) that is being positioned via e.pageX e.pageY and i am trying to make sure it is not hidden below the current scrolled view port.</p> <p>I have seen many sites have this my code is something like this but i am missing something.</p> <pre><code>var positionImg = function(e) { var viewportWidth = $(window).width(); var viewportHeight = window.innerHeight ? window.innerHeight : $(window).height(); var mouseAtY = e.pageY; var mouseAtX = e.pageX; var maxBottomVPos = viewportHeight-"i dont know"; var maxTopVPos = 30; if (mouseAtY &gt;= maxBottomVPos) { tPosX = mouseAtX+ 10; tPosY = mouseAtY -520; } else if (mouseAtY &lt;= maxTopVPos) { tPosX = mouseAtX; tPosY = mouseAtY +40; } else { tPosX = mouseAtX; tPosY = mouseAtY +20; } $zoomContainer.css({top: tPosY, left: tPosX}); }; </code></pre>
javascript jquery
[3, 5]
1,997,884
1,997,885
about the grid view EditButton
<p>i'm new to asp.net and writing some program for doing some update delete action. i've created a gridview and connecting db program, now i want to enable the edit button and but alter it pass the id from the editGrid.aspx to the editDetials.aspx which let user can edit the content in a details view. </p> <p>here is the script in editGrid.aspx</p> <pre><code>&lt;asp:CommandField ShowEditButton="True" ShowDeleteButton="True" /&gt; </code></pre> <p>how to make it pass the id value using the gridview edit button?</p>
c# asp.net
[0, 9]
4,883,363
4,883,364
How to display data in particular gridview when particular checkbox is selected?
<p>I have 6 check boxes in 1 panel, and 6 gridviews i other seven differnt panels. when i check checkbox 1, the data should be displayed in gridview one and so on. How to do this?</p>
c# asp.net
[0, 9]
1,697,877
1,697,878
Displaying label control depending on condition
<p>I have three pages on my site. Page 1 is home page. When user visits the site, i display label control to user in Page 1. When the same user goes to page 2 , 3 and returns back to page 1, i do not want the label to show again. How can i do this?</p>
asp.net jquery
[9, 5]
4,587,370
4,587,371
Is there is any way to scrape the dynamic content using php or java
<p>I need to scrape some details from a website. It loads certain details in Ajax after a button click. Is it is possible to scrape the details from this <a href="http://www.guruji.com/music/3%20idiots/" rel="nofollow">link</a>?</p> <p>It loads the details when the <code>+</code> button is pressed.</p>
java php
[1, 2]
5,225,443
5,225,444
How to automatically hide a modal popup control?
<p>I have a model pop extender control like:</p> <pre><code> &lt;cc1:ModalPopupExtender ID="basketPopUp" runat="server" PopupControlID="Panel1" PopupDragHandleControlID="PopupHeader" Drag="true" BackgroundCssClass="ModalPopupBG" TargetControlID="Panel1"&gt; &lt;/cc1:ModalPopupExtender&gt; &lt;asp:Panel ID="Panel1" Style="display: none" runat="server"&gt; &lt;div class="PopupBody"&gt; &lt;b&gt;Test&lt;/b&gt; &lt;br /&gt; &lt;/div&gt; &lt;/asp:Panel&gt; </code></pre> <p>What i want is to show the popup for 5 seconds and HIDE it AUTOMATICALLY after this period of time.</p> <p>I've tried this, but, running on the server side, of course it is not working:</p> <pre><code> public void showAndHidePopUp() { basketPopUp.Show(); System.Threading.Thread.Sleep(5000); basketPopUp.Hide(); } </code></pre> <p>Do you know how to hide it in a proper way?</p> <p>Thanks.</p> <p><strong>Edit:</strong></p> <p>For announcementes i've decided to use jGrowl-> <a href="http://www.stanlemon.net/projects/jgrowl.html" rel="nofollow">http://www.stanlemon.net/projects/jgrowl.html</a></p> <p>and not ModalPopUp Extender.</p>
c# asp.net
[0, 9]
770,433
770,434
Get session id from android MEDIA PLAYER?
<p>I'm trying to develop a spectrum based live wallpaper, which will change when the music plays or someone touches the screen, for android 2.3 and up. The problem is that I need to get the session id to initialise the Visualizer so...</p> <p>How can I get the sessionId from android</p> <p>And it would be good if you could show me how I need to init the Visualizer properly to get FFT data, or alternative ways to get fft data.</p>
java android
[1, 4]
2,232,891
2,232,892
Cant figure out why my images won't lazyload
<p>Hey guys i can't seem to get lazyload to work at all on <a href="http://www.childrenoftheson.com/newindex/Untitled-14.html" rel="nofollow">my page</a>, and i can't understand why. I've looked around alot and still have no idea.</p> <p>I need it as im desinging a new page for my band www.childrenoftheson.com/newindex/Newtest.html and since the whole site is run off one page i need to lazyload images to speed it up.</p> <p>I would also love to know if anyone could point my in the right direction for lazyloading widgets.</p> <p>Any help/rage is appreciated :D.</p>
javascript jquery
[3, 5]
5,881,059
5,881,060
Call jQuery function within function
<p>I have a jQuery function (stripped down just for this example):</p> <pre><code>(function($) { $.fn.Lightbox = function(options) { var opts = $.extend(defaults, options); function initialize() { $('#lightbox').show(); return false; }; function close() { $('#lightbox').hide(); }; return this.click(initialize); }; })(jQuery); </code></pre> <p>I then use....</p> <pre><code>$('a.image').Lightbox(); </code></pre> <p>to run it. I want to be able to call the close() function seperately e.g.</p> <pre><code>$.Lightbox.close(); </code></pre> <p>How can I achieve this within my code?</p>
javascript jquery
[3, 5]
2,534,689
2,534,690
Rewinding HTML 5 video each time the page is loaded
<p>I want to make sure my HTML 5 videos start running from the beginning when the user enters a page.</p> <p>At the moment, the first video is running fine, but if the user closes the pop-up while playing the video will start from where the user left it when they open the pop-up again.</p>
javascript jquery
[3, 5]
463,761
463,762
JQuery callback function flow
<p>i am very new in jquery. so i was searching google for jquery callback function and i got a code but i did not understand the flow of the code. so please anyone help me to understand the coding flow.</p> <p>here is the code</p> <pre><code>function mightyplugin(foo, callback){ // big code block here callback.apply(this, [foo]); } mightyplugin("Bar!", function(param){ alert(param); }); </code></pre> <p>here i am passing <code>"Bar!"</code> as one argument to function <code>mightyplugin</code> and a anonymous function.</p> <ol> <li>what <code>callback.apply</code> does. what <code>this</code> keyword will hold actually.... why it is required.</li> <li>why <code>[foo]</code> is passed as array. </li> <li><p>what would be the syntax if i pass many argument like</p> <pre><code>mightyplugin("Bar!","1stone","2ndone", function(param){ alert(param); }); </code></pre></li> </ol> <p>i know callback function invoke when first function finish but here situation is different... why?</p> <p>please explain...<br> thanks</p>
javascript jquery
[3, 5]
2,394,288
2,394,289
jQuery to hide all row classes except 'row2' only when the parent class is viewContainerTop
<p>I've been to <a href="http://stackoverflow.com/questions/394470/jquery-select-class-inside-parent-div">jquery select class inside parent div</a> and <a href="http://stackoverflow.com/questions/287875/testing-objects-for-ancestor-descendent-relationship-in-javascript-or-jquery">Testing objects for ancestor/descendent relationship in JavaScript or Jquery</a> and <a href="http://stackoverflow.com/questions/1389005/jquery-wild-card-character">jQuery wild card character</a> but can't seem to fit the pieces together. Thanks.</p> <pre><code>&lt;div id="viewContainerTop" class="top"&gt; &lt;div class="row1"&gt;&lt;/div&gt; &lt;div class="row2"&gt;&lt;/div&gt; &lt;div class="row2"&gt;&lt;/div&gt; &lt;div class="row2"&gt;&lt;/div&gt; &lt;div class="row3 first"&gt;&lt;/div&gt; &lt;div class="row3"&gt;&lt;/div&gt; &lt;div class="row3"&gt;&lt;/div&gt; </code></pre> <p></p>
javascript jquery
[3, 5]
2,471,914
2,471,915
Using .hide() and .show() in jQuery
<p>In my program I have several very similar drop-down menus all with the same name (foo in the following example). On change they hide or show a nearby div tag depending on whether or not "ON" was selected.</p> <pre><code>$('.togClass').hide(); $('[name*="foo"]').change(function(){ if ($('[value="ON"]').is(':selected')) { $('.togClass').show('blind', 1000); } else { $('.togClass').hide(1000); } }); </code></pre> <p>As it is, all of the div tags with class "togClass" toggle when <em>any</em> of the drop down menus choose "ON", is there a way that I can choose to show/hide only the <em>nearby</em> div to the drop-down that chooses "ON"(they are nested in the same div)? I don't want to write a copy of this function for every div I want to hide.</p> <p>Here is how it works in the HTML:</p> <pre><code>&lt;select name="foo"&gt; &lt;option value="OFF"&gt;OFF&lt;/option&gt; &lt;option value="ON"&gt;ON&lt;/option&gt; &lt;/select&gt;&lt;br/&gt; &lt;div class="togClass"&gt; //Stuff &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
2,037,645
2,037,646
What is the best way to remove/skip an item from collection
<p>what is the best way to remove/skip an item from collection object</p> <pre><code>List&lt;Person&gt; personList = new List&lt;Person&gt;() personList = dao.GetData(123); personList = personList.Select(x =&gt; x.Comment... ???? </code></pre> <p>resultset:</p> <pre><code>"GCE" Not available "" //comments "RES" 9.97000000 9.99000000 ........ ........ ........ </code></pre> <p>so, i am targeting the field called "comments" and if the comments are empty then dont render.</p> <p>i could have do that in <code>foreach</code> loop with an <code>if condition</code> but i am looking for the best practice</p>
c# asp.net
[0, 9]
4,945,868
4,945,869
Help for arrays: converting php code to python
<p>For the first time this is not python => php but php => python. I've got small problem with arrays in python. (I've already been to docs.python.org)</p> <p>Here's my problem: I get in python couples of strings like this:</p> <pre><code>(People 1): &lt;criteria a&gt; &lt;data of the criteria&gt; &lt;criteria b&gt; &lt;data of the criteria&gt; &lt;criteria c&gt; &lt;data of the criteria&gt; &lt;criteria d&gt; &lt;data of the criteria&gt; (People 2): &lt;criteria a&gt; &lt;data of the criteria&gt; &lt;criteria b&gt; &lt;data of the criteria&gt; &lt;criteria d&gt; &lt;data of the criteria&gt; ... </code></pre> <p>(note for people 2 criteria c doesn't exist) So i'd like do that (in php it's very easy):</p> <pre><code>array_push( tab[ "criteria a" ], array("People1", "data of the criteria") ); </code></pre> <p>Then I'd like to show all a list of the criterias that exists, and use the array to create a nice "insert SQL query" for my database.</p> <p>Any idea how to do this? Where should I look? I miss string indexed arrays....</p>
php python
[2, 7]
1,768,377
1,768,378
thread in asp.net/c#
<p>I want to create a thread on user_login Event or Form_load Event. In this thread i want to call a class function to execute some sql statement, and the user do not have to wait for the result or background process to be finished, he is just directed to his desired page let say my profile or what ever. I am using ASP.NET, C#.</p>
c# asp.net
[0, 9]
2,109,872
2,109,873
Wait for animation to finish before calling function
<p>JS:</p> <pre><code>$.fn.blink = function(times, duration) { times = times || 2; while (times--) { this.fadeTo(duration, 0).fadeTo(duration, 1); } }; </code></pre> <p>This makes blinking text. At last blink I want to execute a function so I changed it like this:</p> <pre><code>$.fn.blink = function(times, duration, callback) { times = times || 2; while (times--) { this.fadeTo(duration, 0).fadeTo(duration, 1); } if (typeof callback == 'function') { // make sure the callback is a function callback.call(this); // brings the scope to the callback } }; </code></pre> <p>The execution of callback is not at the right place. It seems to be fired when blinking starts. Any ideas how to call the function at last blinking?</p> <p><a href="http://jsfiddle.net/Cnm2f/2/" rel="nofollow"><strong>FIDDLE</strong></a></p>
javascript jquery
[3, 5]
1,833,219
1,833,220
Apply style to textbox substring
<p>I have a simple search form consisting of just a textfield, but it has filters (e.g., beginning the query with "type:" only searches a database column of "type"). What I'd like to have is for that text before the actual search term (i.e., "type:") to be styled in such a way that it's obvious to the user that it's a filter and not a search term. In fact, it might look something like StackOverflow's Tags textfield after a user has typed in a tag (see <a href="http://i.imgur.com/tvP6R.png" rel="nofollow">this</a>). So far, I've got a .keypress() method being called on the textfield to determine if the first term is indeed a filter, but I'm not sure how to style the filter text. Any help is appreciated!</p>
javascript jquery
[3, 5]
982,504
982,505
keep file dialog open even after displaying alert
<p>HI Guys,</p> <p>I have the below code where I check for the file types of the file selected.<br> <code>hiddenFileInputFile</code> is of file input type.<br> Below code is working fine but if the user does not supply a <code>.csv</code> file then it show the alert, which is fine, but then I want the file dialog to remain open which is not happening.</p> <p>Please advise.<br> Also is there any way where I can apply the filter directly to the file dialog to select only <code>.csv</code> files using jquery/javascript?</p> <pre><code>Element.find('input.hiddenFileInputFile').change(function () { var filename = $(this).val(); if (!/\.csv$/.test(filename)) { alert('Please select a csv file'); return false; } }); </code></pre> <p>Thanks.</p>
javascript jquery
[3, 5]
4,026,131
4,026,132
Why using XML to create GUI is a good practice in Android
<p>I am from Java Swing background. May I know why using XML to create GUI is a good practice in Android? For instance, instead of writing the code in (Which makes me feel more comfortable with it as I use to Swing desktop application)</p> <pre><code>import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Hello, Android"); setContentView(tv); } } </code></pre> <p>We write the code in XML way.</p> <pre><code>import android.app.Activity; import android.os.Bundle; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } </code></pre> <p>In tutorial, it states that, </p> <blockquote> <p>This structure makes it very easy to quickly build up UIs, using a more simple structure and syntax than you would use in a programmatic layout.</p> </blockquote> <p>However, I don't really buy the idea, as I feel that creating a separate XML file is more cumbersome.</p> <p>Can anyone give a real world example (in the sense of Android), why using XML to build GUI is more superior than bare Java code? </p> <p><strong>If GUI programming through XML is really a good stuff, why it still hasn't become a common practice among GUI desktop application developers?</strong></p>
java android
[1, 4]
2,431,785
2,431,786
How to save/retrieve data with android device sd-card, via USB Debugging mode?
<p>Is there a way to save/retrieve files from an android device, via the USB debugging mode. That means I want my application to get connected even if the Device is charging via the USB cable connected to the PC.</p> <p>I think the ADB (Android Debug Bridge) is capable of rendering this service, however I am not quite sure if it works, If it does how can I use it with C# to simply save and get some files from the SD-Card</p>
c# android
[0, 4]
336,209
336,210
Javascript - Get the object's properties and print on element using "data-id"
<p>I am trying to select an object from this array and print all of its properties into an element, using "data-id". How would I go about doing this? Also, how can I give an ID to the new CarObjects?</p> <pre><code>**&lt;div id="carInfo" data-id="10"&gt;&lt;/div&gt;** function Car(company, name, price, details, image, alt){ this.company = company; this.name = name; this.price = price; this.details = details; this.image = image; this.alt = alt; } var carInformation = [new Car("Ferrari", "Marenello", " $250,000", "Fast. Very Fast.", "images/ferrari.jpg","image of ferrari"), new Car("Dodge", "Viper", " $100,000","Great Acceleration","images/dodge.jpg", "image of viper"), new Car("Ford", "Shelby", "$80,000", "Muscle Car", "images/mustang.jpg", "image of mustang"), new Car("Back To The Future", "Delorean", "$20,000", "Travels through time","images/delorean.jpg", "image of delorean"), new Car("Lamborghini", "Diablo", "$250,000", "Fastest","images/lambo.jpg","image of lamborghini"), new Car("CMercedes Benz", "SLR", "$180,000", "Classy Vehicle.","images/benz.jpg","image of mercedes benz"), new Car("Chevrolet", "Corvette", "$70,000", "Fiberglass body Light Vehicle.","images/vette.jpg","image of corvette"), new Car("Porsche", "Carrera", "$120,000", "Great Handling.","images/porsche.jpg", "image of porsche"), new Car("Audi", "R8", "Price: $110,000", "Fast and Classy.", "images/audi.jpg","image of audi") ]; </code></pre>
javascript jquery
[3, 5]
4,592,718
4,592,719
Execute a dynamic asp button click event
<p>I've create a dashboard that contains multiple dynamic buttons. When I click the "Delete" button I want the server side code to execute. I've added the code to the Click event handler of my button.</p> <p>The dynamic button is created with the following code:</p> <pre><code>Button PopupDeleteButton = new Button(); PopupDeleteButton.ID = "PBD" + controlValue.ID.ToString(); PopupDeleteButton.Text = "Delete"; PopupDeleteButton.Style["Height"] = "15px"; PopupDeleteButton.Style["Width"] = "50px"; PopupDeleteButton.Style["top"] = "0"; PopupDeleteButton.Style["right"] = "0"; PopupDeleteButton.Style["float"] = "left"; PopupDeleteButton.Style["font-size"] = "9px"; PopupDeleteButton.Style.Add(HtmlTextWriterStyle.VerticalAlign, "top"); PopupDeleteButton.Attributes.Add("runat","server"); PopupDeleteButton.Click += new EventHandler(this.RemoveWidgetFromXML_Click); </code></pre> <p>However when the I click the dynamic button on the form a post back occurs, and the function RemoveWidgetFromXML is never called. Any ideas? I've looked all over Google but can't find how to stop the post-back from occurring prior to the event call.</p>
c# asp.net
[0, 9]
3,932,255
3,932,256
Removing the active class from the previous clicked element when fading in and fading out content
<p>I've created 3 buttons with a paragraph of content after each, when a button is clicked this will fade in the paragraph that follows it as well as adding an active class to that clicked button. At the moment I have managed to achieve the fade in and fade out but i dont seem to be able to remove the active class from the previous clicked button, can anyone advise where I might be going wrong with this? also there is probably an easier/better way to create the effect Im working towards so all advice/help/suggestions are really welcome.</p> <p>Fiddle: <a href="http://jsfiddle.net/kyllle/nZFUP/3/" rel="nofollow">http://jsfiddle.net/kyllle/nZFUP/3/</a></p> <p>Thanks Kyle</p>
javascript jquery
[3, 5]
6,021,077
6,021,078
Why does my function get called when it's not supposed to?
<p>I have 2 java script functions. If the first one returns true, the 2nd one is not to be executed. If the first one returns false, only then the second function to be executed. So I am trying to achieve this with the following code:</p> <pre><code> &lt;script type="text/javascript" language="javascript"&gt; function needsForcedReset() { if($("#showMessage").text().length &gt; 0) { return true; } return false; } function sendAlert() { //Sends an alert; alert('oh oh'); } $(document).ready(function() { alert('in doc ready'); if (needsForcedReset()) { alert('Need force reset, no check for alerts'); return; } else { sendAlert(); } }); &lt;/script&gt; </code></pre> <p>What I am seeing though, is that the sendAlert is being called regardless of what the needsForcedReset function return. How do I make it work?</p> <p><b>Edit: the showMessage is a div element </b></p>
javascript jquery
[3, 5]
396,641
396,642
IE7: .remove() does not work - element (byID) does not exist
<p>This code below DOES NOT work in IE7, but works perfectly in all other browsers tested.</p> <p>The element <code>'#requestFormContainer'</code> comes into existence after the <code>.ajax</code> request below. </p> <p>In fact, <code>$('#requestFormContainer').length</code> equals 1 in all browsers tested, but equals 0 in IE7. So it's just not there. No errors in IE's debug tool or Firebug. I'm out of ideas.</p> <pre><code>function ShowEventForm(erid) { $.ajax ({'url': '&lt;?php echo $GLOBALS['SERVER_NAME_HTTP']; ?&gt;ajax/ajax.showrequestform.php', 'data': {'task':'ShowRequestInfo','erid':erid}, 'dataType':'html', 'type': 'POST', 'success': function (data) { $('#eventListContainer').hide(); $('#clientContentPanel').append(data); $('#backToEventList').click(function() { $('#requestFormContainer').remove(); $('#eventListContainer').show(); }); } }); } </code></pre> <p>Updates - No solution with following changes:</p> <p>I've changed</p> <p><code>$('#clientContentPanel').append(data)</code> TO <code>$(data).appendTo('#clientContentPanel')</code></p> <p>and</p> <p>Removed and relocated some js code from the offending element: </p> <p><code>&lt;div id="requestFormContainer"&gt;</code> </p>
javascript jquery
[3, 5]
4,971,013
4,971,014
FileUpload1.HasFile is always returning false
<p>I am uploading file using ASP.net File upload control. My FileUpload1.HasFile is always returning false.</p> <pre><code>if (FileUpload1.HasFile) { DBOperations db = new DBOperations(); try { FileUpload1.SaveAs(Server.MapPath("~/uploadedImages/" + db.uploadImage(System.IO.Path.GetExtension(FileUpload1.FileName)) + System.IO.Path.GetExtension(FileUpload1.FileName))); } catch (Exception Ex) { String he = Ex.Message; } } </code></pre> <p>I am using following ASP.net Code</p> <pre><code>&lt;asp:UpdatePanel ID="fileUpload" runat="server"&gt; &lt;ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID="btnUploadFile" EventName="Click" /&gt; &lt;/Triggers&gt; &lt;asp:FileUpload ID="FileUpload1" runat="server" /&gt; &lt;asp:Button ID="btnUploadFile" Text="Upload File" runat="server" onclick="btnUploadFile_Click" /&gt; &lt;br /&gt; &lt;asp:RegularExpressionValidator ID="revImage" ControlToValidate="FileUpload1" ValidationExpression="^.*\.((j|J)(p|P)(e|E)?(g|G)|(g|G)(i|I)(f|F)|(p|P)(n|N)(g|G))$" Text="Invalid image type" runat="server" /&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p>I have tried even by removing AsyncPostBackTrigger and even by removing Whole asp:updatePanel then also my FileUpload1.HasFile always returns false.</p>
c# asp.net
[0, 9]
1,171,198
1,171,199
Client-side templating, server-side templating or raw cloning&editing stub DOM elements client-side?
<p>There is a page showing a list of objects (e.g. books). This list can programmatically increase through client-side interaction. Which is a good way to create new "books" in the DOM?</p> <p>I'd like to create an invisible stub of the object in the DOM and then clone it n-times, each time editing proprieties (e.g. like book's title and thumb).</p> <p>Which is the best practice?</p> <p>Performance are not the main focus. Code manutenibility and simplicity is my focus. I already use jQuery.</p>
javascript jquery
[3, 5]
2,662,859
2,662,860
Custom Asp.net Navigation Menu
<p>Are there any recommended ways on developing a custom navigation menu in ASP.Net similar to how the built-in Asp.Menu navigation/web.sitemap works?</p> <p>We need to replicate the exact menu structure that a DNN site has for another custom built web application, and its ability to be generated on the fly in case of any addition to the parent menu (which can be done dynamically with DNN).</p> <p>The nav hierarchy structure can be found in the DNN database, but I am not sure how to approach custom building the menu; or even if it can be done.</p> <p>Thanks.</p>
c# asp.net
[0, 9]
4,256,490
4,256,491
In Jquery, can I store the object reference and use it later?
<p>I got a problem with Jquery, I'm making a dynamic form on RoR, so I have a button next to an input that call to an jQuery modal. There the user would do a lookup and select some information from a list. </p> <p>The problem is that I need to insert back the information in the input next to the button that the user click. So i was wondering there's any way to store the button dom and then reuse it so set the value on the input when the modal is getting hidden? Or there's other ways to solve this?</p> <p>Function called on click over the button.</p> <pre><code>function openPicker(event) { $('#myModal').modal('toggle') } </code></pre> <p>Function called when the modal it's getting hidden.</p> <pre><code>$('#myModal').on('hidden', function () { }) </code></pre> <p>Any help will be appreciated!</p>
javascript jquery
[3, 5]
4,248,323
4,248,324
How do I know which list item was clicked?
<p>I have a <code>ListView</code> filled with items. I'd like to set an <code>onClickListener</code> to show details about the item that was clicked. How can I determine which item was clicked within the <code>onClickListener</code>? The <code>View</code>, or <code>v</code> has a lot of methods available that I've looked through and don't see anything pertaining to getting the object clicked on.</p> <pre><code> //populate the activity list ListView teamsListView = (ListView) activity.findViewById(R.id.teamsListView); ArrayList&lt;HashMap&lt;String, String&gt;&gt; listData = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); HashMap&lt;String, String&gt; listItem; for (TeamSet teamSet : response.getTeamSetList()) { listItem = new HashMap&lt;String, String&gt;(); listItem.put("name", teamSet.getName()); //listItem.put("teamCount", Integer.toString(teamSet.getTeams().size())); listData.add(listItem); } teamsListView.setAdapter( new SimpleAdapter( context, listData, R.layout.teams_list_row, new String[]{"name"}, new int[]{R.id.teamsTeamListName} ) ); //show details on a team TextView team = (TextView) activity.findViewById(R.id.teamsTeamListName); team.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //how do I know which item was clicked? I want to load more details on the item... } }); </code></pre>
java android
[1, 4]
4,885,449
4,885,450
Android log files for sleep and wake
<p>before you make fun of me, i am an android noob!</p> <p>i am creating an app that runs as a service and tracks when the phone wakes up and when it goes to sleep. So right now i am wondering if there is a log file from which i can read when the phone goes to sleep and when it wakes up.</p> <p>right now i am coding it so that i make the log file of when the phone goes to sleep and when it wakes up.</p> <p>i am just asking about the log file, since if it exists, then i can simply use its data instead of creating my own logs.</p> <p>thanks!</p>
java android
[1, 4]
4,437,693
4,437,694
what is the sdk version for camera activity?
<p>If I use the <code>targetSdkVersion</code>, my camera works fine. If I change the <code>targetSdkVersion</code> to <code>17</code>, my application stopps. I am also using an android 4.0 Ice Cream Sandwich phone. </p> <pre><code>&lt;uses-sdk android:minSdkVersion="5" android:targetSdkVersion="10" /&gt; </code></pre> <p>if i use android target version=17,my application has stopped</p> <pre><code> &lt;uses-sdk android:minSdkVersion="5" android:targetSdkVersion="17" /&gt; </code></pre>
java android
[1, 4]
2,874,431
2,874,432
when if statement is true code goes to else?
<pre><code>if (_this.tiles["suz:SuzukiHubResponse"]["suz:categories"][category][aspect]["suz:image"][imageNo] != undefined) { if (imageNo &gt; (_this.tiles["suz:SuzukiHubResponse"]["suz:categories"][category][aspect]["suz:image"].length - 1)) { imageNo = 0; _this.categoriesCurrentImage[categoryIndex] = imageNo; } var img = _this.tiles["suz:SuzukiHubResponse"]["suz:categories"][category][aspect]["suz:image"][imageNo]; _this.showImage(img, divId); _this.categoriesCurrentImage[categoryIndex]++; _this.categoryIndex++; } else { if (imageNo &gt; (_this.tiles["suz:SuzukiHubResponse"]["suz:categories"][category][aspect]["suz:image"].length - 1)) { imageNo = 0; _this.categoriesCurrentImage[categoryIndex] = imageNo; } var img = _this.tiles["suz:SuzukiHubResponse"]["suz:categories"][category][aspect]["suz:image"]; _this.showImage(img, divId); _this.categoriesCurrentImage[categoryIndex]++; _this.categoryIndex++; } </code></pre> <p>Can anyone tell me why.</p> <p>i end up in the else clause even though the if is true? It makes absolutely no sense to me.</p> <p>If there is more than 1 image underneath the suz:image node it should fall into the else. it does 99% of the time.</p>
javascript asp.net
[3, 9]
2,645,579
2,645,580
Print the value in loop in Jquery ready function
<p>somehow still not able to do what I’m inted to do. It gives me the last value in loop on click not sure why. Here I want the <strong>value which is been clicked</strong>.</p> <p>Here is my code:</p> <pre><code>$(document).ready(function() { var link = $('a[id]').size(); //alert(link); var i=1; while (i&lt;=link) { $('#payment_'+i).click(function(){ //alert($("#pro_path_"+i).val()); $.post("&lt;?php echo $base; ?&gt;form/setpropath/", {pro_path: $("#pro_path_"+i).val()}, function(data){ //alert(data); $("#container").html(data); }); }); i++; } }); </code></pre> <p>Here the <code>placement_1</code>, <code>placement_2</code> .... are the <code>href</code>s and the <code>pro_path</code> is the value I want to post, the value is defined in the hidden input type with id as <code>pro_path_1</code>, <code>pro_path_2</code>, etc. and here the <code>href</code>s varies for different users so in the code I have <code>$('a[id]').size()</code>. Somehow when execute and alert I get last value in the loop and I don’t want that, it should be that value which is clicked.</p> <p>I think <code>onready</code> event it should have parsed the document and the values inside the loop I’m not sure where I went wrong. Please help me to get my intended result.</p> <p>Thanks, all</p>
php jquery
[2, 5]
180,910
180,911
How to send bufferedImage from JAVA to PHP
<p>I am kinda noob with JAVA. Here's my problem :</p> <p>I am trying to take a screenshot of my JAVA application and send it to a PHP page. With the code i Have, The img file of the screenshot is created by the PHP but when you open it it's all black minus a small line of gibberish white/black;</p> <p>Did i miss something or what did i do wrong?</p> <p>JAVA code</p> <pre><code>File f = File.createTempFile("support", ".png"); this.imageFileName = f.getAbsolutePath(); Robot r = new Robot(); this.snapshot = r.createScreenCapture(this.frame.getBounds()); BOSHTTPClient http; http = newBOSHTTPClient(this.config.getHttpUrlName()+"?filename="+JBOSupportGlassPane.this.imageFileName); ImageIO.write(this.snapshot, ImageFormat.PNG, http.getOutputStream()); </code></pre> <p>PHP CODE</p> <pre><code>$fileData=file_get_contents('php://input'); $filename = substr($_REQUEST['filename'], strrpos($_REQUEST['filename'], '/')+1); $fhandle=fopen("screenshots/".$filename, 'wb'); fwrite($fhandle, $fileData); fclose($fhandle); echo("Done uploading"); </code></pre>
java php
[1, 2]
917,804
917,805
How to set a variable a users referal
<p>I am trying to create some stats and need to print a users referal site, or search keyword. How to get a Users referal site or search keyword with javascript and print it?</p>
javascript jquery
[3, 5]
2,162,294
2,162,295
SharedPreferences -- Where do the intial values come from with a new app?
<p>I've been looking into using preferences with an app that I have created. For example:</p> <p>One part of my app requires a CountDown timer. The default for this count down timer should be 8:00 (8 minutes or 480000 ms). However, I need the user to have the ability to change this to any value they want.</p> <p>During my research, I have discovered the SharedPreferences ability built into Android but I'm a little confused how it works.</p> <p>My thought was that the app will look for the shared preferences and if they aren't there use the defaults. It doesn't seem to be working. Once I install the new app (there currently isn't a Shared Preferences XML file, so I thought it would just load the defaults but I'm getting a null pointer error and the app crashes.</p> <p>Here is my relevant code:</p> <pre><code>long msSavedMainClock = 0, msSavedShotClock = 0, msShotClockStart, msMainClockStart; TextView tvPeriodPrefix, tvPeriod; // Create the SharedPreferences object SharedPreferences prefs = getSharedPreferences("settings", MODE_PRIVATE); // Create the Preference Editor object SharedPreferences.Editor prefsEditor = prefs.edit(); @Override protected void onCreate(Bundle savedInstanceState) { /******* more code here *******/ // Load the values/defaults from the SharedPreferences tvPeriodPrefix.setText( prefs.getString("Period_Prefix", getResources().getString(R.string.period)) ); msMainClockStart = prefs.getLong( "Default_Main_Clock", 480000); // 8 minute default msShotClockStart = prefs.getLong( "Default_Shot_Clock", 24000); // 24 second default // Initialize other variables tvPeriod.setText( tvPeriodPrefix + "1" ); /******* rest of my code here *******/ </code></pre> <p>Can anyone tell me what I'm doing wrong please?</p>
java android
[1, 4]
5,855,681
5,855,682
Java - best way to implement a dynamic-size array of objects
<p>I am a novice with Java.</p> <p>I have to implement an array of objects that changes in size during execution.</p> <p>The code I am writing is going to be ported on Android, too.</p> <p>According to your experience, what's the best class to implement that?</p> <p>Thanks,<br> Dan</p>
java android
[1, 4]
1,496,063
1,496,064
How to pass msg_id into jquery modal form?
<p>I have a following data where I am showing data from database. When i click Comment a dialog appear, there i need to show data in modal from db. but for getting data from db i need msg_id in modal form.</p> <pre><code>&lt;?php $msg_id = $data['message_id']; ?&gt; &lt;a data-toggle="modal" href="msg_id=&lt;?php echo $msg_id; ?&gt;#example" class="link_comment"&gt;Comment&lt;/a&gt; </code></pre> <p>So here I want to pass msg_id to jquery modal form, where i can get data from db on the base of msg_id for that specific message and show it in modal box.</p> <pre><code>&lt;div id="example" class="modal" style="display: none; "&gt; Your Message id : &lt;?php echo $msg_id; ?&gt; &lt;/div&gt; </code></pre> <p>So how can I pass $msg_id into jquery modal form.</p>
php jquery
[2, 5]
4,371,610
4,371,611
why java script cannot access this asp.net var?
<p>I have this c# user control class:</p> <pre><code>public partial class UserControls_JsTop : System.Web.UI.UserControl { public static string sidebarBannerUrl = getSideBarBannerImgUrl(); protected void Page_Load(object sender, EventArgs e) { } public static string getSideBarBannerImgUrl(){ DataClassesDataContext db = new DataClassesDataContext(); var imgUrl = (from b in db.Banners where b.Position.Equals(EBannersPosition.siderbar.ToString()) select b).FirstOrDefault(); if (imgUrl != null) return imgUrl.Path; return String.Empty; } } </code></pre> <p>I try to acces the static var in a js script:</p> <p>load it here:</p> <pre><code>&lt;script type="text/javascript"&gt; var categoryParam = '&lt;%# CQueryStringParameters.CATEGORY %&gt;'; var subcategory1Param = '&lt;%# CQueryStringParameters.SUBCATEGORY1_ID %&gt;'; var subcategory2Param = '&lt;%# CQueryStringParameters.SUBCATEGORY2_ID %&gt;'; var imgUrl = '&lt;%# UserControls_JsTop.sidebarBannerUrl %&gt;'; &lt;/script&gt; </code></pre> <p>and use it here (imgUrl):</p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; $(function () { $(document.body).sidebar({ size: "30px", // can be anything in pixels length: "270px", // can be anything in pixels margin: "300px", // can be anything in pixels position: "left", // left / bottom / right / top fadding: "0.8", // 0.1 to 1.0 img: imgUrl, openURL: "www.twitter.com/amitspatil" }); }); &lt;/script&gt; </code></pre> <p>I do not understand why it is empty. Please trust me that there is a record in DB with that condition.</p> <p>I think there is some js problem when loading the var...</p> <p>Do you know where?</p> <p>thanks</p>
c# asp.net jquery
[0, 9, 5]
3,455,127
3,455,128
Android app UI design
<p>I'm just trying to make an android app design similar to the one in the link below.</p> <p><a href="http://itunes.apple.com/gb/app/id406490694?mt=8" rel="nofollow">http://itunes.apple.com/gb/app/id406490694?mt=8</a></p> <p>how would I go about making a multiple page application like this? I've only ever worked on single page applications so any advice you have would be great.</p> <p>How would I make the buttons at the bottom change the page etc?</p> <p>Thanks,</p> <p>David</p>
java android
[1, 4]
4,750,719
4,750,720
access static variable from aspx page
<pre><code> public partial class Page1 :System.Web.UI.Page { public static LGDP.LDGPSession var1 = null; private void Login(this, EventArgs e) { var1 = new LGDPSession(this, data, data); } public bool IsLoggedIn() { bool login = false; if (var1 != null) { login = true; } return var1; } } </code></pre> <p>How do I access the Page1 static var1 or function IsLoggedIn() from Page2.apsx ?</p> <pre><code> public partial class Page2 :System.Web.UI.Page { Page1.(nothing shows up here) } </code></pre> <p>ANSWER ----- created separate class and accessed public var in pageload / postback</p> <pre><code>private static bool _login = false; public static void SetLoggedIn(object lgdps) { if (lgdps == null) { _login = false; } if (lgdps != null) { _login = true; } } public static bool IsLogin { get { return _login; } } </code></pre>
c# asp.net
[0, 9]
3,155,619
3,155,620
how to connect (Web Server -----> Android PDA) not (PDA -----> webserver)
<p>pda android connection to the web server I know but the problem is how the web server initiate the connection to the PDA for remote method or sql query how to connect (Web Server -----> Android PDA) not (PDA -----> webserver)</p>
php android
[2, 4]
2,095,120
2,095,121
Is it possible to force Activities to get re-drawn when the back key is used?
<p>I understand the concept of the back-stack, so I'm pretty sure this isn't possible but thought I'd ask anyway.</p> <p>If it isn't, then what is the approach to simulate this behavior? For instance, I have an Activity "A1" that starts another Activity "A2". "A2" alters the content that "A1" shows. When the back button is pressed, the old "A1" is displayed with the old content. Whenever "A1" is called again then the new "A1" will show the new content.</p> <p>How do developers get around this issue?</p>
java android
[1, 4]
4,723,480
4,723,481
jQuery [object Object] Issue
<p>I am wanting to update a css attribute using jQuery but it isnt working. Using the alerts in the code below my first alert brings up </p> <pre><code>url("file:///H:/Web/example/HTML/images/red-arrow-up.png") </code></pre> <p>but then the second alert (in the if statement) brings up </p> <pre><code>[object Object] </code></pre> <p>But what i want it to do is update the attribute and change up to down in the url. Any idea what im doing wrong?</p> <pre><code> $(document).ready(function() { $( ".portlet-header" ).click(function() { var currValue = $(this).children(".portlet-arrow").css("background-image"); alert (currValue) if ($("currValue:contains('up')")) { var newValue = $(currValue.replace("up", "down")); alert(newValue) $(this).children(".portlet-arrow").css("background-image", newValue) }; if ($("currValue:contains('down')")) { var newValue = $(currValue.replace("down", "up")); alert(newValue) $(this).children(".portlet-arrow").css("background-image", newValue) }; }); }); </code></pre>
javascript jquery
[3, 5]
2,657,381
2,657,382
Javascript how to split newline
<p>I'm use jquery, and I have a textarea, so when I submit button I will alert every text separate by newline. How to split from newline?</p> <pre><code> var ks = $('#keywords').val().split("\n"); (function($){ $(document).ready(function(){ $('#data').submit(function(e){ e.preventDefault(); alert(ks[0]); $.each(ks, function(k){ alert(k); }); }); }); })(jQuery); </code></pre> <p>example input :</p> <pre><code>Hello There </code></pre> <p>Result I want is :</p> <pre><code>alert(Hello); and alert(There) </code></pre>
javascript jquery
[3, 5]
1,493,160
1,493,161
onclick call jQuery function
<p>I have form with actively populated elements, something like:</p> <pre><code>&lt;input id="id1" type="button" name="some_name"&gt; &lt;input id="id2" type="button" name="another_name"&gt; </code></pre> <p>etc.</p> <p>My options are limited here.</p> <p>I do not know id, as it is assigned by system dynamically (see: 1,2 next to id), so I cannot call JQ function by #. Order of elements change, they are shown in different sets etc.</p> <p>Class manipulation is not practical. Same goes for any other attrib - pretty much - some are used, some may be used - again - dynamically, so I do not want to mess with it.</p> <p>I can attach a js event thou (during form generation), e.g. onClick to particular, desired item.</p> <pre><code>&lt;input id="id1" onClick="myFunc()" type="button" name="some_name"&gt; &lt;input id="id2" type="button" name="another_name"&gt; </code></pre> <p>I would not need to know id, class or anything in standard JS, since if element with myFunc is clicked, function is fired.</p> <p>Is it possible to accomplish something similar with JQ?</p>
javascript jquery
[3, 5]
3,494,702
3,494,703
ASP.Net: Users are logged out when deploying a new file to the server
<p>Everytime I upload a file to my ASP.NET site, all users are logged out (aka, I guess their session become invalidated). </p> <p>Is there any way to "hotswap" the code in ASP.NET so that this doesn't happen? Compile before deploying etc. </p> <p>My deployment method is pretty simple through a SVN update. </p> <p>Thanks! /Niels</p>
c# asp.net
[0, 9]
1,419,645
1,419,646
do you use built in Stack/Queue/List or Vector in your program?
<p>Yesterday i saw in a post a guy said that built in Stack/Queue are 5x slower than a normally coded Stack/queue !<br> Is it true ?<br> If true then why Microsoft (C#.NET,VB.NET) or Oracle (JAVA) is giving such ADT ?<br> Which one you prefer ? Writing your own or using the built in ? </p> <p>[I think most of the people prefer the built in as the code have been tested many times and is very very optimized]</p>
java c#
[1, 0]
5,811,239
5,811,240
Where can i download the iLOCOi2 mobile app source code?
<p>i am a newbie for this kind of development. i am creating a mobile application which involves tracking, and where to download the source codes of iLOCi2 mobile application for my references. pls help me.</p>
java iphone android
[1, 8, 4]
1,184,127
1,184,128
javascript : Event execute multiple time after loading page via ajax.
<p>I have created a page which will be loaded via ajax. On this page i have created a function which will assign some function for the specified keys [I'm using jquery Hot keys].</p> <p>Here is the function that i use to assign functions</p> <pre><code>function setupKeys() { $.each(keyMap, function (event, listener_name){ $(document).bind('keydown', event, listener[listener_name]); }); } </code></pre> <p>This will be executed each time when page is loaded.</p> <p>If l load the page for the first time and press enter key the function will executed. Suppose if i load the page again via ajax with out refersing the browser and press the enter key the function executes two times. And i repeat the same the function will be executes three times.</p> <p>How can i avoid this? keyMap is an object</p> <pre><code>keyMap = { 'Ctrl+s':'save_data', 'return':'test_return', 'tab':'test_return' }; </code></pre> <p>listener = new Array();</p> <p>Please help. </p> <p>[sorry for the poor English]</p> <p>Krish.</p>
javascript jquery
[3, 5]
5,446,611
5,446,612
Javascript get date from class and add an image
<p>Basically I wanted a way to have Javascript look through my HTML for hidden dates with a certain class, parse the date and check if it is greater than today's date. If that is true add an image to the parent element. It looks like it works but is this the best way to write the code?</p> <pre><code>$(".myClass").each(function() { var u = Date.parse($(this).text()); var v = [u.valueOf()]; var t = new Date(); var d = Date.parse(t) if (v[0]&gt;d) { $($(this).parent()).append("&lt;img src='css/img/new.png' alt='icon' title='New Document' class='documentIconText' /&gt;"); } }); </code></pre>
javascript jquery
[3, 5]
5,245,595
5,245,596
Use down and up keys to move to the next and previous elements
<p>I have a <a href="http://www.sportannica.com" rel="nofollow">drop down box</a> that appears upon keyup via javascript. I'd like to take it a step further and make it so that it can be navigated via the keyboard. Any ideas how this can be accomplished? Preferably via jquery.</p>
javascript jquery
[3, 5]
987,293
987,294
What is an alternative to setInterval in jQuery?
<p>I am using jQuery to call a function when a button is clicked. This function that is being called is in PHP and returns logging information. I have tried to use <code>setInterval()</code> but it calls the function at whatever rate I choose and tends to return duplicate logging information and most of the time it freezes. Is there a way that I can make repeated calls to a PHP function from jQuery, but only call the function after the last call is finished and returned?</p> <p>Here is the jQuery code that makes involves the <code>setInterval()</code></p> <pre><code>setInterval( function(){ $.getJSON("ajax.php?function=tail&amp;pointer=" + ftell, function(data){ var obj = []; obj = $.parseJSON(data); ftell = obj[0]; $("#tail").append(obj[1]); }); }, 2000); </code></pre> <p>Here is the PHP function that it calls</p> <pre><code>function tail(){ $file = "/path/to/the/log/file.log"; $handle = fopen($file, "r"); clearstatcache(); $currentSize = filesize($file); $offset = $_REQUEST['pointer'] - $currentSize; if ($_REQUEST['pointer'] == 0) { fseek($handle, -1024, SEEK_END); } else { fseek($handle, $_REQUEST['pointer'], SEEK_END); } while ($buffer = fgets($handle)) { $log .= $buffer . "&lt;br /&gt;"; } fclose($handle); $results = array('0' =&gt; $currentSize, '1' =&gt; str_replace('"', '\"', $log)); echo json_encode($results); } </code></pre>
php jquery
[2, 5]
603,975
603,976
Extending objects with JQuery, Object has no method error
<p>I have this javascript code:</p> <pre><code>var TodoController = { init: function() { $(this).find('input.todo_check').click(function(){ $(this).parents('li.todo').done(); }); } } var Todo = { done: function() { $(this).toggleClass('done'); } } $(document).ready(function() { $("li.todo").extend(Todo); $("#todo_list").extend(TodoController).init(); }); </code></pre> <p>When I click on a 'input.todo_check' I expect done() function, on 'li.todo', to be executed. But I get:</p> <p>=> Uncaught TypeError: Object [object Object] has no method 'done'</p> <p>What I'm doing wrong? </p> <p>This statement should add 'done()' function to "li.todo" elements?:</p> <pre><code>$("li.todo").extend(Todo); </code></pre> <p>Thanks. JM</p>
javascript jquery
[3, 5]
5,079,947
5,079,948
How to get the element id of the html page displayed
<p>I have a web view and a button at the bottom . After loading the html page into the web view, when I click on the button I need to get the id of the current focused html element id from the html page. How to get that..?? Help me friends,current focused element in the sense may be the first topic element of the page displayed.</p>
javascript android
[3, 4]
5,134,297
5,134,298
Javascript post to PHP and get back an array?
<p>So i have this piece of javascript, it posts to <code>foo.php</code> with value <code>val</code>, gets back <code>data</code>, empties the container and call function <code>graph</code> which will fill the container with a new chart.</p> <pre><code>$.post("foo.php", {val: val}, function(data){ if(data.length &gt;0) { $('#container').html(''); graph(data); } }); </code></pre> <p>in <code>foo.php</code>, how do I make it pass back an array instead of string? at the moment I just have an <code>echo</code> in <code>foo.php</code> that echos the data delimited by a comma, ie: <code>1,2,3,4,5</code>. then in the <code>graph</code> function I have a <code>split(',' data)</code> that creates an array for later use.</p> <p>I mean, all this works fine, I'm just wondering if I can avoid the split step and have <code>foo.php</code> return an array directly.</p> <p>thanks!</p>
php javascript
[2, 3]
4,087,291
4,087,292
Converting a piece of C++ to Python
<p>I'm trying to convert this C++ to Python. I practice Python only and haven't touched C/C++ yet.</p> <pre><code>int phi(const int n) { // Base case if ( n &lt; 2 ) return 0; // Lehmer's conjecture if ( isprime(n) ) return n-1; // Even number? if ( n &amp; 1 == 0 ) { int m = n &gt;&gt; 1; return !(m &amp; 1) ? phi(m)&lt;&lt;1 : phi(m); } // For all primes ... for ( std::vector&lt;int&gt;::iterator p = primes.begin(); p != primes.end() &amp;&amp; *p &lt;= n; ++p ) { int m = *p; if ( n % m ) continue; // phi is multiplicative int o = n/m; int d = binary_gcd(m, o); return d==1? phi(m)*phi(o) : phi(m)*phi(o)*d/phi(d); } } </code></pre> <p>Most of it is straightforward to convert, it just requires looking up C++ operators. However, this bit:</p> <pre><code> for ( std::vector&lt;int&gt;::iterator p = primes.begin(); p != primes.end() &amp;&amp; *p &lt;= n; ++p ) </code></pre> <p>What does it mean in Python?</p>
c++ python
[6, 7]
4,801,284
4,801,285
button1.Attributes.Add("onclick", "javascript:window.open('page1.aspx?CheckedItem=" + checkedItem.ToString() + "'');"); is not working properly
<p>my client side code button1.Attributes.Add("onclick", "javascript:window.open('page1.aspx?CheckedItem=" + checkedItem.ToString() + "','mywindow',');"); is not executing on the first click.But it is working fine from second click onwards.I wrote this code inside the button click event.</p> <p>I had tried to put this inside the page_load ,but the problem is i need to return a value from this page. here is the code</p> <pre><code>protected void btnPreview_Click(object sender, EventArgs e) { //StringBuilder checkedItem = new StringBuilder(); checkedItem.Length = 0; foreach (ListItem i in chkValidation.Items) { if (i.Selected) { if (string.IsNullOrEmpty(Convert.ToString(checkedItem))) { checkedItem.AppendFormat(i.Text); } else { checkedItem.AppendFormat(","); checkedItem.AppendFormat(i.Text); } } btn_Preview.Attributes.Add("onclick", "javascript:window.open('TimePhaseAttributePreview.aspx?CheckedItem=" + checkedItem.ToString() + "','mywindow','menubar=0,resizable=0,width=350,height=250');"); } </code></pre> <p>Please help me</p>
c# javascript asp.net
[0, 3, 9]
1,686,194
1,686,195
What is console.log and how do I use it?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4539253/what-is-console-log">What is console.log?</a> </p> </blockquote> <p>I see this line in a lot of jquery scripts out there. I assume it's used for debug.</p> <p>Where can I see this log?</p>
javascript jquery
[3, 5]
4,895,406
4,895,407
Creating a Game Server
<p>I'm interested in creating a server for an undetermined multiplayer game, either PC or mobile based. Any game server would obviously be event driven, asynchronous, and fast. I'm very experienced in web development, where it's common to use a framework such as Symfony for PHP or Django for Python. </p> <p>Is there anything comparable to web frameworks for high performance game server development? ROS (Robot operating system) is an example of a complex C/C++ framework which is optimized for real time performance and includes common robot functionality. Is there something comparable designed for games?</p> <p>Right now I'm most interested in creating a browser based WebGL game or an iPhone game. As such, I'm thinking of using Django as my request handler, and just doing communication over AJAX. I know that'd work nicely for a PC web game, but I'm not sure what the best ways of doing remote communication with an iPhone/other mobile device. Is it common to use a web framework to arbitrate mobile apps?</p> <p>This is an open ended question, so any advice, thoughts, or links to further readings are much appreciated. If anyone has any good reading material I'd love to take a look.</p>
android iphone
[4, 8]
3,234,840
3,234,841
ASP.NET one-to-one chat application
<p>I have developed a simple ASP.NET Ajax chat appliaction.I want to upgrade it.In my project I have an online user list and I am clicking one of them to open a new web browser window (I am doing this with javascript window.open() ). Now I want to improve my project.</p> <p>I want to open a dynamic div instead of a new window. This can be a jquery chat box as well. So my question is:</p> <p>How i will open that div or jquery box and how I will import my asp.net controls (update panel, timer etc.) into to that dynamic div ??</p>
javascript jquery asp.net
[3, 5, 9]
4,582,703
4,582,704
jQuery: select random elements
<p>How can I select the first 5 random elements</p> <pre><code>&lt;ul&gt; &lt;li&gt;First&lt;/li&gt; &lt;li&gt;Second&lt;/li&gt; &lt;li&gt;Third&lt;/li&gt; ... &lt;li&gt;N&lt;/li&gt; &lt;/ul&gt; </code></pre> <p><a href="http://blog.mastykarz.nl/jquery-random-filter/" rel="nofollow">I'm using this plugin</a>:</p> <pre><code>alert($("li:random").text()); </code></pre> <p>but it takes all random elements. I only want the first 5.</p> <p>Is there another way to do the same thing?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
2,120,425
2,120,426
Browsers syntax error in js depending on the server...only for some browsers
<p>This is a follow up to: <a href="http://stackoverflow.com/questions/6680244/debian-all-browsers-jquery-compressed-breaks-all-js-but-uncompressed-works-fin">Debian - all browsers jquery compressed breaks all js, but uncompressed works fine</a></p> <p>I have more information now that requires a new way of thinking about it.</p> <p>A user when connecting to an apache server and is served a minified version of jquery-1.6.2 results in a syntax error in the file, when it does not have one, causing the whole program to break.</p> <p>When that same file is served from a nginx server, the error goes away and it works correctly.</p> <p>Is there anything that can cause javascript to get served incorrectly from the server side?</p> <p>EDIT: Turns out even this even causes javascript errors (http://muench.homeip.net/jquery/jquery-1.5.1-remote.html) Just including jquery 1.5.1</p>
javascript jquery
[3, 5]
2,747,651
2,747,652
Hidding or deleting text nodes
<p>I need to hide all form's content and replace it ( .find('*').each() {$(this).hide} doesn't work) I have problem hiding text nodes :</p> <pre><code> &lt;form onsubmit="javascript:... "&gt; &lt;!--text node --&gt; bad&amp;nbsp; &lt;input type="radio" name="imgvote" value="1" style="display: none;"&gt; </code></pre>
javascript jquery
[3, 5]
3,544,445
3,544,446
Run jquery image resizer after image is appended
<p>I am using this jQuery plugin to re-size images. <a href="http://hirdet2.extra.hu/kepresize/" rel="nofollow">http://hirdet2.extra.hu/kepresize/</a> .</p> <pre><code>$(document).ready(function(){ $('#content img').kepresize({maxWidth: 200,maxHeight: 150}); .... .... $('#content').append('&lt;img src="pathtofile"/&gt;'); }); </code></pre> <p>However, these images are only being appended after the document loads, depending on the users actions. Therefore the appended images are not being re-sized. </p> <p>I have had a play around with .live() but can't seem to get it right.</p> <p>Any help would be much appreciated.</p>
javascript jquery
[3, 5]
3,086,582
3,086,583
Explain this: CheckBox checkbox = (CheckBox)sender;
<p>While going through the checkBox I found there is written </p> <pre><code>CheckBox checkbox = (CheckBox)sender </code></pre> <p>on <code>checkBox1_CheckedChanged</code> event.</p> <p>Please explain what it means?</p>
c# asp.net
[0, 9]
5,453,610
5,453,611
How to save a newly created dropdown and textfield in my database that are created from clicking a botton
<p>I have this code on my page. It creates a checkbox, dropdown and textbox in one table row by the click of a botton. My issue is, when i click the save botton it doesnt save the created checkbox, dropdown and textbox, it only saves the one that was first showing on the page. function addRow(tableID) { var table = document.getElementById(tableID);</p> <pre><code> var rowCount = table.rows.length; var row = table.insertRow(rowCount); var colCount = table.rows[0].cells.length; for(var i=0; i&lt;colCount; i++) { var newcell = row.insertCell(i); newcell.innerHTML = table.rows[0].cells[i].innerHTML; //alert(newcell.childNodes); switch(newcell.childNodes[0].type) { case "text": newcell.childNodes[0].value = "".id = "percent"; break; case "checkbox": newcell.childNodes[0].checked = false.id = "checkbox"; break; case "create_select_box": newcell.childNodes[0].selectedIndex = "0" .id = "percentage"; break; } } } function deleteRow(tableID) { try { var table = document.getElementById(tableID); var rowCount = table.rows.length; for(var i=0; i&lt;rowCount; i++) { var row = table.rows[i]; var chkbox = row.cells[0].childNodes[0]; if(null != chkbox &amp;&amp; true == chkbox.checked) { if(rowCount &lt;= 1) { alert("Cannot delete all the rows."); break; } table.deleteRow(i); rowCount--; i--; } } }catch(e) { alert(e); } } </code></pre> <p> </p>
php javascript
[2, 3]
4,455,172
4,455,173
android: how to pass values from one broadcast receiver to another?
<p>i have this broadcastreceiver that executes some code from time to time and triggers itself again by setting a timer (alarmmanager). the result of the calculations is an integer value, which should be used as input for the next time the algorithm is executed. therefore, i need to store this value.</p> <p>i don't want to do this with SQLite as this would produce an enormous overhead - but what are the alternatives? manage this via shared preferences? store it within files?</p> <p>any good ideas?</p>
java android
[1, 4]
2,097,759
2,097,760
Resources.getString() method doesn't exist
<p>From book I learned:</p> <blockquote> <p>For standard strings use Resources.getString(R.string.deal_details) For plurals use Resources.getQuantityString(R.plurals.deal_service_ new_deal, 1);</p> </blockquote> <p>But <code>Resources</code> class doesn't have this method. Why? Whaat is wrong here?</p>
java android
[1, 4]
2,004,722
2,004,723
javascript event listener for changes in an object variable
<p>I have an object variable that has several properties.</p> <pre><code>MyVar = {"prop1" : 0, "prop2": 0....}; </code></pre> <p>How do I write an event listener that listens for a change in any of the properties.</p> <p>Thanks for your suggestions.</p>
javascript jquery
[3, 5]
327,872
327,873
DataTable.Select() Property: Giving Index Out of Bound Exception
<p>I'm trying to select only those rows which have Parent ID = 0</p> <p><pre></p> <code>int predecessor = Parent; StringBuilder valuePath = new StringBuilder(); valuePath.Append(Parent.ToString()); DataRow[] drPar; while (true) { drPar = dt.Select("MenuID=" + predecessor); if (drPar != null) { if (drPar[0]["ParentID"].ToString().Equals("0")) break; } </code></pre> <p> </p> <p>drPar[0]["ParentID"].ToString().Equals("0") is giving me Out of Bound exception ..</p> <p>Help Please !</p>
c# asp.net
[0, 9]
1,565,227
1,565,228
Function c++ ,equivalent in java
<p>I have the following problem, the following program is in c + +.;</p> <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #include &lt;malloc.h&gt; typedef enum { TR, SYS, INT, BAT } TIPOS ; typedef enum { LIBRE , EJECUCION , LISTO , BLOQUEADO } PCBestado ; struct PCB { int PID; PCBestado estado ; TIPOS tipo ; int mem , dir ;long hora , totalCPU , UsoContCPU, consumidoCPU, consContCPU; struct PCB * sig , *ant ; }; struct PCB *libres = NULL; // something .... ... .. /// function for list void iniPCBpool( int n ) { int f ; struct PCB ** p , *ant = NULL ; for( p = &amp;libres , f = 0 ; f &lt; n ; f++ ) { if( ( *p = (struct PCB *)malloc( sizeof( struct PCB ) ) ) == NULL ) terror("Sin memoria"); (*p)-&gt;ant = ant; ant = *p ; p = &amp;(*p)-&gt;sig ; } *p = NULL ; } </code></pre> <p>what I need is to make this code but in java.</p> <p>Help me, please. Thanks.</p>
java c++
[1, 6]
4,855,506
4,855,507
jquery show/hide two divs on click and hide link
<p>Im using the following JS</p> <pre><code>&lt;a href=# onClick="if($(this).next('div').css('display') == 'none') { $(this).next('div').show('fast'); } else { $(this).next('div').hide('fast'); } return false;"&gt;Add a Street Address&lt;/a&gt; </code></pre> <p>and the following html</p> <pre><code>&lt;div id=entry&gt; &lt;div id=label&gt;Street&lt;/div&gt; &lt;div id=input&gt;&lt;input name="" type="text" class="longtext" /&gt;&lt;/div&gt;&lt;/div&gt; &lt;div id=entry&gt; &lt;div id=label&gt;City/Town&lt;/div&gt; &lt;div id=input&gt;&lt;input name="" type="text" class="longtext" /&gt;&lt;/div&gt;&lt;/div&gt; </code></pre> <p>How would i modify the JS to show/hide both of those divs at once, and then make the link disappear?</p>
javascript jquery
[3, 5]
480,851
480,852
Converting array/matrix initialization code from C++ to C#
<p>I am in the middle of converting C++ code to C#. I am having trouble with some C++ array static initialization. Consider the following piece of C++:</p> <pre><code>int Values[][32] = { {}, {}, {1, 2, 3}, {1} }; </code></pre> <p>What this does is creates a matrix of 4x32 integers. I need to do same or similar in C# in as straightforward way as possible. I am looking to get either</p> <pre><code>static int[][] Values = {...}; </code></pre> <p>...or</p> <pre><code>static int[,] Values = {...}; </code></pre> <p>The thing is C# does not seem to allow array initialization with uneven sub-array sizes. Other than this, if one specifies <code>new int[4,32] {...}</code> then everything between curly braces must be of exactly 32 length. With C++ one can specify <code>{1, 2, 3}</code> and the compiler will fill in the rest of the missing array members with zeros.</p> <p>[EDIT] I have tried using LINQ and got what I desire but it looks cumbersome.</p>
c# c++
[0, 6]
2,405,728
2,405,729
How to get an image name using jQuery?
<p>Let's says I have :</p> <pre><code>&lt;img src='static/images/banner/blue.jpg' /&gt; </code></pre> <p>Using jQuery, how could I get the <code>blue</code> data ?</p> <p>If I use <code>$('img').attr('src')</code>, I can get the whole URI. In that case, what is the best way to remove the extension and all the path ?</p>
javascript jquery
[3, 5]
4,711,505
4,711,506
How can it be detected if a page is on background or foreground with jquery/javascript?
<p>The title explains itself. How can I detect if a web page has gone to background?</p> <p>I'm implementing a chat application and I'll use this information to decide showing new message notifications. I suppose that GMail uses something like that. If the page is on background, it shows desktop notifications (on chrome), if not it doesn't show them.</p>
javascript jquery
[3, 5]
5,383,109
5,383,110
Javascript function not displaying values or writing them to textbox
<p>Basically I am creating a simple function in javascript to check if a textbox value has changed from what it was originally and if so to warn the user the impact the change will have. If the user clicks yes, do nothing, if they click no then I want to set the value of the textbox back to the original value it should be for them.</p> <p><em>EDIT</em></p> <p>Okay it seems I was mistaken as to the root of the problem. It seems that the inpUsername which is a hidden input I have is blank from the beginning. How do I set it correctly in the asp portion of the code so it takes the value of another textbox on the same control?</p> <p>I currently have:</p> <pre><code>&lt;input type="hidden" id="inpUsername" runat="server" value= %#DataBinder.Eval(Container.DataItem,"txtUsername")%&gt; /&gt; </code></pre> <p>This returns the error: BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'. However if I add additional quotes around the value it outputs "/> to the screen</p> <p>The txtUsername declaration as requested is:</p> <pre><code>&lt;asp:TextBox ID="txtUsername" runat="server" CssClass="Textbox" Style="width:100%" onchange="checkForUsernameChange()"/&gt; </code></pre>
javascript asp.net
[3, 9]
218,753
218,754
Android database from website
<p>i was wondering a few things.</p> <p>I Have a database with 3 rows, and i have to use the database on my website cause it has to be shared with every one that downloads my app cause they can add more things.</p> <p>Table is called </p> <p>Poka</p> <p>And the rows are - ID - word(TEXT) - reply(TEXT)</p> <p>The Reply is hooked onto the word.</p> <p>Sense there can be more then 1 of the same "word" text i need it to search threw each of the word that was inputed in the EditText and pick a random reply from that and display it in EditText . And if there are no words, it will say cannot find one.</p>
java android
[1, 4]
1,468,905
1,468,906
a relationship between C++ / C# and PHP
<p>I couldn't find any document about a relationship between C++ / C# and PHP. Can someone share example page or codes ( like echo, functions etc ) ? thank you</p> <p>--- edit -- I want to use C++ or C# in PHP</p>
c# php c++
[0, 2, 6]
601,190
601,191
Creating divs with different id's
<p>i have one question regarding creation of divs:</p> <p>I have button, when user clicks on it, javascript (or jquery) needs to create a div. But when user clicks again, it should create another div, but with different id. So, every time user clicks should be created div with different id.</p> <p>I partialy know how to create div, but i have no idea how to make divs with different id's.</p>
javascript jquery
[3, 5]