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 |
---|---|---|---|---|---|
224,245 | 224,246 | error because of changing the package name | <p>hi i created all my apps in a single package name, when i was to upload it, i was success in uploading my first app. when i was to upload my second app i came to know that 2 app with same package name cannot be uploaded. Its not possible for me to create the second app once again with a new package name so because of my urgent i searched for a solution in net and i found that by refactor (i am using eclipse) i can change the package name and i did the same. But the name is not changed in the manifest file and i changed manually. Then i found some errors in all of my java class file showing error in the line "import.(package name).R", so i deleted all those lines. Now there is no error but the new problem is the app is running partially. The parsing activities which have been designed in my app are not running. Main part of my app is that only. Is there any solution to overcome this, as i am a new developer pls help me........ </p>
| java android | [1, 4] |
1,044,577 | 1,044,578 | JSONParser cannot be resolved to a type | <p>Trying to follow this tutorial: <a href="http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/" rel="nofollow">Tutorial</a></p>
<p>Trying to use <strong>JSONParser</strong> like so:</p>
<pre><code>// Creating JSON Parser object
JSONParser jParser = new JSONParser();
</code></pre>
<p>But Eclipse gives me the <code>JSONParser cannot be resolved to a type</code>.</p>
<p>What to do?</p>
| java android | [1, 4] |
5,060,651 | 5,060,652 | Fixed character limit text box with running feedback - javascript | <p>Is there a simple javascript pattern for showing how many characters left you can use in a fixed character text box?</p>
<p>Say you have a text box and you want them only to use 500 characters, twitter and stack-overflow show how many you have left as you type. I presume you can use jquery and a type event to produce a dynamic running count. </p>
<p>Is there an elegant pattern for this in javascript.</p>
| javascript jquery | [3, 5] |
4,963,181 | 4,963,182 | "Invalid postback or callback argument" after new deployment | <p>Recently deployed a project into production and have run into the "Invalid postback or callback argument" error. We haven't encountered this in testing at all and after some research have found that the problem occurs in the following situation:</p>
<ol>
<li>Old version is published and accessed.</li>
<li>New version is published and accessed without clearing the Temporary Files.</li>
<li>Drop down is changed twice. (The first time everything works fine.)</li>
</ol>
<p>The fix for the clients that have called in has been to clear their temporary internet files but this isn't the ideal fix. Can anyone think of a reason why this would be happening and stop happening after the temp files have been cleared?</p>
<p>BTW: The app is ASP.NET 3.5 written in C#. We're using a javascript call back in this particular control that's causing this issue.</p>
| c# javascript asp.net | [0, 3, 9] |
3,470,581 | 3,470,582 | How to organize Javascript and AJAX with PHP? | <p>My javascript is getting out of hand for my PHP application. I have 20 tags that link to various javascript files in a javascript folder.
Each javascript file basically controls one element on the DOM. And, if the javascript file uses AJAX, then it will have a corresponding PHP file that the AJAX will call.</p>
<p>For example, a js file might control a button on the page:</p>
<pre><code>$(document).ready(function () {
$("#button").live('click', function() {
$.ajax({
type: "POST",
data: ...
url: "button_click.php",
});
});
});
</code></pre>
<p>As you can see, this gets out of hand. What is the best way to organize all of the javascript?</p>
| php javascript jquery | [2, 3, 5] |
2,581,612 | 2,581,613 | How to tell a page to load a JS function based on variables being sent | <p>I have a function which loads some content when executed...</p>
<p>IE...</p>
<pre><code>function load_product(product_id) {
$.ajax({
type: 'GET',
url: 'product_image.php',
data: 'product_id='+product_id+'',
success: function(data) {
$('#product_image').html(data);
}
});
}
</code></pre>
<p>That works great. But say I want to create a link to a page, so that then something triggers to load up the dynamic content?</p>
<p>IE I link to a page, say </p>
<pre><code>www.blah.com/?product=1
</code></pre>
<p>and a few 'divs' on the page that load up different things dynamically for product #1.</p>
<p>The way I currently do it is by doing something:</p>
<pre><code><?php
if($_REQUEST['product_id']) {
echo '
<script type="text/javascript">
$(document).ready(function(){
load_product(' . $_REQUEST['product_id'] . ');
});
</script>
';
}
</code></pre>
<p>And I put that somewhere on the new page being loaded. It works. But is there a better way?</p>
| php javascript jquery | [2, 3, 5] |
2,832,553 | 2,832,554 | force close when music stops - Android | <p>another new problem described below:</p>
<p>When I press home button when music STILL plays, it closes correctly, but when the sound (that is five seconds long) has finished and I press home button, it gives me a force close. I have tried an else-statement; with no luck.</p>
<pre><code>protected void onStop() {
super.onStop();
if(mp.isPlaying()){
mp.pause();
}
}
</code></pre>
<p>there my variable mp is a MediaPlayer linked to this <code>mp = MediaPlayer.create(getBaseContext(), R.raw.mainsound);</code> </p>
<p>Ideas?</p>
| java android | [1, 4] |
4,241,518 | 4,241,519 | Combining multiple selectors in jQuery | <p>I'm trying to find a solution to make this code cleaner:</p>
<pre><code>$(document).keypress(function(ev){
if($("#dialog").is(':visible') === false && $("#alertDialog").is(':visible') === false){
if(ev.keyCode=='13' && !$('#resetBtn').is(':focus') && !$('.edit-new').is(':focus') && !$('.edit-trash').is(':focus')){
return validateForm('valueTable');
}
if(ev.keyCode=='27'){
$('#resetBtn').click();
}
}
});
</code></pre>
<p>As you can see, I'm checking to see if three seperate inputs are not in foucs before exectuing my event. Is there a way to target #resetBtn, .edit-new, .edit-trash into one, nicely packed selector?</p>
| javascript jquery | [3, 5] |
3,782,623 | 3,782,624 | Remove file from input field | <p>I am working on file uploading. So when I click cross button how can I remove exited file using php without page reload?</p>
<p><img src="http://i.stack.imgur.com/0a1lh.jpg" alt="enter image description here"></p>
| php javascript | [2, 3] |
3,052,724 | 3,052,725 | How to record video using Intents? | <p>I need to unserstand how I can record video programatically. Now I use this construction:</p>
<pre><code>public class AndroidLearningActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.main);
Intent captureVideoIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(captureVideoIntent, 100);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Uri uri=data.getData();
Log.e("result", "result:"+resultCode);
}
}
</code></pre>
<p>When the application is opened then the camera will be opened too. I have record some video, but if I press "back" button on the device then the application crushes. Please, explain me, how can I do it? Thank you. </p>
| java android | [1, 4] |
999,303 | 999,304 | Apply class to body while watching videos | <p>Is there a way to first check if the browser is webkit or not, and then apply a class to the body when a user clicks on a video to play it? If the browser is webkit, I'd like to apply the class .blur, and if the browser is not webkit, i'd like to add a dark overlay, so the user can focus on the video. I would have NO clue whatsoever how to do this except for apply the blur, hehe. Any help would be awesome!</p>
| javascript jquery | [3, 5] |
4,298,241 | 4,298,242 | Javascript - Getting data from XML for later use... put in array or object? | <p>I am extracting a bunch of data from an XML file using jQuery. I need to use the data to fill in image paths, names, etc.</p>
<p>What is the best way to gather all of this data for use? For instance, I get everything like so:</p>
<pre><code> $(document).ready(function() {
$.ajax({
type: "GET",
url: "stuff.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('speaker').each(function(){
var img_path = $(this).find('speaker_image').text();
var name_text = $(this).find('speaker_name').text();
// should I build an array or object here?
});
}
});
});
</code></pre>
<p>Should I stick everything into an array in the success method? Maybe in an object? What I will do is take the collected data and use it to build a list of names and images. There will be quite a few elements in this and it will look something like (with <code>img_path</code> being used in the image url and <code>name_text</code> being used for the label:</p>
<pre><code><ul>
<li><img src="images/bobsmith.jpg" /><br /><lable>Bob S. Smith</label></li>
<li><img src="images/crystalforehead.jpg" /><br /><lable>Crystal X. Forehead</label></li>
...
</ul>
</code></pre>
<p>What is the best way to handle the collected data so I can go through and build the html I need using it?</p>
| javascript jquery | [3, 5] |
862,479 | 862,480 | Java: Succinct way to import multiple constants | <p>Is there a succinct way to import in Java which would be equivalent to the following statement:</p>
<pre><code>import static android.view.View.GONE;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
</code></pre>
<p>I know about this:</p>
<pre><code>import android.view.View.*;
</code></pre>
<p>But I would like to be able to control what I import, and not just import everything in the View namespace.</p>
<p>ANSWER: The answer is No.</p>
| java android | [1, 4] |
2,435,942 | 2,435,943 | Difference in behaviour of function - JavaScript/jQuery | <p>I've written some JavaScript/jQuery code that adds a users email to my newsletter database. There is a "subscribe" button to start the process, but I also wanted the user to be able to hit return for usability.</p>
<p>Weirdly, the code works for both the button and when the return key is hit in that the email is added to the database, but the callback function which just displays an alert is only triggered when the button is hit, <em>not</em> when the return key has been pressed.</p>
<pre><code>$('#newsletter_button').click(function(event) {
newsletterSignup();
});
$('#newsletter_email').bind('keyup', function(event) { newsReturn(event); });
function newsletterSignup() {
var email = $.trim($('#newsletter_email').val());
if(!validateEmail(email)) {
alert('Please enter a valid email');
return false;
} else {
// add email to database
$.post('newsletterSignup.php',
{ email: email },
function(data) {alert(data);}
);
$('#newsletter_email').val("");
}
}
function newsReturn(evt) {
if (evt.keyCode == 13) {
newsletterSignup();
}
}
</code></pre>
<p>The function has to work the same no matter how it's been called surely! Like I say the post function is obviously being called both times because the email is being added to the database.</p>
<p>The only thing I can think of is that it's something to do with events. Not sure what though.</p>
| javascript jquery | [3, 5] |
3,130,242 | 3,130,243 | How to get the value from dropdown in asp.net | <p>I am using dropdown in ASP.net to display image along with value</p>
<pre><code><asp:DropDownList ID="ddBanner" runat="server" CssClass="ddBanner" >
</asp:DropDownList>
</code></pre>
<p>I used the following link to modify to my needs, i got it working.
<a href="http://www.aspdotnet-suresh.com/2011/12/jquery-bind-images-to-dropdownlist-in.html" rel="nofollow">http://www.aspdotnet-suresh.com/2011/12/jquery-bind-images-to-dropdownlist-in.html</a></p>
<p>I need to get the dropdown value, which i am finding hard in my case.
when i use ddBanner.SelectedValue or ddBanner.selectedItem or ddBanner.text it gets me "1.png" while i want the "1" to store in the database, below is the value after i run the webpage </p>
<pre><code><select id="MainContent_ddBanner" class="ddBanner" name="ctl00$MainContent$ddBanner">
<option title="../ImagesBanners/1.png" value="1.png">1</option>
<option title="../ImagesBanners/2.png" value="2.png">3</option>
<option title="../ImagesBanners/3.png" value="3.png">6</option>
</select>
</code></pre>
<p>What should i do to get the "1" or "2" from the drop down. i also need to pre select the value store in data base when i am update the same data . </p>
<p>data Example:
<strong>PageTable</strong>
PageName, PageTitle, PageBannerID
Home , Welcome to our site, 1</p>
<p>Banner table</p>
<p>BannerID, BannerImage</p>
<p>1, 1.png
2, b.png
3, 3.png</p>
| c# jquery asp.net | [0, 5, 9] |
3,660,402 | 3,660,403 | real time countdown timer using javascript and php | <p>i need help to create real time countdown timer for timestamp</p>
<p>iam using php to echo the timestamp
like this</p>
<pre><code><? php echo $timestamp;?>
</code></pre>
<p>what iam trying to do is to countdown $timestamp in real time using javascript</p>
<p>thank you all</p>
| php javascript | [2, 3] |
3,670,152 | 3,670,153 | javascript parameters cut down in IE | <p>Hello I have passed value of div lang attribute in my jquery function.this is working perfect in all browse except IE.</p>
<pre><code> While inspects in FIREFOX div look like below code.
<div lang="[email protected]@[email protected]@plain make it@Plain make@Plain@Georgia Gray@8x16@10x20@12x24@No@45@10x20@check2@myCheckbox2@000000@70@90" id="myCheckbox2" style="left: -3000px; top: 883px; margin: 1px;" class="checkboxArea1"><input type="checkbox" class="outtaHere" value="2" id="check2" name="f[]"></div>
While inspects in IE div look like below code.
<div style="margin: 1px; left: -3000px; top: 883px;" id="myCheckbox2" lang="[email protected]@[email protected]@plain make it@Plain make@Plain@Georgia Gray@8x16@10x20@12x24@No@45@10x20@check2@myCheckbo" class="checkboxArea1"><input id="check2" class="outtaHere" name="f[]" value="2" type="checkbox"></div>
</code></pre>
<p>You can see the difference of div lang attributes value. In firefox it takes all value of lang but in IE the last 3 value is not displayed as well fourth value from last is cut down so i have get this values undefined in IE. </p>
<p>Please suggest me how can i resolve this?</p>
| php jquery | [2, 5] |
216,188 | 216,189 | ASP.NET radio button jQuery handling | <p>I am trying to figure out why my page doesn't fire the radio button change event.</p>
<p>Here's the script I have for it, it's supposed to show a div once the radio button is checked.</p>
<pre><code> $("input[id$='radio1']").change(function () {
if ($("input[id$=radio1]").is(':checked')) {
$('#div1').removeClass('hidden');
}
});
</code></pre>
<p>what's wrong with this code?</p>
| javascript jquery asp.net | [3, 5, 9] |
2,495,112 | 2,495,113 | calling REST service using Jquery/javascript | <p>I need to call a REST Service from my classic ASP application.
I heard that the best way to call a REST service is using Jquery.
Its not working for me. I dont know what mistake I am doing here .
Here is my code.</p>
<pre><code><script language="javascript" scr="inc\javascript\jquery-1.7.2.js" ></script>
<script language="javascript">
$(document).ready(function(){
CallService();
});
function CallService()
{
alert("HelloWorld");
var Type = "POST";
var ServiceUrl = "http://mysite/restservice.svc";
var ContentType = "application/xml; charset=utf-8";
var DataType = "xml";
var ProcessData = false;
$.ajax({
type : Type, //GET or POST or PUT or DELETE verb
url : ServiceUrl, // Location of the service
//data : varData, //Data sent to server
contentType : ContentType, // content type sent to server
dataType : DataType, //Expected data format from server
processdata : ProcessData, //True or False
// success : function(msg) {//On Successfull service call
// ServiceSucceeded(msg);
},
error: ServiceFailed// When Service call fails
});
}
</script>
</code></pre>
| javascript jquery | [3, 5] |
615,730 | 615,731 | writing a code for chess board (8x8), except the verteces are nodes, and edges are connection between nodes.. i.e, 8x8 network | <p>I am trying to write a code for just the chess board (8x8), where each vertex is a node, and edges are connections between the nodes. Each node is connected with either 2, 3 or 4 nodes. </p>
<p>I am trying to write the code considering a node as an object. I am new to Graph theory implementation. Please help me out.</p>
<p><a href="http://postimage.org/image/720da4cw1/" rel="nofollow">http://postimage.org/image/720da4cw1/</a> I should me more clear earlier. Each circle represents a node. A square has nothing to do. Every node is connected to its adjacent nodes. </p>
| java c++ | [1, 6] |
42,787 | 42,788 | Any good alternative for ASP.NET validation controls? | <p>Is there easy to integrate ASP.NET with jQuery form validation plugin or any other JS framework to replace standard ASP.NET client validation ?</p>
| asp.net javascript jquery | [9, 3, 5] |
3,778,725 | 3,778,726 | Removing the div child in jquery | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5062916/replace-div-with-another-div">Replace Div with another Div</a> </p>
</blockquote>
<pre><code><div id='test'>
<span></span>
<p></p>
<button></button>
<h1></h1>
</div>
</code></pre>
<p><strong>My question is</strong> , how we can remove the <code>button</code> element and insert someother on the same position in jquery?</p>
| javascript jquery | [3, 5] |
3,508,808 | 3,508,809 | JQuery each loop looping through one line of code x amount of times before even looking at the rest | <p>I have a loop in Jquery:</p>
<pre><code>var fadeTime=500;
css_id=0;
$.each(my_array, function (i, d_U) {
css_id++;
an_v=d_U[1];
an_d=d_U[4];
do_c_function("id_344",true,true);
$("#box_"+css_id).fadeIn(fadeTime,function(){
//this stuff will happen once the fadein is complete
$("#box_"+css_id).animate({top: '-50px'},fadeTime,function(){
//this stuff will happen once the animate is complete
alert("#box_"+css_id);//for debugging
});//end of animation
});//end of fadein
});//end of each loop
</code></pre>
<p>Now as you've probably noticed, I'm trying to make the loop animate different divs each time using the <code>css_id</code> variable and <code>++;</code> (add 1) to it each time the loop runs.</p>
<p>Thing is, <code>css_id</code> reaches a high value before any of the code below has even been executed once. So when its time to animate, Jquery will try to animate <code>#box_210</code> when its supposed to animate <code>#box_1</code>.</p>
<p>Is there any way to make it only execute the <code>css_id++;</code> line once, then the animate lines get executed, and only then again with the <code>css_id++;</code> line...and so on.</p>
<p>I've tried to put the <code>css_id++;</code> line in a call back with both the animations but that seems to not work as well.</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
3,008,167 | 3,008,168 | How to go to Activity by clicking Table row? | <p>I'm making a simple app. and it is my first app too... </p>
<p>It has an activity with a menu and I made each menu option in a Table Row. Each Table Row contain an Image button and a Text Description. I want to go to another Activity when we click on each Table row. How do I do that??</p>
<p>And is it possible to use a single class file to show multiple layout files (ie. for each menu's content) ? </p>
<p>Or</p>
<p>Is there any other way than tableRow to create a menu like this and use it to go to another Activity?</p>
| java android | [1, 4] |
3,268,276 | 3,268,277 | When search for right name display once when search for first character in name displays 5 times? | <p>Seach in database only display firstname and lastname in Gridivew with linkbutton.</p>
<p><img src="http://i.stack.imgur.com/NSsxB.png" alt="enter image description here"></p>
<p>In the first Image(1) I Search only for the first Name, and get displayed firstname and last name.
In the second Image(2) I only search for the First character in the the and it displays it but I display it 5 times why? only want one time?</p>
<p>Here is my code</p>
<pre><code> private void GetEmployee()
{
var db = new knowitCVdbEntities();
var employee = (from p in db.EMPLOYEES
where
p.firstname.Contains(TextBoxSearch.Text) ||
p.lastname.Contains(TextBoxSearch.Text) ||
p.position.Contains(TextBoxSearch.Text)
select p).ToList();
foreach (var vEmp in employee)
{
if (vEmp != null)
{
HiddenFieldID.Value = vEmp.employee_id.ToString();
if (Session["DataTableSearch"] != null)
{
_dt = (DataTable)Session["DataTableSearch"];
}
else
{
_dt.Columns.Add("Firstname");
_dt.Columns.Add("employeeId");
}
//_dt.Rows.Clear();
DataRow dr = _dt.NewRow();
dr["Firstname"] = vEmp.firstname+" "+vEmp.lastname;
dr["employeeId"] = vEmp.employee_id;
_dt.Rows.Add(dr);
Session["DataTableSearch"] = _dt;
GridViewDisplayName.DataSource = _dt;
GridViewDisplayName.DataBind();
}
}
}
</code></pre>
| c# asp.net | [0, 9] |
3,977,516 | 3,977,517 | Is there a way to detect if a user is on a wifi connection with php or javascript? | <p>Cant seem to find any info on this, but was wondering if there is any way to detect if a user is on a wifi connection, specifically public wifi, using javascript, or php?</p>
| php javascript | [2, 3] |
57,310 | 57,311 | Determine if JavaScript value is an "integer"? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/600763/check-if-a-variable-contains-a-numerical-value-in-javascript">Check if a variable contains a numerical value in Javascript?</a> </p>
</blockquote>
<p>How do I check if variable is an integer in jQuery?</p>
<p>Example: </p>
<pre><code>if (id == int) { // Do this }
</code></pre>
<p>Im using the following to get the ID from the URL.</p>
<pre><code>var id = $.getURLParam("id");
</code></pre>
<p>But I want to check if the variable is an integer.</p>
| javascript jquery | [3, 5] |
4,830,414 | 4,830,415 | Creating links for elements with a particular class with jQuery | <p>How can I wrap every element belonging to a particular class with a link that is built from the text inside the div? What I mean is that I would like to turn:</p>
<pre><code><foo class="my-class>sometext</foo>
</code></pre>
<p>into</p>
<pre><code><a href="path/sometext" ><foo class="my-class>sometext</foo></a>
</code></pre>
<p>Url encoding characters would also be nice, but can be ignored for now if necessary.</p>
<p><strong>EDIT</strong>: Just to clarify, the path depends on the text within the element</p>
| javascript jquery | [3, 5] |
3,106,762 | 3,106,763 | Using OnDraw() Function in Android Conditionally | <p>I want to know if we can call Ondraw() method of Android Conditionally, based on some flag. For example ondraw() should be called only when a particular frame is decoded.</p>
<p>So consider this situation:</p>
<pre><code>decoder(); /// @NDK
set flag;
if (Flag==set)
{
OnDraw() works and displays an image
}
else
OnDraw sleeps;
</code></pre>
<p>Can we implement such type of activities in Android, if yes then how? </p>
| java android | [1, 4] |
2,106,253 | 2,106,254 | Why can't java subordinate object access parent field? | <p>I have an object that I instantiate twice, and each one needs to affect something in the other object. Yes, it's ugly, but in Android, I want to make a radio button in one display/tab match the state in another display/tab. I suppose I could have a method in the parent that updates both instantiations of the radio button, that'd probably be a better way to do it. But I don't understand why what I've done below doesn't work and I'd like to understand why even if I don't use it.</p>
<p>I'll just use 'someField' for this example as the cross-access field. I pass 'this' into each instantiated object for who the parent is, then I should be able to access a field in the other 'brother' object thru the parent object I would think, but it doesn't seem to work. Here's a simplified version of the code (actually the two classes are in two files of course):</p>
<pre><code>public class EtMain extends TabActivity {
public WxFields mDepWx;
public WxFields mArrWx;
public void onCreate(Bundle savedInstanceState) {
mDepWx = new WxFields(this);
mArrWx = new WxFields(this);
}
}
public class WxFields {
private Activity mParent; // Main Window object
public int someField;
public WxFields(Activity myParent) {
mParent = myParent;
}
public void someSetup() {
Button mButton = (Button) mParent.findViewById(R.id.someRes); //<---mParent works here
mParent.mArrWx.someField = 0; //<------------ mArrWx cannot be resolved
//I don't seem to be able to access a field in the parent object
//Yes, it's not symmetrical, but the code is just for illustration purposes
}
}
</code></pre>
| java android | [1, 4] |
2,576,363 | 2,576,364 | Add class to a div via Jquery | <p>I have the div which is generated when page loads as below.</p>
<pre><code><div class="redactor_ redactor_editor"></div>
</code></pre>
<p>How can I add a class .example onto it via jquery like below?</p>
<pre><code><div class="redactor_ redactor_editor example"></div>
</code></pre>
<p>Thank you very much!</p>
| javascript jquery | [3, 5] |
1,354,491 | 1,354,492 | problem with jquery and asp.net data exchange | <p>i have a wcf service that i want to call and i know it's returning a JSON string. </p>
<p><strong>Q1</strong>: how can i find out how the JSON looks like at runtime? for example, if the JSON is {'name':'steive', 'lastname':'jones'} how do i find this parameter names with javascript or jquery? </p>
<p>in the sample jquery like this:</p>
<pre><code> $.ajax({
url: '/wcfService.svc/test',
dataType: 'json',
type: 'POST',
success: function(data) {
// to do
}
});
</code></pre>
<p><strong>Q2</strong>: how do i know what names data.d contains in the success function??</p>
<p>as you can guess i'm trying to automate the server/client data exchange so if the JSON gets big the client should be able to use the parameters that could be in any names. in the above example i used name and lastname but the client should work with no problem if i change the name to names and lastname to lastnames at server side, like this:
{'names':'steive', 'lastnames':'jones'}
i should be able to use it without any modification to client. i'm using ASP.NET and C#.</p>
<p><strong>Q3</strong>: is this even possible??</p>
| c# jquery asp.net | [0, 5, 9] |
5,710,577 | 5,710,578 | ASP.NET - Internal messaging system | <p>I want to implement a messaging system in my Web application similar to the one Chase and Facebook have on their websites. Should I develop this on my own, or should I find a 3rd party control or other solution? Would google provide some sort of API to make this easy? I'm leaning towards developing this on my own because it probably won't involve too much but wanted to know my options. </p>
<p>All suggestions/comments are appreciated! </p>
| c# asp.net | [0, 9] |
270,946 | 270,947 | Stack of activity from Activity stack | <p>There is a stack of activity i want to call the activity from that stack , My question is that is it possible to check from that stack and call that intent . When i press home button and again when i press the executable it should start the activity where i have left .
Is it possible ?
Any example related to the same would be great help </p>
<p>Thnx in advance .</p>
| java android | [1, 4] |
5,519,595 | 5,519,596 | Delegating a button click event by clicking another button | <p>I want to fire a HTML button click event by clicking another button, Can anyone help me with the code, I'm using jQuery library..</p>
| javascript jquery | [3, 5] |
4,071,266 | 4,071,267 | How can I get my CheckBoxList to have three possible states? | <p>How can I get my <code>CheckBoxList</code> to have three possible states ? More precisely, is there a way to have three possible states for each checkbox : checked, unchecked, undefined (in most GUIs this is represented as a full square).</p>
<p>Alternatively, do you recommend another control that would meet these needs ?</p>
<p><strong>UPDATE</strong> : Ok, given that HTML does not support tri-state checkboxes, I'm looking for a way to 'CSS' (color fill, highlight, etc...) the checkboxes of the items that are in that 'undefined' state from my server point of view. </p>
| c# asp.net | [0, 9] |
889,854 | 889,855 | Using JavaScript, Select GridView Rows & selected column values in asp.net | <p>My requirement is to get the gridview selected row column values in javascript function which is I am calling on click on image that is first column of gridview. Please tell me how can I do this I can't use checkbox or radio button instead of image, as well i don't want to refresh the page. </p>
| javascript jquery asp.net | [3, 5, 9] |
756,282 | 756,283 | Using jquery to monitor form field changes | <p>Trying to learn some jquery to implement an autosave feature and need some assistance. I have some code to monitor the status of form fields to see if there has been any change. Everything works, but I need to only monitor the changes in a specific form, not all form inputs on the page. There is a search box and a newsletter form on the same page and when these form fields are changed, they are detected as well, which I need to filter out somehow or better yet, only target the specific form.</p>
<pre><code>$(function(){
setInterval("CheckDirty()",10000);
$(':input').each(function() {
$(this).data('formValues', $(this).val());
});
});
function CheckDirty()
{
var isDirty = false;
$(':input').each(function () {
if($(this).data('formValues') != $(this).val()) {
isDirty = true;
}
});
if(isDirty == true){
alert("isDirty=" + isDirty);
}
}
</code></pre>
| javascript jquery | [3, 5] |
3,563,907 | 3,563,908 | What is the difference between "$(this)" and "this"? | <p>I was reading the <a href="http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery">http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery</a>. And got confused with use of <code>this</code> in these 2 code segments.</p>
<pre><code> $(document).ready(function() {
$("#orderedlist").find("li").each(function(i) {
$(this).append( " BAM! " + i );
});
});
$(document).ready(function() {
// use this to reset several forms at once
$("#reset").click(function() {
$("form").each(function() {
this.reset();
});
});
});
</code></pre>
<p>When do we need <code>$(this)</code> and <code>this</code>? And what is the difference between them? Thanks in advance.</p>
| javascript jquery | [3, 5] |
3,567,962 | 3,567,963 | phpmyadmin html connect | <p>i am currently creating a web application. the problem here it is coded purely in HTML and JScript. Is it possible to use a php script as well to connect to PHPmyadmin? i have been encountering the same problem where the script is being displayed as text file</p>
| php javascript | [2, 3] |
1,372,739 | 1,372,740 | Detect vertical scroll and scrollbar width and apply width change to body | <p>In my page, I wish to detect whether the page has vertical scrollbars, and if so, need to detect the width of the scrollbar, so I can reduce my body by the width and thus prevent my sidebar from changing location from viewing a non-scrolling page to a scrolling page.
I have the following jQuery/Javascript code:</p>
<pre><code> $(document).ready(function () {
var parent, child, width;
if (width === undefined) {
parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body');
child = parent.children();
width = child.innerWidth() - child.height(99).innerWidth();
parent.remove();
}
if ($("body").height() > $(window).height()) {
//change width of body here
}
});
</code></pre>
<p>Unfortunately, this code doesn't work for me. Can someone please let me know where I'm going wrong?</p>
| javascript jquery asp.net | [3, 5, 9] |
1,187,954 | 1,187,955 | What is the Java equivalent of PHP var_dump? | <p><strong>PHP has a <a href="http://php.net/var_dump">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] |
497,037 | 497,038 | combining similar click handlers in order to reduce code being used in jquery? | <p>I have 2 click events that go through a series of different actions, the only thing that is different between the 2 events though is 2 lines. Is there a way of combining these clicks in order to cut down the amount of code being used?</p>
<pre><code>$('a.register').click(function() {
$('h4#registerHead').addClass('active');
$('#registerMessage').show();
$('#nav li span a').css({'color':'#8F8F8F'});
$('#alertNav').css({'color':'#dedede'}).addClass('activeSub');
});
$('a.subscribe').click(function() {
$('h4#subscribeHead').addClass('active');
$('#subscribeMessage').show();
$('#nav li span a').css({'color':'#8F8F8F'});
$('#alertNav').css({'color':'#dedede'}).addClass('activeSub');
});
</code></pre>
<p>All advice welcome on this, and thanks.</p>
| javascript jquery | [3, 5] |
5,847,670 | 5,847,671 | Anchoring from a link to label in a repeater | <p>I have a list on top of my page that has a few different countries on it. I need to have an #anchor that will pop half way down the page to the country picked. However the countries down the page are pulled from a Database and are listed by HyperLinks in a repeater. </p>
<pre><code><td align="center">
<ul style="list-style-type: none;">
<li><a href="#USA">USA </a></li>
<li><a href="#Canada">Canada </a></li>
<li><a href="#Australia">Australia </a></li>
</ul>
</td>
</code></pre>
<hr>
<pre><code><asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
<ItemTemplate>
<asp:HyperLink ID="hlCountryName" runat="server" Style="color: #6D94B8; font-size: 20px; font-weight: bold; margin-bottom: 5px; padding-left: 10px;"></asp:HyperLink>
</code></pre>
<p>And inside the DataList1_ItemDataBound method in the C# section I did:</p>
<pre><code>hlCountryName.Attributes.Add("href", "#" + drCountry[Common.Data.Country.Constants.countryName].ToString());
</code></pre>
<p>Yet when I click on the link at the top of the page I am not taken anywhere. I am wondering what I could be missing in my code? Or if I have miss understood how to do this altogether? Any help is appreciated. Thanks!</p>
| c# asp.net | [0, 9] |
4,700,674 | 4,700,675 | What is wrong with my jQuery / my JS? | <p>I just started working on the following site: <a href="http://www.psykotaktyle.com/" rel="nofollow">http://www.psykotaktyle.com/</a></p>
<p>I have downloaded the latest jQuery (1.6.2) and jQuery UI (1.8.14).</p>
<p>The only other JS code on the page is:</p>
<pre><code>function get_url_param(param, url) {
param = param.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+param+"=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(url);
if( results == null )
return '';
else
return results[1];
}
$(document).ready(function() {
$('ul.menu li').click(function() {
var href = $('a', this).attr('href');
var content = get_url_param('page', href);
if (!content) content = 'home';
$('.slide-item').animate({top:'1000px'}, 500)
//$('#content').fadeOut();
//alert(content);
return false;
});
});
</code></pre>
<p>For some reason I get a JS error on the page when clicking on a menuitem.</p>
<blockquote>
<p>Uncaught TypeError: Not enough arguments jQuery-1.6.2.min.js:18</p>
</blockquote>
<p>I don't have a clue what went wrong here so I hope someone can tell me what is causing this error.</p>
| javascript jquery | [3, 5] |
4,308,648 | 4,308,649 | jQuery string manipulation performance vs. PHP | <p>Im building a custom jquery modal box that loads an external html template file that contains variables that need to be replaced. For instance: [user-name]</p>
<p><strong>I know I have 2 options for modifying the template file:</strong></p>
<ul>
<li>use find and replace in jquery</li>
<li>process the template server side and
simply send the result to jquery</li>
</ul>
<p>From a user performance stand point, which would be faster?</p>
| php javascript jquery | [2, 3, 5] |
4,367,912 | 4,367,913 | Why can I not see my object's properties | <p>I'm stumped here and would love to know what I'm mising. </p>
<p>I was just re-writing some code and cleaning some stuff up. I have a method that does an ajax call and returns a json string. Since I use the method a couple of places I abstracted to this method here within a name space. </p>
<p>This is json object returned</p>
<pre><code>{"charge_ID":"4","price":"37","description":"corporate rate"}
</code></pre>
<p>This is the abstracted method.</p>
<pre><code>wwdb.getChargeRate = function( chargeID ){
var rate = {}, prop;
$.post(baseUrl + 'dashboard_job/jx_get_charge_rate',
{
'charge_ID': chargeID
},
function( data ){
for( prop in data) {
rate[prop] = data[prop];
}
},
'json'
);
return rate;
};
</code></pre>
<p>I thought I would just be able to assign data to rate but had to iterate through to get that to work. In fact I thought I would be able return data direct from within the function() part of $.post() method, but that didn't work. So question 1. is why can I not just return data? </p>
<p>But much more basic and frustrating is the fact that in the code below I cannot access the object properties. Question 2. is why? </p>
<pre><code>$('#charge_rate_slt').change(function(){
var t = $(this), v = $(t).val(), rate;
console.log(wwdb.getChargeRate( v )); //returns object ok
rate = wwdb.getChargeRate( v ); //assigns object ok
console.log(rate); //displays in firebug as object with properties
console.log(rate.price) //undefined
for(p in rate)
console.log( p ); //undefined?
});
</code></pre>
| javascript jquery | [3, 5] |
2,912,811 | 2,912,812 | Why is Context needed for getRelativeTimeSpanString? | <p>I was wondering why <a href="http://developer.android.com/reference/android/text/format/DateUtils.html#getRelativeTimeSpanString%28android.content.Context,%20long,%20boolean%29" rel="nofollow"><code>getRelativeTimeSpanString</code></a> needs a context? (leaving the puns aside)</p>
<pre><code>public static CharSequence getRelativeTimeSpanString (Context c, long millis, boolean withPreposition)
</code></pre>
| java android | [1, 4] |
5,939,633 | 5,939,634 | How to have an IF OR in android? | <pre><code> if(word.equals(" ")){
}
</code></pre>
<p>I have this IF statment, what i would like it to also do is the following..</p>
<pre><code> if(word.equals(" ") OR word.equals(".") ){
}
</code></pre>
<p>I know the above code will not work, but im looking how to implement something like that? Anyone know how to do an if or, or do i have to use else if?</p>
| java android | [1, 4] |
4,162,580 | 4,162,581 | Strip default HTML code | <p>I want to create a web form where I'll perform some background action based on the GET parameter through jQuery and will print 1 or 0. But the problem - ASP.NET is printing lots of HTML by default even when no such code exist in the Markup window</p>
<pre><code><%@ Page Language="C#"%>
<%
try
{
int cID = int.Parse(Request.QueryString["cid"].ToString());
//do some job and print 1 or 0
}
catch { }
%>
</code></pre>
<p>But in the output window I see HTML code </p>
<pre><code><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type></HEAD>
<BODY></BODY></HTML>
</code></pre>
| c# asp.net | [0, 9] |
1,376,811 | 1,376,812 | How do I format 7 as '07' in string in JavaScript? | <p>I have JavaScript day, month and year. I need my day to be in 2 digits, my months also to be in 2 digits and year in 4 digits.</p>
<p><strong>Eg.</strong> If month is <code>7</code> it should give me string as <code>'07'</code>. If it is <code>12</code> then it should return <code>'12'</code>.</p>
<p>I google for it but I only found <code>toFixed</code> and <code>toPrecision</code>, both of which have different functions. How do I format it?</p>
| javascript jquery | [3, 5] |
1,919,281 | 1,919,282 | Send Mail from ASP.NET | <p>in my application i m sending a mail from gmail server. when i m executing the code its giving error</p>
<p>here is the code</p>
<pre><code> mail.To.Add(txtTo.Text);
mail.From = new MailAddress(txtFrom.Text);
mail.Subject = txtSubject.Text;
mail.Body = txtBody.Text;
mail.IsBodyHtml = true;
if (FileUpload1.HasFile)
{
mail.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, FileUpload1.FileName));
}
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential
("my gmail ID", "my password");
smtp.EnableSsl = true;
smtp.Send(mail);
</code></pre>
<p>After execution i m getting below error</p>
<pre><code> Message : - "Failure sending mail."
Inner Exception : - {"Unable to connect to the remote server"}
</code></pre>
<p>please have a look.</p>
| c# asp.net | [0, 9] |
3,256,789 | 3,256,790 | android Thread and Service | <p>I am using below code.</p>
<pre><code> import android.app.Activity;
import android.os.Bundle;
import android.provider.ContactsContract.Data;
import android.util.Log;
public class ActivityDemoActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
new Thread(new Runnable() {
@Override
public void run() {
int i=0;
while(true){
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Log.i("DATA", "Data.CONTENT_TYPE......"+(i++));
}
}
}).start();
}
@Override
public void onBackPressed(){
finish();
}
}
</code></pre>
<p>When I press Back button of device still thread is working in background.</p>
<p>My questions are...</p>
<ol>
<li>when thread will stop?</li>
<li>Then why we required services in android?</li>
</ol>
<p>Thank You.</p>
| java android | [1, 4] |
974,547 | 974,548 | jquery AJAX sent data in key value pair | <p>In my aspx page, i have the js like this :-</p>
<pre><code> <script language="javascript" type="text/javascript">
$("#btnLoad").click(function () {
var dataForAjax = "{'datakey':'hello'}"
$.ajax({
type: "POST",
url: "Ajax__Demo.aspx/SendFile",
data: dataForAjax,
success: function (msg) {
alert(msg); // Problem with this line. It is not showing the value.
}
});
});
</script>
</code></pre>
<p>In the same webpage code behind class file ,i have the webmethod defined like this:-</p>
<pre><code>[WebMethod]
public static string SendFile(string key, string data)
{
return data;
}
</code></pre>
<p>For some reason, i am able to get the data in the alert used on the html side. alert(msg); is giving me nothing and i am expecting to get the passed value back. In this case it should be 'Hello'. </p>
<p>I am missing something very small here, please help me out here.</p>
| c# jquery | [0, 5] |
4,735,286 | 4,735,287 | Adding jQuery event handlers to elements with wildcard IDs | <p>I currently have the following in a document.ready block:</p>
<pre><code> $("[id^=summaryDetailLink_]").each(function(index) {
var splitID = this.id.split("_");
this.click(alert('clicked: '+splitID[1])); //toggleDetail(splitID[1])
});
</code></pre>
<p>Ultimately I want to detect when a TD with an ID of "summaryDetail_" is clicked on and fire the toggleDetail function with the ID taken from the TD.ID attribute.</p>
<p>The above seems to generate the correct ID (the alert popsup) but is firing when the page loads rather than when I click on the element.</p>
<p>So problem number 1 - why is it firing on page load rather than creating a handler for click on each element and waiting for that click?</p>
<p>Problem number 2, in reading around this issue it seems it would be more sensible to create a single event handler on the table rather the TD then determine which TD element was clicked. How would I convert the code to do that?</p>
| javascript jquery | [3, 5] |
1,505,505 | 1,505,506 | JavaScript unexpected object behavior with jQuery | <p>I have two <code><div></code> elements, and the following JavaScript code:</p>
<pre><code>var myObject = {
$input: $('<input />'),
insert: function () {
$('div').append(this.$input);
$('div').append(' ');
}
};
myObject.insert();
</code></pre>
<p>This, as I expect, produces an <code><input></code> element within each of the two <code><div></code> elements.</p>
<p>Now when I create a new instance of <code>myObject</code> and call <code>insert()</code> again I will be expecting 4 <code><input></code> elements, two in each <code><div></code>. Weirdly, I only get 3 <code><input></code> elements!</p>
<p>See example code here:
<a href="http://jsfiddle.net/FNEax/" rel="nofollow">http://jsfiddle.net/FNEax/</a></p>
| javascript jquery | [3, 5] |
5,981,120 | 5,981,121 | jQuery - Search that will get the list of matched value | <p>I have a list of downloadable zip files. I wanted to add a search box, that will search the filename they are going to download. </p>
<p>Example if they if they are going to search "laptop" keyword.
It will show the <code>laptop_pricelist.zip</code>, <code>apple_laptop_pricelist.zip</code> and <code>laptop_accessories.zip</code></p>
<p>I only have this code below. i got stuck on how to get the list of filename that matches the value in the searchbox.</p>
<pre><code>jQuery('input#id_search').live('input', function() {
var search = jQuery(this).val().toLowerCase();
...
});
</code></pre>
<p>sample output</p>
<p><img src="http://i.stack.imgur.com/P9d5j.png" alt="enter image description here"></p>
| javascript jquery | [3, 5] |
1,399,183 | 1,399,184 | Update web.config file in asp.net | <p>I am working on a web application which sits on a server and connects to various client machines based on the IPAddress.I have to change the IPAddress every time in the web.config file in order to connect to a particular client machine.</p>
<p>I want to put a text box where i can enter the ipaddress and it updates web.config file based on the button click which should eventually connect to the respective client machine.</p>
<p>Is it possible to do this way or i am thinking the wrong way ?</p>
<p>Can any one guide me in the right path ?</p>
| c# asp.net | [0, 9] |
5,922,999 | 5,923,000 | How do I prevent button presses until form request is completed when form request causes a file download | <p>In my Asp.net webforms site I have a form where users select various options and those options are sent back in a postback that generates a PDF report and sends that file back to the user for download via the following code:</p>
<pre><code> protected void btnTopGenReport_Click(object sender, EventArgs e)
{
var stream = new PodMainReportGenerator().GenerateReport(GetReportParameters());
var bytes = stream.ToArray();
stream.Close();
// Set the content headers
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment;filename=testReport.pdf");
Response.AddHeader("Content-Length", bytes.Length.ToString());
Response.BinaryWrite(bytes);
Response.End();
}
</code></pre>
<p>The problem is this report can take a good 10 or so seconds to generate due to the amount of data and processing required, but I don't want people getting impatient and clicking the button over and over again.</p>
<p>In a normal page I would add javascript to disable the buttons on click. This works because when postback is complete the server comes back with the form buttons re-enabled. However, since the form's response is not an HTML page but a downloaded file, which I don't know how to detect.</p>
<p>Essentially, how do I disable the form's buttons but re-enable them once we get the response from the server (and the http file transfer is initiated)?</p>
| c# asp.net | [0, 9] |
4,212,450 | 4,212,451 | javascript event.target not working in mozilla | <pre><code><script type ='javascript'>
function fun(userID) {
var btn = event.target; // error 'event' undefine in mozilla
alert(btn.id);
}
</script>
</code></pre>
<hr>
<pre><code><asp:linkButton id ="target" style =" cursor:pointer" onclick ="fun('1')" >click here </asp:LinkButton>
</code></pre>
<p>I am new in JavaScript, I have written above code and this code is working fine in Google chrome but not working in Mozilla Firefox. can anyone suggest how to find control firing event?</p>
| javascript jquery asp.net | [3, 5, 9] |
1,214,912 | 1,214,913 | Retrying an http connection | <p>I'm making an http request. I'm on a platform (android) where network operations often fail because the network connection might not be immediately available. Therefore I'd like to try the same connection N times before completely failing. Was thinking of something like this:</p>
<pre><code>DefaultHttpClient mHttp = ...;
public HttpResponse runHttpRequest(HttpRequestBase httpRequest)
throws IOException
{
IOException last = null;
for (int attempt = 0; attempt < 3; attempt++) {
try {
HttpResponse response = mHttpClient.execute(httpRequest);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == 200) {
return response;
}
} catch (IOException e) {
httpRequest.abort();
last = e;
}
}
throw last;
}
</code></pre>
<p>I'm mostly worried about the connection being in some state which is invalid on subsequent retries. In other words, do I need to completely recreate 'httpRequest', should I avoid calling httpRequest.abort() in the catch block, and only call it in the final failure?</p>
<p>Thanks</p>
| java android | [1, 4] |
4,655,820 | 4,655,821 | redirection follow by post | <p>just wonder how those air ticket booking website redirect the user to the airline booking website and then fill up(i suppose doing POST) the required information so that the users will land on the booking page with origin/destination/date selected?</p>
<p>Is the technique used is to open up new browser window and do a ajax POST from there?</p>
<p>Thanks.</p>
| javascript python | [3, 7] |
2,826,368 | 2,826,369 | How to use javascript or jQuery to read a pixel of an image? | <p>How to use javascript or jQuery to read the color of a pixel of an image when user click on it? (of course we have the (x,y) value of this pixel by subscribing to the click event).</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
929,297 | 929,298 | "Expecting More Source Characters" in my Javascript | <p>Visual Studio is objecting to the script below and returns a message that says "Expecting More Source Characters". This I assume is the reason this script won't fire on the page.</p>
<p>Usually when I get this message in VS it means I forgot a semi colon. However I don't <em>think</em> that is the case this time. What could be causing this error?</p>
<pre><code>jQuery(document).ready(function ($) {
var Category = "animals";
var BaseURL = "http://localhost:61741/VocabGame/play?cat=";
var URL = BaseURL + Category;
$.getJSON(URL, {
tags: "Pinyin",
tagmode: "any",
format: "json"
},
function (data) {
$('#ChoiceA').append = data.nouns[0].Pinyin;
$('#ChoiceB').append = data.nouns[1].Pinyin;
});
</code></pre>
| javascript jquery | [3, 5] |
1,763,527 | 1,763,528 | Thumbs up/Thumbs Down Rating Implementation | <p>Similar to the one here on StackOverFlow, I would be needing to implement a way for people to vote up and vote down comments in a forum like site.</p>
<p>However instead of having a generic overall score, we will display the total amount of "thumbs up" and "thumbs down". The overall score will be needed for filtering purposes, such as "sort by highest rated", "show only ratings with + 3"</p>
<p>What is the best implementation strategy?</p>
<p>As a user suggested, I would also be storing the information who casted the vote</p>
| c# asp.net | [0, 9] |
2,067,261 | 2,067,262 | Get parent formname on child window using jquery? | <p>i have below form tag on parent page from which i open a popup. i want to get form Name attribute value(i.e "cust-100" ) on popup screen</p>
<pre><code><form action="/custAction" formName="cust-100">
</code></pre>
<p>i tried below</p>
<p><code>self.opener.document.$('[name="formName"]').val()</code> but it gives error</p>
<pre><code>TypeError: self.opener.document.$ is not a function
</code></pre>
| javascript jquery | [3, 5] |
222,057 | 222,058 | Creating a small jQuery plugin | <p>I created this plugin to make work around an application easier.</p>
<p>Here is the link : <a href="http://jsfiddle.net/X5Squ/" rel="nofollow">http://jsfiddle.net/X5Squ/</a></p>
<p>My problem it that it always uses just 1 of the elements, please don't edit the data and data5 functions as these work perfectly for other parts but I need my function called jtoggle to work.</p>
<p>Any help much appreciated! Thanks.</p>
| javascript jquery | [3, 5] |
3,679,037 | 3,679,038 | Writing to a file on Android issue | <p>I am currently trying to paste current time into a file for an Android application. The code looks like this but the file is not created. I have enabled the permission of my application to write on the SD card through the manifest. Any ideas?</p>
<pre><code> Time today = new Time(Time.getCurrentTimezone());
today.setToNow();
try {
File myFile = new File("/sdcard/mysdfile.txt");
myFile.createNewFile();
FileOutputStream fOut = new FileOutputStream(myFile);
OutputStreamWriter myOutWriter =
new OutputStreamWriter(fOut);
SimpleDateFormat dF = new SimpleDateFormat("HHMMSS");
StringBuilder current = new StringBuilder(dF.format(today));
myOutWriter.append(current);
myOutWriter.close();
fOut.close();
}
</code></pre>
| java android | [1, 4] |
5,589,711 | 5,589,712 | Adding break every 2 consecutive floated elements (nth:child) | <p>I created this fiddle so that you can see what i am trying to do easily.
I would like to add that break after every 2 consecutive div elements (div.column) </p>
<p>Fiddle example:
<a href="http://jsfiddle.net/j5qS5/" rel="nofollow">http://jsfiddle.net/j5qS5/</a></p>
<p>I tried:</p>
<pre><code>$(".column:nth-child(2)").after('<br /><br />break<br /><br />');
</code></pre>
<p>It seems to work after the 2nd child only, how can I make it consecutive and works for every 2 elements afterwards.. I hope it's simple :)</p>
<p>Thanks in advance</p>
| javascript jquery | [3, 5] |
3,530,635 | 3,530,636 | Am I less likely to encounter cross-browser issues if I use php instead of server-side javascript to build a website? | <p>Recently, I've been involved in two projects.</p>
<p>The first one is built on php and the second in Javascript (using <a href="http://nodejs.org/" rel="nofollow">http://nodejs.org/</a>).
Well, I thought that since php depends mostly on the hosting provider, if the site works in one browser it should work in all the rest. Since Javasscript depends mostly on the browser I should encounter more issues in different browsers.</p>
<p>What about the Javascript part that handle the things between the client and server side? </p>
<p>Am I right? Or I'm not considering something?</p>
| php javascript | [2, 3] |
1,607,687 | 1,607,688 | PHP / mySQL output via javascript and dropdown | <p>Here is what I have in php:</p>
<pre><code>[Color, Size, Status]
Red, Small, 1
Red, Large, 0
Blue, Small, 1
Blue, Large, 1
</code></pre>
<p>I can get that output in php just fine like mentioned above. What I want to do is get this structured properly for dropdown in html and javascript/jquery (please continue reading for javascript purpose).</p>
<p>Basically there would be 2 dropdowns. One for Size and one for Color. The reason for javascript (preferably jquery) is to check the status. 1 means in stock and 0 for out of stock. So if someone were to select the combination of Red Color in Large Size it would be status of 0 (meaning out of stock)</p>
<p>I have been struggling on how to do this for few hours. Any help is much appreciated!!</p>
<p>----== UPDATE ==----</p>
<p>I have found a way to do this, but different than I had initially wanted to (using an array or ojbect in javascript)</p>
<p>Anyhow, my solution is posted here: <a href="http://jsbin.com/osipe5/2" rel="nofollow">http://jsbin.com/osipe5/2</a></p>
<p>Basically I output a bunch of combinations in a hidden input and then use the javascript to read them and update the text of the select options</p>
| php javascript jquery | [2, 3, 5] |
2,586,293 | 2,586,294 | passing query string value from asp.net page to iframe | <p>I have an asp.net page with a textbox and a button. on button click, I open a popup and load a page in it using iframe. I want to pass value of textbox as query string to page in iframe. How can I do this?</p>
<p>I tried using server side iframe like this:</p>
<pre><code><iframe id="popupframe" runat="server" src="~/temp.aspx" width="100%" height="455">
</iframe>
</code></pre>
<p>but temp.aspx doesnt load and gives 404. If I use it without server side tag</p>
<pre><code><iframe id="popupframe" src="../../../../temp.aspx" width="100%" height="455">
</iframe>
</code></pre>
<p>Page loads in iframe but I can't pass valuue of textbox to temp.aspx. Please suggest solution. thanks</p>
| javascript jquery asp.net | [3, 5, 9] |
5,180,516 | 5,180,517 | Calculation in code behind | <p>Chauffeur service cost $30. It is an option to user whether they want the service or not. When they already select car, and day of rental, I store it in session. </p>
<pre><code>Session["car1"] = Label1.Text;
Session["price"] = Label5.Text;
Session["day"] = DropDownList3.SelectedItem.Text;
Session["driver"] = Label6.Text;
Response.Redirect("~/Welcome/BookingForm.aspx");
</code></pre>
<p>Then in bookingform.aspx, I retrieve back the session, and display it in label. </p>
<pre><code>string car1 = Session["car1"].ToString();
string price = Session["price"].ToString();
string day = Session["day"].ToString();
string driver = Session["driver"].ToString();
</code></pre>
<p>To calculate the total amount of user should pay, I used this code:</p>
<pre><code>int totalValue = 0;
totalValue = int.Parse(Session["price"].ToString()) *
int.Parse(Session["day"].ToString());
Label8.Text = totalValue.ToString();
</code></pre>
<p>The problem now is, I don't know how to add $30 for chauffeur service IF user pick that service. Like if user choose yes, totalValue + 30, and if NO, do nothing. </p>
<p>Thanks for your time. Cheers.</p>
| c# asp.net | [0, 9] |
2,425,125 | 2,425,126 | hide javascript in php | <p>hi all
i am working on a project, it need email validation when user enter his email address check for availiblity. i wrote the php code in javascript it works fine but my problem is when some one see my page source it is displaying all user email address in javascript code. i want hide this one.</p>
<p>i wrote javascript code in seperate file but validation is not working.</p>
<p>if any one give idea, how hide javascript code in php, guide me please.</p>
<p>thanks </p>
| php javascript | [2, 3] |
3,475,867 | 3,475,868 | One function to rule multiple buttons, and then some | <p>I have 7 buttons. They are distributed on top of a background image and interacting with it. They are placed absolutely. I have created a jQuery function to animate one of the buttons height. The button expands upwards. Check it out here: <a href="http://hdpano.no/bf/newindex.html" rel="nofollow">http://hdpano.no/bf/newindex.html</a> and click the top left button named Deck 8.</p>
<p>I wish this function to handle all the buttons, but there are some variables. The baseline of each button varies, and i need to subtract from it as i expand the height. I also wish to close any other open button if one clicks another. </p>
<p>Here is the jQuery code:</p>
<pre><code>jQuery(document).ready(function() {
$('#link8').toggle(
function()
{
$('#deck8').animate({height: "25px",top:"202"}, 500);
},
function()
{
$('#deck8').animate({height: "150",top:"76"}, 500);
});
});
</code></pre>
<p>The function is quite basic and I have stripped it of all my attempts to make it work with the other buttons.</p>
| javascript jquery | [3, 5] |
5,941,312 | 5,941,313 | JQuery - DIV-Content-Change should be another URL | <p>after the user logged in, the project-url is root/inside/. The site has 4 different main-sections, which will be displayed in a div via Ajax. The url does not change, after clicking on the links. How can i do it, that the url changes like this after clicking on the links for the main sections:</p>
<pre><code>root/inside/my_account
root/inside/part_one
root/inside/part_two
root/inside/part_three
</code></pre>
<p>I would like to use that, because when the user is at one section and uses the back-button in the browser he is at the root. That's not user likely...</p>
<p>Thanks-</p>
| javascript jquery | [3, 5] |
4,352,676 | 4,352,677 | Android Package Manager List Doesn't Show Navigation Icon | <p>I'm using the below code to get a list of applications:</p>
<pre><code> List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
Collections.sort(packages, new ApplicationInfo.DisplayNameComparator(pm));
for (int i = 0; i < packages.size(); i++) {
if (packages.get(i).uid > 10000) {
try {
Log.d(pm.getApplicationLabel(packages.get(i));
} catch (NameNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
</code></pre>
<p>Now the issue is that there are some applications that don't show in the list, such as Google Navigation. Any idea why this is?</p>
| java android | [1, 4] |
2,553,976 | 2,553,977 | Need help with jQuery to JavaScript | <p>I want to rewrite this line as vanilla JS so it is applied quicker (and before the downloading of the jQuery library). The line is</p>
<pre><code>$(document).ready(function() { $('body').addClass('javascript'); });
</code></pre>
<p>If I added it to the html element instead, would I be able to leave off the DOM ready part? One problem with this though is the validator doesn't like the class attribute on the html element, even if it is inserted with JS.</p>
<p>So, how would I rewrite that as vanilla JS?</p>
| javascript jquery | [3, 5] |
1,616,018 | 1,616,019 | jQuery .getJSON vs .post which one is faster? | <p>Using
$.getJSON();
or
$.post();</p>
<p>I'm trying to send some parameters through a page that is just for AJAX request
and get some results in JSON or html snippet. </p>
<p>What I want to know is that which one is faster?</p>
<p>Assume the HTML file would be simply plain boolean text (true or false)</p>
| javascript jquery | [3, 5] |
2,903,404 | 2,903,405 | jQuery: do I need to put calls to $("img").lazyload() in $(document).ready()? | <p>I am using <a href="http://www.appelsiini.net/projects/lazyload" rel="nofollow">lazy load jquery plugin</a>.</p>
<p>It tells me to put this in my code to activate it:</p>
<pre><code>$("img").lazyload();
</code></pre>
<p>Do I have to put this in <code>$(document).ready()</code>? or can I just put it at the very top of the page:</p>
<pre><code><head>
<script type="text/javascript">
$("img").lazyload();
$(document).ready...{}
</script>
</head>
</code></pre>
| javascript jquery | [3, 5] |
1,579,964 | 1,579,965 | hiddenfield have to change on every onclick | <p>Am new to asp.net,c#.
Am having dynamic boxes(each companies),it will create at the run time.Now On each click of the box my hidden field should give the respected id.If am clicking that box I can get the company id from database,now if the company id is 5 my hidden field should get 5,if it is 7 my hidden field should give 7.Am using asp.net control hidden field(necessary to use in sql datasource).I can asp.net control hiddenfield values only in c#.
How can I change the hidden field values in c# with javascript for every click</p>
<p>How to achieve this using c# and javascript coding?please help me out</p>
| c# javascript asp.net | [0, 3, 9] |
1,087,284 | 1,087,285 | Banner changer issue | <p>I have the lines of code for a banner changer and whenever i add a link to any of the banners, it goes blank "The banner space goes blank." every now and then.
</p>
<pre><code> $(function(){
$('#banner img:gt(0)').hide();
setInterval(function(){$('#banner :first-
child').fadeOut().next('img').fadeIn().end().appendTo('#banner');}, 8000);
});
</script>
</code></pre>
<p><br>
</p>
<pre><code> <div id="banner">
<img src="images/hollinger.png" width="519" height="76" />
<img src="banners/leonards.png" width="519" height="76" />
<img src="banners/banner1.png" width="493" height="82" border="0" />
</div><!-- End Banner -
->
</code></pre>
<p></p>
<p>Here's the link to unstand what I mean Here's the link to understand what I mean <a href="http://woodstown-pilesgrove.com/" rel="nofollow">http://woodstown-pilesgrove.com/</a></p>
| javascript jquery | [3, 5] |
5,405,428 | 5,405,429 | find element at an absolute position | <p>How would you use jquery to get the element at a particular x, y coordinate? You can .offset and .position to find absolute and relative position using jquery. </p>
| javascript jquery | [3, 5] |
3,703,445 | 3,703,446 | Name convention Controls on Forms Tips | <p>I found out this article I would like share with you.</p>
<p><a href="http://10rem.net/articles/net-naming-conventions-and-programming-standards---best-practices" rel="nofollow">http://10rem.net/articles/net-naming-conventions-and-programming-standards---best-practices</a></p>
<p><a href="http://stackoverflow.com/questions/642759/naming-convention-for-controls">http://stackoverflow.com/questions/642759/naming-convention-for-controls</a></p>
<p>Regarding name conventions for "Controls on Forms", I thought to use this:</p>
<pre><code>ux-Description-GeneralType
</code></pre>
<p>Example:</p>
<pre><code>uxUserIdInput
</code></pre>
<p>PRO:</p>
<ol>
<li>have IntelliSense group all my Controls</li>
<li>possibility to identifu the type in IntelliSense</li>
<li>If I change the Type I do not need to update my code</li>
</ol>
<p>Because I am pretty new at developing, I would like start with the right foot and using solid practices.</p>
<p>Do you guys agree with that. Would you advice some other name convention?</p>
<p>Thanks for your time! bye </p>
| c# asp.net | [0, 9] |
2,279,430 | 2,279,431 | JavaScript check field value based on variable value | <p>I have an anchor like this:</p>
<pre><code><a href="#" rel="1 4 7 18 ">Anchor</a>
</code></pre>
<p>Where 'rel' attribute values are ids of some items.<br />
Than I have a form with an input, where user should type an id and click submit button.<br />
On submit button click I need to check the value of input like this:</p>
<pre><code>var value = $('a').attr('rel'); // get anchor 'rel' ids
var uservalue = $('input[type='text']').val();
if ( uservalue == '1' || uservalue == '4' || uservalue == '7' || uservalue == '18') {
// however I need the line above are created dynamically based on 'value' var
alert('The id exists');
return false;
} else {
return true;
}
</code></pre>
<p>So, the question is how to create a line below dynamically based on anchor 'rel' attribute values?!<br />
This is the line:</p>
<pre><code>if ( value == '1' || value == '4' || value == '7' || value == '18') {
</code></pre>
| javascript jquery | [3, 5] |
5,091,511 | 5,091,512 | Problem with jQuery clone(): clone input without value | <p>I am using jquery <code>.clone()</code> and it is working fine. However my problem is that when I clone my input field it also clones the value of the previous field. I don't want to clone the value. How can I overcome this issue?</p>
<p>Here is my code</p>
<pre><code>function addrow(){
var num = $('.clonedInput').length;
var newNum = new Number(num + 1);
var newElem = $('#input' + num).clone().attr('id', 'input' + newNum);
$('#input' + num).after(newElem);
jQuery('.clonedInput').each(function(){
jQuery('#total', jQuery(this)).unbind('blur');
});
var ci = jQuery('.clonedInput:last');
jQuery('#total', ci).blur(function() {
addrow();
});
}
</code></pre>
<p>Regards,</p>
<p>Faizan</p>
| javascript jquery | [3, 5] |
301,384 | 301,385 | Anyone know of javascript for this drop down navigation? | <p>I'm a beginner to web design, does anyone know of a script that has this EXACT drop down navigation style?</p>
<p><a href="http://behance.vo.llnwd.net/profiles4/172375/projects/4109265/b262ce1df694cced3f3fa5fe3cb8dc97.jpg" rel="nofollow">http://behance.vo.llnwd.net/profiles4/172375/projects/4109265/b262ce1df694cced3f3fa5fe3cb8dc97.jpg</a></p>
| javascript jquery | [3, 5] |
907,272 | 907,273 | How can I retain a GridViewRow value? | <p>My <code>GridView</code> is loaded with data from my database in a <code>DataSet</code>, which corresponds to <code>Label</code>s inside the <code>GridView</code>.</p>
<p>When users click the <code>Select</code> button on a <code>GridViewRow</code>, the button fills a <code>TextBox</code> outside the <code>GridView</code> from the selected row's column value.</p>
<p>After editing values in the <code>TextBox</code> outside my <code>GridView</code>, the user can click a button to move the new value from the <code>TextBox</code> back to the <code>GridView</code> (but not to the database).</p>
<p>My problem is: when I select the next row and do the same action, it clear the previous newly-added row data. It doesn't retain the previous row data.</p>
<p>I know it can be done by <code>ViewState</code> or <code>Session</code>, but it didn't work for me.</p>
| c# asp.net | [0, 9] |
3,747,214 | 3,747,215 | How to send email from ASP.Net | <p>My question is should I use email account to send email from asp.net application or just I can send it from the localhost?
regards,</p>
<p>Mohamed Farag</p>
| c# asp.net | [0, 9] |
4,633,568 | 4,633,569 | Generating a C++ executable from a C# application | <p>I have a WCF service accepting requests from our clients.
After analyzing the request I need to generate (compile + link) C++ EXE.
What is the best method to create an C++ EXE from a C# application???</p>
<p>10x</p>
| c# c++ | [0, 6] |
1,023,868 | 1,023,869 | How to invoke browser without losing browsing state? | <p>I have written an activity that has 2 image buttons (1 for messaging and another for browser). On click on each will start messaging and browser android activities respectively.</p>
<p>My question is: whenever I start my app and click on any of the buttons say browser button for example, and after it starts the android browser app, and it allows me whatever to browse in this time if I press the home button on android emulator and again if I start my app and select the browser button in my activity as usual the browser get started from the beginning rather than starting form where I left previously.</p>
<p>Should I start a service to call browser activity or should I set some flags while calling android browser activity?</p>
| java android | [1, 4] |
2,393,196 | 2,393,197 | Cannot seem to get user location | <p>I've been trying to get the longitude and latitude of a users location with Android. I've been trying to use the LocationManger however it does not seem to activate and give me an update. Here is the code, any ideas what I'm doing wrong?</p>
<pre><code>LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);// Define a listener that responds to location updates
LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) { // Called when a new location is found by the network location provider.
System.out.println(location.getLatitude());
System.out.println(location.getLongitude());
locationplace = location.getProvider();
}
public void onStatusChanged(String provider, int status, Bundle extras) {}
public void onProviderEnabled(String provider) {}
public void onProviderDisabled(String provider) {} };// Register the listener with the Location Manager to receive location updates
//locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
System.out.println(locationplace);
</code></pre>
| java android | [1, 4] |
3,512,631 | 3,512,632 | What are the best practices to add jquery to asp.net? | <p>I apologize if this question has been asked, but I can't find a question for this anywhere.</p>
<p>I would like to use jquery on my asp.net page, but should I just register a new script? Add a link? Is there some special reference I can add?</p>
<p><a href="http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx" rel="nofollow">scottgu states</a> that it's integrated into visual studio, but doesn't describe how to get started adding it to a page?</p>
| jquery asp.net | [5, 9] |
449,824 | 449,825 | DisplayMessageActivity cannot be resolved to a type-Building first android App | <p>Hi I have just began working on the first android application on <strong>developer.android.com</strong>.</p>
<p>well to start with I got to learn many error origins and their solutions from S.O. , but i have been trying to figure out this statement
<em>"DisplayMessageActivity cannot be resolved to a type"</em> while we have to set an Intent for button onclick function. It shows this error in the line where the code line is:</p>
<pre><code>Intent intent = new Intent (this, DisplayMessageActivity.class);
</code></pre>
<p>here is the java file:</p>
<p><strong>MainActivity.java</strong></p>
<pre><code>}
/**called when the user clicks the send button*/
public void sendMessage(View view) {
Intent intent = new Intent (this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById (R.id.edit_message);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity (intent);
}
}
</code></pre>
<p>I tried a lot find which class do I need to import now, and searched but no avail.
may be I am a beginner is what I miss here.</p>
| java android | [1, 4] |
5,903,398 | 5,903,399 | Drag an app window | <p>My app uses android:theme="@android:style/Theme.Panel"</p>
<p>in the manifest to make the window smaller than the screen on a big tablet.</p>
<p>But how can I move the app window around on the screen?</p>
<p>I don't see anything like "application.left" in the API.</p>
| java android | [1, 4] |
279,454 | 279,455 | Optimising event handling: one large, or many small? | <p>Which pattern is best, and why?</p>
<pre><code>$myElements.delegate(selector, 'event1 event2', function () {
if (event.type === 'event1') { /* Handle event 1 */ }
if (event.type === 'event2') { /* Handle event 2 */ }
}
</code></pre>
<p><strong>OR</strong></p>
<pre><code>$myElements
.delegate(selector, 'event1', function () {
/* Handle event 1 */
}
.delegate(selector, 'event2', function () {
/* Handle event 2 */
}
</code></pre>
<p>In other words, is it better to have one large unified handler, or many small separate handlers?</p>
| javascript jquery | [3, 5] |
1,623,417 | 1,623,418 | Event not getting fired in code behind | <pre><code>PnlImages.Controls.Add(new LiteralControl(" <img id=\"img\" class=\"content\" src=\"" + url + "\" runat=\"server\" name=\"img\" onclick=\"return onClick(this);\" />"));
public void onClick(object sender)
{
}
</code></pre>
<p>debugger is not firing instead giving error "object expected".<br>
Please help.</p>
| c# javascript | [0, 3] |
971,421 | 971,422 | ASP.net or jQuery modal pop-up solution | <p>I am looking for a modal pop-up solution with the following requirements:</p>
<p>1.) Usable with ASP.net.
2.) The modal pop-up's height is dynamic, for example: the modal pop-up's height would grow based on how much content was in it and if your content is going to make the pop-up taller than the browser's available height, the content would be scrollable.</p>
<p>Currently, we are using the ASP.net modal pop-up extender and if our pop-up is larger than the browser window, you have to click and drag. This becomes a problem when the user has a very small resolution and the modal pop-up's drag handle is obscured by the browser's toolbars.</p>
<p>I was just wondering if anyone else has run into this problem, if so, how did they solve it.</p>
<p>Thank you in advance,
Jim</p>
| jquery asp.net | [5, 9] |
5,953,943 | 5,953,944 | jQuery slideToggle() on two items concurrently | <p>So I'm in the process of creating a text slider, for headlines. I would like the currently displayed text to side out, at the same time that the new text is sliding in. Is there a way that I can use jQuerys <code>.slideToggle()</code> or <code>.slide()</code> concurrently to be able to do what I want?</p>
| javascript jquery | [3, 5] |
5,814,587 | 5,814,588 | gridview on edit event , on update event? | <p>I would like to know how I can access the edit and the update button from <code>GridView</code>?<br>
I mean, if I click the edit button from the website in the <code>GridView</code>, I want to get some values from the tables.<br>
For example: the <code>button1</code> event.</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.