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 |
---|---|---|---|---|---|
84,437 | 84,438 | Class constructor error | <p>Since we know that constructor is not inherited in the child class as i asked in the my previous question <a href="http://stackoverflow.com/questions/11271920/constructor-overriding">Click here to view question </a></p>
<p>I had write the code </p>
<pre><code>namespace TestConscoleApplication
{
abstract public class A
{
public int c;
public int d;
private A(int a, int b)
{
c = a;
d = b;
}
public virtual void Display1()
{
Console.WriteLine("{0}{1}", c, d);
}
}
internal class B : A
{
protected string Msg;
public B(string Err)
{
Msg = Err;
}
public void Display()
{
Console.WriteLine(Msg);
}
}
class Program
{
static void Main(string[] args)
{
B ObjB = new B("Hello");
Console.ReadLine();
}
}
}
</code></pre>
<p>when i compile the code its showing an error </p>
<blockquote>
<p>Error <code>TestConscoleApplication.A.A(int, int)</code> is inaccessible due to its protection level. </p>
</blockquote>
<p>Then why it is showing an error.</p>
| c# asp.net | [0, 9] |
1,549,426 | 1,549,427 | Android-java vs PC-Java | <p>This simple line of code gives the error "The method getTextContent() is undefined for the type Element":</p>
<pre><code>String color_string = ( ( Element )( ( Element )inner_node ).getElementsByTagName( "color" ).item( 0 ) ).getTextContent();
</code></pre>
<p>I get the error in my Android-java version, but not in my PC-Java which I use for testing and debugging Java code before I run it on the phone.</p>
<p>I have</p>
<pre><code>import org.w3c.dom.Element;
</code></pre>
<p>on both versions. And I copied the code from the PC-Java to the Android-Java so I am 100% sure I have the same syntax on both.</p>
| java android | [1, 4] |
50,379 | 50,380 | How to change the value of textbox when form is submitted? | <p>I have a form which has fields pre-filled with a default value, like this:</p>
<pre><code><input type=text name=first value="First Name" class="unfilled" />
</code></pre>
<p>When the textbox is clicked, the class <code>unfilled</code> is removed from the textbox, and the textbox is made blank so the user can type in his/her own info.</p>
<p>The problem is that when the form is submitted, its getting submitted with these default values, which is messing up the server side validation. How can I do it so that when the form is submitted, all the fields which have a default value are made blank, so the server side validation would throw the error: 'Please fill in this field'?</p>
<p>I'm trying the following code which isn't working:</p>
<pre><code>$("#myForm").submit(function()
{
$(".unfilled").val('');
}
);
</code></pre>
<p>This does make the fields blank, but the server still receives them with their previous default values.</p>
| javascript jquery | [3, 5] |
5,222,561 | 5,222,562 | <a> tag problem while generating javascript through java code | <p>How should I write a statement in Java to produce JavaScript in a page</p>
<pre><code>out.write("document.write('< a href='str'> '+str.slice(beg+1,end)+' </a>');");
</code></pre>
<p>so that it will create statement in JavaScript </p>
<pre><code>document.write("< a href=' "+str+" '> "+str.slice(beg+1,end)+" </a>"); //< a
</code></pre>
<p>and the link will go to page whose address is stored in str </p>
<p>curently it is taking href value as str and not the value stored in str i.e. it is searching for page str</p>
| java javascript | [1, 3] |
2,763,860 | 2,763,861 | Building a grid defining specific columns and rows from a stored procedure | <p>I have a stored procedure that returns a few columns, I am only interested in building a gridview with the <code>ProjectID</code> values that are null. My code below returns all the rows of all the columns, it is just supposed to return where column = projectID. Can someone take a look at it. Thanks</p>
<pre><code>DataRowCollection rowCollection = spDataTable.Rows;
DataTable dt = new DataTable();
foreach (DataColumn col in spDataTable.Columns)
{
if (col.ColumnName == "ProjectID")
{
dt.Columns.Add(col.ColumnName);
lb_Test.Items.Add(col.ColumnName);
foreach(DataRow ros in col.Table.Rows)
{
foreach (object oObj in ros.ItemArray)
{
if (oObj != null)
{
if (col.ColumnName == "ProjectID")
{
lb_Test.Items.Add(oObj.ToString());
dt.Rows.Add(oObj);
}
}
else
{
lb_Test.Items.Add("Null");
}
}
}
grd_test.DataSource = dt;
grd_test.DataBind();
}
else
{
lb_Test.Items.Add("Not valid Name");
}
}
</code></pre>
| c# asp.net | [0, 9] |
1,465,938 | 1,465,939 | How do I avoid .Parent.Parent.Parent. etc. when referencing control hierarchies? | <p>I'm trying to fix this ugly code.</p>
<pre><code>RadGrid gv = (RadGrid) (((Control) e.CommandSource).Parent.Parent.Parent.Parent.Parent);
</code></pre>
<p>I often need to find the first grid that is the parent of the parent of... etc of a object that just raised an event.</p>
<p>The above tends to break when the layout changes and the number of .Parents increase or decreases.</p>
<p>I don't necessarily have a control Id, so I can't use FindControl().</p>
<p>Is there a better way to find the 1st parent grid?</p>
| c# asp.net | [0, 9] |
2,077,959 | 2,077,960 | Inserting "null" when no RadioButtons are selected | <p>I have CheckBoxes on my website which, when checked, are being stored into the database in the following way:</p>
<pre><code>Cust.IsCust = Convert.ToInt16(cb_IsCust.Checked ? 0 : 1);
</code></pre>
<p>Now instead of checkbox I am changing it to radiobuttons with "yes/no" option. How can I insert these options in the database with 1 for yes and 0 for no. If there is nothing checked I need to insert null (management requirement).</p>
<p>Thank you in advance.</p>
| c# asp.net | [0, 9] |
5,048,602 | 5,048,603 | HTTPUrlConnection not working in windows machine and working in mac | <p>I have the following code to call the foursquare API:</p>
<pre><code>String ll = String.valueOf(latitude) + "," + String.valueOf(longitude);
URL url = new URL(API_URL + "/venues/search?ll=" + ll + "&categoryId=4bf58dd8d48988d1c4941735&v=20111111&client_id="+CLIENT_ID+"&client_secret="+CLIENT_SECRET);
Log.d(TAG, "Opening URL " + url.toString());
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection.setDoInput(true);
urlConnection.setDoOutput(true);
urlConnection.connect();
String response = streamToString(urlConnection.getInputStream());
JSONObject jsonObj = (JSONObject) new JSONTokener(response).nextValue();
</code></pre>
<p>the very same code, no different. I port the entire project into my friends windows machine and when it calls this function it causes a <code>FileNotFoundException</code>, I assume that it is because on the <code>getInputStream()</code>, but I am not really sure why. Any idea? What is wrong on my code above?</p>
| java android | [1, 4] |
1,340,842 | 1,340,843 | Fetching a segment of the URL in the address bar | <p>This is what I tried:</p>
<pre><code>string myURL= "http://mysite.com/articles/healthrelated";
String idStr = myURL.Substring(myURL.LastIndexOf('/') + 1);
</code></pre>
<p>I need to fetch "healthrelated" ie the text after the last slash in the URL. Now the problem is that my URL can also be like :</p>
<pre><code>"http://mysite.com/articles/healthrelated/"
</code></pre>
<p>ie "a Slash" at the end of that text too. Now the last slash becomes the one AFTER "healthrelated" and so the result I get using </p>
<pre><code>String idStr = myURL.Substring(myURL.LastIndexOf('/') + 1);
</code></pre>
<p>is empty string..</p>
<p>what should my code be like so I always get that text "healthrelated" no matter if there's a slash in the end or not. I just need to fetch that text somehow.</p>
| c# asp.net | [0, 9] |
886,328 | 886,329 | jQueryJavaScript error - missing ; before statement | <p>I was using this statement in my code to cache the jquery selector and this was causing an error in the console. The error was <code>"Missing ; before statement"</code></p>
<pre><code>var $medium-image-holder = $('#image_'+itemID_value);
</code></pre>
<p>where <code>itemID_value</code> is a numeric value. This statement is inside a for loop</p>
<p>Out of curiosity and after trying various tricks to overcome this thing, I replaced the hyphen with underscore in the variable name.</p>
<pre><code>var $medium_image_holder = $('#image_'+itemID_value);
</code></pre>
<p>Surprisingly this worked.</p>
<p>I want to know whether using hyphens in JavaScript variable names is not permitted. At least, I didn't know about this. Would be very helpful if someone clarifies.</p>
| javascript jquery | [3, 5] |
1,146,287 | 1,146,288 | JQuery function from within PHP While Loop | <p>I have a PHP WHILE loop I'm using to send a batch of emails. </p>
<p>What I'd like to do is have a DIV show my user the current count of emails going out via jQuery.</p>
<p>So, as each pass is made in the loop, it would update a single div with the new count. I'm trying to avoid having a simple <code>echo $count;</code> in my code so it doesn't just scroll down the page. My count is going to be approx 3000.</p>
<p>Thanks!
Rick</p>
| php jquery | [2, 5] |
5,883,919 | 5,883,920 | jQuery ordered actions | <p>Does anybody know how to make a jQery function that has more than one action and every action will be fired only after its precedent is complete like:</p>
<pre><code>$('#myelement').addClass('loading').load(loadUrl).removeClass('loading');
</code></pre>
<p>here the first action which is adding the class name is ok, the second is also ok, but the problem comes with the last action which is supposed to remove the class after the load is finished, but here it will be fired even before the loading is finished and will cancel the first action so that it will look like none of the first nor the third action are present.</p>
<p>Thanks.</p>
| javascript jquery | [3, 5] |
3,007,702 | 3,007,703 | Is there a way using Jquery to detect the back button being pressed cross browsers | <p>I have a website that is on a slide show and when the user presses the back button I would like it to go back to the album view not the prior and prevent page. Is there a way of doing this? thanks for any help or advice.</p>
| javascript jquery | [3, 5] |
2,210,690 | 2,210,691 | How to capture plain text site into a variable using JavaScript or jQuery? | <p>I need to save all the content of a website inside a variable in order to search for a specific string.</p>
<p>Here is an example of how the content looks like, it's literally a plain text log.</p>
<pre><code>======================================================================
BEGIN_TEXT
APPLEYARD IAN 23761347 BA 2 Airport Data:
Code = JFK
Name = JFK/John F Kennedy International
City = New York
State = NY
Airport Data:
Code = LCY
Name = Lcy/London City Airport '
City = London
State = England
sysTime:XXXXXXXXX0000 year:2012 month:7 day:16 hour:7 min:10 pm,END_TEXT
======================================================================
----(1341920977.93286)
2012/07/10 12:03:22.582
MAP UNAVAIL-AIRPORT CHECK IN ONLY *
>
======================================================================
----(1341920977.93286)
2012/07/10 12:03:23.202
I
======================================================================
----(1341920977.93286)
2012/07/10 12:03:23.337
IGND
>
======================================================================
----(1341920977.93286)
2012/07/10 12:03:23.337
9V/BA2R16AUGJFKLCY
======================================================================
</code></pre>
<p>This was my original idea:</p>
<pre><code>var content = document.body.textContent; //But there is no body!
var pos = content.search("UNAVAIL-AIRPORT"); // Just an example to search for
</code></pre>
<p>So my questions are:</p>
<ol>
<li>How do I capture that content?</li>
<li>Once I get the position of the string, how can I scroll there and highlight the match?
I basically want to recreate the CTRL + F function.</li>
</ol>
<p>Thanks in advance!</p>
| javascript jquery | [3, 5] |
5,866,337 | 5,866,338 | Binding data in dropdown list | <p>I am making an application in asp.net using C# which contains drop down list controls displaying the same data on different web pages.Now I don't want to write same code for fetching same data from database multiple times. Instead of that I had made a separate class which contains the code for fetching data.</p>
<p>The problem is that I am not able to fill data in drop down list by taking reference of the objects of that class.
I am trying to use ref function. Am I doing something wrong????</p>
<p>Please suggest....I m in trouble.</p>
| c# asp.net | [0, 9] |
3,655,232 | 3,655,233 | Hide all the id in JavaScript | <p>I need to hide all the tags which has the ID 'media'</p>
<p>E.g.:</p>
<pre><code>`<div id='media'>contents</div>`
`<div id='media'>content</div>`
</code></pre>
<p>How to do this using JavaScript?</p>
| javascript jquery | [3, 5] |
3,965,025 | 3,965,026 | Better way to pass variable from child to parent function javascript | <p>For example</p>
<pre><code>function getResult(field) {
$.ajaxSetup ({cache: false, async: false});
$.get("api.php?field="+field, function(i) {
result = i;
});
return result;
};
</code></pre>
<p>The problem with this is that result becomes global. If I do <code>var result = i;</code> then the parent function (getResult) cannot see the variable <code>result</code>.</p>
<p>Is there a clever way to do this?</p>
<p>The code that I have posted works correctly. I have set my AJAX calls to be done synchronously.</p>
| javascript jquery | [3, 5] |
1,471,856 | 1,471,857 | Progress bar in web application using C# and asp.net | <p>I need to have 2 progress bars in my application:</p>
<ol>
<li><a href="http://developers.sun.com/docs/web-app-guidelines/uispec4_0/15-progress.html#15.3" rel="nofollow">Circular graphical progress bar</a> (<em>busy indicator)</em>
<ul>
<li>as shown in the link <strong>[15.1.3]</strong> when the page does a postback and </li>
</ul></li>
<li>A <a href="http://developers.sun.com/docs/web-app-guidelines/uispec4_0/15-progress.html#15.3" rel="nofollow">determinate progress bar</a>
<ul>
<li>as shown in the link <strong>[15.1.1]</strong> with showing a percentage when I update or load data into the grid which I use in my application.</li>
</ul></li>
</ol>
<p>Can anyone help me with code snippets and how I can proceed with my .aspx and .aspx.cs files in order to obtain these progress bars for my application?</p>
| c# asp.net | [0, 9] |
3,488,747 | 3,488,748 | asp post back issue and html controls | <p>My html.</p>
<pre><code><input id="rdb1" type="radio" name="rdbData" checked="checked" />
<input id="rdb2" type="radio" name="rdbData" />
<asp:Button ID="btnTest" runat="server" Text="Test" OnClick="btnTest_Click" />
</code></pre>
<p>Button is only <code>asp:button</code> but <code>radio buttons</code> are not.First time when page is load rdb1 is selected.But when i click the button <code>btnTest</code> with check <code>rdb2</code>, page is refreshed and select 1st redio button.To prevent this i try <code>jquery</code> like this.
Inside <code>Document.ready</code>:<br></p>
<pre><code>var btnTest = "<%=btnTest.ClientID %>";
$('#' + btnTest).bind("click", function() {
if ($('#rdb1').attr("checked")) {
$('#rdb2').attr("checked", false);
$('#rdb1').attr("checked", true);
}
else {
$('#rdb1').attr("checked", false);
$('#rdb2').attr("checked", true);
}
});
</code></pre>
<p>But its not work.How can we handle this type of situation.Where i am getting wrong.Any idea or any alternative.Thanks.</p>
| c# jquery asp.net | [0, 5, 9] |
5,329,051 | 5,329,052 | How to check the file creation date basing on the URL? | <p>I have an URL to a XML file, is there any posibility to get its creation date ?</p>
| c# java php | [0, 1, 2] |
281,447 | 281,448 | Syntax to refer an enum member in a generic class | <p>For the following generic class.</p>
<pre><code>class Message<T>
{
public enum TYPE { Heart, Spade };
}
</code></pre>
<p>In Java, to refer to enum, I can simply</p>
<pre><code>// Works in Java
Message.TYPE type = Message.TYPE.Heart;
</code></pre>
<p>But how about in C#? In C#, I need to provide a <strong>dummy</strong> type</p>
<pre><code>Message<double>.TYPE type = Message<double>.TYPE.Heart;
</code></pre>
<p>Is there any way I can avoid the <code>dummy</code> type?</p>
| c# java | [0, 1] |
4,652,571 | 4,652,572 | Sorting an object list | <p>I am keeping a list of objects in a <code>List()</code>. I want to sort this list by a property of the object.</p>
<p>For example, say the object is a Messsage and message has: content, date, header, ...</p>
<p>I want to sort the list by the message's date. </p>
<p>Is there any <code>List</code> method or any other method that makes this sort easy?</p>
<p>Thanks.</p>
| c# asp.net | [0, 9] |
4,086,520 | 4,086,521 | Collect prices from page using JavaScript | <p>I'm developing a bookmarklet now and faced this task: I need to collect all prices from any page.</p>
<p>The problem is that the price may be in multiple formats ($19.00, 15.45$, etc), not counting different currencies and html markup. The good news is that I'm using jquery.</p>
<p>If anybody has an idea how it can be accomplish, please share :)</p>
<p>Thanks in advance!</p>
| javascript jquery | [3, 5] |
4,910,664 | 4,910,665 | Javascript Remove Form Data | <p>I have a form that I want to only submit post data for value which have changed. </p>
<p>So the way I have been doing this is like this:</p>
<pre><code>function submit_form(){
var hd = [];
// hd is a big array that is defined here
// hd ['some id_number'] = 'some value'
// main function
for (var id_number in hd ){
var x=document.getElementById(id_number).selectedIndex;
var y=document.getElementById(id_number).options;
selector_text = y[x].text;
if (hd[id_number] == selector_text){
$(id_number).remove();
}
}
document.forms["my_form"].submit()
}
</code></pre>
<p>So the goal is that if the selector equals what is in the array, then don't POST the data.</p>
<p>To do this I have been doing the remove function. Everything up to the remove function works as expected. However when I look at the post data I still get the selected value for the id_numbers that mach the value in hd.</p>
<p>Is there a better way to remove to prevent it from going to the POST data? The id.parent.removeChild(id) method didn't work either.</p>
| javascript jquery | [3, 5] |
5,404,822 | 5,404,823 | Javascript popup and close | <p>HTML</p>
<pre><code><ul>
<li class="first"><a href="#">Intro</a></li>
<li><a href="#">Crew</a></li>
</ul>
</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] |
3,982,141 | 3,982,142 | Delete specific class in page (jQuery) | <p>How can i delete all classes "green" in the page using jQuery? I don't know what selector it has. <code>find('.green').removeClass('green')</code> does not work.</p>
| javascript jquery | [3, 5] |
3,106,445 | 3,106,446 | I have orders.something.com and hr.something.com. How can I login into both systems? | <p>I have a site orders.something.com and other site hr.something.com. My 1st question should I create different applications for these in VS 2010 or I can run it inside single application too? Secondly, if I create 2 applications how can I establish login into both system? So for example if he is logged into something.com, he is authenticated into orders.something.com as well as hr.something.com?</p>
<p>Thanks in advance :)</p>
| c# asp.net | [0, 9] |
345,909 | 345,910 | Closing popup if user doesn't provide any response | <p>I have a session time out functionality implemented, in which user is presented with pop-up window (that your session is about to expire) in case no activity is done for 30-mins.</p>
<p>Need help on:</p>
<p>When this pop up opens up and let say user has locked his desktop and doesn't provide input. Then what I want is that - if user doesn't provide any input in 1 min then this pop-up will close and new popup will display that "Session is exprired"</p>
<p>Can anyone please help.</p>
| javascript asp.net | [3, 9] |
710,357 | 710,358 | Logging into a website from android | <p>Basically I have a form in my android app that lets the user enter his/her username and password and then this is POSTED to a very simple login page made in PHP online. I then need to access a second pae which pulls down data from an xml file - in order to access this page the user must be logged in. The xml page that the user sees is dependent of their username.</p>
<p>On my login page I have </p>
<pre><code>session_start();
session_register("username");
</code></pre>
<p>At the beginning of each page that checks login I have</p>
<pre><code><?php
session_start();
?>
</code></pre>
<p>and to check if the user is logged in I use a simple if statement</p>
<pre><code>if(!session_is_registered("username")){?>
display whatever
else bla
</code></pre>
<p>How can I make this work in my android application? I am unable to go to the xml page after I have logged in because it does not recognise me as being logged in.</p>
| php android | [2, 4] |
825,951 | 825,952 | How to change text mode to password mode after entering in textbox in asp.net | <p>I have a form in ASP.NET as below :-</p>
<pre><code>Number(textbox)
Name(textbox)
Age(textbox)
sex(textbox)
Marks(textbox)
Class(textbox)
Re enter number(textbox)
Save(button)
</code></pre>
<p>In this fields after entering number, when I go for next field number filed of textbox data of text mode should convert to password mode. after entering "re enter number" it should check for matching both "number" and "re enter number" and should display message like number is matched or not matched and then save data.</p>
<p>Please it is urgent.</p>
<p>Thanks</p>
| c# asp.net | [0, 9] |
419,688 | 419,689 | Convert large hexadecimal string to octal string | <p>How do i convert a value given as a hexadecimal string to an Octal format, when the number is too large to fit in a 64 bits number?</p>
<p>I currently convert a byte array to hex like this</p>
<pre><code>Byte[] data = { 116, 4, 228, 18, 189, 145, 31, 7, 123, 74, 174, 151, 54, 144, 224, 49, 210, 169, 43, 213 };
hex = BitConverter.ToString(data).Replace("-", string.Empty);
</code></pre>
<p>Output in Hex:</p>
<pre><code>7404E412BD911F077B4AAE973690E031D2A92BD5
</code></pre>
<p>How do I get the Octal representation?</p>
<p>So i tried this earlier, but it doesn't work.</p>
<pre><code>string binaryval = "";
binaryval = Convert.ToString(Convert.ToInt32(hexValue,16), 8);
foreach (char ch in hexValue)
{
binaryval += Convert.ToString(Convert.ToInt32(ch.ToString(), 16), 8);
}
</code></pre>
| c# asp.net | [0, 9] |
2,090,768 | 2,090,769 | jquery - javascript - project for fine art school | <p>I am a (french) student in a fine art school, and I make a project about memory in this project, the computer needs to forget the text that you write...</p>
<p>I know html and css but I just began javascript...</p>
<p>I need to change or to erase randomly some letters (or some words) in a text area; like you write your text normally, and when you have written 5 lines of text, the first line begins to change: some letters change (A became F or M) or some are erased...and the text means nothing. But the writers musn't see the change, it has to be very discreet (with a slow change of opacity or something like that.)</p>
<p>Thank you for your help!</p>
| javascript jquery | [3, 5] |
3,871,804 | 3,871,805 | Box style search form with step by step narrow | <p>Anyone could help me to find a tutorial or a free script which work something like this:</p>
<p><a href="http://www.unixauto.hu/Unix_TipusVal_Form.aspx" rel="nofollow">http://www.unixauto.hu/Unix_TipusVal_Form.aspx</a></p>
<p>The visitor pick a main catergory, than a sub-category..etc...and get the result what he want.</p>
<p>This type of search have any name?</p>
<p>Thank you very much.</p>
| php javascript asp.net | [2, 3, 9] |
4,431,984 | 4,431,985 | how to send javascript dynamic data to php variable without ajax | <p>I have a form, with the 3 input type text.</p>
<pre><code><input type="text" id="one" onkeyup="multiply()" name="one">
<input type="text" id="two" name="two">
<input type="text" id="three" name="three">
<script>
function multiply(){
one = document.getElementById('one').value;
two = document.getElementById('two').value;
document.getElementById('three').value = one * two
}
</script>
</code></pre>
<p>now i don't have value in three, but it is a dynamic one, when i submit forum to (forumSubmit.php)then i get error of </p>
<pre><code>undefiend index three
</code></pre>
<p>I searched & found this can be done with ajax, but i don't want to use ajax, i want to make a page refresh</p>
| php javascript | [2, 3] |
177,240 | 177,241 | display photo or video from a link | <p>is there some kind of a plugin to display a photo or video from a website link like if you post a link on Facebook it loads a miniature picture of the link? </p>
| javascript jquery | [3, 5] |
3,411,677 | 3,411,678 | external javascript file from asp.net C# page | <p>i have some javascript functions written in an external javascript file.
and i have included the file in my asp.net page head section.
however i m not able to understand how do i call the functions from the code behind file.
e.g, i want to call a certain function 'tacount' on onkeypress event of a textbox. how can i possible do that?</p>
| c# javascript asp.net | [0, 3, 9] |
2,956,585 | 2,956,586 | Android Activity or Service for mathematical calculations? | <p>I'm creating a simple tip calculator to get into Android programming. I have created the main activity but I have a question. Should I do the actual calculations in the Activity, or should I have another service class that I bind the activity to that does the calculations for total and splitting and sub total, etc? Is there an advantage to doing the calculations in the service and passing the results back to the activity? Is that how it should be done?</p>
<p>I'm used to the whole MVC setup it seems with Android the Activity is the view and controller</p>
| java android | [1, 4] |
5,977,168 | 5,977,169 | Selecting divs from jquery array values | <p>i have a easy problem, i need do a action .click() if is clicked on a div in my array...</p>
<pre><code>if($('#container_1').click(function(){
$('div#image').fadeOut('fast', function(){
$('div#cat_1').css('background-color', '#F30');
$('#new_frame').show('fast').load('history.html');
});
}));
if($('#container_2').click(function(){
$('div#image').fadeOut('fast', function(){
$('div#cat_2').css('background-color', '#F30');
$('#new_frame').show('fast').load('history.html');
});
}));
if($('#container_3').click(function(){
$('div#image').fadeOut('fast', function(){
$('div#cat_3').css('background-color', '#F30');
$('#new_frame').show('fast').load('history.html');
});
}));
if($('#container_4').click(function(){
$('div#image').fadeOut('fast', function(){
$('div#cat_4').css('background-color', '#F30');
$('#new_frame').show('fast').load('history.html');
});
}));
if($('#container_5').click(function(){
$('div#image').fadeOut('fast', function(){
$('div#cat_5').css('background-color', '#F30');
$('#new_frame').show('fast').load('history.html');
});
}));
</code></pre>
<p>Okay that is my code what works...</p>
<p>But i think that i can to do so much shorter... with a code like this::</p>
<pre><code>Contenedores = ['1', '2', '3', '4', '5'];
if($('#container_'+Contenedores).click(function(){
$('div#image').fadeOut('fast', function(){
$('div#cat_'+Contenedores).css('background-color', '#F30');
$('#new_frame').show('fast').load('history.html');
});
}));
</code></pre>
<p>But i don't know how do it right to work...</p>
<p>Thanks, and sorry my poor english.</p>
| javascript jquery | [3, 5] |
266,732 | 266,733 | Initiate POST Request, Perform Action, Then Complete Post request - how? | <p>When a user clicks a submit button I want the form to be submitted. However, just before this happens, I want a window to pop open and for them to fill in some data. Once they do this and they close that child window, I want the POST request to be made.</p>
<p>Is this <strong>possible</strong>, if so <strong>how</strong>? I just need help after the window closes, how can I make that POST request continue?</p>
<p>Thanks all</p>
| php javascript | [2, 3] |
1,964,370 | 1,964,371 | Moving a div into another div | <p>i have 2 main div:</p>
<pre><code> <div id="div1">
<div id="minidiv1">a</div>
<div id="minidiv2">b</div>
</div>
<div id="div2"></div>
</code></pre>
<p>I want move the minidiv1 into the div2 with jquery</p>
<p>how can i do?</p>
| javascript jquery | [3, 5] |
1,572,443 | 1,572,444 | Can I replace .attr("data"... with .data(" ... | <p>I have the following:</p>
<pre><code> if ($(this).attr("data-disabled") === "false") {
var $link = $(this);
$("a.accessLink").each(function () {
$(this).attr("data-disabled", "true");
});
dialog($link);
}
</code></pre>
<p>Am I correct in saying this could be replaced with:</p>
<pre><code> if ($(this).data("disabled") === "false") {
var $link = $(this);
$("a.accessLink").each(function () {
$(this).data("disabled", "true");
});
dialog($link);
}
</code></pre>
<p>Also is there a better way for me to set all the data-disabled attributes of links with the accessLink class to a value of "disabled"?</p>
| javascript jquery | [3, 5] |
1,437,015 | 1,437,016 | get all values of ul into variable | <p>I have <code><ul></code> like this:</p>
<pre><code> <ul class="options" id="selt_count">
<li value="1">One</li>
<li value="2">Two</li>
<li value="5">Five</li>
<li value="12">Other</li>
</ul>
</code></pre>
<p>What I want is to get all values of <code><li></code> into variable in the following format (1,2,5,12) in jquery.</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
5,937,715 | 5,937,716 | jQuery multiple selectors, get which selector triggered event | <p>When handling events with multiple selectors, such as:</p>
<pre><code>$('.item a, .another-item a').click(function(e) {
});
</code></pre>
<p>Is it possible to determine which parent selector triggered the event? Was it <code>.item</code> or <code>.another-item</code> ?</p>
<p>Thank you!</p>
| javascript jquery | [3, 5] |
471,517 | 471,518 | Convert unreadable characters in to Unicode characters | <p>When I call some facebook info from the opengraph I get some names that look like this.</p>
<p><strong>\u0d94\u0db1\u0dca\u0dbd\u0dd2 \u0dc3\u0dd2\u0db1\u0dca\u0d9c\u0dca\u0dbd\u0dd2\u0dc2\u0dca</strong></p>
<p>Is there a way to convert them in to readable unicode characters using PHP or Javascript? <strong>PHP is more preferred.</strong> Thanks</p>
| php javascript | [2, 3] |
121,353 | 121,354 | Data accessing from one class to another class | <p>Is there any way to call one class's ArrayList onto another class? In class A ArrayList is there, I need to use that ArrayList in class B, Class A is having <code>AsyncTask</code> in that I have the Arraylist so I need that in side AsynTask's Arraylist in another class.</p>
<p>In class A:</p>
<pre><code>public Class A{
public class HomeTask extends AsyncTask<Void,Void,Bundle> {
onPreexecute(){}
doInbackground(){}
postexecute(){}
Arraylist joblist(); //------------ My data is here;
}
}
</code></pre>
<p>second class:</p>
<pre><code>Class B
{
// I need to use that arraylist here
}
</code></pre>
| java android | [1, 4] |
5,994,151 | 5,994,152 | How a Dialog window can modify JS in the parent window | <p>I have a site that opens a dialog. In that dialog I want to be able to modify a JS value in the parent window. The sites are at the same domain.</p>
<p>in the parent I can do:</p>
<pre><code>currentUserModel.guest(false)
</code></pre>
<p>In the dialog, how can I do currentUserModel.guest(false)?</p>
<p>Right now if I try I get:</p>
<pre><code>Uncaught ReferenceError: currentUserModel is not defined
</code></pre>
<p>Thanks</p>
| javascript jquery | [3, 5] |
1,959,645 | 1,959,646 | Scrolling div by the #id, what am I doing wrong? | <p>I'm programming a message board for my site. Every message gets an id by auto increment in the database. The messages on the board are under "li id=#" tags where the "li" gets the id from the database. I've tried to create scrolling function via javascript so that down and up arrows would move across whole messages.</p>
<p>This is what I've got so far:</p>
<pre><code>down.node.onclick = function() { // down arrow
var msgs = document.getElementById("kommentit"); // the <ul> element
var a = new Array();
if (msgs.hasChildNodes()) {
var children = msgs.childNodes;
for (var i = 0; i < children.length; i++) {
if (msgs.childNodes[i].tagName == "LI") {
a.push(msgs.childNodes[i].id); // array with the id's
}
}
}
for (var i = 0; i < a.length; i++) { // this is what goes wrong
parent.location.href = '#' + 'a[i + 1]';
}
</code></pre>
<p>So while the array gets the right values the actual function doesn't work. With this code I get .../index.php#[a + 1] as my url when I click.</p>
<p>If I use ''+a[i + 1]+'' the page refreshes through the whole array until it settles with #undefined.</p>
<p>The id's are in format "id-xx" so is that the problem? I tried splitting the id by using msgs.childNodes[i].id.split("id-") but if I do this I get ",xx" as my values in the array.</p>
| php javascript | [2, 3] |
2,850,694 | 2,850,695 | Code to detect current page | <p>Is there a php or javascript code that can detect the current user's page and then add <code><a class="active"></code> to an item in a <code>ul</code> (my menu). I include my menu in my pages with <code>PHP include</code> so making change is easy; I only have to edit it once. But, with that method, I can't individually set each page to have <code>a class="active"</code>. How can I do this?</p>
| php javascript | [2, 3] |
4,493,824 | 4,493,825 | How to get the domain of the current request? | <p>In asp.net, I want to get just the domain information?</p>
<p>i.e localhost or example.com</p>
<p>possible?</p>
<p>can this value ever be null or its 100% gauranteed to return a value?</p>
| c# asp.net | [0, 9] |
1,987,225 | 1,987,226 | How to Set Relative Position for Dialog Box when Page Becomes longer (Scroll bars are activated)? | <p>Have a web app which consists of a form and have it set up to launch a dialog box containing information next to the subject label text field.
Everytime, someone fills out the form and clicks on submit, the form's message body (from the text area of the form) is displayed on top and the
form is displayed underneath it. Before, I had it set up as fixed (x,y) for the dialog box to appear next to the subject label. But, now, when
the page becomes longer, the dialog box doesn't appear next to my subject label text field. It is displayed a lot lower.</p>
<p>Here's the code to find the position:</p>
<pre><code>// Finds the position and adds 40px to the left axis.
function findPosition(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
} while (obj = obj.offsetParent);
curleft += 42;
// alert ('[' + curleft + ', ' + curtop + ']');
return [curleft,curtop];
}
}
</code></pre>
<p>Here's the code that calls this function to display a dialog box at a specific place:</p>
<pre><code>function displayDialog() {
var subjectLabel = document.getElementById("myform.subjectLabel");
$("#myDialog").dialog({
open: function(event, ui) {
jQuery('.ui-dialog-titlebar-close')
.removeClass("ui-dialog-titlebar-close")
.html('<span padding-right = "16px;">Close</span>');
},
hide: true,
draggable: false,
position: findPosition(subjectLabel),
closeOnEscape: false
});
}
</code></pre>
<p>How can I set it so my findPosition() calculation doesn't miscalculate when the page is too long (when scroll bars are needed)?</p>
<p>Is there a way to set the relative positioning to always have the dialog appear 40px right of the subject label?</p>
<p>Thank you for taking the time to read this.</p>
| javascript jquery | [3, 5] |
3,446,645 | 3,446,646 | Can I change the URL string in the address bar using javascript | <p>I've a link on my webpage, say 'about'. Clicking on it loads a particular div without refreshing the whole page using jquery <code>.load()</code>. This does not change the URL string in the browser address bar.</p>
<p>The same page can be accessed by going to <code>www.mydomain.com/?page=about</code>.</p>
<p>So what I want to do is, when the user clicks on the 'about' link, the pages will be loaded as it is (using jquery), but I want to change the URL string in the browser address bar also so that someone can actually copy or bookmark the exact page.</p>
<p>Is it possible to do so??</p>
| javascript jquery | [3, 5] |
4,909,265 | 4,909,266 | Is it possible to call a Javascript function (that's private) inside the object A from an object that inherits from A? | <p>I want to be able to test some inner functions that I have without putting the Javascript test code in the same file. I've been trying to inherit the class that has the inner functions, and then adding wrapper functions to make them public, like this:</p>
<pre><code>copyPrototype(TrafficChartCanvas_test, TrafficChartCanvas);
function TrafficChartCanvas_test() {
TrafficChartCanvas_test.prototype.test_getYScale = function(reach) {
return getYScale(reach);
}
}
</code></pre>
<p>Assume copyPrototype successfully assigns the prototype of TrafficChartCanvas to that of TrafficChartCanvas_test. Here's part of the file I'm attempting to test:</p>
<pre><code>function TrafficChartCanvas(...) {
// some other stuff here... public functions, etc.
function getYScale(reach) {
...
}
}
</code></pre>
<p>However, this doesn't work for me. Is there any other way I can do this?</p>
| javascript jquery | [3, 5] |
3,987,025 | 3,987,026 | ASP.NET Generate a table from list with dynamic number of rows and columns | <p>I have a list of items which I want the user to be able to tick which are appropriate to them.</p>
<p>Currently I have a <code><ul></code> generated by a <code>Repeater</code> with checkbox and label controls placed in side, all working fine.</p>
<p>However, the <code><ul></code> is taking up too much space on the screen and I need to condense it. I think the best approach would be a table that expands based on the number of items, 9 resultining a 3x3 grid, 12 a 3x4 grid, 16 a 4x4 grid etc up to a maximum width of 6 rows.</p>
<p>Any suggestions for where to start?</p>
| c# asp.net | [0, 9] |
5,454,873 | 5,454,874 | jquery remove of prepended element not working | <p>Basically, I want to have two functions. The first prepends an element <code>div</code> which contains some ajax data and a button which can fire the close function. The first function does everything I want it to, except I'm having trouble applyin the <code>onclick</code> attribute on the which will fire the remove function when clicked.</p>
<p>But independent of this, I haven't been able to get the <code>remove function</code> to work. </p>
<p>If you can help me do this better I would be grateful.</p>
<pre><code>function displayCrRef(refPid, refFs, pidOfReferringP) {
$.get("crRefParaExtract.php", {
pid: refPid,
fs: refFs
}, function(data) {
$("#pwrap_" + pidOfReferringP).prepend("<div id='#crRef_" + refPid + "' style='float: left; width: 350px; margin-right: 60px; padding: 10px; background-color: #E6EDE8'>" + "<a id='crossRefRemoveButton'>Return to normal text</a>" + data + "</div>");
});
var rmFxnParam = "'" + refPid + "'";
$("#crossRefRemoveButton").attr("onclick", "removeCrossRef(" + rmFxnParam + ")");
$("#" + pidOfReferringP).css({
float: 'left',
width: '425px'
});
$("#menu_" + pidOfReferringP).css({
float: 'none',
clear: 'both'
});
}
function removeCrossRef(refPid) {
$("#crRef_" + refPid).remove();
}
</code></pre>
| javascript jquery | [3, 5] |
2,581,518 | 2,581,519 | How to effectively use jQuery 1.8 - examples? | <p>We are using jQuery on our websites - but I dont think we are effectively using it with a lot of duplicated code, etc. Im looking for examples of websites that do it right or documentation/books to explain to right way or a better way?</p>
| javascript jquery | [3, 5] |
760,977 | 760,978 | How I can forefully fire the rowcommand event when grid data is changing on every postback? | <p>My requirement is to refresh the data on every postback but if I do so my rowcommand event doesnot get fired on link button click in gridview? How I can achieve it?</p>
<p>I am changing the row order using jquery and saving the new order in hidden variable. on page postback I get the new order from hidden variable and rebinds the grid with new order.</p>
<p>I need to rebind the grid with new order everytime page postback. postback occurs when I click on edit/delete linkbuttons in grid but the rowcommand event doest not get fired.</p>
<pre><code> protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
string order = hdnOrder.Value.ToString();
if (order != string.Empty)
{
ReOrder();
}
}
}
protected void ReOrder()
{
DataTable dt = new DataTable();
if (ViewState["data"] != null)
{
dt = (DataTable) ViewState["data"];
string[] order = hdnOrder.Value.Split(',');
for (int i = 0; i < order.Length; i++)
{
DataRow[] keyRows;
keyRows = dt.Select("ID='" + order[i] + "'");
if (keyRows.Length > 0)
{
int index = dt.Rows.IndexOf(keyRows[0]);
dt.Rows[index].SetField("Precedence", i + 1);
}
}
DataView dv = dt.DefaultView;
dv.Sort = "Precedence ASC";
ViewState["data"] = dv.ToTable();
grd.DataSource = ViewState["data"];
grd.DataBind();
hdnOrder.Value = string.Empty;
}
}
</code></pre>
| jquery asp.net | [5, 9] |
5,796,283 | 5,796,284 | Aspect ratio is off when scaling down and drawing a bitmap | <p>The image I am using is from a 4x6. So the aspect ratio should be about .66. When I calculate the aspect ration in my code , I get around .66. However, the height of the displayed image looks squashed. The image only looks right if I set the aspect ratio manually to around .85. </p>
<p>Since setting the aspect ratio manually is not perfect, how can I get the can I keep the height of my image from appearing to be squashed.</p>
<pre><code>public class SpotGameActivity extends Activity {
private Bitmap mBitmap;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.dpi2b);
setContentView(new BitMapView(this, mBitmap));
}
class BitMapView extends View {
Bitmap mBitmap = null;
public BitMapView(Context context, Bitmap bm) {
super(context);
mBitmap = bm;
}
@Override
protected void onDraw(Canvas canvas) {
// called when view is drawn
Paint paint = new Paint();
paint.setFilterBitmap(true);
// The image will be scaled so it will fill the width, and the
// height will preserve the image’s aspect ration
float aspectRatio = ((float) mBitmap.getWidth()) / mBitmap.getHeight();
Rect dest = new Rect(0, 0, this.getWidth(),(int) (this.getHeight() * aspectRatio));
String AR = Double.toString(aspectRatio);
//Rect dest = new Rect(0, 0, getWidth(), getHeight());
canvas.drawBitmap(mBitmap, null, dest, paint);
Toast.makeText(SpotGameActivity.this, AR, Toast.LENGTH_SHORT).show();
}
}
</code></pre>
<p>}</p>
| java android | [1, 4] |
4,750,593 | 4,750,594 | Changing columns in display based on variable | <p>I currently have a table with a repeater that is being filled with data</p>
<pre><code><table width="100%" >
<tr>
<td class="add_border_bold" nowrap>Title</a></td>
<td class="add_border_bold" nowrap>User</td>
</tr>
<asp:Repeater id="program_list" OnItemDataBound="Repeater1_ItemDataBound" runat="server">
<ItemTemplate>
<tr>
<td class="add_border">
<a href="page.aspx?id=<%# Eval("id") %>"><%# Eval("short_title") %></a>&nbsp;
</td>
<td class="add_border">
<%# Eval("userid") %>&nbsp;
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</code></pre>
<p>I'm currently converting this from coldfusion. In the previous application, I had multiple table layouts for displaying different kinds of information, for example, phone number instead of userid. (although, working with a lot more columns, I shortened it for posting). In coldfusion I would just wrap each table in a <code><cfif></code> tag controlled by a variable that said which view to use. I am unaware how to get multiple data displays into a single page controlled by a variable, like I was before. Mostly because, it appears that most of my logic is done in the code behind files, so I don't understand how to get those changes across in the .aspx, or how to manipulate them from the code behind file. </p>
<p>Thanks in advance.</p>
| c# asp.net | [0, 9] |
421,146 | 421,147 | Appending to <td> instead of below <tr>. What's wrong? | <p>In this jsFiddle</p>
<p><a href="http://jsfiddle.net/littlesandra88/tZqYX/" rel="nofollow">http://jsfiddle.net/littlesandra88/tZqYX/</a></p>
<p>would I like that a new <code><tr></code> is inserted below the one where "Details" is clicked.</p>
<p>I do</p>
<pre><code>$('.row').append("<tr><td>It worked</td></tr>");
</code></pre>
<p>but this results in</p>
<pre><code><tr class="row">
<td class="edit-column"><a href="javascript:addRemove('7249');">Details</a> <input value="Save" type="submit"></td>
<tr><td>It worked</td></tr></tr>
</code></pre>
<p>where I was hoping for</p>
<pre><code><tr class="row">
<td class="edit-column"><a href="javascript:addRemove('7249');">Details</a> <input value="Save" type="submit"></td>
</tr>
<tr><td>It worked</td></tr>
</code></pre>
<p>Any idea how to fix this?</p>
| javascript jquery | [3, 5] |
1,031,646 | 1,031,647 | What is the difference between....? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1626010/what-is-the-difference-between-container1-and-container2-fin">What is the difference between $(“<em>”, $(“#container1”)) and $(“#container2”).find(“</em>”)?</a> </p>
</blockquote>
<p>What is the difference between </p>
<p><code>jQuery('.classname', this.frame)</code> and <code>this.frame.find('.classname')</code> ?</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
5,219,278 | 5,219,279 | Worrying about concurrency issues - should I only allow 1 user at the time? | <p>I’m working on an administration tool for a project that does a small amount of reading and writing to different files and some database queries and updates. Now I believe it’s improbable that we would ever have an issue with this since we’re not that many people using this project. But if I can, I want to minimize or eliminate the risk of it ever happening while not disturbing the normal users. I'm using Windows Authentication and Roles. </p>
<p>One of my ideas is to create a lock and only allowing 1 user to administer at the time. By using the Session.SessionID and saving it in the Application state as an exclusive lock. E g if a user would want to administer he would first go to a landingpage and there where would be this check (oh, this isn't atomic I take it?):</p>
<pre><code>if (Application["lockedBy"] == null)
{
Application["lockedBy"] = Session.SessionID;
Application["lockedName"] = User.Identity.Name;
Response.Redirect("Admin.aspx");
}
</code></pre>
<p>And the admin page there would be a button to release the lock and redirect to another page. Or if the user forgets using the Session_End() in the global.asax file and having an autorefresh. But how would this stop someone from pressing the browsers backbutton and bypassing this?</p>
<p>Or should I try to make sure the configuration files haven’t been changed before writing to them? But how would I save the state for this page. Should I like save the files modification time in Session state and if they diff just abort the save action? </p>
<p>So the question is: how should I protect my application from concurrency issues while not disturbing the normal users?</p>
| c# asp.net | [0, 9] |
5,395,520 | 5,395,521 | jQuery General Question (cycle plugin) | <p>Currently this does work except slide.src is undefined because by default slide.src is looking for an image src tag first, but the image src tag is now inside the div properties.</p>
<p>So how can i change the javascript + slide.src + to be(or get) the image inside the div properties.</p>
<p>View</p>
<pre><code><div id="properties">
<?php foreach($search_results->result() as $row) :?>
<div id="<?=$row->mls_listing_id?>"><br>
Listing ID : <?=$row->mls_listing_id?><br>
State: <?=$row->sale_price?><br>
State: <?=$row->mls_state_code?><br>
MLS Office: <?=$row->mls_office_name?><br>
Office Number: <?=$row->mls_office_phone?><br>
Photo: **<img src="<?=$row->photo_url?>" width="175" height="137" /**><br>
</div><!--END specific id div -->
<?php endforeach; ?>
</div><!--End Properties DIV -->
</code></pre>
<p>javascript</p>
<pre><code>$('#properties')
.before('<ul id="propnav">')
.cycle({
fx: 'scrollHorz',
next:'#next',
prev:'#prev',
pager: '#propnav',
delay: -1000 ,
// callback fn that creates a thumbnail to use as pager anchor
pagerAnchorBuilder: function(idx, slide) {
return '<li><a href="#">**<img src="' + slide.src + '"** width="50" height="50" /></a></li>';
}
});
</code></pre>
| javascript jquery | [3, 5] |
665,168 | 665,169 | Could this string splitter be refactored or improved? | <p>The following code snippet does the following:</p>
<p>Given a string like: <code>"key1=value1;key2=value2;key3=value3"</code>, it will perform a lookup for key1 and set the value to value1 using jQuery: </p>
<pre><code>$("#key1").val("value1");
</code></pre>
<p>My goal was to not assume the string is in the right format, so it might not have a <code>;</code>, or it might not have a <code>=</code>. So the code should guard itself from crashing.</p>
<p>How could this be improved using the correct javascript style/idioms:</p>
<pre><code>var myString = "key1=value1&key2=value2;key3=value3";
var kvp = myString.split(";");
if (kvp && kvp.length) {
for (var x = 0; x < kvp.length; x++) {
var parts = kvp[x];
if (parts && parts.length && parts.indexOf("=") >= 0) {
var kv = parts.split("=");
$("#" + kv[0]).val(kv[1]);
}
}
}
</code></pre>
| javascript jquery | [3, 5] |
5,166,878 | 5,166,879 | Why does jquery need _$ in case of overwrite? | <pre><code>var
// Will speed up references to window, and allows munging its name.
window = this,
// Will speed up references to undefined, and allows munging its name.
undefined,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
jQuery = window.jQuery = window.$ = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context );
};
</code></pre>
<p>Why does jQuery need "_$ = window.$" or "_jQuery = window.jQuery"? It doesn't make sense to me, but without this two lines, the framework doesn't work.</p>
<p>Thanks for any help..</p>
| javascript jquery | [3, 5] |
4,371,101 | 4,371,102 | Flip image in jQuery | <p>I have a collection of small images (bellow “Some examples” in the left column ) I would like to flip one at the time.
I imagine that they flip and a new image is shown (like flipping a card).</p>
<p>Is there a jQuery plug in for this, or can I do it with ordinary jQuery?</p>
<p><a href="http://www.dvdboxswap.com" rel="nofollow">Link to site</a></p>
<p>//Johan</p>
| asp.net jquery | [9, 5] |
4,345,386 | 4,345,387 | New file created path | <p>I was referring to this <a href="http://developer.android.com/guide/topics/data/data-storage.html#filesInternal" rel="nofollow">http://developer.android.com/guide/topics/data/data-storage.html#filesInternal</a> for write file in internal memory. Where do I check the file? For an example the guide code:</p>
<pre><code>String FILENAME = "hello_file";
String string = "hello world!";
FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.close();
</code></pre>
<p>Where do I go and check the file hello_file, since the guide didn't give the path?</p>
| java android | [1, 4] |
4,448,744 | 4,448,745 | Can I know if my page is going to have a scroll bar before it renders. PHP Javascript | <p>I have a <code>header.php</code> which has my <code><a name='#top' /></code></p>
<p>and I have a <code>footer.php</code> which I want to do something like</p>
<pre><code>if ($_SERVER[' is scroll bar ']
{
echo <a href='#top'>Back to Top</a>
}
</code></pre>
<p>is it possible with PHP or Javascript to do something like this, where I can know if my page is going to be very long ahead of render time?</p>
| php javascript | [2, 3] |
5,878,216 | 5,878,217 | Different events when onclick tabs | <p>Hi Guys
I have created a tabs by jquery and i want to display different data from database at each tab how can i do that knowing that it is the same container and same data but with different conditions hope to find an answer soon
And i am using php and javascript
Thanks </p>
| php javascript jquery | [2, 3, 5] |
5,918,361 | 5,918,362 | How to load page only after JavaScript function has finished executing and performed its magic? | <p><strong>Here's the story...</strong></p>
<p>I have an image that is of dimensions 1174px x 660px within a container of dimensions 1174px x 375px. The image's height is cutoff and only 375 pixels worth of the image's height is displayed as I set overflow hidden on the container.</p>
<p>I have created a JavaScript function that takes this image (1174x660) and vertically centers it in its container (1174x 375) so that the center of the image is at the center of the container.</p>
<pre><code>function allFeaturesImagesResize () {
var allFeatures = function () {
var image = $('.all-features article img'),
container = $('.all-features article'),
container_height = container.height(),
image_height = image.height(),
container_center = .5 * container_height,
image_center = .5 * image_height,
center = (image_center - container_center);
image.css('position','relative').css('bottom', center);
}
$(function () {
$(window).resize(function () {
allFeatures();
}).resize();
});
}
</code></pre>
<p>I am using a <code>$(document).ready(function() { //... });</code> wrapper around this function, however, whenever the page loads I can see the function doing its work of moving the image up to the center point. Is there any way to delay the pay load until after this repositioning is complete?</p>
<p><strong>Keep in mind my site is fluid responsive which is why I need to dynamically position the images as I don't know the user's viewport beforehand dimensions (specifically the width).</strong></p>
| javascript jquery | [3, 5] |
5,995,747 | 5,995,748 | How to write files from Android to PC and back? | <p><strong>The Situation:</strong><br>
Client has an Android phone that is not activated to use cellular services and his office does not have wifi. He wants me to write him a simple customized contact list that he can view the names and the phone numbers of people(already completed). However, he wants a Desktop Client (done in Java) where he can update the contacts, as he is a bit older and prefers using a standard sized keyboard instead of the slider keyboard on his phone.(this is completed as well).</p>
<p>I need to complete a class for the app that will read a file on the PC's local hard drive and update the contacts file on the SD card.</p>
<p><strong>Options:</strong><br>
As far as I can tell, my only option in this case would be to use the USB port from the phone. I will have the desktop client write the contacts file to the SD card on the Android Device.</p>
<p><strong>Question:</strong><br>
Can I use the USBManager class to have the app:<br>
1. Look for xml contact file on PC.<br>
2. Read the file on the PC and update the file on the SD card.</p>
<p><strong>Additional Information:</strong><br>
Client's Phone Model: Motorola Droid II Global<br>
Android OS version: 2.3.4</p>
<p>Perhaps it may be easier to have the Desktop Client access the SDCard and write the files to the Android Device. I am willing to review all concepts and ideas about this process. Thank you.</p>
| java android | [1, 4] |
415,028 | 415,029 | jQuery JavaScript Encoding HTML | <p>How on earth do you encode HTML with jQuery/JavaScript?</p>
<p>Havn't found any working solution after hours of Googling and surfing this site.</p>
<p>This:</p>
<pre><code>jQuery('<div/>').text(value).html();
</code></pre>
<p>does not work with jQuery!</p>
| javascript jquery | [3, 5] |
467,516 | 467,517 | Ping Test Android | <p>I am working on developing ping application.In terms of ICMP, is there any proper ping API for android application in order to count the number of packets? </p>
<p>Thank you.</p>
| java android | [1, 4] |
1,184,753 | 1,184,754 | jQuery response saved as PHP variable | <p>I have a php page which generates links based on results from an "USERS" table, "NAME" row.
I'm using a jQuery tooltip so that a div appears when those links are hovered.
When the hover happens, I am able to get the link's text using <code>$(this).text()</code>, however, I don't seem to be able to parse the result so that it can link with PHP, as I want to display in the 'hidden' div certain info about the HOVERED user (e.g. his e-mail address).</p>
<p>Something like: When "Mike" is hovered, show Mike's e-mail address in the hover div.. and so on.</p>
<p>I've tried with cookies (when mouseover happens, I used something like:</p>
<pre><code>$.post("gophp.php", {"name":$(this).text()}, function(results) {
nada
});
</code></pre>
<p>, with gophp.php setting a cookie with data from <code>$_POST['name']</code>) - the div inside the other page is then able to show the cookie, BUT if I hover some other link, the data which is displayed remains the same because the page has to be reloaded.</p>
<p>Please help me, I'm going nuts.</p>
| php javascript jquery | [2, 3, 5] |
5,603,291 | 5,603,292 | Make rate button launch marketplace and have message body show | <p>i would like to have my rate button in my dialog to launch marketplace and go to my specific app.</p>
<p>Also how do i add in a message body into this dialog?</p>
<pre><code> private void makeDialog() {
AlertDialog.Builder about = new AlertDialog.Builder(this);
about.setMessage("About The Giveaway");
about.setPositiveButton("Rate", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
//action
}
});
about.setNegativeButton("Close", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {}
});
about.show();
}
}
</code></pre>
| java android | [1, 4] |
2,572,291 | 2,572,292 | How can I access javascript methods from jQuery selectors | <p>I have this plain js:</p>
<pre><code>var innerText = document.getElementById("TaskId").options[0].text;
</code></pre>
<p>And I was wondering how to convert it to jQuery:</p>
<pre><code>var innerS = $("#TaskId");
var innerText = innerS.options[0].text;
</code></pre>
<p>This throws an error: </p>
<pre><code>innerS.options is undefined
</code></pre>
<p><strong>EDIT</strong></p>
<p>In accordance with some of the debate I threw a quick speed test together:</p>
<p>js:</p>
<pre><code>var startDat = Date.now();
for (var c = 0; c < 100000; c++) {
var com = $("#TaskId").get(0);
}
var endDat = Date.now();
alert("jQ.get(0) took " + (endDat - startDat) + "ms");
var startD = Date.now();
for (var co = 0; co < 100000; co++) {
var com = $("#TaskId")[0];
}
var endD = Date.now();
alert("jQ[0] took " + (endD - startD) + "ms");
var startDa = Date.now();
for (var comp = 0; comp < 100000; comp++) {
var compa = document.getElementById("TaskId");
}
var endDa = Date.now();
alert("js took " + (endDa - startDa) + "ms");
</code></pre>
<p>results:</p>
<pre><code>jQ.get(0) took 1042ms
jQ[0] took 1057ms
js took 136ms
</code></pre>
| javascript jquery | [3, 5] |
5,912,998 | 5,912,999 | Automatically add an event to the calendar without "Done" "Cancel" | <p>I'm using this code for adding event into google calendar</p>
<pre><code>Calendar beginTime = Calendar.getInstance();
beginTime.set(2012, 0, 19, 7, 30);
Calendar endTime = Calendar.getInstance();
endTime.set(2012, 0, 19, 8, 30);
Intent intent = new Intent(Intent.ACTION_INSERT)
.setData(Events.CONTENT_URI)
.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, beginTime.getTimeInMillis())
.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endTime.getTimeInMillis())
.putExtra(Events.TITLE, "Yoga")
.putExtra(Events.DESCRIPTION, "Group class")
.putExtra(Events.EVENT_LOCATION, "The gym")
.putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY)
.putExtra(Intent.EXTRA_EMAIL, "[email protected],[email protected]");
startActivity(intent);
</code></pre>
<p>and it work but i need other methods for haven't this
<a href="http://imageshack.us/photo/my-images/560/screenshot2013030308374.png/" rel="nofollow">link</a></p>
| java android | [1, 4] |
2,912,567 | 2,912,568 | Find caller for exception? JQuery | <p>I am working in FireFox and I notice that a exception is thrown in my Firebug console.
The exception is in a jQuery function, but I have no idea who the caller is.
The webpage has a lot of custom javascript files included with many lines of code.</p>
<p>Is there any trick that I can use to find out from where the call came?</p>
<p>I have tried removing some of the included javascript files, but due to the size of the project and how things are connected, it is limited.</p>
<p>I tried placing a "debugger;" attribute in a javascript file and just stepped through the code, but it doesn't seem that I hit the correct place doing this.</p>
| javascript jquery | [3, 5] |
2,344,431 | 2,344,432 | Android OnPOst excute is not called | <p>I have an async task. It runs a sql query.It should go to the onPostExecute automatically, but it does not always go there. THere is no exception.The logs are also fine.</p>
<pre><code>class QueryDbTask extends AsyncTask<String, Void, Cursor> {
protected Cursor doInBackground(String... params) {
....
//sql query
try {
cur=activityObject.execSQL(Query);
}catch (Exception e) {
e.printstacktrace
}
return cur;}
protected void onPostExecute(Cursor result) {
}
</code></pre>
<p>Under what conditions onPostExecute would not be called?</p>
<p>i debugged and found that it was not reaching onPost Execute</p>
<p>Can two async task simulataneoulsy?</p>
| java android | [1, 4] |
3,064,449 | 3,064,450 | Javascript: How to calculate sum of attribute for each object with a same attribute in an array | <p>I have an array of objects like this one:</p>
<p>{'shapeId': 'shapeid1', 'latlong': '45.42342,-65.23424', 'number': 5}</p>
<p>I want the sum of the values of the attribute "number" when the value of the attribute "shapeId" is the same.</p>
<p>Is there a built in method for that? Thank you!</p>
<p>What I tried so far is this but I only have the last shapeId repeated many times in the output array:</p>
<pre><code>function stats(){
var total = 0;
allTotal = [];
for (var i=0; i < createdShapes.length; i++){
$.each(allMarkers,function() {
if(this.shapeId == createdShapes[i].id){
total += parseInt(this.number);
shape_id = this.shapeId;
alert('dans boucle ' + shape_id)
}
});
sums.shapeId = shape_id;
sums.total = total;
allTotal.push(sums);
alert('longueur: ' + allTotal.length)
}
for (var j = 0; j < allTotal.length; j++){
alert(allTotal[j].shapeId + ':' + allTotal[j].total)
}
}
</code></pre>
| javascript jquery | [3, 5] |
3,149,979 | 3,149,980 | scroll down to position | <p>I have this code to make page scroll up and down,Please tell me how to make it back to scroll postion instead of down page when i click down?</p>
<pre><code><a href="javascript://" id="toDown">Down</a>
<a href="javascript://" id="toTop">Top</a>
<script type="text/javascript">
jQuery.noConflict();
$(window).scroll(function(){
if($(window).scrollTop() > "0"){
$('#toTop').fadeIn();
$('#toDown').hide();
}else if($(window).scrollTop() == "0"){
$('#toTop').fadeOut();
$('#toDown').fadeIn();
}
});
$('#toTop').click(function(){
$('html, body').animate({scrollTop:0}, 0);
$('#toDown').fadeIn();
});
$('#toDown').click(function(){
$('html, body').animate({$('body').height()}, 0);
$('#toDown').fadeOut();
});
</script>
</code></pre>
| javascript jquery | [3, 5] |
1,709,465 | 1,709,466 | How to send mail with attachment using JS? | <p>Can anybody tell me how to send mail with an attachment using JavaScript?</p>
| javascript jquery | [3, 5] |
3,447,407 | 3,447,408 | Jquery help with left tab menu | <p>This really should not be this complicated, but can't figure it out.</p>
<p>Have several tabs vertically on the left along the body content section.</p>
<p>On page load, the "leftKanji" css = display:none. Want when mouse enters the link or "leftTab" class, then "leftKanji" css = disply:block</p>
<p>Currently either all the "leftKanji" shows or hides, not the one the mouse is hover over with. Bonus would be if I can add a "slow" or animate to it.</p>
<p>HTML:</p>
<pre><code><script type="text/javascript" >
$(document).ready(function(){
$('.leftTab').hover( function(){
$(".leftKanji").css('display', 'block');
},
function(){
$(".leftKanji").css('display', 'none');
});
});
</script>
<div class="mainTabSection">
<a href="#" class="leftTab">
<div class="mainTab"><img src="../" /></div>
<div class="leftKanji"><img src="../" /></div>
</a>
</div>
<div class="mainTabSection">
<a href="#" class="leftTab">
<div class="mainTab"><img src="../" /></div>
<div class="leftKanji"><img src="../" /></div>
</a>
</div>
</code></pre>
| javascript jquery | [3, 5] |
4,933,057 | 4,933,058 | Placing code from webform into class | <p>I have some code in a button_click event in my webform that performs some actions
(writing some xml files).</p>
<p>But i wish to place all my XML code in 1 class within my webproject.</p>
<p>But how do i exactly acces controls from my webform on this class?
And how do i link those 2 with each other?</p>
<p>Ive tried inherit from System.Web.UI.Page in my class but seems thats not quite it.</p>
<p>Kind Regards.</p>
| c# asp.net | [0, 9] |
247,417 | 247,418 | Show/hide views with checkbox | <p>I want to show or hide some elements (textviews and edittexts) with checkbox. I set their visibility to gone in layout file. Showing them when user checks the box works, but the when user unchecks it, they don't hide. (android 1.5 and 1.6)</p>
<p>My code:</p>
<pre><code>cb=(CheckBox)findViewById(R.id.cek);
cb.setOnClickListener(new OnClickListener() { // checkbox listener
public void onClick(View v) {
// Perform action on clicks, depending on whether it's now checked
if (((CheckBox) v).isChecked()) {
tv1.setVisibility(0); //visible==0
et3.setVisibility(0);
} else if (((CheckBox) v).isChecked() == false) {
tv1.setVisibility(2); //gone=2
et3.setVisibility(2);
}
}
});
</code></pre>
| java android | [1, 4] |
1,183,942 | 1,183,943 | JQuery Terminal term.echo from another function? | <p>I am trying to use: <code>http://terminal.jcubic.pl/</code></p>
<p>I want to be able to call term.echo from another function to be able to place data inside the terminal, but I can not reference it.</p>
<p>Heres the code below:</p>
<pre><code>jQuery(document).ready(function($) {
var id = 1;
$('body').terminal(function(command, term) {
if (command == 'help') {
term.echo("available commands are mysql, js, test");
} else{
term.echo("entered: " + command);
}
}, {
greetings: "Shell",
onBlur: function() {
return false;
}
});
});
</code></pre>
<p>How can I access term.echo externally, so I can from like a button click call term.echo to add in data?</p>
| javascript jquery | [3, 5] |
2,008,703 | 2,008,704 | call javascript function from code behind | <p>I have this JavaScript code in ASPX page </p>
<pre><code><script>
function show_modal(statut)
{
if (statut == true)
{
$(function ()
{
$('#modal_success').modal('show')
})
}
else
{
$(function ()
{
$('#modal_fail').modal('show')
})
}
}
</script>
</code></pre>
<p>That shows an modalpopup wich I like to launch from my code behind.</p>
<p>I tried this, but it didn't work:</p>
<pre><code>if (resultat)
{
ClientScript.RegisterStartupScript(this.GetType(), "", "show_modal(true);");
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "", "show_modal(false);");
}
</code></pre>
<p>but I can't figure out why!</p>
| c# javascript asp.net | [0, 3, 9] |
2,872,116 | 2,872,117 | How to pass DataTable to Javascript | <p>How can I pass a DataTable element with a lot of rows, to Javascript ? </p>
<p>The idea is to allow me do a loop in my variable that receive this DataTable and recover the values.</p>
| c# javascript | [0, 3] |
3,823,356 | 3,823,357 | Why my events aren't registered after postback? | <p>I have a problem where I have a page with a checkbox :</p>
<pre><code><asp:CheckBox runat="server" ID="chkSelectAll" OnCheckedChanged="chkSelectAll_CheckedChanged" EnableViewState="true" Text='<%# CommonFunctions.GetText(Page, "CreateTask", "chkSelectAll.text") %>' AutoPostBack="true" />
</code></pre>
<p>First I had the problem that when the event was raised the checkbox wasn't keeping the checked property value. This is still strange because nowhere in the application we set the EnableViewState to false and by default it should be true. Well this behavior was fixed by puting EnableViewState="true".</p>
<p>So now, I have a checkbox that when I first load the page, wworks correctly. I check the box, the event is raised Checked property valu is good and the method is executed. Postback completes and renders the page. I check the box back to false, the event is not triggered and the page is reloaded with the previous data but the Checked Property stays at true.</p>
<p>So after the first postback I seem to loose behavior of event and ViewState.</p>
<p>We suspect the fact that we move dynamically the controls in the page (See answer <a href="http://stackoverflow.com/questions/375093/asp-net-possible-to-create-a-usercontrol-that-include-inside-markup-content">here</a>)</p>
<p>But this suspicion doesn't explain why everything works perfectly after the first load and stops working after first PostBack.</p>
<p><strong>EDIT</strong></p>
<p><a href="http://www.mediafire.com/?14udjznyjmj" rel="nofollow"><strong>CODE SAMPLE</strong></a></p>
<p>I created a test project where you can experience my problem. At load if you check any checkbox both raise their respective event. After postback only the second raise both events. I seem to have a problem when I register the events after moving control.</p>
| c# asp.net | [0, 9] |
2,005,366 | 2,005,367 | Combaining two array into single multi dimensional array in javascript | <pre><code>status_name=Array("a","b","c","b","e","f");
status_id=Array( 1, 2, 3, 4, 5, 6);
</code></pre>
<p>How to combine these two arrays and to built multi dimensional array Expected Multidimensional array be like this</p>
<pre><code>[["a", 1],["b", 2],["c", 3],["d", 4],["e", 5],["f", 6]]
</code></pre>
<p>Help me how to use above two array values and built my expected multidimensional array</p>
| javascript jquery | [3, 5] |
4,625,943 | 4,625,944 | dropdownlist with values but disabled | <p>Hi i need to display a dropdownlist with data but disable, my problem it's then despite i set the only value that i need to show at the beginning of the application when i set enable false the data it's been clear, so i need to know if exit's another way to disable a dropdown but with data. Thanks</p>
<p><strong>My Code</strong></p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
//Initialize the combo
Dictionary<int,String> estate = new Dictionary<int,String>();
estadosVenezuela.Add(0,"Pick a state");
DropDownList2.DataValueField = "Key";
DropDownList2.DataTextField = "Value";
DropDownList2.DataBind();
DropDownList2.Enabled = false;
}
</code></pre>
<p>i need that the values pick a state appear's but with the dropdownlist disabled</p>
| c# asp.net | [0, 9] |
2,715,493 | 2,715,494 | asp.net url generation with name and id | <pre><code>test.Controls.Add(GetButton(thisReader["session_id"].ToString(), "Join Session"));
</code></pre>
<p>I have changed the above code to the one below to</p>
<pre><code>test.Controls.Add(GetButton(thisReader["session_name"].ToString(), "Join Session"));
</code></pre>
<p>I did this because i wanted to have my end of URL <code>session= session_name</code> instade of the <code>session_id</code> . doing this now created a problem because the since session_id was not passed i the results on the next page based on session_id are not displayed.Please refer the original question <a href="http://stackoverflow.com/questions/10046586/asp-net-url-generation">asp.net url generation</a></p>
<pre><code>Response.Redirect("EnterSession.aspx?session=" + e.CommandArgument.ToString());
</code></pre>
<p>how can solve this problem ?</p>
<p>c# part of entersession.aspx</p>
<pre><code>public partial class _EnterSession2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SessionID.Value = Request.QueryString["session"];
// Label2.Text = DateTime.Now.ToString();
if (User.Identity.IsAuthenticated)
{
string userName = User.Identity.Name;
//Username.Value = User.Identity.Name;
Username.Value = userName.ToLower();
HiddenField1.Value = User.Identity.Name;
}
}
</code></pre>
| javascript asp.net | [3, 9] |
1,828,491 | 1,828,492 | How to get MenuItem ActionBar Flags? | <p>I want to programmatically determine the current ActionBar-Flag of a MenuItem object, for example MenuItem.SHOW_AS_ACTION_WITH_TEXT.</p>
<p>I only found a method setShowAsAction(int) to set these flags, but I would like to check the current flags of the item. How is that possible?</p>
| java android | [1, 4] |
10,249 | 10,250 | how to encode json.stringified output | <p>i have a form to which the form elements are appended using the onclick event. </p>
<p>the form elements along with their values and label are then maintained in an array . </p>
<pre><code>function save_form() {
var x = document.getElementById("formBuilder");
var elements_data = new Array;
for (var i = 0; i < x.length; i++) {
if (x.elements[i].type == 'checkbox' || x.elements[i].type == 'radio') {
var all_ele_value = [];
var ele_id = x.elements[i].id;
$("input:" + x.elements[i].type + "[name=" + ele_id + "[]]").each(function () {
all_ele_value.push($(this).val());
});
var end_value = all_ele_value.join(";");
}
else if (x.elements[i].type == 'select-one') {
var ele_id = x.elements[i].id;
var end_value = $("#" + ele_id + " option").map(function (i, n) {
return n.value;
}).get().join(";");
}
else {
var end_value = x.elements[i].value;
}
}
var form_data = JSON.stringify(elements_data);
$.post(software_url + 'form_manager/save_form', {
'form_data': form_data
}, function (data) {
alert(data);
});
}
</code></pre>
<p>now i want to encode form_data in my php file . I want to know a way to do that because json_decode does not work. Iam getting all the output in json format .BUt i want to iterate through it.</p>
| php jquery | [2, 5] |
2,469,288 | 2,469,289 | Identify the checkbox that is checked, in a group of checkboxes | <p>I have 2 checkboxes in a form and onclick of these, some php code needs to be executed and based on the result of the code, the checkbox is checked or unchecked. </p>
<p>So i have written onclick = document.formName.submit(); Now it is triggering the same page and i am able to write the code. I am not able to differentiate which checkbox is checked.</p>
<p>I don't want to use the procedure of:- calling javascript and then storing the value of the checkbox in a variable and making this variable as invisible. </p>
<p>I would like to write something like document.formName.submit('checkbox1'). So that i should be able to handle the value of this or i dont know.</p>
<p>Please suggest me an alternative method or better approach.</p>
| php javascript | [2, 3] |
1,696,269 | 1,696,270 | Dynamically build combo/radio options | <p>I will have a product page that could have up to 20 different SKUs on a single page, but all have the same master record. The master record has aload of flags in it saying if it has height/depth/width/length. </p>
<p>I am trying to dynamically generate selectable options on a product page and build an 'option map' or function so that all the other options are filtered on the client side and they end up with the correct SKU.</p>
<p>I'm not sure which way to approach this as i've only just started learning javascript, normally I would just use asp controls and I could easily postback and update controls but i'm trying to make it as nice to use as possible.</p>
<p>Could I register a javascript function on page load with all the product options in an array and then rebind the combos/radios onChanged? I was thinking I could Dynamically generate the combos I need in c# code behind based on the master flags and link them to my new javascript function?</p>
<p>I'm happy to go away and research stuff I just want to make sure there's not a better way of doing it (or if this will even work).</p>
| c# javascript asp.net | [0, 3, 9] |
445,271 | 445,272 | Constructor that handles exception | <p>How can i make constructor that can handle IOException</p>
<p>this is the class with constructor</p>
<pre><code>public class RootProcess {
Process process;
public RootProcess() throws IOException {
}
public RootProcess(Process process){
this.process = process;
}
public Process getProcess() {
return process;
}
public void setProcess(Process process) {
this.process = process;
}
}
</code></pre>
<p>And this is how i declare it</p>
<pre><code>RootProcess process = new RootProcess(Runtime.getRuntime().exec("su"));
</code></pre>
<p>but i get this error in eclipse</p>
<pre><code>Default constructor cannot handle exception type IOException thrown by implicit super constructor. Must define an explicit constructor
</code></pre>
| java android | [1, 4] |
2,037,356 | 2,037,357 | highlight individual cell | <p>i am working on a problem at the moment that I am having a fair amount of difficulty with. thanks to some amazingly wonderful programers I have some javascript code that allows me to highlight a full row on a table if a cell, with id="date", has a date that is in the past. however now I am trying to convert this so that it only highlights the cell with the date itself. the code I have so is </p>
<pre><code><script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<style type="text/css">
body {
background-color: transparent;
padding: 10px;
}
#demotable1 tr {
background: white;
}
#demotable1 tr.past {
background: #FF0000;
color: #999999;
}
</style>
<script type="text/javascript">
//<![CDATA[
$(function()
{
$('#demotable1 .date').each(function()
{
var cell_date = Date.parse($(this).text().replace(/(\d{2})\/(\d{2})\/(\d{4})/, '$2/$1/$3'));
var now_date = new Date().getTime();
if(cell_date < now_date)
{
$(this).parent('tr').addClass('past')
}
}
);
}
);
//]]>
</script>
</code></pre>
<p>I have tried changing .parent to .child and just about every conceivable variation of this that I can think of. </p>
<p>Any help with this problem will be greatly appriciated.</p>
| javascript jquery | [3, 5] |
746,224 | 746,225 | Credential Caching issue | <p>I have a static helper method that I wrap around SMTPClient to send email.</p>
<p>I am storing the SMTP authentication in the web.config -> in the default location that System.Net namespace objects look for.</p>
<p>I am passing the credentials to the SMTPClient, because I want to run my password decryption on the password before the SMTPClient uses this.</p>
<p>The issue that I'm encountering here is - when I run this once, the password is stored somehwere as "decrypted" somehow in the cache. When I try and run this method a second time in the same session, I get an error, because it's trying to decrypt a password that was already decrypte the first time it was ran. Any ideas?</p>
<pre><code> public static void SendEmail(MailMessage mailMessage)
{
SmtpClient smtpClient = new SmtpClient();
NetworkCredential nc = new NetworkCredential();
nc = (NetworkCredential)smtpClient.Credentials;
nc.Password = Tools.Decrypt(nc.Password);
smtpClient.Credentials = nc;
smtpClient.Send(mailMessage);
nc = null;
smtpClient.Credentials = null;
}
</code></pre>
| c# asp.net | [0, 9] |
3,028,143 | 3,028,144 | Possible to toggle/animate between two sizes using jQuery? | <p>Basically I have a small div that is initially styled to 60x60. I have created click event that animates the expansion of the div:</p>
<pre><code>$("#myDiv").click(function () {
$(this).animate(
{
width: "350px",
height: "300px"
}, 500);
}
</code></pre>
<p>I would like to reverse this animation if someone clicks the div again. Is there anyway to toggle between the original size and the expanded size (still using the animate function) with each click? </p>
<p>I found the toggleClass function but I don't think this will work with animiate.</p>
<p>You can see a basic fiddle here: <a href="http://jsfiddle.net/NS9Qp/" rel="nofollow">http://jsfiddle.net/NS9Qp/</a></p>
| javascript jquery | [3, 5] |
4,950,830 | 4,950,831 | How to add and remove Textboxes using javascript and then send the data to php? | <p>How to create a dynamical add/remove textboxs AND send all the data to PHP? Making a dynamic add and remove is fine, but how do I store it in PHP? </p>
<p>The number of textboxes will vary, so how do I store all of them separately in php?</p>
| php javascript jquery | [2, 3, 5] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.