Unnamed: 0
int64 302
6.03M
| Id
int64 303
6.03M
| Title
stringlengths 12
149
| input
stringlengths 25
3.08k
| output
stringclasses 181
values | Tag_Number
stringclasses 181
values |
---|---|---|---|---|---|
5,494,253 | 5,494,254 | How to Block the user from opening same information in two different tabs/window? | <p>From my application i need to block the user from from opening a same link in two different tabs / windows (link is dynamic one not static ), Since the link generated id basis i wont allow user to open a same id inforation in differnt tabs. so how can i prevent it ? appriciate if any one help</p>
| javascript jquery | [3, 5] |
4,236,306 | 4,236,307 | .NET port with Java's Map, Set, HashMap | <p>I am porting Java code in .NET and I am stuck in the following lines that (behave unexpectedly in .NET).</p>
<p><strong>Java</strong>:</p>
<pre><code>Map<Set<State>, Set<State>> sets = new HashMap<Set<State>, Set<State>>();
Set<State> p = new HashSet<State>();
if (!sets.containsKey(p)) { ... }
</code></pre>
<p>The equivalent <strong>.NET</strong> code could possibly be:</p>
<pre><code>IDictionary<HashSet<State>, HashSet<State>> sets = new Dictionary<HashSet<State>, HashSet<State>>();
HashSet<State> p = new HashSet<State>();
if (!sets.containsKey(p)) { /* (Add to a list). Always get here in .NET (??) */ }
</code></pre>
<p>However the code comparison fails, the program think that "sets" never contain Key "p" and eventually results in OutOfMemoryException.</p>
<p>Perhaps I am missing something, object equality and identity might be different between Java and .NET.</p>
<p><em>I tried implementing IComparable and IEquatable in class State but the results were the same.</em></p>
<p><strong>Edit:</strong> </p>
<p>What the code does is: If the sets does not contain key "p" (which is a HashSet) it is going to add "p" at the end of a LinkedList>.</p>
<p>The State class (Java) is a simple class defined as:</p>
<pre><code>public class State implements Comparable<State> {
boolean accept;
Set<Transition> transitions;
int number;
int id;
// ...
public int compareTo(State s) {
return s.id - id;
}
public boolean equals(Object obj) {
return super.equals(obj);
}
public int hashCode() {
return super.hashCode();
}
</code></pre>
| c# java | [0, 1] |
4,511,675 | 4,511,676 | Postback problem on a submit button ! | <p>I have a page that has 4 tables. Initially when the page is loaded, it shows 1 & 2. Thats working fine. On Post back(When Submit is clicked), it should show 3 &4. Even thats working fine(code shown here). When the submit is clicked again, it has to call updatePaymentInfo() and redirect.. Is there something to write as a condition to call UpdatepaymentInfo() because when submit is clicked, it is taking as an other postback and showing me 3 &4 again. </p>
<pre><code>protected void imgbtnSubmit_Click(object sender, ImageClickEventArgs e)
{
try
{
if (Page.IsPostBack)
{
trtest.Visible = false;
trCCandBilling.Visible = true;
trtest2.Visible = true;
}
else
{
UpdatePaymentInfo();
Response.Redirect(ApplicationData.URL_MERCHANT_ACCOUNT_HOME, true);
}
}
}
</code></pre>
<p>Thanks guys!!</p>
| c# asp.net | [0, 9] |
2,246,777 | 2,246,778 | DecimalFormat Significant Digit pattern throws an exception | <p>I am trying to use the significant digit identifier @ <a href="http://developer.android.com/reference/java/text/DecimalFormat.html#sigdig" rel="nofollow">Shown Here</a> but it throws an IllegalArgumentException and I'm not sure how to use it.
I'm trying to format a calculation result to discard any digits that follow two or more zeros.
ex. 1.234002 should be 1.234</p>
<p>fResult is a float from a previous calculation</p>
<p>This code throws an exception:</p>
<pre><code>String aResult = "";
NumberFormat f = NumberFormat.getInstance(Locale.US);
if (f instanceof DecimalFormat) {
aResult = new DecimalFormat("#.@@@###").format(fResult);
}
return aResult;
</code></pre>
<p>This code does not:</p>
<pre><code>String aResult = "";
NumberFormat f = NumberFormat.getInstance(Locale.US);
if (f instanceof DecimalFormat) {
aResult = new DecimalFormat("#.######").format(fResult);
}
return aResult;
</code></pre>
| java android | [1, 4] |
1,919,158 | 1,919,159 | a website that will compare prices of a yamaha baby grand piano | <p>i would like to design a website that will crawl 100 other websites and post the current prices in ascending order of the same model yamaha baby grand piano. the prices on these sites will appear in simple HTML. the question is will i have to modify my algorithm for every single site, or is there some kind of artificially intelligent tool that can find the product on the given site and give my its price?</p>
| php asp.net javascript | [2, 9, 3] |
1,704,405 | 1,704,406 | jQuery click behaviour | <p>I'm developing a menu. This menu, will change the background image when you click on a link, as almost all menus do. If I click in one link from the menu, this link background will change the color.</p>
<p>My <a href="http://en.wikipedia.org/wiki/JQuery" rel="nofollow">jQuery</a> script is:</p>
<pre><code>$(function() {
$('#menu ul li').click(function() {
$('#menu ul li').removeClass("current_page_item");
$(this).addClass("current_page_item");
//return false;
});
});
</code></pre>
<p>Today, with the "return false" commented, when I click on the link under "#menu ul li" it changes the background open the new page and the background is reset. For sure, if I uncomment the <code>return false</code>, the background works fine but then I cannot open any links. So it looks like after that I open a new page, it resets the classes. How can I make it persistent?</p>
| javascript jquery | [3, 5] |
2,847,695 | 2,847,696 | Android JSONReader no class found | <p>I have an error with android development. In fact i try to parse a JSON flux with stringtree library.
So i import the library in build path but i have this error when i launch my application :
java.lang.NoClassDefFoundError: org.stringtree.json.JSONReader</p>
<p>Have you an idea ?</p>
<p>Best regards</p>
| java android | [1, 4] |
448,947 | 448,948 | Combine two object into one | <p>In javascript I would like to combine two objects into one. I got </p>
<pre><code>{
test: false,
test2: false
}
</code></pre>
<p>and </p>
<pre><code>{
test2: true
}
</code></pre>
<p>I tried to use <code>$.extend</code>, <code>$.merge</code> but all I get as an output is </p>
<pre><code>{
test2: true
}
</code></pre>
<p>How to get output like this</p>
<pre><code>{
test: false,
test2: true
}
</code></pre>
<p>EDIT: Actually I have nested objects. What I need is to combine <code>a</code> and <code>b</code> as follows:</p>
<pre><code>var a = { test: false, test2: { test3: false, test4: false } };
var b = { test2: { test4: true } };
// desired combined result:
{ test: false, test2: { test3: false, test4: true } }
</code></pre>
<p>but the actual result I get removes <code>test3</code> from the nested <code>test2</code> object.</p>
| javascript jquery | [3, 5] |
350,713 | 350,714 | Changing a control's style based on validation (ASP.NET) | <p>I've got a very simple form with the following troubled snippet:</p>
<pre><code><asp:Panel class="normal" ID="Panel1" runat="server">
<strong><asp:Label ID="Panel1Error" class="error" Visible="false" runat="server"/></strong>
<label for="TextBox1"><em>*</em> Don't leave this blank</label>
<asp:TextBox ID="TextBox1" runat="server" />
<asp:RequiredFieldValidator ID="TextBox1RFV" runat="server"
ControlToValidate="TextBox1" ErrorMessage="This field cannot be blank."
Display="None" />
<--- other validators --->
</asp:Panel>
</code></pre>
<p>There are two things I want to do when the page fails validation:</p>
<ol>
<li><p>Change the style of Panel1 (to one which shows different colors to indicate an error). I was able to do this by calling Page.Validate in Page_Load, then iterating over Page.Validators, getting each validator's parent control, casting it to a Panel, then setting .CssClass Doesn't seem like a superb solution, but it got the job done - is there a better way?</p></li>
<li><p>I want to take whatever validation error(s) are thrown and put them in the Panel1Error label, as well as set it to visible. This is where I am a bit baffled. I thought at first I could possibly specify the Label in which a validator writes its ErrorMessage, but I had no such luck. If I just toss the validator inside the Label, its formatting messes up the entire layout of the page, regardless of whether I directly assign it the 'error' CSS class or just leave it in the Label.</p></li>
</ol>
<p>Just to clarify, in production, I would be doing this process for multiple Panels on a page, each with one form element, preventing me from calling the Panels explicitly and just saying Panel1.CssClass, etc.</p>
| c# asp.net | [0, 9] |
5,319,825 | 5,319,826 | Why does IE complain about this js line? | <p>Why does IE complain about this javacript call?</p>
<pre><code>$.get("profile_completeness.php?id=<?php echo($user_id); ?>", function(data) {
var percentage = data.match(/id="percentage_complete" value="(\d+)"/)[1];
alert(percentage);
})
</code></pre>
<p>This works fine in Chrome, and FF but IE throws an exception.</p>
<p>Here is the error I get:</p>
<pre><code>Unable to get value of the property '1': object is null or undefined.
</code></pre>
<p>If I remove the var percentage line the error is gone.</p>
<p>Any ideas why?</p>
| javascript jquery | [3, 5] |
5,142,901 | 5,142,902 | What is the Java equivalent of PHP var_dump? | <p><strong>PHP has a <a href="http://php.net/var_dump" rel="nofollow">var_dump()</a> function which outputs the internal contents of an object, showing an object's type and content.</strong></p>
<p>For example:</p>
<pre><code>class Person {
private $firstName;
private $lastName;
public function __construct($firstName, $lastName) {
$this->firstName = $firstName;
$this->lastName = $lastName;
}
}
$person = new Person('Jon', 'Smith');
var_dump($person);
</code></pre>
<p>will output:</p>
<pre><code>object(Person)#1 (2) {
["firstName:private"]=>
string(3) "Jon"
["lastName:private"]=>
string(5) "Smith"
}
</code></pre>
<p><strong>What is the equivalent in Java that will do the same?</strong></p>
| java php | [1, 2] |
5,790,125 | 5,790,126 | javascript how to make the dropdown value to reset to intiall value(checking the check box) | <p>i have check box in one "tr". and another dropdown control in another "tr"
intially dropdown control will be invisiable intially . </p>
<p>but once the user checks the check box. the dropdown control should be visiable and he can select the value. but again the user unchecks the check box the dropdown should be set to default value that is "--selec--"</p>
<p>"UPDATE MODE" intailly
checkbox.Test = dt.cloumn["state"].tostring();</p>
<pre><code>if(checkbox.Test!= "")
{
checkbox.checked=true;
//then value dropdown value should be shown like"india"
}
else
{
checkbox.checked="false"
//then value dropdown value should be default "--select"
}
</code></pre>
<p>in insert mode checkbox willbe unchecked
in update mode if checkbox in checked then the value of dropdown should be shown"india"
in update mode if checkbox in unchecked then the value of dropdown should be shown default"-select-"</p>
| asp.net javascript jquery | [9, 3, 5] |
785,040 | 785,041 | I need to display XML in jquery parsed from a PHP file | <p>Here is the Parser in PHP it currently displays in PHP and I need a function to display the parsed images in jQuery.</p>
<pre><code>for($y = 0; $y <= 1; $y++){
$featured_channel = array_values($featured_channel);
$arraytotal = (count($featured_channel)-1);
$x = rand(0,$arraytotal);
I want to pull $featured_channel[$x]-> into jQuery and display the images in that.
</code></pre>
| php jquery | [2, 5] |
3,460,146 | 3,460,147 | How to call javascript function/write script inside PHP echo | <p>I have written piece of code, below is the code</p>
<pre><code><script type="text/javascript">
function submitform()
{
document.myform.action='http://mysite/index.php';
document.myform.submit();
}
</script>
<?php
if(isset($_POST['submit_details']))
{
echo "<script typ=javascript> submitform();</script>";
}
?>
<form id="myform">
------
------
<input type="submit" name="submit_details">
</form>
</code></pre>
<p>when i try to submit the form , it gives me error document.myform is undefined, how to solve this error</p>
| php javascript | [2, 3] |
3,082,386 | 3,082,387 | Tryied window.open with Ajax, window.print not working (IE9) | <p>I'm trying to open new window and send form data with javascript and jquery-1.8.3.</p>
<p>With Bernhard's help I succeeded to call a new window with page for print.</p>
<p>(Thank you so much Bernhard. <a href="http://stackoverflow.com/questions/14226470/window-open-and-sending-form-data-not-working">window.open and sending form data not working</a>)</p>
<p>But, <code>window.print()</code> function does not working in IE9! (FF, Chorme do well)</p>
<p>I refreshed the page, then IE9 calls <code>window.print()</code></p>
<p>Here is source code.</p>
<pre><code><a href="#" onclick="printPage()">Print this</a>
<script type="text/javascript" src="/common/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
function printPage(){
$.post('/common/print.jsp', {view:$("#ctn").html()}).success(function(response){
var oWindow = window.open('', "printWindow", "width=700px,height=800px");
oWindow.document.write(response);
oWindow.print(); // I added this line. But IE9 not working.
});
}
</script>
</code></pre>
<p>Is there something I missed?</p>
| javascript jquery | [3, 5] |
5,242,318 | 5,242,319 | EntityDatasource Syntax | <p>I've been looking on the web to find all the operators or syntax that you can use for the EntityDataSource control but i haven't found it on msdn could someone please provide me with the link. much appreciated. The syntax for the SELECT and WEHRE staments or operators </p>
| c# asp.net | [0, 9] |
5,535,328 | 5,535,329 | Sending ASP.NET variable/account information to Android device | <p>I'm using an Android device to display an ASP.NET MVC web application and I was wondering if it's possible to send account information to the android device?</p>
<p>My main goal is to use the users account log-in details to set up a specific save path on the android. If I was able to send the users log-in username to the android device this would be possible. </p>
| android asp.net | [4, 9] |
1,425,898 | 1,425,899 | How to ensure only valid numeric characters are entered into a textbox? | <p>Is there any existing jQuery functionality that can test if characters entered into a textbox are either numeric, or valid in a number?</p>
<p>Such as</p>
<p><code>.00</code> or <code>0.00</code>, but not <code>0.00.00</code> or <code>0a</code></p>
<p>What I'd like to do is catch any invalid characters before they appear in the textbox.</p>
<p>If it's not possible with jQuery, what's the best way to approach this?</p>
<p>I know with JavaScript I can test <code>isNaN()</code> and then return false, but that's going to start getting hairy when I have to account for all possible keystrokes.</p>
| javascript jquery | [3, 5] |
185,601 | 185,602 | OnClick event for whole page except a div | <p>I'm working on an own combobox control for ASP.Net which should behave like a selectbox, I'm using a textbox, a button and a div as a selectbox replacement. It works fine and looks like this <a href="http://www.indiwa.de/technik/screenshots/combobox%5F20090921.gif" rel="nofollow">Image</a>:</p>
<p>My problem now is the Selectbox close behaviour: when clicking anywhere outside the opened selectbox it should close.<br>
So I need something like an onClick event for the whole page which should only fire when my div is open. Any suggest how to do that?</p>
| asp.net javascript | [9, 3] |
975,093 | 975,094 | Storing methods and functions in an array | <p>I dont know if its posible but can I store methods or functions in an array? I know Multi dimensional array now and use it to store many arrays as i want. What i would like to do now is to store the methods or functions I create in a certain class. Because i want to store all of my functions to a certain class then call it if i want using loop. And to make my coding cleaner and easy to understand.
Example:</p>
<pre><code>public String[] getDesiredFunction = {getName(),getLastname(),getMiddle()};
for(int i = 0;i<3;i++){
if(i == 1){
getDesiredFunction[i];
}
}
</code></pre>
<p>like that?
Is it posible?</p>
| java android | [1, 4] |
1,260,667 | 1,260,668 | Loading the Select Box again on clearing the text box field | <p>I have a Select box and a text box to search through the list in the select box. The Select box is getting populated from a database with PHP. What I am trying to achieve here is as soon as clear the text field; the select box should refresh. I have to reload the whole page to do that. Here is the little script that I using to search through select box.</p>
<pre><code>function filterSelectBox(filterButton) {
var searchValue = document.getElementById('selectFilter').value.toLowerCase();
var selectField = document.getElementById("domainID");
var optionsLength = selectField.options.length;
for(var i = 0; i < optionsLength; i++) {
if(selectField.options[i].innerHTML.toLowerCase().indexOf(searchValue) >= 0) {
selectField.options[i].style.display = 'block';
} else {
selectField.options[i].style.display = 'none';
}
}
}
</code></pre>
<p>Here is HTML Elements associated with the code.</p>
<pre><code><div class="search_domains" id="search_domains">
<input type="text" id="selectFilter" name="selectFilter" />
<input type="button" id="filterButton" value="Filter" onClick="filterSelectBox(this)"/>
</div>
</code></pre>
<p>and this is how I am populating the Select box,</p>
<pre><code><select name="domainID" id="domainID" size="15" style="width:175">
<option>Select a Domain</option>
<? foreach ($domains as $row) {
?>
<option value="<?=$row -> id ?>"><?=$row -> domain ?></option>
<? } ?>
</select>
</code></pre>
| php javascript | [2, 3] |
2,848,589 | 2,848,590 | How not to abort http response c# | <p>I need to run several methods after sending file to a user for a download. What happens is that after I send a file to a user, response is aborted and I can no longer do anything after <code>response.end()</code>.</p>
<p>for example, this is my sample code:</p>
<pre><code> Response.Clear();
Response.AddHeader("content-disposition", "attachment; filename=test.pdf");
Response.ContentType = "application/pdf";
byte[] a = System.Text.Encoding.UTF8.GetBytes("test");
Response.BinaryWrite(a);
Response.End();
StartNextMethod();
Response.Redirect(URL);
</code></pre>
<p>So, in this example StartNextMethod and Response.Redirect are not executing. </p>
<p>What I tried is I created a separate handler(ashx) with the following code:</p>
<pre><code>public void ProcessRequest(HttpContext context)
{
context.Response.Clear();
context.Response.AddHeader("content-disposition", "attachment; filename=test.pdf");
context.Response.ContentType = "application/pdf";
byte[] a = System.Text.Encoding.UTF8.GetBytes("test");
context.Response.BinaryWrite(a);
context.Response.End();
}
</code></pre>
<p>and call it like this:</p>
<pre><code>Download d = new Download();
d.ProcessRequest(HttpContext.Current);
StartNextMethod();
Response.Redirect(URL);
</code></pre>
<p>but the same error happen. I've tryied to replace Response.End with CompleteRequest but it doesn't help.</p>
<p>I guess the problem is that I'm using HttpContext.Current but should use a separate response stream. Is that correct? how do I do that in a separate method generically (Assume that I want my handler to accept byte array of data and content type and be downloadable from a separate response. I really do not want to use a separate page for a response.</p>
<p><strong>UPDATE</strong><br>
I still didn't find a good solution. I'd like to do some actions after user has downloaded a file, but without using a separate page for a response\request thing.</p>
| c# asp.net | [0, 9] |
2,312,325 | 2,312,326 | How to implement unobtrusive javascript with dynamic content generation? | <p>I write a lot of dynamically generated content ( developing under PHP ) and I use jQuery to add extra flexibility and functionality to my projects.</p>
<p>Thing is that it's rather hard to add JavaScript in an unobtrusive manner. Here's an example:</p>
<p>You have to generate a random number of DIV elements each with different functionality triggered onClick. I can use the "onclick" attribute on my DIV elements to call a JS function with a parameter but that is just a bad solution. Also I could generate some jQuery code along with each div in my PHP "for" loop, but then again this won't be entirely unobtrusive.</p>
<p>So what's the solution in situations like this?</p>
| javascript jquery | [3, 5] |
4,704,073 | 4,704,074 | button position issue using javascript | <p>I have below two lines of code. show1 and show2 are buttons on my JSP Page that position according to below code. However, button show2 is displayed little lower that button show1. How to resolve this issue. </p>
<pre><code> document.getElementById('show1').style.marginTop="33%";
document.getElementById('show2').style.marginTop="33%";
</code></pre>
| javascript jquery | [3, 5] |
4,922,934 | 4,922,935 | Public class with only public static members | <p>I have a public class that only contains public static members.</p>
<p>I know this is not the best thing to do but I was just wondering why on my Android, if I pause the application, open a few others and come back to mine, all variables seems to be (null).</p>
<p>Questions:</p>
<ol>
<li>Is it because of some kind of a memory release made by Android?</li>
<li>What then could be a better way to keep such variables?</li>
<li>Is a class that extends Application a good option?</li>
</ol>
<p>Here is my code:</p>
<pre><code>public class Session {
public static String ID = null;
public static String UNIQID = null;
public static String TOKEN = null;
public static String SESSIONID = null;
}
</code></pre>
| java android | [1, 4] |
2,021,379 | 2,021,380 | What is the logic to send friend requests and showing notifications? | <p>What is the logic to send friend requests?</p>
<p>I want that with my application's user is able to search for other users and be able to send friend requests to them. I have two tables in my database. One is for user information and another is friendships which stores user id and friends id.</p>
<p>My application is combination of an Android client and PHP web server. In addition, how can I display notifications to a user about his friends' current activities?</p>
| php android | [2, 4] |
1,875,742 | 1,875,743 | Problem in displaying all images inside the folder using javascript | <p><strong>Hi,</strong></p>
<p>For my project I m using jquery bulit in photo slide show,jquery code is taking images from array and displaying the images..The problem is I have a lot of images which I don't want to put it in Array(because it need manual effort) instead of that I want to read each image from the folder and display the images. the advantage of doing so is whenever you want to add more images you need to drop it in folder since you are reading images from folder so need not to do any thing in code level.so it makes your work easier and simpler.. so is there any way to achieve the same using javascript?.</p>
<p>Thanks in Adavance.</p>
| javascript jquery | [3, 5] |
4,397,969 | 4,397,970 | What library to use for XML SOAP Dispatching | <p>At my last place we used to do a lot via XML SOAP - Basically the client would construct an XML request which would contain the service to invoke and send that onto a host and port </p>
<p>The server would then take that service request and figure out the class and method to call and serialise the request / response </p>
<p>This was helpful as we had Java and C# and wanted to segregate the two</p>
<p>If you had to build this out what libraries would you use?</p>
<p>Specifically how the main machine translates a service name => class and method invocation</p>
| c# java | [0, 1] |
4,204,188 | 4,204,189 | How to create a username and password pop-up on Android | <p>How can I create a custom dialog for entering username and password when I press any button on Android?</p>
| java android | [1, 4] |
4,460,442 | 4,460,443 | strange behaviour of java | <p>I have a form named <code>abc</code> with multiple dropdown elements named as <code>splitOption</code>.html of this element is something like this- </p>
<pre><code><select title="Split Delivery for EO2135VX" name="splitOption" onchange="splitDelivery('2','trId2',this.value,'5000','N',this,0,'DIST');">
<option value="" selected=""></option>
<option value="2">Split 2 deliveries</option>
<option value="3">Split 3 deliveries</option>
<option value="4">Split 4 deliveries</option>
<option value="5">Split 5 deliveries</option>
</select>
</code></pre>
<p>When I submit the form and try to get this value in my controller by this code </p>
<pre><code>String[] arrSplitOption = request.getParameterValues("splitOption");
</code></pre>
<p>It gives me <code>arrSplitOption = null</code> in my logs, <strong>this issue is only in mozila</strong>, it's working fine in IE.
I tried to alert the <code>splitOption length</code> just before submitting the form, it gave me correct value.<br>
I don't know what's going wrong.
can any body tell me what could be the reason behind this. </p>
| java javascript | [1, 3] |
564,144 | 564,145 | how to show a dialog box when click on accordin? | <p>I want to show a dialog box when clicking on an accordion header.</p>
<p>If I click ok on the dialog box then it will expand and show the list items, links or content on that particular accordion. If I click cancel then it wont expand the accordion.</p>
<p>Does anyone know how to achieve this? I’m trying with JQuery accordion example, but still not having any success with it.</p>
| javascript jquery asp.net | [3, 5, 9] |
182,622 | 182,623 | jQuery - Create new function on event | <p>In JavaScript/jQuery, if I want to have a function that can run on an element that has been appended to the DOM, it has to be created <em>after</em> the element has been appended to the DOM. How can I do this? I heard one can do this with the jQuery <code>.on()</code> function, but I'm not quite sure how.</p>
<p><em>HTML:</em></p>
<pre><code><span>Hello Stackoverflow</span>
</code></pre>
<p><em>JavaScript:</em></p>
<pre><code>$("span").click(function () {
addMyElement();
});
$("p").click(function () {
removeMyElement(this);
});
function addMyElement() {
$("<p>Hello World</p>").appendTo("body");
}
function removeMyElement(myElement) {
$(myElement).remove();
}
</code></pre>
<p>Example on <a href="http://jsfiddle.net/wowpatrick/wWXrK/5/" rel="nofollow">jsFiddle.net</a>.</p>
| javascript jquery | [3, 5] |
2,153,564 | 2,153,565 | Call C# method in javascript function directly | <p>How to call a c# method in javascript function directly. (eg <code>page_load</code> method of code behind page). Please help me.</p>
| c# javascript | [0, 3] |
3,470,855 | 3,470,856 | How to access object using jQuery and HTML select element? | <p>I have this structure:</p>
<pre><code>var data = {
'horizontal':{
'static':[1,3,5,7,9],
'dynamic':[2,4,6,8]
},
'vertical':{
'static':[1,3,5,7,9],
'dynamic':[2,4,6,8]
}
};
</code></pre>
<p>I have this HTML objects:</p>
<pre><code>Direction:
<select id="direction">
<option value="horizontal">Horizontal</option>
<option value="vertictal">Vertictal</option>
</select>
Type:
<select id="mytype">
<option value="static">Static</option>
<option value="dynamic">Dynamic</option>
</select>
</code></pre>
<p>Can I access to the <code>data.horizontal.static[2]</code> somehow like this?</p>
<pre><code>var result = data.[ $('#direction').val() ].[ $('#mytype').val() ][2];
</code></pre>
<p>Is there any way?</p>
| javascript jquery | [3, 5] |
6,024,174 | 6,024,175 | upload image file without post back in asp.net | <p>Does anybody know how can I upload an image file in a specific folder without post back
using c# .</p>
| c# asp.net | [0, 9] |
5,884,976 | 5,884,977 | make javascript .click(function() with php | <p>I'm trying to make a series of javascript.click functions using on a loop using PHP:</p>
<pre><code>$("document").ready(function()
{
$('#nav > li > a').click(function(){
if ($(this).attr('class') != 'active'){
$('#nav li ul').slideUp();
$(this).next().slideToggle();
$('#nav li a').removeClass('active');
$(this).addClass('active');
}
else{
$(this).next().slideToggle();
$(this).removeClass('active');
}
})
<?php
include_once '../admin/Clases/sql.php';
$sql = new sql();
$res = $sql->check("products","*","1");
$javascript = "";
if($res["ok"]){
foreach($res["tabla"] as $fila)
{
$javascript .="$('#btn_".fila[2]."').click(function(){$('#prod_img').css('background-image','url(".fila[3].")');})";
}
echo $javascript;
}
?>
</code></pre>
<p>but when I run it doesn't work. What am I doing wrong?</p>
| php javascript | [2, 3] |
3,290,309 | 3,290,310 | Jquery: help to get values from data attributes | <p>I have the following markup</p>
<pre><code><a href='#' id="remove_user_from_group" data-user-id="a9a4ae36-c6cd-11e1-9565-910084adb773" data-group-id="e4d66f80-d046-11e1-89b6-16f96811a1bd">x</a>
</code></pre>
<p>And I want to get the data from <code>user-id</code> and <code>group-id</code>.</p>
<p>For now, I have tried:</p>
<pre><code>$this = $(this);
$("#remove_user_from_group").live('click', function() {
var userid = $this.data('user-id');
var groupid = $this.data('group-id');
alert(userid);
alert(groupid);
});
</code></pre>
<p>which pops me 2 alerts with <code>undefined</code> values.</p>
<p>What am I missing here?</p>
| javascript jquery | [3, 5] |
4,431,812 | 4,431,813 | Javascript Code not working when on my site | <p>I recently installed a code on my website to insert text at the position of the cursor. It works perfectly when on its own: <a href="http://www.penpalparade.com/test.php" rel="nofollow">http://www.penpalparade.com/test.php</a></p>
<p>It isn't however working with my site as a whole: <a href="http://www.penpalparade.com/jobs.php" rel="nofollow">http://www.penpalparade.com/jobs.php</a></p>
<p>I've tried to fix it but have been unsuccessful, could someone please please help me at solving it because I've been at it for hours.</p>
| javascript jquery | [3, 5] |
5,081,377 | 5,081,378 | "The server tag is not well formed." What's wrong? | <p>I get the following parser error message. How can I fix this problem?</p>
<blockquote>
<p>The server tag is not well formed.</p>
</blockquote>
<p>Code:</p>
<pre><code><a href="#" class="mySprite id<%# ((int)DataBinder.Eval(Container,"ItemIndex")) % 6 + 1%>">
</code></pre>
| c# asp.net | [0, 9] |
5,539,176 | 5,539,177 | help with jquery ajax success event | <p>I'm having an issue with my update button and jquery ajax. Right now when I click on my update button, it saves whatever updated data to the database. My goal is I want to slide up a message if the update is successful. I was looking at ajax post and using the success event seems like it would work but I dont know how to incorporte it. How would I do this? Would it be something like this?</p>
<pre><code> $(document).ready(function(){
$('#divSuccess').hide();
$('#btnUpdate').click( function() {
alert('button click');
$.ajax({
url: "test.aspx",
context: document.body,
success: function(){
$('#divSuccess').show("slide", { direction: "down" }, 3000);
$('#divSuccess').hide("slide", { direction: "down"}, 5000);
}
});
});
});
</code></pre>
| javascript jquery | [3, 5] |
798,190 | 798,191 | Help with getting two different data types from IEnumerable | <p>I have <code>IEnumerable</code> object with value1 and value2. value2 is an array and value1 is string.
I want to databind this object to Listview like that. So both value1 and value2[0] (always first item in array) could be accessed via <code><%# Eval("value1") %></code> and <code><%# Eval("value2") %></code> . </p>
<p>How to write expression to handle both items ?</p>
<pre><code> ListViewItems.DataSource = f.Items.Select(t => t.value1, t.value2[0]);
ListViewItems.DataBind();
</code></pre>
| c# asp.net | [0, 9] |
811,997 | 811,998 | javascript: $(window).height is not a function | <p>I have some javascript that I am using to resize my background image to fit my window. There are some confusing things going on that I just don't get.</p>
<ol>
<li><p>Firebug and I assume my page doesn't recognize my <code>resizeFrame</code> function unless I place it below the body block. Why?</p></li>
<li><p>Why am I getting the error: <code>$(window).height is not a function</code>?</p></li>
</ol>
<p>Any suggestions or insights would be helpful.</p>
<pre><code><!-- This this placed in <head> block -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script> <!-- This placed below body block -->
jQuery.event.add(window, "load", resizeFrame);
jQuery.event.add(window, "resize", resizeFrame);
function resizeFrame()
{
var h = $(window).height();
var w = $(window).width();
$('body').css('background-size', w + 'px ' + h + 'px' );
}
</script>
</code></pre>
| javascript jquery | [3, 5] |
2,233,343 | 2,233,344 | schedule and Callable | <p>I'm trying to use ScheduledExecutorService inside the main activity, where there are a few user interface controls. Under some circumstances I wish to delay the method invoked by one of them by a second:</p>
<pre><code>ScheduledExecutorService scheduledExecutorService =
Executors.newScheduledThreadPool(5);
ScheduledFuture scheduledFuture = scheduledExecutorService.schedule(new Callable() {
public Object call() throws Exception {
stopSomething();
}
},
1,
TimeUnit.SECONDS);
try {
scheduledFuture.get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
scheduledExecutorService.shutdown();
</code></pre>
<p>Such a snip of code would work in another part of the program, so I know the outline of this solution works at least there. But in the main activity and in other parts of the program where I've tried (where I could actually use it), Eclipse keeps finding something wrong with this:</p>
<p>ScheduledFuture scheduledFuture = scheduledExecutorService.schedule(new Callable() {
public Object call() throws Exception {</p>
<p>If the compile error isn't on <code>Object call() throws Exception</code>, it's on <code>schedule(new Callable()</code>, like right now. </p>
<p>The red line under schedule is "The method schedule(Runnable, long, TimeUnit) in the type ScheduledExecutorService is not applicable for the arguments (new Callable(){}, int, TimeUnit)"</p>
<p>The red line under Callable is "Callable cannot be resolved to a type"</p>
<p>(Maybe .schedule (Runnable task, long delay, TimeUnit timeunit) is a better method to use here? If so, what would account for the error "The method schedule(Runnable, long, TimeUnit) in the type ScheduledExecutorService is not applicable for the arguments (new Callable(){}, int, TimeUnit)"? What does this want? And how would it be composed?)</p>
| java android | [1, 4] |
2,583,688 | 2,583,689 | Skip Standard Error Screen Asp.Net | <p>I have an Application that you need to register in the db to connect to it but if you are not, there is a Error Screen but its really looking ugly as you can see </p>
<p><img src="http://i.stack.imgur.com/nsq08.gif" alt="enter image description here"></p>
<p>I have tried to check if the session where the user ID is saved == null and than clear Content and this is on the start page where every user is connecting first </p>
<pre><code>if (this.Session["SessionId"] ==null)
{
Response.ClearContent();
Response.Write("ERROR");
Response.End();
}
</code></pre>
<p>Why do I get here an error </p>
<pre><code> <system.web>
<customErrors defaultRedirect="~/Error/Error.aspx" mode="Off"/>
</system.web>
</code></pre>
<p>Thanks for help and fast answer </p>
| c# asp.net | [0, 9] |
5,649,130 | 5,649,131 | WebView.getContentHeight() always returns 0 | <p>I'm attempting to display an HTML string in a WebView named webDescription. Because this HTML can sometimes be lengthy, I want to limit the height of the WebView to a maximum dimension and allow the content to scroll within the view.</p>
<p>I am using the following code to wait until the page finishes loading, check the content height and set the height of the enclosing (parent) TableRow to a maximum of 150.</p>
<pre><code> webDescription.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
// do your stuff here
Log.i("EVENTDETAIL", "Web view has finished loading");
Log.i("EVENTDETAIL", "Description content height: " + view.getContentHeight());
if ( view.getContentHeight() > 150 ) {
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, 150);
view.setLayoutParams(params);
}
}
});
</code></pre>
<p>However, view.getContentHeight() always returns 0; thus, the LayoutParams of the parent TableRow never get changed.</p>
<p>Can anyone offer any insight into this and how I might fix my problem? Thanks so much for your consideration.</p>
| java android | [1, 4] |
5,930,215 | 5,930,216 | CS0246: The type or namespace name 'sconnection' could not be found (are you missing a using directive or an assembly reference?) | <p>I am new i asp.net. i create website in asp.net with c# and database sql server 2005 . when i run in visual studio its working fine. But when i run on localhost the error is occurred. Please solve my problem. the error is
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. </p>
<p>Compiler Error Message: CS0246: The type or namespace name 'sconnection' could not be found (are you missing a using directive or an assembly reference?)</p>
<p>Source Error:</p>
<pre><code>Line 15: public partial class _Default : System.Web.UI.Page
Line 16: {
**Line 17: sconnection c = new sconnection();**
Line 18: protected void Page_Load(object sender, EventArgs e)
Line 19: {
</code></pre>
<p>Source File: d:\SIPLWEB\WebSite\Default.aspx.cs Line: 17 </p>
<p>Thanks</p>
| c# asp.net | [0, 9] |
1,537,639 | 1,537,640 | C# SMTP virtual server doesn't send mail | <p>I have got the following Exception : </p>
<pre><code>System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. -
System.Runtime.InteropServices.COMException (0x8004020F):
The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for [email protected]
--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at System.Type.InvokeMember(String name, BindingFlags, invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Type type, Object obj, String methodName, Object[] args) at
System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
</code></pre>
<hr>
<pre><code>public static void SendEmail(string _FromEmail, string _ToEmail, string _Subject, string _EmailBody)
{
// setup email header .
SmtpMail.SmtpServer = "127.0.0.1";
MailMessage _MailMessage = new MailMessage();
_MailMessage.From = _FromEmail;
_MailMessage.To = _ToEmail;
_MailMessage.Subject = _Subject;
_MailMessage.Body = _EmailBody;
try
{
SmtpMail.Send(_MailMessage);
}
catch (Exception ex)
{
if (ex.InnerException != null)
{
String str = ex.InnerException.ToString();
}
}
}
</code></pre>
| c# asp.net | [0, 9] |
2,834,998 | 2,834,999 | Javascript in asp.net masterpage head content seems not working | <p>I'm using a ready made jquery date picker with ASP.NET text boxes. I'm also using MasterPage so here's what I've done so far -</p>
<p><strong>Page linked to Master Page</strong></p>
<pre><code><asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<link href="overcast/jquery-ui-1.8.15.custom.css" rel="Stylesheet" type="text/css" />
<script src="js/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.8.14.custom.min.js" type="text/javascript"></script>
<script>
$(function () {
$("#txtBeginDate").datepicker();
$("#txtEndDate").datepicker();
});
</script>
</asp:Content>
</code></pre>
<p><strong>Two text box controls</strong></p>
<pre><code><asp:TextBox ID="txtBeginDate" runat="server" Placeholder="Select Begin Date"></asp:TextBox> to
<asp:TextBox ID="txtEndDate" runat="server" Placeholder="Select End Date" />
</code></pre>
<p>But when I place cursor into these text boxes, the date picker doesn't show. </p>
<p>Please advice.</p>
| jquery asp.net | [5, 9] |
751,820 | 751,821 | show changes after a refresh | <p>Is it possible to highlight changes in the DOM after each AutoRefresh. What are some different approaches?</p>
<p>Thanks,
rod.</p>
| asp.net jquery | [9, 5] |
2,658,605 | 2,658,606 | Filter selectbox options depending on primary choice | <p>I am creating some selectboxes where i need to restrict my options depending on the choice made in the primary.</p>
<p>Basically i have <code>Select field 1</code> and <code>Select field 2</code>.</p>
<p>Data for these selectboxes are parsed from a database.</p>
<p>Select field 1: </p>
<pre><code>errortype_id | errortype_text
</code></pre>
<p>Select field 2: </p>
<pre><code>errorreason_id | errortype_id | errorreason_text
</code></pre>
<p>Is there a straightforward way i can customsize the option data in <code>Select field 2</code> depending on the choice made in <code>Select field 1</code>? I have the variable/attribute in my <code>Select field 2</code> table to filter.</p>
<p><img src="http://i.stack.imgur.com/ryyZX.png" alt="enter image description here"></p>
| javascript jquery | [3, 5] |
5,620,694 | 5,620,695 | How do I determine height and scrolling position of window in jQuery? | <p>I need to grab the height of the window and the scrolling offset in jQuery, but I haven't had any luck finding this in the jQuery docs or Google. I'm 90% certain there's a way to access height and scrollTop for an element (presumably including the window), but I just can't find the specific reference.</p>
<p>Any help is appreciated! Thanks!</p>
| javascript jquery | [3, 5] |
5,019,527 | 5,019,528 | Disabling right click on images using jquery | <p>I want to know how to disable right click on images using jqeury.
I know only this:</p>
<pre><code><script type="text/javascript" language="javascript">
$(document).ready(function()
{
$(document).bind("contextmenu",function(e){
return false;
});
});
</script>
</code></pre>
| javascript jquery | [3, 5] |
1,099,804 | 1,099,805 | jQuery Calculate Date | <p>Any reason why this is landing on the wrong day?</p>
<p><a href="http://jsfiddle.net/SparrwHawk/MH5wP/" rel="nofollow">http://jsfiddle.net/SparrwHawk/MH5wP/</a></p>
<p>I've written the code below for reference, but it's obviously clearer on jsfiddle</p>
<pre><code><p>Sun / Closed</p>
<p>Mon / Closed</p>
<p>Tues / 9am – 5pm</p>
<p>Wed / 9am – 5pm</p>
<p>Thurs / 9am – 8pm</p>
<p>Fri / 9.30pm – 6.30pm</p>
<p>Sat / 8.30am – 4.30pm</p>
<script>
// Day where 0 is Sunday
var date = new Date();
var d = (date.getDay());
$(function(){
if (d = 1) {
$('p:contains("Mon")').addClass('today');
} else if (d = 2) {
$('p:contains("Tues")').addClass('today');
} else if (d = 3) {
$('p:contains("Wed")').addClass('today');
} else if (d = 4) {
$('p:contains("Thurs")').addClass('today');
} else if (d = 5) {
$('p:contains("Fri")').addClass('today');
} else if (d = 6) {
$('p:contains("Sat")').addClass('today');
} else {
$('p:contains("Sun")').addClass('today');
}
});
</script>
</code></pre>
| javascript jquery | [3, 5] |
4,960,442 | 4,960,443 | Add events to the DOM | <p>I have a trouble creating the DOM:</p>
<pre><code>{
...
DOM = DOM + '<td colspan="3" align="center">';
DOM = DOM + '<div id="primero" onClick(imprimir());> plz </div>';
DOM = DOM + '</td>';
...
$('#test').html(DOM);
}
function imprimir() {
console.log(' ready!');
}
</code></pre>
<p>but that onclick doesn't work. Any ideas?</p>
| javascript jquery | [3, 5] |
372,654 | 372,655 | Sending key value pair object to server side codebehind | <p>Sending key value pair object to server side codebehind .<br/>
How to send from javascript?<br/>
How to receive in C# codebehind.</p>
<h2>Edit 1</h2>
<pre><code><script type="text/javascript">
function ABC()
{
var dict = [];
dict.push({ key: "testkey" ,// Key Value
value: "myVal" // "the value" });
...
</code></pre>
| c# javascript asp.net | [0, 3, 9] |
5,283,054 | 5,283,055 | How to load data while scrolling horizontally and on a DIV overflow? | <p>I’m working on this horizontal scrollbar that grabs content from the database when you scroll to the farthest right. Here's an example of what we want to do:
<a href="http://designarchives.aiga.org/#/entries/+collections%3a%2250%20Books/50%20Covers%20of%202009%22/_/grid/relevance/asc/0/48/120" rel="nofollow">http://designarchives.aiga.org/#/entries/%2Bcollections%3A%2250%20Books%2F50%20Covers%20of%202009%22/_/grid/relevance/asc/0/48/120</a></p>
<p>I found useful tutorial here but its vertical scroll:
<a href="http://www.9lessons.info/2009/07/load-data-while-scroll-with-jquery-php.html" rel="nofollow">http://www.9lessons.info/2009/07/load-data-while-scroll-with-jquery-php.html</a></p>
<p>So far it is working vertically, but how do you load data while scrolling horizontally and on a DIV overflow, not the window?</p>
| php javascript jquery | [2, 3, 5] |
444,056 | 444,057 | Mousedown pageX , pageY is not same after mousemove pageX pageY , happens randomly | <p>I want to create a multi select box (click and drag at empty space then will have a blue div ), but the click and drag is inconsistent and i cant find out the problem.</p>
<p>try to drag from a empty space that is around the bottom right , top right or bottom left and you can see that the light blue box didnt actually start from the point where the mouse down</p>
<p><a href="http://jsfiddle.net/wizztjh/jk4Uc/7/" rel="nofollow">http://jsfiddle.net/wizztjh/jk4Uc/7/</a></p>
| javascript jquery | [3, 5] |
1,292,454 | 1,292,455 | How to check if a variable is set in Javascript? | <p>I have this object/array thing:</p>
<pre><code>var states = {};
states["CA"] = new State("CA", "California");
states["AR"] = new State("AR", "Arizona");
....
</code></pre>
<p>How can I check if <code>states["AL"]</code> has been set or not? Will the following work (in all browsers)?</p>
<pre><code>if (states["AL"] == undefined)
alert("Invalid state");
</code></pre>
| javascript jquery | [3, 5] |
4,866,069 | 4,866,070 | Setting variable to true on click - Doesn't seem to work | <p>I have a page with 2 simple tabs. The tabs are showing if disable_function = false.</p>
<p>At the end of the page I have a simple trigger which I want to set the variable disable_function = true so that the tabs won't work - when ever the trigger is ON.</p>
<p>I tried few ways but it didn't seem to work.</p>
<p>Here is a fiddle if you want to have a look of the code: <a href="http://jsfiddle.net/db7tK/" rel="nofollow">http://jsfiddle.net/db7tK/</a></p>
<p>Thanks in advance.</p>
| javascript jquery | [3, 5] |
5,553,566 | 5,553,567 | Using jquery, what is the simplest function to post some json data and process a returned json response? | <p>When users click on an element in my webpage, I would like to call a javascript function that reads the values of a few text boxes on the page, wraps their contents as json where the keys are the ids for the text boxes and the values are the contents of each text box, and then posts the resulting json to a url. </p>
<p>I would then like the same function to expect back a json response and call another javascript function with the returned json data. </p>
<p>Question:
What is the best way to write the javascript function to create a json structure from html elements, post the json with jquery, and call another javascript function with the resulting json response from the server? </p>
| javascript jquery | [3, 5] |
4,419,147 | 4,419,148 | EXE upload prevention | <p>I need to implement EXE file upload prevention in my project in the same way as it is implemented in gmail (even if EXE file is within a password protected zip file, gmail is able to detect it). What approach should I follow?</p>
| c# asp.net | [0, 9] |
800,357 | 800,358 | Javascript Date Of Birth Textbox | <p>As a novice, I really don't know much about javascript. Kindly help me in developing a similar work-a-like Date-Of-Birth textbox like here in this link : <a href="http://ojas.guj.nic.in/GFJobApply.aspx?sid=wGvtB4mUGuc=&yr=kckKNSEPFLY=&ano=K3JOsteln/k=" rel="nofollow">http://ojas.guj.nic.in/GFJobApply.aspx?sid=wGvtB4mUGuc=&yr=kckKNSEPFLY=&ano=K3JOsteln/k=</a> </p>
| javascript jquery | [3, 5] |
2,307,704 | 2,307,705 | How to properly get String from resources? | <p>Hey, I have a lot of Strings so I put them on a .xml, And I also have an ExpandableListView, and each child refers to a String.<br>
I have named each String in the xml like: "String3_1" .. which means this String is for Group 3 Child 1 in the the ExpandableListView..<br>
When switching activity after clicking in one of the childs, I send the GroupNum and ChildNum and I form the a new String: </p>
<pre><code> Intent myIntent=getIntent();
child = myIntent.getStringExtra("GroupNum");
group=myIntent.getStringExtra("ChildNum");
String finalstring="String"+child+"_"+group;
</code></pre>
<p>Now how I call the String in the resources?<br>
getString(resId) gets the String itself not the title of it so I cant compare it with the finalstring</p>
<p>Thanks. </p>
| java android | [1, 4] |
2,507,355 | 2,507,356 | Loading dynamic HTML | <p>I have a bit of code I've been working with that's a compilation of code written through different sources. I'm a beginner with JavaScript and I'm having issues making some final changes to the code. Instead of loading the text name written in the folder tag, I need to write some HTML. </p>
<p>Here's what I currently have:</p>
<pre><code>$(function () {
$(".folderContent").hide();
//arrange the background image starting position for all the rows.
//This will allow the background image cut illusion when showing the folder content panel
$(".row").each(function () {
$(this).css({
backgroundPosition: "0px -" + $(this).index() * $(this).outerHeight() + "px"
});
});
//when a folder is clicked,
//position the content folder after the clicked row
//and toggle all folder / app icon that is not the one clicked.
//and toggle the folder content panel
$(".folder").click(function (event) {
var folderContent = $(".folderContent");
folderContent.remove();
var folderContentShown = folderContent.css("display") != "none";
var clickedFolder = $(this);
clickedFolder.parent(".row").after(folderContent);
folderContent.find(".folderName").text($(this).text());
$("body").find(".folder, .app").not(clickedFolder).each(function () {
if (!folderContentShown) $(this).animate({
opacity: 0.00
}, "fast");
else $(this).animate({
opacity: 1.00
}, "fast");
});
//clickedFolder.animate({opacity: folderContentShown ? 1.00 : 0.70}, "fast");
folderContent.slideToggle("fast");
event.preventDefault();
});
});
</code></pre>
<p>Instead of returning the folderName in text form, I need to return HTML to be visible in the folderContent area.</p>
| javascript jquery | [3, 5] |
4,360,132 | 4,360,133 | Use Session variable in Javascript | <p>below is my asp behind code:</p>
<pre><code>Public Shared Sub GetClient()
{
System.Web.HttpContext.Current.Session("MYVAR") =somevariable.ToString;
}
</code></pre>
<p>and here is my javascript script</p>
<pre><code><script type="text/javascript">
var a = '<%= Session("MYVAR") %>';
document.getElementById("<%=txt_box1.ClientID%>").value = a;
</script>
</code></pre>
<p>I do not know if I'm missing something, because there is nothing in my var a to display.</p>
<p>Any suggestions ? thanks</p>
| javascript asp.net | [3, 9] |
4,633,171 | 4,633,172 | getting fakepath in jquery | <p>am trying get size of a file by passing the file bath from javascript to an php file then return the result , problem is javascript passing file bath as the following ex, c:\fakepath\NAME OF THE FILE , so the php file getting an wrong path so always returning an false !!! </p>
<pre><code> $(document).ready(function (){
$("#file").click(function (){
fileBath=$("#name").val();
$.get('newfile2.php','fileBath='+fileBath,function(data){
alert(data);
});
});
});
</code></pre>
<p>php file </p>
<pre><code>getmax($_GET['fileBath']);
function getmax($fileBath){
$value=filesize($fileBath);
echo $value;
}
</code></pre>
<p>as i said the return value FALSE in php file because file bath is wrong !! </p>
| php javascript jquery | [2, 3, 5] |
5,023,329 | 5,023,330 | How to restore Textbox Data | <p>I have a small requirement, </p>
<p>We have restore the textbox data that was cleared previously.<br>
Below is my HTMl code </p>
<pre><code><table>
<tr><td><input type="textbox"></td></tr>
<tr><td><input type="checkbox"></td></tr>
</table>
</code></pre>
<p>Here is my JQuery Code </p>
<pre><code> $('TABLE TR TD').find(':checkbox').change(function()
{
if($(this).prop('checked'))
{
$(this).parents('TR').siblings('TR').find('input').val("")
}
if(!$(this).prop('checked'))
{
$(this).parents('TR').siblings('TR').find('input').val(?)
}
});
</code></pre>
<p>My Requirement is to clear the textbox content if checkbox is checked. And if i deselect it the textbox should be restored with previous data. </p>
<p>Please someone help me.</p>
| javascript jquery | [3, 5] |
4,542,284 | 4,542,285 | How to display number in textbox for a particular option? | <p>I need helping appending values into a textbox. What happens is that with the relevant piece of code below, the user can add an "Option Type" from a table row into the textbox. For example if the user clicks on the "Add" button and within that row the Option Type is "True or False", then I want it to display number 27 in the textbox, and if "Option Type" is "Yes or No" then display number 28 in the textbox. So I want it like below</p>
<pre><code>Option Type Number
True or False 27
Yes or No 28
</code></pre>
<p>My question is how can insert the numbers for the 2 option types into the textbox?</p>
<p>I tried this below for True or False but it did not work:</p>
<pre><code>var myNumbers = {};
myNumbers["True-False"] = "27";
gridValues = myNumbers[gridValues];
</code></pre>
<p>Below is the true and false buttons:</p>
<pre><code><input name="answerTrueName" id="answerTrue" type="button" value="True" onclick="btnclick(this);"/>
<input name="answerFalseName" id="answerFalse" type="button" value="False" onclick="btnclick(this);"/>
</code></pre>
| javascript jquery | [3, 5] |
5,189,182 | 5,189,183 | How to access a calling element's id in a jQuery click() function | <p>So I am binding a .click() function to a css class, but I want to be able to access the calling element's id from inside this function when it is called. What is the best way to do this?</p>
| javascript jquery | [3, 5] |
4,404,544 | 4,404,545 | javascript execution from c# | <p>window.execscript("mycode","javascript") is not working when tried to execute,also not giving any exception at that point.Any suggestion is welcome.</p>
<p>Thanks in Advance</p>
| c# javascript | [0, 3] |
3,128,948 | 3,128,949 | How to restrict Android device to not open some specific site e.g.youtube, facebook | <p>I am writing an application for Android devices, Now I want to implement the functionality that if my application is installed on the device than it is restricted to open youtube or facebook. </p>
<p>Because this application is for employees and my client do not want that his emplyees waste their time in youtube or facebook. I tried to find some help on google but received no good source. </p>
<p>thanks</p>
| java android | [1, 4] |
1,363,062 | 1,363,063 | What does Oracle's lawsuit against Google mean to Android developers? | <p>What does <a href="http://mashable.com/2010/08/14/google-rebuts-oracle-lawsuit-invokes-open-source-defense/" rel="nofollow">Oracle's lawsuit against Google</a> mean to Android developers? I know this is not a programming related question, but I can't think of another forum where I can ask this.</p>
| java android | [1, 4] |
4,170,444 | 4,170,445 | Script downloading DI.FM list works only under Opera | <p>Hello fellow stackoverflow'ers!
Today I was tired of old dead links to my fav internet radio, so I decided to make a downloader for all channels from di.fm. The idea was simple: download the page, get to the menu and parse it. After that create a playlist and make user download it.</p>
<p>So I created a PHP script as an API for my JS script. PHP functions were to download the page (JS cannot really do that), save playlist sent via POST in cookies and to provide it as a file. Cookies are supposed to be a communication channel between JS and PHP (with POST I cannot really make file download itself).</p>
<p>So far so good. Everything works like a charm under Opera. Things are getting complicated in Chrome and Firefox. Chrome reloads the page without a download dialog, Firefox works about the same, just sometimes lets me download the list... that is empty.</p>
<p>Any ideas how to solve it? Here is the code (feel free to use it yourself if you like it):
<code>http://pastebin.com/dcEzxV9w</code></p>
<p>Thanks in advice,</p>
<p>Dracco</p>
| php javascript jquery | [2, 3, 5] |
5,766,132 | 5,766,133 | Outputting data with JQuery & PHP | <p>I have a general question regarding quality of writing code ...</p>
<p>I'm working on website, that outputs data from MySQL with PHP and it is being called with <code>$.get() / $.ajax()</code> with jQuery....</p>
<p>Now my question is .. the data I´m exporting for example: an array of comments (from class Comments) for a specific post, and this array is being returned from PHP as a string with its HTML manipulation (<code>return '<div id="this->$data"> this->$data</div>';</code>) and with the JQuery manipulation, I´m adding all the comments as list elements or anything else to a specific html element.</p>
<p>Is it useful to do this? Or it is better to send the array in a variable to jQuery, and then work with its elements and make the dynamic html code directly in JavaScript/jQuery..</p>
<p>If that was confusing, is it better to generate the html code in PHP when returning /echoing, or to generate the html code in jQuery after receiving the core data from the php? </p>
<p>I know there are other methods like XML JSPN, I'm just asking here about the efficient with generating HTML to manipulate core data (example: Array or Core Json data)</p>
| php jquery | [2, 5] |
36,812 | 36,813 | onItemClickListener with cwac-endless | <p>i'm developing an application that it use the cwac-endless library. I tried to add the event in getPendingView function but it doesn't work. My idea is if you have clicked in one element, i create an intent to open a webpage. Thank you so much for the help. I wait yours answers.</p>
| java android | [1, 4] |
2,578,406 | 2,578,407 | Select on collection - C# | <p>Say I have a sql query </p>
<pre><code>SELECT fname, lname, dob, ssn, address1, address2, zip, phone,state from users
</code></pre>
<p>Now say the records are now either in dictionary base or a strongly typed collection.</p>
<p>I have a grid view control and i want to bind it to my collection but I only want to display fname, lname, dob and ssn and not the other columns.</p>
<p>Is there an easy way to extract the columns and then bind to the extracted item? Not sure if LINQ would be helpful here.</p>
<p>This is a test project as I am getting familiar with the web world wqith VS-2008</p>
| c# asp.net | [0, 9] |
4,402,993 | 4,402,994 | Speed up live search js, php, mysql | <p>I have made a "live search bar" with php and javascript. if you enter a word in the search bar it searches the database (mysql).</p>
<p>index.php:</p>
<pre><code><input type="text" onkeyup="getMovie(this.value)"/>
<div id="movie"></div>
</code></pre>
<p>javascript.js:</p>
<pre><code>function getMovie(value) {
$.post("getmovie.php",{partialMovie:value},function(data) {
$("#movie").html(data);
});
}
</code></pre>
<p>getmovie.php:</p>
<pre><code>include_once "connection.php";
if($_POST['partialMovie']){
$partialMovie = $_POST['partialMovie'];
$sql = "SELECT title FROM movie WHERE title LIKE '%$partialMovie%'";
$stm = $db->prepare($sql);
$result = $stm->execute(array());
while($row = $stm->fetch(PDO::FETCH_ASSOC)) {
echo "<li>".$row['title']."</li>";
}
}
</code></pre>
<p>This works, but it is way to slow. I have only 3 "movies" in my database, but it takes like a second or two to show the results. </p>
<p>the titles of the 3 movies are: een twee drie.
but if i type "een" fast, after a second you see een, twee, drie. a second later you see: een twee. and another second later you see: een. </p>
<p>So my question is: is there a way to speed the search up or is there a way to stop searching if you type another letter?</p>
| php javascript | [2, 3] |
4,134,655 | 4,134,656 | Input string was not in a correct format when trying to add jQuery in code behind | <p>I try this and it gives the error mentioned in the title at the line I call <code>String.Format</code>.</p>
<pre><code>public static void JqueryDialogue(string divId)
{
String script = String.Format(
"$(document).ready(function(){ $('#{0}').dialog('open'); });",
divId);
// Gets the executing web page
Page page = HttpContext.Current.CurrentHandler as Page;
string codeId = "openDialoge" + divId.ToString();
// Checks if the handler is a Page and that the script isn't already on Page
if (page != null && !page.ClientScript.IsClientScriptBlockRegistered(codeId))
{
page.ClientScript.RegisterStartupScript(
typeof(JavascriptHelper),
codeId,
script,
true);
}
}
</code></pre>
| c# asp.net | [0, 9] |
1,151,826 | 1,151,827 | Need the decimal to save and show three places | <p>I have this line of code in c# but i it always resets the textbox back to the format 0.00, how can i make it so that it keeps the format 0.000 ?.</p>
<pre><code>NewYorkTax = Convert.ToDecimal(txtNewYorkTax.Text);
//converts it but with 0.00, I need 0.000 or 7.861 etc..
</code></pre>
<p>SIDE NOTE:
NewYorkTax is of type Decimal, I need to keep this variable.. any ideas?</p>
<p>Thank you</p>
| c# asp.net | [0, 9] |
1,061,865 | 1,061,866 | Android Webview touch content | <p>I want to get the content of that tag which I touch in webview in string.</p>
<p>Suppose I have 5 paragraph and I touch on one then I want content of that paragraph in string.
How can I achieve this?
Thanks</p>
| javascript android | [3, 4] |
2,927,418 | 2,927,419 | Read the Android Inbox From Desktop Application | <p>I want to make a desktop application that can read the SMS from the android phone connected to the PC via USB cable. Is it possible I have searched the web to get any getting started point, there are tutorials about reading the SMS through android app... Can somebody guide me in the right direction, its not a request for code just want directions which way i should go ... </p>
| java android | [1, 4] |
2,104,050 | 2,104,051 | Jquery Neat Codes request | <p>This is my very first post. I am a freelance front end web developer and I strongly believe it is only fair that I give my clients the best product and service, which neat and clean codes is one of them.</p>
<p>Javascript is a recent technology I acquired and want to get good at. This is the Javascript from <a href="http://oscarinoservices.com/portfolio" rel="nofollow">http://oscarinoservices.com/portfolio</a>. How can I improve it? Please see the source code of the page to see the HTML </p>
<pre><code><style>
.twentyall:hover{
background-image:#000 url(http://oscarinoservices.com/portfolio/themes/bartik/images/menu-glow.png) no-repeat;
}
.workall, .workall h1{ display:none; }
</style>
$(document).ready(function () {
$('#block-block-1').show(); /* shows the years selector hidden if javascript is disabled */
$('a#logo').hover(function () {
$('.workall').hide();
$('#block-block-9').fadeIn('slow');
});
$.each($('.twentyall'), function () {
$(this).hover(function () {
$('#block-block-9').hide();
var id = $(this).attr("id").substring(6);
$('.workall').hide();
$('#work20' + id).fadeIn();
},
function () {
$(this).show();
});
});
});
</code></pre>
| javascript jquery | [3, 5] |
2,093,705 | 2,093,706 | Changing external variable from nested function | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/9041321/return-ajax-callback-return">return AJAX callback return</a> </p>
</blockquote>
<p>Running the below code:
res1 is full,
res2 is empty,
res3 is empty,</p>
<p>How can i change the result variable and use it as return of the most out function</p>
<pre><code>function fillusers() {
var result = '';
$.when(
$.getScript("http://localhost:9090/app/dwr/engine.js"), $.getScript("http://localhost:9090/app/dwr/util.js"), $.getScript("http://localhost:9090/app/dwr/interface/myService.js"), $.Deferred(function(deferred) {
$(deferred.resolve);
})).done(function() {
myService.getUsers({
callback: function(str) {
result = jQuery.parseJSON(str);
console.log('res1' + result);
}
});
console.log('res2' + result);
});
console.log('res3' + result);
return result;
}
</code></pre>
| javascript jquery | [3, 5] |
2,181,907 | 2,181,908 | jQuery + <a> tag | <p>I've created a Facebook/Twitter style status update where the new Status' get added to an unordered list. I now want to add a "REMOVE" function to it, however, I'm not sure how to best accomplish this. </p>
<ol>
<li>In my list item, create my [a] tag with the unique ID of the status post ID and set a listener class</li>
<li>Have jQuery listen for [a] tags with the listener class</li>
<li>POST the ID over to the PHP script to remove the post; if successful return with "ok" or if failed return with "fail"</li>
<li>In the callback function, if it's OK, then find the element and remove it</li>
</ol>
| php jquery | [2, 5] |
2,181,483 | 2,181,484 | GridView not showing new inserted row | <p>I'm using a gridview and sqldatasource.
When I'm adding a new row in the gridview I need to refresh the page in order to see the new row.
The View state is enabled.</p>
<p>Is there anything I can do ?</p>
<p>Thanks</p>
| c# asp.net | [0, 9] |
1,033,672 | 1,033,673 | getting info of users connected while tethering | <p>while getting data about connected users in tethering you can get users data from <code>dnsmasq.leases</code> File.</p>
<p>If i have to find out how much each user is downloading data how can i do that?</p>
<p>Regards</p>
| java android | [1, 4] |
1,486,270 | 1,486,271 | How to format numbers on Android | <p>i am learning to program mobile aplications on Android. My first app is a unit converter. Everithing is working for now, but i have a question about formating numbers. I hava this code to get text from buttons and to convert the appropriet output: </p>
<pre><code>if (bPrevodZ.getText() == "milimeter"){
if (bPrevodDo.getText()=="kilometer"){
String PomocnaPremenna = jednotkaZ.getText().toString();
double cisloNaPrevod = Double.parseDouble(PomocnaPremenna);
cisloNaPrevod = cisloNaPrevod*0.0000001;
vysledok.setText(Double.toString(cisloNaPrevod));
}
</code></pre>
<p>The final result is "cisloNaPrevod", but i have problems to show a good format of that number. For example:
12345 mm = 0,0012345 km this is good right ? :)</p>
<p>but if i convert:
563287 mm = 0.05632869999999995 this is bad :) i need it to show 0.0563287</p>
<p>Thx for any help</p>
| java android | [1, 4] |
5,680,253 | 5,680,254 | ASP.NET: How to send file from database to printer? | <p>I have an ASP.NET 2.0 (C#) webpage with a link that pulls a blob from a MS SQL database and ouputs it in the appropriat file format, i.e., Word, WordPerfect, PDF.</p>
<p>My users would like to print these files with one click. Right now they have to click the link to open the file, then click the "Print" button within the application that they file opened.</p>
<p>In addition, I would like to send multiple documents to the printer, using one click, if possible.</p>
<p>Thanks.</p>
| c# asp.net | [0, 9] |
4,433,250 | 4,433,251 | What is the Python equivalent of PHP's set_time_limit()? | <p>I have a python script which is freezing (I think it stalls waiting for socket data somewhere), but I am having trouble getting a backtrace because the only way to stop it is to kill the process in. There is a timeout on the socket also, but it doesn't seem to work.</p>
<p>I am hoping that Python has a feature like PHP's <a href="http://www.php.net/set_time_limit" rel="nofollow">set_time_limit()</a> function which can stop the script and give me a useful backtrace, perhaps showing a <code>sock.recv()</code> call which is frozen, or an endless loop somewhere.</p>
| php python | [2, 7] |
2,996,052 | 2,996,053 | size or length of a Document object | <p>How can i get the size of an Document object?</p>
<pre><code> DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
InputStream iStr = urlConnection.getInputStream();
doc = db.parse(iStr);
???? --> Log.i("Bytes",String.valueOf(doc.get????));
</code></pre>
| java android | [1, 4] |
4,174,774 | 4,174,775 | jquery / javascript not picking up value on click | <p>I need to dynamically alter a variable with the "name" attribute from a link - code below...</p>
<pre><code> <input type="text" class="datepicker" id="dp1">
<a href="javascript:;" class="tab" name="1,2">test button</a>
</code></pre>
<p>and</p>
<pre><code>$(document).ready(function(){
var pickable = { dp1: [4,5,6] };
$(".tab").click(function () {
var test = $(this).attr("name").split(",");
pickable = { dp1: test };
});
$(".datepicker").each(function() {
$(this).datepicker({
beforeShowDay: function(date){
var day = date.getDay(), days = pickable[this.id];
return [$.inArray(day, days) > -1, ""];
},
});
});
});
</code></pre>
<p>Any ideas why this doesn't work??</p>
| javascript jquery | [3, 5] |
5,393,719 | 5,393,720 | C# DateTime.Ticks equivalent in Java | <p>What is the Java equivalent of DateTime.Ticks in C#?</p>
<pre><code>DateTime dt = new DateTime(2010, 9, 14, 0, 0, 0);
Console.WriteLine("Ticks: {0}", dt.Ticks);
</code></pre>
<p>What will be the equivalent of above mentioned code in Java?</p>
| c# java | [0, 1] |
1,359,045 | 1,359,046 | Function to erase substrings and explode string? | <p>I want to replace "http://" "https://" "www." and also explode the url on "/".</p>
<p>For example: <a href="http://www.google.com/whatever" rel="nofollow">http://www.google.com/whatever</a> should return google.com</p>
<p>I was doing as much as I knew how on this function:</p>
<pre><code>// Change site's title
function changeTitle(url) {
var title = url.replace("http://", ""); // 1
title = title.replace("https://", ""); // 2
title = title.replace("www.", ""); // 3
document.title = title;
}
</code></pre>
<p>But I want to do all the process on a separate function, e.g: <code>function cleanUrl(url)</code>. I tried this and variants but couldn't make it work:</p>
<pre><code>// Clean URL
function cleanUrl(url) {
var title = url.replace("http://", "");
title = title.replace("https://", "");
title = title.replace("www.", "");
}
// Change site's title
function changeTitle(url) {
cleanUrl(url);
document.title = title;
}
</code></pre>
<p>How do I do it? Also I'm not exploding the url since I didn't know how.</p>
| javascript jquery | [3, 5] |
4,414,918 | 4,414,919 | Closing exe and running from memory | <p>Since exe is an archive, I want my program to be able to save stuff to it's own exe file. Unfortunately, Windows keeps the file open while it's running. I'd like to find a way in Python and/or C++ to force the program to run from memory and have the file close.</p>
| c++ python | [6, 7] |
5,628,557 | 5,628,558 | Back navigation with pushstate and load in jQuery | <p>I'm currently using jQuery to dynamically load content into a holder div and then updating the url with pushstate.</p>
<p>I have the following code so far (some excluded for example simplicity):</p>
<pre><code>$("body").on("click", "a:not(.noclick)", function(){
history.pushState({path: $(this).attr("href")}, "", $(this).attr("href"));
$("#main").load($(this).attr("href"));
return false
});
</code></pre>
<p>It works as expected and the url changes to what it should be on new content load but the back button is currently unfunctional, when back is pressed the url changes to the previous but nothing else happens.</p>
<p>I have pages built in a way that you can either use the site with jQuery to load content without headers or without any javascript and pages display from their urls so there's no issue in that part.</p>
<p>Is there a way I could use load on back navigation to load the last pushstate history? I'd prefer to not use hashing but not sure if it's possible without?</p>
<p>Facebook seems to do this with their navigation if that helps?</p>
| javascript jquery | [3, 5] |
1,937,835 | 1,937,836 | Which one is better approach window.parent.location.href or window.top.location | <p>I am working in a project where I have to redirect on Error Page in a particular scenario. For that I have created Error.aspx page. Right now I am using
window.top.location.href = "../Error.aspx" and it generate <a href="http://localhost/app_web/Error.aspx" rel="nofollow">http://localhost/app_web/Error.aspx</a>
and its working fine except once (which shows Message <a href="http://xyz/ErrorPage.aspx" rel="nofollow">http://xyz/ErrorPage.aspx</a>' does not exist. ). So can anyone suggest which is the better option for this.</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
5,355,315 | 5,355,316 | javascript string equal | <p>I have a very strange jquery problem:</p>
<pre><code>if(response==="success") {
alert("I am here");
$('#uploadfile').html('<img src="./uploads/'+file+'" alt="" /><br />'+file);
}
else {
$('#uploadfile').html(response);
//$('#attached1').val("error");
}
</code></pre>
<p>In this code, if response equal <code>success</code>, the <code>uploadfile</code> element will display "sucess". The <code>alert("I am here")</code> will not show.</p>
<p>I don't know why? what's the error in above code.</p>
| javascript jquery | [3, 5] |
2,515,615 | 2,515,616 | jQuery hover fadein/fadeout/slidetoggle | <p>When I onhover I can get the effect what I need, but when I move the mouse to "my list" <code>a</code> tag, <code>#bb</code> div disappeared. how could I make it stays there as I need to click it.</p>
<p><strong>HTML:</strong></p>
<pre><code><div id="aa">click</div>
<div id="bb"> <a href="">my list</a></div>
</code></pre>
<p><strong>jQuery:</strong></p>
<pre><code>$('#bb').hide();
$('#aa').hover(function(){
$('#bb').slideToggle();
});
</code></pre>
<p>Online sample here - <a href="http://jsfiddle.net/9tjZK/" rel="nofollow">http://jsfiddle.net/9tjZK/</a></p>
| javascript jquery | [3, 5] |
1,814,293 | 1,814,294 | JavaScript function pointer problem | <p>just starting out with JavaScript and jQuery, and i have this problem:</p>
<pre><code>foo(validation);
function foo(func) {
var time = new Date().getTime();
// do some other stuff
func("foobar" + time);
}
function validation(elementName) {
// do stuff
}
</code></pre>
<p>but when i call function foo with the validation function pointer, i would also like to pass in the string "foobar" at that point.</p>
| javascript jquery | [3, 5] |
242,500 | 242,501 | Set object param tag from code-behind | <p>I want to embed video in object tag and I want to put the value of param from code-behind. But I'm not able to put the value from code-behind. Any idea where I'm getting wrong?</p>
<p>This is my code so far:</p>
<pre><code><object runat="server" id="object1">
<param name="param1" value="www.youtube.com?id=123" runat="server" id="video1" />
<param name="size" value="large" />
<param name="category" value="wide" />
</object>
</code></pre>
<p>I want to change the value of <code>param1</code> from code-behind.</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.