Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
5,761,064
5,761,065
Formatting text in dynamicaly created textboxes
<p>I have jquery that generates textareas with different id's. Now i need to make some buttons that will format text inside that textareas. For example: when user clicks in certain textarea, enter text, and click "bold" button, only text inside of that textarea will become bold (in other will be normal). I did manage to make something like this with JS, but it was too primitive (text was formated in all of textboxes) :( Here is some sample code for this:</p> <pre><code>&lt;button id="bold"&gt;B&lt;/button&gt; &lt;textarea id="ta_1"&gt;Some test text&lt;/textarea&gt; &lt;textarea id="ta_2"&gt;Some test text&lt;/textarea&gt; </code></pre> <p>What i want to say: one button, multiply text boxes. Entering text in ta_1 and clicking bold, should bold only text in that txtarea. Additional info: all id's starting with same word, just different number at the end.</p> <p>I feel there is some simple solution, just cant figure it out :D</p>
javascript jquery
[3, 5]
3,060,435
3,060,436
jquery checkbox checked state changed event
<p>I want an event to fire client side when a checkbox is checked / unchecked:</p> <pre><code>$('.checkbox').click (function(){ var thisCheck = $(this); if ( thischeck.is(':checked') ) { // Do stuff } }); </code></pre> <p>Basically I want it to happen for every checkbox on the page. Is this method of firing on the click and checking the state ok?</p> <p>I'm thinking there must be a cleaner jquery way. Anyone know a solution?</p>
javascript jquery
[3, 5]
1,063,297
1,063,298
Show/hide table row based on value of a cell
<p>I am using the range slider from JQuery-UI (http://jqueryui.com/slider/#range) which a user uses to pick a price range, and I want to show/hide table rows depending on whether or not they fall inside the range selected by the user.</p> <p>This is what I have found from other answers: the following code hides the table row that has a cell in column 9 containing the value 10. </p> <pre><code>$("tr").find("td:nth-child(9):contains(10)").parent().hide(); </code></pre> <p>What I am trying to do is "hide where the value in the cell is less than 10".</p> <p>I have tried the following:</p> <pre><code>$("tr").find("td:nth-child(9):lt(10)").parent().hide(); </code></pre> <p>But ":lt" is a method that applies to indexes, not values (I think).</p> <p>Can anyone help me out please?</p>
javascript jquery
[3, 5]
600,118
600,119
ASP.NET beginner question: Need help regarding using some class library
<p>My code:</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { String userHost = Request.UserHostName } </code></pre> <p>This is fetching the IP address alright, but now I want to know the country of the visitor and USE that country name to redirect the visitor to some webpage accordingly.</p> <p>I came across this library but have no clue how to use it in the project. Actually I do, but I am not sure so I am asking.</p> <p><a href="http://ipaddressextensions.codeplex.com/" rel="nofollow">http://ipaddressextensions.codeplex.com/</a></p> <p>When I download from the above the ZIP folder has a DLL file and an XML file. Now, what do I do with these two? Like include in the project. Then what do I type in the code file?</p> <p>Something like the following.</p> <pre><code>if (countryName=="France") { response.redirect("www.mysite.fr") } else if(countryName=="India") { response.redirect("www.mysite.in") } </code></pre> <p>and so on...</p> <p>How do I go about it? Also do I really need to type SO many <code>if</code> blocks for ALL the countries. How do I shorten this code?</p>
c# asp.net
[0, 9]
4,582,718
4,582,719
Correct Syntax to Include object data in jquery selector
<p>I'm trying to make a jquery selector as per the below code. However, my js is pretty poor and i'm not sure what the correct syntax is to use data.key as the value here (data.key should have a numeric value btw). I'd know how to do this in php! But not sure here :(</p> <pre><code>onClick: function(data) { if($(".myForm select option[value=data.key]").is(':selected')){ alert('foo'); } } </code></pre> <p>Any advice would be very gratefully received!</p> <p>Thanks!</p>
javascript jquery
[3, 5]
5,594,844
5,594,845
Reload when setTimeout function finishes
<p>I want to reload window after a this custom function finishes:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ setTimeout(function () { $('#order_form').dolPopupHide({}); }, 3000); //window.location.reload(); }); &lt;/script&gt; </code></pre> <p>Is there a way I can add the reload to the setTimeout function so it doesn't run until the timeout is over?</p>
javascript jquery
[3, 5]
2,373,684
2,373,685
Who passed the "args" to the main method?
<p>I tried to run a small c# and java program (using VS and NetBeans not from the command line) and print the value of the args[0] but I got an <code>IndexOutOfRangeException</code>.<br/> I know that the <code>args</code> is for passing in command line parameters but it is <strong>still</strong> in the main method any way, So how the program will run if there is no <code>args</code> parameter passed to it ?</p>
c# java
[0, 1]
6,031,707
6,031,708
fadeIn/fadeOut div tag after executing some server side code
<p>Here is my code</p> <pre><code>&lt;div id="AuthenticateUser" runat="server" style="display:block" &gt; //login control &lt;asp:button id="ValidateUser" ... /&gt; &lt;/div&gt; &lt;div id="ForceToChangePassword" runat="server" style="display:none" &gt; //reset password control &lt;/div&gt; </code></pre> <p>On click of "ValidateUser" button, I do check whether user is valid or not. Based on some condition I do need hide "AuthenticateUser" div tag and show "ForceToChangePassword" div tag.<br> I really like the jQuery fadeIn/fadeOut effect. I can easily do that on client side. But how can I give that effect after executing server side code?</p> <p>I tried to call javascript method from code behind that method has a fadeIn/fadeOut logic but it seems like that javaScript method is never been called.</p>
asp.net jquery
[9, 5]
186,703
186,704
How can I interact java program using python
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/9333637/how-to-execute-java-program-using-python-considering-inputs-and-outputs-both">How to execute java program using python considering inputs and outputs both </a> </p> </blockquote> <p>I want my python variable should receive all the output of java program and using that variable i will display the output on the screen. also if there is a input to java program, I want that user will enter the input which will be stored in my python variable and using this variable, I want to pass the input to java program.. What should I do?? Please help..</p>
java python
[1, 7]
358,250
358,251
Get jQuery slider values from DB
<p>I have a database with these tables</p> <pre><code>company ========== id | name | ========== 1 | C1 | 2 | C2 | 3 | C3 | position ================= id | level | name | ================== 1 | 1 | SE | 2 | 2 | SE1 | 3 | 3 | SE2 | 4 | 1 | SA | 5 | 2 | SA1 | 3 | 3 | SA2 | company_position ========== cid | pid | ========== 1 | 1 | 1 | 2 | 1 | 3 | 2 | 1 | 2 | 2 | 2 | 3 | 3 | 1 | 3 | 2 | 3 | 3 | </code></pre> <p>In the UI, I have a <code>&lt;select&gt;</code> for displaying Company names. There is a corresponsding slider that should display Position range. onChange on the <code>&lt;select&gt;</code>, I would like the slider the receive new values for range (min, max, name of Position instead of value). How do I go about solving this? jQuery getJSON? I am not looking for code, rather an approach!</p> <p><strong>UPDATE</strong> I realized that my problem is that I am unable to imagine the structure of JSON callback data.</p>
javascript jquery
[3, 5]
2,732,165
2,732,166
fire event on adding a character-jquery
<p>I want to reload a page when I type a character into a textbox and after reload, take cursor back to the textbox. It should not reload when I delete a character from the textbox.</p> <p>I was trying this but it doesn't work</p> <pre><code>$('#id_BasePairs').bind('input', function() { location.reload(); $('textbox').focus(); }); </code></pre> <p>How should it be done?</p>
javascript jquery
[3, 5]
4,067,056
4,067,057
Equivalent of PHP's 'array_splice' in java
<p>How can I implement <code>array_splice()</code> in java</p> <pre><code>$input = array("red", "green", "blue", "yellow"); array_splice($input, 2); // $input is now array("red", "green") </code></pre> <p><a href="http://php.net/array_splice" rel="nofollow">http://php.net/array_splice</a></p>
java php
[1, 2]
5,137,068
5,137,069
How can I use a JavaScript file in my ASP.NET project?
<p>I want to use a JavaScript file, lying in the root folder. How can I include that JS file?</p>
asp.net javascript
[9, 3]
678,941
678,942
Making a redistributable component or library for Android
<p>I'm just starting out on Android and Java programming, coming in from a C++ background. I was wondering - whats the best way to go about making a library/UI widget/component that I can license to third-party developers? </p> <p>In C++ I'd ship the customers my headers and *.a files, but I don't know the equivalent in Java.</p> <p>Are there any good resources or links about this, maybe even from general Java development standpoint.</p>
java android
[1, 4]
2,636,457
2,636,458
jQuery: mouseover makes image visible that has the same last 4 numbers in their id as the trigger
<p>I am currently working on a website and got stuck with the following problem: </p> <p>On the website I have small dots (images) with the ids "dot0001", "dot0002", "dot0003", etc. . I also have hidden images (visibility:hidden) with the ids "info0001", "info00002", "info0003", etc. </p> <p>I am looking for a jQuery solution. What I need is a code that allows the following events:</p> <p>When users move the mouse over "dot0001" the image "info0001" becomes visible and when they leave "dot0001", "info0001" becomes invisible again. Same applies to "dot0002"-"info0002" , "dot0003"-"info0003" etc. So only the info-images with the corresponding 4 digit number become visible. </p> <p>I gave it endless tries but got nowhere and there is not even a point in pasting my code.</p> <p>Any help appreciated! </p>
javascript jquery
[3, 5]
1,677,129
1,677,130
How to call custom jquery function onClick
<p>Hi. I am new to jQuery.. I want to know how to call custom jQuery function by onClick attribute of HTML. This was the basic I was trying.Further I want to make parametrised function and want to call that function onClick attribute.</p> <p>my jQuery function is:</p> <pre><code>jQuery.fn.myFadeIn=function() { return $('#fadeInDiv').fadeIn(); }; </code></pre> <p>and the HTML is:</p> <pre><code>&lt;input type="radio" name="contentCalls" class="radioButton" id="Calls" onclick="myFadeIn();"&gt; &lt;div id="fadeInDiv"&gt; div to open &lt;/div&gt; </code></pre> <p>Thanks!</p>
javascript jquery
[3, 5]
4,582,434
4,582,435
cursor not stopping until button click completes in window.onbeforeunload?
<p>I have below javascript code for window.onbeforeunload. I am calling code behind button click method when pressed browser back button. </p> <p>Now the problem is cursor is not stopping until <code>$("#buttonclientid").click()</code> completes. Just calling the method and moving to next statement. How to hold or stop cursor until <code>$("#buttonclientid").click()</code> complete and then move to next step?</p> <pre><code>var form_has_been_modified = 0; $(function () { $("input").keyup(function () { form_has_been_modified = 1; }) window.onbeforeunload = function (e) { if (!form_has_been_modified) { return; } doYouWantTo(); } }); function doYouWantTo(){ doIt=confirm('Do you want to save the data before leave the page?'); if (doIt) { var returnbutton; //cursor should stop here until click function completes. returnbutton = $("#buttonclientid").click(); } else{ } } </code></pre>
javascript jquery asp.net
[3, 5, 9]
4,190,062
4,190,063
How to clear a text box when clicked on it?
<p>I am using this JS to clear text box when user click on it, so this works fine and clears all the text box in the page, I want to clear only the search text box Search.. How can I do that, Other text box should not be cleared and only this search text box should be cleared when I click on it.</p> <pre><code> &lt;script type="text/javascript"&gt; $(function () { $('input[type=text]').focus(function () { $(this).val('') }); }); &lt;/script&gt; </code></pre> <p>And another question.</p> <p>I have a panel with few text box, how can i set focus on a particular text box</p> <pre><code> &lt;asp:TextBox ID="txt_Name" runat="server" /&gt; </code></pre>
c# javascript jquery asp.net
[0, 3, 5, 9]
443,601
443,602
Add to Array jQuery
<p>I know how to initliaize one but how do add I items to an Array? I heard it was <code>push()</code> maybe? I can't find it...</p>
javascript jquery
[3, 5]
1,056,484
1,056,485
javascript - Is there a way to grab these values with php?
<p>I have this JS code which works by using the <code>onclick</code> method and opens an image in a new window which is the exact size of the image.</p> <p>I adapted it from the BolGallery script. but the bolGallery script parses this in PHP and is able to get the the 'title','width' and 'height' values dynamically. and also the 'ImageFile' value. </p> <p>My question is, is there a way to get these with php?</p> <p>Im not very knowledgeable with JS </p> <pre><code>function GalleryPopup(imageFile, width, height, title){ var html = '&lt;title&gt;' + title + ' - Click to close &lt;/title&gt;&lt;body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onclick=\"javascript:window.close()\"&gt;&lt;img src=\"' + imageFile + '\" alt=\"Click to close\"&gt;&lt;/body&gt;'; var popup = window.open(imageFile, '_blank', 'width=' + width+ ', height=' + height + ', status=no'); popup.document.write(html); popup.focus(); } </code></pre> <p>alternatively, if you know of any other ways to achieve what i'm going for then feel free to tell me.</p> <p>For Instance i dont know what to set the variable like:</p> <pre><code>$imagetitle = </code></pre> <p>Would that work?</p> <p>i also have jQuery..</p>
php javascript jquery
[2, 3, 5]
2,200,218
2,200,219
Is it possible to use function of one php extension in other?
<p>I want to make a php C++ extension. Is it possible to use redis functions into my PHP C++ extension?</p>
php c++
[2, 6]
1,372,832
1,372,833
How much Java should I have learnt before trying Android programming?
<p>I have been seeking beginner learning books in Android, and of course found out that I should learn Java first. So I began studying Java and now I am quite comfortable with objects, classes, inheritance, interfaces, and just moved onto Layouts in Swing as well as Swing Features. But I am starting to wonder.... do I know enough about Java now? Can I start programming Android yet?</p> <p>Of course I can keep going in Java, but have been itching to begin programming Android apps. </p> <p>Any definitive answer here about how much Java I need to know before Android?</p> <p>Thanks so much!</p>
java android
[1, 4]
5,600,511
5,600,512
Trouble using findcontrol to find values from dynamic Literal Control
<p>I'm having problems with finding my controls in my dynamically created literal control. I want to be able to grab the value in the label with the <code>fnameID(x)</code> id.</p> <p>ASPX:</p> <pre><code>&lt;div&gt; &lt;asp:Panel ID="Panel1" runat="server"&gt; &lt;/asp:Panel&gt; &lt;/div&gt; &lt;asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /&gt; </code></pre> <p>CODE BEHIND:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { for (int i = 0; i &lt; 50; i++) { CheckBox _checkbox = new CheckBox(); _checkbox.ID = "dynamicCheckListBox" + Convert.ToString(i); Panel1.Controls.Add(_checkbox); Panel1.Controls.Add(new LiteralControl("&lt;Label id='fnameID" + i + "' &gt;test" + i + "&lt;/Label&gt;&lt;br/&gt;")); } } protected void Button1_Click(object sender, EventArgs e) { Label lbl = (Label)Panel1.FindControl("fnameID0"); Response.Write(lbl.Text); } </code></pre> <p>Currently I am getting the following error when I click on the button:</p> <pre><code>Object reference not set to an instance of an object. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. </code></pre> <p>Source Error:</p> <pre><code>{ Label lbl = (Label)Page.FindControl("fnameID0"); **Response.Write(lbl.Text);** } </code></pre>
c# asp.net
[0, 9]
4,142,104
4,142,105
Anyway to get an indexed item from $(".box")
<p>Suppose I get a list of items like <code>$(".box")</code>. Is it possible to get an indexed jQuery object </p> <p>like </p> <pre><code>var $boxes = $(".box"), $box2 = $boxes[1] </code></pre> <p>currently I do something like</p> <pre><code>var $boxes = $(".box"); $boxes.each(function(i, box) { var $box = $(box); // &lt;-- is this a good idea? // do something with $box }); </code></pre> <p>I wonder tho if the line <code>var $box = $(box)</code> is such a good idea? I am actually running that in a <code>setInterval()</code></p> <p>like</p> <pre><code>var $boxes = $(".box"); setInterval(function() { $boxes.each(function(i, box) { var $box = $(box); // &lt;-- is this a good idea? // do something with $box }); }, 1000); </code></pre> <p>I wonder if its bad for performance since I am initializing a variable for each item in <code>$boxes</code> per 1s in this example. If I can access the element directly from the jQuery "array" or whatever $boxes is, it maybe better?</p>
javascript jquery
[3, 5]
966,660
966,661
Passing a variable from Java class to another for Android
<p>Screen2.java file has the following code :</p> <pre><code>public class screen2 extends Activity { public int globalZip=0; //Some validations &amp; update globalZip //Code control goes to Screen3,java } </code></pre> <p>Screen3.java file has the following code :</p> <pre><code>public class Screen3 extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.screen3); screen2 objs2= new screen2(); int myzip = objs2.globalZip; Toast.makeText(getBaseContext(), "Screen3 "+myzip, 5).show(); System.out.println("WTHDude"+"Screen3 "+myzip); } </code></pre> <p>Now the problem i am having that if i have updated value of globalZip in Screen2.java file as 90034 it is not getting updated in the screen3. Can anyone help me with this error. Thank you. </p>
java android
[1, 4]
1,158,240
1,158,241
Show hidden tabs from slider
<p>I have a slider with more tabs then visible on the main page, so my idea is to put them in a ul set at overflow hidden. Once the last tab is active and you click next, the next tab is not displayed, the slide itself (on top) is displayed. </p> <p>What should happen once the last visible tab is active (current class) and click next, the next hidden tabs should be displayed. Basically you go from seeing tab 1 to 5.5 to tab 2 to 6.5.</p> <p>As you can also click a tab itself to display it's content, I would need 2 functions, one when clicking the arrows prev and next (when clicking prev the tabs should scroll back and clicking next the hidden one's should become visible).</p> <p>I've tried to make these 2 functions (see code below) but they are not working.. Any ideas, is this even possible?</p> <p>Demo: <a href="http://jsfiddle.net/epnDK/1/" rel="nofollow">http://jsfiddle.net/epnDK/1/</a></p> <ol> <li><p>The function when clicking next and prev arrows</p> <pre><code>$('.coda-nav-left, .coda-nav-right').click(function(e) { if (class == 'coda-nav-left') { $('.coda ul li').remove('.coda ul li:last'); } else { $('.coda ul li'). remove('.coda ul li:first'); } }); </code></pre></li> <li><p>Display the next tabs after the current one</p> <pre><code>function current() { var $current = $('.coda-nav ul li a.current'); if (current) { //show current in the center and 2 tabs before and after current } } </code></pre></li> </ol>
javascript jquery
[3, 5]
3,474,884
3,474,885
Save a MotionEvent for latter processing
<p>I'm starting with a 2D game.</p> <p>I followed the hints of the book "Beginning Android 4 Games Development", there the autor process each MotionEvent,transform the touch from the screen coordinates to the game coordinates, create its own "TouchEvent" and store it in a pool for being processed with the next UI refresh.</p> <p>The problem is that then I can't use the TouchEvent with an GestureDetector for example. So I'm considering o rewrite that part and make something like.</p> <pre><code>public boolean onTouch(View v, MotionEvent event) { MotionEvent gameEvent= MotionEvent.obtain(event); int x=tranformToGameCoords(event.getX()); int y=tranformToGameCoords(event.getY()); gameEvent.setLocation(x, y); addToBuffer(gameEvent); return true; } </code></pre> <p>And then for consuming the events:</p> <pre><code>while((event=getEventFromBuffer())!=null){ consume(event); event.recycle(); } </code></pre> <p>Is that approach correct? If not whats the best solution for that problem?</p>
java android
[1, 4]
4,174,979
4,174,980
How to call an action after click() in Jquery?
<p>I want to load an image and some other actions after I click a certain DOM element, but I want to load them AFTER the clicking action finished.</p> <p>Here is a code example:</p> <pre><code> $("#message_link").click(function(){ if (some_conditions...){ $("#header").append("&lt;div&gt;&lt;img alt=\"Loader\"src=\"/images/ajax-loader.gif\" /&gt;&lt;/div&gt;"); } }); </code></pre> <p>The problem is that the if condition executes before the click action have finished(Or at least that is my impression). I need that the If condition executes after the click action has finished. Can some one please tell me a solution?</p> <p>Thanks :)</p>
javascript jquery
[3, 5]
2,007,860
2,007,861
javascript split, each, check if exists in select if not add option
<p>Can anyone see what im doing wrong here?</p> <p>I am trying to split <code>tag_filter</code>, then for each of the <code>tag_filter</code> values, I would like to check if the option value already exists in <code>tag_select_dropdown_filter</code>. If it does not exist then add option to <code>tag_select_dropdown_filter</code>.</p> <pre><code>var tag_filter = new1,new2,new3; var arraylist = tag_filter.Split(","); jQuery.each(arraylist, function(index, item) { if ($('select#tag_select_dropdown_filter option[value="'+item+'"]').length) { // it exists } else { var o = new Option("option text", item); $(o).html("option text"); $("#tag_select_dropdown_filter").append(o); } }); </code></pre>
javascript jquery
[3, 5]
6,009,069
6,009,070
How do I include indicator images with <div> show/hide code in JavaScript?
<p>I'm using this code to hide and show <code>div</code>s:</p> <pre><code>$(function() { $('a.hide').click(function() { $(this).closest('.hideable').find('.hide-container').toggle(); }); $('a#hide-all').click(function() { $('.hide-container').hide(); }); $('.hide-container').hide(); }); </code></pre> <p>I have a problem: how can I add images such as a <code>+</code> mark when the <code>div</code> is hidden and a <code>-</code> mark when it is shown?</p>
javascript jquery
[3, 5]
4,701,572
4,701,573
Android Save Image and read
<p>Hı a have a bitmap(from byte array). I want to save that as PNG file in internal storage. </p> <p>Then I want load this image to webview ?</p> <p>How can ı do this ?</p>
java android
[1, 4]
3,241,220
3,241,221
Recording audio not to file on Android
<p>I want android.media.MediaRecorder. to record audio not into file, but into same variable, for example char[ ] or byte[ ] or some other datta buffer structure. I want to send it to the remote server via Wi-Fi, can android.media.MediaRecorder provide this functionality?</p>
java android
[1, 4]
4,525,996
4,525,997
How to execute code everytime url changes
<p>I'm making an ajax site. How would I go about executing some javascript every time the url changes. Say when "/#page/aboutus/" changes to "/#page/news/".</p> <p>I want users to be able to bookmark ajax-pages.</p>
javascript jquery
[3, 5]
4,337,735
4,337,736
How to develop application for Hide files in Android
<p>I am trying to develop application to <strong>HIDE</strong> files in Android.The files may be video or mp3 files.So please help me to solve this problem.</p>
java android
[1, 4]
1,735,543
1,735,544
Javascript/jQuery encoding for special characters when using val()
<p>I have a problem with special characters like &amp;, ä, etc. and their corresponding HTML encoded writing like <code>&amp;amp;</code>, <code>&amp;auml;</code> etc.</p> <ul> <li><p>When they are used in the value tag of input fields, the browser decodes it automatically, no problem at all.</p></li> <li><p>When using jQuerys val() function, the browser has no chance to evaluate the content correctly</p> <pre><code>$("button").click(function(){ $("#test").val("&amp;amp;"); }); </code></pre></li> </ul> <p>Any idea?</p>
javascript jquery
[3, 5]
2,085,067
2,085,068
Where does JQuery call setInterval for .fadeIn and .fadeOut()?
<p>Here is a <a href="http://james.padolsey.com/jquery/#v=1.6.2&amp;fn=jQuery.fn.fadeIn" rel="nofollow">source viewer</a> for fadeIn() but it does not link out to custom() for some reason.</p> <p>Also, as a second question, how does one conceptualize all this code...there are so many function calls that I can't even guess as to how much code actually runs when you call .fadeIn() or .fadeOut().</p> <p>For example:</p> <p><code>fadeIn()</code> calls <code>animate()</code> which calls <code>speed()</code> which calls <code>extend()</code>...</p> <p>As a third question: is this object oriented programming ?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
6,018,392
6,018,393
.focusout() only reading through first if() statement
<p>Why is this not reading through both if statements even though they are both true?</p> <p><strong>HTML</strong></p> <pre><code>&lt;textarea name="test"&gt; Focus out to test prompts &lt;/textarea&gt; </code></pre> <p><strong>jQuery</strong></p> <pre><code>var disableA = 1; var disableB = 1; $('textarea[name="test"]').focusout(function() { if (disableA == 1) { disableX(); } if (disableB == 1) { disableY(); } }); function disableX() { alert('A is disabled'); } function disabledY() { alert('B is disabled'); } </code></pre> <p>Right now it will call for <code>disableX();</code> but not <code>disableY()</code></p> <p><strong>jsFiddle:</strong> <a href="http://jsfiddle.net/nCQQm/" rel="nofollow">http://jsfiddle.net/nCQQm/</a></p>
javascript jquery
[3, 5]
2,352,066
2,352,067
Making a button element submit
<p>Using ASP.NET, how do I make this button tag submit my ASP.NET form when clicked:</p> <pre><code>&lt;button&gt;Submit&lt;/button&gt; </code></pre> <p>I'd like it to do a post back just like a regular asp.net server control button would work. I'd prefer a jquery way to do it if possible.</p>
c# jquery asp.net
[0, 5, 9]
291,316
291,317
Remove a span implemented in first toggle using second toggle
<p>I'm having trouble removing a span that is created on the first click in the toggle and removed on the second click of the toggle.</p> <pre><code>$(document).ready(function(){ $("td").toggle( function(){ var current = $("input[name=prices]:checked").val(); $(this).html("&lt;img src='images/1.gif'/&gt;"); $(".summary").append("&lt;br&gt;&lt;span class = 'newticket' id = 'null'&gt;"); $("#null").attr("id",$(this).attr("id")); $(".summary").append("1 x "); if(current == 'full'){ $(".summary").append("full price ticket."); } $(".summary").append(" Seat: "); $(".summary").append($(this).attr("id")); if(current == 'full'){ $(".summary").append(" Price: £10&lt;/span&gt;"); } }, function(){ $(this).html("&lt;img src='images/a.gif'/&gt;"); $("span#" + $(this).attr("id")).remove(); }); }); </code></pre> <p>If i click on the table value the span is added however if i click again on the table value the span is not removed.</p> <p>Any help would be appreciated.</p>
javascript jquery
[3, 5]
5,085,262
5,085,263
jquery - Get the occurrence of an element
<p>I have a div which contains 5 images.</p> <p>I want to write to a p tag every occurrence of the img</p> <pre><code>$("#myDiv img").each( function() { $("p").append($(this).length); }); </code></pre> <p>The above returns:</p> <p><code>11111</code></p> <p>What I want to return is:</p> <p><code>12345</code></p>
javascript jquery
[3, 5]
5,293,852
5,293,853
ASP.net web application data integrity issue
<p>Let say...</p> <p>If we ASP.net banking application. When user press a button then it will debit $100 from his account.</p> <p>Issue: What happened if user two or three times click on this button without waiting for first inform or it press F5/refresh page.</p> <p>How we can prevent or get data integrity.</p>
c# asp.net
[0, 9]
862,096
862,097
How to get jQuery infinitely repeat function?
<p>I currently have the following piece of code. When "true" is returned from tv.php the code seems to stop. How can I make this code check tv.php every 60 seconds, and repeat regardless of what TV.php returns? (I want the to refresh every time it detects "true", and keep checking every 60 seconds infinitely)</p> <pre><code>$(document).ready(function(){ setInterval(function() { $.ajax({ url: 'checktime.php', success: function(refresh){ if($.trim(refresh) == "true"){ $('#tv').load('tv.php'); } } }); }, 60000); }); </code></pre>
javascript jquery
[3, 5]
5,853,587
5,853,588
Javascript function that reassigns itself
<p>How do I keep <code>accordions</code> from being initialized when the page loads... I'd like it only to be run from inside of a method (other than <code>init()</code> of course) but only when needed</p> <pre><code>$.extend($.fn, { accordion: function () { var accordion = (function () { var accordions = (function () { alert('test'); return 1; })(); return { init: function (el) { el.click(function (e) { accordion.show(el); }); }, show: function (el) { console.log(accordions); } } })(); this.each(function() { accordion.init($(this)); }); } }); </code></pre> <p>I hope I've provided enough detail :-\</p>
javascript jquery
[3, 5]
3,800,670
3,800,671
Can malicious javascript code be injected trough $()?
<p>Example:</p> <pre><code>if($('#' + untrusted_js_code).length) &gt; 0 ....` </code></pre> <p>Normally "untrusted_js_code" should be a simple string representing the ID of an item. The value of the variable comes from an iframe (trough postMessage), this is why it's untrusted. And I'm just checking if that item exists in the current page, and only then do stuff with it.</p>
javascript jquery
[3, 5]
906,746
906,747
Tooltip Issue with jQuery
<p>I have this code</p> <pre><code>&lt;?php if(!empty($auction['Auc']['beginner'])){ ?&gt; &lt;a href="#" id="trigger_beginner"&gt;&lt;?= $html-&gt;image('badge/beginner_icon.png', array('width'=&gt;"30", 'height'=&gt;"30", 'border'=&gt;"0", 'alt'=&gt;"Beginner auction", 'title'=&gt;"Beginner auc"))?&gt;&lt;/a&gt; &lt;div class="tooltip"&gt; &lt;label&gt;Beginner&lt;/label&gt; &lt;label&gt;For an explanation &lt;a href="/pages/auct#beginner"&gt;please click here&lt;/a&gt;&lt;/label&gt; &lt;/div&gt; &lt;script&gt; $(function() { $("#trigger_beginner").tooltip(); }); &lt;/script&gt; &lt;?php } ?&gt; </code></pre> <p>Issue is when I have two auctions with same auction type for e.g like beginner in this case, then tooltip is only working for one auction. I want it to display tooltip on all similar auctions.. </p>
php javascript
[2, 3]
3,254,728
3,254,729
android: generate random number without repetition
<p>can anybody help me in making a method to generate random number without repetition in Android? The maximum number is: <code>prjcts.size();</code> it's my JSON Array. And the return value should be in integer. </p> <p>What I've already had is: <code>int i = (int)(prjcts.size() * Math.random());</code> I casted the method 3 times, because I need 3 random generated numbers. It works, but I don't know how to make it without repetition. So those 3 numbers won't be the same between each other.</p> <p>Thank you</p>
java android
[1, 4]
5,872,026
5,872,027
Buzzbox SDK For Android
<p>Can anyone tell me what kinds of information that Buzzbox collects off of devices? I am very interested in the SDK as it looks really convienient but I am very concerned about how much data will be skimmed by Buzzbox. Any input would be greatly appreciated.</p>
java android
[1, 4]
193,329
193,330
Get Entry from URL
<p>I am writing classic asp.net website and struggling with a problem. </p> <p>Usually in URL send data by doing this: localhost/MyrandomPage.aspx?UserName=RandomUsername</p> <p>But i am trying to make a page more personal so i want Url to look like this: </p> <p>localhost.com/Profile/RandomUsername</p> <p>And i am cant find a way how to retrive RandomUserName after slash in Url. </p> <p>ive done Routing:</p> <pre><code> public static void RegisterRoutes(RouteCollection routes) { routes.MapPageRoute("", "/Pages/{UserName}", "~/Pages/Profile.aspx"); } </code></pre> <p>But how do i retrive UserName??</p>
c# asp.net
[0, 9]
5,086,252
5,086,253
How to find the closest element to the current position with jQuery
<p>I have a document with several sections like this:</p> <pre><code>&lt;div class='section' id='sec1'&gt; lalala lalala lalala &lt;/div&gt; &lt;div class='section' id='sec2'&gt; lalala lalala lalala &lt;/div&gt; &lt;div class='section' id='sec3'&gt; lalala lalala lalala &lt;/div&gt; &lt;div class='section' id='sec4'&gt; lalala lalala lalala &lt;/div&gt; </code></pre> <p>How do I grab the closest <code>&lt;div.section&gt;</code> to the current scroll position (presumably, this would equate to the section that the reader is currently looking at)?</p>
javascript jquery
[3, 5]
263,157
263,158
Javascript/Jquery if statement and hasClass
<p>I have a bunch of images that have an opacity of 80%.<br> When I hover over the image, I use <code>mouseenter</code> and <code>fadeTo('fast' 1);</code> to make the opacity 100%.<br> When I hover away from the image, I use <code>mouseleave</code> and <code>fadeTo('fast' 0.8);</code> to get the opacity back to 80%.</p> <p>BUT, if the image I hover over has a specific class, I want the opacity to stay 100%, and not change to 80% on mouse leave.</p> <p>I tried but failed, I hope you guys can help me!</p> <pre><code>$(document).ready(function(){ var subject = 'null'; $('.subject').mouseenter(function(){ if ($(this).hasClass(subject) == false) { $(this).find('.info').fadeTo('fast', 1); $(this).find('img').fadeTo('fast', 1); } }); $('.subject').mouseleave(function(){ if ($(this).hasClass(subject) == false { $(this).find('.info').fadeTo('fast', 0); $(this).find('img').fadeTo('fast', 0.8); } }); $('.english-link').click(function(){ $('.english').find('.info').fadeTo('fast', 1); $('.english').find('img').fadeTo('fast', 1); var subject = 'english'; }); $('.math-link').click(function(){ $('.math').find('.info').fadeTo('fast', 1); $('.math').find('img').fadeTo('fast', 1); var subject = 'math'; }); $('.electives-link').click(function(){ $('.electives').find('.info').fadeTo('fast', 1); $('.electives').find('img').fadeTo('fast', 1); var subject = 'electives'; }); </code></pre> <p>});</p> <p><a href="http://jsfiddle.net/JDfpc/" rel="nofollow">http://jsfiddle.net/JDfpc/</a></p>
javascript jquery
[3, 5]
3,625,587
3,625,588
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]
5,421,080
5,421,081
Android, make scrollable view overflow to the left instead of right?
<p>I was recommended using a parent view to get horizontal scrolling right in my TextView:</p> <pre><code>&lt;HorizontalScrollView android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:scrollHorizontally="true" android:gravity="center|right" android:text="123456789"/&gt; &lt;/HorizontalScrollView&gt; </code></pre> <p>Horizontal scrolling works fine but it makes the content overflow to the right when it gets longer than it's parent's width:</p> <pre><code>------- |123456|7 ------- </code></pre> <p>However I'm working on a textview that holds numbers and since numbers are commonly aligned to the right I need the textview to overflow to the opposite side. (you should have to scroll left to see the beginning of the string).</p> <pre><code> ------ 1|4567| ------ </code></pre> <p>I have tried multiple combinations of gravity="right" and widths but I cannot manage to do it. How can I align the text to the right and make it overflow to the left?</p> <hr> <p>EDIT:</p> <p>I tried doing this when the user types:</p> <pre><code>calc.setText( newNumber ); HorizontalScrollView hsv = (HorizontalScrollView) findViewById(R.id.hsv); hsv.scrollTo(hsv.getRight(), hsv.getTop()); </code></pre> <p>This scrolls to the right every time the user types a number, however the latest number is always left out of the screen (it's like it scrolled and THEN added the number).</p>
java android
[1, 4]
3,488,081
3,488,082
Hiding/unhiding list elements with jQuery
<p>I'm attempting to create a "filterable" list of items. The user should be able to click on a list element (the parent), which would hide all other parent elements and show the "children".</p> <p>An example of the html is:</p> <pre><code>&lt;ul class='parent_list'&gt; &lt;li&gt;Parent 1&lt;/li&gt; &lt;ul class='child_list'&gt; &lt;li&gt;Child 1&lt;/li&gt; &lt;li&gt;Child 2&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;Parent 2&lt;/li&gt; &lt;ul class='child_list hidden'&gt; &lt;li&gt;Child 1&lt;/li&gt; &lt;li&gt;Child 2&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>My jQuery code is:</p> <pre><code>$('.parent_list li').click(function(){ $(this).siblings().addClass('hidden'); $(this).children().removeClass('hidden'); }); </code></pre> <p>Of course, you can probably tell by the javascript that I don't have too much experience with things like this. I've tried searching for a bunch of different examples on Google and haven't been able to get anything to work as of yet. Any tips?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
33,293
33,294
How do I select and unselect multiple elements with JavaScript or jQuery?
<p>I am working currently on some online editor and I would like to have there the posibility to select multiple elements (all this same class) while holding ctrl key - just like in most of the programs and then make some actions on them - eg. align.</p> <p>The second thing what I want to achive is to be able to deselect all when I click somewhere - if on element then all beside this, if outside all elements then all elements.</p> <p>I was trying to insert them into a table if they are clicked and then perform some action - only on objects from this table, but then I don't know how to make them be select only with ctrl button if there is any.</p> <p>I have also tried this function on clicking outside objects:</p> <pre><code>$('html').click(function(){ alert("Deselect"); }) </code></pre> <p>But it does't work either.</p> <p>So, does anyone know any other way to perform this actions?</p> <p>And here is an example of what I would like to achive (you have to click <code>Advanced Editing</code>) - I mean the align list in the right top corner of editor. Also there is deselection of object when you press outside one, and ctrl selection.</p> <p><a href="http://www.vistaprint.com/vp/ns/studio3.aspx?pf_id=064&amp;combo_id=120585&amp;free_studio_gallery=true&amp;referer=http://www.vistaprint.com/vp/ns/default.aspx?dr=1&amp;rd=2&amp;GPS=2357948912&amp;GNF=1&amp;GPLSID=&amp;rd=2#doc_id=2170662331" rel="nofollow">http://www.vistaprint.com</a></p> <p>Thank you for your help and ideas.</p>
javascript jquery
[3, 5]
3,355,545
3,355,546
Help to make a decision on which programming language
<p>We're developing a system which can be best described as a layer above social networking. It's extremely data heavy, would involve a huge user base, data base would be beefy basically, but it wouldn't involve complex computations. The most complexity would involve fast retrieval of data. Now, we have programmers who're comfortable with JAVA as well as PHP. The front end is nailed - Javascript, HTML, CSS. But we're having a huge debate on what to go with for the back end. We consulted numerous blogs and forums and have a consensus on the pluses and minuses. To sum it up, people say that it's a pain to host Java but it's extremely scalable, whereas PHP is fast and easy to host, but not entirely OO or sturdy. We're still not able to reach a decision. For a system like ours, does it even matter what we go with? Because at the end, it's the performance boosters that matter.... or am I entirely wrong in thinking that? Any input will be appreciated. Thanks in advance!</p>
java php
[1, 2]
3,527,252
3,527,253
Is it possibile to wait till all javascript files are loaded before executing javascript code?
<p>We have several javascript files which we load at the bottom of the master page. However, I have the situation that I need to perform some javascript before the other scripts are loaded. Is it possible to wait till all the javascript files are loaded and then execute some javascript code?</p> <p>I thought <code>$(document).ready()</code> did this, but as it turns out, it doesn't. Off course we can move the script files from the bottom to the top, but I am wondering if it possible what I want.</p>
javascript jquery
[3, 5]
4,226,706
4,226,707
Get result PHP code in jQuery function?
<p>I use codeigniter and i want make uniqid code with php as following code(by random_string()):</p> <pre><code>function coding(){ echo random_string('unique'); } </code></pre> <p>I want use result top function in a, jquery function (for use in js code), i in jquery code try as this, but this output in <code>alert(coding())</code> is "undefined". How can fix it?</p> <pre><code>function coding(){ $.ajax({ type: "POST", dataType: "text", url: "coding", cache: false, success: function (data) { return data; } }) } alert(coding()) // in here output is "undefined" !!!? </code></pre>
php javascript jquery
[2, 3, 5]
3,378,244
3,378,245
scrollheight of an element gives undefined value
<p>In an element i've given CSS, overflow:scroll; Now in jquery i want to have its original height (Containing all child element height). Children under this elements are dynamically changing. I want to have height on scroll event. Here is the code:</p> <pre><code>$("#container").scroll(function(e) { scrollAll(); }); function scrollAll(){ var elemHeight = $("#container").scrollHeight; var scrollHeight = $("#scrollbars").scrollHeight; var ratio = elemHeight / scrollHeight; $("#outup").html( elemHeight +" and "+ scrollHeight +" ratio "+ ratio +" = "+ ($("#container").scrollTop())); } </code></pre> <p>Issue: It throws scrollHeight as undefined. What's wrong?</p>
javascript jquery
[3, 5]
4,712,056
4,712,057
How to get location, I want to display a div at the location of the bottom left side of a table row
<p>I have a table with rows.</p> <p>I have the ID of the row I want to display a div block under when a button is clicked.</p> <p>How can I get the location?</p> <pre><code>&lt;table&gt; &lt;tr id="tr1"&gt; ... &lt;/tr&gt; &lt;tr&gt; ... &lt;/tr&gt; &lt;/table&gt; </code></pre> ... <p>So when a button is clicked, display the div d1 under the row with ID=tr1. I need the buttom left side of the row i.e. I want my div to start there and display below and to the right of that point.</p> <p>Oh and above any other element so it i.e. it should be the top most element z-index?</p>
javascript jquery
[3, 5]
3,349,307
3,349,308
KCFinder install
<p>Does anybody could help me with KCFinder installation?</p> <p>I downloaded KCFinder 2.51, on my htdocs folder "project" created dir "kdfinder" and I copied all to it. I configured config.php file, but what now? Ho do I know, I did it right? How can for example include it in my filemanager.php file?</p> <p>I've read a lot on the KCFinder page, but still can't install it.</p>
php javascript
[2, 3]
3,819,757
3,819,758
ASP.NET w/ C# SortedList
<p>How do I create a SortedList that holds multiple variables? I want to keep multiple instances of (date, height, weight).</p>
c# asp.net
[0, 9]
4,495,697
4,495,698
How can I stop jquery effects from cloning nearby elements during execution of effect?
<p>I have observed some strange behavior with a few jquery effects. The one that always exhibits the behavior that concerns me is slideUp(1000). My HTML is formatted similar to:</p> <pre><code>&lt;ul&gt; &lt;li&gt;Nav Element&lt;/li&gt; &lt;li&gt;Another...&lt;/li&gt; &lt;li&gt;...&lt;/li&gt; &lt;/ul&gt; &lt;div id="action_area"&gt; Stuff &lt;/div&gt; </code></pre> <p>Then my jquery call is:</p> <pre><code>$('#action_area').slideUp(1000); </code></pre> <p>When this call is executed the formatted navigation tabs appear to be cloned just above the "Stuff" in the action_area div during the time the slideUp effect is executing. This action area can be reopened and when it is the navigation tabs don't appear again. They only "appear" to be there when the slideUp function is being executed? Is this normal? If so then why? Is there a way to prevent this?</p>
javascript jquery
[3, 5]
3,732,086
3,732,087
Client side image resize and save
<p>is there a way to resize and save an image to a temp file through a web browser client side?</p> <p>What I am trying to accomplish is resize an image to a max 1024px wide/high, save it locally and then upload the resized image to a server.</p> <p>The reason is that I am building an online app that allows users to upload a maximum of 6 high res images upto 4mb each. Then when on the server I resize to 1024px wide/high which is actually only 200kb or so. This is a bit of a waste uploading 4mb only to be resized to a smaller file size so I am hoping there is a way to resize, save a temp file client side before uploading.</p> <p>Any help appreciated.</p>
php javascript jquery
[2, 3, 5]
498,761
498,762
Marshalling data for C#
<p>I have not many experience in such language as C# so I would be pleased if you guys could help me. I wrote this method in C++ using MPIR library:</p> <pre><code>mpz_class SchnorrProtocol::getX(const mpz_class&amp; r) const { mpz_class x; mpz_powm(x.get_mpz_t(), this-&gt;params_.getBeta().get_mpz_t(), r.get_mpz_t(), this-&gt;params_.getP().get_mpz_t()); return x; } </code></pre> <p>and now I want to import it to C#:</p> <pre><code> #region Filter &amp; P/Invoke #if DEBUG private const string DLL = "schnorrd.DLL"; #else private const string DLL = "schnorr.DLL"; #endif [DllImport(DLL)] "method definition" ...... SchnorrProtocol::getX(......); </code></pre> <p>my problem, I don't know how to do it. Could u please help me?</p>
c# c++
[0, 6]
5,562,528
5,562,529
howto sort a asp:Table?
<p>is it possible to simply sort a asp:Table by columns?</p>
c# asp.net
[0, 9]
3,193,101
3,193,102
Why is OnCreate() being called when the app is "quit", this causes my initiliazation code to run multiple times
<p>So this should be easy I am sure I am just missing something.</p> <p>in my OnCreate() method, I do most of my games initilization (oh by the way I am making a game!)... in OnCreate I create a Panel, which is a class that extends view, and is responsible for all displaying. In the constructor of this panel I update a few linkedlist with objects to display, these objects are moveable by me in the panel (I can click an object, click a new spot, and the object is moved there) That all works fine!</p> <p>Now if I hit the home button to leave my app, and come back, android remembers where I left my objects, and keeps them there! How kind of Android. However the problem occurs when I hit the back button to leave my application (Which I guess is more like killing it, which means OnCreate() is called the next time my app starts. (I know OnCreate() CAN be called if I just hit the home button, but only when the phone needs some space and kills my app) Anyways, when OnCreate is called again, Android so kindly remembers where the objects I moved are, but it does something else, it recalls all my initalization code, so there is duplicate objects, at the original location (aka now there is double the objects).. How do i fix this? I tried this,</p> <pre><code> if(savedInstanceState!=null) //see if android saved the state { super.onCreate(savedInstanceState); //reload the state } else{ super.onCreate(savedInstanceState); //I pass this savedinstancestate to OnCreate here even //though it is null, //because I do not know what else to pass //then i do the initilization crap all over again (because the savedinstancestate should have been //null and therefore it shouldnt display any saved data locations, // but.... YET IT DOES!!! } </code></pre> <p>Please help me with this! How do I either stop it from saving the state EVER and always let me load it how I want to or how do I make it so my init code is ONLY called when the game doesnt reload the state? Thank you!! </p>
java android
[1, 4]
550,408
550,409
Ways to overcome sending email delay in asp.net
<p>I added a comment box and each time the user add new comment im calling an Insert Handler to apply this into the DB. What i like here is the quickness things done.</p> <p>what i wanted to do now is to send each time a new comment inserted, WITHOUT DELAYS.</p> <p>so i added <strong>SmtpClient</strong> and send the mail using <strong>SendAsync</strong> on the same Insert Handler. that was not good enough for me, since even for the simplest email body ("hello world") it took it 5 seconds to repsonse!!! <strong>Maybe I need to add a new thread?</strong></p> <p>Is there any other way to overcome the delay of sending emails? I thought to create a new Handler, that will run <strong>onComplete</strong> of the Insert Handler, that will call another Handler that will do the sending mail on the background, and the user will not notice. The problem with this may be Spam, but re-calling the same Handler over and over again.</p>
c# asp.net
[0, 9]
4,064,639
4,064,640
What does this property do in a user control
<p>I have been trying to research information about this property but have not had luck finding a good explanation.</p> <p>What does the property of a user control "Mode" do? or what is it used for?</p> <pre><code> &lt;uc1:MyWebControl runat="server" ID="uxMyWebControl" Mode="10" Visible="false" /&gt; </code></pre> <p>Thank you for you help</p>
c# asp.net
[0, 9]
5,922,933
5,922,934
Call instances of custom object with different parameters
<p>I want to call an instance of a custom object twice with one parameter different, the problem is if I set its config property it changes accordingly if I create 2 instances, but if I don't specify the property when calling the second instance of the object, it inherits the set parameter from the first instance.</p> <p>I want the second instance to use the default parameter unless it is manually set when calling it.</p> <p>I tried making an elem variable and prepend it to queried elements but it didn't work.</p> <p>HTML:</p> <pre><code>&lt;div class="parent"&gt; &lt;div class="test"&gt;&lt;p&gt;test&lt;/p&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="parent-second"&gt; &lt;div class="test"&gt;&lt;p&gt;test&lt;/p&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>JS:</p> <pre><code>(function() { // Utility if ( typeof Object.create !== 'function' ) { Object.create = function( obj ) { function F() {}; F.prototype = obj; return new F(); }; } var objTest = { config: { value: 'some text' }, init: function(elem, config) { var self = this; this.elem = elem; $.extend(this.config, config); this.doIt(); }, doIt: function() { var self = this; $(self.elem + ' .test p').text(this.config.value); console.log($(self.elem + ' .test p')); } }; var parent = Object.create( objTest ); parent.init('.parent', { value: 'first div text' }); // if you comment out the value parameter from the following instance, it will inherit from previous object instance var parentSecond = Object.create( objTest ); parentSecond.init('.parent-second', { value: 'second div text' }); })(); // end self invoking function </code></pre>
javascript jquery
[3, 5]
2,755,080
2,755,081
append data is not showing? HELP!
<p>im trying to append data using jquery, but its only showing the status messages but not the button! although the button deos show on firebug?</p> <pre><code>$("form.follow-form").live('submit', function(e) { /* stop event */ e.preventDefault(); /* "on request" */ $(this).find('i').addClass('active'); /* send ajax request */ $.ajax({ type: "POST", url: "ajax_more.php", data: $(this).serialize(), cache: false, success: function(html) { $("ul.statuses").append(html); $("form.follow-form").remove(); // this is not full code ;) </code></pre> <p>this is ajax_more.php file:</p> <pre><code>$query= mysql_query($result) or die(mysql_error().$result); while($row=mysql_fetch_array($query)) { $dateTime = $row['dt']; //the append shows this echo formatUpdate($row['user_note'],$row['dt']); } ?&gt; // but not this form, it deos show on firebug only &lt;form class="follow-form" method="post" action="ajax_more.php"&gt; &lt;input name="date" value="&lt;?php echo $dateTime ?&gt;" type="hidden"&gt; &lt;button type="submit" value="Actions" class="btn follow" title="123456"&gt; &lt;i&gt;&lt;/i&gt;&lt;span&gt;More&lt;/span&gt; &lt;/button&gt; &lt;/form&gt; </code></pre>
php javascript jquery
[2, 3, 5]
2,414,985
2,414,986
Android When arriving from a particular Intent
<p>I have a class with two buttons. Depending on which one is clicked a different value is sent to the next intent. That intent has to work with the value sent in the bundle.</p> <p>The problem I am having is that the intent is also my home page and can be accessed via other classes. When these try to open it they are not setting the value in the bundle.</p> <p>Basically I need a way to find out if the user has come from a particular intent and perform different actions depending on if they have or have not.</p> <p>I tried to use this code below, but I am no expert in Java and unaware of the best way to implement this.</p> <p>Sorry for the confusing message.</p> <pre><code> String well =""; Intent i = getIntent(); Bundle bun = i.getExtras(); String standard = "yes"; if(bun.getString("WELL")==null){ well = "";} else {well = bun.getString("WELL");} if(well == standard){ buttonLogin(context); } </code></pre> <p>I keep getting a null pointer exception on the line</p> <pre><code> if(bun.getString("WELL")==null){ well = "";} </code></pre>
java android
[1, 4]
3,929,660
3,929,661
asp.net regular expression validator for decimal
<p>Am using the below expression to validate a textbox with decimal number. But it accept 12, -1.0,12.0,12.5,1.0 etc. But i want a regular expression like this "12.4". First two digit and decimal point and followed by a single digit. </p> <pre><code>ValidationExpression="^-?[0-9]{0,2}(\.[0-5]{1,1})?$|^-?(100)(\.[0]{1,2})?$" </code></pre>
c# asp.net
[0, 9]
4,011,114
4,011,115
calling a php from javascript as src file
<p>i have a question when a .php file called as a javascript what dose this mean? and when this is needed to be used ?</p> <p>ex:</p> <pre><code>&lt;head&gt; &lt;script src="dir/myphpfile.php" type="text/javascript"&gt;&lt;/script&gt; &lt;/head&gt; </code></pre>
php javascript
[2, 3]
3,783,169
3,783,170
Gridview losing row index value
<p>Iam having a gridview with textboxes in itemtemplate. If textbox validation fails whiling clicking the submit button gets into exception and loses its rowindex values. Based on the row index value iam setting theme for gridview rows. So when i click the row it throws null value exception. Help me to solve this. ( I dont wanna bind grid in catch block, since i have to maintain the values user entered in the textboxes)</p>
c# asp.net
[0, 9]
2,296,581
2,296,582
How can I send TCP requests from my phone?
<p>I have following task: to make Android application which connects to router, sends TCP requests for system and gets response. I have made Android application already which uses PHP web-services, but I never make application for TCP requests. Please, tell me, what means should I use for my task? Thank you.</p>
java android
[1, 4]
2,316,331
2,316,332
Javascript - dumping all global variables
<p>Is there a way in Javascript to get a list or dump the contents of all global variables declared by Javascript/jQuery script on a page? I am particularly interested in arrays. If I can get the array names, it will be enough to me. Seeing its values is a bonus.</p>
javascript jquery
[3, 5]
5,968,802
5,968,803
How to control mouse scroll default value javascript
<p>Hey guys How to control mouse middle button.. I want to override mouse wheel for example when I clicked wheel button..The browser is scrolling default value(I guess 112 ) but I want 200 </p> <p>How can I do that Sorry about my english</p>
javascript jquery
[3, 5]
3,879,839
3,879,840
How can I programmatically monitor the activity on an already opened serial port?
<p>Is there a library or code sample (preferably C# or Java, but not required) that allows to "sniff" what is happening on a serial port which is being used by another application? Like this software does:</p> <p><a href="http://www.eltima.com/products/serial-port-monitor/" rel="nofollow">http://www.eltima.com/products/serial-port-monitor/</a></p>
c# java
[0, 1]
2,336,596
2,336,597
Javascript, or Jquery and posting to php
<p>I want to send a javascript variable to a php file. What I would like to know is could you do it via this method?</p> <p>Jquery:</p> <pre><code>Var UserName; UserName = John; $.post("InsertRunInfo.php", { UserName: UserName } ); </code></pre> <p>Pass to php:</p> <pre><code>&lt;?php $con = mysql_connect("*****","*****",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("runtracker", $con); $sql="INSERT INTO userinfo (UserName) VALUES ('$_POST[UserName]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con); ?&gt; </code></pre>
php javascript jquery
[2, 3, 5]
2,989,220
2,989,221
Call Javascript function from codebehind on button click
<p>I want to execute a javascript function on a button click and if the result is a sucess only then the server side code should be executed on that button click.</p> <p>Below is what I am trying to do</p> <pre><code> protected void btnAdd_Click(object sender, EventArgs e) { if (btnAddItem.Text == "Add") { string script = string.Format(@"validate()"); ScriptManager.RegisterClientScriptBlock(this, typeof(Page), UniqueID, script, true); if (text1.text== null) { Addtogrid(); } </code></pre> <p>and below is my javascript function </p> <pre><code>function validate() { var arrTextBox = document.getElementsByTagName("input"); var retVal = 1; for (i = 0; i &lt; arrTextBox.length; i++) { if (arrTextBox[i].type == "text" &amp;&amp; arrTextBox[i].value == "") { retVal = 0; } } if (retVal == 0) { alert("Validation Failed"); return false; } else { alert("Validation Success"); return true; } } </code></pre> <p>I am not able to understand how to capture of the result of the javascript function . I am trying this for the first time. Kindly help me.</p>
javascript asp.net
[3, 9]
4,658,529
4,658,530
Create a link on the fly when a user enters a code in a form box
<p>I have a form....</p> <pre><code>&lt;form id="orderform" method="post" orderform="" name=""&gt; &lt;table width="533" cellspacing="0" cellpadding="2" border="0" id="ordertable"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;Product Code&lt;/td&gt; &lt;td&gt;Meterage&lt;/td&gt; &lt;td&gt;Sample Img&lt;/td&gt; &lt;/tr&gt; &lt;tr class="item"&gt; &lt;td class="prodcode"&gt;&lt;input type="text" id="prodcode" name="prodcode"&gt;&lt;/td&gt; &lt;td class="meterage"&gt;&lt;input type="text" id="meterage" name="meterage"&gt;&lt;/td&gt; &lt;td class="imgsample"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>What i would like is when a user clicks out of the box on the prodcode it searches a folder for the image reference...creates a link on under the imgsample header for that particular item using the prodCode they entered...</p> <p><a href="http://www.mylink.com/images/folder/sub-folder/imageref.jpg" rel="nofollow">http://www.mylink.com/images/folder/sub-folder/imageref.jpg</a></p> <p>Is this an impossible task, any ideas?</p>
php jquery
[2, 5]
5,990,161
5,990,162
PHP & Jquery - open a small div over others div when mouse go on a link
<p>i need to open a div (or somethings other, dunno what) when mouse go on a link. But this div doesnt move other div. It must open OVER the others div (like this website...when there are the "popup/error" div over others div. How can do it? Transparent? Or somethings like it?</p> <p>for example, if i write somethings into title field in a link statement, there is a small windows that show to me what i wrote. somethings like it, but with a div, or somethings other when i can put text, image, ecc.</p> <p>as another example, on facebook when i go on the main wall and i go with mouse on the name of the users, it show me a small windows with more details. the same when i open the chat box :)</p> <p>code :</p> <pre><code>&lt;div class="playerDetailsOff"&gt; Name : Marco&lt;br /&gt; Surname : Daghine &lt;/div&gt; &lt;a class="viewt" href="#" onmouseover="viewPlayerOn('id1?&gt;');return false" onmouseout="viewPlayerOff();return false"&gt;link 1&lt;/a&gt; &lt;a class="viewt" href="#" onmouseover="viewPlayerOn('id2?&gt;');return false" onmouseout="viewPlayerOff();return false"&gt;link 2&lt;/a&gt; &lt;a class="viewt" href="#" onmouseover="viewPlayerOn('id3?&gt;');return false" onmouseout="viewPlayerOff();return false"&gt;link 3&lt;/a&gt; &lt;a class="viewt" href="#" onmouseover="viewPlayerOn('id4?&gt;');return false" onmouseout="viewPlayerOff();return false"&gt;link 4&lt;/a&gt; function viewPlayerOn(val) { $('.playerDetailsOff').removeClass().addClass('playerDetailsOn'); } function viewPlayerOff() { $('.playerDetailsOn').removeClass().addClass('playerDetailsOff'); } .playerDetailsOn{width:200px; height:100px; position:fixed;} .playerDetailsOff{display:none;} </code></pre>
php jquery
[2, 5]
4,491,021
4,491,022
after mod-rewrite, all images file paths are not visible
<p>I want to add an url rewrite to a website and when I try to access the page it's loading with no images and css file. Here is my code:</p> <pre><code> &lt; rewriter&gt; &lt; rewrite url="~/item/(.+)/(.+)" to="~/item.aspx?imageId=$1&amp;amp;category=$2"/&gt; &lt; /rewriter&gt; and &lt; location path="~/item.aspx"&gt; &lt; system.web&gt; &lt; authorization&gt; &lt; allow users="*" /&gt; &lt; /authorization&gt; &lt; /system.web&gt; &lt; /location&gt; </code></pre> <p>but it seems it is not recognize the path. Does anyone what is wrong ?</p> <p>Thank you, Alina</p>
c# asp.net
[0, 9]
1,078,396
1,078,397
How can I cut the 1st char from a string in jquery?
<p>Does anyone know how can I cut the 1st char from the string in jquery?</p> <p>Example: If I have string as following:</p> <pre><code>var test = '3265'; </code></pre> <p>How can I cut only the 1st char so that the output will be '3' instead?</p>
javascript jquery
[3, 5]
1,812,281
1,812,282
whats wrong with this simple snippet (parsing string into array)?
<p>Assuming element with id 'id2' is a textarea with the following entries:</p> <p>[email protected], [email protected], [email protected]</p> <p>When I run this, I am getting values 0, 1 and 2 - why?</p> <pre><code>jQuery('#myid').submit(function() { var temp = jQuery('#id2').serializeArray(); var email_arr = temp[0].value.split(','); for (e in email_arr) alert(e); return false; }); </code></pre>
javascript jquery
[3, 5]
5,908,777
5,908,778
G722 Java or C++ impelementation
<p>I am developing a VoIP application and Need to know if there is any open-source implementation for G722 speech codecs. ?!</p>
java c++
[1, 6]
4,285,727
4,285,728
validate variable with javascript
<p>it is a code to submit several grades in one submission<br> this is the javascript code fore validation</p> <pre><code>function validateForm() { var x='&lt;?php echo ($grade);?&gt;'; if (x&gt;100) { alert("Invalid Data Entry"); return false; } </code></pre> <p>it is not accessing the variable grade in the third echo down </p> <pre><code>&lt;form name="form1" method="post" action="insertgradeac.php"onsubmit="return validateForm()" method="post"&gt; &lt;?php $con = mysql_connect($server, $username, $password); mysql_select_db($database); $query_fetch5 = "SELECT ass_class FROM assess WHERE ass_ID LIKE '$id'"; $result_fetch5 = mysql_query($query_fetch5); $row5 = mysql_fetch_row($result_fetch5); $row5_0 = $row5[0]; $query_fetch = "SELECT st_ID, st_name FROM student WHERE class_ID LIKE '$row5_0'"; $result_fetch = mysql_query($query_fetch); while ($row = mysql_fetch_row($result_fetch)) { echo "&lt;tr&gt;\n"; echo "&lt;td&gt;$row[0]&lt;input type=\"hidden\" name=\"stt_ID[]\" value=\"$row[0]\" /&gt;&lt;/td&gt;\n"; echo "&lt;td&gt;$row[1]&lt;input type=\"hidden\" name=\"student[]\" value=\"$row[1]\" /&gt;&lt;/td&gt;\n"; echo "&lt;td&gt;&lt;input type=\"text\" name=\"grade[]\" /&gt;&lt;/td&gt;\n"; echo "&lt;/tr&gt;\n"; } mysql_close($con); ?&gt; </code></pre>
php javascript
[2, 3]
510,982
510,983
Adding Sliding Effect to Counter
<p>I currently have a javascript counter which looks something like this towards the output.</p> <pre><code>out= "&lt;div id='days'&gt;&lt;span&gt;"+ days +"&lt;/span&gt;&lt;/div&gt;" + "&lt;div id='hours'&gt;&lt;span&gt;" + hours +"&lt;/span&gt;&lt;&lt;/div&gt;" + "&lt;div id='mins'&gt;&lt;span&gt;" + mins +"&lt;/span&gt;&lt;/div&gt;" + "&lt;div id='secs'&gt;&lt;span&gt;" + secs +"&lt;/span&gt;&lt;/div&gt;" ; document.getElementById('countbox').innerHTML=out; setTimeout("GetCount()", 1000); </code></pre> <p>I was wondering what the method would be to use some jQuery for effects such as <code>.fadeOut()</code></p>
javascript jquery
[3, 5]
3,929,090
3,929,091
show message when like button is clicked?
<p>I am using the following code to alert the user when he click the facebook like button. It is alerting the user only on Opera browser. How do I fix this problem and make it work with all browsers ?</p> <pre><code>&lt;script&gt; FB.Event.subscribe('edge.create', function(response) { alert("You liked the URL"); } ); &lt;/script&gt; </code></pre> <p>I can also use Jquery.</p>
javascript jquery
[3, 5]
5,163,214
5,163,215
jQuery's after method not working with newly created elements
<p>Insofar as I can tell, the following code should work, creating a <code>&lt;div&gt;</code> element, and then creating a <code>&lt;p&gt;</code> element; the expression should result in a jQuery object with two elements:</p> <pre><code>$("&lt;div&gt;first element's content&lt;/div&gt;").after("&lt;p&gt;second element's content&lt;/p&gt;"); </code></pre> <p>However, what I get is very different. <a href="http://api.jquery.com/after/" rel="nofollow">The documentation</a> (see the heading "Inserting Disconnected DOM Nodes") tells me the above code should result in a jQuery object, grabbing both HTML snippets and building the two DOM elements. But, what I've gotten, in several different versions of jQuery, all above 1.4, is a jQuery object with only 1 node. However, the following code works just fine, returning (what I believe is) the correct jQuery object, two elements inside:</p> <pre><code>$("&lt;div&gt;&lt;/div&gt;").after("&lt;p&gt;second element's content&lt;/p&gt;"); </code></pre> <p>And this example works as well:</p> <pre><code>$("&lt;div&gt;&lt;/div&gt;").after("&lt;p&gt;second element's content&lt;/p&gt;").after("&lt;p&gt;third element's content&lt;/p&gt;"); </code></pre> <p>It seems the <code>.after()</code> method works fine if the first DOM node being created is empty, but does not when it is not (irrespective of the contents of subsequent DOM nodes being appended to it).</p> <p>Am I missing something about jQuery's internals, quirky DOM issues and/or JavaScript peculiarities, or is this simply a jQuery bug that's persisted from version 1.4 on through 1.7?</p> <p>(<a href="http://jsfiddle.net/paulbruno/pT3GQ/" rel="nofollow">Here's a meager JSFiddle</a> demonstrating the issue pretty plainly.)</p>
javascript jquery
[3, 5]
2,656,785
2,656,786
Is it possible to base 36 encode with JavaScript / jQuery?
<p>I'm thinking about using the encode/decode technique here (Encoding to base 36/decoding from base 36 is simple in Ruby)</p> <p><a href="http://stackoverflow.com/questions/6338870/how-to-implement-a-short-url-like-urls-in-twitter">how to implement a short url like urls in twitter?</a></p> <p>Idea being to track user referrals, invite URLs. I can use Rails to decode, but it there a way to encode with Javascript or jQuery?</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,696,272
3,696,273
Error while passing series of numbers as a parameter to a JavaScript function in PHP
<p>Here's my PHP code - </p> <pre><code>for ($i=1;$i&lt;=10;$i++) { $numbers .= $i."\n"; } echo "&lt;input type='button' onclick=ShowNumbers('$numbers') value='Show Numbers'&gt;"; </code></pre> <p>And my Javascript code - </p> <pre><code>function ShowNumbers(numbers) { alert("Numbers:: "+numbers); } </code></pre> <p>But when I click on the button <strong>Show Numbers</strong>, nothing happens. Whats going wrong ?</p> <p>When in FireBug I check the button element it shows - </p> <pre><code>&lt;input type="button" value="Show Numbers" ');="" 10="" 9="" 8="" 7="" 6="" 5="" 4="" 3="" 2="" onclick="ShowNumbers('1"&gt; </code></pre> <p>may be thats where the problem lies. How do I get it in right format?</p>
php javascript
[2, 3]
1,336,157
1,336,158
javascript show hide div
<p>how to do show and hide div in javascript and simillarly in c# pageload how to call div based on id value.can any one help on this ?</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href="#cat1"&gt;cat1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#cat2"&gt;cat2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#cat3"&gt;cat3&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div id="cat1"&gt; &lt;asp:UpdatePanel&gt; &lt;asp:Panel&gt; &lt;asp:ListView&gt; &lt;/asp:ListView&gt; &lt;/asp:Panel&gt; &lt;/asp:UpdatePanel&gt; &lt;/div&gt; &lt;div id="cat2"&gt; &lt;asp:UpdatePanel&gt; &lt;asp:Panel&gt; &lt;asp:ListView&gt; &lt;/asp:ListView&gt; &lt;/asp:Panel&gt; &lt;/asp:UpdatePanel&gt; &lt;/div&gt; &lt;div id="cat3"&gt; &lt;asp:UpdatePanel&gt; &lt;asp:Panel&gt; &lt;asp:ListView&gt; &lt;/asp:ListView&gt; &lt;/asp:Panel&gt; &lt;/asp:UpdatePanel&gt; &lt;/div&gt; </code></pre>
c# javascript asp.net
[0, 3, 9]
4,982,802
4,982,803
Base64 Encode - Decode Python and ASP.Net?
<p>i m trying encode data on python with "base64.encodestring()" then i send encodedData to my asp.net service and trying decode this data.But this data is invalid.</p> <p>Python function code () : </p> <pre><code>randomString=''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(10)) fileNameString=randomString+"_"+request.vars['file'].filename pathToFile="/tmp/"+fileNameString f = open(pathToFile,"wb") f.write(request.vars["file"].file.read()) f.close() f = open(pathToFile,"rb") data=f.read() f.close() encodedData=base64.encodestring(data) return encodedData </code></pre> <p>C# Code:</p> <pre><code>byte[] filebytes = Convert.FromBase64String(encodedData); FileStream fs = new FileStream(crmPath + fileName, FileMode.CreateNew, FileAccess.Write, FileShare.None); fs.Write(filebytes, 0, filebytes.Length); fs.Close(); </code></pre> <p>this codes works towards save file but when i try to open this file it isnt opened</p>
c# asp.net python
[0, 9, 7]
5,419,206
5,419,207
Java locale annotation - C# culture attribute
<p>In C# I have the following attribute above a method:</p> <pre><code>[Test, SetCulture("en-GB")] </code></pre> <p>which, I assume, means that whatever happens inside this test method (e.g. number parsing) will obey the rules of the en-GB culture.</p> <p>Is there any way to do the same thing in Java? Have some annotation that indicates the Locale applicable to a method? I'd really hate to have an extra parameter that gets passed everywhere.</p>
c# java
[0, 1]
1,678,057
1,678,058
Javascript getJSON not working (Possibly Cross Domain)
<p>Im getting a JSON from a server, and when I type the url into the browser, I can see the JSON data. And when I use curl to get the JSON I can also see the data. But when I try to use a html page locally to access the data i get an error. I've tried using </p> <pre><code>$.support.cors = true; </code></pre> <p>but I still get an error, is there anyway I can solve this possible cross domain problem?</p> <p>Thanks, Matt</p>
javascript jquery
[3, 5]
1,094,995
1,094,996
Closing exe and running from memory
<p>Since exe is an archive, I want my program to be able to save stuff to it's own exe file. Unfortunately, Windows keeps the file open while it's running. I'd like to find a way in Python and/or C++ to force the program to run from memory and have the file close.</p>
c++ python
[6, 7]
4,176,202
4,176,203
Navigation and Update record in mysql database with html form
<p>I am new in php and I want to make navigation buttons Next, Previous, Top, Bottom in html form which retrieves data from mysql database in php. And I also want to edit, delete buttons on html form. Please help in this regards.</p>
php javascript
[2, 3]
4,745,759
4,745,760
How to pop out <select> list via button?
<p>I want to know how to pop out the native list using either jQuery or just plain JavaScript. I'm currently working on a mobile website and instead of having the users click on the object, the will click on a button instead and the list should pop out. The object will be hidden too.</p> <p>How do I go about doing this?</p>
javascript android jquery
[3, 4, 5]
3,226,241
3,226,242
how to make system tray alert using php or jquery or java?
<p>I am writing a program which requires to alert the user when a particular event occurs, it can be a balloon tip, or system tray alert like skype, or antivirus alert? </p>
php javascript jquery
[2, 3, 5]