Unnamed: 0
int64 302
6.03M
| Id
int64 303
6.03M
| Title
stringlengths 12
149
| input
stringlengths 25
3.08k
| output
stringclasses 181
values | Tag_Number
stringclasses 181
values |
---|---|---|---|---|---|
2,315,868 | 2,315,869 | ENTER to TAB redirect problem: submit form at the end of cycle | <p>I'm using this jQuery function to jumping on "input" styled components of the form: </p>
<pre><code>$('*').live("keydown", function(e)
{
var inputs = $(this).parents("form").eq(0).find(".input:visible:enabled");
var idx = inputs.index(this);
// ENTER IS PRESSED
if (e.keyCode == 13)
{
if (idx == inputs.length - 1)
{
inputs[idx + 1].select();
}
else
{
inputs[idx + 1].focus();
inputs[idx + 1].select();
}
return false;
}
// TAB IS PRESSED
if (e.keyCode == 9)
{
inputs[idx + 1].select();
return false;
}
});
</code></pre>
<p>and this components on the form (reduced code):</p>
<pre><code><h:inputText id="persId" tabindex="1" styleClass="input">
<h:selectOneMenu id="type" tabindex="1" styleClass="input">
<h:selectOneMenu id="no" tabindex="1" styleClass="input">
<h:commandButton type="submit" tabindex="2" id="btnSubmit" styleClass="btninput"/>
</code></pre>
<p>what I need is to jumping on 3 inputs and after that submit a form (using Enter). When I replace selectOneMenu by inputText, it works fine, but with selectOneMenu, it doesn´t.</p>
<p>TAB rotate all three components normally. </p>
<p>What am I doing wrong?</p>
<p><strong>UPDATE:</strong> perhaps it would be enough to fire enter normally <code>if (idx == inputs.length - 1)</code>, but I don´t know how..?</p>
<p><strong>SOLVED:</strong> aha, it's simple, just add <code>document.getElementById('food:btnSubmit').click();</code> :)</p>
| javascript jquery | [3, 5] |
1,431,469 | 1,431,470 | SharedPreferences on a non-Activity extended class | <p>I have a class that sends some info to the mysql db.
I want from this class to use the Shared Preferences methods but they are belong to the activity class.
My class extends AsyncTask so I can't extend another.. I tried to create an activity instance and use it but my program has stoped. something like this:</p>
<pre><code>Activity a1 = new Activity();
SharedPreferenecs loginInfo = a1.getSharedPreferences("MyKid", 0);
</code></pre>
<p>etc ..</p>
| java android | [1, 4] |
1,307,678 | 1,307,679 | Programmatically reorder RelativeLayout | <p>I'm trying to create a word jumble game where you drag a letter right or left in the jumbled word and the letters swap. What is the best way to reorder items in a RelativeLayout programmatically so when the letter is dragged left the letters that the tile passes are positioned to the right of the dragged letter.</p>
<p>I've tried something like this as a basic test.</p>
<pre><code>public static void moveTile(Tile tile, int x, RelativeLayout parent) {
if (x < tile.getWidth()) {
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.LEFT_OF, tile.getId() - 1);
tile.setLayoutParams(params);
RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
p.addRule(RelativeLayout.RIGHT_OF, tile.getId());
Tile t = (Tile) parent.findViewById(tile.getId() - 1);
t.setLayoutParams(p);
}
parent.invalidate();
}
</code></pre>
<p>But this causes the app to crash with an error about "Circular dependancies cannot exist in a RelativeLayout" which I understand but I'm just not sure what other way to do this.</p>
<p>Any help will be much appreciated.</p>
| java android | [1, 4] |
5,671,704 | 5,671,705 | jQuery - Choosing a variable based on the ID of the element that was clicked | <p>I'm probably overlooking a more obvious way to do what I want, but...</p>
<p>I have a list of JS variables with names that are identical to the ID's of some elements on my page. When I click one of the elmeents, I want to be able to use the clicked element's ID to determine which variable should be used in my function. My variable names correspond to my element ID's - there must be some way to take the value of my clicked element's ID using <code>$(this).id</code> and then find the variable that matches that string? Just to be clear, the content of the variables is not at all related to the variable names or element ID's - the variables are set when the page loads and I'd like to avoid setting them every time the function is run! And I know I could probably use <code>onclick</code> for this, but I'm trying to avoid that because apparently it's inferior now?!</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
916,286 | 916,287 | Sending notification (few data) from PHP server side App to Android Client Side App | <p>How can I send data from my PHP server side App to Android Client Side App in terms of Notification or something else i dont want to use C2DM ,is there any other Alternative.</p>
<p>I want to send such data on a particular event happen on server like a new row inserted in some table or existing row deleted by user A but also shared to user B.So i want to notify user B by sending some notification on his mobile.</p>
| php android | [2, 4] |
3,661,049 | 3,661,050 | how to insert the data in the database through asp.net with c#? | <p>I need help developing a page that will contain a FormView connected to a table in a SQL Express database.</p>
<p>My workflow is to the effect of: </p>
<ul>
<li>User enters information on page.</li>
<li>User clicks save button.
<ul>
<li>If successfully saved then display success message.</li>
<li>Otherwise display error message.</li>
</ul></li>
</ul>
<p>I currently don't know how to accomplish the tasks at hand so I am looking for anyone that could provide me an example using a FormView (preferred) or a better/alternative method for achieving my goal.</p>
| c# asp.net | [0, 9] |
3,821,224 | 3,821,225 | Changing textbox backcolor Conditionally | <p>I have a few textboxes in an aspx page. i would like to change the textbox color to yellow if they are enabled. I can do it individually for each textbox. But is there a way where I can get all the textbox collection of a page and check their enabled property and assign the backcolor?</p>
| c# asp.net | [0, 9] |
1,874,636 | 1,874,637 | Is it possible to find button by view, and not findViewById? | <p>I'm wondering if it is possible to find the button in the way I want. Because I need to make a temporary button from the button that has been clicked.</p>
<p>This code gives an error:</p>
<pre><code>public void onClick(View view) {
Button button = (Button) findViewById(R.id.view);
}
view cannot be resolved or is not a field
</code></pre>
<p>That is obviously, because I'm using the findViewById() method, and therefore the program is expecting an Id, not a View. Is there maybe an other method to find the right button?</p>
| java android | [1, 4] |
57,636 | 57,637 | IE8 not initializing function properties in javascript. | <p>I have the following javascript. This extends keith woods jquery date picker. In chrome, ff the following alerts a date value. However in ie 8 i get [object, object]</p>
<pre><code><script type="text/javascript"><!--
var defaultDate = '06/01/2011';
$(function() {
$('#inlineDatepicker').calendarsPicker({onSelect: showDate, defaultDate: defaultDate, selectDefaultDate: true, changeMonth:false, onDate: nationalDays, prevText: '&nbsp;', nextText: '&nbsp;'});
});
function nationalDays(date, inMonth) {
alert(date); // doesn't return date in ie 8
}
function showDate(date) {
var start = date.toString('dd-MM-yyyy');
var url = '/events?s=' + start;
window.location = url;
}
--></script>
</code></pre>
| javascript jquery | [3, 5] |
1,807,435 | 1,807,436 | Jquery Quoting String | <p>I cannot seem to get the quotes around this statement right. No matter what combination I try.
I am really confused on how it should be quoted.</p>
<pre><code>$(#imagearea).append("<img id='"+theWord.charAt(i).toUpperCase+"'.png'" src='images/'+theWord.charAt(i).toUpperCase+"'.png'/>");
</code></pre>
| javascript jquery | [3, 5] |
2,620,199 | 2,620,200 | Async file downloader android | <p>I started creating file downloader class. Here is what i have:</p>
<pre><code>public class Downloader {
//download url
URL url;
public Downloader(URL downloadURL){
url = downloadURL;
}
public void toFile(File fName) {
try {
HttpURLConnection urlConnection = (HttpURLConnection) url
.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection.setDoOutput(true);
urlConnection.connect();
FileOutputStream fileOutput = new FileOutputStream(fName);
InputStream inputStream = urlConnection.getInputStream();
byte[] buffer = new byte[1024];
int bufferLength = 0;
while ((bufferLength = inputStream.read(buffer)) > 0) {
fileOutput.write(buffer, 0, bufferLength);
}
fileOutput.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
</code></pre>
<p>I need to call this downloader in new thread. Maybe someone could give me hint why i need to call new thread or asyc task for this.</p>
<pre><code>public void downloadFile(String urlToDownload,String path) throws MalformedURLException{
new Thread(new Runnable() {
public void run() {
new Downloader(new URL(urlToDownload)).toFile(new File(path));
}
}).start();
}
</code></pre>
<p>So when i want to downlaod my file it's strating downloading asynchronical.</p>
<p>I don't really want that.
I want to create downloader where i could choose if i want synchronously or async download a file.</p>
<p>But in the first place, i want to know when file was downloaded. How could i know this ?</p>
<p>Maybe someone had done this and could help me.
I need to know when file is downloaded.</p>
<p>Thanks.</p>
| java android | [1, 4] |
1,887,675 | 1,887,676 | How to embed php in javascript? | <p>how can we use php in between javascript ?????
<br>
like <br></p>
<pre><code>function jst()
{
var i = 0 ;
i = <?php echo 35; ?>
alert( i );
}
</code></pre>
<p>Please suggest a better way</p>
| php javascript | [2, 3] |
3,955,968 | 3,955,969 | Generic function issue - Cannot convert type 'System.Web.UI.Control' to 'T' | <p>It seems I still don't "get" generics ... I want a general function to load a user control which inherently calls Page.LoadControl() but I am getting the error above when trying to make it work.</p>
<p>Here is a mock up of the code I use to load the control:</p>
<pre><code>MyControl Ctrl = MyUtilClass.LoadControl(Page, "MyControl");
</code></pre>
<p>and then in MyUtilClass:</p>
<pre><code>internal static T LoadControl<T>(Page P, string ControlName)
{
return (T)P.LoadControl(String.Format("~/{0}{1}.ascx", WebGlobals.cControlDir, ControlName));
}
</code></pre>
<p>I am obviously doing something wrong but my understanding was the compiler would look at the type of var I am trying to assign the result of this function to and be able to cast the result as that type.</p>
| c# asp.net | [0, 9] |
3,518,209 | 3,518,210 | Copy uploaded image to my physical directory in ASP.net | <p>I'm creating a user profile for my website and I need to allow user to upload his image to be his profile picture, I used the ASP.net upload control and I need to copy the image he uploaded to a physical directory called Images on the server.</p>
<p>Does any one has idea if that is possible using ASP.net?</p>
| c# asp.net | [0, 9] |
654,328 | 654,329 | Add table column cells with input textbox and without | <p>I am adding the values of a column in a table with the following javascript function:</p>
<pre><code>function sumOfColumns(tableID, columnIndex, hasHeader) {
var tot = 0;
$("#" + tableID + " tr" + (hasHeader ? ":gt(0)" : ""))
.children("td:nth-child(" + columnIndex + ")")
.each(function() {
tot += $(this).html();
});
return tot;
}
</code></pre>
<p>I would like to modify it so it adds not only the numbers in the cell, but also include the value of textboxes in cells. A cell can either have a number or a textbox with a number.</p>
<p>The following cells should add up to 2115:</p>
<pre><code><table>
<tr><td>100</td></tr>
<tr><td><input type="text" value="5" /></td></tr>
<tr><td>10</td></tr>
<tr><td><input type="text" value="2000" /></td></tr>
</table>
</code></pre>
<p>How can I do this most efficiently?
Thanks for your input!</p>
| javascript jquery | [3, 5] |
3,474,446 | 3,474,447 | Smooth natural motion when page scroll | <p>I am newbie in JS. Right now i am working on an effect in which i want when page scroll first time then the natural motion animation starts but it's creating a problem because when i scroll the element animation became fast.</p>
<p>Check this more you got the idea.</p>
<p><a href="http://jsfiddle.net/byvLy/" rel="nofollow">http://jsfiddle.net/byvLy/</a></p>
| javascript jquery | [3, 5] |
743,593 | 743,594 | How to create Gallery in asp.ne code behind | <p>I want to create a Gallery of data from server in asp.net under vb, each Gallery item should look like the following snapshot
<img src="http://i.stack.imgur.com/IVqBt.png" alt="enter image description here"></p>
<p>and it should looks like the following snapshot
<img src="http://i.stack.imgur.com/hnh2V.png" alt="enter image description here"></p>
<p>please help or guide me.
Kind Regards, </p>
| javascript jquery asp.net | [3, 5, 9] |
2,731,802 | 2,731,803 | Browser Capabilities Files | <p>I've defined a new platform in my App_Browsers folder like this:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<browsers>
<browser id="PlatformWin7" parentID="PlatformWinnt">
<identification>
<userAgent match="Windows (NT 6\.1)" />
</identification>
<capture>
</capture>
<capabilities>
<capability name="platform" value="Win7" />
</capabilities>
</browser>
</browsers>
</code></pre>
<p>However, when I try and go to my site I get this error thrown:</p>
<pre><code>Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The browser or gateway element with ID 'PlatformWinnt' cannot be found.
</code></pre>
<p>However, <code>PlatformWinnt</code> IS defined in <code>gateway.browser</code> in <code>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\Browsers</code> so why can't it pick it up?</p>
<p>I thought <code>parentID</code> was cross file? I've even tried calling aspnet_regbrowsers but to no avail.</p>
<p>Edit: This is also true if I rename <code><browser></code> to <code><gateway></code>.</p>
| c# asp.net | [0, 9] |
931,429 | 931,430 | Can Android applications have their variables read/set maliciously? | <p>This does not deal with apk piracy what I'm asking about is the code in the apk file.</p>
<p>I know that if you use shared memory and set the mode to public people can change the values that are saved but what about the code in the application? For example if I set a variable to public static int in a game could an outside application change those values?</p>
<p>Another question I have is if I have my application access a remote server could a 3rd party application possibly change the return value that my server would send back?</p>
<p>Thanks in advance</p>
| java android | [1, 4] |
516,084 | 516,085 | Is there a more efficient way to write this function? | <pre><code>function month(num) {
if (num == 1) {
return "January";
} else if (num == 2) {
return "Feburary";
} else if (num == 3) {
return "March";
} else if (num == 4) {
return "April";
} else if (num == 5) {
return "May";
} else if (num == 6) {
return "June";
} else if (num == 7) {
return "July";
} else if (num == 8) {
return "August";
} else if (num == 9) {
return "September";
} else if (num == 10) {
return "October";
} else if (num == 11) {
return "November";
} else if (num == 12) {
return "December";
} else {
return false;
}
}
</code></pre>
<p>jQuery/Javascript.</p>
| javascript jquery | [3, 5] |
4,777,560 | 4,777,561 | .click() doesn't work a second time | <p>As a beginner in jQuery I'm trying to understand how to handle .click().</p>
<p>My event click function :</p>
<pre><code><script language="javascript" type="text/javascript">
$(document).ready(function() {
$('.del').click(function() {
var lien = $(this).attr("title");
$.post(lien, function(data) {
$('#result').empty();
$('#result').append(data);
})
});
</script>
</code></pre>
<p>The span :</p>
<pre><code><span title="<?php echo base_url().'del/cat/'.$cat->idcategories ?>"class="del alignright">supprimer</span>
</code></pre>
<p>This works the first time but not after that. Is this happening because I'm using attr()?</p>
<p>Any explanation of the expected behavior would be very much appreciated.</p>
| php jquery | [2, 5] |
4,325,347 | 4,325,348 | Android album art path reload | <p>I am displaying album art into an ImageView and it's working fine.If I delete the album art files from <strong>data/com.android.providers.media/albumthumbs</strong>.How do I refresh this folder through the code. Any one please let me know how to do it.</p>
| java android | [1, 4] |
1,303,419 | 1,303,420 | How can i access static class without using object in android? | <p>Can i access static class to another class without using object for that static class. help me how to access.</p>
| java android | [1, 4] |
2,507,810 | 2,507,811 | Generating an integer and use it as index for string array | <p>I recently started with android programming, with just basic knowledge in java.
I'm having trouble with my code,What I'm aiming is to display a randomly chosen text that's already programmed in my array after the button is clicked (onclick event).</p>
<pre><code>public void magicbegins() //
{
int min = 0;
int max = 3;
Random r = new Random();
int rand = r.nextInt(max - min + 1) + min;
//generating random number from 0 to 3 to use as index in later event
String[] magictext = {"yes", "no", "maybe"};
TextView text = (TextView) findViewById(R.id.textView1);
//using the generated number as index for programmed string array
text.setText(magictext[rand]);
}
</code></pre>
<p>If any case this codes is not recommendable to use, will anyone provide a sample script that would do similar from what I aim at very least?</p>
| java android | [1, 4] |
4,133,497 | 4,133,498 | Javascript - Set date 30 days from now | <p>I need to set a date that would be 30 days from now taking into account months that are 28,29,30,31 days so it doesn't skip any days and shows exactly 30 days from now. How can I do that?</p>
| javascript jquery | [3, 5] |
5,807,353 | 5,807,354 | jQuery grab a file uploaded with input type='file' | <p>I want to grab the file uploaded in a <code><input type='file'></code> tag.</p>
<p>When I do $('#inputId').val(), it only grabs the <em>name</em> of the file, not the actual file itself.</p>
<p>I'm trying to follow this: </p>
<p><a href="http://hacks.mozilla.org/2011/03/the-shortest-image-uploader-ever/">http://hacks.mozilla.org/2011/03/the-shortest-image-uploader-ever/</a></p>
<pre><code>function upload(file) {
// file is from a <input> tag or from Drag'n Drop
// Is the file an image?
if (!file || !file.type.match(/image.*/)) return;
// It is!
// Let's build a FormData object
var fd = new FormData();
fd.append("image", file); // Append the file
fd.append("key", "6528448c258cff474ca9701c5bab6927");
// Get your own key: http://api.imgur.com/
// Create the XHR (Cross-Domain XHR FTW!!!)
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://api.imgur.com/2/upload.json"); // Boooom!
xhr.onload = function() {
// Big win!
// The URL of the image is:
JSON.parse(xhr.responseText).upload.links.imgur_page;
}
// Ok, I don't handle the errors. An exercice for the reader.
// And now, we send the formdata
xhr.send(fd);
}
</code></pre>
| javascript jquery | [3, 5] |
3,113,888 | 3,113,889 | How do I get an Asp.Net radiobox to callback when it is clicked? | <p>I'm working on an asp.net/C# application, and trying to get a radiobox to invoke a callback when any of the buttons on it is clicked. Does anyone know how to do this? I've tried this...</p>
<pre><code><asp:RadioButton id="id1" onclick="do_foo" runat="server" Text="Text1" GroupName="mybox" />
<asp:RadioButton id="id2" onclick="do_foo" runat="server" Text="Text2" GroupName="mybox" />
<asp:RadioButton id="id3" onclick="do_foo" runat="server" Text="Text3" GroupName="mybox" />
</code></pre>
<p>and also this...</p>
<pre><code><asp:RadioButtonList onclick="do_foo" id="radiolist1" runat="server">
<asp:ListItem>Text1</asp:ListItem>
<asp:ListItem>Text2</asp:ListItem>
<asp:ListItem>Text3</asp:ListItem>
</asp:RadioButtonList>
</code></pre>
<p>but in both cases get the error "Microsoft JScript runtime error: 'do_foo' is undefined". I know that do_foo is defined because I can invoke it from a button.</p>
| c# asp.net | [0, 9] |
2,472,042 | 2,472,043 | Writing / reading file in the internal storage of Android (the file disappears) | <p>I have a class which write a png in the internal storage. When I write and read it just after that, it works.</p>
<pre><code>FileOutputStream fileOutStream = openFileOutput(filepath,
Context.MODE_PRIVATE);
mBitmap.compress(Bitmap.CompressFormat.PNG, 90, fileOutStream);
fileOutStream.close();
</code></pre>
<p>(the type of Bitmap is a Bitmap)</p>
<pre><code>FileInputStream fileInStream = openFileInput(filepath);
byte[] fileContent = org.apache.commons.io.IOUtils.toByteArray(fileInStream);
</code></pre>
<p>When I use the same read function, with the same filepath parameter (I verify id), but in another class, it doesn't work. </p>
<p>Is there a limitation when using with another class of the same project ?</p>
<p>Regards</p>
| java android | [1, 4] |
133,710 | 133,711 | receiving string from c# to Java mistakes | <p>I want to send String from C# to Jave
I do it in C# in 2 side like this</p>
<p>Sender: C#</p>
<pre><code>NetworkStream ns1 = _client2.GetStream();
byte[] b = { (byte)2 };//this is the command that sent from client to Server
ns1.Write(b, 0, 1);
string data = "222222222";
byte[] b2 = _AC.GetBytes(data);
ns1.Write(b2, 0, b2.Length);
</code></pre>
<p>Reciever C#</p>
<pre><code> Byte[] b = new byte[10];
ns.Read(b, 0, b.Length);
string Data = _AE.GetString(b);
while (ns.DataAvailable)
{
b = new byte[10];
ns.Read(b, 0, b.Length);
Data += _AE.GetString(b);
}
</code></pre>
<p>I do some coding with no luck in Java .... like this..</p>
<pre><code>byte b = is.readByte();
byte[] buff= new byte[8];
is.read(buff,0,10);
</code></pre>
<p>I receive inside buff[50,50,50,50,50,50,50,50,50];
.....then how to change it to string in java .....
Any help would be great ....thanks</p>
| c# java | [0, 1] |
5,810,647 | 5,810,648 | Refresh Treenode parent to show most current child nodes | <p>I am able to select and expand to a particular tree node programmatically, but unable to refresh it to reflect most current data in the table. Is there Treeview1.Refresh() method ? or something like that to effect? any help will be appreciated. I have a treeview and I am adding child nodes to a parent node by having the user enter data and click on a button. After that insert into the table is done, I want the parent node to refresh and show all child entries.</p>
<pre><code> protected void PopulateNode(Object sender, TreeNodeEventArgs e)
{
switch (e.Node.Depth)
{
case 0:
PopulateChild(e.Node);
break;
default:
//PopulateChild(e.Node);
break;
}
}
protected void PopulateChild(TreeNode node)
{
DataSet ResultSet = RunQuery("Select Id From tbl");
if (ResultSet.Tables.Count > 0)
{
foreach (DataRow row in ResultSet.Tables[0].Rows)
{
TreeNode newNode = new TreeNode();
newNode.Text = row["Id"].ToString();
newNode.Value = row["Id"].ToString();
newNode.PopulateOnDemand = true;
newNode.SelectAction = TreeNodeSelectAction.Expand;
node.ChildNodes.Add(newNode);
}
}
}
DataSet RunQuery(String QueryString)
{
String ConnectionString = "asdasdasdasd";
OleDbConnection DBConnection = new OleDbConnection(ConnectionString);
OleDbDataAdapter DBAdapter;
DataSet ResultsDataSet = new DataSet();
try
{
DBAdapter = new OleDbDataAdapter(QueryString, DBConnection);
DBAdapter.Fill(ResultsDataSet);
DBConnection.Close();
}
catch (Exception ex)
{
if (DBConnection.State == ConnectionState.Open)
{
DBConnection.Close();
}
}
return ResultsDataSet;
}
</code></pre>
| c# asp.net | [0, 9] |
5,040,016 | 5,040,017 | JQuery - Make my script work? | <p>I have written a script. It does work! It's just a bit rubbish. Could someone tell me where I am going wrong.</p>
<p>Basically, I have a 5 star rating box. When the mouse hovers over the various parts of the box I need the stars to change.</p>
<p>Currently the stars only change when you move your mouse over and out of the element. I need the stars to change while the mouses within the element. I think the problem is with the event but I have tried a couple and it seems to make no difference.</p>
<pre><code>$(".rating").mouseover(function(e) {
// Get Element Position
var position = $(this).position();
var left = position.left;
// Get mouse position
var mouseLeft = e.pageX;
// Get Actual
var actLeft = mouseLeft - left;
$(".info").html(actLeft);
if (actLeft < 20) {
$(this).attr('style', 'background-position:0;');
} else if (actLeft < 40) {
$(this).attr('style', 'background-position:0 -20px;');
} else if (actLeft < 60) {
$(this).attr('style', 'background-position:0 -40px;');
} else if (actLeft < 80) {
$(this).attr('style', 'background-position:0 -60px;');
} else {
$(this).attr('style', 'background-position:0 -80px;');
}
});
</code></pre>
| javascript jquery | [3, 5] |
2,969,491 | 2,969,492 | jQuery html(), loading an img tag into a div | <p>When I do the following:</p>
<pre><code>var foo = '<p><img src="tracking.pixel.outside.my.domain /></p>';
$("#outputdiv").html(foo);
</code></pre>
<p>This is what shows up in outputdiv: <code><p></p></code></p>
<p>Is there some reason that this shouldn't work? I'm running out of ideas. I've also tried using innerHTML, to no avail.</p>
| javascript jquery | [3, 5] |
2,371,455 | 2,371,456 | hide/show div on image click with jquery? | <p>I am trying to show/hide div when click on an image. when I click on the image nothing happens. What is wrong with my code</p>
<pre><code><script type="text/javascript">
$('#close').click(function(){
$('#main').show();
$('#login').hide();
});
</script>
<div style="float:right;"><a href="#">Close <img id="close" src="assets/close.png"></a></div>
</code></pre>
| javascript jquery | [3, 5] |
995,056 | 995,057 | Ringtone playing too long | <p>I'm using a RingtoneManager with RingtonePreference. When I use the default Ringtone, there is no problem, but when i use a configured Ringtone, it's playing for minutes... I don't know if the song's duration is minutes or if it plays in a loop... </p>
<p>here my code:</p>
<pre><code>private static void playNotificationSound(Context context) {
RingtoneManager rm = new RingtoneManager(context);
String ringtone = MySharedPreferences.ringtone(context);
Uri uri = null;
if(ringtone == null)
uri = RingtoneManager
.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
else
uri = Uri.parse(ringtone);
if (uri != null) {
Ringtone rt = RingtoneManager.getRingtone(context, uri);
if (rt != null) {
rt.setStreamType(AudioManager.STREAM_NOTIFICATION);
rt.play();
}
}
}
</code></pre>
<p>I use it to play a song with a notification and I don't want the phone to play for 5minutes... </p>
| java android | [1, 4] |
3,233,544 | 3,233,545 | mysql_real_escape_string and jquery | <p>Let say i have a column product name and it has value <code>Shoe's</code>.
When i pick that value from db and use <code>mysql_real_escape_string</code> and placed it in html hidden input it becomes <code><input type='hidden' value='Shoe\'s' id='product_name'></code></p>
<p>When i do <code>$('#product_name').val()</code> it return only <code>Shoe\</code> truncating the <code>s</code> or rest of the value after that. The jQuery is assuming an escaped single quote as a closing quote for attr value.</p>
<p>On solution is to use <code>value=""</code> (enclosed in double quotes) but what if value contains a double quote? So the problem persists.
Any help is appreciated.</p>
<p>Thanks!</p>
| php jquery | [2, 5] |
5,689,208 | 5,689,209 | Site tour for first time user for all pages | <p>What is the best way to identify a user to visit a page in a site for the first time. I've written a script which shows a tour of the page. Since tours should be shown only once. I need to know.</p>
<p>For example consider a domain example.com if a user login for the first time i need to show a tour on the '/' page.. When the user navigates to '/page1' i should show the tour for that page. when the user go backs to '/' i shouldn't show the tour. But when user goes to '/page2' i should show the tour on page2.</p>
<p>I could able to find the first time when the user logs in by a single query.! but How can i do that for each and every page. My idea was to make a query to database every time when the user navigates but i know it's not the best way. </p>
<p>Note: Cookies can be used to track anything.</p>
| php javascript jquery | [2, 3, 5] |
1,606,174 | 1,606,175 | Holding a large collection in memory, for querying | <p>Would it be ok, for example, to hold an IEnumerable in memory, in my ASP.Net app, indefinately?</p>
<p>For example:</p>
<p>Every morning, my asp.net mvc app needs to load data from CSV files.
This data is loaded from a few CSV files, then, using LINQ joins etc.. it's merged into a single, de-normalized collection, of around 500,000 "Things"</p>
<p>The apps sole purpose is to query this data.
Methods like:</p>
<ul>
<li>GetThingsByName </li>
<li>GetThingsByPrice</li>
</ul>
<p>etc...</p>
<p>My idea was to just have a static IEnumerable that the Controller could call upon..?</p>
<p>It would be running on a dedicated server...</p>
<p>Basically, I'm trying to avoid using a database (of any kind, NoSQL or otherwise), as I don't think it's needed, since the data is fairly volatile.</p>
<p>The querying would be done using LINQ.</p>
| c# asp.net | [0, 9] |
5,384,836 | 5,384,837 | jQuery $().html escapes &-sign | <pre><code>var alt = json_data['alt']; // some text
var url = json_data['url']; // some url
var img_url = '<img src=\'/' + url + '?h=100&w=100\' alt=\'' + alt + '\'>';
$('#imagepreview').html(img_url); // translates to <img src="/some_url?h=100&amp;w=100" alt="some_text">
</code></pre>
<p>Why does this happen and how can I prevent this?</p>
| javascript jquery | [3, 5] |
5,254,034 | 5,254,035 | W3.org validation stuck on one inline javascript attribute, how to fix it? | <p>I have a website with the following code for a specific element:</p>
<pre><code><textarea id="textToTranslate" onfinishinput="dothis()" rows="5"></textarea>
</code></pre>
<p>onfinishinput waits for the user input and check if he is stopped. If he stop typing, the function dothis is called throught $('#waitUserInput').live() function.
The tricky part of my question is, how to change the above line to be completely jQuery.</p>
<p>The jQuery dat correspont to the dothis() function is the following:</p>
<pre><code>// Detect if user input stops
$('#waitUserInput').live("keyup", function(e)
{
startTypingTimer($(e.target));
});
var typingTimeout;
function startTypingTimer(input_field)
{
if (typingTimeout != undefined)
clearTimeout(typingTimeout);
typingTimeout = setTimeout( function()
{
eval(input_field.attr("onfinishinput"));
}
, 250);
}
</code></pre>
<p>Javascript dothis() function:</p>
<pre><code>function dothis(){
// Ajax call when called
{
</code></pre>
<p>Now, when I go to <a href="http://validator.w3.org" rel="nofollow">http://validator.w3.org</a>, I have one error, and yes it is about the above code:
<strong>Attribute onfinishinput not allowed on element textarea at this point.</strong></p>
<pre><code><textarea id="textToTranslate" onfinishinput="dothis()" rows="5"></textarea>
</code></pre>
<p>The question is, is it possible to turn the onfinishinput javascript attribute out of the textarea, but so that is is functioning the same?</p>
<p>I know it is a little complex, but I hope someone can help.</p>
| javascript jquery | [3, 5] |
760,873 | 760,874 | How to add attribute when onclick event in asp.net | <p>Hi how can i add attribute into a button when button is clicked?</p>
<p>this is the attribute <code>dojotype="dijit.form.Button"</code></p>
<pre><code>void ButtonLogin_OnClick(object sender, EventArgs e)
{
// the add attribute
}
</code></pre>
<p>this is my button</p>
<pre><code><button id="ButtonLogin" runat="server" onServerClick="ButtonLogin_OnClick" jsid="ButtonLogin" style="float: right;
padding: 5px 15px 0px 0px;">
Login</button>
</code></pre>
| javascript jquery asp.net | [3, 5, 9] |
22,607 | 22,608 | Converting C# app to Android - How to extend List<> | <p>I'm converting an app someone else wrote to Android.</p>
<p>One of the classes is declared like so:</p>
<pre><code>public class PowerList : List<PowerEvent>
</code></pre>
<p>How would I do this in Java for Android? If I do this:</p>
<pre><code>public class PowerList extends List<PowerEvent>
</code></pre>
<p>I get errors - </p>
<pre class="lang-java prettyprint-override"><code>"The type List<PowerEvent> cannot be the superclass of PowerList; a superclass must be a class"
</code></pre>
| c# java | [0, 1] |
5,256,209 | 5,256,210 | Execute a function with sliding delay | <p>Say I have an html page which diplays a list of some elements. There is a textbox which allows the user to filter the elements. To update the displayed elements, I need to do an ajax call to retrieve the elements that match the filter value. I want the ajax call to be executed two seconds after the last letter was typed in the filter textbox. I know about <code>settimeout</code> but I want the two second delay to be "sliding", meaning that if within the two second delay period the user types another letter, then I want to reset the delay. How would I go about that? </p>
<p>Thanks in advance.</p>
| javascript jquery | [3, 5] |
5,049,923 | 5,049,924 | FadeIn and FadeOut when dynamically loading with php | <p>I want to fadeOut the current big picture in the #inner_left div by clicking one of the thumb pics in the #photo1 div.The thumb images are loaded with php.Currently the loading of the pictures works on click normally but I want them to fadeout and fadeIn when clicked on the next thumb.For now this is what I have in my jquery part..</p>
<pre><code>$('#photo1 img').click(function(){
$('#inner_left img').attr('src',$(this).attr('big')); });
</code></pre>
<p>and the php part which loads the thumbs:</p>
<pre><code> foreach($imagess as $image){
if($image['image_th_source'] != '' && $image['image_source'] != ''){
echo '
<div id=photo1>
<a href="#"> <img src="'.$image['image_th_source'].'" alt="'.$image['image_alt'].'" title="'.$image['image_title'].'" big="'.$image['image_source'].'" /></a>
</div>
';
}
}
</code></pre>
<p>please help if you can!</p>
| php jquery | [2, 5] |
2,361,650 | 2,361,651 | How to Get Form Values in ASP.Net When Using Jquery.post | <p>I am using the following scrip to post data into ASP.Net</p>
<pre><code>$.post(window.location, { name: "John", time: "2pm" })
</code></pre>
<p>In my page_load event , I am checking Request.Forms.AllKeys but the count is comming as zero.</p>
<p>My form is
<code><form name="aspnetForm" method="post" action="Default.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm"></code></p>
| asp.net javascript jquery | [9, 3, 5] |
549,672 | 549,673 | Binding dropdownlist | <p>I have got a requirement to bind a dropdownlist using db values.I gave that dropdownlist datasource as a list of class, ie <code>ddlUser.datasource=List <User>;</code></p>
<p>The class user contains following properties <code>UserID</code>, <code>Firstname</code> and <code>Lastname</code>. </p>
<p>Its datavalue field is <code>UserID</code>. </p>
<p>I want to show the text of dropdown as a string ie <code>Firstname+" " + Lastname</code>.</p>
| c# asp.net | [0, 9] |
3,604,046 | 3,604,047 | disable js script with jquery or js | <p>in one page function i want disable js script.</p>
<p>How make that?</p>
<p>I try jquery: hide(), but this not' work</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
1,390,432 | 1,390,433 | Compare jQuery Arrays with multiple DOM elements | <p>Consider this:</p>
<pre><code><div class="test">one</div>
<div class="test">two</div>
<script>
var i1 = $('.test');
var i2 = $('.test');
console.log( i1 == i2 );
console.log( i1 === i2 );
console.log( i1.is(i2) );
</script>
</code></pre>
<p>They all print <strong>false</strong> although they contain the same elements. One would think that <code>.is()</code> would work for comparing but it doesnt. How would you compare two jQuery objects?</p>
| javascript jquery | [3, 5] |
1,826,700 | 1,826,701 | javascript file storing | <p>I have stored javascript files in the header.php of my project page. And overtime this has grown to lot of files. Need a help from senior member who can guide me how to store these? I looked all over net could not find anything on this. So this is my last stop.
Should these be stored in header.php(so what i am doing is correct?). Should these be stored individually on the .php pages that are using them? Or is there another better and more efficient way to do this?
(i do have some prototype and scriptaculous files also)</p>
<pre><code><script type="text/javascript" src="javascript/prototype.js"></script>
<script type="text/javascript" src="javascript/scriptaculous.js"></script>
<script src="javascript/jquery-1.6.1.min.js"></script>
<script type="text/javascript">
jQuery.noConflict();
</script>
<script type="text/javascript" src="javascript/jquery.colorbox.js"></script>
<script type="text/javascript" src="javascript/friends.js"></script>
<script type="text/javascript" src="javascript/site.js"></script>
<script type="text/javascript" src="javascript/search.js"></script>
<script type="text/javascript" src="javascript/settings.js"></script>
<script type="text/javascript" src="javascript/inbox.js"></script>
<script type="text/javascript" src="javascript/profile.js"></script>
<script type="text/javascript" src="javascript/color_picker.js"></script>
<script type="text/javascript" src="javascript/load_more.js"></script>
<script type='text/javascript' src='javascript/jquery.bgiframe.min.js'></script>
<script type='text/javascript' src='javascript/jquery.Queue.js'></script>
<script type='text/javascript' src='javascript/jquery.autocomplete.js'></script>
</code></pre>
| php javascript | [2, 3] |
5,093,957 | 5,093,958 | Javascript variable evaluation in a map | <p>I'm attempting to pass some data via the jQuery's <code>$.post()</code> and I'm running into some problems with, what I can only classify as, variable evaluation in the data map. Lets get to it:</p>
<pre><code>var field = 'fooVar';
var value = 'barVar';
$.post('/path/to/url', { field:value, 'fooString':'barString' });
</code></pre>
<p>The end result is a POST with the following values:</p>
<pre><code>// Actual result
field = barVar
fooString = barString
// Expected result
foo = barVar
fooString = barString
</code></pre>
<p>I expected "field" to be evaluated as the variable "foo" in the data map, but it is not. What I've been able to discern is that the single quotes on the "key" are optional, therefore leaving them out does not cause the variable to evaluated. </p>
<p>I have also tried the following for giggles with the amount of luck:</p>
<pre><code>$.post('/path/to/url', { "'" + field + "'":value, 'fooString':'barString' });
$.post('/path/to/url', { eval(field):value, 'fooString':'barString' });
</code></pre>
<p>I'm stumped. Thanks for any help you can provide or even just a firm "no" so I can get on with my life, safe in the knowledge someone more versed has my back would be appreciated. :)</p>
| javascript jquery | [3, 5] |
354,026 | 354,027 | Removing <script> tag - PHP | <p>How to change all the occurrence of the <code><script> <Script> <scRipT> <sCrIpT> and so ..</code> to <code>&lt;script&gt; &lt;Script&gt;</code> with PHP<br>
I also want to remove </p>
<p>The input will be taken from a WYSIWYG Editor, so i can not use the strip_tags function.</p>
<p><code>Edit 2</code><br>
Is there any other way a user can execute a javascript with some kind of strange characters to<br>
I found this on internet </p>
<pre><code><scr<!--*-->ipt>
alert('hi')
</script>
</code></pre>
<p>But it did not worked though, is there any such possibilities ?</p>
| php javascript | [2, 3] |
4,084,353 | 4,084,354 | String encoding in android | <p>I need to encode string in android but it doesn't work . I don't know which encoding should I do .I need to display <strong>"Ruzyn\u011b (PRG)"</strong> on textview but it display same as look without encoding .Is there any help ??</p>
| java android | [1, 4] |
5,847,547 | 5,847,548 | Add Row Values to DataTable Having AutoIncreamented DataColumn | <p>I want to add a row in a DataTable having a Data Column which has an auto Increament Property. </p>
<pre><code>DataTable tblproduct = new DataTable();
DataColumn CartItemId = new DataColumn();
CartItemId.ColumnName = "CartItemId";
CartItemId.DataType = System.Type.GetType("System.Int32");
CartItemId.AutoIncrement = true;
CartItemId.AutoIncrementSeed = 1;
CartItemId.AutoIncrementStep = 1;
CartItemId.ReadOnly = true;
CartItemId.Unique = true;
tblproduct.Columns.Add(CartItemId);
tblproduct.Columns.Add("CampaignId", typeof(int));
tblproduct.Columns.Add("SubCatId", typeof(int));
tblproduct.Columns.Add("Size", typeof(string));
tblproduct.Columns.Add("Qty", typeof(int));
tblproduct.Rows.Add(3, 345,"Hello", 1);
tblproduct.Rows.Add(5, 3455,"Hecfghhgdfllo", 8);
</code></pre>
<p>I don't want to insert the values in Autoincreamented column. It should be Autogenerated value but above code didn't work for me.</p>
| c# asp.net | [0, 9] |
5,820,655 | 5,820,656 | Jquery Cycle plugin. Command Prev not working | <p>I'm having trouble getting the Jquery Cycle plugin to work. My code is below. Whats happening is the Next button is going through the slides sequentially, however when I press previous, it goes previous starting from the last image in the sequence. I dont want it to automaticly play which is why on my document.ready function I call the pause command. </p>
<p>Any help will be appreciated.</p>
<p>-Sam</p>
<pre><code><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<!-- include Cycle plugin -->
<script type="text/javascript" src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.latest.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.main').cycle({
fx : 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
});
$(".main").cycle("pause");
});
</script>
// extra page code not shown //
<div class="main" id="main">
<img src="../images/design/beautiful1.jpg" height=600 width=500>
<img src="../images/design/beautiful2.jpg" height=600 width=500>
<img src="../images/design/beautiful3.jpg" height=600 width=500>
<img src="../images/design/beautiful4.jpg" height=600 width=500>
</div>
</body>
<div class="label" id="nextbutton"><img src="../images/nextarrow.jpg"></div>
<div class="label" id="prevbutton"><img src="../images/prevarrow.jpg"></div>
<script>
$("#nextbutton").live("click",function(){
$(".main").cycle("next");
}
);
$("#prevbutton").live("click",function(){
$(".main").cycle("prev");
}
);
</script>
</code></pre>
<p></p>
| javascript jquery | [3, 5] |
5,896,737 | 5,896,738 | jquery calculate html values next to checked checkboxes | <p>My head is not thinking right today. Could any of you help? =)
Only checked int values in second column need to be calculated and alerted in sum.</p>
<pre><code><table width="100%">
<tr><td>Product Name</td><td>Price $</td></tr>
<tr><td><input type="checkbox"> Product 1</td><td>200</td></tr>
<tr><td><input type="checkbox"> Product 2</td><td>300</td></tr>
</table>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$('input').change(function() {
var sum = 0;
$("input:checked").each(function(){
sum += parseInt($("input:checked").closest('td').next().html());
});
alert(sum);
});
</script>
</code></pre>
<p>Thanks.</p>
| javascript jquery | [3, 5] |
2,694,455 | 2,694,456 | How to get an element that was appended by before method? | <p>the source example is kind of this</p>
<pre><code>// block with caption
var caption_block = "<div class='caption-block'><h1>"+ options.title + "</h1><div class='pages'><a href='/' id='left_pg'></a><div id='counter'>"+ (i+1)+'/'+(elms+1)+"</div><a href='/' id='right_pg'></a></div></div>";
// put the elemnt with caption into the DOM
$('ul.slider').before(caption_block);
// by click in #counter TEST
$('a').bind('click',function(){
$('#slider').find('#counter').text(" TEST ");
});
</code></pre>
<p>Unluck, but it's don't do anything at all.</p>
<p>The script can't find a <code>div#counter</code>. How to get it?</p>
<p>the html looks like</p>
<pre><code><div id="slider"><ul class="slider" /></div>
</code></pre>
| javascript jquery | [3, 5] |
260,787 | 260,788 | Why does the whole page refresh when I use jQuery to increase or decrease the font size? | <p>I have a HTML page where I want one button to increase the font size and the same button to decrease the font size when clicked.</p>
<p>I am using jQuery like so:</p>
<pre><code>$("p").css("font-size","20")
</code></pre>
<p>However, when I do that the font size increases for maybe 2 seconds and then goes back to normal. It appears that the page is refreshing after I click the button... Why is that?</p>
| javascript jquery | [3, 5] |
2,081,892 | 2,081,893 | How to reference the inner text of a drop down box | <p>im trying to check for a specific word in a dropdown box before sending an SMS
this is what i have </p>
<p><code></p>
<pre><code> if (grdvHandSets.Rows[i].Cells[4].Text == "Port" && grdvHandSets.Rows[i].Cells[16].Text != String.Empty) //Only send SMS if Type = Port and ConDate isnt empty
{
SmsBody = string.Format("Your order has been despatched to" + lblDespatchPostCode.Text + ". via Royal Mail next day special delivery. Your number/s are due to transfer on" + grdvHandSets.Rows[i].Cells[16].Text + ". Kind Regards BPD");
//objSms.SendSms(phonenum, SmsBody);
}
</code></pre>
<p></code></p>
<p>Its the first part where im saying grdvHandSets.Rows[i].Cells[4].Text == "Port" which is a drop down box i thought text would work but it comes up with "" when im debugging.... any help?</p>
| c# asp.net | [0, 9] |
2,877,547 | 2,877,548 | convert a string to javascript object | <p>I have the following string</p>
<pre><code>":All;true:Yes;false:&nbsp"
</code></pre>
<p>I want to convert is to an object like:</p>
<pre><code>var listItems =
[
{itemValue: "", itemText: "All"},
{itemValue: true, itemText: "Yes"},
{itemValue: false, itemText: "&nbsp"}
];
</code></pre>
<p>Any elegant way to doing this appreciated.</p>
| javascript jquery | [3, 5] |
2,900,588 | 2,900,589 | Get information from website for Android | <p>I want to make an application that compare pizza prices. To do that I have to go to the actual site and enter and search. How can I display the prices WITHOUT the user seeing the actions of going to the website and entering a search. Would I use a WebView and a WebViewClient?</p>
| java android | [1, 4] |
3,945,990 | 3,945,991 | Check if a username has been registered | <p>I am using the builtin ASP.NET logon and user management features. Is there a way to just identify if a username or email address is already registered? I would've thought it's part of FormsAuthentication or similar, but can't find such a function.</p>
| c# asp.net | [0, 9] |
4,957,538 | 4,957,539 | Need suggestions to create a chat application | <p>This question may sound stupid. I need suggestions from you guys to create a chat application using asp.net. The thing where I am confused is that there are many techniques in asp.net such as MVC, AJAX and many more (I dont know about them, been aware through many tutorial sites). So I dont know which technique to use. I will just explain the chat application which I am creating to you guys so that you can give some suggestions:</p>
<blockquote>
<p>-- It should be just like gmail chat application<br>
-- The chat messages should be stored in a Database<br>
-- There should be two tabs, one for important chat and other for casual chat (Both should be store in database)<br>
-- This chat application will be integrated to existing website.</p>
</blockquote>
<p>So, my question is simple which technique of asp.net should I use to make it more efficient(or simple to understand). I am a trainee and I have only visual studio 2010. (This is my main project) The things I know are Basics of ASP.net, ado.net, c#.net, jquery, css, html and javascript. </p>
| c# asp.net | [0, 9] |
3,503,634 | 3,503,635 | How to Read the value in a hiddenField from javascript | <p>I want to read a value in the hidden field in javascript/Jquery.How can i acheive this ??</p>
| c# javascript asp.net | [0, 3, 9] |
3,055,064 | 3,055,065 | block UI when postback | <p>how to block UI when postback from buttons in form or in updatepanel and show "processing...". after return postback unblock UI.</p>
<p>may be jquery plugin?</p>
| jquery asp.net | [5, 9] |
5,753,508 | 5,753,509 | database not working with 2.2,working good with 2.3 and Higher Version | <p>my app working on 2.3 and higher version good bt on 2.0 or 2.2 it gives error like "android sqlite returned error code 1 no such table" please help.</p>
| java android | [1, 4] |
5,362,787 | 5,362,788 | pass the e.target to a function thats called when element is clicked | <p>I am trying to pass the clicked event (event.target) to a function inside a function that is being called when clicked how would i do this?</p>
<pre><code>function showGrid(){
updateTag()
}
function updateTag(){
/*how do i get the event.target passed here? */
alert(e.target)
}
$(".gridViewIcon").click(function(e) {
showGrid();
});
</code></pre>
| javascript jquery | [3, 5] |
5,383,378 | 5,383,379 | jquery: find out at which position (order) a particular element is among its neighbors | <p>I think this should be simple but I haven't been able to figure it out:</p>
<p>I have a container with a couple of children:</p>
<pre><code><div id='container'>
<div id='one'>some</div>
<div id='two'>random</div>
<div id='three'>text</div>
</div>
</code></pre>
<p>I want to be able to know the position of say element $('#two')... which should return 2 (as the element is the second of the container's children, $('#one').... should return 1 and so on.</p>
<p>Thanks a lot in advance,</p>
<p>Martin</p>
| javascript jquery | [3, 5] |
1,261,627 | 1,261,628 | program of different ratio of android scrren device | <p>currently, i was work in my emulator which was 3.2in HVGA. it will display same size of content in the 3.2inch device but it will different size of content in the different screen ratio android device?</p>
<p>my question is, how to i set the content fit the different screen ratio and display same size of content in all different screen ratio.</p>
| java android | [1, 4] |
1,100,331 | 1,100,332 | looping through dynamically created controls in jquery | <p>I'm trying to use the following loop to loop through dynamically created controls on my web form:</p>
<pre><code> for(x = 0; x <= count; x++) {
Stmt += $("#DDLColumns" + x).val();
switch($("#DDLConditional" + x).val()) {
case "is equal": Stmt += " = ";
break;
case "begins with": Stmt += " LIKE '%";
break;
};
Stmt += $("#WhereText" + x).val();
Stmt += ", ";
}
</code></pre>
<p>and this is producing undefined and nulls as output from the val() functions. What am I doing wrong here?</p>
| javascript jquery | [3, 5] |
1,562,585 | 1,562,586 | need to access FileUpload control inside static method without passing paremeters | <p>I need to access FileUpload control inside static method without passing parameters.</p>
| c# asp.net | [0, 9] |
5,123,549 | 5,123,550 | A smoother alternative to jQuery show() and hide() | <p>I have a page setup with a hidden column using the jQuery show() and hide() functions to slide the column in and out.</p>
<p>However it's kind of "clunky" and does not look very smooth when showing/hiding; in contrast I also have a section of the page using jquery UI accordion. When switching between these sections the transition looks very nice and smooth...</p>
<p>Is there a better function than show()/hide() which looks as nice as the accordion does? (maybe the "easing" parameter can be used in the show/hide functions, but i'm not sure how to use this properly?)</p>
| javascript jquery | [3, 5] |
670,280 | 670,281 | At Least One input must need to fill in DIV jQuery | <p>I have form in which there are 5 inputs </p>
<p>I need to check From their inputs at least one must be fill on Button Click using JQuery.</p>
<pre><code><div id='myForm'>
<input name="baz" type="text" />
<input name="bat" type="text" />
<input name="bab" type="text" />
<select name="foo">
<option value=""></option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<select name="bar">
<option value=""></option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<input type='button' value='submit' onclick='return chk();'/>
</div>
<script>
function chk()
{
// i need to check here
alert('i wan to to check it here')
}
</script>
</code></pre>
| javascript jquery | [3, 5] |
682,326 | 682,327 | How to get array if value in array exists. Jquery | <p>If the <code>"id":"236"</code> exists in <code>spConfig['attributs'][125]['options']</code> get the array that is contained in.</p>
<p>How would you do this in jQuery ?</p>
<pre><code>var spConfig = {
"attributes": {
"125": {
"id": "125",
"code": "pos_colours",
"label": "Colour",
"options": [{
"id": "236",
"label": "Dazzling Blue",
"price": "0",
"oldPrice": "0",
"products": ["11148"]
}, {
"id": "305",
"label": "Vintage Brown",
"price": "0",
"oldPrice": "0",
"products": ["11786", "11787", "11788", "11789", "11790", "11791", "11792", "11793"]
}]
}
}
</code></pre>
| javascript jquery | [3, 5] |
3,478,781 | 3,478,782 | Image auto reload with a fade or preload? | <p>So I've got a basic system set up to reload webcam jpgs at a regular interval, but it's weird to see the file load. I'd rather have one fade into the other or at least wait for the whole image to load before it swaps the other one out.</p>
<pre><code> $(document).ready(function() {
setInterval('updateCamera()',1000);
});
function updateCamera() {
$('#camera').attr('src','cam_1.jpg?'+ new Date().getTime());
}
</code></pre>
<p>Here is the site, click on "Live Feed" www.graysonearle.com/frogutopia Any ideas?</p>
| javascript jquery | [3, 5] |
115,343 | 115,344 | LightBox bug on opening | <p>Hi while developing a lightbox for a website it seems I made an error in the creation of my code somewhere.If I click the lightbox two times it works normaly and everything is well.But when I try to open it a third time a bug seems to interfere.I have posted the code for the entire website on jsFiddle :</p>
<p><a href="http://jsfiddle.net/Ywpdh/" rel="nofollow">http://jsfiddle.net/Ywpdh/</a> </p>
<p>Pay attention only on the "Login" button on the top right corner.When the Login button is clicked the lightbox appeares you can close it by clicking on the top right rectangle.The bug only appeares after the login button is clicked a third time.At this point the small rectangle seems to behave as if it's container is given the overflow:hidden property something that is not true.I have tested the code on all modern browser I get the same bug.Can someone please tell me what's going on?</p>
| javascript jquery | [3, 5] |
4,651,228 | 4,651,229 | How to Add Horizontal line in Javascript | <p>I would like to add a horizontal seperating line on a dynamic populated table. How do I do this? Below is a snippet.</p>
<pre><code> function addNewRow() {
$('#displayTable tr:last').after('<tr><td style="font-size:smaller;" class="dataField1"></td><td style="font-size:smaller;" class="dataField2"></td><td style="font-size:smaller;" class="dataField3"></td></tr>');
var $tr = $('#displayTable tr:last');
$tr.find('.dataField1').text($('#txtName').val());
$tr.find('.dataField2').text($('#txtAddress').val());
$tr.find('.dataField3').text('document.write("<tr><td colspan=\"2\"><hr \/><\/td><\/tr>");
}
</code></pre>
| javascript jquery | [3, 5] |
4,113,247 | 4,113,248 | How can I load a PHP file every 5 seconds with JavaScript | <p>I want a php program to be executed every 5 seconds using JavaScript. How can I do that?</p>
<p>I tried using: </p>
<pre><code><script type="text/javascript">
setInterval(
function (){
$.load('update.php');
},
5000
);
</script>
</code></pre>
<p>But it doesn't work.</p>
| php javascript jquery | [2, 3, 5] |
654,426 | 654,427 | is there any way findout duplicate id name in the page using jquery | <p>my script is :</p>
<pre><code>$('document').ready(function () {
var position = 0;
var data = [{'id':'user1'},{'id':'user2'},{'id':'user3'},{'id':'user4'},{'id':'user5'}];
$('#add').click(function() {
var newdiv=$('<div></div>').attr('id', data[position].id).text(data[position].id);
$("#container").append(newdiv);
position++;position %= data.length;
});
});
</code></pre>
<p>My html is:</p>
<pre><code><html>
<body>
<button id="add">Add new div</button>
<div id="container"><div id="user3"></div></div>
</body>
</html>
</code></pre>
<p>when click a button i am appending new divs with some id name here before insert div i want to check all div id names if anything matches i don't want to append that div</p>
<p><a href="http://jsfiddle.net/sureshpattu/nfQWx/7/" rel="nofollow">my jsfiddle is here</a></p>
| javascript jquery | [3, 5] |
1,626,756 | 1,626,757 | Should I prefix with this.myPrivateMethod if the name is same as public method? | <p>I am using the module pattern like:</p>
<pre><code>BLAH = ( function() {
var someMethod = function(data) {
};
return {
someMethod: function(data) {
this.someMethod(data);
}
}
})();
</code></pre>
<p>Inside the public someMothod, is it good practise to reference the inner function using <code>this</code>?</p>
<p>Does it matter or it's just makes things clearer?</p>
| javascript jquery | [3, 5] |
4,373,684 | 4,373,685 | jQuery mouseout onto anything but <ul> | <p>So I made my own right click context menu, and I have expandable options on the right click menu when you hover over them. I want the expanded menu to close if the mouse leaves the right click menu so I used the following code:</p>
<pre><code> $('ul').live('mouseout', function(event) {
// close code here
});
</code></pre>
<p>But the problem is the event gets called every time I move the mouse onto any of the <code><li></code> elements.</p>
<p>How do???</p>
| javascript jquery | [3, 5] |
5,088,949 | 5,088,950 | Scrollview's direct Host adding probelm | <p>When there is error of "scroll view can host only one direct child", I add one host Linear layout so all the child LL are become disappear so how can I add scroll view and It's direct host so my Data does not being disappear? </p>
| java android | [1, 4] |
5,164,658 | 5,164,659 | menu.add in java won't take NONE as valid integer | <p>As the title says, I'm trying to add an item to a menu using the <code>menu.add()</code> method. The args for this are: <code>menu.add(int groupId, int itemId, int order, int titleRES)</code>. The docs say that for <code>groupId</code> and <code>order</code> the value <code>NONE</code> can be attributed to them if they are not required. Eclipse won't accept NONE as a valid integer value however. </p>
<p>Can anyone help me with this?</p>
<p>There's not much point posting a code snippet!</p>
| java android | [1, 4] |
3,623,830 | 3,623,831 | API For Playing User's Music? | <p>Is there a way to play music the user has on their device with the sound APIs?</p>
<p>Thanks</p>
| java android | [1, 4] |
3,091,087 | 3,091,088 | Android java.net.UnknownHostException: Host is unresolved (strategy question) | <p>I have android code that uses a background process to routinely (e.g. hourly) connect to a content source on the web to check for updated content. As new users download the app and run it for the first time, it seems (and this is just a "seems at the moment) that in this first-run situation, because the DNS for our servers are not cached already on the device, those first series of connections fail with dreaded UnknownHostException: Host is unresolved. And of course, the application tries again later and (again, "it seems like") it is all working -- perhaps because the OS has had time to actually resolve the address.</p>
<p>So, my question(s) are: (1) Do other Android developers see this behavior with their deployed applications as well? First time, a series of "host unresolved" issues that work themselves out later. (2) Does anyone have a better strategy for "warming up the DNS" so-to-speak so that the first real connections work? or perhaps do you just re-try with some back-off looping when you encounter this exception? I was contemplating having a separate thread that tries to fetch a small text file from our server and have it just loop until it gets it and maybe (not sure about this part) block the other outgoing network connections until it succeeds.</p>
<p>In any event, I have read through a chunk of the answers to various similarly worded questions here on Stack Overflow and I just to assure everyone that</p>
<pre><code><uses-permission android:name="android.permission.INTERNET" />
</code></pre>
<p>is set in my Manifest file :)</p>
| java android | [1, 4] |
117,840 | 117,841 | For Android development, some questions about Java SDK and 32/64 bit versions | <p>I am about to get my feet wet in Android development, and I had some questions about the Java SDK as it pertains to Android coding.</p>
<p>I'm running Win 7 x64 - is it better if I run the 32-bit JDK, or the 64 bit JDK? I've done some searching, and keep finding conflicting answers.</p>
<p>Also, if I'm about to install the SDK, should I uninstall the Java Run Time on my machine first? Does the SDK serve the same purpose? Or do I need both installed at the same time?</p>
<p>Thanks! And I'm sorry if you guys have heard these questions before. (I did try to look up the info first, I promise!) :)</p>
| java android | [1, 4] |
5,614,797 | 5,614,798 | how can i Grab Source code & save it in text file | <p>I need your help to grab the source code of the page & can save it in a text file.</p>
<p><strong>What actually i want!!</strong>
Instead of doing the lot of work like, right click on the page then click on view source code then to copy & paste it in a text file...</p>
<p>I want to make a short, i want to put a link on the page, in which i need to grab a source code, so when i just click on that link let say "Download Code" it grabs the current page source code & save it in a .txt format.</p>
<p>Kindly help me how can i do this?? it would be great if i can achieve this by using a java script, i don't want to use server side programming language.</p>
<p>I tried data URI but dont get the exact what i need</p>
| javascript jquery | [3, 5] |
2,517,526 | 2,517,527 | how to select a li a based on the text using jQuery | <p>How can I select a given li a element so that it is selected by default?</p>
<p>Please refer to this question to see the example that I'm working with...</p>
<p><a href="http://stackoverflow.com/questions/7295346/how-can-i-navigation-up-and-down-a-ul-using-two-buttons">How can I navigation up and down a ul using two buttons?</a></p>
<p>Basically I need to select the Patient Test li a item by default.</p>
| javascript jquery | [3, 5] |
5,778,179 | 5,778,180 | asp.net javascript | <p>I am writing a javascript in asp.net server side (with in a button click event), this script is called if the user id and password matches and it supposed to close current window and open welcome page, but it is not happening. Below is my code, can anyone help me figure out what is the problem?</p>
<pre><code>protected void okbtn_Click(object sender, EventArgs e)
{
account.txtuser = txtuid.Text;
account.txtpwd = txtupwd.Text;
account.login();
if (account.data == true)
{
string script = "<script language='javascript' type='text/javascript'>function f11(){window.close();var strLocation ;var strProfileID ;if (top.opener == null){strLocation = 'YourAccount.aspx';window.location = strLocation;}else{strLocation = 'http://' + top.opener.location.hostname+':'+ window.location.port + '/SendMail/' + 'YourAccount.aspx';top.opener.location = strLocation;top.opener.focus();}}</script>";
ClientScript.RegisterStartupScript(GetType(),"abc", script, true);
}
else
{
Label1.Text = "Invalid user name or password";
}
}
</code></pre>
| asp.net javascript | [9, 3] |
1,596,154 | 1,596,155 | Convert string to specific DateTime format | <p>I've been googling for a while now and for the life of me can't seem to find a solution. I thought this would be easy but it's taking too long and am turning to stackoverflow.</p>
<p>I need to convert a string which contains a date and time to a DateTime variable. I've formatted the string in the exact format I want to store it in but when i convert it to a DateTime it keeps adding the seconds which I don't want. I want it stored as 01/01/2010 09:00AM. Here's the code I've been using so far:</p>
<pre><code>DateTime.ParseExact(startTime,"MM/dd/yyyy hh:mmtt", null);
</code></pre>
<p>..but it keeps appending seconds to it. Please advise.</p>
| c# asp.net | [0, 9] |
2,991,203 | 2,991,204 | how to determine the exact element type/code segment, in real world scenarios of radio buttons | <p>I have a scenario where I want to parse through all the values displayed on screen for a radio button.</p>
<p>Now the radio button can be any one of the following, in coding style--</p>
<pre><code><input type="radio" name="lunch" value="pasta1" /><span>Pasta</span>
</code></pre>
<p>OR</p>
<pre><code><input type="radio" name="lunch" value="pasta1" /><p>Pasta</p>
</code></pre>
<p>OR </p>
<pre><code><input type="radio" name="lunch" value="pasta1" /><ul>Pasta</ul>
</code></pre>
<p>OR <code><input type="radio" name="lunch" value="pasta1" />Pasta</code></p>
<p>Basically I have to deal with any type of real world HTML... While I can get the factual value (="pasta1" for this example) using val(), I want to obtain the text "Pasta" also as shown above, irrespective of whatever tags may be used, in any combination... Is it possible to get such data? At the very least, is it possible to get (for our examples above) the element pointing to <code><p>Pasta</p></code> or <code><ul>Pasta</ul></code> and so on? Then I can try and extract the exact text from that element/node...I can use pure javascript or jquery...</p>
| javascript jquery | [3, 5] |
5,129,578 | 5,129,579 | What is the correct way to create a resized Bitmap from an Uri? | <p>I'm trying to create a resized Bitmap from an Uri.<br>
While searching the web I saw couple of partial examples and only got confused.<br>
What is the correct way to create this task? </p>
<p>Thanks.</p>
| java android | [1, 4] |
5,744,820 | 5,744,821 | How to dynamically add a runat server button in asp.net | <p>Actually, I want to know how to add it's click event.</p>
<pre><code>Button b = new Button();
b.Text = "Go back!";
b.ID = "btn_Back";
b.Click = ??
</code></pre>
| c# asp.net | [0, 9] |
238,763 | 238,764 | find null values in multidimensional associative array | <p>Is there a way to search through an associative array with an unknown number of dimensions and change all the null values to an empty string?</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
3,684,666 | 3,684,667 | javascript -web development | <p>which one is friendly to develop an webpage application, javascript or php.i want to know which will take less memory and provide more security.</p>
| php javascript | [2, 3] |
701,776 | 701,777 | how to create multiple excel sheets | <p>well i have to creat just one excel file and 2 sheets both are fill using a 2 diferent DataTable, it gives the name the user only has to click save, the next code allows me to seend one datatable to one sheet (i am using C#, asp.net, and NOT using Visual Studio, i am writing in the Notepad my code):</p>
<pre><code>string name2="Centroids";
HttpContext context = HttpContext.Current;
context.Response.Clear();
foreach (System.Data.DataRow row in _myDataTable2.Rows)
{
for (int i = 0; i < _myDataTable2.Columns.Count; i++)
{
context.Response.Write(row[i].ToString().Replace(",", string.Empty) + ",");
}
context.Response.Write(Environment.NewLine);
}
context.Response.ContentType = "text2/csv";
context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + name2 + ".csv");
</code></pre>
<p>but i have no idea how to creat the second sheet and use the second DataTable, any ideas of how to find a solution, this way the user has only to save and donwload only one document and not save as many DataTable are in the programa </p>
| c# asp.net | [0, 9] |
768,295 | 768,296 | Generating Javascript from PHP? | <p>Are there any libraries or tools specifically designed to help PHP programmers write Javascript? Essentially, converting the PHP logic into Javascript logic. For instance:</p>
<pre><code>$document = new Document($html);
$myFoo = $document->getElementById("foo");
$myFoo->value = "Hello World";
</code></pre>
<p>Being converted into the following output:</p>
<pre><code>var myFoo = document.getElementById("foo");
myFoo.value = "Hello World";
</code></pre>
<p>So the <code>$html</code> that is passed in won't initially be modified by the PHP. Instead, the PHP will convert itself into Javascript which is then appended onto the end of the <code>$html</code> variable to be ran when the variable it output and converted into the client-side DOM.</p>
<p>Of course it would be excellent if more complicated solutions could be derived too, perhaps converting objects and internal methods into javascript-objects, etc.</p>
| php javascript | [2, 3] |
5,408,154 | 5,408,155 | How to pass javascript object from one page to other | <p>I want to pass javascript object from one page to other page so anyone can tell me how to do it?</p>
<p>Is that possible to do so using jQuery?</p>
| javascript jquery | [3, 5] |
3,286,475 | 3,286,476 | Is there a way to delay an HTTP response in ASP.NET MVC 4 without using Thread.Sleep? | <p>I want to delay the response of my website authentication request so that the server begins responding at a particular seconds offset from when the request was received.</p>
<p>For example, if the user authenticates at <code>04:00:00</code>, I want the response to come back at <code>04:00:05</code>, not sooner nor later. If it is not possible for the code to meet the deadline, I want it to cause an error.</p>
<p>This must be done on the server side and I would like to avoid using <code>Thread.Sleep</code>. Though, I was thinking there may be a way to do this with an async controller and using Thread.Sleep in part of the request's continuation</p>
<p>Has anyone here faced a similar challenge and what was your solution?</p>
<p>Can any of you folks think of a way to do this while avoiding <code>Thread.Sleep</code> and maintaining responsiveness?</p>
| c# asp.net | [0, 9] |
1,569,528 | 1,569,529 | How do I declare "Member Fields" in Java? | <p>This question probably reveals my total lack of knowledge in Java. But let me first show you what I thought was the correct way to declare a "member field":</p>
<pre><code>public class NoteEdit extends Activity {
private Object mTitleText;
private Object mBodyText;
</code></pre>
<p>I'm following a google's notepad tutorial for android (<a href="http://developer.android.com/resources/tutorials/notepad/notepad-ex2.html" rel="nofollow">here</a>) and they simply said: "Note that mTitleText and mBodyText are member fields (you need to declare them at the top of the class definition)." I thought I got it and then realized that this little snippet of code wasn't working.</p>
<pre><code>if (title != null) {
mTitleText.setText(title);
}
if (body != null) {
mBodyText.setText(body);
}
</code></pre>
<p>So either I didn't set the "member fields" correctly which I thought all that was needed was to declare them private Objects at the top of the NoteEdit class or I'm missing something else. Thanks in advance for any help.</p>
<p><strong>UPDATE</strong></p>
<p>I was asked to show where these fields were being intialized here is another code snippet hope that it's helpful...</p>
<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.note_edit);
Long mRowId;
mTitleText = (EditText) findViewById(R.id.title);
mBodyText = (EditText) findViewById(R.id.body);
</code></pre>
<p>So basically the error that is showing up is coming from eclipse:
"The method setText(String) is undefined for the type Object"</p>
| java android | [1, 4] |
5,584,659 | 5,584,660 | How to get the left navigation to follow user as they scroll down the page | <p>Please take a look at this example:</p>
<p><a href="http://jsfiddle.net/3YrDD/" rel="nofollow">http://jsfiddle.net/3YrDD/</a></p>
<p>I'm trying to get the left "SideBar" content to follow the user as they scroll down the "Main content".<br>
Is there a way that I can do this?</p>
<p>thanks</p>
| javascript jquery | [3, 5] |
4,053,788 | 4,053,789 | Where to parse a large txt file ASP.NET | <p>I have a large txt file thar I want to parse in my web application. Earlier, I had the same application as a kind of desktop application, and I did the parsing one time during the Load, and briong the contents of file into memory.<br/></p>
<p>Here in ASP.NET website, I am not sure if I should be doing this in Page_Load() since parsing a 13Mb text file would make this slow for the user everytime. What should I do to bring this one time into memory and then for all the users, the same in-memory parsed contents can be looked up?</p>
| c# asp.net | [0, 9] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.