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
5,574,291
5,574,292
How to make android phone silent in java
<p>Hi I am new to android development. I am trying to make my android phone silent using java. After searching google I found some examples but they didnt workd for me. Here is my code.</p> <pre><code>package com.zafar.silent; import android.app.Activity; import android.content.Context; import android.media.AudioManager; import android.os.Bundle; public class Silent extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); AudioManager audiomanage = (AudioManager)getSystemService(Context.AUDIO_SERVICE); audiomanage.setRingerMode(AudioManager.RINGER_MODE_SILENT); } } </code></pre> <p>Can someone help me how can I make this run?</p> <p>Thanks in advance</p> <p><strong>Update</strong></p> <p>Here is my menifest file</p> <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.zafar.silent" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="10" /&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" &gt; &lt;activity android:name=".Silent" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;uses-permission android:name="android.permission.WRITE_SETTINGS"/&gt; &lt;uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p><strong>I updated menifest file</strong></p>
java android
[1, 4]
1,175,135
1,175,136
Tables: selected rows and loop through column JQuery&JavaScript
<p>I have two questions :)</p> <ol> <li><p>Im using Jquery to select table rows and checkbox in the first column, how can I make 2 and 7 columns not clickable. I mean if you click 7 column's cell, it will not select checkbox and will not add 'selected' class.</p> <pre><code>$('#tableID tbody tr') .filter(':has(:checkbox:checked)') .addClass('selected') .end() .click(function (event) { $(this).toggleClass('selected'); if (event.target.type !== 'checkbox') { $(':checkbox', this).attr('checked', function () { return !this.checked; }); } }); </code></pre></li> <li><p>I'm using JavaScript to add all one column values, the script is working fine when the table doesn't have merged cells. How to make it work with merged cells.</p></li> </ol> <pre><code>_________ _________ |_|_|_|_| | |_|_| |_|_|_|_| script working |___|_|_| script doesn't work |_|_|_|_| |_|_|_|_| |_|_|_|_| |___|_|_|</code></pre> <pre><code>function count() { var i; var sum=0; var table = document.getElementById("tableID"); for (i=1;i&lt;table.rows.length-1;i++) { sum += Number(table.rows[i].cells[3].innerHTML, 10); } document.getElementById('sum1').innerHTML = sum; } </code></pre> <p>HTML code for the second part: <a href="http://jsfiddle.net/f4zH9/" rel="nofollow">http://jsfiddle.net/f4zH9/</a></p> <p>Thanks</p>
javascript jquery
[3, 5]
1,346,453
1,346,454
Checking if jquery is loaded using Javascript
<p>I am attempting to check if my Jquery Library is loaded onto my html page. I am checking to see if it works, but something is not right. Here is what I have.</p> <pre><code> &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;script type="text/javascript" src="/query-1.6.3.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).Ready(function(){ if (jQuery) { // jQuery is loaded alert("Yeah!"); } else { // jQuery is not loaded alert("Doesn't Work"); } }); </code></pre>
javascript jquery
[3, 5]
1,924,138
1,924,139
Android SQLite sync updates from server
<p>I just wanted some advice. I have an app with a database that will be updated once a week. In my opinion there is no point having users download the app again each week. Nor is there a reason for the entire database to be downloaded once a week.</p> <p>My idea is to send a request to a server every time the app is opened with the version of the database. The server compares this version to the current and if it is out of sync the rows will be returned via something like a json reply.</p> <p>If there are better methods for this or if there are valid reasons why the options I have discounted are much better, please do tell me.</p>
java android
[1, 4]
1,093,025
1,093,026
How to set more than one alarm for calendar events in android?
<p>I have already worked on calendar events and for each event the alarm should ring with notification. The problem i face is, If i set more than one event, the last set event is alone notifying the user with alarm. But all the other events doesn't ring alarm. Any Help is appreciated and thanks in advance...</p>
java android
[1, 4]
383,220
383,221
developing cross platform games for android and iPhone?
<p>I know this question has been asked before but I really couldn't find anything that would suit my needs..So I want develop a 2d game that is something like Draw Something. the game is not really heavy on graphics or anything like that so what is the best Development enviroment for my game thanks</p>
android iphone
[4, 8]
683,383
683,384
Add random number to .css so it doesn't cache
<p>I'm trying to get the styles.css to not cache as the server is having issues with the css when it caches.</p> <pre><code>&lt;script&gt; var numBAH = Math.floor(Math.random()*100); &lt;/script&gt; &lt;link href="styles.css+ numBAH +" rel="stylesheet" type="text/css" /&gt; </code></pre>
javascript jquery
[3, 5]
5,791,659
5,791,660
Android app crashing at starup
<p>I have written a quick android add to display the SSID of the wifi network connected to along with the device ip address. the code is: </p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Context context = getApplicationContext(); WifiManager wifi_man = (WifiManager)context.getSystemService(Context.WIFI_SERVICE); if(wifi_man.isWifiEnabled()==true) { System.out.println("inwifi"); WifiInfo wifi_info = wifi_man.getConnectionInfo(); String ssid_name = wifi_info.getSSID(); TextView temp = (TextView)findViewById(R.id.widget40); CharSequence sentence = "SSID NAME : "+ssid_name; temp.setText(sentence); int temp2 = wifi_info.getIpAddress(); String ip_addr = Formatter.formatIpAddress(temp2); temp = (TextView)findViewById(R.id.widget41); CharSequence sent = "IP ADDRESS : "+ip_addr; temp.setText(sent); } } </code></pre> <p>however the app process crashes as soon as it starts ... any idea why. also i am confused as to the entry point into my code. do i just put my apps code at the end of the onCreate process?</p>
java android
[1, 4]
4,010,548
4,010,549
How a HTTP server respondes to a client's request
<p>could you please give me a sample code on how an Http Server(Java) receives the request of a client(android)? I mean the client sends the request via Httppost, how the server takes the content of these requests in order to see the context and reply? I am trying to built a chat application.</p> <p>Thank you in advance!</p>
java android
[1, 4]
3,147,335
3,147,336
when i click on anchor i need to enable text field
<p>I have a anchor tag, with id="click_me". When i click on this i should enable input text (<code>&lt;input type="text" id="summary" class="summary"&gt;</code>), which is disabled first.</p> <p>even i can do it using javascript function, by calling these javascript function() using onclick in the tag; but in my application i shld not use these. </p> <p>I am newbie to php. please suggest me any alternative solution either using DOM or anything else. Thanks in advance</p>
php javascript jquery
[2, 3, 5]
4,687,840
4,687,841
Issue while access contacts of android
<p>I am new for android development. I am trying read and write contacts to android addressbook.</p> <p>I tried following line of code for write name into android</p> <pre><code>public class SecondApp extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ContentValues values = new ContentValues(); values.put(Contacts.People.NAME, "Rishabh"); ContentResolver cr = getContentResolver(); Uri uri = cr.insert(People.CONTENT_URI, values); </code></pre> <p>but i am getting "The application has stopped unexpectedly. Please try again" message.</p> <p>what is wrong in it ? How can i access contacts of android ?</p> <hr> <p>Hi MannyNS thanks for reply I have given write permission as you defined above.</p> <p>but i am still getting the "The application has stopped unexpectedly. Please try again", even when i start android its giving message "Process android.process media is not responding".</p> <p>Can you suggest me whole procedure to read and write contacts to android ? Do you have any sample code for it ?</p> <p>Thanks Rishabh</p>
java android
[1, 4]
3,131,537
3,131,538
Setting active class for navigation
<p>I have a separate navigation php which has a list of links and menu options:</p> <pre><code> echo "&lt;ul id='menu'&gt;"; //some if loop to do the following: echo "&lt;li&gt;&lt;a href='#'&gt;Adminstration&lt;/a&gt; &lt;ul&gt;&lt;li&gt;"; if($userm == 'R'||$userm == 'RW') { echo "&lt;a href='/N.Jain/administration/usermanagement.php&gt;User Management&lt;/a&gt;"; } </code></pre> <p>This file has 10 such sub-menu. What i am trying to achieve here is that if a User is on this particular page, then the menu should expand and highlight that option.</p> <p>Here is my menu javascript:</p> <pre><code>function initMenu() { $('#menu ul').hide(); $('#menu li a').click( function() { var checkElement = $(this).next(); if((checkElement.is('ul')) &amp;&amp; (checkElement.is(':visible'))) { $('#menu ul:visible').slideUp('normal'); return false; } if((checkElement.is('ul')) &amp;&amp; (!checkElement.is(':visible'))) { $('#menu ul:visible').slideUp('normal'); checkElement.slideDown('normal'); return false; } } ); } </code></pre> <p>Now i am trying to get the link and then set its class to active and then do something: </p> <pre><code>function markActiveLink() { $("#menu li ul li a").filter(function() { var currentURL = window.location.toString().split("/"); return $(this).attr("href") == currentURL[currentURL.length-1]; }).addClass("active"); if($('#menu li ul li a').hasClass('active') == true) { console.log('has'); } } </code></pre>
php javascript jquery
[2, 3, 5]
5,861,175
5,861,176
Post from PHP page to Java program and output result
<p>I have a PHP page on one server, which asks for some login details from a user. </p> <p>I then have a Java application on another server.</p> <p>I am trying to POST the results from the login form to the Java application, then respond with a yes/no as to whether the details were correct. </p> <p>Whats the simplest way of going about this? I have read plenty on using sockets to post from Java, not I can't seem to find a good tutorial that explains how to post from a form, process it and return the results pack to the user.</p>
java php
[1, 2]
1,645,902
1,645,903
HTML table porting to SQL
<p>Is there anyway i can extract data from a HTML table (i tried jsoup) and then save it in SQL for further use and displaying? It's actually a timetable for my classes.</p>
java android
[1, 4]
5,967,347
5,967,348
asp.net + Code behind send table rows to Javascript
<p>I am trying to send some table row data from code behind to process in my Javascript but I get an error in my console: </p> <pre><code>Uncaught TypeError: Object &lt;tr&gt;&lt;td&gt;usr1&lt;/td&gt;&lt;td &gt;Z&lt;/td&gt;&lt;td&gt;40&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;usr2&lt;/td&gt;&lt;td &gt;G&lt;/td&gt;&lt;td&gt;23&lt;/td&gt;&lt;/tr&gt; has no method 'hide' . </code></pre> <p>Can someone please advise what is the problem? Thanks. </p> <p><strong>Javascript:</strong></p> <pre><code> function addRows(rows) { var _rows = $(' ' + rows + ' '); rows.hide(); $('tr:last-child').after(_rows); rows.fadeIn("slow"); } </code></pre> <p><strong>Code Behind:</strong></p> <pre><code> foreach (DataRow row in dt.Rows) { rows += string.Format("&lt;tr&gt;&lt;td&gt;" + row["UserName"] + "&lt;/td&gt;&lt;td &gt;" + row["Name"] +"&lt;/td&gt;&lt;td&gt;" + row["Age"] + "&lt;/td&gt;&lt;/tr&gt;"); } addRows = string.Format("addRows('{0}')", rows); GeneralHelper.RegisterClientScriptBlock(uiupUsr, addRows); </code></pre>
javascript jquery asp.net
[3, 5, 9]
2,067,016
2,067,017
don't work 'fadeOut' If there is 'replaceWith'.?
<p>When i use of <code>fadeOut</code> and <code>replaceWith</code> together, does not work fadeOut. but if i use only of <code>fadeOut</code> it worked. i want use of each tow they together. how is it in my code?</p> <pre><code>$.ajax({ type: "POST", url: url, data: dataString, cache: false, success: function(html){ var $html = $(html); ////////////////////////////////// here //////////////////////////////// $('.ser_form #paginate input:checkbox:checked').parent().parent().fadeOut("slow"); $('#num_count').replaceWith($html.find('#num_count')); $('tr#paginate').replaceWith($html.find('tr#paginate')); $('.pagination').replaceWith($html.find('.pagination')); ////////////////////////////////// here //////////////////////////////// }, </code></pre> <p><strong>EXAMPLE:</strong> <a href="http://www.binboy.gigfa.com/admin/accommodation/show" rel="nofollow">Yourself see</a><p> In example above please check row and click on DELETE to see it.</p>
javascript jquery
[3, 5]
5,667,980
5,667,981
Show/hide part of external .js file
<p>How can I show/hide the answers for below external .js file using a 'toggle' button ? If I had access to the code I could wrap the answers in a div but since this is an external .js file is this possible ?</p> <p>Heres the fiddle &amp; code : </p> <p><a href="http://jsfiddle.net/Wx5mM/" rel="nofollow">http://jsfiddle.net/Wx5mM/</a></p> <pre><code> &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $(".pds-pd-link").hide(); $(".a2a_dd.pds-share").hide(); $(".pds-box").width(220); }); &lt;/script&gt; &lt;script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/5968383.js"&gt;&lt;/script&gt; &lt;noscript&gt;&lt;a href="http://polldaddy.com/poll/5968383/"&gt;This is a test question ?&lt;/a&gt;&lt;/noscript&gt; </code></pre>
javascript jquery
[3, 5]
4,462,898
4,462,899
How can I access buttons using string Ids in ASP.Net?
<p>I am using Asp.Net. I have a page full of buttons and every button has an id example: btn_1_1, btn_1_2 etc. From the code side I have a loop and I am generating the button's Ids as a string using random numbers, example: "btn_1_1", "btn_1_2" etc. . My question is, how I can use this string value to access the button's properties that have the same ID?</p> <p>Thanks</p>
c# asp.net
[0, 9]
2,532,706
2,532,707
How to Add PHP Variables in a Jquery Notification
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/7141860/passing-variables-from-php-to-javascript">passing variables from php to javascript</a> </p> </blockquote> <p>I am using <a href="http://dev.thrivingkings.com/read/Sticky-A-super-simple-notification-system-built-with-jQuery" rel="nofollow">this awesome</a> jQuery Stick Notification Plugin which creates notifications upon clicking various buttons. I used the following code to display the notification box...</p> <pre><code>$(".notify").click(function() { $.sticky('The page has loaded!'); }); </code></pre> <p>Can i make it display some PHP variables in place of static text message?</p> <p>Hope i've made it clear enough.</p>
php jquery
[2, 5]
2,874,137
2,874,138
split values in arraylist and store in different array list
<p>I am doing a project in android ,and i have a problem My array list values like this</p> <p>[name1, addr1, place1, name2, addr2, place2]</p> <p>How can i split this values and want to store name, address, places in different array list?</p>
java android
[1, 4]
5,614,859
5,614,860
Getting ANDROID_ID Trying to understand the java
<p>I'm still new to programming/Java/Android so I'm trying to understand everything I do and trying to figure out how to properly read the reference section of developer.android.com and so maybe one of you guys can help me out. Thanks in advance</p> <p>These calls get me the ANDROID_ID. They both give me the same output. I just do not understand how the Second Way works. It shouldn't work in my opinion. </p> <h2>First way</h2> <pre><code>AndroidID = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); </code></pre> <h2>Second way</h2> <pre><code>AndroidID = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID); </code></pre> <p>Why does it work like that?</p> <p>I used <a href="http://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID" rel="nofollow">this</a> to find the getString() method. I get the ANDROID_ID. It works perfectly using both calls, but I want to know why it works the second way.</p>
java android
[1, 4]
1,845,736
1,845,737
What's the simplest code to make a dialog box with just text and OK/Cancel buttons on Android 4?
<p>Using Android API 14 or higher, what is the easiest way to make a dialog box? All I want is a few lines of text, OK button, and Cancel button. The Cancel button closes the dialog, the OK button performs some method that I have.</p> <p>The reason I ask is because I'm going through a few different tutorial books and many of them seem to make dialog creation an overly complicated process. So I want the absolute simplest way to do this (fewest lines of code).</p>
java android
[1, 4]
3,581,020
3,581,021
Validate Licence key on each page request
<p>I have create a web application which I want to sell to various clients with the source code. This application contains a DLL created by me having various methods outof which there is a method named ValidateLicenceKey(). I want this method to be called by each page for valid licence. To do this there are various ways ( as far as i know )-</p> <ol> <li>Create a BaseClass and call ValidateLicenceKey() method in baseclass and inherite this class on each page so that this method will be called on each page request.</li> <li>Call ValidateLicenceKey() method in Application_Start/Session_Start event of Global.asax file so that even if page is not inherited from Baseclass, this method will be called.</li> <li>Use of HttpModule and Call ValidateLicenceKey() method there and define that in web.config file</li> </ol> <p>I am giving client the flexibility to add new pages/controls in the application as well as he can edit the existing code as per his requirement.</p> <p>Now my question is- Since the client has the source code with DLL he can disable ValidateLicenceKey functionality by</p> <ol> <li>Removing the Baseclass inheritance from all the existing pages as well as do not implement Baseclass inheritance in the new pages created by him.</li> <li>Commenting the line that calls ValidateLicenceKey() method in Global.asax file.</li> <li>Commenting the line in web.config file that defines httpmodule</li> </ol> <p>So how do i force them to call this method.</p> <p>Is their any way to solve this? Please help.</p>
c# asp.net
[0, 9]
523,539
523,540
How to convert element id in Javascript to jQuery?
<p>i dont know, how to chance this script to jQuery, please help JavaScript</p> <pre><code>function show_t(id){ document.getElementById("hide_t_"+id).style.visibility='visible'; } function hide_t(id){ document.getElementById("hide_t_"+id).style.visibility='hidden'; } </code></pre> <p>this is div element on php, with above script</p> <pre><code> &lt;div class='item' onMouseOver="show_t('$dataBB[0]')" onMouseOut="hide_t('$dataBB[0]')"&gt; </code></pre> <p>I have trouble, when I change with this script</p> <pre><code>$("#show_t1"+id).mouseover(function(){ document.getElementById("hide_t_"+id).style.visibility='visible'; }).mouseout(function(){ document.getElementById("hide_t_"+id).style.visibility='hidden'; }); </code></pre> <p>the <em>div</em> element for script on above is</p> <pre><code>&lt;div id="show_t$dataBB[0]"&gt; &lt;span id='hide_t_$dataBB[0]' class='hide_input'&gt; &lt;/span&gt; &lt;/div&gt; </code></pre> <p>You can see what I means in <a href="http://www.tumbasklik.com" rel="nofollow">www.tumbasklik.com</a></p>
php javascript jquery
[2, 3, 5]
3,652,642
3,652,643
How do I draw an image inside an Android master-detail app?
<p>I'm new to android, so bear with me. Yesterday I started up an Android Master Detail project (Default Settings), and started looking around. I located a few lines of code nside com.myname.appname.ItemDetailFragment that looked like they were what was doing the changing of text in the secondary window. The related code is</p> <pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_item_detail, container, false); // Show the dummy content as text in a TextView. if (mItem != null) { ((TextView) rootView.findViewById(R.id.item_detail)) .setText(mItem.descrip); } return rootView; } </code></pre> <p>I want to change this code around so that instead of displaying text it draws an image on the secondary activity. Any suggestions</p> <p>Also, since I'm new to android, any good tutorials on master-detail app programming, activities, drawing images, or just plain Android would be great.</p>
java android
[1, 4]
901,732
901,733
PHP image rotate looses quality after each rotation
<p>I'm currently using GD and some PHP to rotate images. After each rotation the quality of the image gets worse. Is there a better way to do this or is this expected?</p> <pre><code> $img = new ImageClass; list($original, $info) = $img-&gt;load($src); // Determine angle $angle = strtolower($angle); if( $angle == 'cw' || $angle == 'clockwise' ) $angle = 270; if( $angle == 'ccw' || $angle == 'counterclockwise' ) $angle = 90; $rgb = $img-&gt;hex2rgb($bg_color); $bg_color = imagecolorallocate($original, $rgb['r'], $rgb['g'], $rgb['b']); $new = imagerotate($original, $angle, $bg_color); </code></pre> <p>Is it possible to rotate the image client side with maybe jquery and then save the image via PHP to the server? I'm assuming this will help with the image quality.</p>
php jquery
[2, 5]
3,118,710
3,118,711
Cannot reach $(this) from within $().data()
<p>I'm trying to set the class of my element inside a data object of the same element, but it keeps returning undefined.</p> <pre><code>$(this).data({ orgSize:{ // Write all the sizes as data. For future reference. width: $(this).width(), //returns the width just fine! height: $(this).height() //returns the height just fine! }, orgClass: function(){ cl = $(this).attr('class'); if(cl){ return ' ' + cl; }else{ return ' somethingelse'; } } //returns undefined }); console.log($(this).attr('class')) //returns the class </code></pre> <p>edit: The problem is within the orgClass.</p>
javascript jquery
[3, 5]
1,982,908
1,982,909
Help understanding jQuery button enable/disable code
<p>I grabbed this code form JCarousel and just trying to understand these lines below. I'm new to jQuery and not that great at JavaScript so I am not sure what is jQuery and which is JavaScript below</p> <pre><code>this.buttonNext[n ? 'bind' : 'unbind'](this.options.buttonNextEvent, this.funcNext)[n ? 'removeClass' : 'addClass'](this.className('jcarousel-next-disabled')).attr('disabled', n ? false : true); this.buttonPrev[p ? 'bind' : 'unbind'](this.options.buttonPrevEvent, this.funcPrev)[p ? 'removeClass' : 'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled', p ? false : true); </code></pre> <p>It's setting some of the css to set state and either enabling or disabling the button that is in a but I want to modify this once I really understand it. I just can't make out exactly what it's doing 100%.</p> <p>Trying to understand things such as [n ? 'bind' : 'unbind'] and just the chaining here also. There's a lot going on in those 4 lines.</p> <p>The code comes from this plug-in: <a href="http://sorgalla.com/projects/jcarousel/" rel="nofollow">http://sorgalla.com/projects/jcarousel/</a></p>
javascript jquery
[3, 5]
5,579,749
5,579,750
Accessing Page properties from Base User Control which gets extened by all user controls
<p>I have a Page with few web user controls in it</p> <p>Page does the following , it extends Icode interface</p> <pre><code> public partial class TestPage: System.Web.UI.Page, ICode </code></pre> <p>// it implements Code implementation here</p> <pre><code>public string Code { get { return "sample code"; } } </code></pre> <p>One of the control is as below</p> <p>I am able to access the Code value from this sample control</p> <pre><code>sampleControl:BaseControl // here I am able to access the page property's if (Page is ICode) { string test= ((ICode))Page).Code; } </code></pre> <p>Now i want to access the same value from BaseControl, as baseControl is getting executed before the page i am unable to set the values in the base control.</p> <pre><code>BaseControl: System.Web.UI.UserControl { // how can i access those values here. } </code></pre> <p>if i can set the values in the base control, all controls can acess that value</p> <p>any help will be appreciated</p>
c# asp.net
[0, 9]
3,299,337
3,299,338
setting asp image src property from javascript
<p>I am trying to set asp image element src property from javascript but the url property is not being set.</p> <pre><code>function slideshow() { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "/RollingScreen.aspx/GetNextImage", dataType: "json", data: "{}", success: function (data) { //this changes the image on the web page $('#imgSlideShow').attr("src","~/1.png"); $("#txt1").val(data.d); //fires another sleep/image cycle setTimeout(slideshow,5000); }, error: function (result) { alert(result.message); } }); } $(document).ready(function () { //Kicks the slideshow slideshow(); }); </code></pre> <p>My aspx image element is </p> <pre><code>&lt;asp:Image ID="imgSlideShow" runat="server" Height="300px" Width="600px" ImageAlign="Middle" ImageUrl="~/1.png"/&gt;.... </code></pre> <p>Can anyone please help me...</p>
jquery asp.net
[5, 9]
5,753,941
5,753,942
JScript or JQuery in Windows
<p>I am a C# developer using Visual Studio, but I'm interested in creating some <strong>JScript</strong> or <strong>JQuery</strong> programs to run on our Windows machines. There is obviously a learning curve I've got to get over.</p> <ul> <li>Will <strong>JQuery</strong> run on a PC, or does it have to run on a web page?</li> </ul> <p>I'd like to start by mimicing a <strong>VBScript</strong> I was presented with not long ago:</p> <pre><code>Dim wshShell Set wshShell = CreateObject("WScript.Shell") wshShell.Run "msiexec.exe /i ""\\CPFS2\Share Files\package.msi"" /l*v ""C:\install.txt""", 1, true wshShell.Run "C:\install.log" </code></pre> <p>Can this be done with either <strong>JScript</strong> or <strong>JQuery</strong>?</p> <p>What are good search tool terms to help me locate help on this topic? (<em>JScript</em>, <em>Windows</em> is not producing much)</p>
javascript jquery
[3, 5]
2,523,037
2,523,038
Only the last Android app is installed
<p>I have 2 android applications in eclipse, I create the apk and then I copy them to the device and install them. The problem is that only the last one is installed.</p> <p>I install app A. OK</p> <p>I install app B. B is ok but A is gone.</p> <p>What am I doing wrong? What should I change in the Manifest xml?</p> <p>Thanks</p>
java android
[1, 4]
4,132,482
4,132,483
How can I have a button be disabled with jQuery but also run server code once it's been clicked?
<p>I have a button that will execute a stored procedure. After it's been clicked, I want it disabled so that the user can't click it multiple times. However, once it's been clicked, I also want to run some C# on the server side through an <code>onclick</code> event. As of right now, all my code does is disable the button, but then it won't run the server side stuff. Can this be achieved? Here's my jQuery:</p> <pre><code> $("#btnGenerate").click(function () { $(this).attr("disabled", true).val("Generating..."); }); </code></pre>
c# jquery asp.net
[0, 5, 9]
3,546,636
3,546,637
jQuery: Foreach element href?
<p>The title sounds confusing.. but im sure this is possible!</p> <p>I have one button, <code>(id='downloadAll')</code> and many <code>&lt;a href="..." class="link"&gt;&lt;/a&gt;</code> on my page. What i want to do, for the purpose of finding out how to do this.. is to do something logic like this.</p> <pre><code>var hrefs = ALL OF THE ELEMENTS WITH CLASS 'link'; foreach(hrefs){ alert(this.attr('href')); } </code></pre> <p>Basically for each of the elements with a class, i want to get the value of each one... in tern. Yes, i do have jquery on the page - am hoping to make use of this!</p> <p>Thanks!</p>
javascript jquery
[3, 5]
4,401,757
4,401,758
trying to find the amount of half hours in between two times
<p>I can't think right now.... i've been trying to figure out how many half hours there are between two variables, which will have the start and end times like so, 1100 and 1430</p> <p>I started doing the following but realized time doesnt go to 100!</p> <pre><code>function process_blocks(startTime,endTime){ var blocks = 0; startTime = +startTime; endTime = +endTime; while(startTime &lt; endTime){ startTime = startTime + 30; // add a half hour, which is a block blocks++; } return blocks; } </code></pre>
javascript jquery
[3, 5]
5,862,338
5,862,339
Server.mappath confusion
<p>There is a little confusion in my mind about server.mappath which is correct and what's the difference betwwen these two</p> <pre><code>FileUpload1.saveAs(Server.MapPath("~/User/images/")+"ankush.jpg")); FileUpload1.saveAs(Server.MapPath("~/User/images")+"ankush.jpg")); </code></pre>
c# asp.net
[0, 9]
2,209,810
2,209,811
Setting culture info dynamically
<p>I am building an application in asp.net/c#. For dates in my application, I amm using global variables which give date formats from a given database.</p> <p>So if my <code>DateFormat</code> is British I use:</p> <pre><code>Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB"); </code></pre> <p>if it is US I use:</p> <pre><code>Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); </code></pre> <p>So my dates are validated and compared using this approach. My question is; should I just check for the format only once for the entire application or will I have to check the formats for every page as I know that for every new thread <code>CultureInfo</code> gets reset?</p> <p>Could you please suggest the the correct way of doing this.</p>
c# asp.net
[0, 9]
5,259,840
5,259,841
How to send table column values from a Javascript page to a C# page using Jquery
<p>I have values that come from a dynamically created table from it's selected rows. inside each selected row i want all the td.innerText values that belong to be sent to a C# page, but i don't know how to. I was using JSON but I dont know if i used it properly.</p> <pre><code>function selectedRows() { var selectedItems = $('#ScannedLabelTable').find(':checkbox:checked').parents('tr'); var serial, kanbanNumber, customer, description, quantity; $.each(selectedItems, function (i, item) { var td = $(this).children('td'); for (var i = 0; i &lt; td.length; ++i) { serial = td[1].innerText; kanbanNumber = td[2].innerText; customer = td[3].innerText; description = td[4].innerText; quantity = td[5].innerText; } console.log(serial + ' ' + kanbanNumber + ' ' + customer + ' ' + description + ' ' + quantity); }); $.ajax({ url: SEND_TO_TEXTFILE_PAGE , data: "labelSerial=" + serial + "&amp;kanbanNumber=" + kanbanNumber + "&amp;customer=" + customer + "&amp;description=" + description + "&amp;quantity=" + quantity , dataType: 'json' , success: function (status) { if (status.Error) { alert(status.Error); } } , error: Hesto.Ajax.ErrorHandler }); } </code></pre>
javascript jquery
[3, 5]
64,294
64,295
Why is jQuery not adding the data attribute to this element?
<p>I have a hidden modal box on my page that gets rendered with the call of this create.js file. </p> <p>Everything else is working nicely except for adding a data-meal_id attribute to the element. </p> <p>Here's the jquery:</p> <pre><code>var $modal, $modal_close, $modal_container, $meal_id; $modal = $('#modal'); $modal_close = $modal.find('.close'); $modal_container = $('#modal-container'); $meal_id = &lt;%= @meal_id %&gt; $modal .data('meal_id', $meal_id) .prepend($modal_close) .css('top', $(window) .scrollTop() + 100) .show(); $modal_container.show(); $(document).on('click', '#modal .close', function() { $modal_container.hide(); $modal.hide(); return false; }); </code></pre> <p>Here are the elements before the above code is triggered:</p> <pre><code>&lt;div id="modal-container"&gt;&lt;/div&gt; &lt;div id="modal"&gt; </code></pre> <p>After being triggered...</p> <pre><code>&lt;div id="modal-container" style="display: block;"&gt;&lt;/div&gt; &lt;div id="modal" style="top: 100px; display: block;"&gt;&lt;a href="#" class="close"&gt;cancel&lt;/a&gt; </code></pre> <p>Totally skips the data attribute??!</p>
javascript jquery
[3, 5]
5,573,798
5,573,799
jQuery/Javascript will chaining be the solution?
<p>dummy.html:</p> <pre><code>&lt;button id="do"&gt;Do&lt;/button&gt; </code></pre> <p>external.js:</p> <pre><code>$("#do").click(function() { history.go(-1); alert('One page back'); history.go(1); alert('back from were you started'); }); </code></pre> <p>Will execute history.go(-1); and end.</p> <p>In the final usage scenario it will be used with jQuery UI tabs consisting of several tabs, and normally history.go(-1) will stay on same page but normally return to another tab, on the same page.</p> <p>Can I solve this with chaining and how would it look like?</p>
javascript jquery
[3, 5]
5,293,334
5,293,335
How to run/execute form in a PHP page loaded in another using Javascript .load() without refreshing the parent PHP page?
<p>Sorry for the very long title but it's exactly what I'm looking for.</p> <p>I have a PHP page (let's call it the parent page) that loads another (the child page) in one div with the following code:</p> <pre><code>$("#compose_inputandoptions").load("compose_inputandoptions.php"); </code></pre> <p>In the child page called "compose_inputandoptions.php" I have a form like this:</p> <pre><code>&lt;?php&gt; echo $_POST['option']; ?&gt; &lt;form action="" method="post"&gt; &lt;p&gt; &lt;input type="text" name="option" /&gt; &lt;input type="submit" value="Valider" /&gt; &lt;/p&gt; &lt;/form&gt; </code></pre> <p>How can I obtain a value for the $_POST['option'] in the child page<br> when I submit the form which is in the child page<br> without refreshing the parent page?</p> <p>Thank you very much for your help!</p>
php javascript jquery
[2, 3, 5]
1,190,475
1,190,476
need help with jQuery when not hovering over a particular element
<p>I am having a navigation div (the id is navigation) i am thinking of writing a code that executes when i am not hovering over the navigation. Can somebody explain me how can that be possible with jQuery.</p> <pre><code> &lt;ul id='navigation'&gt; &lt;li&gt;a&lt;/li&gt; &lt;li&gt;b&lt;/li&gt; &lt;li&gt;c&lt;/li&gt; &lt;li&gt;d&lt;/li&gt; &lt;/ul&gt; </code></pre> <pre><code> #navigation li{ display:inline; float:left; width:50px; border-right:1px solid black; padding:2px; }</code></pre> <pre><code>jQuery("#navigation").mouseout(function(){ alert("hi"); });</code></pre> <p>Now with this code even when i am moving from one li to another mouseout function is called. However i am expecting it to be called everytime out of this navigation. </p>
javascript jquery
[3, 5]
5,537,673
5,537,674
How to resolve conflict issues with jQuery + other libraries
<p>Can someone help me figure out how to write a no conflict function for js for my weebly website.</p> <p><a href="http://cadogan.weebly.com/big-name.html" rel="nofollow">http://cadogan.weebly.com/big-name.html</a> </p> <p>Thank you.</p>
javascript jquery
[3, 5]
876,051
876,052
How to get last few characters of varying length from a string ..?
<p>I have a multiple string urls, from which i have to pick last few characters, which are id's infact. But the problem is that, the length of id's is not consistent, i.e., if one id is of length 6 then, other may be of length 5 or 4 and so on. The sample urls are like:</p> <pre><code>www.abc.com/xyz-123456 www.abc.com/pqr-5432 www.abc.com/lmn/opqr-25647 </code></pre> <p>it could have been a lot easier if the length of the particular id portion would have been same, i could have used:</p> <pre><code>String abc = "www.abc.com/xyz-123456"; String id = abc.substring(abc.length()-6); </code></pre> <p>But now the scenario is different as length of id portion in the selected url is not the same always, How can i cater this varying id..???? please any help is appreciated.</p>
java android
[1, 4]
3,056,243
3,056,244
how to Highlight being read words in text to speech asp.net?
<p>I'm am building a web app and need a text to speech which highlights the text being read at the moment. I built the text to speech but don't have any idea how to tackle the highlighting of text are there any tips or functions for this problem? 10x a lot.</p>
c# asp.net
[0, 9]
5,995,019
5,995,020
Java: ClassName.this
<p>I am doing Android programming and was learning about Intents, when I saw a constructor that, to my C# trained mind, seemed funky. The call was: </p> <pre><code>Intent myIntent = new Intent(CurrentActivity.this, NextActivity.class); </code></pre> <p>Both of the parameters are new to me. How is there a static ".this" off of a Class Name? Is this a Java thing or an Android thing? I am assuming that it is the same as just saying "this", since I am in the context of CurrentActivity, but I don't get how the "this" can be called off of the Class name itself. Also. The ".class" looks like it is used for reflection, which I am familiar with in C#, but any insight into this would be welcomed as well.</p> <p>Thanks.</p>
java android
[1, 4]
834,094
834,095
Deleting from an array based on a string value
<p>I have defined an array like so : </p> <pre><code>var myArray = {myNewArray: ['string1' , 'string2' , 'string3']}; </code></pre> <p>I want to iterate over the array and delete an element that matches a particular string value. Is there a clean way in jQuery/javascript to achieve this ?</p> <p>Or do I need to iterate over each element, check its value and if its value matches the string im comparing, get its id and then use that id to delete from the array ?</p>
javascript jquery
[3, 5]
912,695
912,696
Problem in submiting 2 forms with one function?
<p>I have facing problem to submit two form whit one javascript function..</p> <p>In that I have called one ajax file to check the username availability.</p> <p>The forms are as below</p> <pre><code>&lt;form action="abc.php" method="post" enctype="multipart/form-data" onsubmit="return isValid(this)" class="login_form" style="width:100%;"&gt; &lt;form action="http://xyz.com" method="post" enctype="multipart/form-data" onsubmit="return isValid(this)" class="login_form" style="width:100%;" name="form1" id="form1"&gt; </code></pre> <p>In isValid() function when i do </p> <pre><code> alert ("hi"); document.form1.submit(); alert("bye"); </code></pre> <p>Then it submiting the form1 else it does not.</p> <p>Please help me..</p> <p>Thanks in advance.</p> <p>Kanak</p>
php javascript
[2, 3]
3,702,382
3,702,383
use jquery to remove element from parent
<p>i have a form with multiple div elements like this</p> <pre><code>&lt;div&gt; &lt;label for="id"&gt;text&lt;/label&gt; &lt;input type="text" name="id" id="id" value=""&gt; &lt;/div&gt; &lt;div&gt; &lt;label for="id1"&gt;text&lt;/label&gt; &lt;input type="text" name="id1" id="id1" value=""&gt; &lt;/div&gt; </code></pre> <p>i use .post to validate some fields before submit if the input failed validation i add a span element to the parent div</p> <pre><code>$('#id').parent('div:first').append('&lt;span class="error"&gt;error message&lt;/span&gt;'); &lt;div&gt; &lt;label for="id"&gt;text&lt;/label&gt; &lt;input type="text" name="id" id="id" value=""&gt; &lt;span class="error"&gt;error message&lt;/span&gt; &lt;/div&gt; </code></pre> <p>else i want to remove the span from the div and i tried </p> <pre><code>$('#id').parent('div:first').remove('.error'); $('#id').parent('div:first').remove('span'); </code></pre> <p>but doesn't work any ideas ?</p>
javascript jquery
[3, 5]
5,126,754
5,126,755
How can I automatically turn an IEnumerable<T> into a csv file?
<p>I am trying to create a user control that accepts any generic list so I can iterate through it and create a CSV export. Is it possible to expose a public property that can accept any type? (i.e. <code>List&lt;Product&gt;</code>, <code>List&lt;Customer&gt;</code>, etc.) If yes, how?</p> <pre><code>public IEnumerable&lt;T&gt; AnyList { get; set; } </code></pre> <p>Here's what I have as far as the utility methods I have:</p> <pre><code>public static byte[] ToCsv&lt;T&gt;(string separator, IEnumerable&lt;T&gt; objectlist) { //Type t = typeof(T); Deleted this line. //Here's the line of code updated. PropertyInfo[] propertyNames = objectlist.First().GetType().GetProperties(); string header = String.Join(separator, propertyNames.Select(f =&gt; f.Name).ToArray()); StringBuilder csvdata = new StringBuilder(); csvdata.AppendLine(header); foreach (var o in objectlist) csvdata.AppendLine(ToCsvFields(separator, propertyNames, o)); return Encoding.ASCII.GetBytes(csvdata.ToString()); } public static string ToCsvFields(string separator, PropertyInfo[] fields, object o) { StringBuilder linie = new StringBuilder(); foreach (var f in fields) { if (linie.Length &gt; 0) linie.Append(separator); var x = f.GetValue(o, null); if (x != null) linie.Append(x.ToString()); } return linie.ToString(); } </code></pre>
c# asp.net
[0, 9]
3,444,296
3,444,297
Setting minimum date to date picked in previous datepicker
<p>I have two date pickers. A <code>startdate</code> and an <code>enddate</code>.</p> <p>The way I have the code set up is that the second datepicker won't be initiated until the first one has been changed. The <code>enddate</code> datepicker is initialized with the current date on <code>startdate</code>. The only problem is that if you change the time on the first datepicker it doesn't refresh the <code>mindate</code> on <code>enddate</code>.</p> <pre><code> $(function(){ $( "#startdate" ).datepicker({ minDate: currentTime }); //When the startdate changes change the mindate for the enddate picker $( "#startdate" ).change(function (){ startTime = ($("#startdate").val()); $("#enddate").datepicker({ minDate: startTime }); }); //$( "#enddate" ).datepicker({ minDate: currentTime }); }); </code></pre>
javascript jquery
[3, 5]
20,918
20,919
Android Webview caching works in version 4.0.x but not in 2.3.3
<p>I am facing a very strange issue. My jquery webview works offline in browsers and in <code>android version 4.0.x</code>. However, it does no work offline in lower versions. </p> <p>Code for setting cache mode :</p> <pre><code>if(isConnected) { webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); } else { webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ONLY); } </code></pre>
java android
[1, 4]
2,239,071
2,239,072
New row inserted for each page refresh
<p>Hi I'm getting a strange problem while inserting records into database. In my button click event I'm trying to insert some values into my database it is working fine. Once insertion is completed... again if I press F5 or refresh the browser a new row is getting inserting with the previous values in the table.</p> <p>Why it is happening?</p> <p>Thank you</p>
c# asp.net
[0, 9]
5,426,621
5,426,622
how to Put add in our android application
<p>I have created an application for admob, but I am getting an error. I found an example from Google and I have tried it, but there is a problem when I'm launching the application .</p> <p>I'm using Android 2.2 API 8. I am able to launch the application, but this block is causing an error.</p> <pre><code>android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/&gt; </code></pre> <p>If I change this to</p> <pre><code>android:configChanges="keyboard|keyboardHidden" </code></pre> <p>then I am able to launch the application, but there is an error coming on our add field.</p> <pre><code>you must have adactivity declare in Android Manfiest.xml with config change </code></pre> <p>Due to this I am not able to show google adds in our application.</p> <p>Please help me to fix this.</p>
java android
[1, 4]
365,581
365,582
is it possible refresh gridview when change table in DB?
<p>Refresh the Grid Automatically when table changes in the DB </p> <p>like twitter and other facebook .</p> <p>how to do this using any asp.net controls using c#</p>
c# asp.net
[0, 9]
4,752,176
4,752,177
Android DroidDao Database Manager: My code or theirs?
<p>I am using DroidDao in my Android App for a persistent SQLite database.</p> <p>I have a Connection table:</p> <pre><code>PART_ID GPS_ID SAND_ID </code></pre> <p>I am having issues with two functions in this library:</p> <pre><code> /**Get an Object by clause*/ public T getByClause(String clause, String[] clauseArgs) { T object = null; Cursor cursor = database.query(getTableName(), getArrayColumns(), clause, clauseArgs, null, null, "1"); if(cursor.moveToFirst()){ try { object = buildDataFromCursor(cursor); } catch (Exception e) { e.printStackTrace(); } } if(! cursor.isClosed()){ cursor.close(); } return object; } </code></pre> <p>And:</p> <pre><code> /**List items by clause*/ public List&lt;T&gt; getAllbyClause(String clause, String[] clauseArgs, String groupBy, String having, String orderBy) { List&lt;T&gt; objectList = new ArrayList&lt;T&gt;(); Cursor cursor = database.query(getTableName(), getArrayColumns(), clause, clauseArgs, groupBy, having, orderBy); if(cursor.moveToFirst()){ try { do{ T object = buildDataFromCursor(cursor); if(object != null){ objectList.add(object); } } while(cursor.moveToNext()); } catch (Exception e) { e.printStackTrace(); } } if(! cursor.isClosed()){ cursor.close(); } return objectList; } </code></pre> <p>I use them both like so:</p> <pre><code>Connection connection = myApp.getDataManager().getConnectionDao().getByClause("PART_ID = ?", new String[]{"44"}); List&lt;Connection&gt; connections = myApp.getDataManager().getConnectionDao().getAllbyClause("PART_ID = ?", new String[]{"44"}, null, null, null); </code></pre> <p>Both of these functions return 0's for PART_ID, GPS_ID, and SAND_ID. Even when I insert an ID that is incorrect, where the function should return NULL, it still return an object with zeros.</p> <p>Any ideas?</p>
java android
[1, 4]
1,754,223
1,754,224
Find if a cell contents appears more than once
<p>I have a table body that looks like the following: </p> <pre><code>&lt;tbody&gt; &lt;tr class="basket_main"&gt; &lt;td class="basket_item"&gt; &lt;input type="text" class="basket_qty_txt" id="ctl00_ctl00_main_body_content_main_content_area_shopping_basket_ctl01_txt_qty_162" value="3" name="ctl00$ctl00$main_body_content$main_content_area$shopping_basket$ctl01$txt_qty_162"&gt; &lt;/td&gt; &lt;td class="basket_item prod_code" id="ctl00_ctl00_main_body_content_main_content_area_shopping_basket_ctl01_prod_code_col"&gt; CSM160 &lt;/td&gt; &lt;td class="basket_item"&gt; SIL.MTG:RENAULT R19 1988 ON &lt;/td&gt; &lt;td class="basket_item max_qty"&gt; 5 &lt;/td&gt; &lt;td class="basket_item"&gt; &lt;input type="button" class="basket_item_button"&gt; &lt;input type="button" class="basket_item_button"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; </code></pre> <p>There could be many rows in this table, what I'm trying to find out is if the <code>prod_code</code> appears in more than one row in the table using javascript or jquery.</p>
javascript jquery
[3, 5]
5,402,208
5,402,209
jQuery selection with dynamic id's
<p>I have a form that is dynamically generated, and has dynamically generated id's (and potentially classes). The forms are the same but they have the related id tacked on to the end.</p> <p>How can I select each set of inputs and apply code to each one?</p> <p>I was experimenting with $('input[id^=@id_airline_for_]') but could not get it to fly. I suspect I am missing some fundamental jQuery knowledge that is holding me back since I am sure this is a common problem with dynamic forms. </p> <pre><code>&lt;form method='POST'&gt; &lt;label for="id_airline_for_8"&gt;Airline&lt;/label&gt;: &lt;input id="id_airline_for_8" class="arrival_transfer_toggle_8" type="text" maxlength="30" name="airline_for_8"/&gt; &lt;label for="id_flight_number_for_8"&gt;Flight Number&lt;/label&gt;: &lt;input id="id_flight_number_for_8" class="arrival_transfer_toggle_8" type="text" maxlength="30" name="flight_number_for_8"/&gt; &lt;label for="id_airline_for_17"&gt;Airline&lt;/label&gt;: &lt;input id="id_airline_for_17" class="arrival_transfer_toggle_17" type="text" maxlength="30" name="airline_for_17"/&gt; &lt;label for="id_flight_number_for_17"&gt;Flight Number&lt;/label&gt;: &lt;input id="id_flight_number_for_17" class="arrival_transfer_toggle_17" type="text" maxlength="30" name="flight_number_for_17"/&gt; -- snip -- &lt;/form&gt; </code></pre> <p>EDIT: I should update that i want to be able to perform some action when the input is clicked but only for classes with a matching id at the end.</p> <p>To make it easy, lets say I want all inputs with a matching id at the end of the #id to disappear when one is clicked (just for arguments sake).</p>
javascript jquery
[3, 5]
5,555,127
5,555,128
Rotate images, if last image then hide
<p>I have 3 images that I want to rotate when a button is clicked.</p> <p>image1, image2, image3.</p> <p>If the image is at image1, then when clicked it should show image2 (and so on, in order of image1, .., image3).</p> <p>When I am at image3, it should then hide the image, i.e. don't display it.</p> <p>I need some help with the javascript function to do this, I already have the code for the button click event.</p> <p>I am passing the toggle() function the jquery object <code>$('myImageID')</code>;</p> <pre><code>$(document).ready( function() { $('#button1').click( function() { toggleSector( $('#sector1') ) } ; } ); function toggleSector(o) { // help! } &lt;div id="sector1"&gt;&lt;/div&gt; &lt;input type="button" id="button1" value="Sector 1" /&gt; </code></pre> <p><b>Update</b></p> <p>I have to somehow find the name of the current background image set to the <code>&lt;div&gt;</code> where my image is.</p> <p>Is there a background property to get the image name currently being displayed?</p>
javascript jquery
[3, 5]
4,348,849
4,348,850
Android more option menus aint appearing as grid
<p>I have like 10 or 12 option menus, when I press menu key, 6 menus appear as grid including More, but when clicking More menu, the rest of menus appear as list. How can I make them look like grid too ?</p>
java android
[1, 4]
1,244,024
1,244,025
Converting to Datetime issue
<p>I am trying to convert this content into DateTime.</p> <pre><code> DateTime dtmNextPayment = Convert.ToDateTime(DateTime.Now.AddMonths(1).Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/" + DateTime.Now.AddYears(1).Year.ToString()); </code></pre> <p>Here, i get an exception "String was not recognized as a valid datetime". Where am i doing wrong?? Could some one help me. Thank you in advance..</p>
c# asp.net
[0, 9]
4,690,059
4,690,060
Passing a querystring value through a javascript window.open
<p>I need to pass the pass value stored in a asp hiddenfield to a querystring using the window.open.</p> <pre><code>onclick="window.open('../New/FeedbackV4.aspx','FeedbackWindow','width=960,height=640,scrollbars=yes,resizable=yes,status=yes')" </code></pre> <p>I need to get the value of the hidden field and pass it as a querystring</p>
javascript asp.net
[3, 9]
1,829,814
1,829,815
Reset hidden items from previous search
<p>I am trying to implement search in Javascript for my application, and I'm running into an issue where items I previously hid will not show up again. <a href="http://jsfiddle.net/for3v3rforgott3n/Y5w5r/9/" rel="nofollow">JSFiddle</a></p> <p>My code is here:</p> <pre><code>$('#search').keyup(function() { var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase(); $searchproject.show().filter(function() { var text = $(this).text().replace(/\s+/g, ' ').toLowerCase(); return !~text.indexOf(val); }).parents('div.srcprojects').hide(); }); </code></pre> <p>The problem is I am hiding the parent srcprojects container of my filtered selection, so keyup doesn't show it again.</p> <p>However, if I change</p> <pre><code>$searchproject.show().filter(function() { </code></pre> <p>to </p> <pre><code>$searchproject.parents('div.srcprojects').show().filter(function() { </code></pre> <p>it does not work at all. What am I doing wrong?</p>
javascript jquery
[3, 5]
5,751,782
5,751,783
ASP.NET beginner question: How do I implement something like this is my ASP.NET C# website?
<p>I want to create an FAQ page like the one on this website</p> <p><a href="http://www.microsoft.com/windows/windows-7/faq.aspx" rel="nofollow">http://www.microsoft.com/windows/windows-7/faq.aspx</a></p> <p>When you click on the question, the answer expands. Click it again and it collapses.</p> <p>My question, answers are stored in a database. I googled and found out there's this JavaScript code to achieve this BUT also came across something that said it can be done using Repeater Controls.</p> <p>How to do that? Any link to some tutorial would be great.</p>
c# asp.net
[0, 9]
5,213,055
5,213,056
How can i show a jquery popup on PageLoad??
<p>I am trying to use jquery to open a popup on Pageload. I guess this is what i should use to show the popup after a button click in an Asp.Net application. How do i get the popup on Pageload. </p> <pre><code>$(document).ready(function(){ $("#button").click(function(){ centerPopup(); loadPopup(); }); }); </code></pre> <p>Thank you in advance!!</p>
jquery asp.net
[5, 9]
3,133,869
3,133,870
jQuery Fadeout on Click or after delay
<p>I am displaying a message box on a website. I would like to be able to have it either fadeout on click or after X seconds. The problem is that the <code>delay()</code> function takes the place over the <code>click()</code> function making it so even if you click close you still have to wait the time. </p> <p>Here is the jQuery</p> <pre><code>$(document).ready(function() { $(".close-green").click(function () { $("#message-green").fadeOut("slow"); }); //fade out in 5 seconds if not closed $("#message-green").delay(5000).fadeOut("slow"); }) </code></pre> <p>I also set up a simple jsfiddle. To see the problem comment out the delay line <a href="http://jsfiddle.net/BandonRandon/VRYBk/1/" rel="nofollow">http://jsfiddle.net/BandonRandon/VRYBk/1/</a></p>
javascript jquery
[3, 5]
2,656,629
2,656,630
How to scroll to a part of the page using jQuery?
<p>My code scrolls the user to the bottom of the page:</p> <pre><code>var $elem = $('body'); $('html, body').animate({scrollTop: $elem.height()}, 800); </code></pre> <p>How can it be modified to take the user to the part of the page where there is a h3 tag with the id "myTitle":</p> <pre><code>&lt;h3 id="myTitle"&gt;Hello&lt;/h3&gt; </code></pre>
javascript jquery
[3, 5]
2,767,433
2,767,434
Calling JavaScript Function From CodeBehind
<p>I am new to JavaScript Programming and C# Programming. Can someone provide good examples of calling a Javascript function From CodeBehind and ViceVersa.</p> <p>Thank You</p>
c# javascript asp.net
[0, 3, 9]
1,544,271
1,544,272
reuse code when binding to click
<p>Given the following:</p> <pre><code> $(document).ready(function() { $('a.went-cold-turkey').click(function() { $("body").css("cursor", "progress"); var activity_day = this.rel; $.ajax({ url: this.href, type: "GET", cache: false, success: function (html) { $('#'+activity_day).replaceWith(html); $("body").css("cursor", "auto"); } }); return false; }); $('a.did-it-once').click(function() { $("body").css("cursor", "progress"); var activity_day = this.rel; $.ajax({ url: this.href, type: "GET", cache: false, success: function (html) { $('#'+activity_day).replaceWith(html); $("body").css("cursor", "auto"); } }); return false; }); }); </code></pre> <p>As you can see both ".click" calls are practically identical. How can I share repetitive code in both to keep things DRY?</p>
javascript jquery
[3, 5]
3,678,478
3,678,479
Passing a variable to a function
<p>I have a variable declared:</p> <pre><code>var recent; </code></pre> <p>And I wrote a function which needs the variable passed into it. However, I believe what is happening is the variable is being passed as a string. The var is represented by <code>thisVar</code>:</p> <pre><code>function detachVariable(thisDiv, thisVar, fileName) { //Check if this section is visible: if($(thisDiv + " li").length &gt; 0) { $(thisDiv).prepend(thisVar); } else { //If variable does not have content stored, store it: if(thisVar === undefined) { $("#site-nav li a").parents().removeClass("nav-active"); $(this).addClass("nav-active"); $(thisDiv + " ul.top-level").load('assets/includes/' + thisFile, function () { $(this).show().siblings().hide(); ajaxAudioController(); }); //If variable has content, show it: } else { $("#site-nav li a").parents().removeClass("nav-active"); $(this).addClass("nav-active"); $(thisDiv).prepend(thisVar); } } } </code></pre> <p>My click function:</p> <pre><code>$("#site-nav .nav1").on("click", function (event) { detachVariable("#recent", "recent", "recent.php"); event.preventDefault(); }); </code></pre> <p>Is there a way I can pass my variable into the function?</p>
javascript jquery
[3, 5]
4,193,425
4,193,426
changing window.beforeunload message
<p>I'm wondering if can I change the <code>window.beforeunload</code> message. All examples on the internet are similar to this:</p> <pre><code>$(window).bind('beforeunload', function() { return 'You have unsaved changes. If you leave the page these changes will be lost.'; }); </code></pre> <p>That's cool, and in Google Chrome my message will be displayed, but in Firefox the default message is displayed. How can i trick Firefox to display my message and not the default message?</p>
javascript jquery
[3, 5]
589,764
589,765
Finding the data inside a word document
<p>In my project which I'm doing, I have to find if my word document consists of any image or table. Is there any way to do that using c# code. I couldn't find any code related to this.</p> <p>Thanks in advance</p>
c# asp.net
[0, 9]
2,176,859
2,176,860
Jquery | Function inside same function. It bad practice?
<p>I am using this function for easiness, as I am going to use fadeTo a lot:</p> <pre><code>function fade_to(div, speed, opacity, after_fade) { $(div).fadeTo(speed, opacity, after_fade); } </code></pre> <p>Then I am calling the same function for after_fade parameter:</p> <pre><code>fade_to('#div', 3000, 1, function() { fade_to('#another_div', 3000, 1)}); </code></pre> <p>Is that a bad thing to do? Will I have speed/smoothness issues? Is it better to just use jQuery's default fadeTo function?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
1,726,053
1,726,054
Separate web links from paragraph into a JS array
<p>I checked all answers above to see if mine was answered , please don't tag this as duplicate</p> <p>In the application that i am building there is a div </p> <pre><code>&lt;div class="paragraphlink"&gt; &lt;/div&gt; </code></pre> <p>I am allowing users enter any text like this</p> <blockquote> <p>Räikkönen was among the two Formula One drivers <strong>http://www.formula1.com</strong> who made it into the Forbes magazine's The Celebrity 100 list, the other being Fernando Alonso <strong>http://www.google.com</strong>. He is 36th on Forbes magazine's <strong>http://www.forbesmagazine.com</strong></p> </blockquote> <p>If you notice there are urls present in the above para. can you please help me with a javascript code to extract all the urls from the para above?</p>
javascript jquery
[3, 5]
4,427,566
4,427,567
Teechart Colorline Problem
<p>I have a problem with Teechart. I want to draw in X axes. My code:</p> <pre><code>Steema.TeeChart.Tools.ColorLine colorLine = new Steema.TeeChart.Tools.ColorLine(oDynamicChart.Chart); colorLine.Active = true; colorLine.Axis = oDynamicChart.Chart.Axes.Left; colorLine.Pen.Color = Color.Green; colorLine.Pen.Width = 1; colorLine.Pen.Style = System.Drawing.Drawing2D.DashStyle.Solid; colorLine.Value = 50; </code></pre> <p>But this is not show colorline in 50. It is showing in the middle of the x axis.</p> <p>How can I set colorline value in Asp.net application? </p> <p>Thanks John</p>
c# asp.net
[0, 9]
5,080,732
5,080,733
why does this script not work in IE6?
<p>I've been working on and off on a horizontal accordion. It's not working perfectly at the moment but i've just got to change a few bits. The code is very rough and I intend to make it a bit more graceful once it works.</p> <p>It functions perfectly in every browser apart from ie6..initially when it loads in the page all you can see is the 6th panel (labelled df6)...then if you click on that the accordion seems to spring in to life....all the panels appear and it seems to work just fine. I can't think of any reason for this..</p> <p>Any ideas? I'm at a complete loss with this :(</p> <p><a href="http://boudaki.com/testing/carousel/test.html" rel="nofollow">http://boudaki.com/testing/carousel/test.html</a></p>
javascript jquery
[3, 5]
2,906,043
2,906,044
how to Highlight being read words in text to speech asp.net?
<p>I'm am building a web app and need a text to speech which highlights the text being read at the moment. I built the text to speech but don't have any idea how to tackle the highlighting of text are there any tips or functions for this problem? 10x a lot.</p>
c# asp.net
[0, 9]
2,653,699
2,653,700
Android Status Bar Notification Not Loading
<p>I'm hoping this issue is simply something to do with the emulator, basically ive got a Service that sets a timer, as soon as the timertask runs the following code is supposed to execute:</p> <pre><code> String ns = Context.NOTIFICATION_SERVICE; NotificationManager mNotificationManager = (NotificationManager)getSystemService(ns); int icon = R.drawable.androidapplogo; CharSequence tickerText = "Ticker Text"; long when = System.currentTimeMillis(); Notification notification = new Notification(icon, tickerText, when); Context context = getApplicationContext(); CharSequence contentTitle = "My Notification"; CharSequence contentText = "Hello World!"; //Do i need this? Intent notificationIntent = new Intent(); PendingIntent contentIntent = PendingIntent.getActivity(ctx, 0, notificationIntent, 0); notification.setLatestEventInfo(context, contentTitle, contentText, null); mNotificationManager.notify(1, notification); </code></pre> <p>The issue i have, is that when the notification gets called, it appears in the status bar, but when i click on the icon, it just has a blue circle. I dont own an android phone so im guessing that means its trying to load something.</p> <p>Btw, ive pretty much lifted the code from here: <a href="http://developer.android.com/guide/topics/ui/notifiers/notifications.html" rel="nofollow">http://developer.android.com/guide/topics/ui/notifiers/notifications.html</a></p> <p>So my question is two fold: - What is happening, is it failing to load something? - Any ideas on how to fix it, or would it be worth finding a new form of notification</p> <p>EDIT: Im sorry guys, found the issue was that you needed to drag down the Notification Window - i rarely use android x)</p>
java android
[1, 4]
4,009,127
4,009,128
Need to select a drop down list element with a particular attribute value from a list of drop down lists and set its selected value
<p><code>.FilterList</code> is the class name of all the drop down lists </p> <pre><code>var $lists = $('.FilterList[ctype="' + ctype + '"]').css('display', 'inline'); </code></pre> <p>Something like the below works fine but I was wondering if there's a more concise and efficient method I could use instead of the <code>.each()</code></p> <pre><code> $lists.each(function () { $(this).attr('filterid') == filterid ? $(this).val(thisval) : null; }); </code></pre> <p>Whilst I am after something more like:</p> <pre><code>$lists.first('.FilterList[filterid = "' + filterid + '"]').val(thisval); </code></pre>
javascript jquery
[3, 5]
1,072,638
1,072,639
jQuery: Why would selector fail?
<pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="../jquery.js" type="text/javascript"&gt; &lt;/script&gt; &lt;script type="text/javascript"&gt; $(".demo").click(function() { alert("JavaScript Demo"); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p class="demo"&gt;a paragraph&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Why did not the click function response?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
4,488,397
4,488,398
jQuery bind with a different this
<p>I want to bind a function to an event but I want to change the context in which the function is called</p> <pre><code>function Foo(){ t : "123", bar: function(){ // I am here $('#selector').bind('click' this.foo); } , foo: function(){ //I want when to be able to use the current object here by this //this.t should be 123 and this.bar should call the above function } } </code></pre>
javascript jquery
[3, 5]
1,284,394
1,284,395
What is the need for validation of forms in php?
<p>I am done with validation using javascript for a form in PHP. </p> <p>When is there any need for PHP validation?</p> <p>javascript validation in itself ensures that all the fields are filled up. Is there a possibility to check the valid format of the inputs using javascript? </p>
php javascript
[2, 3]
4,620,095
4,620,096
jQuery - Working with arrays
<p>OK so I fixed my last error with the DIV and all..</p> <p>OK so at the very top of my <code>javascript</code> file... I have </p> <pre><code>$(function() { var games = new Array(); // games array }); </code></pre> <p>and then in a new function I have: <code>var gamesLgth = games.length;</code></p> <p>but when I run it, I get this: <code>Uncaught ReferenceError: games is not defined</code></p> <p>When I weird because I initalized it at the very beginning...</p>
javascript jquery
[3, 5]
5,249,743
5,249,744
Will the following result in two HTTP requests?
<pre><code>var img = new Image(); $(img).attr('src', "&lt;?php echo $image_url; ?&gt;"); $(window).load(function(e){ resetImageSize(img); td.css('background-image', 'url("&lt;?php echo $image_url; ?&gt;")'); }); $(window).resize(function(e){ resetImageSize(img); }); function resetImageSize(img){ var wr = $("#wrapper"); var td = $("#wrapper td"); if(img.width &gt; wr.width() || img.height &gt; wr.height()){ td.css('background-size', 'contain'); } else { td.css('background-size', img.width); } } </code></pre> <p>How can I know?</p>
javascript jquery
[3, 5]
275,491
275,492
What does the question mark mean in this function?
<p>Here's the documentation for this plugin (There's only two functions.) <a href="http://tkyk.github.com/jquery-history-plugin/#documentation" rel="nofollow">http://tkyk.github.com/jquery-history-plugin/#documentation</a></p> <pre><code>$(document).ready(function() { function load(num) { $('#content').load(num +".html"); } $.history.init(function(url) { load(url == "" ? "1" : url); }); $('#ajax-links a').live('click', function(e) { var url = $(this).attr('href'); url = url.replace(/^.*#/, ''); $.history.load(url); return false; }); }); </code></pre> <p>Here's the html:</p> <pre><code>&lt;body&gt; &lt;h1&gt;jQuery History Plugin Ajax Sample&lt;/h1&gt; &lt;div id="ajax-links"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#1"&gt;load 1.html&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#2"&gt;load 2.html&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#3"&gt;load 3.html&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div id="content"&gt;&lt;/div&gt; &lt;hr /&gt; &lt;/div&gt; &lt;p&gt;[&lt;a href="../"&gt;All samples&lt;/a&gt;] [&lt;a href="http://github.com/tkyk/jquery-history-plugin"&gt;Project home&lt;/a&gt;]&lt;/p&gt; &lt;/body&gt; </code></pre>
javascript jquery
[3, 5]
521,632
521,633
Finding elements in an object that started as a string
<p>I've got a textarea:</p> <pre><code>&lt;p&gt; Input:&lt;br&gt; &lt;textarea name="text_input" id="text_input"&gt;&lt;/textarea&gt; &lt;/p&gt; </code></pre> <p>I'm trying to treat the textarea value as a jQuery object to be able to find each hypertext link.</p> <p>That textarea has some related script code:</p> <pre><code>&lt;script&gt; $('#text_input').change(process).keyup(process); function process(){ var html = $('#text_input').val(); $(html).find("a").each(function(i,elem){ alert('got here'); }); } &lt;/script&gt; </code></pre> <p>In that textarea, I paste, for example, the text:</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;a href="http://www.google.com/"&gt;hello&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Problem is, the <code>alert()</code> never fires. What am I missing? I guess the <code>$(html)</code> line has issues.</p>
javascript jquery
[3, 5]
5,843,517
5,843,518
How to use spin.js instead of a animated gif
<p>I am just looking for a bit of instruction really. I am very new to JQuery, so it's all a bit hazy.<br> However, I have a form "processing" div that shows <a href="http://stackoverflow.com/questions/9934803/show-div-upon-form-submit-works-in-chrome-ff-ie-but-not-safari">somewhat</a> when a form has been submitted.</p> <p>At the moment I have a simple div with a animated gif to visually show its sending.</p> <pre><code>&lt;div id="loading"&gt;Please wait, your news is being submitted... &lt;img src="/-/images/addwalk-loader.gif"/&gt; </code></pre> <p></p> <p>Ideally, I would like to replace the animated gif with a spinner created through spin.js, as I am aware that animated gifs do not continue to animate on IE once the form has been sent.</p> <p>The only problem is, looking through the documentation, I am a bit unsure as to how I would implement it. Any pointers would be greatly appreciated! Thanks!</p>
javascript jquery
[3, 5]
296,037
296,038
C# equivalent of fread
<p>I am in the process of converting some C++ code to C#, I am trying to figure out how I could write out and following C++ code in my C# app and have it do the same thing:</p> <pre><code>fread(&amp;Start, 1, 4, ReadMunge); //Read File position </code></pre> <p>I have tried multiple ways such as using FileStream:</p> <pre><code> using (FileStream fs = File.OpenRead("File-0027.AFS")) { //Read amount of files from offset 4 fs.Seek(4, SeekOrigin.Begin); FileAmount = fs.ReadByte(); string strNumber = Convert.ToString(FileAmount); fileamountStatus.Text = strNumber; //Seek to beginning of LBA table fs.Seek(8, SeekOrigin.Begin); CurrentOffset = fs.Position; int numBytesRead = 0; while (Loop &lt; FileAmount) //We want this to loop till it reachs our FileAmount number { Loop = Loop + 1; //fread(&amp;Start, 1, 4, ReadMunge); //Read File position //Start = fs.ReadByte(); //Size = fs.ReadByte(); CurrentOffset = fs.Position; int CurrentOffsetINT = unchecked((int)CurrentOffset); //Start = fs.Read(bytes,0, 4); Start = fs.Read(bytes, CurrentOffsetINT, 4); Size = fs.Read(bytes, CurrentOffsetINT, 4); Start = fs.ReadByte(); } } </code></pre> <p>The problem I keep running into is that <code>Start/Size</code> do not hold the 4 bytes of data that I need.</p>
c# c++
[0, 6]
5,679,728
5,679,729
jQuery.validate.js equalTo refuses to work
<p>I am trying to validate that my one password equals the other. The system keeps flagging the passwords not equal error.</p> <p>Let me post my code:</p> <pre><code>&lt;div class="fieldWrapper"&gt; &lt;label for="password" id="id_password"&gt;Password: &lt;/label&gt; &lt;input id="id_password" type="password" placeholder="Password" name="password" maxlength="128" class="valid"&gt; &lt;/div&gt; &lt;div class="fieldWrapper"&gt; &lt;label for="password_verification"&gt;Confirm:&lt;/label&gt; &lt;input id="id_password_verification" type="password" placeholder="Confirm" name="password_verification" maxlength="128"&gt; &lt;/div&gt; $(document).ready(function() { $("#signup-form").validate({ rules: { password: { required: true, minlength: 5 }, password_verification: { required : true, equalTo: "#id_password" } }, messages: { password: { required: "Please provide a password", minlength: "Your password must be at least 5 characters long" }, password_verification: { required: "Please enter your password again", equalTo: "Please enter the same password as above" }, }, submitHandler: function(form) { form.submit(); } }); }); </code></pre> <p>Does anyone have any clue where I am going wrong here? Note that my form has the id signup-form.</p>
javascript jquery
[3, 5]
132,510
132,511
Comparing two arrays in Javascript for different values
<p>Javascript gurus, I need your help.</p> <p>I need to compare two different arrays and check for different values. The values are coming from the same form multi select element. I tried getting a list of current values (cacheTermList) and checking for new value on change (newTermList). The idea is I want to pass an id to an ajax call if a new value was input, and return some data to the screen.</p> <p>Code:</p> <pre><code>var cachedTermList = $('select#edit-categories').val(); if (cachedTermList == null) { var cachedTermList = new Array(); } $('select#edit-categories').chosen().change(function() { var newTermList = $('select#edit-categories').val(); if (cachedTermList != null) { for(var i = 0; i &lt; newTermList.length; i++) { alert(newTermList[i]); if (!($.inArray(newTermList[i], cachedTermList))) { $.ajax({ type: "GET", url: "/classifieds/js/term/" + newTermList[i], success: function(data){ //$('div#term-help-text').html(data); cachedTermList.push(newTermList[i]); alert(cachedTermList); } }); } } } else { } }); </code></pre> <p>Bear with me, I don't tend to work with Javascript too often. I was trying to get a current list of values by setting cachedTermList on load, then when the select changes, set a newTermList to the new value of the field, then loop it, and check for a value in that list that is not in the cached list.</p> <p>While I could see things happen, and dump both term lists and see different values, for the life of me I could not get it to push the found value to the cached list so that the next time the element changes, it doesn't keep sending the same value to the ajax call again and again. After the .push() executes, it just adds ',,,' without values. Where am I going wrong?</p>
javascript jquery
[3, 5]
1,983,113
1,983,114
strange issue with js in updatePanel
<p>I have a link <strong>in an update panel</strong> which calls a js method to do printing of the current window:</p> <pre><code>&lt;a href="javascript:print()" id="cpMain_popupCouponDescriptionControl_hrefPrint"&gt;Print Coupon&lt;/a&gt; </code></pre> <p>where the js method is called on Page_Load event:</p> <pre><code>private void loadJs() { String flashMap = "script"; if (!Page.ClientScript.IsClientScriptBlockRegistered(this.Page.GetType(), flashMap)) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), flashMap, "function print(){ alert('test'); window.print(); return false; }", true); } } </code></pre> <p>When pressing the link, the alert window is shown multiple times (after I click "Ok", which seems strange) but window.print() is never called (a new tab for printing is not opened).</p> <p>If I directly call <code>javascript:window.link</code> from <code>href</code> it works, but because the link is contained in an update panel, it no longer works second time (that's why I tried to register the script).</p> <p>Can anybody see the issue here?</p>
javascript asp.net
[3, 9]
4,364,794
4,364,795
Clicking asp ImageButton returning me back to top of page: Error
<p>I am trying to allow users to edit information on a page with a onclick edit button</p> <p>the page reloads and the page is taken back to the top, each time the button is clicked, it seems to be a huge inconvenience to the user</p> <pre><code> &lt;% Page directives ... MaintainScrollPositionOnPostBack="True" .. %&gt; </code></pre> <p>with my page tag at the top, but its still jumping back to the top any suggestions?</p> <p>I have tried putting it in the webconfig </p> <pre><code> &lt;pages maintainScrollPositionOnPostBack="True" &gt; </code></pre> <p>i have tried putting an asp:Page tag on the page too</p> <pre><code> &lt;asp:Page MaintainScrollPositionOnPostBack="true" .... /&gt; </code></pre> <p>and still puts the position at the top of the page on reload.</p>
c# asp.net
[0, 9]
2,066,711
2,066,712
Android hide keyboard on off focus but not when password field selected
<p>The code below works when I off focus to another textField but not when I just tap anywhere on the screen (which I'd like to trigger the onFocusChanged event). How can I achieve this? I'll also need to check that the other textfield doesnt't have focus, because if it does the keyboard should be retained.</p> <pre><code>usernameET.setOnFocusChangeListener((new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if(v == usernameET) { Log.d(LoginPage.Tag, "keyboardOnTouch"); if (hasFocus) { ((InputMethodManager) a.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(usernameET, InputMethodManager.SHOW_FORCED); } else { ((InputMethodManager) a.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow( usernameET.getWindowToken(), 0); } } } })); </code></pre>
java android
[1, 4]
4,738,199
4,738,200
Convert long strings to html elements in JQuery
<p>i have a string that contain some html in string form, like this one :</p> <pre><code>var string = '&lt;html&gt; ... some code here... &lt;/html&gt;'; </code></pre> <p>the problem is when i try to convert this string to html element in JQuery if the length of this string be bigger than 28457 characters JQuery convert this string to an array, as you see here :</p> <pre><code>var temp = $(string.substr(0, 28458)); </code></pre> <p>if i print "temp" this message is shown :</p> <ul> <li>jQuery.fn.jQuery.init[102]</li> </ul> <p><img src="http://i.stack.imgur.com/zQf5k.png" alt="enter image description here"></p> <p>for access to temp i should do my actions like an array</p> <pre><code>temp[12] /* return some html or text element that contain attribute, baseURI, etc. */ </code></pre> <ol> <li>why this message is shown?</li> <li>what can i do for convert string to html if it's length is bigger than 28458 charachters?</li> </ol> <p>thank you.</p>
javascript jquery
[3, 5]
512,640
512,641
Easy way to resize a directory full of images
<p>Looking for an easy way to resize a directory of images to a given set width and height.</p> <p>Does anyone know an easy way to do this in php or javascript? I have a directory that contains about 100 images and doing this in photoshop would just be highly inefficient.</p> <p>Thanks</p>
php javascript
[2, 3]
494,142
494,143
Get "My Documents" File in Android
<p>I've got a couple of voice recordings and I'd like to play them from my code simply by telling the MediaPlayer the file to play.</p> <p>Trouble is I can't find the files! The phone claims they are in "My Documents/My Recordings", as does windows when I connect the phone as a disk. But when I open that folder as a File in Java, it isn't there.</p> <p>I've looked at <code>Android.os.Environment.getExternalStorageDirectory()</code> and <code>getExternalStoragePublicDirectory()</code>, but I haven't found the magic incantation to get to <strong>My Documents</strong>.</p> <p>Any help would be much appreciated!</p> <p>&lt; Edit > Found the files in <code>/sdcard/My Documents/My Recordings</code> - so I guess the questions becomes "is there a more portable way of doing it than just hard coding /sdcard?".</p>
java android
[1, 4]
1,737,614
1,737,615
Threads and performance with Android games
<p>I've been following this tutorial: <a href="http://www.droidnova.com/playing-with-graphics-in-android-part-iii,176.html" rel="nofollow">http://www.droidnova.com/playing-with-graphics-in-android-part-iii,176.html</a></p> <p>To get comfortable with Android. It's been very, very helpful. In it though, he uses one thread to handle input, and another for drawing to the canvas. This is my first time using threads, and I am wondering if it is wise to put the entire onDraw() method into a synchronized block. Will this cause performance problems, especially in a game handling a lot of bitmaps?</p>
java android
[1, 4]
4,580,643
4,580,644
What does the Request object do in the following scenario?
<p>If I see something like:</p> <pre><code>if(Request["Email"]) { } </code></pre> <p>What does this actually mean? Where is the Email collection member actually being set?</p>
c# asp.net
[0, 9]
4,361,513
4,361,514
cannot print the array passed from javascript to php
<p>here is the code.......here i am passing a javascript array to php... something is going wrong........</p> <p>html:</p> <pre><code> &lt;html&gt; &lt;body onload="aa()" &gt; &lt;script language="javascript"&gt; function aa() { var a, s; a = [ 'one', 'two', 'three']; s = JSON.stringify( a ); document.getElementById("fb_user").innerHTML= s; } &lt;/script&gt; &lt;form action="check1.php" method="post"&gt; &lt;label id="fb_user"&gt; &lt;/label&gt; &lt;input type="submit" value="submit"/&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>php code:</p> <pre><code>&lt;?php $fb_usr_id =json_decode( $_POST['fb_user'], true ); echo $fb_usr_id; ?&gt; </code></pre> <p>when $fb_usr_id is echoed nothing is printed??</p>
php javascript
[2, 3]
4,631,404
4,631,405
Split value into percentage with a slider
<p>im new to jQuery and searching a way for doing smthing like this:</p> <p>I have a value [100] and 5 categorys [apple, banana, kiwi, lemon, orange]</p> <p>What I want is to have for each category a slider (a line with a point on it you can move)</p> <p>So every category starts with a value of 20 (100 / 5).</p> <p>When there is more banana than apple and you "slide" banana to the value of 40 the other values should decrase so I've still the full percentage of 100%.</p> <p>Anyone knows a plugin or has a handy snippet?</p> <p>Thx in advance!</p>
javascript jquery
[3, 5]