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
3,067,365
3,067,366
Calling Dynamic controls from a seperate class
<p>I need to know if it is possible to call a control and also attach it's events from a class. I have been researching the internet for a some valuable information but to no avail. Below is a simple illustration of what I intend achieving.</p> <p>PAGE</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { DynamicControls(IsPostBack); } public void DynamicControls(bool posting_back) { ControlHandler ch = new ControlHandler(); CreateTextbox(item.id, item.value, item.textMode, item.mandatoryInput, item.maxLength,int.Parse(item.rowNumber), int.Parse(item.colNumber), item.visible, item.autoPostBack,item.enable, table); } </code></pre> <p>CLASS</p> <pre><code> public void CreateTextbox(String id, String value, String textMode, bool mandatoryInput , String maxLength, int rowNumber, int colNumber, bool visible, bool autopostBack, bool enable, Table table) { TextBox tb = new TextBox(); tb.ID = id; tb.Text = value == null ? "" : value; tb.TextMode = textMode == null ? TextBoxMode.SingleLine : textMode.ToLower() == "multiline" ? TextBoxMode.MultiLine : TextBoxMode.SingleLine; tb.MaxLength = maxLength == null ? 32500 : int.Parse(maxLength); tb.Visible = visible; tb.Style.Add("width", "80%"); tb.Enabled = enable; tb.AutoPostBack = autopostBack; tb.Font.Bold = true; tb.ForeColor = System.Drawing.Color.Chocolate; tb.TextChanged += new EventHandler(tb_TextChanged); } protected void tb_TextChanged(object sender, EventArgs e) { TextBox tb = (TextBox)sender; tb.Text = //some values or display in another control in the form } </code></pre> <p>Thanks</p>
c# asp.net
[0, 9]
4,929,729
4,929,730
How to find out first character index in my Textbox
<p>I have a textbox, I need to enter only alphabet in the starting of textbox; no integers, no special characters.... What should I do?</p>
c# asp.net javascript
[0, 9, 3]
2,022,601
2,022,602
How to count online people connected to my web site with jQuery or st?
<p>i created a web site with asp.net 4.0 and now i need to count online people that connected to my web site. how do i do this with JQuery?</p>
jquery asp.net
[5, 9]
5,878,483
5,878,484
JavaScript timing, jQuery fadeIn fadeOut
<p>I have a simple function that I wrote that transitions three div elements using a fade in/out effect. The event is triggered when a user clicks a link. Here's my code:</p> <pre><code>$(".link1").click(function () { $(".feature1").fadeIn(1000); $(".feature2").fadeOut(1000); $(".feature3").fadeOut(1000); }); $(".link2").click(function () { $(".feature1").fadeOut(1000); $(".feature2").fadeIn(1000); $(".feature3").fadeOut(1000); }); $(".link3").click(function () { $(".feature1").fadeOut(1000); $(".feature2").fadeOut(1000); $(".feature3").fadeIn(1000); }); </code></pre> <p>I need to be able to set some sort of timer so that these transitions happen automatically every 8 seconds or so. I also want them to "loop" essentially, so that if we get to the third div in the set, it returns to the first div.</p>
javascript jquery
[3, 5]
2,459,400
2,459,401
get query string in popup window
<pre><code>&lt;a href="tags.php" onclick="return popitup('tags.php')"&gt;tags&lt;/a&gt; </code></pre> <p>I have this line of code that runs the javascript to open new mini popup window,and it mostly works.</p> <p>Now how could i add current query string attributes so that my popup window has url something like this "tags.php?variable1&amp;variable2"</p> <p>In few similar places I used this along with some other code to get the query attributes,the problem is that in this case page refreshes and contacts the sql without running javascript or opening window,when i try to make my code PHP using echo the quotation makrs f* everything up. </p> <pre><code>".$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']." </code></pre>
php javascript
[2, 3]
4,330,078
4,330,079
Only supporting users who have Javascript enabled
<p>I am considering creating a website that only supports users with JavaScript enabled.</p> <p>My justification for this is that I want to offer a rich user experience, in a fairly limited time budget, so if I only support people who have JS enabled, I don't have to spend time making sure the UI works without JS and create server side equivalents for validation etc.</p> <ol> <li>Is this possible? Do different browsers\platforms prevent me from achieving this?</li> <li>What percentage of users have JS disabled these days?</li> <li>How would I go about checking if JS is enabled in C#.</li> </ol>
c# asp.net javascript
[0, 9, 3]
5,131,413
5,131,414
how to check the value in text box against the database
<pre><code>protected void btnSubmit_Click(object sender, EventArgs e) { SqlConnection conNwind; SqlCommand cmdSelect, cmdInsert; SqlDataReader dtrUser; string connStr = ConfigurationManager.ConnectionStrings["ConnectionNWind"].ConnectionString; conNwind = new SqlConnection(connStr); conNwind.Open(); string select = "Select * from UserRegistration where UserName=@UN AND Email=@Email"; cmdSelect = new SqlCommand(select, conNwind); cmdSelect.Parameters.AddWithValue("@UN", txtUN.Text); cmdSelect.Parameters.AddWithValue("@Email", txtEmail.Text); dtrUser = cmdSelect.ExecuteReader(); if (dtrUser.Read()) { if (txtUN.Text != "") { Label1.Text = "UserName already exists"; } else if (txtEmail.Text != "") { Label1.Text = "Email already exist!"; } else { dtrUser.Close(); string strInsert = "Insert into UserRegistration(FirstName,LastName,UserName,Password,Gender,Address,Email) values(@FN,@LN,@UN,@Pass,@Gender,@Add,@Email)"; cmdInsert = new SqlCommand(strInsert, conNwind); cmdInsert.Parameters.AddWithValue("@FN", txtFN.Text); cmdInsert.Parameters.AddWithValue("@LN", txtLN.Text); cmdInsert.Parameters.AddWithValue("@UN", txtUN.Text); cmdInsert.Parameters.AddWithValue("@Pass", txtPass.Text); cmdInsert.Parameters.AddWithValue("@Gender", rdlGender.SelectedItem.ToString()); cmdInsert.Parameters.AddWithValue("@Add", txtAdd.Text); cmdInsert.Parameters.AddWithValue("@Email", txtEmail.Text); int intAdd = cmdInsert.ExecuteNonQuery(); if (intAdd != 0) Label1.Text = "User Registration successful,you can now &lt;a href='UserLogin.aspx'&gt;Login&lt;/a&gt;"; else Label1.Text = "Record not added into database!"; } } else conNwind.Close(); } </code></pre> <p>how to check the username and the email address that exist in databese...Pls help!!!</p>
c# asp.net
[0, 9]
614,290
614,291
JQuery: $.get is not a function
<p>I'm having a problem doing something very basic in jQuery. Can someone tell me what I'm doing wrong exactly?</p> <p>If I run the code below, the function $.get seems to be missing (getJSON and others missing too). But $ itself and other functions do exist, so I know JQuery is loading.</p> <pre><code>google.load("jquery", "1.3.2"); function _validate(form, rules_file) { $.get('/validation_rules.json',function(data) { alert("hello") }) } </code></pre> <p>Any ideas would be much appreciated. </p> <p>Thanks, Rob</p> <p>Edit: here is some additional info:</p> <pre><code> &lt;script src="http://www.google.com/jsapi"&gt;&lt;/script&gt; &lt;script&gt; google.load("prototype", "1.6"); google.load("scriptaculous", "1.8"); google.load("jquery", "1.3.2"); &lt;/script&gt; &lt;script&gt; jQuery.noConflict(); // prevent conflicts with prototype &lt;/script&gt; &lt;script src="/livepipe/src/livepipe.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="/livepipe/src/window.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="/livepipe/src/tabs.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="/jquery.maskedinput-1.2.2.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
1,949,898
1,949,899
jQuery find last input and append
<p>I am trying to append an image after the last input field in a div, any ideas as to why this won't work?</p> <pre><code>$('&lt;img src="img/loading.gif" id="loading_img" /&gt;').appendTo($(form).find('input:last')); </code></pre>
javascript jquery
[3, 5]
3,390,555
3,390,556
How can I store PHP values when building html tables?
<p>I don't think I asked the question very well, so let me elaborate what I'm doing. </p> <p>I'm building a simple website for a project my niece is working on. She wants to implement a ticket ordering system for their class graduation (this is all just for the project, it won't actually be used for anything in a production setting). She wanted a "map" of seats available and a way to distinguish seats that have been sold and seats that are open.</p> <p>My vision for implementing this is creating three tables, one for each section. I'm using PHP to build the sections, and at the moment they contain an image that indicates if the seat is taken or not that is wrapped in an anchor tag that points to the same page with the url:</p> <pre><code>&lt;a href='index.php?section=$section&amp;row=$i&amp;seat=$j' class='order'&gt;&lt;img src='open.png'&gt;&lt;/a&gt; </code></pre> <p>So my grand plan was, when they click on the image for a particular seat to have a modal dialog pop up that does one of two things.</p> <p>If the seat is already taken, it will simply display the buyer's information. If the seat is not taken, it will contain a form that will allow the user to input their information and submit it, which will then write to a MySQL database table that stores this data.</p> <p>I was using the jQuery UI dialog for modal forms (<a href="http://jqueryui.com/dialog/#modal-form" rel="nofollow">http://jqueryui.com/dialog/#modal-form</a>) to accomplish the modal dialog before I tried adding the index.php?section= etc to the anchors, and now that I've added that part it flashes up the dialog but then the page refreshes and the dialog disappears. </p> <p>My question is, is there a way to store the section/row/seat information in the anchor in such a way so as not to refresh the page when it's clicked on? Could I add some code before the HTML tag on index.php to handle when the anchor has been clicked? The last time I worked with PHP was several years ago and I'm very rusty and not certain how to tackle this problem.</p>
php jquery
[2, 5]
5,030,628
5,030,629
where android store desktop icons?
<p>Once an app is installed, where android store icons shown on app drawer? in which path? I tried to remove it programmatically but without success. An alternative should be to refresh the app drawer. Possible on rooted phones?</p>
java android
[1, 4]
3,493,973
3,493,974
to generate a loginpage for android using java,sqlite,xml
<p><em>*</em>*iam developing the quiz application android ,for that application iam developing the loginpage i need the coding for login page developed by using the java,sqlite,xml(layout). my design of the login page is consist of userid password for existing user two buttons for login and another for register(new user) when i click the register button it move another screen that consist of username password confirm password for registering the new user i need program coding for the above statement (stack overflow). </p>
java android
[1, 4]
2,254,191
2,254,192
Forms Authentication update user status after specific user session ends
<p>Hi I'm using Forms Authentication for authentication users in my asp.net c# application. How can I update user status after specific user session ends (automatically) or browser close?</p> <p>Thank you</p>
c# asp.net
[0, 9]
5,319,461
5,319,462
Java add and set functions
<p>I'm a python programmer, but currently I'm reading through Java code to get some ideas. I have no programming experience at all with Java and I don't know how it's possible, but I couldn't get any information using Google about these functions.</p> <pre><code>if(pv.size() -2 &lt; j) pv.add(j+1, localpv.get(j)); else pv.set(j+1, localpv.get(j)); </code></pre> <p>This is the piece of code I need to decypher. <code>pv</code> and <code>localpv</code> are both vectors (I believe they are equivalent to lists in python?), and something is added to them. I can guess that one of them is adding them to a vector at a certain position (<code>j+1</code>), but then I have no idea what the other one does.</p> <p>Can you please explain those two lines for me and maybe telling what are they equivalent to in python?</p>
java python
[1, 7]
2,134,367
2,134,368
how to find selected hyperlink in asp.net using C#
<p>I have a list of 10 hyperlink on default1.apx. On selecting any hyperlink it redirects to another page and all hyperlinks redirects to the same page default2.aspx. But how can i now which hyperlink is clicked from 10 hyperlinks list in asp.net using C#.</p>
c# asp.net
[0, 9]
5,932,300
5,932,301
suppress : this page is accessing information that is not under its control this poses a security risk?
<p>I have asp.net page having lots of ajax controls. I am redirect to https:// login page from this asp.net page after session time out. But the page always showing below popup message window when its redirect. </p> <pre><code> "this page is accessing information that is not under its control this poses a security risk" </code></pre> <p>How can suppress this message window using javascript or jQuery or asp.net code? </p>
c# javascript jquery asp.net
[0, 3, 5, 9]
4,722,386
4,722,387
Using ID as a variable
<p>I'm trying to find the text of the span with the class name "link" but i have problems.</p> <pre><code>&lt;div id="item-0" class="box"&gt; ....... &lt;/div&gt; &lt;div id="item-1" class="box"&gt; &lt;p&gt;&lt;strong&gt;Link: &lt;/strong&gt;&lt;span class="link"&gt;http://www.domain.com/list44/&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;input type="submit" value="submit" class="load-button2"&gt;&lt;/p&gt; &lt;/div&gt; &lt;div id="item-2" class="box"&gt; ....... &lt;/div&gt; $(".load-button2").click(function(){ var id = $(this).closest('.box').attr('id'); alert(id); // showing the right box ID var linkp = $(/*** what should i put here? ***/ "#" + id + " .link").text; }); </code></pre>
javascript jquery
[3, 5]
1,289,497
1,289,498
How to get ShowState of a window in c# or c++?
<p>I am trying to get showstate of a window.</p> <p>I know that I can maximize, minimize, or close a window by ShowWindow API in c# or c++. How do I get ShowState of a window?</p>
c# c++
[0, 6]
46,420
46,421
how to replace javascript '\' with another char
<p>i have a var in javascript that looks like this: </p> <pre><code>C:\docs\path\file.exe </code></pre> <p>how can i replace \ with another char like ? so the var becomes </p> <pre><code>C:?docs?path?file.exe </code></pre> <p><strong>edit</strong><br> i am trying to find the size of a file in JS. the only way i managed to do it, is to call a [WebMethod] using $ajax. when i try to send the path as it is, i get an escape character error, so i chose to replace '\' by '?' and then the [WebMethod] replaces '?' with '\' check the file size and returns it.</p>
c# javascript
[0, 3]
5,172,480
5,172,481
Jquery / Javascript get params from window localtion
<p>My URL is:</p> <pre><code>http://localhost:3000/?sort=rating </code></pre> <p>The parameter <code>sort</code> is dynamic, and I would like to add it to another URL.</p> <p>In my javascript I have:</p> <pre><code>window.location.pathname + '.js?page=' + currentPage </code></pre> <p>How do I add the <code>sort</code> parameter at the end? </p> <p>Example:</p> <pre><code>window.location.pathname + '.js?page=' + currentPage + &amp;sortparam </code></pre> <p>In this case it would be:</p> <pre><code>window.location.pathname + '.js?page=' + currentPage + '&amp;sort=rating' </code></pre>
javascript jquery
[3, 5]
1,634,854
1,634,855
jQuery script to click automatically on a link
<p>My current code that i use is this:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ $('#on_holiday').trigger('click'); }); &lt;/script&gt; </code></pre> <p>How ever, this only works when the 'ID' is 'on_holiday' within the input form. I need this to work when I have another element within the form - The current 'ID' is:</p> <pre><code>&lt;a href="#" data-reveal-id="on_holiday" class="side_link"&gt;Test&lt;/a&gt; </code></pre> <p>My problem is when ever I add the element 'ID' to this link, it messes up the data-reveal-id and its cause. I need some sort of jQuery code that can click this link without the need to put the 'ID' field in.</p> <p>Many thanks in advance. </p>
javascript jquery
[3, 5]
5,118,296
5,118,297
Open select clicking another element with javascript
<p>I've been looking for a way to open a select / combobox clicking another element. I read answers saying that is impossible but... How is facebook doing it?</p> <p>In your facebook timeline, when you want to change the date of a status, there is an ahchor and when you click it, a combobox appears. I thought they had applied styles to their select so it would look like an anchor but it wasn't like that. </p> <p>Their HTML code has an anchor and a select element, this last one is hidden. Then, I know the select element is positioned as absolute but I can't get from their javascript code how it works.</p> <p>I tried to simulate it like this</p> <pre><code>$('#element').click(); document.getElementById('element').click(); </code></pre> <p>None of this works. I saw a script that duplicated the SELECT element but it add 2 attributes to it: multiple and size. This changes the look of the select.</p> <p>I would like to know how it would be possible? I know maybe it won't work in IE &lt; 9.</p>
javascript jquery
[3, 5]
2,549,654
2,549,655
How can I get the same fly-in and bounce affect that apple uses for their nav bar in the store?
<p>Go to store.apple.com and watch the to nav bar. It flies in, and does a little bounce.</p>
javascript jquery
[3, 5]
1,197,296
1,197,297
Drag and drop div using jquery
<p>I got a Main Div where i can drop any text and this will be displayed as in a form shown in the below script.</p> <p>I need to drag and drop the dynamically generated div to move it up or down ,from within the current div. Is this possible? </p> <pre><code> &lt;script type="text/javascript"&gt; $(init); function init() { function addColumn(column) { var iHtml; //Labeling and Tool Tip the Checkbox iHtml = "&lt;div id='&lt;%" + column + ".ClientID%&gt;'&gt;&lt;span title='ToolTipText'&gt;"+ "&lt;input id='&lt;%" + column + ".ClientID%&gt;' type='checkbox' name='&lt;%" + column + ".ClientID %&gt;' /&gt;"+ "&lt;label for='&lt;%" + column + ".ClientID%&gt;'&gt;MyCheckBox&lt;/label&gt;&lt;/span&gt;&lt;/div&gt;"; return iHtml } </code></pre> <p>}</p>
jquery asp.net
[5, 9]
1,382,337
1,382,338
how to get Value that cause exception
<p>How can I get the value that failed to be converted? In general, and not in this single specific example case.</p> <pre><code>try { textBox1.Text = "abc"; int id = Convert.ToInt(textBox1.Text); } catch { // Somehow get the value for the parameter to the .ToInt method here } </code></pre>
c# asp.net
[0, 9]
2,266,527
2,266,528
Accessing C# variable in javascript
<p>I'm going to design a website for DMS (educational domain) in C#.NET, which I am new to. </p> <p>In one of my ASPX pages, I want to disable a menu, which is in JavaScript, according to <code>accessright</code>. </p> <p>The <code>accessright</code> stored in database table <code>login</code> as one attribute in SQL server, and I want to retrieve that <code>accessright</code> to one C# variable and want to access that variable in JavaScript.</p> <p>If there is another possible approach please tell.</p>
c# asp.net javascript
[0, 9, 3]
1,785,420
1,785,421
Using variables between if/else in Android
<p>I am developing a small app while learning Android.</p> <p>The app is basically making a series of simple math calculations. A button is calling a function where the calculations take place. Everything was working fine, until I inserted an if/else construct.</p> <p>Inside this construct, I am using variables created before, making calculation and setting other variables with this</p> <pre><code>if (TS&gt;Ex) { Double AE = 0.00; } else { Double AE = (Ex-TS); }; Double TBTAT = (TS-Ex); Double Exx = 2864.17; if (TBTAT&gt;Exx) { Double TAT = (Exx*0.2); } else { Double TAT = (TBTAT*0.2); }; </code></pre> <p>I have two of these if/else structures.</p> <p>Then everything is collected and sent to a Text</p> <pre><code>IT_ResultTXT.setText(Double.toString(AE+TAT+TAF)); </code></pre> <p>In normal conditions, AE, TAT, TAF turn out to "cannot be resolved to a variable" in this last line of the code, but if I declare them at the beginning of the function, I have an error of duplicated variables.</p> <p>I suppose is a very stupid basic Java programming error, but I cannot find a solution to this.</p>
java android
[1, 4]
5,070,067
5,070,068
iPhone & Android: how to take a picture and upload it to a website?
<p>I'm building an asp.net website using c# and .net 2.0. One of the pages requires to take a picture (or choose from already existing pictures), upload it to the server, add other info and save everything in the database.</p> <p>I'm using a FileUpload control and everything is working fine on a PC.</p> <p>Android gives me the options to choose a file from Gallery, File system, Music Track etc. but there is no option to take a picture from the camera. The FileUpload control is disabled in iPhone.</p> <p>I want to click on a button or use something else and be able to choose to upload an image from the gallery or start the camera and take one. Is there a way to do it?</p> <p>Thanks!</p>
c# android iphone asp.net
[0, 4, 8, 9]
5,412,151
5,412,152
can insert hyperlinks in different paragraphs of an image at runtime in asp.net?
<p>I am facing a big and interesting problem that is explain below. I have an image which contains x(any number like 5) paragraphs and my requirements is to make each paragraph a hyperlink at runtime in asp.net or jquery etc. But remember, single image that contains text in paragraph form, so how to make these paragraphs of the same image a hyperlink? Please help me how to achieve it?</p>
jquery asp.net
[5, 9]
2,980,452
2,980,453
how to test if a javascript cookie has expired?
<p>Is it possible to test if a javascript cookie has expired using?</p> <p>I need to do a few thing conditionally and two of those conditions are overlapping for which if it could be tested whether a cookie has expired then it will be easier for me to get things done.</p> <p>I am using <code>jquery-1.5.js</code> and <code>jquery.cookies.js</code> plugin.</p> <p>Thanks.</p> <p><strong>CODE</strong></p> <pre><code>var jq = jQuery.noConflict(); jq(document).ready(function () { var timeStart, timeSubmit, timeLeft; timeSubmit = 5 * 60 * 1000; timeStart = jaaulde.utils.cookies.get("_watchman"); try { if(jaaulde.utils.cookies.test()) { throw "err1"; } else if(hasCookieExpired) { throw "err2"; } else if(!timeStart) { jaaulde.utils.cookies.set("_watchman", String(new Date().getTime()), {path: '/path', expiresAt: new Date((new Date().getTime() + timeSubmit))}); timeLeft = timeSubmit - (new Date().getTime() - Number(jaaulde.utils.cookies.get("_watchman"))); timeCheck(); } else { timeLeft = timeSubmit - (new Date().getTime() - Number(jaaulde.utils.cookies.get("_tts"))); timeCheck(); } } catch(err) { //handle errors } function timeCheck() { if(timeLeft &lt;= 0) { triggerSubmit(); } else { setTimeout(triggerSubmit, timeLeft); setInterval(showTimeLeft, 1000); } } function triggerSubmit() { //submit it } function showTimeLeft() { //do something } }); </code></pre>
javascript jquery
[3, 5]
4,650,145
4,650,146
setTimeout vs setInterval in javascript
<p>Hi can we change setInterval to setTimeout function, it is working fine I want to know can it is done with setTimeout</p> <pre><code>&lt;head&gt; &lt;script type="text/javascript"&gt; $(function() { var current = $('#counter').text(); var endvalue = 50 $('a').click(function() { setInterval(function() { if (current === endvalue) { } else { current++; $('#counter').text(current) } }, 50) }) }) &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="counter"&gt;0&lt;/div&gt; &lt;a href="#"&gt;Click&lt;/a&gt; &lt;/body&gt; </code></pre>
javascript jquery
[3, 5]
4,516,176
4,516,177
Jquery form validation is not working on Mac OS X Safari
<p>i'm loading a page from Jquery fuction which is following:</p> <pre><code>$(document).ready(function() { $("#Link").click(function() { $("#Div_id1").load("Page1",function() { $("#Div_id2").load("Page2"); }); }); }); </code></pre> <p>On page1 there is jquery form validation, when i click on link it loads all pages but the validation of form doesn't work in Mac OS x safari, but it works perfectly fine in Windows.</p>
javascript jquery
[3, 5]
5,133,502
5,133,503
Script issue in PHP
<pre><code>&lt;?php echo "&lt;script type='text/javascript'&gt;$('#tnxerror_captcha').html('test');&lt;/script&gt;"; ?&gt; &lt;div class="tnxerror" id="tnxerror_captcha"&gt;&lt;/div&gt; </code></pre> <p>The above code is not working.</p>
php javascript
[2, 3]
5,195,688
5,195,689
convert bitmap to image c#
<p>this is how my code look now:</p> <pre><code>System.Drawing.Image objImage = System.Drawing.Image.FromFile(Server.MapPath("aaa.jpg")); int height = objImage.Height; int width = objImage.Width; System.Drawing.Bitmap bitmapimage = new System.Drawing.Bitmap(objImage, width, height); System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmapimage); System.Drawing.Image bitmap2 = (System.Drawing.Image)Bitmap.FromFile(Server.MapPath("sem.png")); g.DrawImage(bitmap2, (objImage.Width - bitmap2.Width) / 2, (objImage.Height - bitmap2.Height) / 2); MemoryStream stream = new MemoryStream(); bitmapimage.Save(stream, ImageFormat.Jpeg); String saveImagePath = Server.MapPath("ImagesMerge/") + "aaa.jpg"; bitmapimage.Save(saveImagePath); imgBig.ImageUrl = saveImagePath; </code></pre> <p>The problem I have now is that the image is not displayed in browser, I don't understand why .</p>
c# asp.net
[0, 9]
4,988,038
4,988,039
How to redirect to dynamic url in javascript
<p>This is what I am trying to do:</p> <pre><code>window.location = "delete.php?case=&lt;?php echo $nt['id']; ?&gt;"; </code></pre> <p>How can this be done?</p>
php javascript
[2, 3]
276,496
276,497
Focus out event of asp.net textbox
<p>I want to call a javascript function on focus out of asp.net textbox. I want to do this on client side and not on server side.</p>
javascript asp.net
[3, 9]
3,717,047
3,717,048
getting international time using javascript/jquery/json/etc
<p>I am trying to figure out some way to get actual time via JavaScript, jQuery, JSON, etc... </p> <p>I've got these two sites that host the time for exactly that purpose</p> <ul> <li><a href="http://www.timeapi.org/utc/now" rel="nofollow">http://www.timeapi.org/utc/now</a></li> <li><a href="http://json-time.appspot.com/time.json" rel="nofollow">http://json-time.appspot.com/time.json</a></li> </ul> <p>and this site that actualy explains how to get the time but i cant seem to figure it out, since i dont really know json, only javascript.</p> <ul> <li><a href="http://james.padolsey.com/javascript/getting-the-real-time-in-javascript/" rel="nofollow">http://james.padolsey.com/javascript/getting-the-real-time-in-javascript/</a></li> </ul> <p>I've searched a lot but couldn't figure out how to extract data from another website using JavaScript.</p> <p>if someone could help me get the time from one of these sites into a variable in JavaScriptthat would be great.thanks.</p>
javascript jquery
[3, 5]
5,216,053
5,216,054
ASP.NET C# Display address details if logged in
<p>On my website i am trying to get my site to display the users address details if they are logged in have tried a stored procedure:</p> <pre><code>ALTER PROCEDURE dbo.showAddress @userid nvarchar(256) AS SELECT Fullname, Address, County, Postcode FROM Addresses WHERE @userid = UserId RETURN </code></pre> <p>But i get an area about expecting the user id? I have tried inserting through code behind:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (User.Identity.IsAuthenticated) { SqlCommand oCMD = new SqlCommand(); SqlConnection oCON = new SqlConnection(); oCON.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString; oCON.Open(); oCMD.Connection = oCON; oCMD.CommandType = CommandType.StoredProcedure; oCMD.CommandText = "showAddress"; SqlDataReader oRDR = oCMD.ExecuteReader(); oRDR.Read(); txtName.Text = oRDR.GetString(oRDR.GetOrdinal("Fullname")); oCON.Close(); } } </code></pre> <p>But this doesnt work either for me. Is there some code that could be entered as something like: </p> <p>txtPostcode.Text = "sql connection; Addresses; Fullname";</p> <p>Any help or ADVICE is appreciated.... </p>
c# asp.net
[0, 9]
5,032,080
5,032,081
How to hide a div with asp:ListView
<p>I have a &lt; div> with &lt; asp:ListView>- with results of searching. I want to hide this div, and show it when ListView will be full (or better - when this part of code will be completed)</p> <pre><code> lvSearchResult.DataSource = getSearchResult(); lvSearchResult.DataBind(); </code></pre> <p>How can I do this? Meanwhile when this &lt; div> with listview will be not visible, I want to show another div with information "Loading". When ListView will be ready, &lt; div> with results will show up, and &lt; div> with "loading" will be hidden.</p>
c# javascript asp.net
[0, 3, 9]
3,258,706
3,258,707
How to obtain thumbnail path from image path in android?
<p>Basically i have image path that looks like this: /mnt/sdcard/Pictures/image.jpg And i need to get a path to thumbnail from it, in a fastest possible way.</p> <p>I am trying to use MediaStore.Images.Thumbnails.queryMiniThumbnail, but no matter what i pass i get null cursor. Thanks!</p> <p><strong>EDIT:</strong> This is the function that brings ALL of the image paths and thumbnail paths and stores them in a String. What I need is a function that returns thumbnail path for a specific image path (/mnt/sdcard/Pictures/image.jpg). Thanks</p> <pre><code>public String getThumbPaths(ThumbContext ctx) { Uri uri = MediaStore.Images.Thumbnails.getContentUri("external"); Cursor cursor = MediaStore.Images.Thumbnails.queryMiniThumbnails(ctx .getActivity().getContentResolver(), uri, MediaStore.Images.Thumbnails.MINI_KIND, null); int columnIndex = cursor.getColumnIndex(Thumbnails.IMAGE_ID); String[] filePathColumn = { MediaStore.Images.Media.DATA }; StringBuilder stringBuilder = new StringBuilder(); String id = MediaStore.Images.Media._ID + "=?"; String orientation="1"; for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { String imageId = cursor.getString(columnIndex); Cursor images = ctx.getActivity().managedQuery( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, filePathColumn, id, new String[] { imageId }, null); String filePath = ""; if (images != null &amp;&amp; images.moveToFirst()) { filePath = images.getString(images .getColumnIndex(filePathColumn[0])); } ExifInterface exifReader; try { exifReader = new ExifInterface(filePath); orientation=exifReader.getAttribute(ExifInterface.TAG_ORIENTATION); } catch (IOException e) { // TODO Auto-generated catch block //e.printStackTrace(); } stringBuilder.append(cursor.getString(1) + ";"); stringBuilder.append(filePath + ";"); stringBuilder.append(orientation + ";"); orientation="1"; } //cursor.close(); return stringBuilder.toString(); } </code></pre>
java android
[1, 4]
3,474,770
3,474,771
How to concat string to List C#
<p>I was trying to add the strings to the List and export the list as csv file but the result I got is not the way I want. Here is the code -</p> <pre><code>List&lt;string&gt; values = new List&lt;string&gt;(); using (StreamReader sr = new StreamReader(filePath)) { while (sr.Peek() != -1) { string line = sr.ReadLine(); List&lt;string&gt; lineValues = line.Split(',').ToList(); var tempMinInt = 1; var tempValue = 1; var tempValInt = Convert.ToInt32(lineValues[4]); if (tempValInt % 60 != 0) { tempMinInt = (tempValInt / 60) + 1; tempValue = tempMinInt * 30; } else { tempMinInt = tempValInt / 60; tempValue = tempMinInt * 30; } values.Add(lineValues + "," + tempValue.ToString()); } } </code></pre> <p>Here is the sample input data: </p> <pre><code>33083,2011-12-19 05:17:57+06:30,98590149,1876,258 33084,2011-12-19 05:22:28+06:30,98590149,1876,69 33085,2011-12-19 05:23:45+06:30,98590149,1876,151 33086,2011-12-19 05:30:21+06:30,98590149,1876,58 33087,2011-12-19 06:44:19+06:30,949826259,1876,66 </code></pre> <p>And here is the output data:</p> <pre><code>System.Collections.Generic.List`1[System.String],150 System.Collections.Generic.List`1[System.String],60 System.Collections.Generic.List`1[System.String],90 System.Collections.Generic.List`1[System.String],30 System.Collections.Generic.List`1[System.String],60 </code></pre> <p>Please advice. Thank you.</p>
c# asp.net
[0, 9]
3,820,883
3,820,884
Add outlook calendar items with asp.net
<p>Im in urgent situation to add a ms outlook calendar items via asp.net/c#, I could find a sample for this,but it works when sender and receiver are different mail address. But my requirement is when my customer create a appointment customer's outlook calendar should disaply the appointment with reminder, so basically sender and receiver mail address are same</p> <p>example - fromaddress - [email protected], toaddress - [email protected]</p> <p>so this scenario, im only getting Appointment mail, but not saving in a calendar.</p> <p>but i when i used different mail address as sender, its work fine,</p> <p>pls help me solve this issue.</p> <p>Thanks</p> <p>Regards, IndSoft</p>
c# asp.net
[0, 9]
684,936
684,937
Build common interface for two applications(one is in .asp, other in java)
<p>We have two applications. One application in .asp and second application in java. we want to build interface for universal authentication, so that one can access the other application once signed into one application. Both applications are using SQL database, but one is written in .ASP hosted on Windows server while the other is in JAVA hosted on a Linux server. The applications are currently resided on two different servers.</p> <p>requirements:</p> <p>1)The end user are most likely to access the applications through .ASP first, then reach the 2nd application more like "back office" management system. 2)he JAVA application currently works well with IE web browser, but not very smooth with other browsers such as Firefox. Would like to make the application to be more compatible with other browsers.</p> <p>Please help me, its very important to me. Thanks in advance!</p>
java asp.net
[1, 9]
726,892
726,893
Difference in methods for testing undefined in javascript
<p>I've never understood the difference in these two ways for testing the existence of an object...</p> <pre><code>typeof obj == "undefined" </code></pre> <p>vs.</p> <pre><code>obj == undefined </code></pre> <p>Is one preferred? I'm almost always using jQuery, is the second a jQuery only feature?</p>
javascript jquery
[3, 5]
3,743,981
3,743,982
Dynamically choose DataContext
<p>based on some variable, I want to choose the datacontext from four possible datacontexts (of different types, of course) in a master page and then use it in nested master pages. Is this possible? </p> <p>Thanks, Ondrej</p>
c# asp.net
[0, 9]
526,262
526,263
How do I get text/html between consecutive <input>s?
<p>Since input tags aren't supposed to have closing tags, is there a simple way to extract the text/HTML in between a series of input tags? For example, for the below I want to retrieve <code>&lt;b&gt;Bob and Tim&lt;/b&gt;&lt;br&gt;Tim &lt;i&gt;after&lt;/i&gt; Bob&lt;br&gt;</code>.</p> <pre><code>&lt;div id="inputs"&gt; &lt;input type="text" value="bob" size="4" /&gt; &lt;b&gt;Bob and Tim&lt;/b&gt;&lt;br&gt; &lt;input type="text" value="tim" size="4" /&gt; Tim &lt;i&gt;after&lt;/i&gt; Bob&lt;br&gt; &lt;input type="button" value="get textbox values" id="mybutton" /&gt; &lt;/div&gt;​ </code></pre> <p><a href="http://jsfiddle.net/gLEZd/5/" rel="nofollow">http://jsfiddle.net/gLEZd/5/</a></p> <p>I can get the textbox's values, but how do I accomplish the above?</p>
javascript jquery
[3, 5]
1,537,927
1,537,928
How to set a dropdownlist item as selected in ASP.NET?
<p>I want to set selecteditem for asp. net dropdownlist control programmatically.</p> <p>So I want to pass a value to the dropdownlist control to set the selected item where is the value of the item equal to the passed value.</p>
c# asp.net
[0, 9]
1,328,567
1,328,568
Unable to return value from a function
<p>I want to return value from the function which contains an anonymous function. </p> <pre><code>function getSingleCheckedItemId() { return $(".data-table-chk-item").each(function() { if ($(this).is(":checked")) { var value = $(this).attr("value"); return value; } }); } </code></pre> <p>In this case it returns me the array of all checkboxes. If I remove the first <code>return</code>, it won't return a value but <code>undefined</code>.</p> <p>So how do I return the value from <code>getSingleCheckedItemId()</code>?</p>
javascript jquery
[3, 5]
4,614,271
4,614,272
need different button style on focus , clicked and normal
<p>How can i achieve different buttons styles when the button gets focus, when clicked and when it losses focus.</p> <p>I need to do this in jquery.</p>
jquery asp.net
[5, 9]
805,690
805,691
How to pass extra parameter in jquery post request from outside click event?
<p>Hi i have jquery request like below ,</p> <pre><code>$('#filterForm').submit(function(e){ e.preventDefault(); var dataString = $('#filterForm').serialize(); var class2011 = document.getElementById("2011").className; //var validate = validateFilter(); alert(dataString); if(class2011=='yearOn') { dataString+='&amp;year=2011'; document.getElementById("2011").className='yearOff'; } else { document.getElementById("2011").className='yearOn'; } alert (dataString); $.ajax({ type: "POST", url: "myServlet", data: dataString, success: function(data) { /*var a = data; alert(data);*/ } }); </code></pre> <p>and my Form is like , </p> <pre><code>&lt;form method="post" name="filterForm" id="filterForm"&gt; &lt;!-- some input elements --&gt; &lt;/form&gt; </code></pre> <p>Well, I am triggering jquery submit on submit event of a form ,(it's working fine) I want pass one extra parameter inside form which is not in above form content but it's outside in page it's like below</p> <p>[Check this image link for code preview][1]</p> <p>So how can i trigger above event , on click of , element with class yearOn ( check above html snippet ) and class yearOff , with additional parameter of year set to either 2011 or 2010</p>
javascript jquery
[3, 5]
3,221,966
3,221,967
How can I take a different values from different tables and store in another table?
<p>I want to take the <code>customer id</code> from a <code>customer table</code>, <code>restaurant id</code> from a <code>restaurant table</code>, and <code>order id</code> from <code>order table</code>. I want to store these values in a single table detail. How might I do this?</p>
c# asp.net
[0, 9]
4,432,575
4,432,576
selected text in iframe
<p>How to get a selected text inside a iframe.</p> <p>I my page i'm having a iframe which is editable true. So how can i get the selected text in that iframe.</p>
javascript jquery
[3, 5]
3,054,710
3,054,711
Hiddenfield in a usercontrol, can not access it on clientside
<p>I have a hidden field in a User Control. At run time I assign the hidden fields ClientId to an anchor tag like this:</p> <pre><code>aClickSort1.HRef = string.Format("javascript:SortImage({0},{1});", divArrowUp1.ClientID, hiddenSort1.ClientID); </code></pre> <p>The thing is that when I try to get the hidden fields ClientId in client side code, it is undefined.</p> <p>How can access it on the client side code?</p> <p>Ps. The HiddenField is in a usercontrol</p> <p>Regards Örvar</p>
javascript asp.net
[3, 9]
870,607
870,608
When using $(document).ready why must it be in an anonymous function?
<p>I use document ready all the time, but I'm watching some tutorial videos to really KNOW whats going on instead of just knowing from typing it so much.</p> <p>I had always put it in an anonymous function out of habit as thats how its always done, but now I see if its NOT in an anonymous function (say <code>alert();</code> for instance), it will execute NOT when the DOM is loaded but immediately when that javascript loads. It must be in an anonymous function for this to happen how its supposed to (when the whole page loads) and the event listeneter triggers that its 'ready'.</p> <p>Why is this?</p> <p>furthermore I often see something like function(i){}(i), what does this mean?</p>
javascript jquery
[3, 5]
2,689,342
2,689,343
jQuery's implicit loop goes "both ways"?
<p>Turns out jQuery's "implicit looping" goes both way:</p> <pre><code> &lt;div class="classOne"&gt; some content &lt;/div&gt; &lt;div class="classOne"&gt; some content 2 &lt;/div&gt; [...] $(function() { $('hello world').prependTo($('.classOne')); }) </code></pre> <p>in this case, the loop will happen at the <code>$('.classOne')</code> section -- <code>hello world</code> will be added to both Divs.</p> <p>I also tried</p> <pre><code> &lt;div class="classOne"&gt; some content &lt;/div&gt; &lt;div class="classOne"&gt; some content 2 &lt;/div&gt; &lt;div class="classTwo"&gt; &lt;a href="http://www.google.com"&gt;hello Google&lt;/a&gt; &lt;/div&gt; &lt;div class="classTwo"&gt; &lt;a href="http://www.yahoo.com"&gt;hello Yahoo&lt;/a&gt; &lt;/div&gt; [...] $(function() { $('.classTwo').prependTo($('.classOne')); }) </code></pre> <p>and there will be "nested loops"... so the 2 links will be added to both Divs</p> <p>so i think if we have</p> <pre><code>$('.classOne').prepend($('.classTwo')).prepend($('.classThree')) </code></pre> <p>then it will be like 3 nested loops? Is there a rule to the nesting, and which one is the inner loop and which one is the outer loop? And what is the inner loop / outer loop if it is</p> <pre><code>$('.classOne').prependTo($('.classTwo')).prependTo($('.classThree')) </code></pre> <p>?</p>
javascript jquery
[3, 5]
5,187,761
5,187,762
Why does not self focus work in javascript?
<p>Whenever a blur event is triggered from any input element, I want to set focus to one particular element. </p> <p>But this <em>only works</em>, when the element I am trying to focus on to, is <strong><em>not</em></strong> the one triggering the event.</p> <blockquote> <p><strong><a href="http://jsfiddle.net/Lx6Cx/" rel="nofollow">[Issue Illustration]</a></strong> <em><strong>and explanation as per the fiddle:</em></strong></p> <ul> <li>The element I am trying to focus to is <code>col0</code></li> <li>Unless the element to trigger the blur event is not <strong><code>col0</code></strong> it works perfect</li> <li>But when blur is triggered from <code>col0</code> itself, then <code>$("#col0").focus()</code> does not work.</li> </ul> </blockquote> <p><strong>Q:</strong> Why? &amp; What is the workaround/solution?</p> <p><sub><strong>P.S:</strong> I am just trying to know the cause of the behavior and ways to overcome it. Concerns about the usability, is <strong>not the question</strong>.</sub></p>
javascript jquery
[3, 5]
375,265
375,266
best way to check if 3 textboxes are empty
<p>I have 3 textboxes and I want to check if put together they all add up to greater than blank. What's the best way to accomplish that?</p> <pre><code> &lt;asp:TextBox ID="tbDate" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:TextBox ID="tbHour" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:TextBox ID="tbMinutes" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:CustomValidator ID="cvDateControlValidator" runat="server" ErrorMessage="Invalid Date" ValidateEmptyText="True" ClientValidationFunction="validateDateOnClient" ControlToValidate="tbDate" Display="Dynamic"&gt;&lt;/asp:CustomValidator&gt; &lt;script type="text/javascript"&gt; function validateDateOnClient(sender, args) { if (args.Value.length &gt; 0) args.IsValid = false; return args.IsValid; } &lt;/script&gt; </code></pre> <p>One suggestion was: </p> <pre><code>if (tbDate.value != '' || tbHour.value != '' || tbMinutes.value != '') </code></pre> <p>I want to make sure tbDate, tbHour, tbMinutes together is greater than blank before I perform the client-side validation.</p>
javascript asp.net
[3, 9]
4,180,483
4,180,484
JQuery Toggle True or False on data-filter
<p>I have an image link which I want to use as a toggle button.</p> <pre><code>&lt;img id="myToggleButton" src="myToggle.jpg" /&gt; And what I want it to toggle is this: &lt;ul id="listview" data-filter="true"&gt; So, basically I need to change from data-filter="true" or data-filter="false" and so on. </code></pre> <p>How can I get this working using JQuery?</p>
javascript jquery
[3, 5]
3,387,101
3,387,102
What's the difference between jQuery.data and jQuery._data ( underscore data )?
<p>While going through the source, I noticed that 'toggle' supposedly uses <code>jQuery._data</code> to store the state of the element. I examined the <code>jQuery.cache</code> object in chrome and found that the element's data object had yet another object under it prepended by the word jQuery with a number that I'm guessing uniquely identifies it. However, I saw no data regarding the state of the element. Simply <code>{olddisplay: 'block'}</code>. Any clues as to the purpose of jQuery._data and how it works per se?</p> <p>I've been staring at the source all day .... please don't tell me to view the source. My eyes and brain will thank you.</p>
javascript jquery
[3, 5]
4,330,716
4,330,717
Fading in background image with jQuery
<p>How would you fade in a background image (the body tag, and it is tiled) with jQuery? The background color is white and in a callback function I want to toggle the background image to on and off.</p> <p>Any ideas?</p>
javascript jquery
[3, 5]
5,024,338
5,024,339
not able to pass value to javascript function from jquery's success
<p>I am calling javascript function filename in success of jquery as below , but i am not able to get p in javascript </p> <pre><code> success: function(result) { var htmlString = [result]; for (i = 0; i &lt; htmlString.length; i++) { var p = htmlString[i].Number; $('#MyGrid tbody').append('&lt;tr&gt;&lt;td&gt;&lt;a rel="' + p + '" href="#" onclick="filename(p);" class="filePreview"&gt;&lt;/a&gt;&lt;/tr&gt;'); } } </code></pre> <p>how to get p in filename?</p> <p>thanks,</p> <p>michaeld</p>
javascript jquery
[3, 5]
532,551
532,552
Process Jquery fuction only once
<p>HTML&amp;PHP</p> <p>I list ticket info;</p> <pre class="lang-php prettyprint-override"><code> &lt;table&gt; &lt;?php while($values = mysql_fetch_array($ticketInfo)){ echo '&lt;tr&gt;'; echo '&lt;td id="ticketPrice"&gt;'. $values['ticket_price'] .'&lt;/td&gt;'; echo '&lt;td id="myBonus"&gt;'. $values['bonus']*5 .'&lt;/td&gt;'; echo '&lt;td&gt;&lt;input type="checkbox" name="use_bonus" onclick="useMyBonus();" id="myBonusId" /&gt;&lt;/td&gt;'; echo '&lt;/tr&gt;'; } ?&gt; &lt;/table&gt; </code></pre> <p>When user click checkbox process a jquery script for calculate discount with use bonus and write returning data to ticketPrice ID. But there is multiple checkbox and if user click another checkbox script calculate again but I don't this. How can I process it only once?</p> <p>My jquery Code;</p> <pre><code> function useMyBonus(){ myBonus = parseInt($("#myBonus").text()); ticketPrice = parseInt($("#ticketPrice").text()); checked = $("#myBonusId").is(':checked'); if(checked == true){ $("#ticketPrice").text(ticketPrice-(myBonus/2)); }else{ $("#ticketPrice").text(ticketPrice+(myBonus/2)); } } </code></pre>
javascript jquery
[3, 5]
4,681,953
4,681,954
DateTime.Now.Year to fill maximum value in RangeValidator
<p>I am using a RangeValidator to validate that a year is between a static start year and a dynamic end year (the current year). I am drawing a huge blank for setting the maximum value in this fashion:</p> <pre><code>MaximumValue='&lt;% DateTime.Now.Year %&gt;' </code></pre> <p>Any help is appreciated as I usually don't set max values in this fashion.</p> <p>Edit: So I have been given the following ways to incorporate the code into the codebehind:</p> <ol> <li>validator init event</li> <li>page prerender</li> <li>and i'm a newb and would just have done on page load</li> </ol> <p>which is best?</p>
c# asp.net
[0, 9]
2,065,756
2,065,757
JavaScript - creating a html table or grid from a list of words in script
<p>How can I take the list of words and create a html table from them? </p> <pre><code> &lt;script&gt; $('.wordcontainer').html('&lt;ul&gt;&lt;li&gt;&lt;/li&gt;&lt;/ul&gt;'); var listofwords = {"mat","cat","dog", "pit", "pot", "fog", "log", "pan", "can", "man"}; &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
3,544,381
3,544,382
sending other input with $_FILES php
<p>Im uploading a file using the following jquery..</p> <pre><code> function ajaxFileUpload(jobid) { $("#loading") .ajaxStart(function(){ $(this).show(); }) .ajaxComplete(function(){ $(this).hide(); }); $.ajaxFileUpload ( { url:'addjobrpc.php', secureuri:false, jobID:jobid, fileElementId:'fileToUpload', dataType: 'json', success: function (data, status) { $('#imageid').val(data.imageid); if(typeof(data.error) != 'undefined') { if(data.error != '') { alert(data.error); }else { alert(data.msg); } } }, error: function (data, status, e) { alert(e); } } ) return false; } </code></pre> <p>My form looks like this...</p> <pre><code>&lt;form name="form" action="" method="POST" enctype="multipart/form-data"&gt; </code></pre> <p>I get the filename with $_FILES['fileToUpload']['name']; but how would I get a input that is not part of the file upload? For example Jobid is a hidden field but I can't seem to get the value in addjobrpc.</p> <p>Thanks</p>
php javascript jquery
[2, 3, 5]
1,226,771
1,226,772
Accessing the reference of a child class from an abstract parent
<p>I have an abstract class. It contains a private class field. In one of the methods in the private class field, I need to refer to <code>this</code> of whatever child class extends the abstract class.</p> <pre><code>public abstract class ActivityCrazy extends Activity { private class FoolClickedButton implements OnClickListener { public void onClick(View v) { startActivity( new Intent( IMPLEMENTER_OF_ABSTRACT_CLASS.this, AnotherClass.class ) } } } </code></pre> <p>How do I properly do this? </p> <p>Before ActivityCrazy was not an abstract class, so I could use <code>ActivitySpecific.this</code>. But now I realized that many classes need the same private FoolClickedButton, so I created this abstract class. The problem is that FoolClickedButton's onClick method must refer to itself.</p>
java android
[1, 4]
3,231,431
3,231,432
Create nested property from variable
<p>Assume I have an empty object like so:</p> <pre><code>var object = {}; </code></pre> <p>How can I add a property with a nested object using variables? E.g.:</p> <pre><code>&lt;span id='obj1'&gt;person&lt;/span&gt; &lt;span id='nestedObj'&gt;name&lt;/span&gt; var obj1 = $( '#obj1' ).text(); var nestedObj = $( '#nestedObj' ).text(); function (obj1, nestedObj) { //Trying to simulate object.person.nestedObj object[obj1][nestedObj] = 'someone'; } </code></pre>
javascript jquery
[3, 5]
4,606,094
4,606,095
Disable click handler when click is fired in jQuery
<p>We have a website built in .NET and jQuery. We have custom jQuery to call the load method on a processing ASP.NET page. That ajax call is fired in a click handler, e.g.</p> <pre><code>$("#Submit").click(function(){ $(a_selector).load("Process.aspx?data=" + someDataObject, null, function(){ alert("Done")}); } return false; ); </code></pre> <p>Our issue is when we hit the #Submit button the click is fired which calls the ajax to process it. People seem to be double-clicking the button and therefore we're getting multiple results in our database from the dual clicks. Does anyone have an idea on how to prevent this issue? I considered something like disabling the button via JS but I'd like to know of other ideas.</p>
javascript jquery
[3, 5]
4,474,605
4,474,606
How to compare two date and time in android
<p>I have one problem is there. How to compare 2 date and time</p> <pre><code>enter code here if(fromdate&lt;=nowdt.now() &amp;&amp; todate&gt;= nowdt.now()){ //// } </code></pre>
java android
[1, 4]
5,779,045
5,779,046
strange session problem
<p>I have this field in my session class:</p> <pre><code>public bool IsCartRecentlyUpdated { get { if (this.session["IsCartRecentlyUpdated"] != null) { return (bool)this.session["IsCartRecentlyUpdated"]; } else { this.session["IsCartRecentlyUpdated"] = false; return (bool)this.session["IsCartRecentlyUpdated"]; } } set { this.session["IsCartRecentlyUpdated"] = value; } } </code></pre> <p>Whenever a user adds a product to the cart I put this value on true:</p> <pre><code> public void AddToCart(Product product, int quantity) { IsCartRecentlyUpdated = true; //other code for updating the cart } </code></pre> <p>Adding a product to the cart does a postback so I can <strong>show a message</strong> (ëg: <em>Product added succesfully</em>) in Page_Load of the General Master page where the shopping cart is located, when a product has just been added to the cart:</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { if (this.sessionsUtil.IsCartRecentlyUpdated) { this.lblCartWarning.Text = (string)GetLocalResourceObject("CartWarning"); imgCardLogos.Visible = false; } else { this.lblCartWarning.Text = String.Empty; imgCardLogos.Visible = true; } //other code //put it back to false to not show the message each time the page is loaded this.sessionsUtil.IsCartRecentlyUpdated = false; } </code></pre> <p>Well this code <strong>works</strong> great <strong>locally</strong> but on the <em>server</em> it does not <em>show the message</em> after adding the product to the cart but <em>on the second page loading</em>... (I guess that on the server somehow the page is loading before the session var is updated - extremely strange)</p> <p>Do you know why? I do not see any problem in the code...</p>
c# asp.net
[0, 9]
4,339,314
4,339,315
How to add number of days to get the next date from current date without weekends
<p>I want to add some no. of days to get the future date. And weekends should not be included in this. How can I get this?</p> <p>var startdate = "8-June-2012"; no. of days to add = 10; enddate should be "22-June-2012"</p>
javascript jquery
[3, 5]
3,609,234
3,609,235
new values on $(window).resize
<p>I first do this and it works:</p> <pre><code> $(document).ready(function() { var delay = 0; var myLeft = $("#container").offset().left; var myRight = myLeft + $("#container").outerWidth(); var newWidth = $("#container").width(); $("#head").animate({width: newWidth}); $("#head").css("marginLeft", myLeft).css("marginRight", myRight); $('.box').each(function() { $(this).delay(delay).fadeIn(); delay += 250; }); }); </code></pre> <p>Then i run this but it does't work, ideally it would have to work on each window resize:</p> <pre><code> function doSomething() { var myLeft = $("#container").offset().left; var myRight = myLeft + $("#container").outerWidth(); var newWidth = $("#container").width(); $("#head").animate({width: newWidth}); $("#head").css("marginLeft", myLeft).css("marginRight", myRight); }; var resizeTimer; $(window).resize(function() { clearTimeout(resizeTimer); resizeTimer = setTimeout(doSomething, 100); }); </code></pre> <p>But it looks like as the new sizes are not applied each time there is a window resize, anyone?</p>
javascript jquery
[3, 5]
503,259
503,260
How to send a script from one page to another in JavaScript or jQuery?
<p>I would like to send some javascript from one file to another in my own server. For example on file 1 I have the following code:</p> <pre><code>&lt;script&gt; alert("Hey There!"); &lt;/script&gt; </code></pre> <p>I want to send this code to file 2, so that the alert happens on file 2. Imagine File 2 had already loaded, I want to perform some processing on File 1 and based on the result of said processing I want to send something to File 2.</p> <p>File 2 should not be sending any requests to File 1, File 1 should be doing all the sending, and File 2 should receive the message without page refresh.</p> <p>Is this possible?</p> <h2>EDIT</h2> <p>Imagine I have 3 files (2 html and 1 js). File A has already loaded, there's nothing in there. The js file is call "sayHello.js", it has the following content:</p> <pre><code>alert('Indeed 10 is less than 100'); </code></pre> <p>File B has the following content:</p> <pre><code>if (10 &lt; 100) { // attach the js file "sayHello.js" to File A } </code></pre> <p>How would I be able to attach the js file to File A from File B (using the jQuery.getScript() method) and have the script execute on File A?</p>
javascript jquery
[3, 5]
5,482,714
5,482,715
Detect Android phone via Javascript / jQuery
<p>How would i detect that the device in use is an Android for a mobile website?</p> <p>I need to apply certain css attributes to the Android platform.</p> <p>Thanks</p>
javascript jquery android
[3, 5, 4]
5,482,202
5,482,203
Detecting Data changes in Forms using JQuery
<p>I'm using ASP.NET 2.0 with a Master Page and I was wondering if anyone knew of a way to detect when the fields within a certain <code>&lt;div&gt;</code> or <code>fieldset</code> have been changed (e.g., marked '<code>IsDirty</code>')?</p>
javascript jquery
[3, 5]
275,206
275,207
parsererror in ajax jquery calling a webservice
<p>I have written a webservice like below:</p> <pre><code>[WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json, XmlSerializeString = false, UseHttpGet = true)] public string GetNews(int tes) { return tes.ToString(); } </code></pre> <p>and I want to use this function in client so I wrote this lines:</p> <pre><code>$.ajax({ dataType: "jsonp", success: function (d) { $('.widget.yellow').html(d.d); }, error: function (xhr, textStatus, errorThrown) { $('.widget.yellow').html(textStatus); }, data: { tes: '170' }, url: "http://localhost:1122/Services/MyService.asmx/GetNews?format=json" }); </code></pre> <p>but I get error.The textStatus is "parsererror" and xhr.statusText is "success" and xhr.status is "200" and xhr.readyState is "4". I need some help.</p>
jquery asp.net
[5, 9]
3,745,642
3,745,643
Jquery .change() to view currently assigned method
<p>Is there any way I can view the current method assigned to a selects change event. I have tried. </p> <pre><code>$('#select').change() </code></pre> <p>but that just returns me the change event. I don't really need to do this but would be very handy for debugging. Save me hunting through the code to find the method, this way I can simply search the text in the method and find the method quickly. </p>
javascript jquery
[3, 5]
3,868,376
3,868,377
Jquery and CSS background change
<p>I am having problem with the following line:</p> <pre><code>document.getElementById("giftcard").getElementsByTagName("label").style.backgroundImage ="url(giftcard_icon-d.jpg)"; </code></pre> <p>I am trying to change background image after clicking a <code>label</code>.</p> <p>I do have 5 <code>label</code>s in a page, but when i click on <code>label</code>, the background should change it. Other labels should be reset to use this <code>giftcard_icon-d.jpg</code> image as their background. </p> <p>How can I fix this?</p> <pre><code>$(document).ready(function() { $('#giftcard label').click(function() { document.getElementById("giftcard").getElementsByTagName("label").style.backgroundImage ="url(giftcard_icon-d.jpg)"; this.style.backgroundImage ="url(giftcard_icon-a.jpg)"; }); </code></pre>
javascript jquery
[3, 5]
2,024,702
2,024,703
File permission while saving a html to server
<p>I have a problem , I want to save a html file in directory using asp.net . But when i try to do so , I got a security exception as follow . </p> <pre><code>7/10/2012 12:03:54 AM,http://www.teddytank.com/admin/AddNewsLetter.aspx? nid=3,System.IO.IOException: The process cannot access the file 'D:\hosting\7837152\html\ne\newsletter06_07_2012_T_37.html' because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileInfo.Delete() at Admin_AddNewsLetter.Submit_Click(Object sender, EventArgs e) 7/10/2012 12:04:45 AM,http://www.teddytank.com/admin/AddNewsLetter.aspx? nid=3,System.IO.IOException: The process cannot access the file ' D:\hosting\7837152\html\ne\newsletter06_07_2012_T_37.html' because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileInfo.Delete() at Admin_AddNewsLetter.Submit_Click(Object sender, EventArgs e) </code></pre> <p>Please help. thanx in advance.</p>
c# asp.net
[0, 9]
4,735,074
4,735,075
jquery REGEX validation for letters and Numbers onlyu
<p>Can any body tell me what is the Regex validation to use my textbox should take only letters and Numbers?</p> <pre><code> var BLIDRegExpression = /^[a-zA-Z0-9]*$/; if (BLIDRegExpression.test(BLIDIdentier)) { alert('The BLID Identifier may only consist of letters or numbers and must be exactly five characters long.'); return false; } </code></pre> <p>I am using this one but its not working. can anybody tell me.</p> <p>Thanks</p>
javascript jquery
[3, 5]
5,686,157
5,686,158
Convert from C# function to JavaScript function
<p>I have a function in c# that used to manipulate the string, It works well while I used in C#. Now I want to convert this function to use in JavaScript. This is the function in C#:</p> <pre><code> public static string TrimString(string str, int lenght) { string _str = str; int _iAdditionalLenght = 0; for (int i = lenght; i &lt; str.Length; i++) { if (_str.Substring(i, 1) == " ") break; _iAdditionalLenght++; } return str.Substring(0, str.Length &lt; (lenght + _iAdditionalLenght) ? str.Length : (lenght + _iAdditionalLenght)); } </code></pre> <p>I converted it to javascript :</p> <pre><code>function TrimString(str, lengthStr) { //this is my testing 4 var _str = str; var _iAdditionalLenght = 0; for (var i = lengthStr; i &lt; str.length; i++) { if (_str.substring(i, 1) == " ") break; _iAdditionalLenght++; } return str.substring(0, str.length &lt; (lengthStr + _iAdditionalLenght) ? str.length : (lengthStr + _iAdditionalLenght)); } </code></pre> <p>But the javascript doesn't work.</p> <p>Could anyone tell me, how could I do it in JavaScript function?</p>
c# javascript
[0, 3]
3,051,094
3,051,095
How to add &ref=123 every link
<p>How would i be able to put the follow on the end of every link of my website with out editing every link?</p> <p>e.g <code>www.WebsiteName.com/?ref=123</code></p> <p>so if i went to <code>www.WebsiteName.com/aboutus.php</code> i want it to add <code>?ref=123</code> onto the end of the url.</p>
php javascript jquery
[2, 3, 5]
4,234,103
4,234,104
adding click listener to Overlay class
<p>I have the following class which extends Overlay that draws the pin in my Google Map, the question is how do I add a click listener on that so when I click on the pin I can redirect it to a different activity?</p> <pre><code>class MapOverlay extends Overlay { private GeoPoint p; public MapOverlay(GeoPoint p){ this.p = p; } public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) { super.draw(canvas, mapView, shadow); //---translate the GeoPoint to screen pixels--- Point screenPts = new Point(); mapView.getProjection().toPixels(p, screenPts); //---add the marker--- Bitmap bmp = BitmapFactory.decodeResource( getResources(), R.drawable.pushpin); canvas.drawBitmap(bmp, screenPts.x, screenPts.y-50, null); return true; } } </code></pre>
java android
[1, 4]
3,162,870
3,162,871
List<Object> vs List<dynamic>
<p>I need to create a heterogeneous <code>List</code> of objects (custom classes). My first thought was to create a <code>List&lt;ISomeMarkerInterface&gt;</code> but I quickly learned that this is not what I want. My next thought was <code>List&lt;dynamic&gt;</code> and this didn't seem to be a bad idea. However, I was doing some research and came across this <a href="http://msdn.microsoft.com/en-us/library/yz2be5wk.aspx" rel="nofollow">article about boxing and unboxing</a> and in the example, they're doing basically what I want using <code>List&lt;Object&gt;</code>. </p> <p>Aside from the fact that <code>dynamic</code> will be evaluated at runtime and <code>Object</code> at compile-time, what is the difference between <code>List&lt;dynamic&gt;</code> and <code>List&lt;Object&gt;</code>? Aren't they essentially the same thing?</p>
c# asp.net
[0, 9]
1,795,137
1,795,138
jquery checkbox selcetion
<p>Please refer the url </p> <p><a href="http://jsfiddle.net/fnvXT/" rel="nofollow">http://jsfiddle.net/fnvXT/</a></p> <p>Here while selecting the check box the corresponding row is selected. I want to change that as</p> <p>only one will be highlighted at a time.</p> <p>If i select check box 2 then the check box 2 will be checked and this row only be highlighted and remaining check box should unchecked and remove the highlighting. </p> <p>How do i change this. Please do the needful. Thanks</p>
php jquery
[2, 5]
3,161,998
3,161,999
how to hide download option from pdf document seen in google docs
<pre><code>WebView WebView = (WebView) findViewById( R.id.WebView01); String pdfurl = ""; // Url of pdf or doc file. String weblink="http://docs.google.com/gview?embedded=true&amp;url="+pdfurl; mWebView.loadUrl(weblink); </code></pre> <p>but this code has Download option on page I want remove this option and I want to give permission to read only not download. please help Thanks.</p>
java android
[1, 4]
4,030,225
4,030,226
In javascript, how would I do this rfind?
<pre><code>www.mydomain.com/invite/abc123 </code></pre> <p>I want the function to return "abc123". The logic goes like this:</p> <pre><code>If there is a forward slash, then take all characters after the last forward slash. </code></pre> <p>In python, I write it like this: </p> <pre><code>if s.find('/') &gt;= 0: return s[s.rfind('/')+1:] </code></pre> <p>But how do I do this in javascript?</p>
javascript python
[3, 7]
3,384,983
3,384,984
How to get result from activity if started from Overlay?
<p>How can i get the result back from an Activity if started from an Overlay e.g. I am using the following code:</p> <pre><code>Intent alertSett = new Intent(_ctx, AlertSettings.class); _ctx.startActivity(alertSett); //set destination setDestination(); </code></pre> <p>I want to call the <strong>setDestination();</strong> based on the settings i received from AlertSettings Activity, there is no <strong>startActivityForResult()</strong> in context which seems ok because it'll trigger the overridden onActivityResult which is in Activity Class. Is there any other way to accomplish it?</p>
java android
[1, 4]
3,019,582
3,019,583
loading image while javascript function(s) run
<p>is there a way to show a loading image while a javascript function is running. I have one that takes about 2-5 seconds, would be nice if i could have something like the jquery-ajax function</p> <pre><code>$("#loading").bind("ajaxStart", function(){ $(this).attr("style", "visibility: visible") }).bind("ajaxStop", function(){ $(this).attr("style", "visibility: hidden") }); </code></pre> <p>clarification edit:</p> <p>The idea is that every time a javascript function runs and takes over, say 3/4 of a second, the loading image would be displayed. It really has nothing to do with this ajax function, just the same principle of always catching a running javascript and timing it.</p> <p>Thanks!</p>
javascript jquery
[3, 5]
2,235,052
2,235,053
parsing url with javascript or jquery
<p>I have a url in this form <a href="http://www.example.com/data/45" rel="nofollow">http://www.example.com/data/45</a>. How do I get the last element (45 in this example) using jQuery or JavaScript?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
4,862,426
4,862,427
jquery addclass id not working on list
<p>Please check my code,</p> <p><strong>CSS</strong></p> <pre><code>.ulData li.sel { background:#fff !important; font-size:0.8em; font-weight:bold; } </code></pre> <p><strong>JS</strong></p> <pre><code>function switchTab(typ){ $(".ulData li").removeClass("sel"); $("#"+typ).addClass("sel"); $("."+ typ +"Options").addClass("sel"); } </code></pre> <p><strong>HTML</strong></p> <pre><code>&lt;ul class="ulData"&gt; //For Loop li &lt;li title="${option.id}" id="${option.key}"&gt;&lt;span&gt;aaaa&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>If I click on a button, I call switchTab function. In there I am adding the 'sel' class. If I am adding like,</p> <pre><code>$("li#"+typ).addClass("sel"); </code></pre> <p>Then working in Firefox but non of the IE versions. please help how to apply the CSS for all the browser compatibilities.</p> <p>Thanks in advance</p>
javascript jquery
[3, 5]
5,514,237
5,514,238
How could I do face detect during recording video mode
<p>I want to do some image processing work like face detection or something during the camera is under recording video mode .</p> <p>now I can recording video and save file and transfer it to my server. but if I want to detect human face during recording,(I don't need any algorithm , I'll take it) how can I do this? use what kind of library ? I think I should use some method to get each frame of the recording video. but how ?</p> <p>now, I use "MediaRecorder" to capture the video . SurfaceView , SurfaceHolder : to show the preview screen</p> <p>is anyone can give me some suggestions ? thank you very much in advance ^^</p>
java android
[1, 4]
5,744,981
5,744,982
Get a "Could not load file or assembly 'Microsoft.Practices.ObjectBuilder" while trying to run my application
<p>I get this error message when trying to run my ASP.NET application: </p> <blockquote> <p>Could not load file or assembly 'Microsoft.Practices.ObjectBuilder, Version=1.0.51206.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.</p> </blockquote> <p>I checked to make sure the DLL is in the right place and that the assemblies and references are right, and they are. Any ideas or has anyone come across this? </p>
c# asp.net
[0, 9]
4,693,754
4,693,755
How would my Java program process a JS file to extract function names?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6921427/how-to-get-method-name-from-javascript-file">How to get method name from JavaScript file</a> </p> </blockquote> <p>I want to fetch Java Script function name in my Java file.I mean i want some solution so that i can go traverse my JS File,find out function name &amp; list out them in my Java file.Is there any way so that i link my JS File,its function name with Java?</p>
java javascript
[1, 3]
1,614,885
1,614,886
Execute live function
<p>I've got an ajax call I want to execute for 2 events, whenever the document is loaded and whenever foo-live-event is clicked. What is the best way to do this? </p> <pre><code>$(document).delegate(".foo-live-element", "click", function() { $.ajax({ //ajax call }); }); </code></pre>
javascript jquery
[3, 5]
480,276
480,277
actionBarSherlock subtitle textSize
<p>I'm using ActionBarSherlock subtitles and trying to change the subtitle textsize using styles, but it seems that doesn't work. I'm not that familiar with themes, so.. How can I change that??</p> <p>Thanks in advance</p>
java android
[1, 4]
327,031
327,032
Javascript .keyCode vs. .which?
<p>I thought this would be answered somewhere on SO, but I can't find it.</p> <p>If I'm listening for a keypress event, should I be using .keyCode or .which to determine if the enter key was pressed?</p> <p>I've always done something like the following:</p> <pre><code>$("#someid").keypress(function(e) { if (e.keyCode === 13) { e.preventDefault(); // do something } }); </code></pre> <p>But, I'm seeing examples that use .which instead of .keyCode. What's the difference? Is one more cross-browser friendly than the other?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
4,948,587
4,948,588
I need to fill text field programatically in a web page opened inside a WebView. How To?
<p>I have created a WebView and opened up a web page in it that contains a form. I need to fill that form programmatically (need to get some data form sqlite database and fill it). </p> <p>how i can do that ? can anyone please help me out.</p> <p>EDIT : the web page is a sign-up form and i do not own that web page.. i cannot add java script into that page.</p>
java android
[1, 4]
5,831,562
5,831,563
Jquery variables variable
<p>There exist some concept like variables variable to print variable names or call functions dynamically:</p> <p><a href="http://php.net/manual/en/language.variables.variable.php" rel="nofollow">http://php.net/manual/en/language.variables.variable.php</a></p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
3,088,940
3,088,941
Android: Opening default phone dailing
<pre><code>&lt;TextView android:id="@+id/TextView03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/header" android:layout_alignLeft="@+id/button1" android:layout_marginBottom="127dp" android:text="@string/phone" android:textColor="#000000" android:textSize="12dp" android:typeface="sans" /&gt; </code></pre> <p>I have a test view which holds my phone information. How do i open an default phone dailing box on the click of the message. </p> <pre><code>&lt;string name="email"&gt;Phone: 1-866-232-3805&lt;/string&gt; </code></pre> <p>Here is my Override method. </p> <pre><code> @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView t2 = (TextView) findViewById(R.id.TextView03); email.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub } }); } </code></pre> <p>What should i do from here?</p>
java android
[1, 4]