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 |
---|---|---|---|---|---|
3,990,000 | 3,990,001 | Get the value in the textbox automatically when clicking an item in dropdown | <p>I have a text box and dropdown list box. In dropdown list box i'm having the list of equipments which are having the different price according to the equipment. User take the equipment for the rent for the num of days. Now I calculate the price for the rent using php function. </p>
<p>Now all I want is, to display that respected calculated value at the text box while clicking the respective item in a dropdown list box by calling that function in the html form using php.</p>
<p>Could anyone help me to fix this problem with the example?</p>
| php javascript | [2, 3] |
4,385,964 | 4,385,965 | copy data from one textbox to another when document is ready | <p>In a form, when the document is ready, I am trying to copy the preset value of a textbox to another textbox using jQuery. I tried <code>$("#b").val() = $("#a").val();</code> but, it dint work. Please refer to <a href="http://jsfiddle.net/Z693R/" rel="nofollow">this fiddle</a>.</p>
| javascript jquery | [3, 5] |
455,114 | 455,115 | Jquery - Open a new window with content from the current page | <p>I'm trying to create a 'print' button to open a new window and display a PHP Variable in it. </p>
<p>The code below is looped through the PHP script as many times as there are tickets, however I can't seem to get the correct number to display when the window opens (the number that displays in the print link is correct - but when the new window is opened it's incorrect). </p>
<pre><code><script type='text/javascript'>
jQuery(function($) {
$('a.new-window').click(function(){
var recipe = window.open('','PrintWindow','width=600,height=600');
var html = '<html><head><title>Print Your Ticket</title></head><body><div id="myprintticket">' + $('<div />').append($('#ticket').clone()).html() + '</div></body></html>';
recipe.document.open();
recipe.document.write(html);
recipe.document.close();
return false;
});
});
</script>
<a href="" class="new-window">Print <?php echo $EM_Booking->get_spaces() ?></a>
<div style="display:none;">
<div id="ticket"><?php echo $EM_Booking->get_spaces() ?>
</div>
</div>
</code></pre>
| php jquery | [2, 5] |
4,668,102 | 4,668,103 | creating Web User Control and adding it to tool box | <p>I'm trying to learn how create a web user control so i can use in diffrent projects. I created a simple control just to see how it worked; after I created it, I could add it to any page on the current project and it worked fine. </p>
<p>My problem is how can I add this control to the tool box so I can use it in diffrent projects? I tried to look for him by doing:</p>
<pre><code>right click toolbox > choose items > looking for it.
I can't see the control in the list.
</code></pre>
<p>What do i need to add so i can see it?</p>
<p><a href="http://stackoverflow.com/questions/288047/user-controls-not-showing-up-in-the-toolbox">Here is the same question</a> but nothing help me :( I'm using visual studio 2010.</p>
| c# asp.net | [0, 9] |
1,268,001 | 1,268,002 | Subscribing to "childrenAdded" event in jQuery | <p>Is there currently a way to subscribe to an event of a wrapped set, that will trigger when any element is appended to it as a child element? </p>
| javascript jquery | [3, 5] |
1,273,160 | 1,273,161 | How can I narrow down a class with an id in jQuery? | <p>I have the div:</p>
<pre><code><div class="io-content-pane" id="record-view" style="position: relative;></div>
</code></pre>
<p>How can I select this based on its class and its id in jQuery?</p>
| javascript jquery | [3, 5] |
2,800,354 | 2,800,355 | jQuery make kellishaver stopwatch plugin countdown instead of up | <p>I need a stopwatch/timer to countdown. I'm trying to use <a href="http://www.kellishaver.com/projects/stopwatch/" rel="nofollow">Kellis Havers stopwatch jQuery plugin</a> and change it to countdown.</p>
<p>But can't figure out how to make it substract instead of add seconds, tried changing the 'second++;' to 'second--;' but got this result= 00:03:0-1. It says in the comments that parseInt() is not working, so i figure it something with the seconds is written in 01 02 03 04 etc. </p>
<p>But I am not yet good enough to understand how to get it to countdown.</p>
<pre><code>function do_time() {
// parseInt() doesn't work here...
hour = parseFloat(h.text());
minute = parseFloat(m.text());
second = parseFloat(s.text());
second++;
if(second > 59) {
second = 0;
minute = minute + 1;
}
if(minute > 59) {
minute = 0;
hour = hour + 1;
}
h.html("0".substring(hour >= 10) + hour);
m.html("0".substring(minute >= 10) + minute);
s.html("0".substring(second >= 10) + second);
}
}
})(jQuery);
</code></pre>
| javascript jquery | [3, 5] |
4,123,843 | 4,123,844 | Intellisense for <tr> and <td> | <p>Hey, This is the one i used. For some condition, i want to hide these by using Visible to false.</p>
<pre><code><tr id="trpackage" runat="server" valign="top" align="center">
<td id="tdpack" runat="server" style="display: none;" align="center">
.......
</td>
</tr>
</code></pre>
<p>In the code behind, Intellisense does not show me either trpackage or tdpack. Can someone help me !! Thank you in advance!!</p>
| javascript asp.net | [3, 9] |
2,276,400 | 2,276,401 | Animate to top value when element has a bottom value | <p>I am trying to animate an element that is absolutely positioned and positioned bottom and left to a position top and right.</p>
<p>CSS</p>
<pre><code>.obj{
position: absolute;
bottom: 0;
left: 200px;
}
</code></pre>
<p>JS</p>
<pre><code>$('.obj').click(function(event){
$(this).animate({top:'15%', right: '300px' }, 400).css({'bottom': '', 'left': ''});
});
</code></pre>
<p>The problem with what I currently have is that some browsers (Chrome/Safari) will fire the CSS as it animates which leads to the object jumping across the screen.</p>
<p><strong>EDIT:</strong> It seems to clear the bottom and left value, then animates from <code>top: 0, right: 0</code>.</p>
<p>Also, I can't put the <code>.css()</code> in the complete function of the <code>.animate()</code> because the current bottom and left positioning affects how it animates.</p>
<p>Thanks for your help!</p>
| javascript jquery | [3, 5] |
5,308,002 | 5,308,003 | load content while scrolling not working | <p>I am writing a code which i scroll to the bottom of the window it loads another data with the help of php code.
It loads the load_first.php file but not identifies the load_second.php file
What problem in this code see this </p>
<pre><code> <?php $_SESSION['first']=1; if($_SESSION['first']==1) { ?>
<script type="text/javascript">
$(window).scroll(function(){
if($(window).scrollTop() == $(document).height() - $(window).height()){
$('div#last_msg_loader').html('<img src="loading.gif">');
var data="cachekey=" + $('.cachekey').val()+"&cachelocation="+ $('.cachelocation').val();
$.ajax({
url: "load_data.php?last_msg_id="+ID,
data:data,
error:function(error)
{
alert(error);
},
success: function(html){
if(html){
$(".message_box:last").after(data);
$('div#last_msg_loader').hide();
}else{
$('div#loadmoreajaxloader').html('<center>No more posts to show.</center>');
}
}
});
}
});
</script>
<?php
include('load_first.php');
?>
<?php
}
else
{
include('load_second.php');
}
?>
<div id="last_msg_loader"></div>
</code></pre>
<p>Actually this code is used to load the hotel list using xml api of expedia</p>
| php jquery | [2, 5] |
2,254,169 | 2,254,170 | Avoid data redundancy in ASP.NET page | <p>I have an asp.net page which uses a listview to show 2 columns of data.
The first column has just labels and the second one has dropdowns.</p>
<p>My concern is, the dropdowns in second column has same items 100% of the time, they never change and since it is databound, and datasource to these dropdown is also same. As these dropdowns are in a list view this repetition happens on each row added to my list view!</p>
<p>So, I was thinking of removing this data redundancy being transported over the wire. Any ideas?</p>
| c# asp.net | [0, 9] |
259,079 | 259,080 | jquery removing a class (if it exists and adding a new class) | <p>I'm trying use jquery to remove a class from an element (not knowing ahead of time if it exists) and add a new element to replace it.</p>
<p>Would this be the best way (I'm skepticle because its not checking to see if the class exists before removing it):</p>
<pre><code>$(elem).removeClass(oldClass).addClass(newClass);
</code></pre>
<p>thanks</p>
| javascript jquery | [3, 5] |
2,252,595 | 2,252,596 | Send message from a hotspot to a connected client | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/10777678/send-message-from-a-basic-server-to-a-specific-client">Send message from a basic server to a specific client</a> </p>
</blockquote>
<p>Here is a scenario. I have enabled a hotspot through wifi tethering on my android phone. I also have two wifi modules which connects to this hotspot. Now, I want to send a message to only 'one client' (not all) connected to my hotspot. Is that even possible in Java if I dont want to use a Server-Client Application. As the hotspot itself acts as a server.</p>
<p>Thanks for any assistance.</p>
| java android | [1, 4] |
1,853,435 | 1,853,436 | Change the selected value of the selectlist | <p>I am using <code>selectmenu plugin</code> for my select list. I want to change the selected value of the selectlist using jquery. I tried :</p>
<pre><code> $('select').val("new selected value");
$('select').selectmenu("value", "new selected value");
</code></pre>
<p>But both of the above are not working. Help me out please?</p>
| javascript jquery | [3, 5] |
1,125,616 | 1,125,617 | how to make a secondary link after a first link was clicked? | <p>i want to make two links.
1. click here to generate CSV file.
2. click here to download the CSV file.</p>
<p>the problem is that i want the second file to appear only if the first link was clicked.</p>
<p>can someone help?</p>
<p>thanks,
Sebastian</p>
<p>EDIT: i forgot to mention that my table is built up in a while statement.</p>
| php javascript | [2, 3] |
1,884,895 | 1,884,896 | adding a try catch around a large method call | <p>I have a web service that's pretty simple; something like this:</p>
<pre><code>public class LeadService : System.Web.Services.WebService {
[WebMethod(EnableSession = true)]
public string MyService(string TheIncomingData)
{
string ReturnData = "";
MyClass TheClass = new MyClass();
ReturnData = TheClass.MyMethod(TheIncomingData);
return ReturnData;
}
}
</code></pre>
<p>You might have guessed it, the MyMethod is a pretty long-running method with some room for errors (for now). If I add a try/catch statement around the method call like this:</p>
<pre><code>try { ReturnData = TheClass.MyMethod(TheIncomingData); }
catch { ReturnData = ""; }
</code></pre>
<p>Is this going to make the service and the app exception-proof? And, is using a try statement like this going to have any performance impact even if no error occurs?</p>
<p>Thanks for your advice.</p>
| c# asp.net | [0, 9] |
4,709,707 | 4,709,708 | How to Change the Text of a button using EditText on Android | <p>I am trying to use an EditText one one Activity to change the text of a button on another. I know I have to go through the SharedPreferences, and although this is where I am stuck.</p>
<p>Activity with the Button:</p>
<pre><code>protected void onResume() {
super.onResume();
class1.setText(this.getButtonText());
}
public String getButtonText()
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
String buttonText = prefs.getString("ButtonText", "Default button text"); // I am not sure how to get the button text here. This is what someone was trying to have me do?
return buttonText;
}
</code></pre>
<p>This is my Activity that has the EditText and the button to go back to the activity with the button:</p>
<pre><code>public class EditClass1 extends Activity implements OnClickListener{
Button class1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.editclass1);
SettingButtons();
class1.setOnClickListener(this);
}
private void SettingButtons() {
// TODO Auto-generated method stub
class1 = (Button) findViewById(R.id.edittoclass1);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId()){
case R.id.edittoclass1:
startActivity(new Intent("com.clayton.calendar.TOCLASS"));
break;
}
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
Editor editor = prefs.edit();
editor.putString("ButtonText", // This is not working
((TextView)findViewById(R.id.edittoclass1)).getText().toString());
editor.commit();
}
}
</code></pre>
| java android | [1, 4] |
5,495,384 | 5,495,385 | How to run Javascript code before document is completely loaded (using jQuery) | <p>I am sharing a tip with you all.Please add on to this discussion.</p>
<p>JQuery helps faster page load than javascript. JQuery functions are fired when the related elements are loaded, instead of complete pageload.
This is a common practice to call a javascript function when page is loaded like</p>
<pre><code>window.onload = function(){ alert("Mindfire") }
</code></pre>
<p>or</p>
<pre><code><body onload="javascript:document.getElementById('user_id').focus();">
</code></pre>
<p>Inside of which is the code that we want to run right when the page is loaded. Problematically, however, the <a href="http://www.mindfiresolutions.com/How-to-run-Javascript-code-before-document-is-completely-loaded-using-jQuery-35.php" rel="nofollow">Javascript</a> code isn't run until all images are finished downloading (this includes banner ads). The reason for using window.onload in the first place is due to the fact that the HTML 'document' isn't finished loading yet, when you first try to run your code.
To circumvent both problems, jQuery has a simple statement that checks the document and waits until it's ready to be manipulated, known as the ready event</p>
<pre><code>$(document).ready(function()
{
// Your code here
});
</code></pre>
| javascript jquery | [3, 5] |
1,684,287 | 1,684,288 | How does one share data between a C++app and a C# app without files? | <p>I have a C++ application with data that needs to be shared with a C# application.
I'm currently transferring the data via files, but with speed and quantity of the data becoming an issue I would like to find a way to share the data through memory.</p>
<p>I'm a beginner to intermediate programmer at best, and so far I have heard of two methods that may be able to help me do this: Socket Programming & Memory Mapped Files</p>
<p>So my questions is, which is the best way to do this? (yes, speed is a factor)</p>
<p>and any info or links to info that could help me in my research and comprehension of the method you suggest would be very much appreciated.</p>
<p>Thank you,</p>
| c# c++ | [0, 6] |
3,645,191 | 3,645,192 | check element has a class starting with string using jquery | <p>I am getting the last element from a form which has a value like this: </p>
<pre><code>var lastOne =$(':text[name^=distanceSlab][value!=""]').last();
</code></pre>
<p>now I want to find the element which has a class that begins with the string "limit".
I have tried something like:</p>
<pre><code>if(lastOne.is("class^='limit'")){
console.log('BEGINNING WITH LIMIT')
}
</code></pre>
<p>but it didn't work. How do I do this?</p>
| javascript jquery | [3, 5] |
951,257 | 951,258 | Gridview with multiple columns of checkboxes selection in javascript | <p>I am using a Gridview with checkboxes in my application.
Here is the format:
<img src="http://i.stack.imgur.com/QK95k.png" alt="enter image description here"></p>
<p>In the gridview if header checkbox is checked then all subsequent chekboxes under that should also be checked or unchecked as the case of header chekbox.</p>
<p>for this I am using java script function as.</p>
<pre><code> function SelectAllFirstRow(ChK, cellno)
{
var gv = document.getElementById("ggvPage");
for (var i = 1; i <= gv.rows.length - 1; i++) {
var chk1 = gv.rows(i).cells(cellno).firstChild;
chk1.checked = ChK.checked;
}
}
</code></pre>
<p>Here :
<strong>ggvPage</strong> is the Gridview.
<strong>Chk</strong> is the header Checkbox and cellno is like 1 for view,2 for Add and.........</p>
<p>It's working fine in IE but not in Firefox and chrome.</p>
<p>Please suggest some solution for fulfilling my need.</p>
<p>Waiting for valuable solutions,</p>
<p>Thanks a lot,
Supriya</p>
| javascript asp.net | [3, 9] |
1,887,231 | 1,887,232 | Will Java catch up with C#? | <p>Today I posted a question asking about which language C# or Java would be better for me to study. I had some great answers. One thing that came up was that perhaps Java is now rather behind C# with new features. I saw some web links and most pointed out what C# had and what java did not have. </p>
<p>So my question to you all is will Java catch up with C# again? And if you were to take a guess where would it stand in 5 years time. Would it have all the things that are maybe now missing? How about Java 7?</p>
| java c# | [1, 0] |
4,268,137 | 4,268,138 | jQuery insertAfter: will insert <li> but not <a>? | <p>With this code: </p>
<pre><code><ul data-role="listview" id="routelist" data-theme="g">
<li id="firstlistitem" style="display:none;">
</code></pre>
<h2> </h2>
<pre><code>$("<li><a href='http://www.google.co.uk'></a></li>").text('content').insertAfter($("#firstlistitem"));
</code></pre>
<p>and see also this jsFiddle: <a href="http://jsfiddle.net/6MW2e/" rel="nofollow">http://jsfiddle.net/6MW2e/</a></p>
<p>How come I end up with an unlinked list item? How can I insert an element with a link?</p>
<p>thanks!</p>
| javascript jquery | [3, 5] |
26,305 | 26,306 | Determine if collection of elements are visible using JQuery like $(".someClass") | <p>I have a collection of elements on my page, and I want to see if they are visible or not currently.</p>
<p>So:</p>
<pre><code>$(".someClass")
</code></pre>
<p>How can I loop through and figure this out? because if it is visible, i have to fire another function.</p>
| javascript jquery | [3, 5] |
2,531,639 | 2,531,640 | JQuery Toggle with sliding effect or similar | <p>I am working with this code:</p>
<pre><code><script type="text/javascript">
$(function(){
$('#MyLink').click(function(){
$('#DivA').toggle();
$('#DivB').toggle();
});
});
</script>
</code></pre>
<p>I just need to add some sliding to it of some other effect so that you can tell that it's actually swapping from one div to another.</p>
| javascript jquery | [3, 5] |
2,714,086 | 2,714,087 | Linking a button to a XML page | <p>Basic question but i have checked a number of places and can only find information on pop up messages like toast etc.</p>
<p>How would I be able to link buttonA (stored in fragment xml file) so that it will view activitypage.xml?</p>
<p>Thanks!</p>
| java android | [1, 4] |
4,819,815 | 4,819,816 | How to convert an image into ASCII | <p>I want to send an image to the server through XML. For that i need to change my image in ASCII. Can any one help me</p>
<p>Thanks in Advance. </p>
| java android | [1, 4] |
2,736,708 | 2,736,709 | How to export javascript generated report to pdf? | <p>I made a reporting engine with javascript for my project...
The problem is with printing..
Although with page-break and css i can produce a good looking report, i want to export that report to a pdf in order to be printed better without ,the url,page title and other stuff that browsers add.
Note in Chrome there isnt page setup!!!</p>
<p>I am using java for server side.</p>
<p>i think sending via ajax the Html of the report somehow and return a url for the pdf report maybe...
i am looking for a good tool for this
thank you</p>
| java javascript | [1, 3] |
2,343,116 | 2,343,117 | PHP syntax for setting a variable | <p>I have a JS script which im converting the code over to PHP but am stuck on what the correct syntax is to create the same as this piece of code in JS in my PHP script:</p>
<pre><code>var sdata = {
"13":{
"22":["618","22","1","1","0","0","0"],
"21":["617","22","1","1","0","0","0"]
},
"14":{
"22":["619","22","1","1","0","0","0"],
"20":["622","22","1","1","0","0","0"]
},
"15":{
"20":["623","22","1","1","0","0","0"]
}
};
</code></pre>
<p>Any ideas?</p>
| php javascript | [2, 3] |
6,033,567 | 6,033,568 | jQuery dynamic changing image header | <p>Iam trying to write a simple jQuery function to change the image header of my webpage.</p>
<p>The HTML looks like this:</p>
<pre><code><div class="slider">
<ul>
<li> <img src="img/slide21.png" alt=""> </li>
<li> <img src="img/slide31.png" alt=""> </li>
</code></pre>
<p>
</p>
<p>I just want to fade in the next image every 5 seconds and fade out the old.
The position of the image should not change and all images are the same size.</p>
<p>My js code looks like this:</p>
<pre><code>function menu (obj) {
if (!obj.length) {
return;
}
$(obj).find("li").hide();
$(obj).find("li").next().fadeIn(2400);
}
$(document).ready(function () {
menu(".slider");
});
}
</code></pre>
<p>This code is really not what I want but currently I have no idea how to do this.</p>
<p>Any help would be appreciated!
Thanks!</p>
| javascript jquery | [3, 5] |
3,616,534 | 3,616,535 | sliding the divs accroding to url | <p>I am having a page here.</p>
<p><a href="http://www.kharota.com/cantsay/index.html" rel="nofollow">http://www.kharota.com/cantsay/index.html</a></p>
<p>What I wanted was to div slide up and down as url changes for example index.html#thisweek will slide the div which contains data of this week. Sometimes it works sometimes its not. I am big confused there is no error but still not working. The code is following</p>
<pre><code>var loc = window.location.href;
if(loc.indexOf( '#' ) >= 0 ) {
var hash = loc.substr( loc.indexOf('#') + 1 );
}else{
var hash = "";
}
if(!hash){
$("#ca").slideDown("fast");
}else{
switch(hash){
case "iwantagig":
$("#cd").slideDown("fast");
$("#ca").slideUp("fast");
$("#cb").slideUp("fast");
$("#cc").slideUp("fast");
break;
case "jointhecrew":
$("#cc").slideDown("fast");
$("#ca").slideUp("fast");
$("#cb").slideUp("fast");
$("#cd").slideUp("fast");
break;
case "birthdayGuestlist":
$("#cb").slideDown("fast");
$("#ca").slideUp("fast");
$("#cc").slideUp("fast");
$("#cd").slideUp("fast");
break;
case "thisweek":
$("#ca").slideDown("fast");
$("#cb").slideUp("fast");
$("#cc").slideUp("fast");
$("#cd").slideUp("fast");
break;
}
}
</code></pre>
<p>The page is here. I would be thankful if someone help.</p>
<p><a href="http://www.kharota.com/cantsay/index.html" rel="nofollow">http://www.kharota.com/cantsay/index.html</a></p>
| javascript jquery | [3, 5] |
5,158,490 | 5,158,491 | PHP JSON and <script> tag | <p>I am using PHP to send a json string to jQuery ajax. I am simply using $("#id").html(data.result) to display the html from the fetched page. Now on the fetched page I am looping through MySQL results. I need to run a piece of javascript on each result so I can start a countdown timer for each result.</p>
<p>My problem is that the calling page simply displays the actual javascript script as a string.</p>
<pre><code>$row_array['result'] .= '<script>trigger script</script>'
</code></pre>
<p>Any suggestions?</p>
<p>Thanks</p>
| php jquery | [2, 5] |
1,279,586 | 1,279,587 | Jquery PHP media upload library | <p>Strange trouble
I want to upload image via ajax which many plugin does but none support textarea to write caption. As i want to assign a caption to every image ,how do my new learning task makes it different is i want user to be able to put up caption whilst image is uploading.</p>
<p>Do any one know of such plugin that just donot send ajax request but also have text box requests attached </p>
| php jquery | [2, 5] |
1,760,886 | 1,760,887 | Current Page HTML output using c# | <p>I am working in an asp.net website. I need to get the current page HTML output in the Page Load event. I tried the following code. But I am not getting any output, it executes continuously.</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
Http(Request.Url.ToString());
}
public void Http(string url)
{
if (url.Length > 0)
{
Uri myUri = new Uri(url);
// Create a 'HttpWebRequest' object for the specified url.
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(myUri);
// Set the user agent as if we were a web browser
myHttpWebRequest.UserAgent = @"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4";
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
var stream = myHttpWebResponse.GetResponseStream();
var reader = new StreamReader(stream);
var html = reader.ReadToEnd();
// Release resources of response object.
myHttpWebResponse.Close();
Response.Write(html);
}
}
</code></pre>
<p>What is wrong here?</p>
<p>Is there is any other way to get current page HTML output using c#?</p>
<p>I tried the following code also:</p>
<pre><code> protected void Page_Load(object sender, EventArgs e)
{
Page pp = this.Page;
StringWriter tw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
pp.RenderControl(hw);
string theOut = tw.ToString().Trim();
string FilePath = @"D:\Home.txt";
Stream s = new FileStream(FilePath, FileMode.Create);
StreamWriter sw = new StreamWriter(s);
sw.WriteLine(theOut);
sw.Close();
}
</code></pre>
<p>By using the code i am able to get the HTML in the ".txt" file.But execution of this code causes "A page can have only one server-side Form tag." error. Can anybody help me to solve this?</p>
| c# asp.net | [0, 9] |
4,372,494 | 4,372,495 | Get value attribute of the clicked checkbox via JQuery | <p>I have got this <code>checkbox</code> which has value <strong>1</strong>.</p>
<pre><code><input type="checkbox" name="option_1" id="checkbox_1" value="1">
</code></pre>
<p>Also I use this method to make checked/unchecked it. </p>
<pre><code>$('input[id^="checkbox_"]').not('#checkbox_all').click(function () {
$('#checkbox_all').prop('checked', false);
// Get 'VALUE' of the checkbox here
});
</code></pre>
<p>What I need is somehow get 'VALUE' of the clicked <code>checkbox</code>. So In that case it should be <strong>1</strong>.</p>
<p>Any clue how do it could be done?</p>
<p>Thank you!</p>
| javascript jquery | [3, 5] |
1,736,833 | 1,736,834 | jQuery Add Class on Click but only allowed once. | <p>Here is what I have so far:
<img src="http://i.stack.imgur.com/8WC1d.png" alt="enter image description here"></p>
<p><strong>Javascript:</strong></p>
<pre><code>$(document).ready(function() {
$(".thumb_wrapper").click(function() {
$(this).addClass("active");
});
});
</code></pre>
<p>So this is working, it is adding the class but I want only one item to be active at all times. So when I click on an item, and it turns active, the next item I click on should be the new active one, and remove the class on the previous one.</p>
<p>Does that make sense? How can I do something like this?</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
1,404,593 | 1,404,594 | jquery select elements from a given selector | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4502533/jquery-method-to-select-a-subset-and-also-its-inverse">jQuery method to select a subset and also its inverse?</a> </p>
</blockquote>
<p>given this javascript code </p>
<pre><code>var radio_buttons = $('.search-options input[type="radio"]');
</code></pre>
<p>I want to get only the checked radio button from the collection of radio buttons that the variable holds. I thought that the find method could help achieving that, but it doesn't.</p>
<pre><code>radio_buttons.find('input[checked]')
</code></pre>
<p>Any other way to do it?</p>
| javascript jquery | [3, 5] |
4,347,064 | 4,347,065 | how to access parent window object using jquery? | <p>How to acess parent window object using jquery?</p>
<p>This is my Parent window variable , I want to set its value after closing child window .</p>
<pre><code>$('#serverMsg').html('some text here');
</code></pre>
| javascript jquery | [3, 5] |
2,839,367 | 2,839,368 | How to add number of days to today's date? | <p>I need to be able to add 1, 2 , 5 or 10 days to today's date using jQuery.</p>
| javascript jquery | [3, 5] |
3,894,682 | 3,894,683 | jQuery: set selected value of dropdown list? | <p>What's wrong with this code? <a href="http://jsfiddle.net/x3UyB/1/">http://jsfiddle.net/x3UyB/1/</a></p>
<pre><code>$(document).ready(function() {
$("#routetype").val('quietest');
)};
<select id="routetype" name="routetype">
<option value="fastest">Fastest</option>
<option selected="true" value="balanced">Balanced</option>
<option value="quietest">Quietest</option>
</select>
</code></pre>
<p>It gives me 'Balanced' as the selected option, not 'Quietest'.</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
390,221 | 390,222 | how to add a div and apply a style to it in jquery | <p>the code is like this:</p>
<pre><code> <div id="comments">
<h2>comments list</h2>
<div class="clear-block">....</div>
<div class="clear-block">....</div>
<div class="clear-block">....</div>
<div class="indented">....</div> // this div is indented.
<div class="box"...</div>
</div>
</code></pre>
<p>now, i want to use jquery to add a border to the </p>
<pre><code> <h2>......</div>
</code></pre>
<p>part.maybe i shoule add a div label first before the h2 label, then the close label </p>
<pre><code> </div>
</code></pre>
<p>before </p>
<pre><code><div class="box"> .
</code></pre>
<p>then using a style</p>
<pre><code> border:1px...
</code></pre>
<p>but i don't how to do it. thank you.</p>
<p>the border effect like this <a href="http://phplist.xxmn.com/1.jpg" rel="nofollow">http://phplist.xxmn.com/1.jpg</a></p>
| javascript jquery | [3, 5] |
2,882,747 | 2,882,748 | What is the best way to call Java code from Python? | <p>I have a Java class library (3rd party, proprietary) and I want my python script to call its functions. I already have java code that uses this library. What is the best way to achieve this?</p>
| java python | [1, 7] |
4,777,578 | 4,777,579 | Logout on Backward | <p>I want the page to sign out automatically if the user accessed the page from back the button.</p>
<p>below is my code:</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
Label1.Visible = false;
try
{
if (!IsPostBack)
{
TxtLogin.Focus();
Session["url"] = null;
Response.Cache.SetNoStore();
Response.Expires = -1;
Session.Abandon();
if (Page.User.Identity.IsAuthenticated)
{
FormsAuthentication.SignOut();
Response.Redirect("~\\LoginPage.aspx", false);
}
}
}
catch (Exception ex) { throw new Exception(ex.Message); }
}
</code></pre>
<p>Its working in IE but not working in firefox how to do for firefox?</p>
| c# asp.net | [0, 9] |
3,079,260 | 3,079,261 | Off-canvas / viewport navigation slide in with jQuery | <p>I am trying to make an off-canvas navigation that slides in from the left to take up 20% of the page while the content slides to the left ( some of it will be off canvas ) taking up 80% of the page.
This has been seen in Google's mobile site and Facebook's mobile app.</p>
<p>Here is a version using CSS3 Transitions: <a href="http://codepen.io/chriscoyier/pen/umEgv" rel="nofollow">http://codepen.io/chriscoyier/pen/umEgv</a></p>
<p>Except, I am trying to make one that relies only on JQuery / Javascript and not CSS Transitions at all.</p>
<p>Below is a link to what I have so far.</p>
<p>I don't understand why it is not working. The width of the #main-nav should be toggled every time .menu-button is clicked; thus creating a sliding tot he right effect.</p>
<p>Can someone please help me fix this and / or help me with that I am trying to achieve.</p>
<p>Here is what I have so far: <a href="http://pastebin.com/0X7uT7tC" rel="nofollow">http://pastebin.com/0X7uT7tC</a></p>
| javascript jquery | [3, 5] |
5,983,507 | 5,983,508 | blueooth barcode getInputStream() | <p>im using a blueooth barcode reader
to deliver text to an edit text</p>
<p>the problem is that it cuts the barcode text for about half the time
and delievers me an incomplete text</p>
<p>i am using the class "BluetoothSocket"
this is my reading code:</p>
<pre><code>int bytes = socket.getInputStream().read(buffer);
message = message + new String(buffer, 0, bytes);
// Send the obtained bytes to the UI Activity
handler.post(new MessagePoster(textView, message));
</code></pre>
<p>i am looking for a way to make the action of getInputStream() be longer
thank you for your help</p>
| java android | [1, 4] |
684,215 | 684,216 | Detect when an alert box is OK'ed and/or closed | <p>Basically as the title says.</p>
<p>How can I detect when an alert box is OK'ed and/or closed?</p>
| javascript jquery | [3, 5] |
19,562 | 19,563 | How to call methods | <p>I have few js files in my project with this structure:</p>
<pre><code>(function (window, $) {
var reload = function (force) { /* implementation here */ };
//more variables are here, the same construction as above
})(this, $);
</code></pre>
<p>Are more such files, for each part (page) of the website there is one js with this structure to manage the page. The whole site is a single page, with those js files managing DOM nodes by hiding, showing and filling content and this gives to the user the illusion s/he navigates throw multiple pages. </p>
<ol>
<li><p>I'd like to get a simple explication about how the above construction is loaded - I see the head.js library that loads all those js scripts, but I don't understand where is loaded, how to access it.</p></li>
<li><p>I'd like to know how to access by myself the specific reload() I need. As I told you, are more js files with the same structure (resources.js, users.js, reports.js etc). How do I access the reload function inside, let's say, reports.js on a button press in the html I load all those scripts?</p></li>
</ol>
| javascript jquery | [3, 5] |
5,724,703 | 5,724,704 | java script is not working | <p>i am comparing password and confirm password through java script.my code-</p>
<pre><code>function validate_form(thisform)
{
with (thisform)
{
if (validate_required(password,"<b>Error: </b>Password must be filled out!")==false)
{password.focus();return false;}
else if (validate_required(cnfpassword,"<b>Error: </b>Confirm Password must be filled out!")==false)
{cnfpassword.focus();return false;}
else if (document.getElementById('password').value != document.getElementById('cnfpassword').value)
{password.focus();Sexy.error("<b>Error: </b>Passwords entered are not same!");
password.value="";cnfpassword.value="";return false;}
}
</code></pre>
<p><strong>validate_required()</strong> function is working fine, it is showing alert msg but <strong>password compare</strong> is not working. But the same code is working fine in some other page.I have written some php code to avoid page caching-</p>
<pre><code><?php
session_start();
session_cache_limiter('nocache');
header('Pragma: no-cache');
?>
</code></pre>
<p><strong>what's the problem???</strong></p>
| php javascript | [2, 3] |
430,139 | 430,140 | advice on how to fix the prev and next buttons of content slider | <p>I'm trying to add in previous and next buttons to my content slider but seem to be having problems, what I would really like to do is move the $slideCtn left or right by the width slideWidth each time the previous or next button is clicked but i'm unsure how to increment each click by the value of slideWidth. I've tried ++ and -- etc but with no results, would anyone be able to show me the best way to do something like this? Also any other advice very welcome!</p>
<p>Or should I create a global index variable that gets set at 0, then as the pagination x's are clicked or the prev/next arrows are clicked update this global variable?</p>
<p><strong>JS Snippet</strong></p>
<pre><code>//Add previous + next arrows
$dirArrows.on('click', function(e){
var arrDir = $(this).data('dir');
$slideCtn.css('left', ( arrDir === 'prev' ) ? -(slideWidth) : +(slideWidth));
e.preventDefault();
});
</code></pre>
<p><strong>JS Fiddle</strong>
<a href="http://jsfiddle.net/SG5ad/10/" rel="nofollow">http://jsfiddle.net/SG5ad/10/</a></p>
| javascript jquery | [3, 5] |
3,936,517 | 3,936,518 | How to set position of element equals to position of another element? | <p>The simple question. How to set position of element equals to position of another element by jquery or javascript?</p>
<p>The following code doesn't work:</p>
<pre><code>$('#credit_tip').css('top', $('.credit').position().top);
$('#credit_tip').css('left', $('.credit').position().left);
</code></pre>
| javascript jquery | [3, 5] |
4,860,070 | 4,860,071 | How to return a value from a nested and anonymous function? | <p>I have this JS code:</p>
<pre><code>function paging() {
$('.paging li').click(function(e) {
$('.paging li a').removeClass("active");
$(this).find('a').addClass("active");
$('#img-grp-wrap img').hide();
var indexer = $(this).index();
$('#img-grp-wrap img:eq('+indexer+')').fadeIn();
e.preventDefault();
return indexer;
});
}
var $cur_page = paging();
console.log($cur_page);
</code></pre>
<p>I would like to use the indexer value outside the function paging() but when I try doing console.log(), it just says <em>undefined</em>.</p>
<p>How do I structure this so that I can pass the index value of the link I clicked outside the function (which is the indexer variable)?</p>
<p>I'm a programming newbie so please bear with me.</p>
| javascript jquery | [3, 5] |
5,550,497 | 5,550,498 | Recompiling Android Launcher2 (Gingerbread) | <p>I'm attempting to recompile the Launcher2 (Gingerbread) application, so that i can modify it.</p>
<p>However, I get a fair few errors (120ish), namely:</p>
<p>mLeft, mTop, mBottom, mRight, mParent, mContext cannot be resolved to a variable.</p>
<p>These come from (what I can see anyway), private members of the "TextView" widget.</p>
<p>Is there any way to access these private members, or would I need to do some other magic to get this working?</p>
<p>Cheers!</p>
| java android | [1, 4] |
740,049 | 740,050 | Data binding in gridview column using eval | <p>I hava grid containing a column for displaying countrynames. I need to display value in that column as contrycode-first 10 letters of country name (in-India) .I tried it using Eval functions with in the item template:</p>
<pre><code><asp:TemplateField>
<ItemTemplate>
<asp:Label ID="CountryNameLabe" runat="server" Text='<%# Eval("CorporateAddressCountry").SubString(0,6) %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</code></pre>
<p>But it shows error.
Can i use custom functions in eval?
please help</p>
| c# asp.net | [0, 9] |
5,252,442 | 5,252,443 | To delay javascript function call using jquery | <p><strong>CODES:</strong></p>
<pre><code> $().ready(function(){
function sample()
{
alert("This is sample function");
}
$("#button").click(function(){
t=setTimeout("sample()",2000);
});
});
</code></pre>
<p><strong>HTML:</strong></p>
<pre><code><input type="button" name="button" id="button" value="Call sample function with delay">
</code></pre>
<p>Once i click button sample function is not called with a delay of 2 seconds. I dont know whats wrong. Please notify me how to do this</p>
<p><strong>Question:</strong> To call javascript function using setTimeout via jquery</p>
| javascript jquery | [3, 5] |
5,578,781 | 5,578,782 | How can I make a box hide when mouse hovers other element | <p>Im making a webpage and at the moment it has a full screen background image with an overlaying div containing all the page text content slightly off center an about 500px wide so the image is visible behind it. I'd like to be able to hover the mouse over the background image which would cause the text box to close close up exposing the background image to be fully viewed, however the content box needs to open again when the mouse moves </p>
<p>I hope that makes sense, can anyone help me?</p>
| javascript jquery | [3, 5] |
5,082,422 | 5,082,423 | How to get an array in asp (Server side) to javascript? | <p>Hi i have float array in server side i want to take this array to javascript how do i do this?</p>
<p>I'm using c# </p>
| c# javascript asp.net | [0, 3, 9] |
2,982,469 | 2,982,470 | Pre load images from an ajax request before displaying them? | <p>I'm using jQuery to load html content which contains images, the problem is that i don't want the effect of blinking on images due to loading, to achieve that i need to pre load images inside the response body before inserting it to guarantee a smooth update.</p>
<p>Current Code:</p>
<pre><code>$.ajax({
url: 'hello.php',
method: 'GET',
data:'id='+id,
success: function(data) {
$('#section').html(data);
}
});
</code></pre>
<p>Any Solutions?</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
1,635,743 | 1,635,744 | Javascript multidimensioned isset() | <p>When running:</p>
<pre><code>if (data.custaccount.webaddress) {
alert('found it');
}
</code></pre>
<p>I get the error </p>
<pre><code>data.custaccount is undefined
</code></pre>
<p>The only way i can get around it seems to be with multiple IFs like so:</p>
<pre><code>if (undefined != data && undefined != data.custaccount && undefined != data.custaccount.webaddress) {
alert('found it');
}
</code></pre>
<p>Is there any way i could do this more simply? </p>
<p>In php we'd normally use the isset(data.custaccount.webaddress) and that worked quite well. is there an equivalent in javascript (or jquery)?</p>
<p>We have used try / catch, but found that to slow down performance of the script considerably.</p>
<p>I've seen someone else asking something similar on <a href="http://verens.com/2005/07/25/isset-for-javascript/" rel="nofollow">http://verens.com/2005/07/25/isset-for-javascript/</a> without any success, but am hoping that stackoverflow will do it's normal job of saving the day :)</p>
<p>Thanks!!!</p>
<p>Justin</p>
| javascript jquery | [3, 5] |
5,972,130 | 5,972,131 | Check the time stored in the DB, then make sure its 15 min later before running a update task | <p>I would like to stop people from constantly syncing/updating items in the DB as this could cause potential problems. I have a time the last sync/update occured which is stored in the DB. What I need to do is disable the user from initiating another update/sync until 15 minutes has passed since the last update/sync.</p>
<p>How would i go about doing this?</p>
<p>Update: for some reason i am getting the error "A new expression requires (), [], or {} after type" on DateTime lastUpdate. Any ideas why this could be?</p>
<pre><code> DataDataContext dc = new DataDataContext();
DateTime lastUpdate = from t in dc.Settings
where t.id == 1
select t.lastSync;
if ((DateTime.Now - lastUpdate).TotalMinutes >= 15)
{
}
else { }
</code></pre>
<p>Update: Sorted, i missed off the (); of the datacontext!! <em>facepalm</em></p>
<p>Final Update: All fixed and working! Many thanks for all your help, for the ones who think this "smells fishy" or "is bad" then here is what i did!!</p>
<pre><code>DateTime lastUpdate = (from t in dc.Settings
where t.id == 1
select t.lastSync).Single();
if ((DateTime.Now - lastUpdate).TotalMinutes >= 15)
{
syncbuttons.Visible = false;
}
else { syncbuttons.Visible = true; }
</code></pre>
<p>Now please explain what is so suspect about what i am trying to do? Stopping users from hammering a database? What if i have 30 users attempting to update/sync. Would not be that good would it!</p>
| c# asp.net | [0, 9] |
3,457,337 | 3,457,338 | Using jQuery to perform .load on originating page div, from floatbox popup | <p>I have 3 pages, we'll call them Page A, B, & C.</p>
<p>On Page A, Page C loads into a div. Also on Page A, there's a link-click that opens Page B with Floatbox (like a popup).</p>
<p>On Page B, there's an onClick function that should reload Page C into the div that is located on page A (underneath the floatbox popup).</p>
<p>The function on Page B is currently trying to load the div onto Page B. I verified this by adding a copy of the div to Page B, and it loads there, as expected.</p>
<p>How can I make the function on Page B target the div on Page A?</p>
<p>On page B I'm using: </p>
<pre><code>function functionName() {
$('#divName').loadfunction functionName('pageC.php'); {
}
</code></pre>
| javascript jquery | [3, 5] |
912,061 | 912,062 | iphone apns sending push notification in different languages with voice | <p>i have studied and implemented Ray wenderlich's awesome tutorials on apns, and i am using this php script on server side</p>
<p><a href="https://github.com/sebastianborggrewe/PHP-Apple-Push-Notification-Server" rel="nofollow">https://github.com/sebastianborggrewe/PHP-Apple-Push-Notification-Server</a></p>
<p>every thing is going well, but i just want to know that how can i send push notification in a language other than english, like arabic, urdu, hindi or french...???(i am sending notifications from php server using a web form) this is first part of question, the other part is that can i send a voice message with push notification, i know that there is a property for sound in apns but dont know its max. length (max length of push notification is 256 bytes). plz. guide me thanx and Regards Saad. </p>
| php iphone | [2, 8] |
5,338,689 | 5,338,690 | File Upload for asp.net in c# | <p>I have been working on an image/file uploader that stores an image to a virtual directory with MapPath or to a database. I have been using if statements for the button click event to check the file and attempt to save but I have not been successful.</p>
<pre><code>protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
string extension = Path.GetExtension(FileUpload1.FileName);
if (extension == ".jpg" || extension == ".gif" || extension == ".png" || extension == ".bmp")
{
FileUpload1.SaveAs(Server.MapPath("../photos/" + FileUpload1.FileName));
string imagePath = "/photos/" + FileUpload1.FileName;
</code></pre>
| c# asp.net | [0, 9] |
5,557,474 | 5,557,475 | hash change and save element position | <p>I'm looking for a simple way of having the hash change and to be able to save an element position. By looking at all the examples around are in regards of tabs systems, but I only really need: "on a click of this link, save this element at this position". Following a quick and simple logic:</p>
<p>start addres bar </p>
<pre><code> htp://mysite.com
</code></pre>
<p>basic html</p>
<pre><code><div class="leftNav">
<ul>
<li><a href="myPositionedLeftNav"></a></ali>
</ul>
</div>
</code></pre>
<p>css</p>
<pre><code>.leftNav {
position: fixed;
to: 0;
left: 20;
}
</code></pre>
<p>jQuery</p>
<pre><code> $(".leftNav a").click(function(){
$(".leftNav").css("top", "50");
});
</code></pre>
<p>New address bar should be</p>
<pre><code> http://mysite.com/myPositionedLeftNav
</code></pre>
<p>Now linking to this new address bar will show the leftNav positioned as we said on jQuery click event.</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
3,356,781 | 3,356,782 | local Javascript - write to local file | <p>I have some javascript code loaded from a local html file (without going through a webserver).. i.e., opened using <code>file://</code></p>
<p>Is there any way the javascript in this file can be used to write to a local file?</p>
<p>I know that cross-site restrictions do not allow lot of things in javascript, but this is not cross-site, so it should be allowed in theory.</p>
| javascript jquery | [3, 5] |
4,091,785 | 4,091,786 | Different events when onclick tabs | <p>Hi Guys
I have created a tabs by jquery and i want to display different data from database at each tab how can i do that knowing that it is the same container and same data but with different conditions hope to find an answer soon
And i am using php and javascript
Thanks </p>
| php javascript jquery | [2, 3, 5] |
1,162,338 | 1,162,339 | Converting image to text using ocr in c# asp.net | <p>I am trying to convert a image to text using OCR library with the source code provided on below link</p>
<p><a href="http://www.codeproject.com/Articles/41709/How-To-Use-Office-2007-OCR-Using-C" rel="nofollow">Converting image to text using ocr</a></p>
<p>But i get the below annoying exception every time i do</p>
<pre><code>md.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH,true,true);
</code></pre>
<p>but i am getting error </p>
<pre><code>Object hasn't been initialized and can't be used yet.
</code></pre>
<p>Please give me solution to solve the problem.<br>
Thank You.</p>
| c# asp.net | [0, 9] |
4,830,701 | 4,830,702 | How to show human-readable "time ago" | <p>My user last logged in at 15:50:09 Wednesday, January 25, 2012 IST
how can i show it as "10 minutes ago".
Is there any js?</p>
| javascript jquery | [3, 5] |
4,014,743 | 4,014,744 | dropdownlist custom databinding | <p>DropDownList inside Gridview.</p>
<p>Database Schema: </p>
<pre><code>Restaurants Menus Products
RestaurantID MenuID ProductID
RestaurantName MenuName ProductName
RestaurantID MenuID
</code></pre>
<p>it doesnt work with this:</p>
<pre><code><asp:DropDownList ID="DropDownList8" runat="server" DataSourceID="ObjectDataSource3"
SelectedValue='<%# Bind("MenuID") %>' DataTextField="RestaurantName" DataValueField="RestaurantID">
</code></pre>
<p>Gridview has GetAllProducts method.</p>
<p>ObjectDataSource3 has GetAllRestaurants method.</p>
<p>I want to edit and insert Menus of each Product. But I want to show RestaurantName indtead of MenuID..</p>
<p>When you want to bind Questions and Categories (just two) tables, this can work easily:</p>
<pre><code><asp:DropDownList ID="DropDownList8" runat="server" DataSourceID="ObjectDataSource3" SelectedValue='<%# Bind("CategoryID") %>' DataTextField="CategoryName" DataValueField="CategoryID">
</code></pre>
<p>I have 3 tables to reach data.. How can I do this?</p>
<p>Thanks</p>
| c# asp.net | [0, 9] |
1,699,558 | 1,699,559 | javascript: Swap image & onClick | <pre><code><img src="logo.jpg" class="myImage" alt="Logotyp" />
</code></pre>
<p>This is my javascript code:</p>
<pre class="lang-js prettyprint-override"><code>$(function() {
var windowWidth = $(window).width();
if (windowWidth <= 480) {
$(".myImage").attr("src", "load.jpg");
}
});
</code></pre>
<p>The image logo.jpg becomes load.jpg when window width = 480. Works fine. But I want an onClick-function that says when you click load.jpg it becomes logo.jpg again. Can't seem to make it work. Suggestions?</p>
| javascript jquery | [3, 5] |
325,782 | 325,783 | Intent problem, return value (Android) | <p>I have an application that open an other class using intent : </p>
<pre>
private void createRepository(){
Intent j = new Intent(this, Repository.class);
startActivityForResult(j, ACTIVITY_CREATE);
}
</pre>
<p>In Repository.class we have the <strong>onActivityResult</strong> method :</p>
<pre>
public void onActivityResult(int reqCode, int resultCode, Intent data) {
super.onActivityResult(reqCode, resultCode, data);
switch (reqCode) {
case (PICK_CONTACT) :
if (resultCode == Activity.RESULT_OK) {
Uri contactData = data.getData();
c = managedQuery(contactData, null, null, null, null);
if (c.moveToFirst()) {
//String name = c.getString(c.getColumnIndexOrThrow(People.NAME));
num = c.getString(c.getColumnIndexOrThrow(People.NUMBER));
}
}
break;
}
finish();
}
</pre>
<p>I don't know how I can return the value of <strong>num</strong> to the first class (that create Repository.class).
Thank you for your help.
Michaël</p>
| java android | [1, 4] |
2,250,514 | 2,250,515 | Should C# or C++ be chosen for learning Games Programming (consoles)? | <p>I've basic game programming knowledge in c and c++. I'm learning c# nowadays. If I want to make a career in console games programming, which one I should use to proceed? I've noticed that a lot of game companies are using C++/C (probably because of legacy reasons). Also probably C++ enjoys more number of supported libraries? In which languages modern game engines(unreal/crysis etc) are written in?</p>
<p>This <a href="http://stackoverflow.com/questions/174830/learning-game-programming">thread</a> suggests to use c# in the beginning and later c++. Would in future C++ maintain its spot in games industry? </p>
<p>Keeping all those points in mind, which language would be a better bet? and why?</p>
| c# c++ | [0, 6] |
5,444,948 | 5,444,949 | Is there any method to escape '>' to '>' in JavaScript? | <p>i want to escape some HTML in JavaScript. How can I do that?</p>
| javascript jquery | [3, 5] |
1,404,422 | 1,404,423 | Current selection of tab selected in tabcontainer when page load or refresh | <p>When page refresh tabcontainer of tab not staying current selection of tab.I have 3 tabs.I select tab2,when page load it goes to tab1.My current page name is Customer.aspx.This page automatically refresh every 60sec.so i wrote coding </p>
<pre><code> $(document).ready(function () {
window.setInterval(yourfunction, 60000);
});
function yourfunction() { window.location = "Customer.aspx"; }
</code></pre>
<p>Tab container coding is</p>
<pre><code> <div style="width: 80%; height: auto; float: left; margin-left: 8.9%;">
<ul class="tabNav">
<li><a href="#nogo" title="Additional Info" linkrel="#tab-1">Address Info</a></li>
<li><a href="#nogo" title="Additional Info" linkrel="#tab-2">Additional Info</a></li>
<li><a href="#nogo" title="Payment &amp; Job Info" linkrel="#tab-3">Payment Info</a></li>
<li></li>
</ul>
<div class="full" id="tab-1">some data</div>
<div class="full" id="tab-2">some data</div>
<div class="full" id="tab-3">some data </div>
</code></pre>
<p>when page load the page display Customer.aspx.When i click any tabs the url is Customer#nogo.aspx.after 60s page refresh url goes to Customer.aspx.</p>
<p>so tab-1 automatically selected using jQuery.so please help me,when page load how to i select current selected tab,not go to first tab-1 defaultly..My doubt any URL problem?i tried all the ways .but no use.</p>
| javascript jquery asp.net | [3, 5, 9] |
4,290,020 | 4,290,021 | Max return parameter limit for HtmlPage.Window.Invoke method | <p>What could be the maximum limit of string values return from the following code?</p>
<p>is there is any limit on that application? </p>
<p>string o = (String)HtmlPage.Window.Invoke("CallMe", "data here!!");</p>
| javascript asp.net | [3, 9] |
2,906,435 | 2,906,436 | How to access a method by another method? | <p>I was watching thenewboston Android tutorials and I got lost in this line of code:</p>
<pre><code>getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
</code></pre>
<p>I think <code>getWindow()</code> and <code>setFlags()</code> are a method, but why they can be accessed like that? The one that I always see is <code>ClassObject.Method</code> but this time it's <code>Method.Method</code>.</p>
| java android | [1, 4] |
4,460,175 | 4,460,176 | Counting the number div loaded from external php file | <p>I have two php files, child.php and parent.php. Child.php generates div. Now, the parent.php calls child.php to be loaded in <code><div id='divContainer'></code>. Now, I need to count the div inside the divContainer. Is it possible?
I tried something like this: </p>
<pre><code>$(document).ready(function () {
var total_record = $('#divContainer > div').length;
alert(total_record);
});
</code></pre>
<p>But it's not working. Even an empty alert is not popping out.
Can someone here, help me on this? THank you!</p>
| javascript jquery | [3, 5] |
4,775,925 | 4,775,926 | Remove last line from string | <p>How do I remove the last line from a string, if I dont know how big the string will be?</p>
<pre><code>var tempHTML = content.document.body.innerHTML;
var HTMLWithoutLastLine = RemoveLastLine(tempHTML);
function RemoveLastLine(var x)
{
// code
}
</code></pre>
| javascript jquery | [3, 5] |
3,226,108 | 3,226,109 | Detecting referral url | <p>I can't detect referral url if user type url directly to browser or if he has some anti-virus or firewall which removes referral url. Is it possible to detect when user typed url directly in browser?</p>
| php asp.net | [2, 9] |
4,691,191 | 4,691,192 | Get the largest value from the array in JS or jQuery | <p>Using flow chart lib I’m plotting a graph. Below is the <code>x</code> and <code>y</code> coordinates of the graph as an array.</p>
<pre><code>var plottingPoints = [[0, 3], [4, 8], [8, 5], [9, 23], [10, 2]];
</code></pre>
<p>I just need to pick largest value of the <code>y</code> coordinate (ie 23). Please need support of expertise. </p>
| javascript jquery | [3, 5] |
2,758,261 | 2,758,262 | Android 2.3X kills Apps into the Background | <p>I always used Android 2.2 for my Apps. But currently I upgraded to Android 2.3.X Gingerbread. So if I start my App and go back to the android "desktop", the app is kill by 3-4 Minutes.</p>
<p>I think it will be killed after some minutes inactivity, but I need to run it in background to read some mobile status. </p>
<p>How can I set my App as a "Background" App, so that Android will not longer kill it?</p>
<p>Thanks for Help...</p>
<p>Regards, Rookee</p>
| java android | [1, 4] |
1,595,442 | 1,595,443 | Delay execution of jquery error function | <p>I use the error function below to hide external images which do not seem to load.
However images are hidden very easily and I think it is because the function executes to fast. Is there a way in Jquery to delay the function two seconds?</p>
<pre><code>$(".display li img").error(function () {
$(this).parent().parent().hide("fast");
pos3 = $(this).attr("id");
reportrefcam();
});
</code></pre>
| javascript jquery | [3, 5] |
1,817,930 | 1,817,931 | javascript alert not working if i use php redirect? | <p>i have code written something like this.</p>
<pre><code> if(!isset($cid))
{
echo "<script type=\"text/javascript\">alert('OOps, Something went wrong, please make sure you select country from the list')</script>";
header('Location:location-manager.php?view=countries');
exit;
}
</code></pre>
<p>the above code will only redirect the page and ignores the JS alert. if i remove header() then it alerts with JS alert box. what is wrong with my code? isn't it possible for me to alert the user with the error from JS alert and then redirect it to desired page?</p>
| php javascript | [2, 3] |
4,024,838 | 4,024,839 | How can I position an element next to user text selection? | <p>I need to position an absolute positioned button<br />
next to user's selected text. just like what IE8 does internally.</p>
<p>I'm binding a <strong>jquery event mouseup</strong> to the Document, and get<br/>
the selected text. but I'm currently out of ideas how to know where the<br/>
actual selection is positioned, without wrapping it in some element, <br />
because selection of text can be across several elements, and it would mess <br />
the structure if I would wrap it.</p>
| javascript jquery | [3, 5] |
2,378,383 | 2,378,384 | To get path name with url values in jquery | <p>This is an example URL.</p>
<pre>
http://stackoverflow.com/questions/ask?a=1&b=2
</pre>
<p><strong>question</strong>: I need to fetch path name along with url values like this<pre>/questions/ask?a=1&b=2</pre>
I need jquery or javascript solution</p>
| javascript jquery | [3, 5] |
616,128 | 616,129 | get uploaded image width & height for loding actual image size | <p>how i get uploaded image height and width,for display in it's original size.</p>
| php javascript | [2, 3] |
3,752,963 | 3,752,964 | dynamically display products in two columns | <p>I have a jsfiddle <a href="http://jsfiddle.net/K5PGp/" rel="nofollow">http://jsfiddle.net/K5PGp/</a> that I am trying to modify so that it displays the "products" in two columns even if the browser is IE 8.</p>
<p>For example, if all 8 products are displayed, it should look like this:</p>
<h2>one two</h2>
<h2>three four</h2>
<h2>five six</h2>
<h2>seven eight</h2>
<p>If only 1,3,5,7 are displayed, it should look like this:</p>
<h2>one three</h2>
<h2>five seven</h2>
<p>If only 2,4,6,8 are displayed, it should look like this:</p>
<h2>two four</h2>
<h2>six eight</h2>
| javascript jquery | [3, 5] |
2,196,329 | 2,196,330 | 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] |
1,756,750 | 1,756,751 | Click Once For All Elements In Same Class | <p>I am trying to write code that will add another row to a form automatically. It should only do this once for each form input with the class lastName.</p>
<p>The below code works. But it executes more than once. I want the code to only execute once for each form input with the class lastName. I am inexperienced with jquery and javascript, so I am unsure of how to approach this problem. </p>
<pre><code> function AutoAdd() {
$('.lastName').focus(function(e){
$('#add_new',pupils_form).parent().before(pupils_row);
AutoAdd();
});
};
AutoAdd();
</code></pre>
| javascript jquery | [3, 5] |
131,728 | 131,729 | How do I find what class of anchor tag has using javascript/jquery? | <p>I have HTML like this:</p>
<pre><code><div id="signbtn">
<a class="btnsignin" href="signin.php">Admin</a>
</div>
</code></pre>
<p>How do I find the class of the anchor tag embedded inside the <code>div</code> with <code>id="signbtn"</code>.</p>
<p>I need this to be able to assign a different class to the anchor tag only if has <code>"btnsignin"</code> class.</p>
| javascript jquery | [3, 5] |
2,643,603 | 2,643,604 | Clip text in C# after the third word | <p>I have a text(title) which has values like "Zesty Bean Bites South of the Border ". I need to add ... after the 3rd word in title .How can we achieve this ? i tried using Substring() method but it wont split by words ? </p>
| c# asp.net | [0, 9] |
4,343,745 | 4,343,746 | Count Number of days between 2 dates in javascript | <p>Please help me get the number of days between today's date and some other date.. Here is my <a href="http://jsfiddle.net/vQnHz/" rel="nofollow">example</a></p>
<p>It gives me <code>NaN</code></p>
<p>Here is what I came up with. My <a href="http://jsfiddle.net/vQnHz/3/" rel="nofollow">demo</a></p>
<pre><code>var cellvalue="2011-08-18 11:49:01.0 IST";
var firstDate = new Date();
var secondDate = cellvalue.substring(0, cellvalue.length-4);
alert(diffOf2Dates(firstDate,secondDate));
function diffOf2Dates(todaysDate,configDate)
{
/*var udate="2011-08-18 11:49:01.0";
var configDate=new Date(udate);*/
var oneDay = 24*60*60*1000; // hours*minutes*seconds*milliseconds
var firstDate = todaysDate; // Todays date
var secondDate = new Date(configDate);
var diffDays = Math.abs((firstDate.getTime() - secondDate.getTime())/(oneDay));
console.info(firstDate+", "+secondDate);
//console.info(Math.ceil(diffDays));
return Math.ceil(diffDays);
}
</code></pre>
| javascript jquery | [3, 5] |
4,564,509 | 4,564,510 | big Ajax problem .. can't figure it out | <p>Hy, </p>
<p>I have a live username validation using ajax :</p>
<pre><code><td id="user_process_live"><input type="text" id="user_live_ver" name="user" /></td>
</code></pre>
<p>abnd the following java :</p>
<pre><code> $("input#user_live_ver").blur(function() {
var username=$(this).val();
var dataString = 'username=' + username;
$.ajax({
type: "POST",
url: "ajax/login_ajax.php",
data: dataString,
cache: false,
success: function(html) {
$("td#user_process_live").html(html);
}
});
});
</code></pre>
<p>The <code>login_ajax.php</code> returns the same <code><input type=text id=user_live_ver name=user /></code> but with different styles applied (background-color and border-color) : red if username already exist and green if user does not exist ...</p>
<p>The problem is the script does this just one time .. just one <code>.blur()</code> ... </p>
<p>If i remove the <code>.ajax({ ... etc });</code> and insert <code>alert(dataString);</code> every time i click out that input the <code>alert()</code> is triggered but not the same for the <code>.ajax()</code> ...</p>
<p>What seems to be the problem ? Thanks a lot</p>
| php jquery | [2, 5] |
697,632 | 697,633 | Dynamically updating label text on textbox changes? | <p>I want to display the text entered in a textbox on a label character by character.</p>
<p>I.e, if I enter a character in textbox, I need to display that character in the label.
Up to the length of the textbox, this procedure has to done for the label also.</p>
<p>How can i achieve this?</p>
| c# asp.net javascript | [0, 9, 3] |
861,834 | 861,835 | jquery post on document ready | <p>All i want is, a data will pass into this php file: check.php and this php file will pass data into that function when the page is ready. this is just an expirement.</p>
<p>ok I have this code:</p>
<pre><code>$(document).ready(function() {
$.post("check.php", {
name: "log"
}, function(data) {
if (data === "yes") {
alert('has been login');
} else {
alert('has not login');
}
});
});
</code></pre>
<p>and i have this php code ("check.php") where the jquery post will pass the data into.
</p>
<pre><code><? //check
$chk = $_POST['name'];
if (isset($chk === "log")) {
if (isset($_COOKIE['admin'])) {
if ($_COOKIE['admin'] === "login") {
echo "yes";
}
} else {
echo "no";
}
} else {
echo "no";
}
?>
</code></pre>
<p>but nothing happen, even i change the whole code in check.php into: "echo "yes";" theres nothing happen, i guess, its either there is no data receive or there is no data pass. Hope someone could help me into this simple and cute problem that im stuck with. thank you in advance</p>
| php javascript jquery | [2, 3, 5] |
5,246,241 | 5,246,242 | How to access the values of a dropdownlist bound using jquery from server side | <p>I have created a cascading dropdownlist using jquery and a webservice in my asp.net website. I have changed the <strong>EnableEventValidation="false"</strong>. I am not getting the selected value which i am binding using jquery on save event.</p>
<p>This is the code I am using to select the value.</p>
<pre><code>int stateid = Convert.ToInt32(ddState.SelectedItem.Value);
</code></pre>
<p>neither I am getting <code>ddState.SelectedValue</code>. Both are returning blank.</p>
| jquery asp.net | [5, 9] |
3,482,194 | 3,482,195 | Change margin-top position of an fixed positioned element after reaching the bottom of the page? | <p>I need to change top-margin of an fixed div element from margin-top: 200px to margin top 0px after reaching the bottom of the page (or 200px from bottom) using vertical scrollbar.</p>
<p>And toggle return back if scrolling back to the top.</p>
<p>I guess some javascript/jQuery code code do that.</p>
<p>my html/layout code:</p>
<pre><code><div id="header" style="position: fixed; margin-top: 0px;">
Header content
</div>
<div id="main">
<div id="left" style="position: fixed; margin-top: 200px;">Google Ads here</div>
<div id="right">Content posts here</div>
</div>
<div id="footer">
Footer content
</div>
</code></pre>
<p><strong>EDIT: Here are some images to make my question more clear.</strong></p>
<ol>
<li><p>normal state when you load the page:
<img src="http://i.stack.imgur.com/DIbPl.png" alt="enter image description here"></p></li>
<li><p>problem when you scroll down, and the google ads column is in conflict with footer:
<img src="http://i.stack.imgur.com/nlhJ4.png" alt="enter image description here"></p></li>
<li><p>how it needs to be solved:
<img src="http://i.stack.imgur.com/In2sx.png" alt="enter image description here"></p></li>
</ol>
| javascript jquery | [3, 5] |
3,523,676 | 3,523,677 | Popup window unload issue | <p>I have one popup window, when user opens and closes popup window simultaneously, it is giving script error. Below code is used in popup window.</p>
<pre><code> <html>
<head>
<script src="../../StaticContent/Scripts/jquery-1.7.2.min.js"
type="text/javascript"></script>
<script src="../../StaticContent/Scripts/jquery-ui-1.8.20.custom.js"
type="text/javascript"></script>
<script type="text/javascript" language="javascript">
function CloseWarning() {
return "Do you want to close the window";
}
function onload()
{
}
</script></head>
<body onbeforeunload="return CloseWarning();" onload="onload();">
//Some html
<script type="text/javascript" language="javascript">
$(document).ready(
function() {
//Some code
});
</script>
</body>
</html>
</code></pre>
<p>I have tried degubbing, it is giving error at $(document).ready() line. I think because of closing the popup window before fully loading HTML is causing this problem. </p>
<p>Any clues???</p>
| javascript jquery | [3, 5] |
5,492,874 | 5,492,875 | why this is output as the following? | <pre><code>var obj = [ "one", "two", "three"];
$.each(obj, function() {
console.log(this);
});
</code></pre>
<p>The output I get is</p>
<pre><code>{ '0': 'o', '1': 'n', '2': 'e' }
{ '0': 't', '1': 'w', '2': 'o' }
{ '0': 't', '1': 'h', '2': 'r', '3': 'e', '4': 'e' }
</code></pre>
<p>I suppose to get "one" "two" "three", but I get the following weird results, anyone can explain?</p>
| javascript jquery | [3, 5] |
4,994,291 | 4,994,292 | How to determine size and position of span or relatively positioned element with Javascript/jQuery? | <p>For example, I want to draw submenu while its parent item is a <code><span></code> element. Can I determine the <code><span></code>'s dimensions and location on the fly?</p>
| javascript jquery | [3, 5] |
5,227,252 | 5,227,253 | Tiles layout (bin packing) | <p>Situation:
I have set of images. Each image has some level of priority. I want them to be distributed like this:</p>
<p><a href="http://appstouse.com/wp-content/uploads/2011/10/Grid-Size-File-Manager-Android12.png" rel="nofollow">http://appstouse.com/wp-content/uploads/2011/10/Grid-Size-File-Manager-Android12.png</a></p>
<p>or like this: <a href="http://caitsplate.me/wp-content/uploads/2012/04/PhotoGrid_1334763975360-11.jpeg" rel="nofollow">http://caitsplate.me/wp-content/uploads/2012/04/PhotoGrid_1334763975360-11.jpeg</a></p>
<p>Although, I'm not limited by screen height (can be scroll-able), and I don't really have specific sizes for images. The only condition is that images with higher priority must be displayed higher and be bigger than images with lower priority.</p>
<p>Is there any library/layout that can help me distribute images like this? Or maybe some algorithm?</p>
| java android | [1, 4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.