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 |
---|---|---|---|---|---|
163,560 | 163,561 | Get button name inside javascript function | <p>I have a html button with runat=server tag, whoose Name has been set dynamically during run time.</p>
<pre><code> protected void Page_Load(object sender, EventArgs e)
{
btnShowHideCols.Name = "some text here";
}
</code></pre>
<p>the button HTML code is like below.</p>
<pre><code> <input id="btnShowHideCols" type="button" value="+/-" runat="server" onclick="return btnShowHideCols_onclick()" />
</code></pre>
<p>How Do I get the button name form inside the javascript function? can I get the sender of the event there?</p>
| javascript asp.net | [3, 9] |
3,303,734 | 3,303,735 | JavaScript One line problem | <p>This code works:</p>
<pre><code>$('[id$=lbl]').val() == "0" ? alert('Bla') : null;
</code></pre>
<p>but this codes don't:</p>
<pre><code>$('[id$=lbl]').val() == "0" ? function(){alert('Bla'); return false; } : null;
$('[id$=lbl]').val() == "0" ? alert('Bla');return false; : null;
$('[id$=lbl]').val() == "0" ? return false : null;
</code></pre>
<p>i need "alert" after "return false"</p>
<p>How can I do that ?</p>
| javascript jquery | [3, 5] |
1,049,899 | 1,049,900 | What is the equivalent of CPython string concatenation, in C++? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/13013442/simple-string-concatenation">Simple string concatenation</a> </p>
</blockquote>
<p>Yesterday, as I'm writing this, someone asked on SO</p>
<blockquote>
<p>if i have a string <code>x='wow'</code>
applying the function <code>add</code> in python :</p>
<pre><code>x='wow'
x.add(x)
'wowwow'
</code></pre>
<p>how can i do that in C++?</p>
</blockquote>
<p>With <code>add</code> (which is non-existent) corrected to <strong><code>__add__</code></strong> (a standard
method) this is a deep and interesting question, involving both subtle low
level details, high level algorithm complexity considerations, and
even threading!, and yet it’s formulated in a very short and concise way.</p>
<p>I am reposting
<a href="http://stackoverflow.com/questions/13013442/simple-string-concatenation">the original question</a>
as my own because I did not get a chance to provide a correct
answer before it was deleted, and my efforts at having the original question revived, so
that I could help to increase the general understanding of these issues, failed.</p>
<p>I have changed the original title “select python or C++” to …</p>
<ul>
<li>What is the equivalent of CPython string concatenation, in C++?</li>
</ul>
<p>thereby narrowing the question a little.</p>
| c++ python | [6, 7] |
180,239 | 180,240 | .mousemove and memory, do I need to optimize this or not? | <p>I've created a simple demo of a light-test-thing here: <a href="http://jsfiddle.net/CGr9d/">http://jsfiddle.net/CGr9d/</a></p>
<p>When I record the memory usage using the Chrome dev tools I get this: <a href="http://cl.ly/LSDl">http://cl.ly/LSDl</a>, it basically go up until a certain point and then go down again and start over until it reaches the previous high point again.</p>
<p>is this normal/OK?
Is there any way to optimize my code to make it less memory intensive?</p>
<p>This is my mousemove function:</p>
<pre><code>$('body').mousemove(function(e) {
//2000 is half the image width/height, of course used for centering
$('.light-circle').css({ backgroundPosition: (e.pageX-2000)+'px '+(e.pageY-2000)+'px' });
});
</code></pre>
<p>Thanks.</p>
| javascript jquery | [3, 5] |
4,625,844 | 4,625,845 | How do I open an Excel file in a web browser for editing? | <p>How to open Excel sheet in iframe window, after editing that excel sheet will be saved into Server.</p>
| c# asp.net | [0, 9] |
931,023 | 931,024 | How to update controls with generic handlers | <p>I have a master page containing child page with user controls on it. I'm showing some values coming from database on those user controls. I need to update the page after a fixed interval; so that changed values will be reflected on the page. But the whole page gets refreshed every time.</p>
<p>I'm new to generic handlers.I've written the code to bring the data in the code behind file. Somebody said that I can get data with generic handler & update the controls in aspx page. Is it possible?</p>
| c# asp.net | [0, 9] |
3,222,936 | 3,222,937 | Android: Set Default soft keyboard | <p>I have created a softkeyboard application. I would like to set it as my default soft keyboard while installing. Is it possible to add code in my softkeyboard application coding to set this keyboard as default keyboard while installing? </p>
| java android | [1, 4] |
2,697,861 | 2,697,862 | Expose method as a property in user control | <p>I created user control for textbox with autocompleteextender, and its working fine, but now i wanted to expose methods in user control to aspx page as a one of the property in user control,like in button control having onClientClick event.
and forgive my English.</p>
| c# javascript jquery asp.net | [0, 3, 5, 9] |
3,862,996 | 3,862,997 | set or select the text of dropdownlist to the text : select here or any other text | <p>I want to set/select the text baed upon the texts I choose. e.g I have the following code that is not selecting the text but instead is adding another line to the option.</p>
<p>I have a dropdownlist with the following:</p>
<pre><code><select id="fruit"> <option value="">select here</option> <option value="1">apple</option> <option value="2">pineapple</option> <option value="3">orange</option><select>
$("#myList option:selected").text("pineapple");
$("#myList option:selected").text("select here");
</code></pre>
<p>How can I select the option based upon the text?</p>
| javascript jquery | [3, 5] |
3,703,408 | 3,703,409 | using javascript function to initialize php variable | <p>hi i want to initialize php variable in javascript function and than call the php function with php initialized variable. Please help me for solving this problem... </p>
<pre><code> <?php
function printDiv($abc) {
echo '<div align="center" width="100%"> ' . $abc . ' </div>';
}
?>
<script type="text/javascript">
function callPhpFunction(jsabc) {
<?php $abc ?> = jsabc;
document.write("<?php printDiv($abc) ?>");
}
</script>
</code></pre>
| php javascript | [2, 3] |
1,969,229 | 1,969,230 | Accessing aspx value from an user control | <p>H,</p>
<p>My aspx page has a usercontrol where the usercontrol contains a button. Onclick of button in usercontrol i am trying to fire javascript method. So when I click on button on to execute the javascript somehow i want to access the textbox value from the aspx page.</p>
<p>something like </p>
<p><code>this.getElementbyID[txtbox].value</code>. </p>
<p>Is it possible? or is there any other way to access control of aspx page from usercontrol.</p>
<p>Thanks in advance,
Pavan</p>
| javascript asp.net | [3, 9] |
5,237,496 | 5,237,497 | Determining the background-color or color in numeric format across browsers | <p>I have been through a number of responses to similar questions. I just want to clarify if I am understanding correctly. My purpose is to do some colour calculations.</p>
<p>I have been working in fire fox where:</p>
<pre><code>var bkg_Colour = $("#test_Box_1").css("background-color"); // is red
var fgd_Colour = $("#test_Box_2").css("background-color"); // is blue
</code></pre>
<p>returns rgb(255, 0, 0) and rgb(0, 0, 255) respectively.</p>
<p>Which is fine and I have calculated the distance between the foreground and background appropriately by splitting out the tuples and comparing them.</p>
<p><strong>BUT:</strong></p>
<p>In internet explorer this same code returns "red" and "blue" and of course the calculation fails.</p>
<p>Form the previous answers it appears that there isn't a consistent way of getting the colour back (whether background-color or color) in a numeric format - if using $(...).css. And it appears that all sorts of hoops have to jumped through to cover all the bases.</p>
<p>So is there a way of doing this without using $(...).css?</p>
<p><strong>Edit</strong></p>
<p>Just following this up when I apply the example code given <a href="http://api.jquery.com/css/" rel="nofollow">here</a> in my script and I run it in FF I get rgb(255,0,0) when I run it in IE i see the word "red" in result. <strong>BUT</strong>
when I run the above link in IE result is rgb(xxx,xx,xx) I am therefore very confused. Is there a server setting or something that is causing IE to behave this way on the page I am serving??</p>
<p><strong>Edit</strong></p>
<p>As far as I can tell at the moment in IE it reports back the colour as specified in the css, namely "green" "blue" "red" or #808080 etc. whereas in ff it always reports it back as a rgb value.</p>
| javascript jquery | [3, 5] |
1,763,507 | 1,763,508 | Arrow animation in jquery | <p>Is it possible to make an animation of this picture[1] to this picture[2] in jquery?. I would like to get "a growing arrow effect". I must admit that after some searching i found nothing and simple </p>
<p><code>$('#img').animate({width: '109px',height: '109px'});</code> </p>
<p>is not enough effect for me. Maybe you guys have some clues or tips to achieve that kind of effect.</p>
<p>[1] <a href="http://img543.imageshack.us/i/arrowmb.png/" rel="nofollow">http://img543.imageshack.us/i/arrowmb.png/</a></p>
<p>[2] <a href="http://img687.imageshack.us/i/pngqa.png/" rel="nofollow">http://img687.imageshack.us/i/pngqa.png/</a></p>
| javascript jquery | [3, 5] |
2,725,445 | 2,725,446 | Unable to evaluate expression because the code is optimized or a native frame is on top of call stack | <p>I am working on a website where user comes and submits some information. After the information is submitted I am trying to send two mails simultaneously - one to my sales team and one to the visitor on my website.</p>
<p>While the mails are getting sent I am getting the following error while redirecting to another page using <code>Response.Redirect("http://www.targetsite.com/index.php")</code>:</p>
<blockquote>
<p>Unable to evaluate expression because the code is optimized or a
native frame is on top of call stack</p>
</blockquote>
<p>Can anybody help me with this issue? Thanks in advance.</p>
| c# asp.net | [0, 9] |
2,276,721 | 2,276,722 | passing arguments to click or submit function | <p>Is it possible to pass arguments to click or submit function like :</p>
<pre><code>$("#example").click(function()
{
var myVar = x; // refering to x as passed argument
});
</code></pre>
<p>Maybe function inside a function ? </p>
<pre><code>function Func(){
$("#example").click(function()
{
var myVar = x;
});
}
</code></pre>
<p>Maybe something like calling <code>Func()('33');</code> will this pass the 33 to the click function, is it possible after all?</p>
| javascript jquery | [3, 5] |
2,049,337 | 2,049,338 | Can I process the JSON result with a new script? | <p>I currently have my getJSON result being processed in the same script. Now I want to add previous and next buttons to get those records. The getJSON request will be different but the processing of the result will be the same. So I guess my question is can I send the result of getJSON to another script for processing and how?</p>
<p>Here is my get and first line of processing.</p>
<pre><code>$.getJSON("loadloads.php", function(data){
$("#LoadNumber").val(data[0].value.LoadNumber);
})
</code></pre>
| javascript jquery | [3, 5] |
3,102,691 | 3,102,692 | NULL Reference Error | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-in-net">What is a NullReferenceException in .NET?</a> </p>
</blockquote>
<p>When i am trying to access value stored in object it shows null reference error when the value is null.How to check for null values???</p>
<pre><code>str = "<html>" + objName.Name + "</html>"
</code></pre>
<p>Thanks in Advance </p>
| c# asp.net | [0, 9] |
99,528 | 99,529 | Posting data via js/jQuery | <p>I am really new to Javascript and its many brilliant libraries, I find even the most simple scripts hard to perform. </p>
<p>I do want to learn this language, because it would be powerful for creating client websites, however at the moment I am trying to do something relatively simple, this is to flag a personal message on my site. There are many messages in a big list, and what I am looking at doing is when the user clicks the "Flag PM" image, it will run flag.php in the background which will change the flag field in MySQL from 0 to 1.</p>
<p>This script is all dependant on one field, that is id so I can run this through the database. Anyway, here is my code;</p>
<p><strong>flag.php</strong></p>
<pre><code> require('_inc/_core/core.php'); // inc core_funcs for sql & clean
$pm_id = clean($_POST['p_id']); // create new variable, clean the post
echo "The ID for the PM is " . $pm_id;
mysql_query("UPDATE `messages` SET `flag_status` = 1 WHERE `id` = {$pm_id}"); // update the db
</code></pre>
<p><strong>JS/jQuery</strong></p>
<pre><code> // Flag a Personal Message
$("#flagPM").submit(function(event) {
event.preventDefault();
$.post("flag.php", { p_id: pm_id } );
alert(event);
});
</code></pre>
<p><strong>HTML handling the form</strong></p>
<pre><code><form action="#" id="flagPM"><input type="hidden" id="pm_id" value="$id" />
<input type="submit" class="submit" value="FLAG" /></form>
</code></pre>
<p>So there is a hidden input field named <strong>pm_id</strong> that contains what I want posted. </p>
<p>Would really appreciate some help, the Javascript is being run from an independent file that is two directory's up from flag.php</p>
<p>Thank you</p>
| javascript jquery | [3, 5] |
5,269,830 | 5,269,831 | Build array with one textbox c# , asp.net | <p>I need to build a form that allows a user to enter 100 different measurements. Then enter 100 different weights. I want to use the same text boxes. One for the measurements, one for the weights. Then have them store the value and then reset to accept the next value and so on. Can anyone point me in the right direction to accomplish this? I have searched for over an hour and can't find anything. Thank you in advance for your help. </p>
| c# asp.net | [0, 9] |
1,981,673 | 1,981,674 | How to write javascript function to check JRE version | <p>I am new to javascript. How to write javascript function which will return installed java version in the computer.</p>
<p>Thanks
Sunil Kumar Sahoo </p>
| java javascript | [1, 3] |
2,882,718 | 2,882,719 | Why would multiple SessionStateStoreProviders be instantiated? | <p>I'm working on a Redis <code>SessionStateStoreProvider</code> that <a href="https://github.com/TheCloudlessSky/Harbour.RedisSessionStateStore" rel="nofollow">can be found here</a>. In my <code>web.config</code>, I add the following in the <code>system.web</code> element.</p>
<pre><code><sessionState mode="Custom" customProvider="RedisSessionStateProvider">
<providers>
<clear />
<add name="RedisSessionStateProvider"
type="Harbour.RedisSessionStateStore.RedisSessionStateStoreProvider" />
</providers>
</sessionState>
</code></pre>
<p>However, when I start the application (an MVC3 application using the built in VS Web Server), <strong>two</strong> instances of the <code>RedisSessionStateProvider</code> are created. This can be verified by setting a break point on the constructor. I've tried cleaning the solution and rebuilding but it didn't fix it. When the application is closed down, both providers <em>are</em> disposed.</p>
<p>Something interesting to note is that the breakpoint icons are as follows:</p>
<p><img src="http://i.stack.imgur.com/FELpk.png" alt="breakpoints"></p>
<p>I can't seem to <a href="http://msdn.microsoft.com/en-us/library/5557y8b4.aspx" rel="nofollow">find any documentation</a> on the second icon.</p>
<p>Interestingly enough, when I switch to IIS Express, two instances are created. However, when I refresh the page after it's loaded, a <strong><em>third</em></strong> instances is created. What's even more weird is that after a few seconds it gets disposed!</p>
<p>I can't find any documentation supporting this behaviour. Does anyone have any info on this? Is this by design? Could this be because of multiple worker processes?</p>
| c# asp.net | [0, 9] |
818,927 | 818,928 | JQuery and C# ASP.NET Form and File Validation | <p>I am confused about the best way to intertwine jquery/javascript with C#. I am supposed to put a javascript confirm popup into a file upload form. However the confirm only pops up if certain criteria is not met.</p>
<p>There are 4 elements on the form that are of importance. </p>
<ul>
<li>clientId_txt - An input text field of client's ID</li>
<li>program_radio - A radio button indicating the program type</li>
<li>file_box - browse to file button and text box</li>
<li>upload_btn - user clicks this button to upload file</li>
</ul>
<p>When the user click the button, the program checks that the file_box file name has 3 elements:</p>
<ul>
<li>it contains the current date in mmddyy format</li>
<li>it contains the clientId_txt</li>
<li>it contains the 2 character program type represented by the radio button selection (clientId_txt should be stripped from the string during this check)</li>
</ul>
<p>If one or more of these conditions is not met, and appropriate javascript confirm message is displayed warning the user:
"Are you sure this is the correct file? Program code not found!"</p>
<p>The user can then click 'Yes' to upload anyway or 'Cancel' the upload.</p>
<p>If the upload is allowed then the file name and time is stored in a database. </p>
<p><hr /></p>
<p>What is the best way to handle this processing. Can I do all of the filename checking in jquery/javascript in onClientClick and then the uploading and database update in onClick C# side?</p>
<p>Or should I put a script literal inside a javascript-script tag . Then do all the processing on C# side and spit a dynamically generated javascript confirm out to the javascript literal, then triger the literal somehow?</p>
| c# asp.net javascript jquery | [0, 9, 3, 5] |
5,062,208 | 5,062,209 | How to make a PHP library work in java environment? | <p>i have a php library which is in php. can i have this lib to work in java environment like calling the functionalists of the lib to work exactly like a java lib?</p>
<p>Regards
Tony</p>
| java php | [1, 2] |
4,186,435 | 4,186,436 | How to switch between 2 CSS colors with jQuery? | <p>I want a string of text to change color from default to #c30 when I click a button somewhere on the page, and it changes back to default when I click the button again.</p>
<p>My code looks like this:</p>
<pre><code>$("#button").click(function() {
var anno = $(#text);
if (anno.css('color') == '#c30') {
anno.css('color', '');
} else {
anno.css('color', '#c30');
}
});
</code></pre>
<p>But it doesn't seem to work on FF3. Works in IE though. Any idea?</p>
| javascript jquery | [3, 5] |
2,531,011 | 2,531,012 | how to get a value of parent id with jquery | <p>This is the html i am using</p>
<pre><code> <tr>
<td>No.</td>
<td id="2" class="editable">data1</td>
<td id="2" class="editable">data2</td>
<td>Usage Left</td>
</tr>
<!-- Multiple rows with different ids -->
</code></pre>
<p>and this is my javascript</p>
<pre><code> $(function(){
$('.editable').editable({onSubmit:Update});
function Update(){
var id = $(this).parent('td').attr('id');
var title = $(this).text();
$.ajax({
type: 'post',
url: 'update.php',
data: 'title=' + title + '&id=' + id,
success: function(response) {
$('#response').fadeIn('1000').empty().append(response);
}
});
}
});
</code></pre>
<p>I want to get the value of the ids of class editable, this is a inline edit plugin i am using i am able to collect the data1 and data2 values but for id i am getting undefined.</p>
<p>What is wrong with my code.</p>
<p>Thank You.</p>
| javascript jquery | [3, 5] |
1,626,155 | 1,626,156 | Android App Dev (Beginner) | <p>My question is in two parts, I guess that makes it two questions :-).</p>
<p>I have a strong interest in beginning to develop Android applications. I have some knowledge of programming HTML and CSS but no other languages. My research has yielded many folks indicating knowledge of Java is a must-have in order to develop complex apps. </p>
<p>My first question is: should I start with learning Java or use a Java book as a reference guide? If learning Java is the way I should go (I am not looking to shortcut this process) what books can you recommend that would provide exercises to assist?</p>
<p>Any advice is much appreciated. Thanks in advance.</p>
| java android | [1, 4] |
4,689,207 | 4,689,208 | .Net how should i share session objects between different layers of asp.net project | <p>I have created a List objects when application starts and saved them as a session variable.</p>
<p>I then use this session variable throughout life of the application.</p>
<p>At times I update to this List in other layers of the application so I want to pass this session variable to other layers.</p>
<p>Should I be passing List object from asp.net to other layers in the methods? should i create a property of List in all layers which are going to use this object and set the property from the presentation layer? if i create a static list then all users see same list. i want the list to be session specific.</p>
| c# asp.net | [0, 9] |
1,877,220 | 1,877,221 | Why isnt jQuery appearing in my page | <p>I have my "good.html" and "jquery.js" file in a folder on desktop called "jquery2."</p>
<p>Here is my code </p>
<pre><code><!doctype html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="jquery.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function(){
console.log('ready');
});
</script>
</body>
</html>
</code></pre>
| javascript jquery | [3, 5] |
5,879,811 | 5,879,812 | how to set a specific date to be available? datepicker | <p>I have DB mysql with column <strong>date_in</strong> and <strong>date_out</strong></p>
<p>how to set datepicker to show available only dates from database mysql.
i have two inputs with datepicker</p>
<pre><code><input type="text" name="check_in_date" id="check_in" />
<input type="text" name="chek_out_date" id="check_out" />
</code></pre>
<p>for example i have <strong>check_in_dates</strong> = 10-05-2012, 13-05-2012, ... , n.
and they must be only available to pick through jQuery.datepicker.</p>
| javascript jquery | [3, 5] |
163,128 | 163,129 | Return only one value by clicking on a button | <p>How to return only the object on which we clicked, not the entire collection? </p>
<pre><code> $('[id^=opener]').click(function() {
document.write($('[id^=opener]').find(this));
});
</code></pre>
| javascript jquery | [3, 5] |
4,986,992 | 4,986,993 | Help porting c++ to php code | <p>I need if possible port this function to c++:</p>
<pre><code>static unsigned char bux_code[3] = {0xFC, 0xCF, 0xAB};
void bux_convert(char* buf, int size)
{
int n = 0;
// ----
for (n=0;n<size;n++)
{
buf[n]^=bux_code[n%3];
}
}
</code></pre>
<p>What i have done:</p>
<pre><code>$bux_code = array("\xFC", "\xCF", "\xAB");
function bux_convert($string)
{
$size = strlen($string);
for ($n = 0; $n < $size; $n++) {
$string[$n] ^= $bux_code[$n % 3];
}
return $string;
}
var_dump ( bux_convert("£Ì•½Ï¼«ü") );
</code></pre>
<p>But i got this error: Cannot use assign-op operators with overloaded objects nor string</p>
| php c++ | [2, 6] |
975,908 | 975,909 | Can I wait for a js process within PHP before continuing? | <p>I have a PHP script I use to register users but during that process I'm trying to call a Google GEOCoding javascript method to return the client lat/lng and record it to a DB before continuing with my PHP registration process.</p>
<p>Can this be done or is there a better way?</p>
<p>My current code looks something like this:</p>
<pre><code>private function process() {
$this->validate();
$this->register();
// execute javascript here to record lat/lng coordinates to the DB.
$this->goHome();
}
</code></pre>
| php javascript jquery | [2, 3, 5] |
2,732,606 | 2,732,607 | how to compare two text input type box values using jquery | <p>I have a two textboxes <code>t1</code> and <code>t2</code> . I would like to figure out how in jquery if the values in <code>t1</code> and <code>t2</code> are same I can display an alert message. If user does not change the values I want to prevent the form from being submitted.</p>
| javascript jquery | [3, 5] |
336,902 | 336,903 | How to remove javascript code as gmail does? | <p>I am currently working on securing my javascript code. I am using Asp.net 4.0 When i was checking my mail on gmail I just right clicked & selected view source & It just showed me <code><html><body></body></html></code> . Can i implement this type of security in my application or any other best security feature that will hide/encrypt my javascript code </p>
| javascript asp.net | [3, 9] |
3,711,693 | 3,711,694 | browser back button / #one #two etc | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1673359/making-browser-back-button-work-while-using-ajax-requests">Making Browser Back button work while using AJAX requests</a> </p>
</blockquote>
<p>I want to write some jQuery that when the browser url changes (not refresh) it will do an action.</p>
<p>I will 100% know what the urls will be so they will be </p>
<ul>
<li>www.hello.com/#one</li>
<li>www.hello.com/#two</li>
<li>www.hello.com/#three</li>
</ul>
<p>I'm not too concerned about the action (I can sort that); it's more about detecting that the URL has changed when not refreshed.</p>
<p>Any pointers?</p>
<p>I don't want to use a plug-in as I feel they are overkill for what I need, as I know specifics of what I am trying to achieve.</p>
| javascript jquery | [3, 5] |
2,430,578 | 2,430,579 | Allowing only one select option of a certain value to be selected | <p>I created a jsfiddle for this at <a href="http://jsfiddle.net/MZtML/" rel="nofollow">http://jsfiddle.net/MZtML/</a></p>
<p>I have a row of images with a select box to determine what type of image it is. These are the options:</p>
<pre><code><select name="image-type">
<option value="none">Select Image Type</option>
<option value="small-thumbnail">Small Thumbnail (70x50)</option>
<option value="thumbnail" selected="selected">Thumbnail (140x100)</option>
<option value="feature">Feature</option>
<option value="gallery">Gallery</option>
</select>
</code></pre>
<p>Now when there are several rows of images, I only want to allow one row to be designated as Feature. If another row is currently set as Feature it should be reset to Select Image Type. The same with Small Thumbnail and Thumbnail.</p>
<p>There can be multiple images set as Select Image Type and as Gallery.</p>
<p>I've been trying using the follow jQuery:</p>
<pre><code>$('#image_container').on('change', '[name="image-type"]', function() {
$this = $(this);
$('[name="image-type"]').not($this).each(function() {
if ($(this).val() === 'feature') {
$(this).val('none');
}
});
});
</code></pre>
<p>I've tried a few variations of this and I have gotten close, but nothing I've tried seems to do it accurately. Can someone help me out?</p>
| javascript jquery | [3, 5] |
4,664,672 | 4,664,673 | how to handle this ThreadAbort Exception..? | <p>i got this exception when i done the code given below..</p>
<p>"Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack." </p>
<p>--code--</p>
<pre><code>try
{
if (retVal == 0)
Response.Redirect("Success.aspx");
}
catch(Exception error)
{
Response.Redirect("errorpage.aspx");
}
finally{
}
</code></pre>
<p>from searching in net i found it to be a bug and if its success then we should end response... ie " Response.Redirect("Success.aspx", false); ".it works fine.. is this a good method or there is any other efficient method to handle this exception please help....</p>
| c# asp.net | [0, 9] |
1,308,134 | 1,308,135 | js is not defined error | <p>How can I get the error message on a good way to solve? Error message: timetotal is not defined.</p>
<pre><code> $(document).ready(function() {
if (typeof(timeleft) !== 'undefined') {
Chrono.update();
}
$('a.add_other_answer').click(function() {
addAnswer();
});
});
Chrono = {
warning: timetotal * 0.25,
critical: timetotal * 0.05,
update: function() {
...
...
</code></pre>
| javascript jquery | [3, 5] |
5,414,798 | 5,414,799 | JQuery apply bind to all children | <p>I have:</p>
<pre><code>$(document).ready(function(){
$("#eventsContent").children().each(function(){
$(this).bind("mouseenter", function(){
$(this).css("background","#F5F5F5");
});
});
});
</code></pre>
<p>I have tried this a couple different ways, but this is the jist of what i've done. </p>
<p>I have a container div with numerous divs within it. I want to bind a MouseEnter event to each inner div respectively (and eventually a mouseout, once i see what's done it will be easy to expand upon).</p>
<p>Thanks for you help in advance.</p>
| javascript jquery | [3, 5] |
5,912,165 | 5,912,166 | save as dialog in asp.net | <p>I have some data in the form of a string. I want to write this data to a file and save the file to the specified path. The path would be specified by opening a save as dialog on the button click. How can this be achieved??</p>
| c# asp.net | [0, 9] |
5,260,116 | 5,260,117 | How to make this jquery code shorter? | <p>Is there a way to make this code smaller into 1 block?</p>
<pre><code>$('#product INPUT:checked').each(function () {
data.box1.push({
id: $(this).attr("id")
});
});
$('#product .dropSelect OPTION:selected').each(function () {
data.drops.push({
value: $(this).val()
});
});
$('#product .setSelect OPTION:selected').each(function () {
data.set.push({
value: $(this).val()
});
});
</code></pre>
| javascript jquery | [3, 5] |
4,556,540 | 4,556,541 | How to send any new uploaded or created items in the web application to all users in the database? | <p>I am developing an <strong>intranet web application</strong> which should provide its users with a weekly medium-size quizzes about the latest training courses that they took in the company.I developed the quiz machine to be similar to this <a href="http://www.asp.net/web-forms/videos/building-20-applications/lesson-11-building-a-quiz-engine-1" rel="nofollow">one explained on ASP.NET website</a>.
Now, I need to make the system sending the quizzes at 7 o'clock on every Monday. Since this is my first project in ASP.NET, I need your explanation and some references to help me in implementing this task.</p>
<p>I already implemented a Mail class that uses MailMessage and SMTP Client. I used this class for Contact Us page. But I don't know I will need to use for this case or not.</p>
<p>I googled about this but I could not be able to find any useful resource for this thing except one resource that tells me about designing one empty page and when the user comes to this page, it should send an email. Then, I need to use some called task scheduling to automate the process of sending emails. But how I develop these things?</p>
<p>Any help?</p>
| c# asp.net | [0, 9] |
935,416 | 935,417 | convert string like "8.37%" to integer like 8.37 | <p>I am using this method to convert it, </p>
<pre><code>String R=sgp.getR();
String R1=R.replace("%", "");
int N=Integer.parseInt(R1);
</code></pre>
<p>but getting Number format exception.
In R i am getting 8.37% and i have to make it 8.37 in integer so that i can use it.
I have also tried</p>
<pre><code> int N=Integer.valueOf(R1)
</code></pre>
<p>yup i got it it will be float it was just out of my mind...</p>
| java android | [1, 4] |
5,893,161 | 5,893,162 | How to dynamically add attributes to mulitple div with same class name using jquery? | <p>I have a "div" written in my html code like this</p>
<pre><code><div class="mydata">
</div>
</code></pre>
<p>and this is created dynamically when page renders so how many div with this same class name is going to be created is not fixed but using my code i can get the total no of div presented at a time after page load.</p>
<p>i stored that value in a variable "counter".</p>
<p>so for example at some time if their are 5 div with "mydata" class name then counter have 5 value</p>
<p>but now i want to add id attribute(Start from 1 upto counter value) to each div.</p>
<p>ex: first div is look like this <code><div class="mydata" id="1"></div></code></p>
<p>second one is like this <code><div class="mydata" id="2"></div> and so on.</code></p>
<p>so please tell me how can add this id attr to my div(as discribed other )using jquery ?</p>
<p>-Thanks </p>
| javascript jquery | [3, 5] |
5,790,681 | 5,790,682 | ASP.Net Problem in Prod/Dev | <p>I am facing strange problem,
Whenever I commented second <strong>if</strong> condition, it works in Production, but fail in development.</p>
<p>And when I dont comments second if condtion of code, it works for development and fail for production.</p>
<pre><code> protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
lblDocument.Text = "Document :" + this.Request.QueryString["A_No"].ToString();
//if (!frmViewer.Action.Contains("?"))
//{
// frmViewer.Action = String.Format("{0}?A_No={1}&A_Format={2}",
// frmViewer.Action,
//this.Request.QueryString["A_No"].ToString(),
// //this.Request.QueryString["A_Format"].ToString());
// }
}
}
</code></pre>
<p>Here is Error message:</p>
<p><strong>CS0117: 'System.Web.UI.HtmlControls.HtmlForm' does not contain a definition for 'Action'</strong></p>
| c# asp.net | [0, 9] |
1,508,182 | 1,508,183 | Send data from javascript to code behind at first load | <p>I am actually buidling a web application and I need to get data of the local environment of the machine viewing the application.To do this, I use a little javascript script such as:</p>
<pre><code><script language="javascript">
function GetUserName()
{
//Permits to get username of client machine
var wshell = new ActiveXObject("WScript.Shell");
var arpege = wshell.ExpandEnvironmentStrings("%USERNAME%");
document.getElementById("arpege").value=arpege;
}
</script>
<input type=hidden id="arpege" runat=server />
</code></pre>
<p>My problem is that this script is executed after the page is loaded and so I can't use it on the page load...</p>
<p>My code on the page load is:</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
myConnection.ConnectionString = ActionSource.ConnectionString;
myConnection.Open();
String account = arpege.value;
...
}
</code></pre>
<p>But i just get "" in account...</p>
<p>Thanks for your help,</p>
<p>Quentin</p>
| c# javascript asp.net | [0, 3, 9] |
2,643,963 | 2,643,964 | Create object on page_load and pass to JQuery | <p>I have an asp.net page and the JQuery date picker. On page load, I want to look at some config and create an object of dates to not include and then pass that to my JQuery in an external .js file. Is there a way to do this? How?</p>
<p>EDIT:
I'd like to pass a Class object</p>
| jquery asp.net | [5, 9] |
1,979,533 | 1,979,534 | how to reset elements affected by a jquery function | <p>I have a jQuery function that runs when a box is clicked that affects multiple other elements on the page (creates a slideshow from a group of divs). There are multiple boxes on the page and I need to reset the elements affected by the function back to normal whenever the box is clicked again. Is there an easier way to reset the elements affected by the jQuery, or basically run the function backwards vs. writing another function that undoes what the first function did? </p>
<p>here is a <a href="http://jsfiddle.net/jlego/zeLNG/21/" rel="nofollow">jsfiddle</a>.</p>
| javascript jquery | [3, 5] |
1,141,877 | 1,141,878 | How can i check if the web page is already accessed in particular IP Address on ASP.Net? | <p>In my application i want to check that the url is accessed in the particular ip address. Only one time the page needs to be displayed and for the next time navigating to that page the page should not come.</p>
<p>How can i achieve this?</p>
<p>Regards,
Prasad</p>
| c# asp.net | [0, 9] |
1,384,615 | 1,384,616 | Adding html and plain text inside div with jQuery | <p>I'm recieving a string (it may be either plain text or HTML text) from server, and I need to insert it into a div after that. </p>
<p>I can use <code>$div.text(textFromServer)</code> if I know that <code>textFromServer</code> is plain text. </p>
<p>If I know that <code>textFromServer</code> is html I can do something like <code>$(textFromServer).appendTo($div)</code>. </p>
<p>The problem is that I don't know for sure whether <code>textFromServer</code> is plain or HTML. </p>
<p>So here's the question: is there a elegant and simple solution for my problem? Or do I have to analyse <code>textFromServer</code>?</p>
| javascript jquery | [3, 5] |
3,143,070 | 3,143,071 | PHP code to Javascript | <p>How can I convert this PHP code to javascript? I wanna use .js file to insert other pages. If there are other ways please tell me.
thanks! :)</p>
<pre><code><?
include 'config.php';
$select = mysql_query("SELECT * FROM `currency`");
$num=mysql_num_rows($select);
while($row=mysql_fetch_object($select))
{
$id=$row->id;
$qveyana=$row->qveyana;
$simbolo=$row->simbolo;
$kursi=$row->kursi;
$zrda=$row->zrda;
$drosha=$row->drosha;
?>
<table border="0" width="300" cellpadding="" cellspacing="0">
<tr bgcolor="#CCCCCC" bordercolor="#FF0000"><td width="22"><i.mg src="<? echo $drosha; ?>" width="20" /></td><td width="50"><? echo $qveyana; ?></td><td width="40"><? echo $simbolo; ?></td><td><? echo $kursi; ?></td><td><? echo $zrda; ?></td></tr>
</table>
<? } ?>
</code></pre>
| php javascript | [2, 3] |
5,517,294 | 5,517,295 | Print text in one textbox by clicking more than one button | <p>I want to print text in textbox by clicking buttons i.e., for example,
if i click on button1, in textbox text should be "a"
If i click on button2, textbox text should be "ab" in ASP.Net</p>
| c# asp.net | [0, 9] |
5,260,261 | 5,260,262 | Lost in jQuery .each() | <p>In the script below, I'm trying to parse through a select list and for each option, call a php that returns a value (psuedo true/false) based on the options "value" attribute.</p>
<p>However, when I'm inside the $.get [to evaluate the return value and execute script against the current option in the each(),] I can't figure out how to reference the current option element in order to modify it. </p>
<pre><code>$('#my_Select').click(
function(){
$('#my_Select option').each(
function(){
$.get(
'<?php echo getStyle.php',{option: $(this).val()},
function(response){
alert($(this).val()); //Returns empty alert. Should return value of current option
//$(this).attr("disabled","disabled");
//if (response.Success){$(this).attr("disabled","disabled");}
});
});
});
</code></pre>
<p>Here's the php script for reference...</p>
<pre><code><?php
//getStyle.php
$myOption = $_REQUEST['option'];
$file = "styles/".$myOption."/style.css";
//echo json_encode(file_exists($file));
if (!file_exists($file))
{
$Response = array('Success' => true);
}
else
{
$Response = array('Success' => false);
}
echo json_encode($Response);
?>
</code></pre>
| php jquery | [2, 5] |
4,943,765 | 4,943,766 | compress file at client-side | <p>I wanna upload a file to server. But is there any way(using javascript) to compress the image at client-side before upload.</p>
| asp.net javascript | [9, 3] |
5,054,799 | 5,054,800 | how to call javascript functions from parent page? | <p>I got a page which has an iframe. This page has a masterpage on which there is a js function defined. </p>
<p>masterpage contains:</p>
<pre><code> <script type="text/javascript" src="/somejs.js"></script>
</code></pre>
<p>page with iframe:</p>
<pre><code> <div >
<iframe id="myIframe" runat="server"></iframe>
</div>
</code></pre>
<p>how can i call functions in the 'somejs.js' file?</p>
| javascript asp.net | [3, 9] |
6,029,266 | 6,029,267 | Global variable in javascript not working properly | <p>I have an iframe issue ( little bit strange for me ) . The issue is that i have an iframe in my document, and there are several functions are operating different task on that iframe and for accessing the contents of iframe we use :</p>
<pre><code>$("iframe").contents();
</code></pre>
<p>So instead of writing this long statement i used a global variable :</p>
<pre><code>var i = $("iframe").contents();
</code></pre>
<p>But this is not working well, like</p>
<pre><code>alert( i.find("someelement") );
</code></pre>
<p>=> <code>undefined</code> </p>
<pre><code>alert($("iframe").contents().find("someelement")
</code></pre>
<p>=> <code>[object]</code></p>
<p>Whats the problem here?</p>
| javascript jquery | [3, 5] |
2,121,377 | 2,121,378 | The XML element 'EnableTheming' from namespace '' is already present in the current scope | <p>The XML element 'EnableTheming' from namespace '' is already present in the current scope. Use XML attributes to specify another XML name or namespace for the element. I get this error when I assign my DataTable to ViewState.</p>
<p>Here is the code:</p>
<pre><code>DataTable dt = new DataTable();
DataColumn dcRoom = new DataColumn("Room", typeof(DropDownList));
DataColumn dcRatePlan = new DataColumn("RatePlan", typeof(DropDownList));
DataColumn dcAdults = new DataColumn("Adults", typeof(string));
DataColumn dcChildren = new DataColumn("Children", typeof(string));
DataColumn dcCheckIn = new DataColumn("CheckIn", typeof(string));
DataColumn dcCheckOut = new DataColumn("CheckOut", typeof(string));
dt.Columns.AddRange(new DataColumn[] {dcRoom,dcRatePlan, dcAdults, dcChildren, dcCheckIn, dcCheckOut });
dt.Rows.Add(new object[] {new DropDownList(),new DropDownList(), "", "", "", "" });
gvRatePlans.DataSource = dt;
gvRatePlans.DataBind();
ViewState["Rooms"] = dt;
</code></pre>
| c# asp.net | [0, 9] |
1,353,330 | 1,353,331 | Table row delete using jquery | <p>i have made this code to remove table row :</p>
<pre><code>jQuery('tr#rowAttend1').remove();
</code></pre>
<p>HTML :</p>
<p>Three rows with same id .
For example :</p>
<pre><code><tr id="rowAttend1" ><td>ssss</td></tr>
<tr id="rowAttend1" ><td>ddddd</td></tr>
<tr id="rowAttend1" ><td>ccccc</td></tr>
</code></pre>
<p>but
i want all three to be removed
it works fine in all browsers except ie7 ?
Can anybody help me?</p>
| php jquery | [2, 5] |
4,066,008 | 4,066,009 | Asp.Net Page Load | <p>i have a weird problem ! i have ASP.NET website and i have a page with page_load which never get executedno matter what i do ,i deleted the page_load and doubled clicked the aspx page it generated page_load again i inserted my code inside and made breakpoint but it never get hit ! </p>
<p>All other Methods gets hit normal like button click and gridview events etc.</p>
<p>ASP.NET 4</p>
<p>it only happens with this page only.</p>
<p>any one ever faced this weird problem ?</p>
| c# asp.net | [0, 9] |
3,885,075 | 3,885,076 | DownloadString timed out | <p>I have a method which returns the content of a webpage:</p>
<pre><code> private string FetchHTML(string sUrl, Encoding encoding)
{
System.Net.WebClient oClient = new System.Net.WebClient();
oClient.Encoding = encoding;
return System.Web.HttpUtility.HtmlDecode(oClient.DownloadString(sUrl));
}
</code></pre>
<p>But when I try to load a link from livejournal (for instance, <a href="http://mos-jkh.livejournal.com/769579.html" rel="nofollow">http://mos-jkh.livejournal.com/769579.html</a>) then I am getting this exception at DownloadString:</p>
<blockquote>
<p>The request was aborted: The operation has timed out.</p>
</blockquote>
<p>Is it a known issue? Why doesn't DownloadString work for some webpages and is there a solution for this? Or is there an alternative to DownloadString?</p>
| c# asp.net | [0, 9] |
2,570,621 | 2,570,622 | C#: How to check whether a instance is serializable | <p>How can check whether a instance is marked as serializable?</p>
<p>Thanks</p>
| c# asp.net | [0, 9] |
4,046,051 | 4,046,052 | How can I execute a Java program within a php script? | <p>I am writing a simple web upload script. The goal is to upload a file using php, and then calling a java program to process this file. I have done the work for uploading the file, but I cannot get a java program to be successfully run from within the php script. I have tried exec(), shell_exec(), and system() with no results. For the command, I have used "java Test", "java < directory >/Test", "/usr/bin/java < directory >/Test", I have even set up the application as a jar file with no results. The actual line of code I have used is:</p>
<p>echo shell_exec("java Test");</p>
<p>Usually there is no output. However, if I have just shell_exec("java"), then the last line of the help from java ("show splash screen with specified image") is displayed, which shows that the command has been executed. If I use, for example, shell_exec("whoami") I get "nobody" returned, which is correct. The only thing the java file does is create a file so that I can see that the application has been successfully run (the application runs successfully if I run it on the command line). I have set the permissions for the java file to 777 to rule out any possibility of permission errors. I have been struggling with this for a while trying all sorts of options with no results - the file is never created (the file is created with an absolute path so it's not being created and I just can't find the file). Does anyone have any ideas?</p>
<p>Thanks.</p>
| java php | [1, 2] |
5,897,638 | 5,897,639 | How do i grey out the input field and the submit button | <p>I want to grey out <a href="http://doorsplit.heroku.com/" rel="nofollow">these two things</a> the song input field and the submit button until the user enters and artist. Is there an easy way to do this via JQuery.</p>
<p>the id of the artist input field is #request_artist</p>
| javascript jquery | [3, 5] |
95,577 | 95,578 | Is it possible to find the parent of an element then navigate the DOM? | <p>When using jQuery how does one return to navigating the DOM. For example, if I found the parent of an item like this:</p>
<pre><code>$(this).parent()
</code></pre>
<p>How can you find something with an id of 'foobar'.
I've tried:</p>
<pre><code>$(this).parent().$('foobar').addClass('hello')
</code></pre>
<p>But I get the message:</p>
<pre>Uncaught TypeError: Object [object Object] has no method '$'</pre>
| javascript jquery | [3, 5] |
5,493,487 | 5,493,488 | Get Parent Tables Parent Table jQuery | <p>I am working with Sharepiont and the code it spits out is messy at best.</p>
<p>I have the id of a div inside a table which is inside another table and I need to get at the parent tables parent table.</p>
<p>Here is the JsFiddle I am working with:</p>
<p><a href="http://jsfiddle.net/BpnNJ/2/" rel="nofollow">http://jsfiddle.net/BpnNJ/2/</a></p>
<p>Can anyone help please?</p>
| javascript jquery | [3, 5] |
1,555,387 | 1,555,388 | how to find datagrid row in asp.net 2.0 C# | <p>I am using dot net 2.0 and c#.</p>
<p>I have a requirement where i have to find rows of datagrid and pass then as an argument in a function, could you please provide me code for findind a row in datagird. Thanks</p>
| c# asp.net | [0, 9] |
2,628,049 | 2,628,050 | TextBox Accepting only a decimal number with two precisions (eg: ddd.dd) | <p>I have a textbox which need to restrict the user for entering other than decimal number (with maximum of three digits and then a period and then maximun of two digits). Can someone suggest me Onkeypress Event for the textbox in jQuery For this requirement</p>
| javascript jquery asp.net | [3, 5, 9] |
4,202,271 | 4,202,272 | Android Supporting Multiple Screens with fixed width icons | <p>This may not be explained the best but here it goes.
I have a window of 2 by 2 square icons. I found a custom layout script that spaces these equally on the screen. These 4 icons consist of a square background with a little image and title.
At the moment the width and height are defined in dp. But that stretches or shrinks the text. I am assuming I need to use fixed values. I understand that there are 4 generalised screen resolutions.</p>
<p>My question is, for small I would have to set the width and heights to x and y, but when the screen gets bigger due to larger devices I would have to increase x and y to keep some sort of continuity.</p>
<p>Is there a minimum and maximum width and height of screens for each size? How do other people get around these issues.</p>
<p>Sorry if it is a bit broad and sweeping, but I am new to creating dynamic (ish) displays for multiple resolutions.</p>
<p>Any help and advice will be greatly appreciated.</p>
| java android | [1, 4] |
5,644,710 | 5,644,711 | Android - checking for certain value does not | <p>I am working on Android billing and trying to set the onPurchaseStateChange method correct, but it does not seem to be working.</p>
<pre><code> @Override
public void onPurchaseStateChange(PurchaseState purchaseState, String itemId,
int quantity, long purchaseTime, String developerPayload)
{
if (purchaseState == PurchaseState.PURCHASED)
{
mOwnedItems.add(itemId);
if ( itemId != null && itemId.trim().equals("3") )
{
Intent myIntent = new Intent(ExtraHelpActivity.this, PsychologyActivity.class);
ExtraHelpActivity.this.startActivity(myIntent);
}
if ( itemId != null && itemId.trim().equals("4") )
{
Intent myIntent = new Intent(ExtraHelpActivity.this, NumberOfBusinessesActivity.class);
ExtraHelpActivity.this.startActivity(myIntent);
}
}
else
if (purchaseState == PurchaseState.CANCELED)
{
// purchase canceled
}
else
if (purchaseState == PurchaseState.REFUNDED)
{
// user ask for a refund
}
else
{
if ( itemId != null && itemId.equals("3") )
{
Intent myIntent = new Intent(ExtraHelpActivity.this, PsychologyActivity.class);
ExtraHelpActivity.this.startActivity(myIntent);
}
if ( itemId != null && itemId.equals("4") )
{
Intent myIntent = new Intent(ExtraHelpActivity.this, NumberOfBusinessesActivity.class);
ExtraHelpActivity.this.startActivity(myIntent);
}
}
</code></pre>
<p>So when the purchaseId is "4" or "3" and the purchaseState == PurchaseState.PURCHASED ....for some reason it does not seem to get into that if statement, and does not perform the intent to go to the next page?</p>
<p>Would anyone know why that happens? It seems very strange. Could it be a Java thing?</p>
<p>Thanks! </p>
| java android | [1, 4] |
840,811 | 840,812 | Adding HTML code with Single Quotes inside jQuery | <p>I am trying to add this HTML/JavaScript code into a jQuery variable. I've managed to insert double quotes by writing is with a backshlash <code>\"</code>, however the same tactic didn't work for the single quotes:</p>
<pre><code>ajaxData += '<div class=\"menu-item-' + $(this).attr('div') + 'onclick=\"alert('Jquery Function');\"></div>';
</code></pre>
<p>Specifically, this part <code>onclick=\"alert('Jquery Function');</code></p>
<p>Anyone know how I can go around this?</p>
| javascript jquery | [3, 5] |
2,965,834 | 2,965,835 | Best way to incorporate javascript in php? | <p>This is the way I am currently doing it. </p>
<pre><code> <?php
//show footer
echo "<script type='text/javascript'>\n";
echo "alert('Congrats');\n";
echo "</script>";
?>
</code></pre>
<p>Is there a better way than just to echo it?</p>
| php javascript | [2, 3] |
3,972,247 | 3,972,248 | How do I extract data from this URL using javascript? | <p>I need to build a string from the data contained in this url using javascript/jQuery:</p>
<pre><code>http://www.example.com/members/admin/projects/?projectid=41
</code></pre>
<p>The string returned should look as follows:</p>
<pre><code>/ajax/projects.php?projectid=41
</code></pre>
<p>Obviously if there is no query string present, the method should still return a string of the same format minus the query string. e.g.</p>
<pre><code>http://www.example.com/members/admin/messages/
</code></pre>
<p>should return...</p>
<pre><code>/ajax/messages.php
</code></pre>
<p>I've made numerous attempts, all met without success due to my poor grasp of regular expressions, and it feels as though the ore I rad on the subject the more I am confusing myself.</p>
<p>If someone could help it would be greatly appreciated.</p>
<p>EDIT: The 'admin' portion of the url is a users 'username' and could be anything.</p>
| javascript jquery | [3, 5] |
1,392,794 | 1,392,795 | Stop or interrupt php script for particular time | <p>Can I Stop or interrupt <code>PHP</code> script for particular time?</p>
<p>I would like to implement logic like below:</p>
<p>on <em><code>mydomain.com/index.php</code></em> there will be flash appear showing some intro of a product for suppose 20 sec. Once it complete, on same index.php page the home page of site will appear.</p>
<p>I am not aware about flash (action script).</p>
<p>Is it possible in <code>PHP</code> or <code>Javascript</code> ?</p>
| php javascript | [2, 3] |
2,465,076 | 2,465,077 | Use both ahref and onclick on php to hIde parameters? | <p>I have a php function which gets data from database and calls a javasript function like this:</p>
<pre><code>echo "<p><a href=\"javascript: customm('$variable')\">$header</a></p>";
</code></pre>
<p>The problem is when someone hovers over the link, the browser shows the complete parameters like this:(on bottom left of the browser, or a new tab)</p>
<pre><code>javascript: customm('some secret code here');
</code></pre>
<p>Is there a way to hide this? I tried adding onclick to the php function and pointing ahref to #.</p>
<pre><code>echo "<p><a href='#' onclick='javascript: customm('$variable')'>$header</a></p>";
</code></pre>
<p>But it didnot work. </p>
<p>Thanks in advance!</p>
| php javascript | [2, 3] |
528,802 | 528,803 | Is it possible populate the updated data in a repeater with out refreshing the page/using and update panel? | <p>H All,<br/>
Is it possible to populate the updated data from the database to a repeater with out refreshing the page and with out using an update panel? <br/></p>
<p>This is my requirement.</p>
<p>I have an option to save Name & Age to the database <br/>
eg:</p>
<p>Name <*textbox accepts name> : Age <*textbox accepts the name> <strong>Save Button</strong><br/></p>
<p>i have a repeater which displays first 50 items displayed below save panel.
eg: </p>
<p><strong>Name Age</strong><br/>
Rahul 30<br/>
Sameera 32<br/>
Manju 28<br/></p>
<p>On click of the Save button I am calling Jquery to insert my data into the database. After this i need to update my repeater as well.</p>
<p>I don't wanna refresh the page or to use update panel.
Is there any option to do so???using some jquery or some thing like that????</p>
| javascript asp.net jquery | [3, 9, 5] |
96,238 | 96,239 | How to let javascript know if a method is being called in java class? | <p>I am doing a webapp currently that deal with java class and javascript. My java class contain a method that will be called by another webapp to update a file. Is there anyway for javascript to detect that the update method was being called so it can proceed with some function of it's own?</p>
| java javascript | [1, 3] |
2,077,314 | 2,077,315 | jQuery each this | <pre><code>var slides = $(".promo-slide");
slides.each(function(key, value){
if (key == 1) {
this.addClass("first");
}
});
</code></pre>
<p>Why do I get an error saying:</p>
<pre><code>Uncaught TypeError: Object #<HTMLDivElement> has no method 'addClass'
</code></pre>
<p>From the above code?</p>
| javascript jquery | [3, 5] |
324,520 | 324,521 | redirect to a different page | <p>I need some help here:</p>
<p>I am writing code to redirect a user to a different page and execute some code, if the user closes the window while he is working on something:</p>
<pre><code><script type="text/javascript">
window.onbeforeunload = function() {
location.assign('http://www.somesite.com');
return "go?";
}
</script>
</code></pre>
<p>Now the code works fine if the user presses cancel. But if he presses Ok, the windows closes without a redirect. </p>
<p>I just need a working code that does one simple thing - redirect the user if the window is closed - can anyone suggest me the code for it</p>
<p>I know that most of you will say that I should not be doing this and I know that this is not the best practice. But if any one of you has written a successful piece of code, please share it here.</p>
| javascript jquery | [3, 5] |
621,739 | 621,740 | Run script if address is x? | <p>I've built a site for my customer a few months ago, and when user clicks a link on navigation, the new content will slide visible and the old content will be hidden. I also made the customer a webstore and he would like a link to to his main site image gallery. However, because the site is actually only one page full of content and the new content is displayed with javascript, typing <a href="http://yoursite.com/#gallery" rel="nofollow">http://yoursite.com/#gallery</a> would actually load the first page. Is it possible to do something like </p>
<pre><code>$(document).ready(function(){
$(page).load(function(){
$('#page1').slideUp();
$('#page2').slideUp();
});
});
</code></pre>
<p>and display the wanted content based on the addresd that is typed?</p>
| javascript jquery | [3, 5] |
5,383,831 | 5,383,832 | i have a question about jquery, i can't get DOM event, when i insert a new code to html DOM | <p>like this</p>
<pre><code><html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
</head>
<body>
<div id="test">321</div>
</body>
<script>
$(document).ready(function(){
$("#test").click(function(){
$.ajax({
url:"http://address/",
type:"post",
data:{id:"123"},
success: function(r)
{
$("#test").after(r); // it will return <div id="test2">123</div>
}
});
return false;
});
$("#test2").click(function(){
alert('123');
return false;
});
});
</script>
</html>
</code></pre>
<p>first click #test and insert #test2 then i click #test2, it can't to get click event, help me, what's problem</p>
| javascript jquery | [3, 5] |
1,974,227 | 1,974,228 | Client system time in ASP.NET | <p>This C# code <code>DateTime.Now;</code> notes server time and this code <code>DateTimeKind.Utc;</code> notes the zone but displaying this to other counties at their own zone is not being possible with this. How to display time according to the clients time zone?</p>
| c# asp.net | [0, 9] |
822,923 | 822,924 | How to make Android product consumable | <p>I am working on a project, which I need to make consumable. </p>
<p>On clicking on the purchase button, using below code for consumption.</p>
<pre><code>inventory=new Inventory();
mHelper.consumeAsync(inventory.getPurchase(SKU_SUCCESS),mConsumeFinishedListener1);
</code></pre>
<p>But it getting 'Null pointer exception for Purchase here in IabHelper class.</p>
<pre><code>void consume(Purchase itemInfo) throws IabException {
checkSetupDone("consume");
if (!itemInfo.mItemType.equals(ITEM_TYPE_INAPP)) {
throw new IabException(IABHELPER_INVALID_CONSUMPTION,
"Items of type '" + itemInfo.mItemType
+ "' can't be consumed.");
}
try {
String token = itemInfo.getToken();
String sku = itemInfo.getSku();
if (token == null || token.equals("")) {
logError("Can't consume " + sku + ". No token.");
throw new IabException(IABHELPER_MISSING_TOKEN,
"PurchaseInfo is missing token for sku: " + sku + " "
+ itemInfo);
}
</code></pre>
<p>Please let me know if anyone have Idea regarding this.</p>
<p>The code for consumeAsync()</p>
<pre><code>public void consumeAsync(Purchase purchase, OnConsumeFinishedListener listener) {
checkSetupDone("consume");
List<Purchase> purchases = new ArrayList<Purchase>();
purchases.add(purchase);
consumeAsyncInternal(purchases, listener, null);
}
public void consumeAsync(List<Purchase> purchases, OnConsumeMultiFinishedListener listener) {
checkSetupDone("consume");
consumeAsyncInternal(purchases, null, listener);
}
</code></pre>
| java android | [1, 4] |
4,987,984 | 4,987,985 | Initialize final variable within constructor in another method | <p>I have a problem which isn't really that big, but still gives me some thought as to how Java constructors and methods are used.</p>
<p>I have a constant representing a radius I declare final, and also make it public for everyone to see. I don't want my code littered with getRadius() methods when I'm never ever going to change the radius.</p>
<p>I want to initialize the constant within the constructor as I want to apply certain criteria before assigning the radius, certain conditions have to be met. However, these conditions do take up some space, and I'd like to put them in some other method, to make the constructor cleaner.</p>
<p>The whole thing would initially look like this</p>
<pre><code>public MyProblematicClass {
public final int radius;
public MyProblematicClass(... variables ...) {
if(... long criteria ...) {
radius = n;
}
}
}
</code></pre>
<p>and I'd love it to end up like</p>
<pre><code>public MyProblematicClass {
public final int radius;
public MyProblematicClass(... variables ...) {
this.setRadiuswithCriteria(criteria);
}
private void setRadiuswithCriteria(criteria crit) {
if(... crit ...) {
radius = n;
}
</code></pre>
<p>I understand that I could potentially use the method for other purposes and that's the reason for giving me a 'blank field RADIUS may not have been initialized, so I'd like to know if there is a way to add a method which will only be used in constructors, for cleanliness's sake.</p>
| java android | [1, 4] |
5,807,756 | 5,807,757 | How to get unique values in a array | <p>How can I get a list of unique values in a array, do I always have to use a second array is there something similar to a java hashmap in javascript?</p>
<p>I am going to be using <strong>Javascript</strong> and <strong>jQuery</strong> only. No additional libraries can be used.</p>
| javascript jquery | [3, 5] |
3,555,729 | 3,555,730 | Get Country, GMT, City by IP address using PHP | <p>I have tried to get the <strong>Country</strong>, <strong>City</strong>, and <strong>GMT</strong> using <code>js</code> by set it to cookies, and then I fetch it with <code>PHP</code> to save into <code>Database</code>.
But the method I used, is does not work sometimes,
So, is there anyway to get them by using PHP alone?
or is there another way by using JS?</p>
<p>I using this <code>js</code> provided by <strong>maxmind</strong></p>
<pre><code><script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script>
</code></pre>
<p>But I often fail to save the data.</p>
| php javascript | [2, 3] |
282,426 | 282,427 | jquery select iframe children | <p>I am using the editArea library and jquery to do what i need...</p>
<p><a href="http://www.cdolivet.com/index.php?page=editArea&sess=2b8243f679e0d472397bfa959e1d3841">http://www.cdolivet.com/index.php?page=editArea&sess=2b8243f679e0d472397bfa959e1d3841</a></p>
<p>so in my html there is an iframe tag that editArea uses what i need is to access something like so with jquery</p>
<pre><code>$('iframe textarea').keydown(function (e){
number = 17; //any number really :)
if(e.which == number){
//do something...
alert('Done...');
}
});
</code></pre>
<p>I tried the above but it looks like it is not detecting that key. but it works if selector was $(document)
therefore the rest of the function works it's just it's not picking up the iframes textarea keydown</p>
<p>any ideas?
Thanks</p>
| javascript jquery | [3, 5] |
2,506,216 | 2,506,217 | getting the value of textbox of Grid | <p>Now , I am using ASP.net with C# . I have a Grid and there are two text box controls in it. How should I do to get the value of these two text box controls from JavaScript. </p>
<p>Regards</p>
| c# javascript asp.net | [0, 3, 9] |
3,666,242 | 3,666,243 | Why am I finding Javascript/jQuery so difficult to get right? | <p>My background is in C and I've picked up PHP, mySQL, HTML, CSS without too much issue.</p>
<p>But I'm finding Javascript/jQuery surprisingly difficult to get right.
Very frustrating.
Why?</p>
<ol>
<li><p>It seems to violate a number of traditional programming principles (e.g. variable scope) </p></li>
<li><p>Undefined variables seem to appear out of nowhere and already have values associated with them. For example (from the jQuery docs): </p>
<pre><code>$("a").click(function(event) {
event.preventDefault();
$('<div/>')
.append('default ' + event.type + ' prevented')
.appendTo('#log');
});
</code></pre>
<p>What exactly is "event"? Do I have to use this variable name? Should I just assume that this object is magically instantiated with the right stuff and I can use any of the methods list at the <a href="http://api.jquery.com/category/events/">JQuery API</a>?</p></li>
<li><p>There seems to be bunch of random rules (e.g. return false to stop a default action, but sometimes this doesn't work?) </p></li>
<li><p>Non-deterministic behavior when debugging. (e.g. I refresh the browser, try something and get result X for JS variables I'm watching in Firebug. I refresh again and I get result Y?)</p></li>
<li><p>Very messy looking code that is hard to follow. What happens when? I'm using Firebug and Chrome Developer Tools, but I'm not getting enough visibility.</p></li>
</ol>
<p>It seems like everyday there's some random JS "rule" that comes up that I've never seen before in any of my JS books or tutorials. </p>
<p>What do I need to do to make Javascript/jQuery more deterministic, controlled, and logical to me?</p>
<p>Are there any resources that explain Javascript's quirks/gotchas?</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
4,367,042 | 4,367,043 | How to access asp.net property in javaScript? | <p>I'm trying this code to access a property but it gives me an error:</p>
<pre><code><textarea class="<%#Eval("soort").ToString() %>" ID="TextTranslation" runat="server" rows="5"><%#Eval("Translation") %></textarea>
</code></pre>
<p>The error:</p>
<blockquote>
<p>Server Error in '/' Application.<br>
Parser Error<br>
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. </p>
<p>Parser Error Message: The server tag is not well formed.</p>
<p>Source Error: </p>
<p>Line 17: <br>
Line 18: <%# (Eval("IsoCode").ToString() != Eval("Default").ToString()) ? " hidden" : "" %>"><br>
Line 19: " ID="TextTranslation" runat="server" rows="5"><%#Eval("Translation") %><br>
Line 20: <br>
Line 21: </p>
<p>Source File: /assets/usercontrols/TranslationControl.ascx Line: 19 </p>
<p>Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272</p>
</blockquote>
| javascript jquery asp.net | [3, 5, 9] |
3,233,995 | 3,233,996 | How do I cancel action of a form after an alert? | <p>When the user submits the form, <code>writeToStorage</code> is fired and it checks if the user is in localStorage and if it is, an alert is run. After this alert I don't want the action to execute. I tried <code>return false;</code> but obviously that does not stop the python script from running. How do I stop the action of the form in case the alert is triggered?</p>
<pre><code>function writeToStorage() {
var chooser = localStorage.getItem("chooser");
if (chooser) {
alert("you are already a user);
//return false; }
else {
//the rest of the program } };
# if alert is run the action of the form should not run
<form name="choice_form" id="choice_form" action="/g/choicehandler" method="post" onsubmit="writeToStorage()">
<textarea name="choice" rows="7" cols="50"></textarea><br />
<input type="hidden" name="chooser" id="form_chooser" />
<input type="submit" value="submit your choice">
</form>
</code></pre>
| javascript python | [3, 7] |
3,518,106 | 3,518,107 | Is it "reflection" when I use getClass.getMethod(...)? | <p>I've written a few bluetooth apps now, but I had never seen <a href="http://stackoverflow.com/questions/3072776/android-bluetooth-cant-connect-out">this particular approach</a> until recently. In the example they use <code>device.getClass().getMethod("createRfcommSocket", new Class[] { int.class });</code> which seems to me a long way of just saying <code>BluetoothSocket bs = createRfcommSocket(...</code>. </p>
<p>What is the difference between their approach</p>
<pre><code>Method m = device.getClass().getMethod("createRfcommSocket", new Class[] { int.class });
sock = (BluetoothSocket) m.invoke(device, Integer.valueOf(1));
</code></pre>
<p>and mine</p>
<pre><code>sock = createRfcommSocket(.....
</code></pre>
<p>Is there a reason to use one or the other? </p>
<p>Thank you</p>
| java android | [1, 4] |
94,664 | 94,665 | where the asp:controls values are stored if enableviewstate is disabled? | <p>I have used a checkbox and a button in my demopage. In checkbox AutopostBack property is false and I have used a server side event checkbox_checkedchanged() on </p>
<pre><code><asp:CheckBox ID="CheckBox1" runat="server"
oncheckedchanged="CheckBox1_CheckedChanged" /><asp:Button ID="Button1" runat="server"
Text="Button" />
</code></pre>
<p>codebehind</p>
<pre><code>protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
Response.Write("checked");
}
protected void Page_Load(object sender, EventArgs e)
{
}
</code></pre>
<p>Now when I click the button(in debug mode )first it go to pageload and then CheckBox1_CheckedChanged event is fired .</p>
<p>I want the explanation.that instead of enabling viewstate why the checkbox event is firing ?</p>
| c# asp.net | [0, 9] |
3,305,967 | 3,305,968 | What is the equivalent of Java's .length for arrays in C#? | <p>I'm new to C#, and I'm trying to convert this code from java into C#.</p>
<pre><code> static public double euclidean_2(double[] x, double[] y)
{
if (x.length != y.length) throw new RuntimeException("Arguments must have same number of dimensions.");
double cumssq = 0.0;
for (int i = 0; i < x.length; i++)
cumssq += (x[i] - y[i]) * (x[i] - y[i]);
return cumssq;
}
</code></pre>
<p>I know java uses .length but what is the equivalent in C# since I keep getting an error</p>
<p>Thanks</p>
| c# java | [0, 1] |
2,680,250 | 2,680,251 | Raphael Paper when Empty | <p>Splice is not working for array with an object and i am getting the following error. I am just reordering stuff based on the condition.</p>
<pre><code>this.generatePartipant = function(userData,creatorID) {
//arrange order based on order: owner, presenter and others
var creatorObject;
var ownerObject;
for(var i=0;i < userData.length; i++){
if(userData[i].senderId = creatorID)
{
creatorObject = jQuery.extend({},userData[i],{creator:true});
userData.splice(i,1);
}
if(userData[i].senderId = whiteboardDesigner.user){
ownerObject = jQuery.extend({},userData[i],{owner:true});
userData.splice(i,1);
}
}
if(creatorObject != null){
userData.push(creatorObject);
}
if (ownerObject != null){
userData.push(ownerObject);
}
}
</code></pre>
<p><strong>> error:</strong></p>
<pre><code> userData.splice(i,1);
Uncaught TypeError: Object [{"senderId":"9e61ec7e-8d7c-469d-88e5-38213dcb34f4","userName":"lkwerj","thumbnailId":null,"active":true,"camStarted":false,"micStarted":false,"imageUrl":null}] has no method 'splice'
</code></pre>
| javascript jquery | [3, 5] |
4,082,209 | 4,082,210 | ASP.NET 1.1 issue | <p>For some reason I cannot add a server control onto a specific asp.net form. If I make an attempt to do this, I get the following error when selecting from the datagrid: Index was out of range. Must be non-negative and less than the size of the collection </p>
<p>I have checked the values and they are all non negative and this exact select works if I restore the page back to the original form from source control. </p>
<p>How do server controls affect the index property of a datagrid? </p>
<p>here is where the code fails:</p>
<pre><code>int _indiv;
int _index;
index = e.Item.ItemIndex;
indiv = Convert.ToInt32(
(grd_associateSearch.DataKeys[e.Item.ItemIndex]).ToString());
</code></pre>
<p>I cannot get past the last line with an additional server control on the page and the code works flwlessly without it.</p>
| c# asp.net | [0, 9] |
1,984,469 | 1,984,470 | UserControl not rendering children when added to a page using aspx tag | <p>I must be missing a trick here. I have an <code>.aspx</code> page (that uses a master page, if that matters) with the following code in it:</p>
<pre><code><me:ModuleContainer runat="server" ID="topmodules"></me:ModuleContainer>
</code></pre>
<p>Now for some reason, my UserControl for <code>ModuleContainer</code> is called, all the properties on the control are called correctly, however it seems it just doesn't fill the control with the children in the <code>.ascx</code> file. Whereever I try to access them in the code (tried on Load and PreRender), the values are always null.</p>
<p>But it works if I programatically add it with the <code>LoadControl</code> method (but not just by declaring a new instance of <code>ModuleContainer</code>.</p>
<p>Ideally I'd like to get it working when loaded in the page. What am I doing wrong?</p>
| c# asp.net | [0, 9] |
5,036,427 | 5,036,428 | how do i add a selector change event to this? | <p>Here is my jquery which works great </p>
<pre><code>$(document).ready(function(){
$('#new_average, #max_occupancy').keyup(function(){
factor = $(".industry_picker option:checked").attr("title");
average = $('#new_average').val();
if($('#new_average').val().indexOf("$") != -1){
average = average.substring(1);
}
if($("#max_occupancy").val() != ""){
max_occupancy = $("#max_occupancy").val();
max_total = ((average * factor) * max_occupancy) * 30;
if(factor != ""){
$("#new_calc").val("$" + max_total + ".00");
}
}
});
});
</code></pre>
<p>but the problems is I need this to fire off on keyup and on </p>
<pre><code> $(".industry_picker")
</code></pre>
<p>changed ....i know I can copy this exact functionality over and have a </p>
<pre><code> $(".industry_picker").change
</code></pre>
<p>but i feel that is a hack...is there a better way of having the </p>
<pre><code>$('#new_average, #max_occupancy").keyup
</code></pre>
<p>and </p>
<pre><code>$(".industry_picker").change
</code></pre>
<p>in the same selector or a better way of achieving this without copying the entire function again</p>
| javascript jquery | [3, 5] |
775,409 | 775,410 | html row selection change with up/down key in j query | <p>I have html table like : </p>
<p><img src="http://i.stack.imgur.com/lCJku.jpg" alt="enter image description here"></p>
<p>Now I want to change row selection with up/down key & as well as scroll in j query/ java script .
Any one tell me how can it possible!</p>
| javascript jquery | [3, 5] |
1,309,553 | 1,309,554 | Error unterminated string literal when using php javascript? | <p>I have a file with format</p>
<pre><code><script src="test.php"></script>
</code></pre>
<p>And code in test.php with table test(id, name) with 4000 rows</p>
<pre><code><?php
$sql = "Select * From test";
$data = array();
$query = mysql_query($sql);
while($row = mysql_fetch_object($query)) {
$data[] = $row;
}
$str = '';
foreach($data as $row) {
$str .= $row->name;
}
?>
output('<?php echo $str ?>');
</code></pre>
<p>When I run code is error is <code>unterminated string literal</code>, but when repair code with
<code>$sql = 'Select * From test order by id limit 100'</code> is no error, how to fix it ?</p>
| php javascript | [2, 3] |
4,592,778 | 4,592,779 | How to get interest in programming especially in java and android | <p>I am new in this community. I just completed my Btech in Computer science, I have interest towards programming especially java. I started studying java but i am little bit slow in logic and understanding the concepts. I have some good books of java but when doing the program i am losing my confidence because of the logic issues. I have some doubts</p>
<ol>
<li>How can i improve my logical and coding skills</li>
<li>HOw to get real interest in programming.</li>
<li>Is there any shortcut for studying programming</li>
</ol>
<p>Please provide some suggestions as i knew this forum has lots of good programmers. Please share ur thoughts and how you people improving ur logics. </p>
<p>Any help is appreciated</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.