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,813,070
5,813,071
Sharing variables and putting text box data into an array
<p>I'm brand new to the subject and very lost. I have a text box on my webSite. The <em>data entered into the textBox</em> will be <em>placed in an array</em>, and a <em>counter will increase</em>. Once the <em>counter reaches five</em>, you <em>cannot add more</em> to the array.</p> <p>There will be a button to display all the names input into the array, which clears the array and the counter as well.</p> <p>I have no idea how to order classes and methods in C#. I put the buttons inside of the main class so that I can share variables between them, but then I can't access the text box.</p> <p>Some code is there because I'm trying to figure this out, but it may not belong in here. The code is also rather bare because I'm just trying to figure it all out. Any help is appreciated.</p> <pre><code>&lt;script runat="server"&gt; public partial class Arrays { private int Counter = 0; protected void btnEnter_Click(object sender, EventArgs e) { Button btn = (Button)sender; btn.Text = (Int32.Parse(btn.Text) + 1).ToString(); Label1.Text = "Enter Another student's name"; } public void btnEnter_Click2(object sender, EventArgs e) { Label1.Text = "Enter a student's name "; } } &lt;/script&gt; </code></pre>
c# asp.net
[0, 9]
4,769,522
4,769,523
jquery getting all dropdown values
<p>I have dropdown <code>&lt;select&gt;</code> with id <code>my_dropdown</code>. I allow multi-select. I know how to pull the selected value(s) using jquery:</p> <pre><code>var values = $('#my_dropdown').val(); </code></pre> <p>This will return an array of values if I select multiple. I also need to get all the values in the dropdown regardless of what is selected. How can I use jquery similarly to get all the values in the dropdown given that id?</p>
javascript jquery
[3, 5]
1,474,256
1,474,257
connecting from android mobile app to a database on a laptop
<p>I'm new to android programming so please I need your help I want to make a mobile application that connects to a databse on my laptop through internet without configuring my router I'm using phpmyadmin in which i created a database, and I made a file called login.php that can make sure of username and password from database I enabled the port 80 in firewall now i wrote in eclipse this url : http:"//192.168.1.3:80/Day%20Manager/Login.php" the ip address is optained by writing ipconfig in cmd and getting the IPV4 address well it's not working it's giving me NetworkOnMainThreadException can you help me please</p>
java android
[1, 4]
4,202,597
4,202,598
Convert Uri to String and String to Uri
<p>I'm developing some Application which allows select image from SD Card, save it into database and set this value for ImageView. I need to know way for converting uri to string and string to uri. Now I used getEncodedPath() method of Uri, but, for example, this code doesn't work:</p> <pre><code>ImageView iv=(ImageView)findViewById(R.id.imageView1); Uri uri=Uri.parse("/external/images/media/470939"); Log.e("uri1", uri.toString()); iv.setImageURI(uri); </code></pre> <p>Therefore I don't know how I can save Uri into database and create a new Uri from saved value. Please, help me to fix it. </p>
java android
[1, 4]
4,433,932
4,433,933
How can I start a fragmentactivity?
<p>For my app I use the ViewPager lib, so users can swipe pages. I would like to use fragmentactivity's or activity's, so I can access the layout elements by FindViewById. But when I try to start my app I get a error:</p> <pre><code>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example/com.example.ViewPagerActivity}: Caused by: java.lang.ClassCastException: com.example.testActivity </code></pre> <p>I cant cast to a fragment... So whats the solution to get this right? </p> <p>Main:</p> <pre><code>/** * The &lt;code&gt;ViewPagerFragmentActivity&lt;/code&gt; class is the fragment activity hosting the ViewPager */ public class ViewPagerActivity extends FragmentActivity{ /** maintains the pager adapter*/ private PagerAdapter mPagerAdapter; /* (non-Javadoc) * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle) */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setContentView(R.layout.main); //initialsie the pager this.initialisePaging(); } /** * Initialise the fragments to be paged */ private void initialisePaging() { List&lt;Fragment&gt; fragments = new Vector&lt;Fragment&gt;(); fragments.add(Fragment.instantiate(this, testActivity.class.getName())); fragments.add(Fragment.instantiate(this, test2Activity.class.getName())); this.mPagerAdapter = new PagerAdapter(super.getSupportFragmentManager(), fragments); ViewPager pager = (ViewPager)super.findViewById(R.id.viewpager); TitlePageIndicator indicator = (TitlePageIndicator) findViewById(R.id.indicator); pager.setAdapter(this.mPagerAdapter); indicator.setViewPager(pager); } } </code></pre> <p>testActivity:</p> <pre><code>public class test extends FragmentActivity { //or activity? /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout); { } </code></pre>
java android
[1, 4]
5,071,342
5,071,343
access object from other scope (javascript)
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/11192875/is-it-possible-to-gain-access-to-the-closure-of-a-function">Is it possible to gain access to the closure of a function?</a> </p> </blockquote> <p>Please have a look at this code: <a href="http://jsfiddle.net/FH6pB/1/" rel="nofollow">http://jsfiddle.net/FH6pB/1/</a></p> <pre><code>(function($) { var o1 = { init: function() { alert('1'); }, } var o2 = { init: function() { alert('2'); }, } }(jQuery)); (function($) { var o3 = { init: function() { alert('3'); }, } o2.init(); }(jQuery)); o1.init(); o2.init(); </code></pre> <p>I have 3 object in 2 different "scopes" (I don't know if it's the right word to use here, but I guess you understand the meaning). As you probably know, I can't access the objects' function from either outside or other "scope" (non of the <code>o.init();</code> will work).</p> <p>Why does it happen? Is there a way to change it?</p> <p>I know I can just put the code in one scope and it will work well, but what if I have scopes in separate JS file?</p> <p>Thanks from advance, Ben</p>
javascript jquery
[3, 5]
5,861,153
5,861,154
How to get central point of Google Map?
<p>I have been developing Android application and I can't make 1 thing - my application uses Google Maps (MapView), and one uses zoom elements for increase/decrease scale of Map. And I need to get center of Map - for example, I can move or increase the Map and than I need to get the central point. I know there is method setCenter() of MapController, but how can I get central point? Thank you. </p>
java android
[1, 4]
2,359,347
2,359,348
How do you call a Javascript function from an ASPX control event?
<p>How do you call a Javascript function from an ASPX control event?</p> <p>Specifically, I want to call the function from the SelectedIndexChanged event of a DropDownList.</p>
asp.net javascript
[9, 3]
2,482,339
2,482,340
Javascript popup and close
<p>HTML</p> <pre><code>&lt;ul&gt; &lt;li class="first"&gt;&lt;a href="#"&gt;Intro&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Crew&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>CSS</p> <pre><code>.page-popup { z-index:500; position:absolute; left:345px; background:#fff; width:680px; height:325px; top:175px; display:none; } </code></pre> <p>JavaScript:</p> <pre><code>$('.first').click(function() { var onOff=false; if (onOff=false) { $('.page-popup').fadeIn('slow', function() { // Animation complete }); onOff = true; } else { $('.page-popup').fadeOut('slow', function() { }); onOff = false; } }); </code></pre> <p>I am trying to create an open close popup effect. When they click on the link the popup fades in, when I click on the link again the popup fades out.</p> <p>*UPDATED. I have figured out how to make it work. I must place the declare:</p> <pre><code>var onOff=false; </code></pre> <p>at page load not when the onclick is executing otherwise it always resets it.......and of course using == for comparison :)</p>
javascript jquery
[3, 5]
280,472
280,473
How can I be sure my Ajax call has fully completed?
<p>I have the following code:</p> <pre><code> $.ajax({ cache: false, url: "/Administration/" + entity + "s/Update", data: { pk: pk, rk: rk, fld: type, val: val }, success: function () { disableLoadingIcon(); if (idArr.substr(0, 8) == 'Position') { location.reload(); } } }); </code></pre> <p>When a user changes some data the code updates the database. There is code that comes before this that picks the data values and it all works good. </p> <p>When the user changes the Position column the database gets changed and I wanted to trigger a refresh of the screen (it's a report screen sorted by position). The refresh works but it seems like it is out of sync. I have the location.reload() in the success area but is it possible that is getting run before the Ajax has completed?</p> <p>Is it possible that this kind of refresh is taking place before the database has been properly updated? When I do another refresh of the page manually from the browser the data always appears in the correct order. </p>
javascript jquery
[3, 5]
220,495
220,496
How to hightlight the text of matched terms in jquery?
<p>I have list of Items and a search box. if search term entered into the search box the matched text should appear with bold letters in the list irrespective of the case(case insensitive). I have done up to some level but later i dont know how to do it, as i am new to the jquery.</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $(".SearchElement").keyup(function(){ keyword = $(".SearchElement").val(); if(keyword.length&gt;=3){ var content = $(".wrapperbox ul li").text(); test = content.match(/keyword/gi) if(test){ //alert(test); } } }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form action=""&gt; &lt;label&gt;SearchTerm:&lt;/label&gt; &lt;input type="text" name="SearchBox" value="" class="SearchElement" /&gt; &lt;/form&gt; &lt;div class="wrapperbox"&gt; &lt;ul&gt; &lt;li&gt;TestString&lt;/li&gt; &lt;li&gt;testString&lt;/li&gt; &lt;li&gt;Kanigiri&lt;/li&gt; &lt;li&gt;KANIGIRI&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>How can i do that, any help will be greatly appriciated. Thank you</p>
javascript jquery
[3, 5]
1,067,136
1,067,137
best way to split a string and get url values using javascript
<p>I have string which is in url like below</p> <pre><code>?type=english&amp;time=today </code></pre> <p>I want to get the values of type and time and curently doing like below</p> <pre><code>var str="?type=english&amp;time=today"; var spt =str.split("&amp;"); var typeval =spt[0].split("=")[1]; var timeval =spt[1].split("=")[1]; document.write(" type :"+typeval+" time : "+timeval); </code></pre> <p>What is the efficient way to get the values using javascript.</p>
javascript jquery
[3, 5]
4,337,619
4,337,620
"error:cannot acces com.hello.LibC","Class file for com.hello.LibC not Found"
<p>I am new to Android.I use this <a href="http://stevethai.wordpress.com/2010/08/04/android-helloworld-with-native-code-tutorial/" rel="nofollow">link</a> to run the NDK Project.</p> <p>I follow all these steps from the given link.However during compilation in the command prompt it shows error like:</p> <pre><code> $ javah com.hello.LibC error: cannot access com.hello.LibC class file for com.hello.LibC not found javadoc: error - Class com.hello.LibC not found. Error: No classes were specified on the command line. Try -help. </code></pre> <p>please help me. Thanks in Advance.</p>
java android
[1, 4]
5,613,507
5,613,508
Two different actions on form submit
<p>I have a form with a submit button. I have called a function on click of submit button.</p> <pre><code>function actionPage(form1) { form1.action="action1.php"; form1.submit(); return(true); } </code></pre> <p>Now i want that the form data should be submitted to two different pages. These pages are on different servers.</p> <p>I know that we can send the data to a particular page according to the conditions but i am not sure whether we can submit to two different pages at the same time i.e:</p> <pre><code>function actionPage(form1) { form1.action="action1.php"; form1.submit(); return(true); form1.action="action2.php"; form1.submit(); return(true); } </code></pre> <p>Right now it is showing action1.php</p> <p>Please guide me on this .</p> <p>Regards,</p> <p>Pankaj</p>
php javascript
[2, 3]
2,320,768
2,320,769
adding a new items to a list. I think either the original items are being overwritten every time or a new list is being created each time
<p>I'm using asp.net 4 and C#. I'm having problems adding items to a list via an event from a button click. On the button click I want to read the text from a text box, convert it to an int and add it to the bottom of a List of type int. I then want to display each item in the List in a label. The problem is that it only displays the most recent textbox entry each time. I've spent ages looking at this and trying different things but cant work out what i'm doing wrong. Please can anybody help?</p> <p>My code is as follows:</p> <pre><code>namespace CSI { public partial class _Default : System.Web.UI.Page { string lablelItems; List&lt;int&gt; numbers = new List&lt;int&gt;(); protected void Page_Load(object sender, EventArgs e) { } protected void AddToSeqBTN_Click(object sender, EventArgs e) { int number; number = Convert.ToInt32(AddNumberTXB.Text); numbers.Add(number); printtolabel(numbers); } private void printtolabel(List&lt;int&gt; numbers) { foreach (int n in numbers) { lablelItems += " " + n.ToString(); CurrentSequenceLBL.Text = lablelItems; } } </code></pre>
c# asp.net
[0, 9]
3,302,375
3,302,376
Javascript jquery strange error
<pre><code>$(document).ready(function() { $.ajax({ type: "get", url: "textman.php", success: function(data) { $('#textbaz').append(data); var file = data.split(" "); var set = 0; console.log(file); $('#textbaz').append("&lt;br&gt;&lt;input id='textbox' type='text' placeholder='Type it man, your on the clock!'&gt;"); } }); $("#textbox").keypress(function() { console.log($("#textbox").val()); }); return false; }) </code></pre> <p>Problem is, it just doesnt console log the value of #textbox. No matter what i type in there, it has no effect D:</p>
javascript jquery
[3, 5]
1,935,543
1,935,544
PHP and JavaScript Dates don't match - Strange anomaly
<p>HTML/PHP: </p> <pre><code>&lt;button onclick="change_value(&lt;?php echo $date?&gt;)"&gt;Go&lt;/button&gt; </code></pre> <p>JavaScript: </p> <pre><code>function change_value(date_used) { alert(date_used); } </code></pre> <p>When I right-click on the button and click the "Inspect Element" button shows the parameter correctly, i.e something like this:</p> <pre><code>&lt;button onclick="change_value(2012-08-22)"&gt;Go&lt;/button&gt; </code></pre> <p>But the <code>alert</code> in the JavaScript is displaying <code>1981</code>. That's it - only <code>1981</code>. Not only the date is wrong, but the format, too.</p> <p>What is this happening and how can I fix it?</p>
php javascript
[2, 3]
3,253,308
3,253,309
Download and save aspx page
<p>I am saving as html file. </p> <pre><code>string url=HttpContext.Current.Request.Url.AbsoluteUri; string sHtml=""; HttpWebRequest request; HttpWebResponse response=null; Stream stream=null; request=HttpWebRequest)WebRequest.Create(url); response=(HttpWebResponse)request.GetResponse(); stream=response.GetResponseStream(); StreamReader sr=new StreamReader(stream,System.Text.Encoding.Default); sHtml=sr.ReadToEnd(); string path=Environment.GetFolderPath(Environment.SpecialFolder.Desktop); string textfilename=TextBox1.Text; string getpath=path+"\\"+textfilename+".html"; File.WriteAllText(getpath,sHtml); if(stream!=null)stream.Close(); if(response!=null)response.Close(); </code></pre>
c# asp.net
[0, 9]
3,775,130
3,775,131
Need help with this error ::Invalid token '=' in class, struct, or interface member declaration
<p>trying to hide a panel of Master Page in my content page using the following code</p> <pre><code> Panel p = this.Master.FindControl("panel1") as Panel; p.Visible = false; //Error is showing on this line </code></pre> <p>Why this error ? Plz help..thnx</p>
c# asp.net
[0, 9]
1,112,355
1,112,356
how to call a javascript function from my controller?
<p>Hi I have a form in my view page on submit a function in a controller called <code>function Login()</code> is called This is my Login function</p> <pre><code>function Login() { $EmailId = $this-&gt;input-&gt;post('mailId'); $Password = $this-&gt;input-&gt;post('password'); $res=$this-&gt;friendsmodel-&gt;CheckLogin($EmailId,$Password); if($res==true) { $_SESSION['Authenticaton_user']="auth_user"; $this-&gt;session-&gt;set_flashdata('item', 'Thanks for logging in'); //I want to call javascript function from here redirect('friends/Display_News'); } else { $this-&gt;session-&gt;set_flashdata('item', 'Username Or Password is invalid'); redirect('friends'); } } </code></pre> <p>Now want to call a javascript function named <code>topBar()</code> from my if and else statement This is my script</p> <pre><code> function topbar(message) { var alert = $('&lt;div id="alert"&gt;'+message+'&lt;/div&gt;'); $(document.body).append(alert); var $alert = $('#alert'); if ($alert.length) { var alerttimer = window.setTimeout(function() { $alert.trigger('click'); }, 5000); $alert.animate({ height: $alert.css('line-height') || '50px' }, 200).click(function() { window.clearTimeout(alerttimer); $alert.animate({ height: '0' }, 200); }); } } </code></pre> <p>How to call a javascript from here</p>
php javascript
[2, 3]
234,750
234,751
Simplest way to animate button
<p>I have to code animated menu buttons for my Android app. It will be look something like this: ![enter image description here][1]</p> <ul> <li>simple mockup of menu: i.stack.imgur.com/vT788.png</li> <li>Animation looks like some kind of cube rotation - one spin of cube, something like that..</li> </ul> <p>I'm looking simplest way to program animation for menu buttons (for example "button1"). By on click it have to do animation first, then show content of submenu. "button1" have to be animated by four *.png file:</p> <ul> <li>button1.png</li> <li>button1_step1.png</li> <li>button1_step2.png</li> <li>button1_step3.png</li> </ul> <p>Anyone know a siple way to code this? Thank's in advance ;-)</p>
java android
[1, 4]
4,609,740
4,609,741
Android SMS API
<p>I know that the SMS content provider is not part of the public API (at least not documented), but if I understand correctly it's still possible to use many of the SMS features as long as you know how to use the API(?).</p> <p>E.g it's pretty straightforward to insert an SMS into your inbox:</p> <pre><code> ContentValues values = new ContentValues(); values.put("address", "+457014921911"); contentResolver.insert(Uri.parse("content://sms"), values); </code></pre> <p>Unfortunately this does not trigger the standard "new-SMS-in-your-inbox" notification. Is it possible to trigger this manually? </p> <p><strong>Edit</strong>: AFAIK the "standard mail application (Messaging)" in Android is listening for incoming SMSes using the android.permission.RECEIVE_SMS permission. And then, when a new SMS has arrived, a status bar notification is inserted with a "special" notification id. So one solution to my problem (stated above) could be to find, and send the correct broadcast intent; something like "NEW SMS HAS ARRIVED"-intent.</p> <p><strong>Edit</strong>: Downloaded a third party messaging application (<a href="http://www.chompsms.com/" rel="nofollow">chompsms</a>) from Android market. This application satisfies my needs better. When i execute the code above the chompsms notice the new sms and shows the "standard status bar notification". So I would say that the standard Android Messaging application is not detecting sms properly? Or am I wrong?</p>
java android
[1, 4]
1,665,749
1,665,750
Model / DAO in Android
<p>I would like to have a model (or similar) which i want to save and fetch data from. For example; I run an asynctask, and in <code>onPostExecute</code> i want to save the return value to the model, which i would be able to make use of in my other classes (once the asynctask is complete ofcourse).</p> <p>Hopefully you understand what im after here, otherwise ill elaborate.</p> <p>Thanks!</p>
java android
[1, 4]
5,646,618
5,646,619
Is ASP.NET HttpPostedFile.SaveAs a blocking call?
<p>I was wondering whether <code>HttpPostedFile.SaveAs</code> function in ASP.NET C# is a blocking call.</p>
c# asp.net
[0, 9]
3,477,439
3,477,440
removing all elements from xml file except root element c#
<p>I have an xml file </p> <pre><code>&lt;Abc&gt; &lt;image filename="1.jpg" heading="1.jpg" /&gt; &lt;image filename="10.jpg" heading="10.jpg" /&gt; &lt;image filename="11.jpg" heading="11.jpg" /&gt; &lt;image filename="2.jpg" heading="2.jpg" /&gt; &lt;image filename="3.jpg" heading="3.jpg" /&gt; &lt;/Abc&gt; </code></pre> <p>I want to delete all elements except root element. How to accomplish this.Please help me.</p>
c# asp.net
[0, 9]
2,632,546
2,632,547
How to populate infinite scroll with images from 1 directory?
<p>I have a <code>&lt;div id="content" class="clearfix"&gt;&lt;/div&gt;</code> which self populates with a list of image urls from a separate directory on my server. </p> <p>Here is the live URL for the site : <a href="http://ilovesmallies.com/forum/showcase.php" rel="nofollow">http://ilovesmallies.com/forum/showcase.php</a></p> <p>I want to use infinite scroll and masonry plugins in this div. </p> <p>However, I'm unsure of how to point towards a list of image urls with this script...</p> <p>Here is how it is coded now and does not work. </p> <pre><code>&lt;script&gt; $(function(){ var $container = $('#content'); $container.imagesLoaded(function(){ $container.masonry({ itemSelector: '.box', columnWidth: 250 }); }); $container.infinitescroll({ navSelector : '#content', // selector for the paged navigation nextSelector : '#content a', // selector for the NEXT link (to page 2) itemSelector : '.box', // selector for all items you'll retrieve loading: { finishedMsg: 'No more pages to load.', img: 'http://i.imgur.com/6RMhx.gif' } }, // trigger Masonry as a callback function( newElements ) { // hide new items while they are loading var $newElems = $( newElements ).css({ opacity: 0 }); // ensure that images load before adding to masonry layout $newElems.imagesLoaded(function(){ // show elems now they're ready $newElems.animate({ opacity: 1 }); $container.masonry( 'appended', $newElems, true ); }); } ); }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
2,281,180
2,281,181
immutable collection?
<p>i use a readonly collection to prevent users from altering my cached data, but the items themselves are ofcourse muatble. Is there a way to prevent that behaviour?</p> <p>Michel</p>
c# asp.net
[0, 9]
3,337,597
3,337,598
When OnResize doesn't notice you resized
<p>Window -> IFRAME -> DIV</p> <p>I have a window, that has an iframe, that has a div. The div has the ability to scroll the content within but not having full control of the parent window, I have to decide how large the div needs to be from within the iframe. </p> <p>To do this, I have the following code JavaScript (please pardon the mix of jQuery/straight JavaScript):</p> <pre><code> $(window.parent).resize(function () { var frameHeight = parent.document.getElementById('IFRAME_banner').offsetHeight - 52; $("div.ajax__tab_body").height(frameHeight); }); </code></pre> <p>This code works fine as long as you resize the window by dragging one of the corners. If you vertically resize by dragging the bottom of the window, it does not fire this event and the div does not properly resize. </p> <p>I use the iframe as a reference since it seems to automagically resize itself because of something the parent window does. (This is all in MS CRM Dyanamics...so who knows what is happening behind the scenes)</p> <p>Does anyone know why this would be? And what I would have to do to work around this?</p> <p>Hackish is ok in this instance. The whole thing is a big hack.</p>
javascript jquery
[3, 5]
928,517
928,518
The import org.apache.commons.net cannot be resolved
<p>Why am I getting this error? I already imported the jar file in my eclipse project.</p>
java android
[1, 4]
3,425,808
3,425,809
How to center a ImageView vertically in its parent?
<p>My layout design is a TextView with long text and a ImageView to the right of the TextView. I want to center the ImageView in its parent vertically, so I used android:layout_centerVertical="true", but it turned out that the ImageView was aligned to the bottom of its parent. If I don't use layout_centerVertical property, the ImageView will be aligned to the top of its parent. How can I solve this problem? Thanks.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#000000"&gt; &lt;ImageView android:id="@+id/t3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/arrow_right" android:layout_alignParentRight="true" android:background="#ff0000" android:layout_centerVertical="true" android:scaleType="centerInside" /&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="This a very very very very very very very very very very very very very very very very long sentence" android:textColor="#231ACC" android:layout_toLeftOf="@id/t3" /&gt; &lt;/RelativeLayout&gt; </code></pre>
java android
[1, 4]
1,226,257
1,226,258
jquery validate position
<p>I'm trying to use jquery validate. Following the example: <a href="http://docs.jquery.com/Plugins/Validation">http://docs.jquery.com/Plugins/Validation</a> works great and I'd like to reproduce with my code. However I'm not sure where to call it.</p> <p>What I have is a generated html table and when you click the "Edit" button for any row it opens up a form. I want to validate this form with jquery. I believe it is working but when I hit submit on the form I hide the form so I can never see the validation work...I think.</p> <p>I generate the form with javascript and the submit button looks like this:</p> <pre><code>var mysubmit = document.createElement("input"); mysubmit.type = "submit"; mysubmit.name = "Submit"; mysubmit.value = "Apply" mysubmit.onclick = function() { //return formSubmitactivecameras(); js("#EditCameraForm").validate(); this.form.submit(); }; myform.appendChild(mysubmit); </code></pre> <p>This is hardly enough information so I have all the code in this fiddle: <a href="http://jsfiddle.net/UtNaa/36/">http://jsfiddle.net/UtNaa/36/</a>. However I can't seem to get the fiddle to work when you click the Edit button. Which opens up a form where I want the validation.</p> <p>I'm not sure validation is actually working. Maybe it is but when you hit the submit button on the form, the form hides. Again the fiddle doesn't work to show the form but it does work for me on my site. Hopefully the code in there will at least help. </p>
javascript jquery
[3, 5]
5,458,749
5,458,750
Open My Documents
<p>Hi I have a link to a file in 'my documents' this is an internal web site. How can I open the users local MY Documents folder using JS or JQ </p> <p>I used this code and thought the documents would appear in a web page but it didnt</p> <pre><code>address = "G:\systems Projects" ; window.open(address,"Detail ","width=800,height=600" ) </code></pre> <p>Any help appreciated ! , thanks </p>
javascript jquery
[3, 5]
1,669,267
1,669,268
Problem Export data from dataset to Excel
<p>I want to export data from dataset to Excel using C# in Asp.Net</p>
c# asp.net
[0, 9]
1,123,125
1,123,126
FF javascript woes
<pre><code>Zoom.addEventListener('click', function(){$(document).ready(function(){$("#draggable").draggable({containment: '#imgContainer', scroll: false});});}); </code></pre> <p>let me first explain the code. Zoom is a handler/button on clicking which i am enabling the dragging of an image object.</p> <p>the above code works fine with Chrome but FF is finding errors. Let me quote Firebug:</p> <pre><code>[Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: http://localhost/slide/script.js :: anonymous :: line 69" data: no] [Break on this error] Zoom.addEventListener('click', functio... '#imgContainer', scroll: false});});}); </code></pre> <p>i am getting it to work fine in Chrome but in Firefox i cannot click the button. pls help me out...</p>
javascript jquery
[3, 5]
2,175,120
2,175,121
how to get property from code behind jquery variable?
<p>I want to retrieve property value in jquery function and want to set it in variable. I am trying with below code but its not working.</p> <p>.cs file</p> <pre><code>private string _Heading; public string Heading { get { return _Heading; } set { _Heading = value; } } </code></pre> <p>.aspx</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $("#btnShowSimple").click(function (e) { ShowDialog(false); e.preventDefault(); var someProp = "&lt;%= this._Heading; %&gt;"; alert(someProp); }); &lt;/script&gt; </code></pre> <p>What should i do to retrieve property value?? Anyone have solution than please help me in this.</p>
c# jquery asp.net
[0, 5, 9]
775,260
775,261
Jquery removing class of span object without passing the Id
<p>I have a input tag before which I have a span tag.</p> <pre><code>&lt;li&gt; &lt;span class="class1 class2" style="background-position: 0pt 0pt;"&gt;&lt;/span&gt; &lt;input id="in1" class="inputclass" type="checkbox" name="in1"&gt; &lt;label for="in1"&gt;text here&lt;/label&gt; &lt;/li&gt; &lt;li&gt; &lt;span class="class1 class2" style="background-position: 0pt 0pt;"&gt;&lt;/span&gt; &lt;input id="in2" class="inputclass" type="checkbox" name="in2"&gt; &lt;label for="in2"&gt;text2 here&lt;/label&gt; &lt;/li&gt; </code></pre> <p>I need to remove the class2 from the 2nd span tag above when checkbox i.e in1 is checked. How can I do that?</p> <p>Also there are many input and span tags. please help.</p> <p>Thanks </p>
javascript jquery
[3, 5]
3,204,539
3,204,540
Accessing control created dynamically in code behind
<p>i have a link button which i have created dynamically and added it to a div i want to access this link button in some other function in code behind how to do this</p>
c# asp.net
[0, 9]
5,960,269
5,960,270
How to use PHP to return a count of images in a directory?
<p>I have a Javascript object like this:</p> <blockquote> <pre><code>var count = { table:19, people:39, places_details:84, story_1:18, story_2:6, story_3:11 } </code></pre> </blockquote> <p>Each item (table, people, etc.) is a directory <em><strong>within</strong></em> my <code>graphics/</code> directory at the site root. I would like to use PHP to supply the numeric values by counting the JPG images in the corresponding directory. I imagine something like this:</p> <blockquote> <pre><code>ar count = { table: &lt;?php count(dir("table")) ?&gt;, people: &lt;?php count(dir("people")) ?&gt;, places_details: &lt;?php count(dir("places_details")) ?&gt;, story_1: &lt;?php count(dir("story_1")) ?&gt;, story_2: &lt;?php count(dir("story_2")) ?&gt;, story_3:&lt;?php count(dir("story_3")) ?&gt; } </code></pre> </blockquote> <p>But need to filter for JPG and return a number. What's the right code?</p>
php javascript
[2, 3]
4,257,684
4,257,685
The import org.apache.commons.net cannot be resolved
<p>Why am I getting this error? I already imported the jar file in my eclipse project.</p>
java android
[1, 4]
568,048
568,049
Grid View using javascript or in PHP
<p>I need a simple grid view with horizontal and vertical scroll bar using Jquery or simple javascript or in php, can anyone suggest me a simple grid view plugin?</p>
php javascript jquery
[2, 3, 5]
4,447,181
4,447,182
Retrieve data from dynamically created controls
<p>I am dynamically creating several dropdown list on the selection changed event of a main (static) dropdown list. These are created in The <code>TableCell</code> of default <code>Table</code>. When submit button is clicked I need to load a new page with selected values of dropdown as parameters. Basically I need to get the dropdown results in the second page. </p> <p>This is how dropboxes are created:</p> <pre><code> while (reader.Read()) { pcID = int.Parse(reader["fk_pcID"].ToString()); pcDesc = GetpcDescription(pcID); List&lt;Product&gt; prodList = GetProductsBypcID(pcID); DropDownList ddList = new DropDownList(); ddList.ID = "ddlPC" + pcID; foreach(Product prod in prodList) { ddList.Items.Add(new ListItem(prod.ProductName, prod.ProductID.ToString())); } TableCell cell1 = new TableCell(); cell1.Text = pcDesc; TableCell cell2 = new TableCell(); cell2.Controls.Add(ddList); TableRow row = new TableRow(); row.Cells.Add(cell1); row.Cells.Add(cell2); table.Rows.Add(row); } </code></pre> <p>EDIT: The above code runs at the selection changed event of a dropdown which is set to runat server. But dynamically created dropdowns are not set to run at server</p>
c# asp.net
[0, 9]
3,853,139
3,853,140
how to collect form ids using jQuery
<p>A jQuery selector <code>$(".thumb_up")</code> returns a collection of forms like this:</p> <pre><code>[&lt;form id="like_post_78" ...&lt;/form&gt; &lt;form id="like_post_79"&gt; ... &lt;/form&gt;] </code></pre> <p>Ultimately I want to generate a string consisting of the numerical ending portion of the form ids.</p> <pre><code>"78,79" </code></pre> <p>What's the most efficient way of getting this?</p>
javascript jquery
[3, 5]
5,255,150
5,255,151
click() not working as expected
<pre><code>$j('#carousel').jcarousel({ vertical: true, scroll: 1, auto: 2, wrap: 'last', initCallback: mycarousel_initCallback }); $j('div#slideshow-carousel a img').css({ 'opacity': '0.5' }); $j('div#slideshow-carousel a img:first').css({ 'opacity': '1.0' }); $j('div#slideshow-carousel li a').hover( function () { if (!$j(this).has('span').length) { $j('div#slideshow-carousel li a img').stop(true, true).css({ 'opacity': '0.5' }); $j(this).stop(true, true).children('img').css({ 'opacity': '1.0' }); } }, function () { $j('div#slideshow-carousel li a img').stop(true, true).css({ 'opacity': '0.5' }); $j('div#slideshow-carousel li a').each(function () { if ($j(this).has('span').length) $j(this).children('img').css({ 'opacity': '1.0' }); }); }).click(function () { $j('div#slideshow-main li').removeClass('active'); $j('div#slideshow-main li.' + $j(this).attr('rel')).addClass('active'); return false; }); </code></pre> <p>This simple carousel script works perfectly except the click part; nothing happens on clicking the thumbnails, they should be applied the 'active' class.</p>
javascript jquery
[3, 5]
1,467,103
1,467,104
jQuery ASP.NET find a particular CheckBox in a CheckBoxList by the innerHTML of the CheckBox Label
<p>I have an ASP.NET CheckBoxList:</p> <pre><code>&lt;asp:CheckBoxList ID="CheckBoxList1" runat="server" Width="10%"&gt; &lt;asp:ListItem Selected="True" Value="1"&gt;White&lt;/asp:ListItem&gt; &lt;asp:ListItem Selected="False" Value="2"&gt;Black&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="3"&gt;Red&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="4"&gt;Green&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="5"&gt;Blue&lt;/asp:ListItem&gt; &lt;/asp:CheckBoxList&gt; </code></pre> <p>I need to modify/delete a particular label of a particular CheckBox in a CheckBoxList:</p> <p>The following code is working fine for the CheckBox value, however it is not working for the CheckBox label. </p> <pre><code>var CheckBoxListInputValue = 3; //value may be dynamic var CheckBoxListInputInnerHTML = "Red"; //value may be dynamic $("#CheckBoxList1 label[innerHTML =" + CheckBoxListInputInnerHTML + "]").remove(); //Not working $("#CheckBoxList1 :input[value = " + CheckBoxListInputValue + "]").remove(); //Working </code></pre> <p>BTW, I don't want to use any for loop.</p>
jquery asp.net
[5, 9]
3,921,290
3,921,291
Forced selection in hidden / Backend using Javascript OR JQuery
<p>I have regular form like this.</p> <pre><code> &lt;form action="/domainchecker.php" method="post"&gt; &lt;input type="text" name="domain" size="20"&gt; &lt;fieldset&gt; &lt;select name="ext"&gt; &lt;option&gt;.com&lt;/option&gt; &lt;option&gt;.net&lt;/option&gt; &lt;option&gt;.org&lt;/option&gt; &lt;option&gt;.us&lt;/option&gt; &lt;option&gt;.info&lt;/option&gt; &lt;option&gt;.biz&lt;/option&gt; &lt;option&gt;.mobi&lt;/option&gt; &lt;option&gt;.name&lt;/option&gt; &lt;option&gt;.tv&lt;/option&gt; &lt;option&gt;.me&lt;/option&gt; &lt;/select&gt; &lt;/fieldset&gt; &lt;input type="submit" value="Go"&gt; &lt;/form&gt; </code></pre> <p>This selectbox enables to select only one option.</p> <p>What I want is <strong>Forced selection in hidden / backend</strong> for the first 5 options regardless user select it or not.</p> <p>How can I achieve this using JavaScript OR JQuery ?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
3,777,619
3,777,620
one document.createElement, append it twice, only shows once
<p>I have a button I want to use in the beginning and the end of the page:</p> <pre><code>var button_save = document.createElement('button'); $("#compteurs").append(button_save); [...] $("#compteurs").append(button_save); </code></pre> <p>but it only appear at the end of the page. If I remove it from the bottom of the page, it appear at the begining of page. It's a kind of pointer. Is there a way to create the button only once and use it twice? Thanks!</p>
javascript jquery
[3, 5]
3,357,300
3,357,301
PHP and Javascript code needed to check if form fields are not empty
<p>Javascript needed to prevent form submit if any of field is empty. all my form fields start names start with name=add[FieldName] those are the fields that need checking.</p> <p>PHP, backend check before submiting to database double check to make sure all $POST are not empty</p>
php javascript
[2, 3]
1,203,803
1,203,804
Toggle TWO Drop Down Panels
<p>I am using two panels at the top of my web page that drop down: "Fast Quote" and "Client Login". Can someone show me how to alter my code so that ONLY ONE panel is open at one time? Example: If "Client Login" is open and the user clicks on "Fast Quote", the "Client Login" should close and the "Fast Quote" drops down.</p> <p>Here is my website: <a href="http://www.ubspack.com" rel="nofollow">http://www.ubspack.com</a></p> <p>CODE:</p> <pre><code>$(document).ready(function(){ $(".btn-slide").click(function(){ $("#panel_quote").slideToggle("slow"); $(this).toggleClass("closeQ"); return false; }); }); $(document).ready(function(){ $(".btn-slide2").click(function(){ $("#panel_login").slideToggle("slow"); $(this).toggleClass("closeL"); return false; }); }); </code></pre>
javascript jquery
[3, 5]
3,728,675
3,728,676
jQuery selection not working in chrome
<p>I've got the following code to run when value is entered to an input. The event is triggered when the focus goes out from the input. </p> <pre><code>$("#guest-level option[id='"+ result.BookingInfo.guestLevelCode +"']").attr("selected", "selected"); </code></pre> <p>This doesn't get executed in chrome but works perfectly in firefox. How can I fix this!</p>
javascript jquery
[3, 5]
2,350,434
2,350,435
jquery: how to know an item is invisible in an aspx page?
<p>If the visible of a server side control is set to false, even I know it's id, is that possible to know that it is invisible by using jQuery? what code should I use, say the control id="test1".</p>
jquery asp.net
[5, 9]
4,483,602
4,483,603
Open dialogue box on <div> click?
<p>My site pages run off <code>header.php</code>, which contains all the JavaScript and CSS needed for all the pages.</p> <p>What I am trying to do is make it so that, whatever page a user is on, if they click the <code>&lt;div&gt;</code> <code>.register_button_click</code>, they will have a JavaScript dialogue box open up. I have placed the JavaScript in the header.php file and have created my <code>&lt;div class="register_button_click"&gt;click here&lt;/div&gt;</code>, but it's not bringing anything up.</p> <p>Where am I going wrong?</p> <pre><code>&lt;head&gt; &lt;script type="text/javascript"&gt; var $dialog; $(document).ready(function () { $dialog = $('&lt;div&gt;&lt;/div&gt;') .html('My Dialog Demo...') .dialog({ autoOpen: false, title: 'My Dialog' }); $('#register_button_click').click(function () { $dialog.dialog('open'); return false; ////cancel eventbubbeling }); }); function showDialog() { $dialog.dialog('open'); return false //cancel eventbubbeling } &lt;/script&gt; &lt;/head&gt; </code></pre>
javascript jquery
[3, 5]
4,950,881
4,950,882
Javascript - looking for an alternative to prependTo so that it doesn't add multiple items
<p>I have some code. When it runs correctly, I create a success message and use prependTo in order to display it on the screen. The problem is that when the user does their successful action twice, I end up with two success messages.</p> <p>Is there a way to overwrite my success message. Here is how I currently handle it in my code:</p> <pre><code> $((is_error ? "&lt;p class=' alert alert-error'&gt;"+message+"&lt;/p&gt;)" : "&lt;p class=' alert alert-success'&gt;"+message+"&lt;/p&gt;")).prependTo("#feedback-container"); </code></pre> <p>Thanks!</p>
javascript jquery
[3, 5]
2,320,115
2,320,116
Jquery click-event but not holding down/marking text-event
<p>I have a table wich expands/contracts on click. It works great, however, there is one problem, sometimes users might want to copy text in the table, and thus their line contracts(on the click)</p> <p>Is there some way to avoid the event being triggerd on click but not if you hold the mouse down and/or mark text?</p> <p>Sample page: <a href="http://resihop.nu/search?from=&amp;to=&amp;when=&amp;got_car=1&amp;code=" rel="nofollow">http://resihop.nu/search?from=&amp;to=&amp;when=&amp;got_car=1&amp;code=</a> </p> <p>I would much appriciate if you could supply an example, i'm not that used to javascript. :)</p>
javascript jquery
[3, 5]
799,975
799,976
JQuery - Make my script work?
<p>I have written a script. It does work! It's just a bit rubbish. Could someone tell me where I am going wrong.</p> <p>Basically, I have a 5 star rating box. When the mouse hovers over the various parts of the box I need the stars to change.</p> <p>Currently the stars only change when you move your mouse over and out of the element. I need the stars to change while the mouses within the element. I think the problem is with the event but I have tried a couple and it seems to make no difference.</p> <pre><code>$(".rating").mouseover(function(e) { // Get Element Position var position = $(this).position(); var left = position.left; // Get mouse position var mouseLeft = e.pageX; // Get Actual var actLeft = mouseLeft - left; $(".info").html(actLeft); if (actLeft &lt; 20) { $(this).attr('style', 'background-position:0;'); } else if (actLeft &lt; 40) { $(this).attr('style', 'background-position:0 -20px;'); } else if (actLeft &lt; 60) { $(this).attr('style', 'background-position:0 -40px;'); } else if (actLeft &lt; 80) { $(this).attr('style', 'background-position:0 -60px;'); } else { $(this).attr('style', 'background-position:0 -80px;'); } }); </code></pre>
javascript jquery
[3, 5]
1,713,602
1,713,603
Accessing ASP.NET Server variables in jQuery
<p>In Page_Load() function, I have populated an arraylist and a hashtable. I need to read their values in the $(document).ready(function(){...}.</p> <p>I am a beginner in terms of ASP.NET and jQuery. Please suggest a way to do it.</p> <p>cheers </p>
asp.net jquery
[9, 5]
4,618
4,619
Add margin dynamically to any found occurrence
<p>How can I make it more elegant and universal? It works but I would like to have the margin added +52px to every next .alert occurrence.</p> <pre><code>var alerts = $(".alert"); if(alerts.is(":visible")) { if(alerts.length &gt; 1 ) { alerts.eq(1).css('margin-top', '52px'); alerts.eq(2).css('margin-top', '104px'); alerts.eq(3).css('margin-top', '156px'); } alerts.delay(5000).slideUp("slow"); } </code></pre> <p>Any thoughts? </p>
javascript jquery
[3, 5]
1,256,901
1,256,902
Can't open Websphere Portal 7.0 Login Page after its integration with a custom user registry?
<p>I am currently working on a project related to Websphere Portal 7.0 on Windows Server 2008 R2,64 bit. I am trying to integrate websphere portal with my custom user registry.I have completed all the steps required to implement custom user registry in portal as given in IBM documentation.I am adding my custom repository to the default federated repositories of Portal 7.0.I have made the required changes under VMM Federated CUR Properties section in wkplc.properties.I am using configengine.bat file to configure Portal with user registry. But even completing all the steps,when I am trying to open the Portal Login Page through <a href="http://ip-address:port_of_portal/wps/portal" rel="nofollow">http://ip-address:port_of_portal/wps/portal</a> ,it is throwing an exception on the console: "Error 500: com.ibm.wps.resolver.data.exceptions.URIProcessingIOException: EJCBD0021E: The URI dav:fs-type1/themes/PageBuilder2/theme.html and parameters [['themeURI'=, 'mime-type'= could not be processed: [EJCBD0021E: The URI dav:fs-type1/themes/PageBuilder2/theme.html and parameters [['themeURI'=, 'mime-type'= could not be processed: EJPSG0002E: Requested Member does not exist.uid=portal,o=defaultWIMFileBasedRealm/null] " and in logs Systemout.log "EJPSB0005E: Exception occurred during creation of the principal with Name uid=portal,o=defaultWIMFileBasedRealm and Principal Type USER caused by com.ibm.portal.puma.MemberNotFoundException: EJPSG0002E: Requested Member does not exist.uid=portal,o=defaultWIMFileBasedRealm/null".</p> <p>Here,"portal" is administrative user in my custom user registry.I am able to access WAS using /ibm/console through user "portal".Please suggest some way to handle this issue.</p>
java c++
[1, 6]
5,198,979
5,198,980
In a repeater, how can determine the RepeaterItem of the button clicked during a CustomValidator OnServerValidate event?
<p>I have a repeater with Remove buttons (LinkButton). Expensive database calls determine if a row can be removed (weird and not ideal, I know). In each row, I've got a CustomValidator that has a OnServerValidate event hander.</p> <p>The problem is that I don't know which RepeaterItem the user is attempting to remove during the multiple calls to CustomValidator.OnServerValidate() event. If I had this information, I could filter the validation to the exact row the user is trying to remove.</p> <p>For now, I've unsubscribed from CustomValidator.OnServerValidate and hacked it together so Repeater.OnItemCommand gathers the RepeaterItem and passes it into a validation method that sets CustomValidator.IsValid after the database validation. This works, but seems lame. There has got to be a way to keep my validation code in my validator.</p> <p>Thanks in advance for any help.</p>
c# asp.net
[0, 9]
5,071,236
5,071,237
requestLocationUpdates generates locations after..?
<p>I got an error on my application so I need to check every single line to find the error which leads me to this question:</p> <p>In case that I send a 10 seconds as minTime in the requestLocationUpdates method, the method will start to count to 10 exactly when it call the listener? or when the listener method is finished?</p>
java android
[1, 4]
5,100,980
5,100,981
How to check on inserting new values if they already exists?
<p>I have a gridview and sqldatasource to bind data to gridview.</p> <ul> <li>I have 3 columns in database : Name,Age,Birthday.</li> <li>I have 3 textboxes and a button for adding new row with values from textboxes in the data table , gridview.</li> </ul> <p>When I click the button for adding a new row with those information , I need to check if the value from textbox for "Name" already exists in the data table in the column "Name" if yes then the update is canceled and the user is asked to enter another value.</p>
c# asp.net
[0, 9]
5,964,093
5,964,094
Increment variable on click jquery
<p>i´m working on an interactive Infographic. Basically there are is a number of circles flying around. I try to change the amount of circles by clicking on a button, therefor I want to increase the <strong>variable d</strong> by 1 on click, to get an other element from the array. But it doesnt´t work. Any ideas?</p> <pre><code>var leuko = ["167", "143", "134", "96"]; //array var d = 0; //variable $("#day").click(function() { d += 1; </code></pre> <p>_</p> <pre><code>for (var i = 0; i &lt; leuko[d]; i++) { var x = 20 + (Math.random() * (canvasWidth - 40)); var y = 20 + (Math.random() * (canvasHeight - 40)); var radius = 5; var vX = Math.random() * 0.2; var vY = Math.random() * 0.2; </code></pre> <p>I hope you can understand my problem, as my english isn´t the best.</p> <p>Here is a jsfiddle-link. Layout looks a little bit messed up..</p> <p><a href="http://jsfiddle.net/JDU6H/" rel="nofollow">http://jsfiddle.net/JDU6H/</a></p> <p>Thanks!</p>
javascript jquery
[3, 5]
1,948,405
1,948,406
On page load jquery
<p>I have a jQuery click event which runs when an element is clicked. Is it possible to get this to run once when the page is loaded?</p>
javascript jquery
[3, 5]
4,661,861
4,661,862
Android: ListView fixed height of child view
<p>Please advice how to set fixed heigh (in dip) for the child view of ListView component?</p> <p>I am using relative layout as root layout for the child view</p> <p>when I set backgoround image to relative layout it becomes very height (maybe because backgoround picture is large) and I want to set precisely the height in dp.</p>
java android
[1, 4]
2,853,040
2,853,041
cells.InnerHtml not getting correct way
<pre><code>protected void ReadHtmlTable(string patientName, string startHour, string startMinute, int rowspan) { for(int i = 0; i &lt;= tableAppointment.Rows.Count - 1; i++) { for(int j = 0; j &lt;= tableAppointment.Rows[i].Cells.Count - 1; j++) { if(tableAppointment.Rows[i].Cells[j].InnerHtml.Trim() == startHour) { if(tableAppointment.Rows[i].Cells[j + 1].InnerHtml.Trim()== startMinute) { tableAppointment.Rows[i].Cells[j + 2].InnerText = patientName; tableAppointment.Rows[i].Cells[j + 2].RowSpan = rowspan; tableAppointment.Rows[i].Cells[j + 2].Style.Add("color", "green"); tableAppointment.Rows[i].Cells[j + 2].Style.Add("background", "green"); } } } } } </code></pre> <p>Above code is my server side code which executes on OnSaveStateComplete(EventArgs e) event . i am reading my html table in c#. when i check its first cell second cell text then its give result like this "\r\n\t\t\t\t\t\t\t\t\t08:00\r\n\t\t\t\t\t\t\t\t" .I have use trim at end but not work.</p>
c# asp.net
[0, 9]
34,045
34,046
Add line breaks after n numbers of letters in long words
<p>A have a string that can reach up to 100 characters in lenght. Is there an easy way to insert line breaks in the word every 10th letter? For example:</p> <pre><code>aaaaaaaaaaaaaaaaaaaaaaaaa </code></pre> <p>Should turn in to</p> <pre><code>aaaaaaaaaa&lt;br/&gt;aaaaaaaaaa&lt;br/&gt;aaaaa </code></pre> <p>I know that i can modify html with the html() method, but im not sure how to count characters and insert the tags. Thanks</p>
javascript jquery
[3, 5]
4,045,636
4,045,637
Why I get different date formats when I run my application through IIS and Visual Studio's web server on the same computer?
<p>I get the same culture i.e. "en-US" while running the website from both IIS and Visual Studio's web server.</p> <p>But I get a different date format as follows, when I run the following code:</p> <pre><code>HttpContext.Current.Response.Write(System.Threading.Thread.CurrentThread.CurrentCulture.ToString()); HttpContext.Current.Response.Write(System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern); </code></pre> <p>On Visual Studio's web server: dd/MM/yyyy en-US</p> <p>On IIS: M/d/yyyy en-US</p> <p>Does "Regional and Language Options" in "Control Panel" play any role in this ? If I change the date format there in "Regional and Language Options", I see no effect in my application.</p>
c# asp.net
[0, 9]
484,902
484,903
Selecting only one element in the jQuery collection
<p>How do I limit an event to a single element in a jQuery collection? </p> <p>In the case below, I've tried using <code>.one()</code> to limit the behaviour (inserting the <code>&lt;li class='close'&gt;Close&lt;/li&gt;</code> line of HTML) to a single instance. The behaviour does indeed happen only once, but on EVERY matched element of <code>$( "ul&gt;li&gt;a" )</code>. How do I make it happen only once, to only ONE of the matched elements in the collection?</p> <p>Any ideas? </p> <pre><code>$( "ul&gt;li&gt;a" ).one( "click", function(){ $( "ul ul") .prepend("&lt;li class='close'&gt;Close&lt;/li&gt;") } ); </code></pre> <p>Thanks in advance.</p> <p>-AS</p>
javascript jquery
[3, 5]
5,908,187
5,908,188
$.slideToggle() & $.hover() animation queue issue
<p>I'm trying to set up a pretty basic hover animation in jQuery. Mouse over a div and the major content is slid down, mouse up and it slides up.</p> <pre><code>&lt;script type="text/javascript"&gt; $(function () { $('.listItem').hover(function () { $(this).find('.errorData').slideToggle('slow'); }); });&lt;/script&gt; </code></pre> <p>This piece of code works fine, but the obvious problem is the animation queuing if you mouse in and out really quickly.</p> <p>To alleviate this I have read that the <code>.stop(true)</code> function placed before the <code>.slideToggle()</code> stops the previous animation and clears the animation queue. So I tried this code:</p> <pre><code>&lt;script type="text/javascript"&gt; $(function () { $('.listItem').hover(function () { $(this).find('.errorData').stop(true).slideToggle('slow'); }); });&lt;/script&gt; </code></pre> <p>My problem now is that this only seems to work on the first mousein and mouseout. After that the animations no longer trigger and nothing happens. This is Google Chrome DEV channel.</p> <p>This seems to be exacerbated by how fast you move the mouse in and out.</p> <p>I can't seem to work out what the issue is, this <a href="http://jsfiddle.net/SNhky/" rel="nofollow">JSFiddle</a> has a working (and breaking on my computer) example.</p> <p>EDIT: I suspect this is a bug in jQuery 1.4.2 and have lodged a bug ticket: <a href="http://dev.jquery.com/ticket/6772" rel="nofollow">http://dev.jquery.com/ticket/6772</a></p>
javascript jquery
[3, 5]
2,093,543
2,093,544
What is the purpose of the arguments Object o and EventArgs ea, in ddlChooseReport_Function (ASP.net)?
<p>I'm curious as to the purpose of this method signature in ASP:</p> <pre><code>protected void ddlChooseReport_Function(Object sender, EventArgs e) </code></pre> <p>because in the method body afterward, it never mentions either parameter</p>
c# asp.net
[0, 9]
5,371,105
5,371,106
Javascript repetition of events
<p>If the focus is on the input was only one time it works but if more then attached event begins to work as many times as eliment was in focus. How to make a click event to execute only once? Below is the code.</p> <pre><code>$('.menuName').focusin(function(){ $(this).parent().append('&lt;div class="cleartext" style="position: absolute;right: 0px;top: 0px;height: 38px;width:32px;z-index: 999;"&gt;&lt;i class="icon-remove-circle"&gt;&lt;/i&gt;&lt;/div&gt;'); inputclr = $(this); intutval = $(inputclr).val(); $(document).on('click', '.cleartext', function() { $('.menuName').placeholder(); $(inputclr).attr('placeholder',intutval); $('.pinch_text').html('click'); $(inputclr).val('').focus(); }); }); </code></pre>
javascript jquery
[3, 5]
1,964,304
1,964,305
Disable Image Save option by right click option
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="http://stackoverflow.com/questions/2018802/prevent-saving-image-from-my-site">prevent saving image from my site</a><br> <a href="http://stackoverflow.com/questions/4514610/transparent-div-to-prevent-right-click-save-as">Transparent &lt;div&gt; to prevent right-click, Save As</a> </p> </blockquote> <p>Hi guys is there any way to disable image "save","copy","save as" option by right click user mouse.Because i don't want any one to save my images.There are some scripts are available but they are not valid for all browsers.Any help which should be valid for all type browsers.</p>
c# javascript asp.net
[0, 3, 9]
2,752,856
2,752,857
How do I make a word bold in javascript?
<p>I am using javascript to populate data in a table which return everything fine. I would like to make a string bold. See code below</p> <pre><code>$tr.find('.data').val($('#txtName').val() + ' &lt;strong&gt;Address:&lt;\/strong&gt; ' + $('#txtAddress').val()); </code></pre> <p>How do I make only the word "Address" bold?</p>
javascript jquery
[3, 5]
5,546,508
5,546,509
how to rewrite this this inline javascript with jquery?
<p>I have the following markup with inline javascript and would like to change it to Jquery. Any help would be appreciated.</p> <pre><code>&lt;a title="823557" href="/PhotoGallery.asp?ProductCode=471823557" id="product_photo_zoom_url"&gt; &lt;img border="0" onload="vZoom.add(this, '/v/vspfiles/photos/471823557-2.jpg');" alt="823557" src="/v/vspfiles/photos/471823557-2T.jpg" id="product_photo"&gt;&lt;/a&gt; </code></pre> <p>I guess I would need to use this?</p> <pre><code>$(function(){ &lt;---- somecode----&gt; }); </code></pre>
javascript jquery
[3, 5]
3,047,239
3,047,240
Segment text using fullstops
<p>I need to segment text using fullstops using PHP/Javascript.The problem is if I use "." to split text then abbreviations , date formatting (12.03.2010 ) or urls as well split-ed , which I need to prevent.There are many such possibilities , I might not be able to imagine. How to recognize that the "." is used as fullstop and nothing else ?</p> <p>When I googled I found about SRX <a href="http://www.lisa.org/fileadmin/standards/srx20.html" rel="nofollow">http://www.lisa.org/fileadmin/standards/srx20.html</a> , is any opensource PHP project segment text using these rules ?</p> <p>I can do with any Linux based command line utility as well unless it is not paid.</p> <p>This issue deals with cases where segment is breaking with a dot (.) as it is considered as Fullstop.We need to distinguish between a dot(.) and a Fullstop </p> <p>Cases where . are not fullstops :</p> <ol> <li><p>http://www.yahoo.com'>it is a good link. i liked it</p> - only one valid fullstop</li> <li><p>This is a test case. Lets try it no valid fullstop</p> <p>http://www.yahoo.com'>Testing is done by amold12@…. - no valid fullstop</p></li> <li><p>Mr. Abc is in town today - no valid fullstop</p></li> <li>S. Khan had done it - no valid fullstop</li> <li>The U.S. is emerging from a recession. - no valid fullstop</li> </ol> <p>As for as code is concerned - I am using javascript text.split(".") method </p> <p>Thanks</p>
php javascript
[2, 3]
1,250,829
1,250,830
Get Checkbox Value Using jQuery
<p>I want to display an error message or success message depending whether a textbox value is empty or has a value.</p>
javascript jquery
[3, 5]
4,722,445
4,722,446
File upload using javascript (iPad web application)
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4081997/upload-files-via-ipad">upload files via iPad</a> </p> </blockquote> <p>Hey guy's I'm trying to create a "native" iPad application using html, javascript, and html5 cache manifest so it will be available off line. I have it working with jquery and using jspdf to export the pdf. I would like to be able for the user to load data from a csv file upload. There seems to be a way to parse csv's with javascript but is it possible to do a file upload using nothing but javascript(and the user is offline). In my mind this won't work(need server interaction) but I'm not 100% sure. Thanks for any help.</p>
javascript jquery
[3, 5]
1,532,645
1,532,646
Call function after element has been removed from DOM
<p>I'm using jQuery to attach a click event to a link that removes a a table row from the DOM. I need to call another function when the click event is fired. I tried using the jQuery <code>.on()</code> method but the function is not called. I see there is a <code>.trigger()</code> method I can use, but not sure how to best use.</p> <p><strong>How can I call a function after element has been removed from DOM?</strong></p> <p>Here is my code: </p> <pre><code>// Add the remove link and attach the remove click event $("[id$=types-cell]").append(function () { return $('&lt;a href="#" id="remove-link" class="remove"&gt;[X]&lt;/a&gt;') .click(function () { var cell = $(this).parent('td'); cell.parent('tr').remove(); // Need to call function after tr is removed }); }); $(".remove").on("click", myFunction); // myFunction does not get called function myFunction(){ ... } </code></pre>
javascript jquery
[3, 5]
4,956,812
4,956,813
Reason why onStart finishes before onCreate
<p>On an application I'm working on the onCreate starts a service with startService() and subsequently after, that same activity calls bindService(to that same service) in its onStart. The problem is the Sevice isn't initialized until well after the onStart has completed which causes a fatal error from a nullpointer exception caused by a null service. I don't know how to get around this without using a half-assed solution and I have no idea how the onStart is finishing before the onCreate.</p> <p>Suggestions? Any help is much appreciated.</p> <pre><code>public class PNetworkService extends Service { private final IBinder binder = new NtwkSvcBinder(this); @Override public void onCreate() { // Creates a HandlerThread to process the network events. HandlerThread handlerThread = new HandlerThread("SystemStartService", Process.THREAD_PRIORITY_BACKGROUND); // Starts the network thread. handlerThread.start(); // Obtains looper so that that the NetworkServiceHandler is bound to that looper. serviceLooper = handlerThread.getLooper(); // Create the Network Service Handler. nsh = new NetworkServiceHandler(serviceLooper, this); messenger = new Messenger(nsh); } @Override public int onStartCommand(Intent intent, int flags, int startId) { Log.i(TAG, "onStartCommand"); return START_STICKY; } @Override public IBinder onBind(Intent i) { Log.i(TAG, "onBind called"); return binder; } public void setExtHandler(Handler extHandler) { Log.i(TAG, "setting exthandler"); nsh.setExtHandler(extHandler); } } </code></pre>
java android
[1, 4]
664,777
664,778
jquery length of characters in a collection
<p>Is there any way to get the length of characters in a jQuery collection? </p> <p>e.g. you matched a bunch of divs and you want the character count of just the matched divs</p>
javascript jquery
[3, 5]
3,508,730
3,508,731
PHP How to I make my textinput accept single quote or Double quotes
<p>How do I make my textinput accept apostrophe or double quotes?</p> <p>Everytime a user type's in this one: John's Birthday, I store this one in the database using mysql_real_escape_string().</p> <p>What I wanted to do in here is to retrieve it in my text input. I tried this one</p> <pre><code>&lt;input type='text' name='title' value='&lt;?php echo $values-&gt;title; ?&gt;' /&gt; </code></pre> <p>The problem here is it removes the single quote and the letters that comes after the quote. I tried to changed the <code>value= ''</code> from <code>value=""</code> but what if a user types a word that has example this one: "You and Me". The problem is still in there.</p> <p>I was thinking to use str_replace in doing this one and replace the ' into `, but again I was thinking that maybe there's an easy way to do it.</p> <p>Any help would be greatly appreciated.</p> <p>Thanks!</p>
php javascript
[2, 3]
1,487,256
1,487,257
How can I take the user to a new page, along with some variables, using Javascript/jQuery, without causing a URI Too Large error?
<p>Using Javascript/jQuery, I need to take the user to a new page when a button is clicked, and also send along a bunch of variables to the new page. At the moment I'm doing it like this:</p> <pre><code>location.href=window.location.href + '/new_note?id='+$('#note_id').val()+'&amp;note_subnotes='+encodeURIComponent(window.JSON.stringify(sub_notes)) </code></pre> <p>This works okay, but the problem is that <code>sub_notes</code> is an array of hashes, which can get pretty large. If I have more than a few hashes in the array, I get this error:</p> <pre><code>Request-URI Too Large WEBrick::HTTPStatus::RequestURITooLarge </code></pre> <p>So obviously the URI is too big. How can I do this without running into this problem? Thanks for reading.</p>
javascript jquery
[3, 5]
1,096,783
1,096,784
JQuery function call with out an event
<p>Suppose i have below jq function, </p> <pre><code>$(document).ready( function(){ $('#demo_btn').click( function(){ $.popup.show("The title", "A nice message"); } ); }); </code></pre> <p>I need to call the above function with out a click event. For example suppose a i check a condition and if its > than 10 im showing the above message. So its like no click event but just calling the above function when a condition satisfy after the page load.</p> <p>More details its like im set a value for a variable in the controller and from view tpl im acccess it. So if the variable is >10 im showing the above alert. So if the variable is >10 the above alert should be display with out a click on a buton.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
1,183,423
1,183,424
How to run the javascript fn using OnClick button event (asp.net)
<p>I had a input button to which I called a javascript function when clicked. But I want to add images to the button So I used a Image button but I am not able to call the Javascript function from the image button. How to run the javascript fn when the image button is clicked </p> <pre><code>&lt;input id="send" type="button" value=" Preview on iPhone " onclick="javascript:preview()"&gt; &lt;asp:ImageButton OnClick="preview()" ID="send" runat="server" ImageUrl="Styles/Images/preview_iphone.png" OnMouseOut="this.src='Styles/Images/preview_iphone.png'" OnMouseOver="this.src='Styles/Images/preview_iphone_over.png'" /&gt; </code></pre>
c# javascript asp.net
[0, 3, 9]
4,960,423
4,960,424
Custom control that detects first child which will be rendered as a html input field
<p>Im trying to develop a custom control that automatically detects the first child control which will be rendered as an input-tag. I'm doing this because I want to know if I should render my associated title as a label or a span element in the HTML (a bit like the <code>asp:Label</code> works when an <code>AssociatedControlID</code> is given).</p> <p>I found that most of the <code>HtmlControls</code> that will be rendered as an input field derives from the base class <code>HtmlInputControl</code>. But I didn't find any class alike for the controls in the <code>System.Web.UI.WebControls</code> namespace.</p> <p>So my question is, am I stuck with digging up the protected property "TagKey" with reflection like this:</p> <pre><code>var property = control.GetType() .GetProperty("TagKey", BindingFlags.NonPublic | BindingFlags.Instance); var tag = (HtmlTextWriterTag)property.GetValue(control, null); </code></pre> <p>or have I missed something?</p>
c# asp.net
[0, 9]
666,911
666,912
Where do I put the JQUERY UI theme folder?
<p>This is my code. It turns my text box into a date picker.</p> <pre><code>&lt;script type="text/javascript" src="{{MEDIA_URL}}template/js/jquery-1.4.1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="{{MEDIA_URL}}template/js/jquery-ui-all.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function() { $("#start_date").datepicker(); $("#end_date").datepicker(); }); &lt;/script&gt; </code></pre> <p>Where do I put the <code>ui-lightness</code> folder? It contains the images and js of the theme. Right now, the images and CSS are blank on my page.</p>
javascript jquery
[3, 5]
3,711,632
3,711,633
change div content by clicking an image
<p>I have this div:</p> <pre><code>&lt;div class="main_mark"&gt; &lt;img src="/assets/welcome_main.png" alt="main" class="main_mark_image" /&gt; &lt;/div&gt; </code></pre> <p>I want the next thing: when the user click the image, this div will changed to:</p> <pre><code>&lt;div class="main_mark"&gt; &lt;embed width="420" height="345" src="http://www.youtube.com/v/XjR-4lbK1mI" type="application/x-shockwave-flash"&gt; &lt;/embed&gt; &lt;/div&gt; </code></pre> <p>so in my javascript, I have tried to do something like:</p> <pre><code>$(".main_mark_image").click(function () { $("#main_mark").innerHTML = "&lt;embed width=420 height=345 src=http://www.youtube.com/v/XjR-4lbK1mI type=application/x-shockwave-flash&gt;&lt;/embed&gt;"; }); </code></pre> <p>but it doesn't change anything..</p> <p>any help aapreciated!</p>
javascript jquery
[3, 5]
4,200,782
4,200,783
Is this safe from sql injection?
<p>I usually use sql parameters with queries, but in this case I need to dynamically create more than just the parameters.</p> <p>Could someone use injection on any of the variables? Aside from a stored procedure is there a simple way to protect against injection via code?</p> <pre><code>string whereClause = "WHERE " + filter.ToString() + " &gt; " + nextStartPoint; string orderBy = "ORDER BY " + filter.ToString() + " DESC"; </code></pre> <p><strong>ex</strong></p> <pre><code>string sql = "SELECT TOP(" + numItemsToGet + ") * " + "FROM Items " + whereClause + " " + orderBy; </code></pre> <p><em><strong></em> Update</strong> </p> <p>filter.ToString() is the actual column name</p> <p>I'm surprised the following worked (partial ex)... I also thought you have to reference a column name with sql parameters.</p> <pre><code>cmd.Parameters.AddWithValue("Count", 10); string sql = "SELECT TOP(@Count) * " + </code></pre>
c# asp.net
[0, 9]
2,142,316
2,142,317
Which is higher in Abstraction Level Linq or Lamdba expression
<p>I always prefer lamdba expression to perform operations on collection. But i can achieve same thing with LINQ which is simpler than Lambda expression. but, I am still confused a bit about which comes at top in Abstraction Level &amp; why? </p>
c# asp.net
[0, 9]
2,538,331
2,538,332
Scale down an image if it's too big for the screen
<p>I have an html page where in the middle there is a pic.<br> Is there a way to scale down the image with javascript in case it's too big for the current monitor resolution?</p> <p>I mean if a user with a resolution of 1600*1200 open an image of 1900*1200 the image should be scaled down to fit the window.</p> <p>I can use jquery</p>
javascript jquery
[3, 5]
3,404,493
3,404,494
jQuery basic: How to create a loop with this structure?
<p>This is a really simple question but I'm not sure how to search for it on the internet. </p> <p>I have an empty <code>&lt;div id="wrap"&gt;&lt;/div&gt;</code> that needs to end up looking as following:</p> <pre><code>&lt;div id="wrap&gt; &lt;div class="container"&gt; &lt;div class="apples"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="container"&gt; &lt;div class="banana"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="container"&gt; &lt;div class="orange"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="container"&gt; &lt;div class="grapes"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>In jquery I have:</p> <pre><code>$(#wrap).html(''); // need this bit var fruitArray = ['apples','banana','orange','grapes']; for (fruit in fruitArray) { $('&lt;div class="'+fruitArray[fruit]+'"&gt;&lt;/div&gt;').appendTo('#wrap').doSomething(); } </code></pre> <p>Because I need the div with the fruitArray class to do something, I can't just wrap it around with the container class: </p> <pre><code>$('&lt;div class="container"&gt;&lt;div class="'+fruitArray[fruit]+'"&gt;&lt;/div&gt;&lt;/div&gt;').appendTo... </code></pre> <p>How can I go about generating the container class in this situation?</p>
javascript jquery
[3, 5]
5,614,741
5,614,742
jQuery problems
<p>Below I present you some code which has completely been butchered by me.</p> <pre><code>$(".gig").hover(function() { var id = $(this).attr("id"); var time = $(this).attr("title"); function () { if (time &gt; 0) { var answer = $('&lt;div class="roll"&gt;Are you attending? &lt;a href="' + id + '"&gt;Yes&lt;/a&gt;&lt;/div&gt;').hide(); } else { var answer = $('&lt;div class="roll"&gt;Did you attend?&lt;a href="' + id + '"&gt;Yes&lt;/a&gt; &lt;/div&gt;').hide(); } answer.appendTo($(this)).fadeIn("fast"); } function () { $(this).find("div:last").fadeOut("fast", function() { $(this).remove() }); } }); </code></pre> <p>I know, it is terrible. It basically is like pseudocode now. Could anyone help me to re-write my mess into actually functioning code?</p> <p>Basically for every class named div, it should append the variable answer onto the end of this div, and on mouseout, remove the variable answer. The variable time will be fetched from the title of the rollover div, and thus affect what is shown in the new div that is added. The id of the .gig should simply be passed into the url.</p> <p>The hover answer add/remove functions work on their own, but I am unable to place them into the new function with the if and new variables.</p> <p>Thank you so much.</p>
javascript jquery
[3, 5]
2,762,088
2,762,089
jQuery element click
<p>I have an element, an anchor, how can I "click it" with jQuery, I mean like a normal user click, because I'm receiving a click on an element..but also I need to fire more events...</p> <p>Ok here is my example</p> <pre><code>&lt;a class="som" href="http://domain.com/ssl-signup.php" target="_blank"&gt;Test Link&lt;/a&gt; $(document).ready(function(){ $('.som').click(); }); </code></pre> <p>But nothing happens!</p> <p>Best Regards.</p>
javascript jquery
[3, 5]
4,396,002
4,396,003
Adding show/hide to my div tags
<p>so I got 4 div tags, with id's - <code>content1</code>; <code>content2</code>; <code>content3</code> and <code>content4</code>. at start, <code>content1</code> is only shown, and all other 3 contents are invisible, and I got menu with links, <code>#content1</code>, <code>#content2</code>, <code>#content3</code>, <code>#content4</code>.<br> So I need to create, when somebody clicks for example on <code>content3</code> link, current content will hide and <code>content3</code> content will show up, same to all other contents.</p> <p>My question - I know how to make show/hide with one element, but I haven't created anything with 2 or more elements, so maybe you could help me create it?</p>
javascript jquery
[3, 5]
3,565,824
3,565,825
How can I get the user's local time instead of the server's time?
<p>How can I get the time of the client side? When I use <code>date()</code> it returns server's time.</p>
php javascript
[2, 3]
5,607,378
5,607,379
Load array using separate thread
<p>I've written a speedlimit app that loads data from a set of tiled xml files representing 0.05 sided degree maps.</p> <p>At the moment, the app checks if I've moved into a new square (using OnLocationChanged) and if so loads in the data for it and the surrounding other 8 tiles.(has a bit of a sanity check and only loads data for new tiles so tends to just load in another 3 tiles worth of data)</p> <p>Anyway, it currently does this on the UI thread and so there is a noticeable pause when moving into new square and I'd like to shift it to background using Asynctask (It also loads in bitmap maps for display purposes and I've already moved that code into an Asynctask so I know how to do that bit)</p> <p>My problem is to do with checking the arrays (actually using ArrayLists) used for the speed limits while the Asynctask is possibly adding (and in future version - subtracting) to them in the background.</p> <p>I was wondering if there was a "professional" :) way of dealing with this sort of situation.</p>
java android
[1, 4]
3,784,976
3,784,977
parsing css measures
<p>When i write a jQuery plugin i like to specify options for spacings the CSS way. I wrote a function that returns a CSS String as values in a object. </p> <p>5px 10px returns top: 5px, right: 10px, bottom: 5px, left: 10px</p> <p>Now i often use the returned values to do some calculations and its not very nice to have to extract the measuring unit every time...</p> <p>I suck in writing regular expressions could someone help me complete this function:</p> <pre><code>this.cssMeasure = function(cssString, separateUnits){ if ( cssString ){ var values = {} }else{ return errorMsg } var spacing = cssString.split(' ') var errorMsg = 'please format your css values correctly dude' if( spacing[4] ) { return errorMsg } else if ( spacing[3] ) { values = {top: spacing[0], right:spacing[1], bottom:spacing[2], left:spacing[3]} } else if ( spacing[2] ) { values = {top: spacing[0], right:spacing[1], bottom:spacing[2], left:spacing[1]} } else if ( spacing[1] ) { values = {top: spacing[0], right:spacing[1], bottom:spacing[0], left:spacing[1]} } else { values = {top: spacing[0], right:spacing[0], bottom:spacing[0], left:spacing[0]} } if (separateUnits) { $.each(values, function(i, value){ /* at this place i need to extract the measuring unit of each value and return them separately something like top: {value: 10, unit: 'px'}, right: {bla} and so on */ }) } return values } </code></pre> <p>if you have any idea how to improve this function i am open to your comments.</p>
javascript jquery
[3, 5]
3,962,748
3,962,749
Display elements of a <ul> in two columns
<p>Someone please help me to change current function to display elements in two columns,</p> <pre><code> function nextCode(flag) { var code = codes[flag]; $('.headers').html(''+code[0]+''); var sum;for(var j=1;j&lt;=code.length;j++) { sum+="&lt;li&gt;"+code[j]+"&lt;/li&gt;"; } sum="&lt;ul&gt;"+sum+"&lt;/ul&gt;"; $('.options').html(''+sum+''); } </code></pre> <p>This is generating a list in single column, But i want to display them in two columns..<br> Please help me on this. </p>
javascript jquery
[3, 5]
3,648,998
3,648,999
Store the string returned by an ASP.NET helper into a javascript var: SyntaxError
<p>What I want to do is store the string returned by this ASP.NET helper into a javascript var.</p> <p>My code:</p> <pre><code> function doSomething(id){ var htmlString = '@Html.TextArea("test", new { @rows = "1" })'; } </code></pre> <p>The generated javascript along with the error in chrome:</p> <pre><code> var htmlString = '&lt;textarea cols="20" id="test" name="test" rows="1"&gt; Uncaught SyntaxError: Unexpected token ILLEGAL &lt;/textarea&gt;'; </code></pre>
javascript asp.net
[3, 9]
4,685,820
4,685,821
make div text disappear after 5 seconds using jquery?
<p>i need to make a div text disappear after x seconds of displaying it using an ajax call</p> <p>can you help me on this please ?</p> <p>thanks</p>
javascript jquery
[3, 5]
1,286,685
1,286,686
How do I create 'JQuery' function calls and pass data to them?
<p>I'm adding tool tips using the qtip jquery plugin. I may add 50-60 tool tips over an entire site.</p> <p>The way I've found to do it right now is ti cut/paste the jquery code over and over. For example:</p> <pre><code>// First, setup a tool tip for 'Enter Username'. $("input#user_login").qtip({ content: 'Enter username', position: { corner: { target: 'rightMiddle', tooltip: 'leftMiddle' } }, style: { border: { width: 1, radius: 3, color: '#0066CC' }, width: 200, name: 'blue' } }); </code></pre> <p>Now, repeat everything for 'First Name'. Seems pointless.</p> <pre><code>$("input#user_login").qtip({ content: 'Enter First Name', position: { corner: { target: 'rightMiddle', tooltip: 'leftMiddle' } }, style: { border: { width: 1, radius: 3, color: '#0066CC' }, width: 200, name: 'blue' } }); </code></pre> <p>How do I create a function I can just pass the display text in to?</p>
javascript jquery
[3, 5]