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 |
---|---|---|---|---|---|
1,309,357 | 1,309,358 |
Hiding divs with javascript collapse all
|
<p>I'm making divs with holds content and my problem is how to get all divs to collapse.
Problem here is that the code needs to be dynamic since we don't know how many divs going to be made.</p>
<p>First here is my javascript:</p>
<pre><code>function pageLoad()
var j = 1; while(j>0)
collapseAll($('div'+j,'divx',+j));
j++;
</code></pre>
<p>This part handles collapse when page is loaded. All divs need to be collapsed.
in code it should be like this:</p>
<pre><code><a onclick="div('div1');" > //this at first time
<div id="div1">
content
</div>
<a onclick="divx('divx1');
<div id="divx1">
content
</div>
<!-- this at next when div is created -->
<a onclick="div('div2');" >
<div id="div2">
content
</div>
<a onclick="divx('divx2'); ">
<div id="divx2">
content
</div>
</code></pre>
<p>and so on.. Problem here is that when code creates new div it gives same name for div that is used in earlier part.</p>
<p>forexample: </p>
<pre><code><a onclick="divx('divx2'); ">
<div id="divx2">
content
</div>
//new div created:
<a onclick="divx('divx2'); ">
<div id="divx2">
content
</div>
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,183,706 | 2,183,707 |
Creating DOM elements in jQuery
|
<p>Let's say we have the following JavaScript/jQuery code below</p>
<pre><code>function createElement(i, value) {
return $('<div>', { id: "field" + i, text: value});
}
</code></pre>
<p>I have a div with an id of "container" and then I do:</p>
<pre><code>var c=$("container");
c.append(createElement(1, "hello, world!");
</code></pre>
<p>Now I've got 2 questions</p>
<ol>
<li><p>Does the createElement function use jQuery to return an HTML string that gets appended to container or does it dynamically create a DOM element that gets appended to the container?</p></li>
<li><p>I'm unfamiliar with this kind of jQuery where you actually create the HTML string (or DOM element) via the $() selector. I tried looking for the documentation on this subject in jQuery's website but I couldn't find it. Can somebody point me in the right direction?</p></li>
</ol>
|
javascript jquery
|
[3, 5]
|
2,906,035 | 2,906,036 |
How to detect if user has reached almost the end of the page using jQuery?
|
<p>Right now I fire an event when the user has reached the bottom of the page using this:</p>
<pre><code>$(window).scroll(function() {
if($(window).scrollTop() == $(document).height() - $(window).height()) {
// do something
}
});
</code></pre>
<p>How can this be modified to fire the event when the user reached almost the end of the page, let's say 300px left?</p>
|
javascript jquery
|
[3, 5]
|
4,992,040 | 4,992,041 |
Getting data from ASP.Net JSON service with jQuery
|
<p>I am trying to call the Google Maps geocoding API, to get a formatted address from a lat/long pair, and then log it to the console. I am trying to get the first 'formatted_address' item that gets returned for a given location.
I am simple unable to extract that item from the JSON, I have no idea why. The line of code needed to extract the data would be greatly appreciated.</p>
<p>The javascript: </p>
<pre><code>//Gets the current location of the user
function getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition);
}
}
function showPosition(position)
{
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
$.ajax({
type: "POST",
url: "ReportIncident.aspx/ReverseGeocode",
data: "{latitude:" + latitude + ",longitude:" + longitude + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (returnedData)
{
// console.log(/****formatted_address Here Please****/);
}
});
}
</code></pre>
<p>The C#:</p>
<pre><code> [WebMethod]
public static string ReverseGeocode(decimal latitude, decimal longitude)
{
// Create the web request
string url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=" + latitude + "," + longitude +
"&sensor=true";
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
// Get response
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
// Get the response stream
StreamReader reader = new StreamReader(response.GetResponseStream());
// Console application output
return reader.ReadToEnd();
}
}
</code></pre>
|
c# jquery asp.net
|
[0, 5, 9]
|
5,715,652 | 5,715,653 |
Jquery functions working momentarily, and then not at all?
|
<p>I had applied this slide mechanism to a page, and it worked fine for a while. I can't remember changing anything at all, but now it won't function properly.</p>
<p>Here is the code:</p>
<pre><code>$(document).ready(function () {
var hash = window.location.hash.substr(1);
var href = $('#nav li a').each(function () {
var href = $(this).attr('href');
if (hash == href.substr(0, href.length)) {
var toLoad = hash + '.html #content';
$('#content').load(toLoad)
}
});
$('#nav li a').click(function () {
$("#story_pane").animate({
marginLeft: 360
}, 250);
$("#main_content").animate({
marginLeft: -600,
opacity: 0.3
}, 250);
$("#main_content").css();
});
alert("test");
var toLoad = $(this).attr('href') + ' #content';
$('#content').hide(1, loadContent);
$('#load').remove();
$('#story_pane').css("display", "block");
$('#story_pane').append('<span id="load"></span>');
$('#load').fadeIn(1);
window.location.hash = $(this).attr('href').substr(0, $(this).attr('href').length - 5);
function loadContent() {
$('#content').load(toLoad, '', showNewContent())
}
function showNewContent() {
$('#content').show(1, hideLoader());
}
function hideLoader() {
$('#load').hide();
}
return false;
});
</code></pre>
<p>Only the "test" alert executes properly, I had been looking for any brackets i forgot to close, or other syntax issues but i'm in a bit of a dead end. I do have the files backedup, but that's a last resort option, in case I can't fix this.</p>
<p>edit- works now, I deleted <code>$("#main_content").css();</code> and added a click function which fixed it</p>
|
javascript jquery
|
[3, 5]
|
1,856,771 | 1,856,772 |
HTML page floating on iphone
|
<p>I am developing a web app for mobile (iPhone, android), i got an issue where in the
whole webpage is floating (checking on safari) when i drag the webpage its floating
how to avoid this floating</p>
|
android iphone
|
[4, 8]
|
2,862,236 | 2,862,237 |
Serving Python website on it's own server next to apache serving other websites
|
<p>I have Apache server serving several PHP driven websites. I'm developing a websites in Python/Pyramid and want to host it on the same server. What options do I have available?</p>
|
php python
|
[2, 7]
|
1,543,342 | 1,543,343 |
can we store fadeOut method in a variable
|
<p>i have a jquery slider function and i want to customize it. my requirement is i want store fadeout effect in variable but i am not getting any idea. i spent some time on the internet to find out the solutions but not reaching up to the solutions. so there is any solutions regarding this. if yes please let me know it will be very helpful for me.</p>
<pre><code>var mYname=fadeOut(500)
</code></pre>
<p>or</p>
<pre><code>if (option[12]/*prevNext*/) eA[fadeOpacity ? 'fadeIn' : 'fadeOut' ](fadetime);
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,431,422 | 4,431,423 |
ASP .NET - Set default values of ListView InsertItemTemplate
|
<p>For a DetailsView I use the following code:</p>
<pre><code> protected void DetailsView1_PreRender(object sender, EventArgs e)
{
DetailsView myDetailsView = (DetailsView)sender;
//set value to current datetime
((TextBox)myDetailsView.FindControl("TextBox1")).Text =
DateTime.Now.ToString("M/d/yyyy HH:mm");
}
</code></pre>
<p>When I try to do the same thing for a ListView control (specifically the InsertItemTemplate) I get a 'NullReferenceException' error message.</p>
<p>How do I set the default value of a Listview InsertItemTemplate textbox?</p>
|
c# asp.net
|
[0, 9]
|
1,077,198 | 1,077,199 |
How do I convert a DateTime object to a string with just the date using C#?
|
<p>Seemingly simple. I need to convert a DateTime object to a string without the time stamp.</p>
<p>This gives me the date and time. And I can't figure out how to just get the date.</p>
<pre><code> startDate = Convert.ToString(beginningDate);
</code></pre>
<p>This outputs: 10/1/2011 12:00:00 AM</p>
<p>I need it to be: 10/1/2011 as a string</p>
<p>Any help is appreciated.</p>
|
c# asp.net
|
[0, 9]
|
5,656,622 | 5,656,623 |
Jquery - how to load everything except the images?
|
<p>I'm currently working on a WordPress addition which loads full post content (normally it shows exceprts) when asked to. I did my code like this:</p>
<pre><code>$(".readMore").click(function() {
var url = $(this).attr("href");
$(this).parent("p").parent("div").children("div.text").slideUp("slow", function () {
$(this).load(url + " .text", function(){
$(this).slideDown("slow");
});
});
$(this).parent("p").fadeOut();
return false; });
</code></pre>
<p>And it works. But I don't want images to be loaded. I tried .text:not(img), but it didn't worked. How can I do this?</p>
|
javascript jquery
|
[3, 5]
|
5,040,867 | 5,040,868 |
Java public class with an internal method
|
<p>I am attempting to convert a C# abstract class to a java class that has the same encapsulation and functionality. I understand you can make a class internal in Java by declaring the class without any modifiers, and this results in a private package. I would like to achieve something similar except where the class is public, some of the methods inside the class are public and some are internal.</p>
<p>The class I am modifying looks as follows, </p>
<pre><code>//// This is C#
public abstract class Response
{
public String Request{get; internal set;}
public String Body{get; internal set;}
}
</code></pre>
<p>I would like to end up with something that ideally looks like this,</p>
<pre><code>//// This is Java
public abstract class Response
{
public abstract String getRequest(){}
abstract String setRequest(String r){}
public abstract String getBody(){}
abstract String setBody(String b){}
}
</code></pre>
<p>Can this be achieved?</p>
|
c# java
|
[0, 1]
|
4,780,756 | 4,780,757 |
exporting gridview to Ms Excel 2007
|
<p>I am trying to export grid view data into excel 2007 i.e. xlsx format. but its giving error.</p>
<p>i am using following code</p>
<p>protected void Button1_Click(object sender, EventArgs e)</p>
<pre><code> {
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=text.xls");
Response.Charset = "";
Response.ContentType = "application/vnd.ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
GridView1.DataSource = Presenter.CurrentModel.BillStatementGlModelRecords;
GridView1.DataBind();
GridView1.AllowPaging = false;
GridView1.DataBind();
GridView1.HeaderRow.Style.Add("background-color", "#FFFFFF");
for (int i = 0; i < GridView1.Rows.Count; i++)
{
GridViewRow row = GridView1.Rows[i];
//Change Color back to white
row.BackColor = System.Drawing.Color.White;
//Apply text style to each Row
row.Attributes.Add("class", "textmode");
}
GridView1.RenderControl(hw);
//style to format numbers to string
string style = @"<style> .textmode { mso-number-format:\@; } </style>";
Response.Write(style);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();
}
</code></pre>
<p>but not working properly and on opening the file it gives following error
"Excel cannot open the file 'ChangeRequestList[2].xlsx' because the file
format or file extension is not valid. Verify that the file has not been
corrupted and that the file extension matches the format of the file"</p>
<p>Can anyone help me?</p>
<p>Thanks</p>
|
c# asp.net
|
[0, 9]
|
287,128 | 287,129 |
Call ajax load from a popup
|
<p>I'm trying to dynamically load html into a popup using ajax with this:</p>
<p><code>$('body').load( new_url, function (responseText, textStatus, XMLHttpRequest ) { ... } );</code></p>
<p>It works fine, but it doesn't load the html into the subwindow, it loads it into the opening window. If I have a reference to the subwindow "win", how can I do something like this:</p>
<p><code>win.$( 'body' ).load...</code></p>
<p>currently, that gives an error saying <code>win.$ is not a function</code>.</p>
<p>Thanks!</p>
|
javascript jquery
|
[3, 5]
|
5,567,824 | 5,567,825 |
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]
|
1,581,417 | 1,581,418 |
Dynamically create JS file using ASP.net Handler
|
<p>I have many clients I want to give them scripts so I want to Create JS file based on their Cusotmer ID.
So I can return and it directly execute on customer side.
Client can be anyone either PHP,Html, ASP.net</p>
<p><strong>Problem is when i browse this link it give me JS string but on customer side this script is not executing like for testing I put alert this alert is not showing on customer side</strong></p>
<hr>
<p>Customer</p>
<pre><code><head>
<script src="http://localhost:12604/JSCreator/Handler.ashx?CustomerID=123" type="text/javascript"></script>
<title></title>
</head>
</code></pre>
<hr>
<p>Handler file</p>
<pre><code>public class Handler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string CustomerId = context.Request["CustomerId"].ToString();
string jscontent = JSFileWriter.GetJS(CustomerId); // This function will return my custom js string
context.Response.ContentType = "text/javascript";
context.Response.Write(jscontent);
}
public bool IsReusable
{
get
{
return false;
}
}
}
</code></pre>
|
javascript asp.net
|
[3, 9]
|
970,515 | 970,516 |
not redirecting to handler page
|
<p>My java script which i had given in aspx page. the info should be redirect to handler page is not working..</p>
<pre><code><script type="text/javascript">
var Name;
var Age;
var Mobile;
var Email;
var Center;
function getdata()
{
alert('Adding');
Name=document.getElementById("txtname").value;
alert(Name);
Age=document.getElementById("Txtage").value;
alert(Age);
Mobile=document.getElementById("Txtmobile").value;
alert(Mobile);
Email=document.getElementById("TxtEmail").value;
alert(Email);
Center=document.getElementById("Ddlcenter").value;
alert(Center);
sendinfo();
}
</code></pre>
<p>below query only not redirected to handler page </p>
<pre><code>function sendinfo()
{
$(document).ready(function(sendinfo){
var url='Handler/Appoinment.ashx?Name='+Name+'&Age='+Age+'&Mobile='+Mobile+'&Email='+Email+'&Center='+Center+'';
alert(url);
$.getJSON(url,function(json)
{
$.each(json,function(i,weed)
{
});
});
</code></pre>
<p>});</p>
|
javascript asp.net
|
[3, 9]
|
4,269,550 | 4,269,551 |
jquery callback specificity
|
<p><br>
Is there any specificity associated with event callback with jQuery. Say, I register a mousedown event callback on a div element, and also on the document. Which one would trigger if I click on the div? Does the order of registration matters? or the specificity (like css) matters?</p>
<p>thanks.</p>
|
javascript jquery
|
[3, 5]
|
1,576,618 | 1,576,619 |
How to restrict user from submitting the form twice?
|
<p>I have an asp.net form, which allow users to submit a registration form which internally sends/store all these values on SharePoint list using the web-service and hence on submit the page process time is a little lengthier then the normal form.</p>
<p>Mean time before the page gets redirect to a thanks page, user's tend to click the submit button again, which is causing the multipul submission of the same record.</p>
<p>Please suggest a way to restrict this submission, on button click I am using a jquery function for data validation, I have tried using the btn.disable = true method there, but once it reach's the else block (after passing the validation and this is where the disable = true code is) it doesn't submit's the form after reading btn.disable = true statement.</p>
<p>Experts, please show me a path.</p>
<p>Thanks in advance. </p>
|
c# javascript jquery asp.net
|
[0, 3, 5, 9]
|
1,428,772 | 1,428,773 |
Embed Python in Java on Android
|
<p>By embed I mean execute Python code from String in Java.</p>
<p>Jython won't compile for Android, and <a href="http://code.google.com/p/android-scripting/" rel="nofollow">Scripting Layer for Android</a> doesn't seem to let me embed Python through my Java application.</p>
<p>So how to embed Python in a Java application on Android?</p>
|
java android python
|
[1, 4, 7]
|
4,005,950 | 4,005,951 |
Jquery validate with fade in and hide
|
<p>I have a JS validation code like this :</p>
<pre><code>$(document).ready(function(){
$('#username').keyup(username_check);
});
function username_check(){
var username = $('#username').val();
if(username == "" || username.length < 4){
$('#username').css('border', '3px #CCC solid');
$('#tick').hide();
}else{
jQuery.ajax({
type: "POST",
url: "check_username.php",
data: 'username='+ username,
cache: false,
success: function(response){
if(response == 1){
$('#username').css('border', '3px #C33 solid');
$('#tick').hide();
$('#cross').fadeIn();
}else{
$('#username').css('border', '3px #090 solid');
$('#cross').hide();
$('#tick').fadeIn();
}
}
});
}
}
</code></pre>
<p>HTML Code :</p>
<pre><code><input type="text" name="username" id="username" class="input">
<img id="tick" src="images/tick.png" width="16" height="16"/>
<img id="cross" src="images/cross.png" width="16" height="16"/>
</code></pre>
<p>This code working good but now I want the image should be hide before validation. Below is the screenshot.</p>
<p><img src="http://i.stack.imgur.com/axkSz.png" alt="enter image description here"></p>
|
javascript jquery
|
[3, 5]
|
5,022,763 | 5,022,764 |
How to Disable Browser from Saving Previous Data of TextBox in asp.net
|
<p>Sorry I didn't explain My problem correctly , My problem is that I have a TextBox with AutoComplete Extender and It's works but The browser save the text that i have Entered before so when i start writing to My text Box I have Two lists appear , one from the browser and one from the autocomplete </p>
<p>I want to disable the browser list and keep the autocomplete list only</p>
<p>If any one can help I will be thankful</p>
<p>Thanks in Advance</p>
|
c# asp.net
|
[0, 9]
|
948,666 | 948,667 |
current time with seconds
|
<p>I have strange problem .. i have a function to display the time with seconds counter but i sent specific time (hours and minutes) as parameters when count of second reach 59 no minutes incremented and i am not sure if the same problem with hours when minutes will be 59 minute</p>
<pre><code>function updateClock(current_hours,current_minutes) {
var currentTime = new Date ( );
var currentHours = current_hours;
var currentMinutes = current_minutes;
var currentSeconds = currentTime.getSeconds ( );
// Pad the minutes and seconds with leading zeros, if required
currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
// Choose either "AM" or "PM" as appropriate
var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
// Convert the hours component to 12-hour format if needed
currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
// Convert an hours component of "0" to "12"
currentHours = ( currentHours == 0 ) ? 12 : currentHours;
// Compose the string for display
var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;
// Big font time
$('.big_time').html("<span></span>" + currentTimeString);
// Time in red triangle in the track bar
$('.time').html(currentTimeString);
}
</code></pre>
<p>I call this function in another file inside document ready like that .. i sent here the data retrieved from an API (hours and minutes)</p>
<pre><code>current_hours = data.current_hours;
current_minutes = data.current_minutes;
setInterval(function(){updateClock(current_hours,current_minutes)},1000);
</code></pre>
|
php javascript jquery
|
[2, 3, 5]
|
5,921,402 | 5,921,403 |
best method of detecting mobile browsers with javascript/jquery?
|
<p>For a site I'm working on I'm implementing image preloading with javascript however i most certainly do not want to call my <code>preload_images()</code> function if someone is on slow bandwidth.</p>
<p>For my market the only people with slow bandwidth are those using mobile internet on a smartphone.</p>
<p>What's the best approach for detecting these users so i can avoid image preloading for them?</p>
<hr>
<p>option 1 : detect browser width</p>
<pre><code>if($(window).width() > 960){ preload... }
</code></pre>
<hr>
<p>option 2: detect user-agent with a list of browser to preload for</p>
<pre><code>if($.browser in array safelist){ preload... }
</code></pre>
<hr>
<p>are there any better options?</p>
|
javascript jquery iphone android
|
[3, 5, 8, 4]
|
3,534,919 | 3,534,920 |
What's faster $('#parent .childclass1, #parent .childclass2').css(something) or $('#parent').children().css(something)?
|
<p>I think the title is explanatory. I'm becoming performance obsessed due to previous problems and am trying to get everything to max speed. As I found out that $('#parent').find('li') is faster than $('#parent li') I feel like I don't know anything anymore... So thus my question:</p>
<p>What's faster </p>
<pre><code>$('#parent .childclass1, #parent .childclass2').css(something)
</code></pre>
<p>or </p>
<pre><code>$('#parent').children().css(something)?
</code></pre>
<p>Thank you in advance</p>
|
javascript jquery
|
[3, 5]
|
3,797,152 | 3,797,153 |
Using an adapter from another class/activity
|
<p>How can I use an ArrayAdapter from another activity? I tried doing the following in MyListActivity.onCreate():</p>
<pre><code>setListAdapter(SomeOtherActivity.myAdapter);
</code></pre>
<p>where myAdapter is defined and initialized in SomeOtherActivity. However, I get an empty list, even though I verified that SomeOtherActivity.myAdapter is fully populated via a call to:</p>
<pre><code>SomeOtherActivity.myAdapter.getCount();
</code></pre>
<p>If I define and initialize my own adapter in MyListActivity with setListAdapter(myLocalAdapter), it works. Once I switch it to setListAdapter(SomeOtherActivity.myAdapter), I get an empty list. I debugged it and found that the adapter's getView() isn't even called.</p>
<p>Help please? Thanks.</p>
<p>In MainActivity.onCreate()</p>
<pre><code>listIsDone = false;
myList = new ArrayList<ItemInfo>();
init = new Runnable() {
public void run() {
myList = generate(); // generate the list, takes a while
Collections.sort(myList, new CustomComparator()); // sorts the list
myAdapter = new MyInfoAdapter(MainActivity.this, R.layout.row, myList);
synchronized(this) {
listIsDone = true;
notifyAll();
}
}
};
Thread thread = new Thread(null, init, "Background");
thread.start;
</code></pre>
<p>In my SubActivity.onCreate()</p>
<pre><code>setListAdapter(MainActivity.myAdapter);
doStuff = new Runnable() {
public void run() {
synchronized(MainActivity.init) {
if (!MainActivity.getListDone()) {
try {
MainActivity.init.wait(); // wait for list/adapter to be initialized
} catch (InterruptedException e) {
}
}
}
}
};
Thread thread = new Thread(null, doStuff, "Background");
thread.start();
</code></pre>
<p>I notice I can't run myAdapter.notifyDataSetChanged() in a Runnable thread(I get a runtime error), but I can do it in a runnable if I run it with runOnUiThread(); I'm guessing all method calls to the adapter needs to be done in the same UI thread?</p>
|
java android
|
[1, 4]
|
594 | 595 |
Jquery syntax when calling methods
|
<p>This code:</p>
<pre><code><script type="text/javascript">
someMethod1();
$(function () {
someMethod2();
});
</script>
</code></pre>
<p>What is the difference between these two callings? When do we do the first call, and when do we do the second call? What is the order of the method execution?</p>
|
javascript jquery
|
[3, 5]
|
1,733,468 | 1,733,469 |
PHP & Javascript :A generic way to create a javascript dictionary using php
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1156054/whats-the-best-way-to-send-javascript-array-to-php-script-using-get">What's the best way to send JavaScript array to PHP script using GET?</a> </p>
</blockquote>
<p>I just want to know that what is the best way to create a javascript dictionary .</p>
<p>Like suppose i have a php array and i want to feed the value of that array(loop iteration )</p>
<p>to a javascript dictionary in the form of key value ?</p>
|
php javascript
|
[2, 3]
|
2,238,959 | 2,238,960 |
SQLiteException when executing query
|
<p>I want to execute a ManagedQuery but am getting a error in my log:</p>
<p><strong>Query</strong></p>
<pre><code> Cursor cursor = managedQuery(GroceryListContentProvider.NOTES_URI,projection,Notes.NOTE_TITLE+"="+S+" AND "+ Notes.NOTE_DATE+"="+S1, null, null);
</code></pre>
<p><strong>Error Log</strong></p>
<pre><code>02-21 16:00:52.395: E/AndroidRuntime(22534): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.schuemie.GroceryList/net.schuemie.GroceryList.shoppinglist}: android.database.sqlite.SQLiteException: near "new": syntax error: , while compiling: SELECT item_name FROM notes WHERE (title=shop new AND date=12/2/12) ORDER BY title
</code></pre>
|
java android
|
[1, 4]
|
5,832,436 | 5,832,437 |
find each link with jquery and a html string
|
<p>I want to find every "a" tag in this HTML string</p>
<pre><code>$(document).ready(function(data) {
$.get('test.html',
function(responseText){
//find each a tag
}, "html"
)
});
</code></pre>
<p>Why is that so damn difficult for me ?</p>
|
javascript jquery
|
[3, 5]
|
5,775,832 | 5,775,833 |
Add or Subtracting into $(window).scrollTop + $(window).height == $(document).height() - Scrolled to bottom of page equation
|
<p>I'm running an if function when the user gets to the bottom of the page which works great as is like this</p>
<pre><code>if($(window).scrollTop() + $(window).height() == $(document).height()) {}
</code></pre>
<p>However I want it to run slightly before the bottom - about 300px before. </p>
<p>I've tried</p>
<pre><code>if($(window).scrollTop() + $(window).height() + 300 == $(document).height()) {}
</code></pre>
<p>AND</p>
<pre><code>if($(window).scrollTop() + $(window).height() == $(document).height() -300) {}
</code></pre>
<p>and all other variations to no avail.</p>
<p>I've also tried putting variables in.</p>
<pre><code>var plusheight = 300;
if($(window).scrollTop() + $(window).height() + plusheight == $(document).height()) {}
if($(window).scrollTop() + $(window).height() + $plusheight == $(document).height()) {}
if($(window).scrollTop() + $(window).height() + "plusheight" == $(document).height()) {}
</code></pre>
<p>What am I doing wrong?</p>
|
javascript jquery
|
[3, 5]
|
1,065,173 | 1,065,174 |
How to get the my table size after applying css styles
|
<p>i am having one div, which contains one table. i want to apply the table-width to div element.
My table cells having padding 5, so table width is not correct in IE browser, while the mozila the sample code works.</p>
|
javascript jquery
|
[3, 5]
|
1,594,077 | 1,594,078 |
opening new window in ie7 opens same target as base window but shows proper url in firefox
|
<p>i have a simple little form</p>
<pre><code><form id="loginform"> <input id="myinput" type="text" /> <input name="submit" value="go" type="submit" /></form>
</code></pre>
<p>in a very not secure way i want it to go to different urls depending on the input value.</p>
<p>here is my simple little jquery script that i am sure could be written more succinctly. (feel free to help)</p>
<pre><code>$(document).ready(function() {
jQuery.noConflict();
var apple = 'http://www.apple.com';
var microsoft = 'http://www.microsoft.com';
jQuery('#loginform').submit(function() {
var pass = jQuery('#myinput').val();
if (pass=='apple') {
var currentloc=apple;
} else if (pass=='microsoft') {
var currentloc=microsoft;
}
else {
var currentloc ='http://www.mysite.com/sorry';
}
window.open(currentloc, 'formpopup', 'width=800,height=600,resizeable=1,scrollbars=1');
});
});
</code></pre>
<p>this works when i run it on ffcurrent macintosh, but not when i run it in ie7. then the popup window is the same as the window we are coming from.</p>
|
javascript jquery
|
[3, 5]
|
2,812,755 | 2,812,756 |
Cancel step if validation fails in asp.net wizard
|
<p>I am using asp.net wizard in my project which is new to me. I have validations in one of the steps in my wizard. If the validation fails i should not allow the user to go to next step. And i am using a asp.net button which navigate between the steps in wizard. I would really appreciate if anyone could help me.</p>
|
c# asp.net
|
[0, 9]
|
5,819,194 | 5,819,195 |
How to escape new line chars in php to output into a javascript string value?
|
<p>I pulling out some html/text strings that I need to insert into a javascript variable.</p>
<p>eg, that's how it would look in php: </p>
<pre><code>echo "<script type=\"text/javascript\">\n";
echo "var myvar='{$value}'";
echo "\n</script>";
</code></pre>
<p>The problem with the above approach is that some special characters would actually break the javascript code.</p>
<p>So, I tried using htmlspecialchars:</p>
<pre><code>htmlspecialchars($value,11,'utf-8',true); //11 stands for ENT_QUOTES|ENT_SUBSTITUTE
</code></pre>
<p>This did replace some unusual chars and most importantly the quotes.</p>
<p>However the new line chars pass it by and break my javascript.</p>
<p>So how could I escape the new line chars? I need to preserve them to be used later in the textareas.</p>
<p>*<strong><em>EDIT</em>*</strong> I will post a sample value of my variable. (They are actually the input from Tiny_mce)</p>
<pre><code> <p>You've been...</p>
<p><iframe src="http://www.youtube.com/embed/8d7OBluielc?wmode=transparent" frameborder="0" width="640" height="360"></iframe></p>
</code></pre>
|
php javascript
|
[2, 3]
|
5,986,226 | 5,986,227 |
Facebook link inspector
|
<p>I'm building a website and am looking for a way to implement a certain feature that Facebook has. The feature that am looking for is the link inspector. I am not sure that is what it is called, or what its called for that matter. It's best I give you an example so you know exactly what I am looking for.</p>
<p>When you post a link on Facebook, for example a link to a youtube video (or any other website for that matter), Facebook automatically inspects the page that it leads you and imports information like page title, favicon, and some other images, and then adds them to your post as a way of giving (what i think is) a brief preview of the page to anyone reading that post.</p>
<p>I already have a feature that allows users to share a link (or URLs). What I want is to do something useful with the url, to display something other than just a plain link to a webpage, to give someone viewing a shared link (in the form if a post) some useful insight into the page that the url leads to. </p>
<p>What I'm looking for is a script, or tutorial, or at the very least someone to point me in the right direction, so that it can help me accomplish this (using PHP preferably).
I've tried googling it but I don't know exactly what such a feature would be called and google isn't helpful when you don't exactly know what you're looking for.
I figure someone out there, in this vast knowledge basket called stackoverflow, can help me with this. Can anyone help me?</p>
|
php javascript
|
[2, 3]
|
2,191,572 | 2,191,573 |
Executing javascript code stored in an element attribute using jQuery
|
<p>say there is an element #button with the attribute onmousedown containing some random javascript how could I trigger the js in that element attribute using jQuery? </p>
<pre><code>j("#otherbutton").click(function(){
var script = j("#button").attr("onmousedown"); //what now?
});
</code></pre>
|
jquery javascript
|
[5, 3]
|
4,659,074 | 4,659,075 |
How to disable HTML links
|
<p>I have a link button inside a TD which i have to disable. This works on IE but not working in Firefox and Chrome.
Structure is - Link inside a TD. I cannot add any container in the TD (like div/span)</p>
<p>I tried all the following but not working on Firefox (using 1.4.2 js):</p>
<pre><code>$(td).children().each(function () {
$(this).attr('disabled', 'disabled');
});
$(td).children().attr('disabled', 'disabled');
$(td).children().attr('disabled', true);
$(td).children().attr('disabled', 'true');
</code></pre>
<p>Note - I cannot de-register the click function for the anchor tag as it is registered dynamically. AND I HAVE TO SHOW THE LINK IN DISABLED MODE.</p>
|
javascript jquery
|
[3, 5]
|
981,967 | 981,968 |
Send mail with attachment
|
<p><strong>Edit</strong>: <strong>I'm able to send mail without attachment</strong> </p>
<p>Getting this error while trying to send mail:</p>
<pre><code>System.Net.Mail.SmtpException: The operation has timed out.
</code></pre>
<p>Following is my code:</p>
<pre><code>public static void SendMailMessage(string to, string subject, string body, List<string> attachment)
{
MailMessage mMailMessage = new MailMessage();
// string body; --> Compile time error, body is already defined as an argument
mMailMessage.From = new MailAddress("[email protected]");
mMailMessage.To.Add(new MailAddress(to));
mMailMessage.Subject = subject;
mMailMessage.Body = body;
foreach (string s in attachment)
{
var att = new Attachment(s);
mMailMessage.Attachments.Add(att);
}
// Set the format of the mail message body as HTML
mMailMessage.IsBodyHtml = true;
// Set the priority of the mail message to normal
mMailMessage.Priority = MailPriority.High;
using (SmtpClient mSmtpClient = new SmtpClient())
{
mSmtpClient.Send(mMailMessage);
}
}
</code></pre>
<p>Web Config</p>
<pre><code> <system.net>
<mailSettings>
<smtp from="mailid">
<network host="smtp.gmail.com" port="587" enableSsl="true" userName="username" password="pass" />
</smtp>
</mailSettings>
</code></pre>
<p></p>
<p>Note : Attachments not exceeding its limit(below than 25 mb)</p>
<p>What can I do to solve this problem, or what am I missing?</p>
|
c# asp.net
|
[0, 9]
|
4,031,662 | 4,031,663 |
How to make /#!/ in our URL?
|
<p>Everyone!</p>
<p>Almost 3 hours im stack in this problem! iv'e copy the concept in twitter like this if twitter.com/#!/username then the page/profile is username, </p>
<p><a href="http://twitter.com/#!/mardagz" rel="nofollow">http://twitter.com/#!/mardagz</a> as you can see it redirected to my account, so now im trying to make my own by getting the current url.. then i trim to string and split it by (/#!/) and when i try to apply nothing works...</p>
<p>assuming that the current url is <a href="http://www.domain.com/#!/about" rel="nofollow">http://www.domain.com/#!/about</a></p>
<p>the Code:</p>
<pre><code>$(window).load(function () {
var getUrl = top.location;
var trimUrl = jQuery.trim(getUrl);
var splitUrl = trimUrl.split('/#!/')
//alert(splitUrl[1]);
switch(splitUrl[1])
{
case 'home':
//Do Something
break;
case 'skill':
//Do Something
break;
case 'about':
//Do Something go to About Us Page!
break;
}
});
</code></pre>
<p>owhh it's not working... whew anyone has a solution for this? :) thank you in advance.. :)</p>
|
javascript jquery
|
[3, 5]
|
2,395,732 | 2,395,733 |
Javascript hour countdown error
|
<p>I have a countdown timer which transfers time from H:i:s to long version using this script:</p>
<pre><code>function parseTime() {
var timeLeftStr;
var timeLeft = 0;
timeLeftStr = document.getElementById("timeleft").innerHTML;
timeLeftStr.replace(/(\d+):(\d+):(\d+)/, function () {
for (var i = 1; i < arguments.length - 2; i++) {
// Convert to ms
timeLeft += arguments[i] * Math.pow(60, 3 - i) * 1000;
}
});
countdown(new Date(timeLeft));
}
function countdown(timeLeft) {
var hours = timeLeft.getHours();
var minutes = timeLeft.getMinutes();
var seconds = timeLeft.getSeconds();
if (timeLeft.valueOf() == 0) {
document.getElementById("timeleft").innerHTML = "0 seconds";
window.location = 'home.php?pageid=' + getURLParam("pageid");
return false;
} else {
document.getElementById("timeleft").innerHTML =
(hours == 0 ? "" : hours + (hours == 1 ? " hour" : " hours")) +
(minutes == 0 ? "" : (hours ? (seconds ? ", " : " and ") : " ") + minutes + (minutes == 1 ? " minute" : " minutes")) +
(seconds == 0 ? "" : (hours || minutes ? " and " : "") + seconds + (seconds == 1 ? " second" : " seconds"));
setTimeout(function () { countdown(new Date(timeLeft - 1000)); }, 1000);
}
}
window.onload = parseTime;
</code></pre>
<p>The error is that a user of mine who lives in Australia keeps getting the wrong "hour"
The original timer would say something like "23:45:05" but when the countdown timer starts it says "10 hours, 45 minutes and 5 seconds" rather than 23 hours. </p>
<p>Any idea why this could be happening? Thank you.</p>
<p>Im not that great at JS, this was created by a friend. </p>
<p>Worked it out in the end.</p>
|
php javascript
|
[2, 3]
|
136,844 | 136,845 |
handle cookie through XML web server
|
<p>I am dealing with XML API, where according to the document, i need to login XML call first before making secure(HTTPS) calls.
e.g. to make login call (http://calllogin.do?username=test&password=password).
once i am successfully logged in, third party system will write cookie.
everytime i make https call third party system will read security details from cookie.
But sytsem i am designing is like "man in the middle".
In a nutshell -
1 - user logs in to my system
2 - sends query to my server
3 - my web application reads the querystring and send request to third party system, process the response and send to browser.
therefore the main problem is how can I handle this cookie problem.
I will be using c# as my web application
Hopefuly I was able to explain my scenario</p>
|
c# asp.net
|
[0, 9]
|
2,187,592 | 2,187,593 |
call the same name functions in jquery?
|
<p>i have 2 file js in my asp website named</p>
<pre><code>1-jquery.datepick.js
2-jquery.hijridatepick.js
</code></pre>
<p>these file have the same name functions but second one apear popup hijricalender i call it by</p>
<pre><code> <script type="text/javascript">
$(function () {
$('[id$=TextBox1]').datepick({ dateFormat: 'dd/mm/yyyy' });
});
</script>
</code></pre>
<p>for <code>textbox2</code> i wanna 2 use datepick function from first file how icall it cause i refrenced the first file as</p>
<pre><code> $('[id$=TextBox2]').datepick({ dateFormat: 'dd/mm/yyyy' });
</code></pre>
<p>but this call again the function of second file
???</p>
|
javascript jquery asp.net
|
[3, 5, 9]
|
1,424,825 | 1,424,826 |
Javascript Type Error, is not a function
|
<p>I've got abit of a strange problem, that I just can't seem to solve! It's part of a big framework I'm writing, but I've wrote some test code which has the same problem. See the following:</p>
<pre><code>!function ($, window, undefined) {
// BASE FUNCTION
var test = function (selector, context) {
return new test.fn.init(selector, context);
};
// SELECTOR FUNCTIONS
test.fn = {
selector: undefined,
init: function (selector, context) {
// Use jQuery to build selector object
this.selector = $(selector, context);
return this;
},
// Create a popup dialog
popup: function (options) {
this.selector.dialog();
}
},
// Expose Carbon to the global object
window.test = test;
}(window.jQuery, window);
</code></pre>
<p>Now when I use the following:</p>
<pre><code>test('#popupLink').popup();
</code></pre>
<p>I get "TypeError: test("#popupLink").popup is not a function". I know it's partly working, as I can do use standard jQuery functions if I do something like:</p>
<pre><code>test('#popupLink').selector.hide();
</code></pre>
<p>Any help would be greatly appreciated, as I'm having a mental block right now.
Thanks in advance! :)</p>
<p><strong>Update</strong></p>
<p>I've used console.log to view the returned object, and it only has the selector element in, which makes sense as I didn't use prototype. How can I fix that?</p>
|
javascript jquery
|
[3, 5]
|
978,255 | 978,256 |
How to change the message box title?
|
<p><img src="http://i.stack.imgur.com/6mZQS.png" alt="enter image description here"></p>
<p>How to change the title of this message box in asp.net?</p>
<p>this heading appears in IE.</p>
<p>Do Help...</p>
|
javascript asp.net
|
[3, 9]
|
1,625,044 | 1,625,045 |
Android equivalent of IBActions and IBOutlets
|
<p>I am thinking of starting with android development. </p>
<p>What are the equivalents of IBActions and IBOutlets in android? </p>
<p>Is it as easy as Interface Builder to setup connections to code?</p>
<p>Is it quick to learn the basics of android development if one knows java?</p>
|
iphone android
|
[8, 4]
|
2,117,922 | 2,117,923 |
LinkButton open new windo tab
|
<pre><code><asp:LinkButton ID="lnkbtnMoreTagRules" runat="server"
CommandName='<%#Eval("Value")%>'
CommandArgument='<%# string.Format("{0}||||{1}", Eval("Tag"),
Eval("TagAppearance"))%>'
OnCommand="lnkbtnMoreTagRules_Command">Več pravil</asp:LinkButton>
</code></pre>
<p>I want to close current window tab and open new one. </p>
<p>How can i open a new window tab with linkbutton. <code>target="_blank"</code> not helping.</p>
|
c# asp.net
|
[0, 9]
|
150,520 | 150,521 |
controlling vibration intensity in android phones? is it possible?
|
<p>I am developing a game. In which, i want do set different vibration intensities for different events. I just want know if its really possible to control the vibration intensity and duration. Any advice or reference links, could be very helpful. Thanks in advance.</p>
|
java android
|
[1, 4]
|
3,313,823 | 3,313,824 |
list with scrollview
|
<p>I have list with <code>scrollview</code> after i add the scroll i try to change the height
of the scroll view so the list be in the center of the layout and the height be more but it dose not working.</p>
|
java android
|
[1, 4]
|
3,640,445 | 3,640,446 |
toggle two images on click
|
<p>I'm trying to use someone's code from an earlier post that I posted on here, and in it, he provided a <a href="http://jsfiddle.net/D9VvV/" rel="nofollow">jsFiddle</a> that shows how to toggle between two images.</p>
<p>I'm trying to replicate exactly what that person is doing, but it doesn't seem to work on my code:</p>
<pre><code><!DOCTYPE html>
<html>
<head>
<script src="jquery.js"></script>
<script>
$('#ellomatey').toggle(
function(){
$(this).attr('src', 'bgimage.png');
},
function(){
$(this).attr('src', 'redsquare.png');
});
</script>
</head>
<body>
<img id="ellomatey" src="bgimage.png" />
</body>
</html>
</code></pre>
<p>Does anyone know what I'm doing wrong? I have a feeling that it's not calling the function correctly, but it seems to work on that person's example.</p>
|
javascript jquery
|
[3, 5]
|
1,284,825 | 1,284,826 |
jQuery animate effect optimization
|
<p>I am experimenting with jQuery and the animate() functionality. I don't believe the work is a final piece however I have problem that I can't seem to figure out on my own or by trolling search engines.</p>
<p>I've created some random animate block with a color array etc and everything is working as intended including the creation and deletion of the blocks (div's). My issue is within 2mins of running the page, Firefox 4 is already at more than a 500,000k according to my task manager. IE9 & Chrome have very little noticeable impact yet the processes still continue to increase.</p>
<p>Feel free to check out the link here: <a href="http://truimage.biz/wip300/project%202/" rel="nofollow">http://truimage.biz/wip300/project%202/</a></p>
<p>My best guess are the div's are being created at a greater speed than the 2000ms they are being removed however I was hoping an expert might either have a solution or could explain what I am doing wrong and some suggestions.</p>
<p>On another note, from the start of my typing this out till now the process is at 2,500,000k. Insane!m</p>
|
javascript jquery
|
[3, 5]
|
3,871,278 | 3,871,279 |
What does this code mean? $.getJSON
|
<p>i know this:</p>
<pre><code>$.getJSON(
"test.js",
function(json){
alert("JSON Data: " + json.users[3].name);
}
);
</code></pre>
<p>but i see the code in a site:</p>
<pre><code>$.getJSON(l, {
tag: "userName",
userName: 'sss'
}
</code></pre>
<p>what is '1' mean,in this place.</p>
<p>thanks</p>
|
javascript jquery
|
[3, 5]
|
356,860 | 356,861 |
Saving File on Long Click
|
<p>I have an app that plays mp3's. I want to make it so when you long click/press on the button it will save the mp3 file to there ringtones directory. Also want a toast notification if possible. Could someone shoot me into the right direction? </p>
<p>Thanks</p>
<p>EDIT:
This is what I have so far</p>
<pre><code> @Override
public boolean onLongClick(View arg0) {
Toast toast = Toast.makeText(AkaliMain.this, "Saved",5000);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
return false;
}
});
</code></pre>
<p>EDIT 2:
This is what I have now. Cant even get it to compile.</p>
<p><a href="http://pastebin.com/raw.php?i=EijmBrSL" rel="nofollow">http://pastebin.com/raw.php?i=EijmBrSL</a></p>
|
java android
|
[1, 4]
|
4,947,541 | 4,947,542 |
Run two mediarecorders at the same time
|
<p>I am implementing <strong>talking tom</strong> like application I am implementing the record and play feature for it like it plays the recorded audio when it detects silence </p>
<p>what I have understood so far is </p>
<ol>
<li>we need two recoders running at the same point of time</li>
<li>one checks the amplitude and another one records the sound</li>
<li>as soon as 1st recorder detects silence it stops the recorder 2 and we can play the recorded sound.</li>
<li>Repeat this process again.</li>
</ol>
<p>but the problem is that I am not able to run 2 mediarecorders at the same time in android however I was able to do the same in iPhone.</p>
<p>Please suggest some solution to this problem,thanks in advance.</p>
|
java android
|
[1, 4]
|
4,615,200 | 4,615,201 |
how to deal with an undefined query variable
|
<p>I have the following to launch dialogs in my app:</p>
<pre><code>$('.dialogDo').live('click', function() {
// Do we have a custom width?
var width = this.search.match(/width=(\d+)/)[1];
if (width) {
dialogDo(this.href, width);
}
else {
dialogDo(this.href, 480);
}
return false;
});
</code></pre>
<p>This works fine if width is defined in the href which trigger the click function above. Problem is if width is not defined it breaks. How can I deal with an undefined width while still maintaining the functionality to use a width if provided?</p>
<p>Thanks</p>
|
javascript jquery
|
[3, 5]
|
4,240,071 | 4,240,072 |
ArrayList of images to GridView
|
<p>I have a list of images in my ArrayList, I would like to display them in GridView, the same way the example is over here: <a href="http://developer.android.com/resources/tutorials/views/hello-gridview.html" rel="nofollow">http://developer.android.com/resources/tutorials/views/hello-gridview.html</a></p>
<pre><code>ArrayList<String> myPhotos = new ArrayList<String>();
</code></pre>
<p>This specific example shows how to do it with drawables what I have already included in my project, how to do it with images that I know full path and are located in SD Card?</p>
<p>Or is there other good and easy way to display the array of images from sd card?</p>
|
java android
|
[1, 4]
|
5,521,407 | 5,521,408 |
jQuery object to string help please
|
<p>I am creating a jquery object like so:</p>
<pre><code> htmlCode = $("<div id='"+data.layoutDescriptions[i].id+"'></div");
</code></pre>
<p>It seems to be missing some elements mainly when I am doing this:</p>
<pre><code>if(data.type == "ListView"){
htmlCode.append("<SELECT property='"+ data.property +"' size="+ data.listProps.length +" multiple>");
i = 0;
while(i < data.listProps.length){
htmlCode.append("<OPTION value='"+ i+1 +"'>"+ data.listProps[i] +"</OPTION>");
i++;
}
htmlCode.append("</SELECT>");
}
</code></pre>
<p>where data is a Json object.</p>
<p>When i do this as a string it works. e.g.
instead of </p>
<pre><code>htmlCode.append("<OPTION value='"+ i+1 +"'>"+ data.listProps[i] +"</OPTION>");
</code></pre>
<p>i would do</p>
<pre><code>htmlCode = htmlCode + "<OPTION value='"+ i+1 +"'>"+ data.listProps[i] +"</OPTION>";
</code></pre>
<p>I want to find out what is missing so I want to see the Object
i have tried the following:</p>
<pre><code>alert(JQuery.htmlCode.stringify());
alert(htmlCode.html);
</code></pre>
<p>Nether work.</p>
<p>Any Ideas??</p>
<p>Thanks.</p>
|
javascript jquery
|
[3, 5]
|
929,859 | 929,860 |
JavaScript Library for opening Excel Files on the Web
|
<p>Is there a javascript library that processes an excel file on the client side of the web? </p>
|
javascript jquery
|
[3, 5]
|
707,672 | 707,673 |
Map structure in Android and dynamic memory allocation
|
<p>Not so recently I've published a game that is written entirely in Java on Android platform. Currently I'm trying to get as much of the performance as possible. It seems that the problem in my game's case is that I'm using more too often <code>ArrayList</code> container in places where <code>Map</code> could be better suited. To explain myself I did it because I was afraid of dynamic memory allocations that would be triggered behind the scene (<code>Map</code>/<code>Tree</code> structures on Android). Maybe there is some sort of structure on Android/Java platform I don't know about, which will provide me with fast searching results and additionally will not allocate dynamically extra memory when adding new elements?</p>
<p>UPDATE:
For example I'm using an ArrayList structure for holding most of my game's Particles. Of course removing them independently (not sequentially) is a pain in the b**t as the system needs to iterate through the whole container just to remove one entity object (of course in the worst case scenario).</p>
|
java android
|
[1, 4]
|
326,314 | 326,315 |
Java hierarchy inside an android listner
|
<p>In my android application I want to solve the following scenario.</p>
<pre><code>class Login extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LayoutBuilder objLB=new LayoutBuilder(this);
objLB.createSpinner();
}
public void spinnerItemSelectedEvent(AdapterView<?> parent, View view,
int pos, long id)
{
}
}
class LayoutBuilder {
private Activity objActivity;
public LayoutBuilder(Activity a) {
objActivity = a;
}
public void createSpinner() {
final Spinner objSPItem = new Spinner(objActivity);
objSPItem.setOnItemSelectedListener(
new Spinner.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view,
int pos, long id)
{
// Do some common activity
objActivity.spinnerItemSelectedEvent(parent,view,pos,id);
// calling this for do some additional task
}
public void onNothingSelected(AdapterView<?> arg0) {}
});
objActivity.spinnerItemSelectedEvent()
}
}
</code></pre>
<p>and the problem is when i try to access spinnerItemSelectedEvent(parent,view,pos,id) from the 'onItemSelected' listner inside createSpinner method
I got the following error.</p>
<p><strong>The method spinnerItemSelectedListener(AdapterView, View, int, long) is undefined for the type Activity</strong></p>
<p>but out side the listner the access to the method works ok(neglect parameter list). What is the reason behind that? is any alternate way exist for solving this? plz help </p>
|
java android
|
[1, 4]
|
2,352,759 | 2,352,760 |
asp.net jquery loading values on page after post back
|
<p>Im currently trying to use a jQuery plugin:
<a href="http://loopj.com/2009/04/25/jquery-plugin-tokenizing-autocomplete-text-entry/" rel="nofollow">jQuery Autocomplete Tokenizer</a>
Now after posting back the page, I want to re-load the values back into the textbox for whatever items had been entered.</p>
<p>Now the jQuery on the page is like below:</p>
<pre><code>$(document).ready(function () {
$("#<%=txtPeople.ClientID %>").tokenInput("Handler.ashx", {
hintText: "Type in a name",
noResultsText: "No results",
searchingText: "Searching...",
prePopulateFromInput: true
},
prePopulate: **Here is where I want to add JSON listing the items that should be populated**
});
});
</code></pre>
<p>If I add the JSON below within the prepopulate it loads the values the first time the form loads (And after any postbacks, so I need a way to make this a variable, that I can feed into the javascript on the page, and also have it updated by any client side changes)</p>
<pre><code>[{"id":1,"name":"Ben"},{"id":2,"name":"Bernard"},{"id":3,"name":"Joe Bentley"}]
</code></pre>
<p>Can anyone point me in the right direction or give any references that may help? thanks</p>
|
javascript asp.net jquery
|
[3, 9, 5]
|
3,951,226 | 3,951,227 |
Disable PrettyPhoto in code
|
<p>How can I disable <a href="http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/" rel="nofollow">PrettyPhoto</a> after it has been enabled?</p>
<pre><code>$(document).ready(function () {
$("a[rel^='prettyPhoto']").prettyPhoto();
}
$("#disablePrettyphoto").click(function (e) {
$("a[rel^='prettyPhoto']").KILLPRETTYPHOTO();
});
</code></pre>
<p>On a page with images, where I use Prettyphoto, I need to do some drag and drop action on the same images. Doing this with prettyPhoto enabled is not nice, as it fires the popups when I am dragging and dropping (as it should). So when I enable drag and drop, I want to disable PrettyPhoto and enable it again when I disable drag and drop.</p>
|
javascript jquery
|
[3, 5]
|
2,202,257 | 2,202,258 |
unzipping a file using c#
|
<p>which one is better to unzip a file in C# using window shell or uzipping it in c# using third party software like DotNetZip?</p>
|
c# asp.net
|
[0, 9]
|
3,771,561 | 3,771,562 |
window.navigate and document.location issue
|
<p>I am working on a system that after completing a record edit and returning control to the calling AJAX script, I refresh the calling page by calling a custom server extension. The odd behavior I am experiencing is after control is returned to the calling script, when the code hits window.navigate or document.location, it attempts to navigate to the url in a new window (which is not the desired behavior). Additionally, the custom server extension is never called - the url appears in the address bar, but then does nothing.</p>
<p>Does anyone have any idea what might be going on? I am running IIS 5.1 on XP sp3 and have tried to get it to work in IE 8 and IE 7, to no avail. Any help would be greatly appreciated.</p>
|
c# javascript
|
[0, 3]
|
291,268 | 291,269 |
Javascript with PHP
|
<p>I have an overlay image that is created in Javascript using the 'Createelement' function. Now I would like to know if I can attach a handler to the mouseover event using PHP? </p>
<p>Can you give an example pls?</p>
<p>The image appears only when hovering over the element below it. </p>
<p>Regards,
T</p>
<p><strong>UPDATE</strong> I want to handle the mouseover event of that element with PHP on server side. Just cause the whole site I'm editing is coded in PHP. The problem is that all HTML/CSS & JS is generated by PHP code of this site, so I'm thinking using PHP will be easier.</p>
<p>What will the effects of that be on the user though, speed etc?</p>
<p><strong>UPDATE2</strong>: So the image that I want to add this handler to, only appears when the mouse is hovered over the image below. Now, when one then hovers over that hovering image, it flickers. I'm trying to suppress the 'mouseover' event of that hovering image so it doesn't reload when hovered over, and so stops flickering.</p>
|
php javascript
|
[2, 3]
|
5,455,242 | 5,455,243 |
what's the behind jquery event delegate?
|
<p>Someone told me sometimes event delegate more efficient.</p>
<pre><code><ul id="test">
<li>aaaaa<li>
<li>bbbbb <p>xxxxx<p> </li>
<li>ccccc<li>
</ul>
//script
var li = document.getElementByTagName('li');
for(var i=0,len=li.length;i<len;i++){
li[i].addEventListener('click',function(){ alert(this.innerHTML); },false);
}
//event delegate
var ul = document.getElementById('test');
ul.addEventListener('click',function(e){
if(e.target == 'li'){
alert(e.target.innerHTML);
}
},false);
</code></pre>
<p>It works not good when you click 'p' in 'li'. I know jquery has method 'on',it's useful.
I try to read jquery source code ,but can not understand how to implement a delegate function work under complexity DOM.</p>
|
javascript jquery
|
[3, 5]
|
3,326,624 | 3,326,625 |
Javascript show/hide - I don't want it to hide the entire element
|
<p>This is probably a fairly easy question, but I'm new to JavaScript and jquery....</p>
<p>I have a website with a basic show/hide toggle. The show/hide function I'm using is here:
<a href="http://andylangton.co.uk/articles/javascript/jquery-show-hide-multiple-elements/" rel="nofollow">http://andylangton.co.uk/articles/javascript/jquery-show-hide-multiple-elements/</a></p>
<p>So here's my question..... I would really like the first 5-10 words of the toggled section to always be visible. Is there some way I can change it so that it doesn't hide the entire element, but hides all but the first few words of the element?</p>
<p>Here's a screenshot of what I would like it to do:
<a href="http://answers.alchemycs.com/mobile/images/capture.jpg" rel="nofollow">http://answers.alchemycs.com/mobile/images/capture.jpg</a></p>
|
javascript jquery
|
[3, 5]
|
5,595,181 | 5,595,182 |
jQuery slider with delayed elements/content
|
<p>I'm looking for a jQuery slider similar to this <a href="http://www.apple.com/uk/imac/" rel="nofollow">http://www.apple.com/uk/imac/</a> or <a href="http://www.reachlocal.com/" rel="nofollow">http://www.reachlocal.com/</a>.</p>
<p>I believe Apple calls theirs "hero slider".</p>
<p>I was looking at easy slider which is very similar but I want the text to slide in a couple of seconds before or after the image? Mostly visible on the Apple website.</p>
<p>Could anyone please point me in the right direction?</p>
|
javascript jquery
|
[3, 5]
|
377,583 | 377,584 |
How is it possible to cast an Android Activity to an interface?
|
<p>In the Android documentation here: <a href="http://developer.android.com/guide/components/fragments.html" rel="nofollow">http://developer.android.com/guide/components/fragments.html</a> A Fragment implements an interface.</p>
<p>In the onAttach() callback, it seems to cast the current Activity to an interface. Conceptually, how is this possible and is the same type of cast standard practice in vanilla Java?</p>
<pre><code>public static class FragmentA extends ListFragment {
// Container Activity must implement this interface
public interface OnArticleSelectedListener {
public void onArticleSelected(Uri articleUri);
OnArticleSelectedListener mListener;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mListener = (OnArticleSelectedListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString() + " must implement OnArticleSelectedListener");
}
}
...
}
</code></pre>
|
java android
|
[1, 4]
|
3,286,592 | 3,286,593 |
How to make Product List in ASP.net C#
|
<p>how to display Product list in ASP.net C#? i'm creating e-commerce website for my thesis i need to display it in a grid form like this >> <a href="http://pcx.com.ph/components/processors.html?p=2" rel="nofollow">sample product list</a> with limitation per page example 10 products per page please i need your help</p>
<p><img src="http://i.stack.imgur.com/Owljl.png" alt="My Product Database"></p>
|
c# asp.net
|
[0, 9]
|
1,799,076 | 1,799,077 |
Can I install an Android application from a byte array programmatically?
|
<p>I know I can install an Android application programmatically by the below code which passes the <a href="http://en.wikipedia.org/wiki/Uniform_Resource_Identifier" rel="nofollow">URI</a> of an <a href="http://en.wikipedia.org/wiki/APK_%28file_format%29" rel="nofollow">APK</a> file. Can I install the application without passing an APK file URI? For example, getting the byte array of an APK file and installing it?</p>
<pre><code>File appFile = new File("application.apk");
Intent installIntent = new Intent(Intent.ACTION_VIEW);
installIntent.setDataAndType(Uri.fromFile(appFile),"application/vnd.android.package-archive");
startActivity(installIntent);
</code></pre>
|
java android
|
[1, 4]
|
1,901,734 | 1,901,735 |
jQuery - Get value of hyperlink.navigateurl
|
<p>I bind click to a series of <code>asp:hyperlink</code> via the following jquery</p>
<pre><code>$(".dummyIdentifier").click(function () {
$("#divLineItemComments").dialog("open");
return false;
});
</code></pre>
<p>This works fine. Now, I need to pass the value of Hyperlink.NavigateUrl <code>OnClick</code>. So that I may include the values with ajax <code>$.get()</code></p>
<p>How can I get the value of a clicked hyperlink? I do not know it's ID as the hyperlinks are generated dynamically along with their names by ASP.NET.</p>
<pre><code> <asp:TemplateField HeaderText="Notes" ItemStyle-CssClass="NoMargin NoPadding" SortExpression="lineNotes">
<ItemTemplate>
<asp:HyperLink id="notesHl" runat="server" text='<%# Bind("lineNotes") %>' Font-Underline="true" Font-Bold="true" CssClass="dummyPhysicalNoteIdentifier"></asp:HyperLink>
</ItemTemplate>
<ItemStyle Font-Size="Smaller" Height="10px" Width="10px" Wrap="True" />
</asp:TemplateField>
</code></pre>
|
jquery asp.net
|
[5, 9]
|
5,413,176 | 5,413,177 |
The requesterd URl could not be found AJAX
|
<p>I have an ASP.net application, when i run it the page load but the method which are AJAX method they do not load. and i get this error.</p>
<p>Error 1: </p>
<blockquote>
<p>/ajax/UserControls_WebUserControl,App_Web_webusercontrol.ascx.6bb32623.ssiyzisi.ashx</p>
</blockquote>
<p>I have re-install AJAX, check the reference of the AJAXControlToolKit.dll path in bin and so on...<br>
In <code>web.config</code> file I am using:</p>
<pre><code><add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax" />
</code></pre>
<p>But with no luck.</p>
<p>Error 2: </p>
<blockquote>
<p>Description: HTTP 404. The resource
you are looking for (or one of its
dependencies) could have been removed,
had its name changed, or is
temporarily unavailable. Please
review the following URL and make sure
that it is spelled correctly.</p>
</blockquote>
|
c# asp.net
|
[0, 9]
|
296,890 | 296,891 |
Two animations run the same time jquery
|
<p>I have tried to make two squares move at the same time...
I know the first animation is repeating to infinite but what should i do?</p>
<p><a href="http://goo.gl/cgrWg" rel="nofollow" title="JsFiddle">JsFiddle</a></p>
|
javascript jquery
|
[3, 5]
|
620,757 | 620,758 |
Starting jQuery autocomplete immediately after my Ajax call to server
|
<p>In my code I bind a <code>keyup</code> event to my input to check if the input value's length is 3.
If it is, I make an Ajax call to the server getting the records from my database which start with these 3 character entered and then I start jQuery autocomplete with source - the data from database.</p>
<p>The problem is when the user enters three characters, I get the source for the autocomlete and only when he enters the fourth character the autocomplete starts. Is it possible to change that behaviour and as soon you enter 3 characters and get the source to start autocomplete?</p>
<p>Here is my code:</p>
<pre><code>var keypresshandler = function () {
var strin = document.getElementById('txtInput').value;
newstr = strin.replace(/[^\u0400-\u04FF0-9]/gi, '');
if (newstr.length<3)
{
$( "#txtInput" ).autocomplete( "destroy" );
} else
if (newstr.length==3)
{
triming();
}
}
$(function() {
$('#txtInput').bind('keyup', keypresshandler);
});
function triming() {
//make asynchronous ajax call to server to get the source of my autocomplete
// alert (mec.length);
$( "#txtInput" ).autocomplete({source: mec});
}
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,491,177 | 3,491,178 |
Need help regarding submitting values through a form with select Box?
|
<p>I have a empty select box on a form. </p>
<p><code><select id='essentialDocs[]' ></select></code></p>
<p>through some script i add options to it. Basically it adds URL's. So at runtime html will look
like </p>
<pre>
<code><select id='essentialDocs[]' >
<option value='http://www.google.com' title='Google'>Google</option>
<option value='http://www.yahoo.com' title='yahoo'>Yahoo</option>
</select></code>
</pre>
<p>Now on submitting the form i want to get both of these key:value pairs</p>
<p>like Title:URL google:http://www.google.com</p>
<p>but on doing <code>$_POST['essentialDocs']</code> i only get values and not title's. What modification would help get me both. Also another thing i have on the form is i can switch the ordering of url's on screen. Please suggest some solution</p>
|
php javascript
|
[2, 3]
|
1,119,739 | 1,119,740 |
JQuery - Help with .animate and function callback
|
<p>I am trying the following, but cant get the function to run itself again (I am trying to create some kind of looping animation)</p>
<pre><code>$(document).ready(function() {
//function loopingFunction(){
function loop() {
$('#item').animate({top:'+=100'}, 500, function() {
$('#item').animate({top:'-=100'},500, function(){
loop;
});
});
}
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,993,647 | 3,993,648 |
c# transform ref_cursor into a list ar a dictionary
|
<p>Hi I was wondering how to transform ref_cursor with a table of results generated by a stored procedure into a list or dictionary,I mean this:</p>
<p>stored proc procedure(userID in integer,result out sys_refcursor);
returns a table 6*5 or smtng similar</p>
<p>now we call this procedure from c# and we have a ref_cursor in C# =></p>
<p>At this point how to transform ref_cursor into a dictionary/list???</p>
<p>hope you could show some examples or usefull links :)</p>
|
c# asp.net
|
[0, 9]
|
859,186 | 859,187 |
I want a tab control in asp.net with previous and next button
|
<p>I want a tab control which will have say 4 tabs. in the content of 1st tab, there will be a button named as "Next". Onclick of "Next",it should go to 2nd tab or switch to 2nd tab. Similar way, 2nd tab will have "Previous" and "Next" buttons which will switch to 1st and 3rd tab respectively.</p>
|
c# jquery asp.net
|
[0, 5, 9]
|
5,153,028 | 5,153,029 |
Select2: search based on tags
|
<p>I would like to have search box like below image.</p>
<p><a href="https://plus.google.com/u/0/photos/114872147731683389826/albums/5843935056831072545?authkey=CKai5M3A-ePvogE" rel="nofollow">https://plus.google.com/u/0/photos/114872147731683389826/albums/5843935056831072545?authkey=CKai5M3A-ePvogE</a></p>
<p>Can I have it with select2 plugin? If yes tell me the way how to do that? Or else point me any other way to do that</p>
|
javascript jquery
|
[3, 5]
|
1,471,951 | 1,471,952 |
Required fields check in asp.net textbox
|
<p>How can I implement a clientsidevalidation required textfields which contain the following texts:</p>
<p>[Name required]
[Address required]</p>
<p>Preferrably I would like to use the asp:CustomValidator if possible? Only if both fields have data the postback will be triggered?</p>
<pre><code> <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script type="text/javascript"> var $j = jQuery.noConflict();</script>
<script type="text/javascript">
function otherMessageValidator_ClientValidation(source, args) {
args.IsValid = false;
var nm = $j("#name");
if (nm.val() != "" && nm.val() != "[Name required]") {
args.IsValid = true;
}
return args.IsValid;
};
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="name" runat="server" ValidationGroup="valgroup">[Name required]</asp:TextBox>
<asp:TextBox ID="address" runat="server" ValidationGroup="valgroup">[Address required]</asp:TextBox>
</div>
<asp:Button runat="server" ID="but1" Text="go" OnClick="but1_Click" />
<asp:CustomValidator ID="MyCustomValidator" runat="server" ValidationGroup="valgroup"
ClientValidationFunction="otherMessageValidator_ClientValidation" ErrorMessage="At least one textbox needs to be filled in." />
</form>
</body>
</html>
</code></pre>
|
c# asp.net
|
[0, 9]
|
1,592,052 | 1,592,053 |
How to handle adding a close link within an UL/LI item
|
<p>I've got some code like so:</p>
<pre><code><ul id="ulPersonal">
<li class="break eTime">
<p>Manage your time card.</p>
<div id="dEtime">
some content
</div>
</li>
</ul>
</code></pre>
<p>The div only appears once you hove over the <code>li</code> item, in jquery:</p>
<pre><code> $('#dEtime').hide(); //initially hide the div...
//when the user hovers show the div
$(".eTime").hover(function () {
$('#dEtime').fadeIn('slow');
});
</code></pre>
<p>So basically the page shows the li item, I hove over it and the div is shown. Now I tried it so that when you "un-hover" off the li then the div disappears, however the UX was not friendly...to much flickering. </p>
<p>So I decided to add a close hyperlink...but if I add it within the li item and click on it, the div reappears as I am still "hovering" inside the li. How can I handle this so that I can allow the user to close the div?</p>
<p>I've got a lot of seperate <code>ul</code> items that do this, so I dont want to add the close link after the ul, and obviously I cannot just add an <code>href</code> tag outside of an li, as that is just plain wrong.</p>
|
javascript jquery asp.net
|
[3, 5, 9]
|
1,323,171 | 1,323,172 |
Is there any function like contains from Java for PHP?
|
<p>I would like to know if is there any function that search a string within string and return boolean value in PHP, telling if the string contains or not, like the method contains in Java?</p>
|
java php
|
[1, 2]
|
3,148,175 | 3,148,176 |
Is it better to send XMLHttpRequests to different scripts or one master script that delegates tasks?
|
<p>I am building a rather larger web application with javascript and PHP. The app has several different types of XMLHttpRequests, and my question is about best practice: is it better to send each of those requests to a different PHP script or to one master script which then goes through and delegates tasks? </p>
<p>Currently I have a requestManager script, but it's getting a bit out of hand. I feel like it's nice to have all of my requests hit that same script first because It's easy for me to debug and remember where my requests are going. The problem is that I'm looking at around 10 if-then statements, and I can imagine that might start to slow things down as it gets bigger and bigger.</p>
|
php javascript
|
[2, 3]
|
612,657 | 612,658 |
Android - root shell comands wont work
|
<p>Can someone tell me whts wrong with this code because it doesnt work, it just wont stick what i echo</p>
<pre><code> Process localProcess;
try {
localProcess = Runtime.getRuntime().exec("su");
DataOutputStream localDataOutputStream = new DataOutputStream(localProcess.getOutputStream());
localDataOutputStream.writeBytes("chmod 777 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor\n")
localDataOutputStream.writeBytes("echo " + govselectedcpu0 + " > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor\n")
localDataOutputStream.writeBytes("exit\n");
localDataOutputStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
</code></pre>
|
java android
|
[1, 4]
|
6,004,415 | 6,004,416 |
How to make visible of text boxes on selecting the drop down list which is multi select
|
<p>Hi all i have gone through the example of dropdownlist with checkbox from here</p>
<p><a href="http://www.dotnetspeaks.com/DisplayArticle.aspx?ID=79" rel="nofollow">http://www.dotnetspeaks.com/DisplayArticle.aspx?ID=79</a></p>
<p>which works fine for me . But as per my requirement i will have 3 items in the drop down, if i select all i would like to enable all the 3 text boxes that are avalable on the form. If not i would like to make only the corresponding text box as visible</p>
<p>so in the script as for my testing i write as follows</p>
<pre><code><script language="javascript">
function GetSelectedValue() {
var chkBox = document.getElementById("<%=chkList.ClientID%>");
var checkbox = chkBox.getElementsByTagName("input");
var objTextBox = document.getElementById("<%=txtChkValue.ClientID%>");
var obj1 = document.getElementById("<%=txt1.ClientID%>");
var counter = 0;
objTextBox.value = "";
for (var i = 0; i < checkbox.length; i++) {
if (checkbox[i].checked) {
var chkBoxText = checkbox[i].parentNode.getElementsByTagName("label");
if (objTextBox.value == "") {
objTextBox.value = chkBoxText[0].innerHTML;
if (objTextBox.value = "hi") {
document.getElementById("<%=txt1.ClientID%>").style.visibility = 'visible'; // This is what i tested but this is not working }
}
else {
objTextBox.value = objTextBox.value + ", " + chkBoxText[0].innerHTML;
}
}
}
}
</script>
</code></pre>
<p>So can any one help me please</p>
|
jquery asp.net
|
[5, 9]
|
3,704,937 | 3,704,938 |
Access element, which contains current <script>
|
<p>I've got following page:</p>
<pre><code><div><script>AddSomeContent(??, 1)</script></div>
<div><script>AddSomeContent(??, 2)</script></div>
</code></pre>
<p>I need to replace the <code>??</code> with the surrounding <code><div></code> DOM object, so the function <code>AddSomeContent</code> can modify it. Is there any oportunity to do this?</p>
<p>Before any other comments: I don't have any other option. I'm already trying to hack some existing page, and only thing I can control is content of the <code><script></code>. </p>
<p>I'm using jquery, but I can change it.</p>
<p>Edit: for clarification. <code>AddSomeContent</code> looks like:</p>
<pre><code>function AddSomeContent(somediv, parameter)
{
$(somediv).append('there goes some data, that I dynamically create from some stuff depending on the parameter');
}
</code></pre>
<p>And I want to first div contain result with <code>parameter = 1</code>, second div <code>parameter=2</code></p>
|
javascript jquery
|
[3, 5]
|
777,079 | 777,080 |
How to disable/enable input field on click with jQuery
|
<p>How to properly enable/disable input field on click with jQuery?</p>
<p>I was experimenting with:</p>
<pre><code>$("#FullName").removeAttr('disabled');
</code></pre>
<p>which removes <code>disabled="disabled"</code> from this input field:</p>
<pre><code><input id="FullName" style="width: 299px" value="Marko" disabled="disabled" />
</code></pre>
<p>But how to add it again with click on another button or how to disable input field on click?</p>
|
javascript jquery
|
[3, 5]
|
3,184,225 | 3,184,226 |
How to change the label text in javascript function?
|
<p>i want to validate login page using java script function.
i take one label button for displaying message and two text box for username and password and one button for "Login" . </p>
<p>when user click on "Login" button without enterning username and password then message will be display in label control. So how to check textbox value in javascript function and how to change the value in lblmessage. I call this function in Ok button . I set this function on Button OnClientClick event but this does not work.</p>
|
javascript asp.net
|
[3, 9]
|
768,168 | 768,169 |
javascript object help
|
<p>I'm following a tutorial on how to make a javascript game, but i'm stuck on the return part. Why are is there { }, and what is the init: init for? Any help would be appreciated. Thanks.</p>
<pre><code>var JS_SNAKE = {};
JS_SNAKE.game = (function () {
var ctx;
var xPosition = 0;
var yPosition = 0;
var frameLength = 500; //new frame every 0.5 seconds
function init() {
$('body').append('<canvas id="jsSnake">');
var $canvas = $('#jsSnake');
$canvas.attr('width', 100);
$canvas.attr('height', 100);
var canvas = $canvas[0];
ctx = canvas.getContext('2d');
gameLoop();
}
function gameLoop() {
xPosition += 2;
yPosition += 4;
ctx.clearRect(0, 0, 100, 100); //clear the canvas
ctx.fillStyle = '#fe57a1';
ctx.fillRect(xPosition, yPosition, 30, 50); //a moving rect
setTimeout(gameLoop, frameLength); //do it all again
}
return {
init: init
};
})();
$(document).ready(function () {
JS_SNAKE.game.init();
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
793,987 | 793,988 |
$("*") with exception?
|
<p>A long time ago a friend made this for me:</p>
<pre><code>$(".rnd1").click(function(){
$("*").click(function (event) {
event.stopPropagation();
$(this).fadeOut();
});
$('#random-button').hide();
$('#recover-button').show();
});
</code></pre>
<p>now i would like to protect some elements (like body and #recover-button) from fading out.</p>
|
javascript jquery
|
[3, 5]
|
2,834,400 | 2,834,401 |
Triple (3) Equal Signs
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/359494/javascript-vs-does-it-matter-which-equal-operator-i-use">JavaScript === vs == : Does it matter which “equal” operator I use?</a> </p>
</blockquote>
<p>I asked <a href="http://stackoverflow.com/questions/11112127/prevent-backspace-from-navigating-back-with-jquery-like-googles-homepage">another question</a> here and received a great answer as follows:</p>
<pre><code>$(document).on("keydown", function (e) {
if (e.which === 8 && !$(e.target).is("input, textarea") || $(e.target).is('[readonly]')) {
e.preventDefault();
}
});
</code></pre>
<p>Notice the three equal signs <code>===</code> in the if-statement. I have always thought you only needed two equal signs <code>==</code> for a javascript/jQuery if-statement. Is there any reason for the three?</p>
<p><strong>UPDATE</strong></p>
<p>Sorry for the duplicate question - I searched but didn't find any good questions. I guess I was using the wrong search terms.</p>
|
javascript jquery
|
[3, 5]
|
3,342,854 | 3,342,855 |
Check the gridview column check box
|
<p>I am developing an app in C# in which I am using the datagridview and gridview first column contains the checkboxes and I want to chech the checkbox is true or not but it is giving me the exception of 'Object referernce is not set to an instance of an object'. The code is following</p>
<pre><code> private void btnDelete_Click(object sender, EventArgs e)
{
StudentDAL s = new StudentDAL();
try
{
for (int i = 0; i < this.dataGridView1.RowCount; i++)
{
if (!DBNull.Value.Equals(this.dataGridView1.Rows[i].Cells[0]) && (bool)this.dataGridView1.Rows[i].Cells[0].Value == true)
{
s.delete(Convert.ToInt32(this.dataGridView1.Rows[i].Cells[1].Value));
i--;
}
}
this.dataGridView1.DataSource = s.getAll();
}
catch (Exception nn)
{
}
}
</code></pre>
<p>Please help me.</p>
|
c# asp.net
|
[0, 9]
|
2,135,470 | 2,135,471 |
How do I close a splash message after generating a file?
|
<p>I've run into a rather sticky situation and I was hoping you all could help. As part of my application, I'm generating a file for my users. Unfortunately, the time it takes to generate this file could be close to 5 minutes. In order to appease my users, I'm showing a message asking them to please wait. Once I have the file generated, I want to return the file to them and clear the message. I'm using the ASP.NET timer to check when the file has finished generating.</p>
<p>My problem comes once the file has finished generating. At the point, I need to do three things:
1.) Pass the file to the user.
2.) Close the message.
3.) Disable the Timer.</p>
<p>My problem comes from the fact that once I've finished writing the file to the repsonse, my postback doesn't finish, so the Viewstate doesn't get updated, so the message and Timer are still there.</p>
<p>Any ideas?</p>
|
c# asp.net
|
[0, 9]
|
3,435,673 | 3,435,674 |
JQuery / JavsScript mechanism to schedule methods
|
<p>I want to be able to invoke a specific method at specific times. For example.</p>
<ul>
<li>after 10 seconds</li>
<li>after 20 seconds</li>
<li>after 35 seconds</li>
<li>after 50 seconds</li>
<li>after 60 seconds</li>
<li>after 65 seconds</li>
</ul>
<p>All times from the same starting point. I was looking at the JQuery Timer module but I don't think this will give it to me.</p>
<p>What is the a good approach to do this in JavaScript / Jquery? Or any plugin available from a CDN.</p>
<p>Thanks.</p>
|
javascript jquery
|
[3, 5]
|
1,094,826 | 1,094,827 |
why define function inside $()?
|
<p>I came across a public JavaScript fragment that has the following lines of code:</p>
<pre><code>$(function() {
var v1, v2;
v1 = new V1;
return v2 = new V2(v1);
});
</code></pre>
<p>The guts of the function are perfectly grokkable. But what is the significance of wrapping this in a <code>$()</code>?</p>
|
javascript jquery
|
[3, 5]
|
5,219,052 | 5,219,053 |
get the second tds tag text in this html string
|
<p>How do I get the text in the second td tag in this html string, can I pass a html string into the JQUERY object and filter through it like this?</p>
<pre><code>var t = '<td>a</td><td>b</td><td>c</td><td>f</td>g<td>h</td>';
$(t).find("td:eq(1)").html();
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,407,456 | 5,407,457 |
What javascript array, nested array, object is most suitable for searching
|
<p>I'm trying to build a colors structure that has 3 data per item. For example, red has x and y, blue has x and y, etc. So the 3 pieces of data are <code>color, x, y</code></p>
<p>What structure do I need to make it easy to read the x and y based on the color. I usually do <code>push(color, x, y)</code> but that wouldn't work here, because I need to search quickly by the color without needing to loop. What structure do I need here, and how do I set it and get it. </p>
|
javascript jquery
|
[3, 5]
|
3,199,530 | 3,199,531 |
R.layout.row stuck on use Android
|
<p>my code is not working and its to do with the R.layout.row.... I do not know how to use it what do I do ? here is my code...suggestions?</p>
<p>could you please give any suggestions on how to improve my code its just a simple wifi scanning app</p>
<pre><code> package com.example.webu;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.view.Menu;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
public class MainActivity extends Activity {
SimpleAdapter adapter;
ArrayList<HashMap<String, String>> arraylist = new ArrayList<HashMap<String, String>>();
int size = 0;
List<ScanResult> results;
String ITEM_KEY = "key";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo at = cm.getActiveNetworkInfo();
final TextView tni = (TextView)findViewById(R.id.textView1);
ListView lv = (ListView)findViewById(R.id.listView1);
WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if(wifi.isWifiEnabled()) {
List<ScanResult> scanResults = wifi.getScanResults();
for(ScanResult scanRes : scanResults) {
this.adapter = new SimpleAdapter(MainActivity.this, arraylist, R.layout.raw, new String[] { ITEM_KEY }, new int[] { R.id.listView1 });
lv.setAdapter(this.adapter);
//tni.setText(scanRes.toString());
}
}
//tni.setText(at.toString());
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
</code></pre>
|
java android
|
[1, 4]
|
6,030,292 | 6,030,293 |
How to investigate why Session() expired and let users know
|
<p>How to investigate what is causing Session expiry?
I would like to give some advise to end-users who have the following problem with our website:</p>
<pre><code>If Session("xxxx") Is Nothing Then say something.. WHY??
</code></pre>
<p>Can I add something to web.config to make sessions last longer or should I read the IIS log files to see why this happens?</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.