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 |
---|---|---|---|---|---|
2,194,596 | 2,194,597 |
Issue with a logical condition to find the value lies in which logical set
|
<p>We have a generic slider functionality implemented in our product. We need to read the item index value from URL and scroll the slider to show the active item. </p>
<p>Following code logic is used to show the active thumbnail and for that i need to animate the DIV to negative left. </p>
<p>First, we get the total thumbnail items and then index of active item from URL Hash Value (i.e. #slide=7). One set contains minimum of 5 items. Need to multiply the slider width to the page set value where ActiveItemIndex lies.</p>
<p>Javascript Code - </p>
<pre><code>showActiveThumbnailOnPageLoad : function() {
var _this = this,
totalThumbnails = $('.slidetabs a').length,
activeItem = window.location.href.split('=')[1],
scrollAmount;
if(activeItem > 5 && activeItem <= 10) {
scrollAmount = '-=' + 772
} else if(activeItem > 10 && activeItem <= 15) {
scrollAmount = '-=' + 772 * 2
} else if(activeItem > 15 && activeItem <= 20) {
scrollAmount = '-=' + 772 * 3
}
$('.slidetabs').stop().animate({
left : scrollAmount
});
}
</code></pre>
<p>As of now, hard code condition is used which support upto 20 items. Any help to make this code to support n number of items. I mean to say a generic code without hard code values.</p>
<p>Thanks in advance.</p>
|
javascript jquery
|
[3, 5]
|
5,435,612 | 5,435,613 |
ASP.NET Async jQuery and SetIsValid
|
<p>I have this code to check email availability - in JS script file <br>
When i use <br>
(async: false) and cntr.SetIsValid(false); <br>
IsValid action doesn't apply on cntr <br>
but If i use <br>
(async: true) and cntr.SetIsValid(false); <br>
IsValid action apply succesfully on cntr <br>
Why ?</p>
<p>I want to use async: false with cntr.SetIsValid</p>
<pre><code>function OnEmailValidation(s, e) {
var illegalChars = /^\w+([-+.'''']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
var spanEmail = document.getElementById("spanEmail");
var obj = GetObj('txt_Email');
var cntr = aspxGetControlCollection().Get(obj.id);
if (!illegalChars.test(e.value)) {
spanEmail.innerHTML = "Invalid Email";
spanEmail.style.color = "red";
cntr.SetIsValid(false);
} else {
$.ajax({
type: "POST",
async: false,
url: "myweb_service.asmx/CheckEmail",
data: "{'email':'" + e.value.toString() + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(res) {
if (res.d == "true") {
spanEmail.innerHTML = "Email register before";
spanEmail.style.color = "red";
cntr.SetIsValid(false);
}
if (res.d == "false") {
spanEmail.innerHTML = "Available";
spanEmail.style.color = "#76EB69";
cntr.SetIsValid(true);
}
}
});
}}
</code></pre>
|
javascript jquery asp.net
|
[3, 5, 9]
|
3,083,548 | 3,083,549 |
Wait for the execution of an async method to return
|
<p>I have a callback when a file is sent for upload, where I need to return <code>false</code> if I want to prevent the upload. I want to abort when the image size is not appropriate :</p>
<pre><code>onSend = function(data)
{
$.when(self._readImage(data[0])).then(function(img)
{
if (img.width > 42)
{
// onSend should return false
}
});
return true; // true == start uploading
}
</code></pre>
<p><strong>How can wait for <code>_readImage()</code> to execute before returning from <code>onSend()</code> ?</strong></p>
<p>note : <code>_readImage()</code> basically just does a <code>readAsDataURL()</code> with a deferred that is resolved in <code>img.onload()</code></p>
|
javascript jquery
|
[3, 5]
|
4,565,494 | 4,565,495 |
change ringvibrate pattern of mobile
|
<p>Hi all i want to change the default ring pattern of android and same i want to do for sms ring i want to change the pattern of smsring too please help</p>
<pre><code> protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btvib = (Button) findViewById(R.id.btvib);
vib = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
btvib.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
vib = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
}
}
});
</code></pre>
<p>i want to set this pattern to default ring pattern of android phone please can share any tutorial or give me any link so i can get this working</p>
|
java android
|
[1, 4]
|
749,712 | 749,713 |
Click handler fired only once
|
<p>I have a set of links that I iterate over and add click handlers. Each link when clicked, fires an ajax request which upon success creates a div containing response data, and appends it to the DOM. The newly appended div (a floating div similar to a small lightbox) however, is removed when the user clicks close(on the div) or clicks anywhere else on the screen. I have a simple script below to monitor this change, but the click handler fires only once and does not work until after a page refresh. What am I doing incorrectly?</p>
<pre><code>var monitorChange = function () {
//Check if div has been appended to the dom and if so continue to monitor it
if ( $('div.justappended').length > 0 )
{
setTimeout(monitorChange,100);
}
else
{
//div has been removed from the dom
alert('div removed');
//...do additional stuff here
}
};
$( 'span.someElements' ).each( function () {
var that = $(this);
$(that).click( monitorChange );
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,972,672 | 5,972,673 |
Why can't I call JS function from external file while function works if directly in head?
|
<p>I would like to be about to call a JS function from an external file in the following way:</p>
<p><code><div class="some_class" onlick="someFunction();"></div></code></p>
<p>Whenever I try this, I get 'ReferenceError: someFunction is not defined' in the console. If I put the function directly in the <code><head></code> of the page, it works.</p>
<p>If, instead of using <code>onclick</code>, I use </p>
<pre><code>$('.some_class').click(function() {...})
</code></pre>
<p>in the external file, it works too, so the error does not appear to be due to incorrectly referencing the external file.</p>
<p>Any thoughts on why this is happening?
Thanks for reading!</p>
|
javascript jquery
|
[3, 5]
|
4,369,611 | 4,369,612 |
how to change zIndex .dragndrop question
|
<p>first, have to look at this dragndrop (http://code.google.com/p/jquery-drag-and-drop/)</p>
<p>what i want to ask is , isit possible to add a ACTIVE "window" onClick???</p>
<p>example:</p>
<p>i got 3 window dragable, name drag1 , drag2 and drag3</p>
<p>drag1 zIndex="98"</p>
<p>drag2 zIndex="99"</p>
<p>drag3 zIndex="100"</p>
<p>when i click on the drag1, change the drag1 zIndex value to highest than all the other drag.</p>
<p>after that, </p>
<p>i click drag3, also change the drag3 zIndex value to highest than all the other drag.</p>
<p>also high than the drag1</p>
<p>example2:</p>
<p>set a ACTIVE drag onClick???</p>
|
javascript jquery
|
[3, 5]
|
3,698,166 | 3,698,167 |
Jquery - If DIV is shown //do something
|
<p>I have a slot machine plugin here that rotates UL's and shows one of them randomly.</p>
<p>I would like the shown UL to set a value.</p>
<p>Something like this:</p>
<pre><code>if ($("#1").is(":visible") == true) {
dial.setValue(8);
};
</code></pre>
<p>Hope you can help.</p>
<p>Thanks.</p>
|
javascript jquery
|
[3, 5]
|
2,829,447 | 2,829,448 |
How to access session from generic handler
|
<p>In ashx:
I'm putting data in list of entities & assinging it to session.</p>
<pre><code>context.Session["objList"] = myEntityCollection;
</code></pre>
<p>I want to get this Session through response; in code behind.
How it is achieved?</p>
<pre><code>context.Response.ContentType = ???
.....
context.Response.Write(context.Session["objList"]);
</code></pre>
|
c# asp.net
|
[0, 9]
|
4,480,887 | 4,480,888 |
C# .NET equivalent to PHP time()
|
<p>I am working with C# .NET and PHP and need some standard way of recording time between the two. I want to use seconds since 1970 = <code><?php echo time(); ?></code> because I'm already using some of php's cool functions like: date() & strtotime() in my project. Is there something in .net that is equivalent to PHP time()?</p>
<p>Thanks in advance.</p>
|
c# php
|
[0, 2]
|
4,165,689 | 4,165,690 |
Asp.net 2 buttons return same page with different data
|
<p>On my Ascx page ive got 2 buttons, those buttons redirect to same page atm. (because page should be exactly same). In Page_Load() method sender parameter doesnt have any parameters. How do i tell Page_Load event which button was clicked? so i can load different data depends on which button was clicked? </p>
<p>Are there any way to do it more dynamicly? or do i have to create a separate page for each button? </p>
|
c# asp.net
|
[0, 9]
|
1,226,502 | 1,226,503 |
Detecting referral url
|
<p>I can't detect referral url if user type url directly to browser or if he has some anti-virus or firewall which removes referral url. Is it possible to detect when user typed url directly in browser?</p>
|
php asp.net
|
[2, 9]
|
5,939,877 | 5,939,878 |
jQuery $ is not a function in Firefox, works in Chrome and works with $(document).ready()
|
<p>I'm implementing jQuery in a site and am getting the "$ is not a function" in Firefox when I try to use a selector, but $(document).ready() works perfectly right before it. My code looks like this</p>
<pre><code><script>
$(document).ready(function(){
alert("hi")
}); // Works fine
function showDiv(){
$("#traditionalCC").hide();
}
//Throws error
</script>
</code></pre>
<p>Does anyone know why this happens, and why it works in Chrome and Firefox.</p>
|
javascript jquery
|
[3, 5]
|
1,420,527 | 1,420,528 |
How can I abort a javascript function if a second call to it is made?
|
<p>Google has failed me (which probably means it can't be done).</p>
<p>Is there a way to kill a Javascript function if it's still running when it gets called again?</p>
<p>Situation is this. I have an HTML5 Android app which has a search function. As the user types, it searches the HTML5 database for matches. Each keystroke in the search box fires off a function to get suggestions. But because the user can type faster than the database engine can return suggestions on relatively slow devices (like my own, or indeed the emulator) subsequent keypresses get queued up, so that it can take a while for the suggestions to match what the user's typed.</p>
<p>So what I'd like to do is to find some way of killing off a previous invocation of the getSuggestions function if it's invoked again before finishing.</p>
<p>Easy enough to set a global which the function tests at various stages and aborts if it sees it, but that won't stop queries piling up in the database engine, which I'm guessing is probably where the blockage is occurring. Which is why I'm looking for some way to kill off the whole function.</p>
<p>Any suggestions gratefully received. Thanks.</p>
|
javascript android
|
[3, 4]
|
3,767,208 | 3,767,209 |
How to create widget to my android application?
|
<p>I created app in android it shows all the images,when user pressed the next button it show another image,if he pressed the previous button it show the previous image.Now i want to create widget to my app.</p>
<p>Will any one tell me the steps to do what i thought?
If you showed with sample code it helps me alot </p>
|
java android
|
[1, 4]
|
351,595 | 351,596 |
How to modify the HTML in Javascript and then read the changes in ASP.NET on the postback?
|
<p>This is a two-fer, and I've looked in a lot of places and could not put together a solution for this particular scenario.</p>
<p>I will have the user enter multiple values using a single text field, such as: </p>
<pre><code><div style="margin-left: 5px; display: block;">
<div id="divTemplateLine" style="display: none;">
<a href="javascript:" onclick="javascript: RemoveLine(this);">x</a>
</div>
</div>
</code></pre>
<p><img src="http://i.stack.imgur.com/XGZem.png" alt="enter image description here"> </p>
<p>Using Javascript, the Add button will keep cloning divTemplateLine and include the text within the parent node.<br>
I got all that working fine. </p>
<p>Now, I'd like to read all these lines (salmon, soup, miso, japanese) on the postback.<br>
I'm assuming at this point I'm in the realm of parsing HTML, since these div's I added are not "runat" server. </p>
<p>One answer could be using a server-run hidden value, where the Javascript will keep appending to it.. yes that's a good solution, but I'd like to see how I can parse out the HTML elements and nodes just as I did in Javascript, because my real scenario is more complicated than a single value, so a hidden value will not quite do.</p>
<p>Any input and/or judgment is welcome.</p>
|
c# javascript asp.net
|
[0, 3, 9]
|
4,377,560 | 4,377,561 |
Is there something more standard for handling "this" without making "that" reference to "this"
|
<p>I have some code here:</p>
<pre><code>App.prototype.binds = function(){
var that = this;
$('.postlist li').live('click', function(){ that.selectPost(this);} );
}
App.prototype.selectPost = function(){
this.function();
}
</code></pre>
<p>I am creating a reference of "this" as "that" in my binds function so in my selectPost(), I can use "this" to reference the App object instead of the list item.</p>
<p>Is there a more graceful/standard solution to this instead of using "that"?</p>
<hr>
<p><strong>With the Answer, my code becomes:</strong></p>
<pre><code>App.prototype.binds = function(){
$('.postlist li').live('click', $.proxy(this.selectPost, this) );
}
App.prototype.selectPost = function(e){
this.function(); // function in App
var itemClicked = e.currentTarget; //or
var $itemClicked = $(e.currentTarget);
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,163,050 | 4,163,051 |
Using jquery $.ajax on window.onerror in ie
|
<p>I got a script going on ff and chrome (don't care about safari) where when there is a javascript error it send an email.</p>
<p>It works on FF & chrome.</p>
<p>On ie8 I see the console.log or alert I added in the success of the ajax call but the call itself is never made, this makes me crazy that it actually goes into the success function</p>
<pre><code>window.onerror = function (msg, url, line) {
$.ajax({
type:"GET",
url:"jserrorhandler.php",
data:"message="+msg+"&url="+url+"&line="+line+'&from='+settings.from+"&website="+settings.website,
success: function(){
if(window.console) console.log("Report sent about the javascript error")
}
})
return true;
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
153,063 | 153,064 |
Object expected error
|
<p>My site is working perfectly in all browsers except the IE.
The error box is prompted when the page is load in IE with the error msg below:
Line: 227
Error: Object expected</p>
<p>when i start debugging, the error is from here below at the first line.</p>
<pre><code>$().ready(function()
{
// Hide all elements with .hideOnSubmit class when parent form is submit
$('form').submit(function()
{
$(this).find('.hideOnSubmit').hide();
});
});
</code></pre>
<p>Can anyone advice? it is really annoying to prompt that message on every page </p>
<p>============== EDIT ===============<br>
I have tried the advice below </p>
<pre><code>$(document).ready(function($)
{
// Hide all elements with .hideOnSubmit class when parent form is submit
$('form').submit(function()
{
$(this).find('.hideOnSubmit').hide();
});
});
</code></pre>
<p>OR</p>
<pre><code>jquery(function($)
{
// Hide all elements with .hideOnSubmit class when parent form is submit
$('form').submit(function()
{
$(this).find('.hideOnSubmit').hide();
});
});
</code></pre>
<p>But both also give me the same error.</p>
|
javascript jquery
|
[3, 5]
|
350,766 | 350,767 |
Difference between HtmlGenericControl and TagBuilder
|
<p>This is more or less the same as this question,
<a href="http://stackoverflow.com/questions/3043800/difference-between-htmltable-and-tagbuildertable">Difference between HtmlTable and TagBuilder("table")</a> and
<a href="http://stackoverflow.com/questions/3043654/why-use-tagbuilder-instead-of-stringbuilder">Why use TagBuilder instead of StringBuilder?</a> </p>
<p>but I want to know that we when you do not have a .Net class for an HTML tag (like iFrame) in System.Web.UI.WebControls and System.Web.UI.HtmlControls then what to use?</p>
<p>@Edit: Can somebody tell me the difference between TagBuilder and HtmlGenericControl ?</p>
|
c# asp.net
|
[0, 9]
|
2,060,181 | 2,060,182 |
Using jQuery.each() to manipulate the elements of an Array/Object in place
|
<p>Playing around with JavaScript and jQuery over here. Making a function that produces timestamps. </p>
<p>I've got the following code:</p>
<pre><code>var timestamp = function () {
var now = new Date();
var components = [now.getHours(), now.getMinutes(), now.getSeconds()];
components.zero_pad = function(index, component) {
// When this function is called with `$.each()` below,
// `this` is bound to `component`, not `components`.
// So, this code fails, because you can't index a Number.
this[index] = (this[index].toString().length == 1) ?
'0' + component : component;
}
// Offending line
$.each(components, components.zero_pad);
return components[0] + ':' + components[1] + ':' + components[2];
};
</code></pre>
<p>This code fails, because, <code>$.each()</code> binds the callback to the element it's working on rather than the iterable, as such:</p>
<pre><code>// from jQuery.each()
for ( ; i < length; i++ ) {
// I would have guessed it would be
// value = callback.call( obj, i, obj[ i ] );
// but instead it's:
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
</code></pre>
<p>Now, to get the binding I want, I can change the offending line in my code to:</p>
<pre><code>$.each(components, $.proxy(components.zero_pad, components));
</code></pre>
<p>but here I invoke even more framework code and this is starting to look quite messy.</p>
<p>I feel like I'm missing something! Is there a simpler way to modify the contents of an array in place?</p>
|
javascript jquery
|
[3, 5]
|
4,069,834 | 4,069,835 |
Open local file from a web page using link in gridview c#
|
<p>I need to open a some types of files like .jpg, word, .pdf
when the user clicks on link in gridview. Right now i am using
this code and its not opening up. </p>
<p>It is a web application and i have to open the file which is present
in the local drive of user. I would be binding the path of file in NavigateUrl property
of the hyperlink</p>
<pre><code><asp:hyperlink ID="HyplnkName" runat="server" NavigateUrl= '<%# ConfigurationManager.AppSettings["ImagesFilePath"]) %>' Target="_top" Text='<%# DataBinder.Eval(Container, "DataItem.FileName") %>' />
</code></pre>
|
c# asp.net
|
[0, 9]
|
115,143 | 115,144 |
Find controls being rendered in master page at runtime
|
<p>I have a master page which has a number of controls on it both from the content page and the master page itself. All these controls extend System.Web.UI.UserControl and some implement an interface called IControlInjector.</p>
<p>When the master page loads, is there any way I can check in the master page what controls are being loaded in the control tree and find all those that implement the IControlInjector interface? </p>
|
c# asp.net
|
[0, 9]
|
2,877,797 | 2,877,798 |
why jquery/javascript code get conflict with other jquery/javascript?
|
<p>While using jquery or javascript code most of the time i have to face the problem of jquery or javascript conflict.</p>
<p>Still i haven't got the reason why this stuff get conflict with other code?</p>
<p>Any one have any idea about this?</p>
<p>And any solution so that next time this issue will not occur while project development.</p>
<p>I have one solution to stop the conflict of jquery files that is,</p>
<pre><code> <script>
var j$=jQuery.noConflict();
</script>
</code></pre>
<p>but all the time this code is not working.</p>
|
javascript jquery
|
[3, 5]
|
4,201,838 | 4,201,839 |
asp net javascript Cache clear
|
<p>I have a website that i did some time ago now they request some new features and i did some changes in some javascript files, but when i publish the clients that use the IE have problems with cache so in they browser they have old version of javascript. How can i clear the client cache so when they visit website they use latest javascript files that i modify.</p>
|
c# asp.net javascript
|
[0, 9, 3]
|
1,545,478 | 1,545,479 |
Is there really no way to programmatically click a link using PHP?
|
<p>I have been trying for a while now trying to figure out how to programmatically click a link using PHP and/or javascript. I have it setup so if the user clicks a link it will refresh a table. You don't really need to know why I want to do this b/c then it will go down a whole long road of confusion. Just know that there is a link to be clicked and I really really want to programmatically click that link using PHP and/or javascript. </p>
<p>Is there really no way to do this?</p>
<p>Edit: The code where I need to put the auto-click is in PHP, which would have to create and trigger some javascript or jquery or whatever.</p>
<p>Edit 2: Ok, now that you're all confused ... the real problem is that I have a Drupal form that has a property set to use AJAX when submitting. So the submission is done using the jquery plugin that is a module for Drupal. The AJAX setting is just an attribute setting and I do not have access to the underlying code that goes along with the submission of the form. Which forces me to have to refresh the table after the button is clicked. I really wish I could just attach the refreshing to the button click event for the submit of the form. But since I don't have access to that code I don't believe it's possible.</p>
|
php javascript
|
[2, 3]
|
387,585 | 387,586 |
Android parse KML file for time
|
<p>I've been trying to work out how to obtain the travel time between two locations (walking, driving etc...).</p>
<p>As I understand it, the only way to do this accurately is by retrieving a KML file from google, then parsing it.</p>
<p>Research has shown that it then needs to be parsed with SAX. The problem is, I can't seem to work out how to extract the correct variables (the time). Does anybody know if / how this can be done?</p>
<p>Many thanks for your help,</p>
<p>Pete.</p>
|
java android
|
[1, 4]
|
1,173,679 | 1,173,680 |
Replay on BG Music
|
<p>I made a service that play background music, but when the music finished I want to replay it again. Which method can I use in my service?</p>
<pre><code>public class BackgroundSoundService extends Service {
private static final String TAG = null;
MediaPlayer player;
public IBinder onBind(Intent arg0) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
player = MediaPlayer.create(this, R.raw.idil);
player.setVolume(100,100);
}
public int onStartCommand(Intent intent, int flags, int startId) {
player.start();
return 1;
}
public void onStart(Intent intent, int startId) {
// TODO
}
public IBinder onUnBind(Intent arg0) {
// TODO Auto-generated method stub
return null;
}
public void onStop() {
}
public void onPause() {
}
@Override
public void onDestroy() {
player.stop();
player.release();
}
@Override
public void onLowMemory() {
}
}
</code></pre>
|
java android
|
[1, 4]
|
908,925 | 908,926 |
transfer data from received email to an app on android
|
<blockquote>
<p>I am creating an app that emails data to contacts and want to, on a user's click, copy data to a live app on the receivers phone.</p>
<p>can this be done?</p>
</blockquote>
|
java android
|
[1, 4]
|
5,503,574 | 5,503,575 |
Jquery event chaining
|
<p>Based on this <a href="http://stackoverflow.com/questions/451491/what-is-the-best-way-to-emulate-an-html-input-maxlength-attribute-on-an-html-text">question</a></p>
<p>I don't want to litter my ready stuff waiting for a "click event" AND a "change event" AND a "mouseover event" I want to have all that stuff in a single function or event.</p>
<p>Is is possible to chain the events together. I want to capture not only a keyup, but also a click or a change in case the user isn't on the keyboard.</p>
<pre><code><script language="javascript" type="text/javascript">
$(document).ready( function () {
setMaxLength();
$("textarea.checkMax").keyup(function(){ checkMaxLength(this.id); } );
$("textarea.checkMax").mouseover(function(){ checkMaxLength(this.id); } );
});
</script>
</code></pre>
<p>This works</p>
<pre><code>$(document).ready( function () {
setMaxLength();
$("textarea.checkMax").bind("click mouseover keyup change", function(){checkMaxLength(this.id); } )
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,780,074 | 1,780,075 |
how can i get the value of the loop both text fields and hidden fields in php using jquery
|
<p>How can I get the values of each input field (both hidden and visible) using jQuery?</p>
<pre><code><?php
$date = date('m-d-Y');
$ts = strtotime($date);
$year = date('o', $ts);
$week = date('W', $ts);
for($i = 1; $i <= 7; $i++) {
?><td><?php
$ts = strtotime($year.'W'.$week.$i);
?><input type="text" name="days" id="days" />
<input type="hidden" name="date_now" id="date_now" value="<?php print date("Y-m-d", $ts); ?>" />
</td><?php
}
?>
</code></pre>
|
php jquery
|
[2, 5]
|
4,469,682 | 4,469,683 |
Difference of definition of function in javascript/jQuery
|
<p>version 1: </p>
<pre><code>function add(){
var a = 2;
...
...
...
}
</code></pre>
<p>version 2: </p>
<pre><code>$(function(){
var ...
..
..
});
</code></pre>
<p>Where is the main difference of two versions? For version 2, it does not have the function name. If it just simply run the code in the function, why not just remove the <code>$function(){..};</code>. It really makes me confusing because nowadays, many scripts are written in style of version 2. Please help to clarify my confusion. </p>
|
javascript jquery
|
[3, 5]
|
5,507,107 | 5,507,108 |
toggle two images on click
|
<p>I'm trying to use someone's code from an earlier post that I posted on here, and in it, he provided a <a href="http://jsfiddle.net/D9VvV/" rel="nofollow">jsFiddle</a> that shows how to toggle between two images.</p>
<p>I'm trying to replicate exactly what that person is doing, but it doesn't seem to work on my code:</p>
<pre><code><!DOCTYPE html>
<html>
<head>
<script src="jquery.js"></script>
<script>
$('#ellomatey').toggle(
function(){
$(this).attr('src', 'bgimage.png');
},
function(){
$(this).attr('src', 'redsquare.png');
});
</script>
</head>
<body>
<img id="ellomatey" src="bgimage.png" />
</body>
</html>
</code></pre>
<p>Does anyone know what I'm doing wrong? I have a feeling that it's not calling the function correctly, but it seems to work on that person's example.</p>
|
javascript jquery
|
[3, 5]
|
459,301 | 459,302 |
Change value of Onclick function vars
|
<p>I have the onClick function attached to a button. I want to be able to change the function var from 'create' to 'update' on the page load and through other functions. I have tried the code below but no luck.</p>
<pre><code><input type="button" name="save_customer" id="save_customer" value="Save" onClick="customer_crud('create')" />
var js = "customer_crud('read')";
// create a function from the "js" string
var newclick = new Function(js);
// clears onclick then sets click using jQuery
$("#save_customer").attr('onClick', '').click(newclick)
</code></pre>
<p>Any ideas.</p>
<p><strong>UPDATED</strong></p>
<p>Ok in a nutshell i want to change the attr onClick like you would change the attr name & type.</p>
<pre><code><input type="button" name="save_customer" id="save_customer" value="Save" onClick="customer_crud('create')" />
</code></pre>
<p>to</p>
<pre><code><input type="button" name="save_customer" id="save_customer" value="Save" onClick="customer_crud('update')" />
</code></pre>
<p>Thanks</p>
|
javascript jquery
|
[3, 5]
|
3,928,214 | 3,928,215 |
Stop MediaScanner scanning of certain directory
|
<p>Is there a way to notify MediaScanner service on Android platform not to scan certain directories? I have application that encrypts images on SD card and after I do that MediaScanner goes wild in LogCat (writing out "not JPEG" exception... and there are time I have over 1000 pics in directory).</p>
<p>Thanks</p>
|
java android
|
[1, 4]
|
2,311,359 | 2,311,360 |
Could someone explain what this line does?
|
<p>In this blog:
<a href="http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/" rel="nofollow">http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/</a></p>
<p>It is one line <code>this.getReadableDatabase();</code>, I don't understand what it does, but if I remove it from my code it stops working.</p>
<pre><code>/**
* Creates a empty database on the system and rewrites it with your own database.
* */
public void createDataBase() throws IOException{
boolean dbExist = checkDataBase();
if(dbExist){
//do nothing - database already exist
}else{
//By calling this method and empty database will be created into the default system path
//of your application so we are gonna be able to overwrite that database with our database.
this.getReadableDatabase();
try {
copyDataBase();
} catch (IOException e) {
throw new Error("Error copying database");
}
}
}
</code></pre>
|
java android
|
[1, 4]
|
1,783,500 | 1,783,501 |
When to use JavaScript in ASP.NET?
|
<p>I am a beginner in ASP.Net. We have Validation Controls in ASP.Net. But I want to know, In which scenarios we need to use JavaScript?</p>
|
javascript asp.net
|
[3, 9]
|
5,281,438 | 5,281,439 |
How to catch asp.net textbox1.text via jquery
|
<p>net textbox control. so I try to catch via jquery. but I cant. How can I do this. Thanks...</p>
|
javascript jquery
|
[3, 5]
|
5,822,307 | 5,822,308 |
The simplest way to allow a web user to update a text file using PHP and Javascript?
|
<h2><strong>Problem:</strong></h2>
<p>I dont know the simplest way to allow a single web viewer to <em>update data</em> in a text file on a server. (ie. only 1 person will be changing the data.)</p>
<h2><strong>Objective:</strong></h2>
<p>To make a prototype web application just <em>one person needs to input</em> in the start and end dates of new assignments and locations of staff and the whole company can visualize the information on a GANTT chart, probably using <a href="http://plugins.jquery.com/project/ganttView" rel="nofollow">this Jquery libary.</a></p>
<h2><strong>Contraints:</strong></h2>
<ol>
<li><p>My data is about the equivalent size of 1000 of these javascript list of lists like </p>
<p><em>data = [["John Smith" , "assigment" , "1/1/10", "1/1/11", "Peru"],[...],...]</em> </p></li>
<li><p>Employee assignment data must be on an internal server.</p></li>
<li><p>I can't use a database (such as SQlite or MySQL).</p></li>
<li><p>I can only use PHP, Javascript, and Jquery. </p></li>
<li><p>Fact: <a href="http://stackoverflow.com/questions/585234/how-to-read-and-write-into-file-using-javascript">Javascript cant directly change a data file sitting on the server.</a> </p></li>
</ol>
<h2><strong>My Tentative Fuzzy Solution:</strong></h2>
<p><strong>On client-side:</strong> use jqeury <code>getJSON()</code> to pass the data back and forth between <code>dataReadWriter.php</code>.</p>
<p><strong>On server-side:</strong> <code>dataReadWriter.php</code> modifies a PHP <code>array</code> as well as writes modified data and reads <code>JSONdata.txt</code> stored in a text file on our internal server. </p>
|
php javascript jquery
|
[2, 3, 5]
|
2,366,435 | 2,366,436 |
How can a new object of Activity for each notification?
|
<p>I have code for creating notification:</p>
<pre><code> NotificationManager notifyMngr=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification=new Notification(mId, "New alert!", System.currentTimeMillis());
Intent alert = new Intent(this, AlertInfoActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, alert, 0);
notification.setLatestEventInfo(this, data.get("name"), data.get("post_date"), contentIntent);
notifyMngr.notify((int) System.currentTimeMillis(), notification);
</code></pre>
<p>I need to create a few notifications, and each notification must execute a new object of AlertInfoActivity by click. But this code executes 1 object of Activity always. How can I do my task? </p>
|
java android
|
[1, 4]
|
1,555,265 | 1,555,266 |
converting class file to jar file using c++
|
<p>Is it possible to convert <code>.class</code> file to <code>.jar</code> file using c++ code?</p>
<p><strong>(i.e can we write a code in c++ that when executed converts given .class file to .jar file)</strong></p>
<p>If yes,how can i do that?</p>
|
java c++
|
[1, 6]
|
1,620,718 | 1,620,719 |
Picking an element within a DIV with JQuery
|
<p>I have an HTML page with a variety of divs on it. For instance, something like this:</p>
<pre><code><div id="myDiv1">
<input id="myInput1" type="text" />
<input id="myInput2" type="text" />
<input id="myButton" type="button" value="Button" />
</div>
<div id="myDiv2">
<!-- My Content -->
</div>
</code></pre>
<p>How do I use JQuery to:</p>
<ol>
<li>Get ALL input fields of type text within myDiv1</li>
<li>Get a single input field inside of a div</li>
</ol>
<p>Traditionally, I would use the following:</p>
<pre><code>var textFields = $(":text");
var myInput = $("#myInput1");
</code></pre>
<p>However, I would really like to understand how to search within a single DIV element.</p>
<p>Thank you so much!</p>
|
javascript jquery
|
[3, 5]
|
4,050,641 | 4,050,642 |
Redirect to url then again redirect to main url
|
<p>I know it is really confusing. Let me explain:</p>
<p>I want to open the urls on my site (http://domain.com) to a (http://domain.com/url='the submitted url') and then the submitted url is opened.</p>
<p>Eg: When we open any other site link from Google+ let the example</p>
<p><a href="http://www.youtube.com/watch?v=WRpX7tkwejU" rel="nofollow">http://www.youtube.com/watch?v=WRpX7tkwejU</a></p>
<p>it redirects to </p>
<p><a href="http://plus.url.google.com/url?sa=z&n=1333340186022&url=http://www.youtube.com/watch?v=WRpX7tkwejU&usg=whZv4BO7Gcrco_vivlnhaz27Wpk." rel="nofollow">http://plus.url.google.com/url?sa=z&n=1333340186022&url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DWRpX7tkwejU&usg=whZv4BO7Gcrco_vivlnhaz27Wpk.</a></p>
<p>and then the original site is opened. I want some thing similar.</p>
|
php javascript
|
[2, 3]
|
2,821,763 | 2,821,764 |
meaning of this jquery code
|
<p>I posted a question <a href="http://stackoverflow.com/questions/3560381/next-not-working">http://stackoverflow.com/questions/3560381/next-not-working</a> and gota reply which is working fine, but can somebody explain me what exactly is going on here:</p>
<pre><code>$(this).closest('tr').next('tr').find("img.cc").toggle()
.closest('tr').siblings('tr').find("img.cc").hide();
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,221,529 | 3,221,530 |
Managing sessions between different servers
|
<p>How are session of same user maintained when a load balancer is used with different web servers at backend . In other words lets suppose there is a load balancer to distribute load between different servers and a user is directed to one server where its session is stored and then next time the same user is directed to second server. How does servers know if it is same user ? how to maintain it that it was the same user on both servers</p>
|
php asp.net
|
[2, 9]
|
5,745,327 | 5,745,328 |
C# calling a Java web service with a Calendar parameter
|
<p>I'm writing a C# desktop client that needs to call a web service written in Java. Two of the parameters are of type Calendar. I'm having great difficulty in trying to pass these two dates to the web service.</p>
<p>I've tried the following ways, all without success.</p>
<pre><code>DateTime startDate = DateTime.Now;
DateTime endDate = startDate.AddDays(2);
DateTime startDate = new DateTime(2012, 3, 1, 1, 1, 1, DateTimeKind.Unspecified);
DateTime endDate = new DateTime(2012, 4, 1, 1, 1, 1, DateTimeKind.Unspecified);
DateTime startDate = new DateTime(2012, 3, 1, 1, 1, 1, DateTimeKind.Utc);
DateTime endDate = new DateTime(2012, 4, 1, 1, 1, 1, DateTimeKind.Utc);
DateTime startDate = new DateTime(2000, 1, 1, new System.Globalization.GregorianCalendar());
DateTime endDate = new DateTime(2012, 1, 1, new System.Globalization.GregorianCalendar());
</code></pre>
<p>I wrote a test Java client using the following code and this works...</p>
<pre><code>GregorianCalendar calStartDate = new GregorianCalendar();
GregorianCalendar calEndDate = new GregorianCalendar();
calStartDate.set(2011, 5, 21);
calEndDate.set(2012, 5, 24);
XMLGregorianCalendar startDate = dtf.newXMLGregorianCalendar(calStartDate);
XMLGregorianCalendar endDate = dtf.newXMLGregorianCalendar(calEndDate);
</code></pre>
<p>Any suggests as to how I can pass a Calendar parameter from C#?</p>
<p>Thanks!</p>
|
c# java
|
[0, 1]
|
3,760,974 | 3,760,975 |
Accessing android.os.Debug methods in javascript
|
<p>I would like to access some of the static methods in the <a href="http://developer.android.com/reference/android/os/Debug.html" rel="nofollow">Debug class</a>; part of the android.os package.</p>
<p>However, when I include calls to these functions javascript gives me a undefined ReferenceError; it cannot find the android package.</p>
<p>How do I set the search path for java packages in javascript?</p>
|
java javascript android
|
[1, 3, 4]
|
2,254,415 | 2,254,416 |
Can I get repeater item count in the javascript script method?
|
<p>I have one requirement. I have a repeater in the usercontrol and devexpress button in the parent view. I'm calling clientsideevents from the button like below:</p>
<pre><code> <dx:ASPxButton ID="btnNextStep" runat="server" Text="Proceed to Step 2" AutoPostBack="False" UseSubmitBehavior="False">
<clientsideevents click="function(s, e) {
{ ToggleActive(); } }" />
<Image Url="~/next.png" />
</dx:ASPxButton>
</code></pre>
<p>Now I want to put some check in the ToggleActive() method like if repeater doesn't have any item then it should not goes to next step and show an alert like you don't have any item in the respective repeater. My question is like how to get the total item count in the JavaScript method ToggleActive();</p>
|
c# javascript jquery asp.net
|
[0, 3, 5, 9]
|
5,595,949 | 5,595,950 |
How to attach this listener in an activity
|
<p>I was wondering how do i attach this(OnGenericMotionListener) listener inside an activity. Do i have to register it to each view? thanks</p>
<p>note: please provide code.</p>
|
java android
|
[1, 4]
|
4,532,739 | 4,532,740 |
Disable fadein animation
|
<p>I am trying to create a splash screen for my app. The problem is it first renders empty layout with default title bar and then fades in my image.</p>
<p>This is all I have <code>onCreate</code></p>
<pre><code>super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.setContentView(R.layout.activity_splash);
</code></pre>
<p>Attempted solution from <a href="http://stackoverflow.com/questions/6972295/switching-activities-without-animation">switching activities without animation</a></p>
<p>Also tried to set window attributes</p>
<pre><code>WindowManager.LayoutParams lp = this.getWindow().getAttributes();
lp.windowAnimations = lp.windowAnimations | android.R.attr.windowDisablePreview;
this.getWindow().setAttributes(lp);
</code></pre>
<p>neither made any visible difference.</p>
|
java android
|
[1, 4]
|
916,121 | 916,122 |
replaceWith but permanent - another way to store
|
<p>I have a div which I update with a count of contents of a shopping cart - when a user adds to the cart, i count the number of lines, then update the div to say e.g. 2 Lines</p>
<p>I currently use:</p>
<pre><code><script type="text/javaScript">
$(document).ready(function(){
$("#lines2").replaceWith($('#lines').html());
});
</script>
</code></pre>
<p>I use replace with as I say "0 Items" at the start of a user session.</p>
<p>All works great apart from when user leaves the cart page, the div then changes back to 0 Items - is there a way to rewrite a div more permanently?</p>
<p>I know its a hack but its a favour for a favour thingy!</p>
|
javascript jquery
|
[3, 5]
|
1,279,466 | 1,279,467 |
How to prevent page reload after alert box on key down event?
|
<p>I want to prevent page reload after clicking ok on alert box. click search button is ok. But now I meet problem in enter key down event. Someone help me please.</p>
<p>This is my html</p>
<pre><code><div id="email">
<input type="text" id="txtSearchEmail" name="email" onkeydown="Javascript: if (event.keyCode==13) {JS_Search(); event.preventDefault();}" style="width: 161px; height: 16px; padding: 2px; border: 1px solid #a8a8a8; font-size: 13px; color: #434343" />
</div>
<div id="search">
<a class="gai-button" style="width: 96px; height: 25px;" onclick="JS_Search();"><img src="images/findamessage_search.jpg" alt="" /></a>
</div>
</code></pre>
<p>This is my javascript </p>
<pre><code>if() {
//some coding
}
else {
alert ("Not found!");
return false;
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,110,711 | 5,110,712 |
validation not working for js
|
<pre><code><html>
<head>
</head>
<body>
<form class="form-horizontal cmxform" id="validateForm" method="get" action="../../course_controller" autocomplete="off">
<input type="text" id="course_name" name="course_name" placeholder="Enter Course Name..." class="row-fluid" required onkeyup="javaScript:validate_course_name();">
<label id="course_name_info" style="color:rgba(255,255,255,0.6);font-size:13px">
</label>
<button type="submit" name="user_action" value="add" class="btn btn-primary" onClick="javaScript:validate();" >Save</button>
<button type="reset" class="btn btn-secondary">Cancel</button>
</form>
<script type="text/javascript">
/**** Specific JS for this page ****/
//Validation things
function validate_course_name(){
var TCode = document.getElementById('course_name').value;
if( /[^a-zA-Z1-9 _-]/.test( TCode ) ) {
course_name_info.innerHTML="Please Enter Only Alphanumeric or _,-,' ' ";
return false;
}
else
{
course_name_info.innerHTML=" ";
return true;
}
}
function validate(){
validate_course_name();
}
</script>
</body>
</html>
</code></pre>
<p>So this the code ...I am applying alpha numeric validation on one field but even if i give invalid input like some other characters the form is getting submitted where am i doing it wrong?
i am very new to this web so any help will be appreciated:)</p>
|
javascript jquery
|
[3, 5]
|
240,393 | 240,394 |
Getting error Uncaught TypeError: string is not a function
|
<p>I'm using this code here for a webpage I'm fooling around with:</p>
<pre><code>$(function() {
console.log('Here');
$.ajax({
type: 'POST',
url: 'http://api.bf3stats.com/pc/playerlist/',
data: {
players: ['xxx', 'xxxx', 'x']
},
success: function(data) {
loadData(data, 'x', 'f');
}
})
})
function loadData(data, uname, $) {
$('#fWins').text("135");
}
</code></pre>
<p>But once it hits the <code>loadData</code> function I get the error:</p>
<pre><code>Error: Uncaught TypeError: string is not a function
</code></pre>
<p>I'm absolutely clueless as to why this is giving me so much problems. Thanks in advance!</p>
<p>Thanks problem was me using $, I don't use jQuery often, only for when i need cross browser compatibility. Thanks for this, will mark Answered when timer is up</p>
|
javascript jquery
|
[3, 5]
|
547,540 | 547,541 |
How can i keep the selected tab selected even after postback
|
<p>I have some listed tab controls on my aspx form which is as below</p>
<pre><code> <div id="tabs">
<ul>
<li><a href="#tabs-1">Tab A</a></li>
<li><a href="#tabs-2">Tab B</a></li>
<li><a href="#tabs-3">Tab C</a></li>
</ul>
<div id="tabs-1"></div>
<div id="tabs-2"><asp:Button ID="someid" runat="server"/></div>
<div id="tabs-3"></div>
</div>
</code></pre>
<p>The navigation on mouse click on a tab is done by the following:</p>
<pre><code> <script type="text/javascript">
$(function () {
$("#tabs").tabs();
});
</script>
</code></pre>
<p>Now, my question is, How can i maintain the selected tab as it is even after postback.
For Example, I select Tab B that contains a Button which causes a postback on click.
After the postback occurs Tab A regians the foucs and i have to manually select Tab B for adjuvent operations.</p>
<p>Please help me to solve this problem.</p>
|
c# jquery
|
[0, 5]
|
5,286,429 | 5,286,430 |
How make jquery loop over with number
|
<p>I am trying to assign a number to my variable i.e. colorswap1, colorswap 2, colorswap 3</p>
<p>I have the following</p>
<pre><code>var i = 1-36;
// Get current image src
var curSrc = $('#colorswap'[i]).attr('src');
</code></pre>
<p>It doesn't seem to be putting the desired: colorswap1, colorswap2</p>
|
javascript jquery
|
[3, 5]
|
5,520,186 | 5,520,187 |
clear all ASP label fields
|
<p>I am trying to clear all the fields in my .aspx page using javascript (<em>Should be cross-browser</em>). The below code is working fine for <code>TextBox</code> fields but not for <code>Label</code> fields.</p>
<pre><code>var elements = document.getElementsByTagName("input");
for (var i = 0; i < elements.length; i++) {
if (elements[i].type == "text") {
elements[i].value = "";
}
else if (elements[i].type == "label") {
elements[i].value = "";
}
}
</code></pre>
<p>Later I saw that HTML is rendering asp.net Labels as <code>span</code> so I also tried:</p>
<pre><code>else if (elements[i].type == "span") {
elements[i].innerHTML = "";
}
</code></pre>
<p>Still the Labels are not being cleared. Am I doing something wrong here?</p>
<p>And the other problem is, whenever I refresh the page, the cleared <code>TextBox</code> fields are again being populated with the old values.. (really frustrating)</p>
<p>I am trying the above code by referring <strong><a href="http://stackoverflow.com/q/569357/1577396">this</a></strong></p>
<p>Please help.</p>
|
javascript asp.net
|
[3, 9]
|
4,487,402 | 4,487,403 |
Using variables between if/else in Android
|
<p>I am developing a small app while learning Android.</p>
<p>The app is basically making a series of simple math calculations. A button is calling a function where the calculations take place. Everything was working fine, until I inserted an if/else construct.</p>
<p>Inside this construct, I am using variables created before, making calculation and setting other variables with this</p>
<pre><code>if (TS>Ex) {
Double AE = 0.00;
} else {
Double AE = (Ex-TS);
};
Double TBTAT = (TS-Ex);
Double Exx = 2864.17;
if (TBTAT>Exx) {
Double TAT = (Exx*0.2);
} else {
Double TAT = (TBTAT*0.2);
};
</code></pre>
<p>I have two of these if/else structures.</p>
<p>Then everything is collected and sent to a Text</p>
<pre><code>IT_ResultTXT.setText(Double.toString(AE+TAT+TAF));
</code></pre>
<p>In normal conditions, AE, TAT, TAF turn out to "cannot be resolved to a variable" in this last line of the code, but if I declare them at the beginning of the function, I have an error of duplicated variables.</p>
<p>I suppose is a very stupid basic Java programming error, but I cannot find a solution to this.</p>
|
java android
|
[1, 4]
|
4,462,691 | 4,462,692 |
Fancybox page anchors
|
<p>Is it possible to use page anchors (http://mysite.com/page.php#jump_to) in Fancybox and if so how?</p>
<p>I have tried like you normally do with a normal HTML page, where it works, but it doesn't work in Fancybox.</p>
|
php javascript
|
[2, 3]
|
2,536,660 | 2,536,661 |
store id and transfer to another php page
|
<p>I have a little question.
On my site i use for few jquery functions , they get some data and transfer by GET method to php helper. This is not work when i want to use the data in another php page. For example i have jquery that store id of the anchor:</p>
<pre><code>$("#rightContent .users_list li a").live('click', function() {
var id = $(this).attr('id');
$.get("getHelper",{'userId':id},function(data){
$('#user_rightContent').html(data);
});
});
</code></pre>
<p>And in php file returned by "getHelper" i do:</p>
<pre><code>if(isset($_GET['userId'])){
$id = $_GET['userId'];
//do something
);
</code></pre>
<p>The anchor of the live click lead to another page displayed by another php file where i want to use this id by using helper... This is work only if i stay on same page...
Can anybody help me in this problem?
thanks for advice</p>
|
php javascript jquery
|
[2, 3, 5]
|
4,878,947 | 4,878,948 |
How to download/print specific portion of a page using php
|
<p>I have an HTML page as follows</p>
<pre><code>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type specimen book.
<table>
<th>WEEK</th>
<th>DATES</th>
<th>Workout #1</th>
<th>Workout #2</th>
<th>Workout #3</th>
<tr>
<td>1</td>
<td>3/27-4/2</td>
<td>Warm up for 5 minutes. </td>
<td>Same as #1 for this week.</td>
<td>Same as #1 for this week.</td>
</tr>
<tr>
<td>2</td>
<td>4/3-4/9</td>
<td>Warm up for 5 minutes. </td>
<td>Same as #1 for this week.</td>
<td>Same as #1 for this week.</td>
</tr></table>
</code></pre>
<p>How can make only the table downloadable and printable using php and/or javascript.</p>
|
php javascript
|
[2, 3]
|
5,795,072 | 5,795,073 |
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]
|
944,629 | 944,630 |
triggering the same function, from 2 different click events, with and without parameters
|
<p>I have a function <code>myFunc</code> that can be triggered 2 different ways: by clicking div1 or div2. </p>
<ul>
<li>If the click came from div2, I'd like to pass some parameters to the function at the time of the call. </li>
<li>Also, in both cases, I need a reference to the item that was clicked: <code>$(this)</code>.</li>
</ul>
<p>I've tried this code, but the second version (where I'm passing the parameters) gets triggered automatically even without me clicking anything. What am I doing wrong, and do I need to pass <code>this</code> as a parameter in both cases?</p>
<pre><code>$('#div1').live('click', myFunc);
$('#div2').live('click', myFunc('param1 value', 'param2 value'));
function myFunc(param1, param2){
console.log('inside myFunc');
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,932,312 | 4,932,313 |
ASP.NET - How to postback a page after a file download?
|
<p>Here my situation :</p>
<p>The user click on a LinkButton, and the page does a PostBack. But I also need to prompt a file download to the user at the same time.</p>
<p>In order to do that, I did this on the LinkButton</p>
<pre>
lnkPrint.Attributes.Add("onclick", "window.open('Download.ashx?type=x')");
</pre>
<p>The <strong>Download.ashx</strong> Http Handler generates the file (Content-Type : <strong>application/pdf</strong>), and if I click on my LinkButton, it does PostBack and download the file after showing a popup... But I can't manage to close this popup automatically.</p>
<p>I tried some methods </p>
<ul>
<li>settimeout('self.close()',1000) after the download</li>
<li>Setting a RegisterStartupScript on the LinkButton.Command, to trigger the download after the postback, but IE6 prompts a warning that disturbs my users </li>
</ul>
<p>So, none of these methods seems to work fine.</p>
<p>So, my question is : Is there a way to make the popup instantly disappear, or is there a means to make the page download the file <strong>AND</strong> postback at the same time ?</p>
<p>PS : I thought of the <strong>Your download will begin shortly</strong> method, but I'm afraid I'll have the same issues as before with the RegisterStartupScript...</p>
|
c# javascript asp.net
|
[0, 3, 9]
|
1,631,367 | 1,631,368 |
Is modern C++ replacing C#? Is Microsoft pushing developers to adopt C++?
|
<p>I hear about modern C++ popularity and some talks about migrating back to C++ from C# or other C-like languages.</p>
<p>I know about C++11 features but I would like to hear your experiences, especially from developers who migrated from C# to C++. </p>
<p>More importantly, does Microsoft push developers to use C++? If yes, why?</p>
|
c# c++
|
[0, 6]
|
5,406,527 | 5,406,528 |
Setting TextBox focus in BLL ASP.NET
|
<p>I'm working on an application where the validation (ranges) checks are controlled in the business logic layer. The code looks similar to this:</p>
<pre><code>public string ValidateRange(int value, int lowRange, int highRange, string fieldDesc, System.Web.UI.WebControls.TextBox txtBox)
{
string msg = "";
if (value >= lowRange & value <= highRange)
msg = "";
else
{
msg = "Please enter a value between " + lowRange + " and " + highRange + " for \"" + fieldDesc + ".\"";
txtBox.Focus();
}
return msg;
}
</code></pre>
<p>I'm pretty sure I'm doing this incorrectly so I was hoping someone can explain to me the most efficient way of handling the function and BLL so that it can pass to the Presentation layer nicely. My hope is that I can limit my interaction with the BLL to ValidateRange checks on the form's TextBox controls with a return for each. If I'm approaching this incorrectly, please let me know. If it does work this way, how can I allow the BLL to access the TextBoxes from the Presentation Layer?</p>
<p>Thanks for your help.</p>
|
c# asp.net
|
[0, 9]
|
1,005,940 | 1,005,941 |
need to creat variable variable in Javascript--not an array
|
<p>I'm needing to call a plugin that uses a var to work it's self. but I can't get the var cause that can change so... this is what I was trying to do.</p>
<pre><code>var selection = $(".view-your-rescues .cms_textarea,.post-a-rescue .cms_textarea,.edit-account-details .cms_textarea");
if(selection.length > 0 ) {
selection
.css({"height":"100","width":"500"})
.each(function(i) {
var eval("hb"+i ) = $(this).htmlbox({
toolbars:[[
"separator","bold","italic","underline","strike","sup","sub",
"separator","justify","left","center","right",
"separator","ol","ul","indent","outdent"
]],
icons:"silk",
skin:"red",
idir:"/uploads/htmlbox/",
about:false
});
});
}
</code></pre>
<p>So that is based on this <a href="http://htmlbox.remiya.com/cms/demo/iconsets-demo/" rel="nofollow">http://htmlbox.remiya.com/cms/demo/iconsets-demo/</a> where you'll see that that in order to do two you need to have the different vars.</p>
<p>The important part is</p>
<pre><code>.each(function(i){
var eval("hb"+i )= $(this).htmlbox({
</code></pre>
<p>I tried the eval.. but I don't like that idea and it don't work anyway... any ideas?</p>
<p>EDIT: I can't do var eval("hb"+i )= $(this) and if I go</p>
<p>eval("hb"+i )= $(this)</p>
<p>I just get "hb0 is not defined"</p>
<p>Hope that makes sense. Thank you for the help.
Cheers -Jeremy</p>
|
javascript jquery
|
[3, 5]
|
206,008 | 206,009 |
converting javascript in csharp--function as a argument
|
<p>In bing map AJAX api v7 there is a method for eventhandling in Events object:</p>
<pre><code>addHandler(target:object, eventName:string, handler:function);
</code></pre>
<p>which is used like this:</p>
<pre><code>Microsoft.Maps.Events.addHandler(pin2, 'mousedown', mouseDownHandler);
</code></pre>
<p>how can i write this in csharp:</p>
<pre><code>public void addHandler(object target, string eventName, ----)
</code></pre>
<p>what should be the 3rd argument?</p>
|
c# javascript
|
[0, 3]
|
2,123,883 | 2,123,884 |
I want to change the string from user define special character using javascript
|
<p>I want to change this string <strong>colormanagemnet</strong> from user define specail character like this
<strong>c!o@l#o$r$m%a^n&a*g?e(m)e@n!t</strong> using javascript or jquery if you guys have any idea about this please share me</p>
<pre><code><script type="text/javascript">
var sc = "!@#$%^&*()?"
var txt = "colormanagemnet";
// dont know how to concat like this
</script>
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,385,220 | 5,385,221 |
Querying String Values in Pure JavaScript AND Opening a Dialog Box
|
<p>OK, I found this code on another thread </p>
<p><a href="http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values">How can I get query string values?</a>, and it's been very helpful in location a string value in a URL. Now I need to take that string value, and use it to open a dialog box.</p>
<p>Here is the original code to get the string value</p>
<pre><code> function getParameterByName( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
</code></pre>
<p>and here is the code I've written to search for the string, and open the dialog box, and yet it is not doing that.</p>
<pre><code>var signup_param = getParameterByName( 'Redirect' );
if (signup_param == "signup") {
$('#emailDuplicateDialog').dialog('open');
}
</code></pre>
<p>The URL I'm working with btw ends with login.html?redirect=signup so redirect is the name, and signup is the value.</p>
<p>Any suggestions on changes to make this work would be a great help.</p>
<p>Thanks.</p>
|
javascript jquery
|
[3, 5]
|
2,309,525 | 2,309,526 |
remove class from all other list items
|
<p>I've gotten help from others on this, but their replies were a little bit too broad to help me... I'm a newb when it comes to javascript so I can't quite wrap my head around their answers (and everything I've tried in the last 3 days hasn't worked.) The working site is here: <a href="http://www.studioimbrue.com/beta" rel="nofollow">http://www.studioimbrue.com/beta</a> The problem is that with the thumbnails, once clicking them it adds the .selected class properly but when clicking on another, it fails to strip the .selected class from any of the other thumbnails. If you can just correct the code I have that would be amazing, and if you feel like explaining what I had wrong, go right ahead!</p>
<pre><code>$(document).ready(function(){
var activeOpacity = 1.0,
inactiveOpacity = 0.6,
fadeTime = 100,
clickedClass = "selected",
thumbs = "#list li";
$(thumbs).fadeTo(1, inactiveOpacity);
$(thumbs).hover(
function(){
$(this).fadeTo(fadeTime, activeOpacity);
},
function(){
// Only fade out if the user hasn't clicked the thumb
if(!$(this).hasClass(clickedClass)) {
$(this).fadeTo(fadeTime, inactiveOpacity);
}
});
$(thumbs).click(function() {
// Remove selected class from any elements other than this
var previous = $(thumbs+'.'+clickedClass).eq();
var clicked = $(this);
if(clicked !== previous) {
previous.removeClass(clickedClass);
}
clicked.addClass(clickedClass).fadeTo(fadeTime, activeOpacity);
});
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,728,152 | 5,728,153 |
Sorting Jquery Tab Panel
|
<p>I have a tab panel. </p>
<p>It can add tabs dynamically by clicking the <code>add tab</code> button. </p>
<p>A typical use case scenario will be this: </p>
<ul>
<li>I have multiple tabs open Tab-1, Tab2, Tab-3, and Tab-4 in the panel </li>
<li>and remove some of them Tab-2 and Tab-3 from the panel by closing the tabs. </li>
</ul>
<p>This will leave Tab-1 and Tab-4 in the panel. </p>
<p>Now, if i try to add new tabs, order in which the tabs are is Tab-1, Tab-4, Tab-2, Tab-3.</p>
<p>I want to sort the panel in jquery and make it Tab-1, Tab-2, Tab-3, and Tab-4</p>
<p>Please Help!!</p>
|
javascript jquery
|
[3, 5]
|
570,090 | 570,091 |
jQuery append (or appendTo) with Animation
|
<p>I have a UL-LI e.g.</p>
<pre><code><ul>
<li id="1">item-1</li>
<li id="2">item-2</li>
<li id="3">item-3</li>
<li id="4">item-4</li>
</ul>
</code></pre>
<p>I would like to move one of the items to another position in the list. e.g. item-2 to AFTER item-4.</p>
<p>Normally I can do this by deleting the item and then appending it after another.</p>
<p>But I would like to do this to happen visually with animation. As in, item-2 descends to after item-4.</p>
<p>How can I achieve this?</p>
|
javascript jquery
|
[3, 5]
|
389,150 | 389,151 |
Implement a search bar
|
<p>I want to implement a search bar, which the user can write something and it will search for in the page.</p>
<p>I read about it in the android developer and found it:</p>
<p><a href="http://developer.android.com/guide/topics/search/search-dialog.html" rel="nofollow">http://developer.android.com/guide/topics/search/search-dialog.html</a></p>
<p>However, I read that it's available only for api 11 and higher.</p>
<p>Is there any implementation or another search widget for api lower than 11?</p>
|
java android
|
[1, 4]
|
742,600 | 742,601 |
Getting the clicked element using $(this)
|
<p>hey I have this silly issue and I hope you could help me to solve it. I have some "a" elements and I just want to add an active class when clicked.</p>
<p>I tried this :</p>
<pre><code><a href="javascript:mifunction()"></a>
js:
function mifunction(){
$(this).addClass('active');
}
</code></pre>
<p>but it doesn't work, so I tried this:</p>
<pre><code><a></a>
js:
$('a').click(function() {
$(this).addClass('active');
});
</code></pre>
<p>It doesn't work either. It just worked when I mixed both. But users have to dubbleclick the element, which is not an option:</p>
<pre><code><a href="javascript:mifunction()"></a>
js:
function mifunction(){
$('a').click(function() {
$(this).addClass('active');
});
}
</code></pre>
<p>Do you have any idea of how to solve this?</p>
<p>Thank you very much!</p>
|
javascript jquery
|
[3, 5]
|
3,418,471 | 3,418,472 |
Whats the easiest way to reactive a submit() action that was cancelled with 'return false'
|
<p>I have some image buttons that have jQuery event handlers attached to them.</p>
<p>I want to make an AJAX call in the click() event to determine if the action should actually be allowed. Because I am doing an async ajax call I have to return 'false' to immediately cancel the event and wait for the response.</p>
<pre><code>$('[id^=btnShoppingCartStep_]').click(function() {
var stepName = this.id.substring("btnShoppingCartStep_".length);
$.ajax({
type: "POST",
url: $.url("isActionAllowed"),
data: "requestedStep=" + stepName,
dataType: "json",
success: function(data) {
if (data.allowed) {
// need to resume the action here
}
else {
AlertDialog(data.message, "Not allowed!");
}
}
});
return false;
});
</code></pre>
<p>I need to find the best way to resume the click event if the AJAX call determines that it should be allowed.</p>
<p>Any way of doing this that I can come up with seems clumsy, such as :</p>
<p>1) remove event handler from the buttons</p>
<p>2) simulate a click on the button that was clicked</p>
<p>Is there any nice way of doing this that I'm missing?</p>
|
javascript jquery
|
[3, 5]
|
46,378 | 46,379 |
What's the equivalent of .get in javascript?
|
<pre><code>d = {'hello':'abc'}
d.get('hello','default_val');
</code></pre>
<p>Above is python. How to do this in javascript? I want to be able to set a default value if no key found.</p>
|
javascript python
|
[3, 7]
|
3,652,042 | 3,652,043 |
How to get inner HTML of element inside a list item, within a delegate?
|
<p>I have this bit of HTML :</p>
<pre><code><li eventId="123">
<img src="image.jpeg"/>
<h3 id="eventName">Event Name</h3>
<p id="eventDescription"></p>
</li>
</code></pre>
<p>I want to be able to pull out the <code><h3></code> and <code><p></code> via jQuery so that I can update their values.</p>
<p>I have a delegate bound to the list items, and on click I'm trying to grab hold of <code><h3></code> and <code><p></code> using :</p>
<pre><code>function eventIdClicked()
{
// This gets hold of "123" OK
theEvent.id = $(this).get(0).getAttribute('eventId');
// How to get the other 2 inner html?
var existingEventName = $(this).get(1).getAttribute('eventName');
var existingEventDesc = $(this).get(2).getAttribute('eventDescription');
$.mobile.changePage("home.html");
}
</code></pre>
<p>Am I able to do this?</p>
|
javascript jquery
|
[3, 5]
|
3,702,398 | 3,702,399 |
Drag from the ListView and Drop on to the Button
|
<p>I would like to know if its possible to drag an item from the ListView and drop onto the Button. After dropping onto the button the text on the button will be changed.</p>
<p>Is it possible to drop an item onto the Button?</p>
|
java android
|
[1, 4]
|
2,380,657 | 2,380,658 |
How to use 'contains' in an if statement?
|
<p>I have HTML that looks like this:</p>
<pre><code><div class="item-list">
<h3>Monday Sep 21</h3>
<h3>Tuesday Sep 22</h3>
<h3>Wednesday Sep 23</h3>
</code></pre>
<p>If today's date is on the list, then that date should be red. If today is not on the list (hey, it's still August!), then the 21st should be red. I used this code to successfully turn Sept 21 red, but I don't know how to put it in an if/else. [I tried some basic stuff, and searched, but I am lame with js.]</p>
<pre><code>$(".item-list h3:contains('Monday Sept 21')").css('color','red');
</code></pre>
<p>(That "Monday Sept 21" will eventually be a variable based on today's date.)</p>
|
javascript jquery
|
[3, 5]
|
3,630,774 | 3,630,775 |
Scrolling Tabs in a table
|
<p>I have a horizontal tab menu. These tabs are all li elements. I show always 5 of them at once. To the left and right I have buttons which scrolls these tabs to either side. I am just not sure how to achieve that. Can I put the next 5 tabs in a different div which will be shown on click? That wouldnt be the best solution, would it? Can I do this somehow with JavaScript or jQuery?</p>
<p>Thanks.</p>
|
javascript jquery
|
[3, 5]
|
5,333,360 | 5,333,361 |
How to prohibit user from viewing a page before a specific time period?
|
<p>I want to build an online quiz test site. </p>
<p>Suppose, exam will start at 10:00 am and a student login to give exam at 9:45 am. Whenever the student clicks 'Take Exam' button, he/she cannot not get access to the question paper because the exam time is 10:00 am and there are still 15 minutes before the exam start.</p>
<p>Now I want to put some Javascript or PHP code that will prohibit the students to give exam earlier and if a students come early, it will show a stopwatch which display the remaining time before exam time and when the current time is equal to exam time then he/she will be directly redirected to the question paper page.</p>
|
php javascript
|
[2, 3]
|
2,219,360 | 2,219,361 |
How to submit multiple jquery posts to a page one after another if database updates successfully?
|
<p>I am trying to send multiple $.post to a single page. I need each to post to a page that updates a database then post the next one until they are done. This is my code so far: </p>
<pre><code>$(document).ready(function(){
$("#action").change(function(){
var selectVal = $('#action :selected').val();
if(selectVal == "list-all"){
$(".prelistCheckbox:checked").each(function(index) {
var theValue = $(this).val();
console.log('Values to be passed: ' + theValue);
var form = $('form[id=' + theValue + ']');
console.log(form.serialize());
// $.post(form.attr('action'), form.serialize(), function(data) {
$.post('jqueryPost.php', form.serialize(), function(data) {
$('#results').text(data);
console.log(data);
});
});
}
});
});
</code></pre>
<p>I'm really not sure how to make it make it do this. The forms are generated from rows of a database with a loop. </p>
|
php jquery
|
[2, 5]
|
5,736,944 | 5,736,945 |
Use Javascript to get the Sentence of a Clicked Word
|
<p>This is a problem I'm running into and I'm not quite sure how to approach it.</p>
<p>Say I have a paragraph:</p>
<pre><code>"This is a test paragraph. I love cats. Please apply here"
</code></pre>
<p>And I want a user to be able to click any one of the words in a sentence, and then return the entire sentence that contains it.</p>
|
javascript jquery
|
[3, 5]
|
4,639,549 | 4,639,550 |
Including Java classes in PHP script
|
<p>I want to include Java class to my PHP script, can some one help me with the syntax and the path.</p>
<p>Thanks for the help.</p>
|
java php
|
[1, 2]
|
601,995 | 601,996 |
C++ -vector<string> in C#
|
<p>I have a code in C++ as basically a class const and a dest</p>
<pre><code> Abc(vector<std::string>& names);
virtual ~Abc();
</code></pre>
<p>I need to know the equilivalent in C#</p>
<p>Thanks</p>
|
c# c++
|
[0, 6]
|
6,017,873 | 6,017,874 |
Jquery Css Selector Add Value
|
<p>How can i reset a display:none and add some value here is the code</p>
<pre><code>onclick="$('reason{$test->id}').css('display:block');
$('#reasonid{$test->id}').val(this.value);"
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,556,710 | 5,556,711 |
How to perform a $_POST for this example below?
|
<p>I have a multiple row of buttons in my javascript code which goes from A-Z:</p>
<pre><code><?php
$a = range("A","Z");
?>
<table id="answerSection">
<tr>
<?php
$i = 1;
foreach($a as $key => $val){
if($i%7 == 1) echo"<tr><td>";
echo"<input type=\"button\" onclick=\"btnclick(this);\" value=\"$val\" id=\"answer".$val."\" name=\"answer".$val."Name\" class=\"answerBtns answers answerBtnsOff\">";
if($i%7 == 0) echo"</td></tr>";
$i++;
}
?>
</tr>
</code></pre>
<p>Below is the javascript function where it turns on and off each individual button:</p>
<pre><code>function btnclick(btn)
{
$(btn).toggleClass("answerBtnsOff");
$(btn).toggleClass("answerBtnsOn");
return false;
}
</code></pre>
<p>What my question is that I want to perform a $_POST so that it posts all of the buttons which has been turned on. Does anyone know how the post method should be written for this?</p>
|
javascript jquery
|
[3, 5]
|
875,339 | 875,340 |
Is there a way to log this?
|
<p>I'm trying to figure out what "this" refers to. </p>
<p>Is there a way in js to console.log this?</p>
<pre><code>console.log $(this).next
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,822,589 | 5,822,590 |
Error using DLL from other project - ConfigurationManager
|
<p>I have 2 projects, 1 is a REST service the other is ASP.net website. They each run independently. But I want to re-use global functions form the REST service in my ASP.net project. The issue is that the Global class is static and us setting vars using the ConfigurationManager.AppSettings["Property"];</p>
<p>What is a better way to handle this?</p>
<p>Edit: One thought I had was creating a generic XML file that the two projects could both share and read from instead of a web.config file.</p>
|
c# asp.net
|
[0, 9]
|
270,489 | 270,490 |
Why I got an error in the system when I use MIN in the SQL Query?
|
<p>I am developing a web application that sends the quizzes to all users via emails. If there is more than one quiz in the database that not be sent to the users before, the system should select the minimum quiz id not the maximum one. </p>
<pre><code> string quizid = "";
// Open DB connection.
conn.Open();
string cmdText = "SELECT MIN (QuizID) FROM dbo.QUIZ WHERE IsSent <> 1";
using (SqlCommand cmd = new SqlCommand(cmdText, conn))
{
SqlDataReader reader = cmd.ExecuteReader();
if (reader != null)
{
while (reader.Read())
{
// There is only 1 column,
// so just retrieve it using the ordinal position
quizid = reader["QuizID"].ToString();
}
}
reader.Close();
}
</code></pre>
<p>When I used MIN, it gave me the following error:</p>
<blockquote>
<p>Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code. </p>
<p>Exception Details: System.IndexOutOfRangeException: QuizID</p>
<p>Source Error: </p>
</blockquote>
<pre><code>> Line 69: {
> Line 70: //
> There is only 1 column, so just retrieve it using the ordinal position
> Line 71: quizid = reader["QuizID"].ToString();
> Line 72:
> Line 73: }
</code></pre>
|
c# asp.net
|
[0, 9]
|
3,516,984 | 3,516,985 |
Android, is there an OnRelease functions?
|
<p>Say I want a dialog to <code>.show()</code> when the user Touches a certain element and <code>.hide()</code> once he releases it.</p>
<p>I found how to make the <code>OnTouchListener</code>. But is there any sort of <code>OnReleaseListener</code>?</p>
<p>Thanks!</p>
|
java android
|
[1, 4]
|
2,858,652 | 2,858,653 |
Difference between jquery $('#my_id') and document.getElementById('my_id')?
|
<p>I tought $('#my_id1') was the same thing as document.getElementById('my_id1'). But it is parently not. What is the difference?</p>
<pre><code>(function( $ ) {
$.fn.simple_hide_function = function() {
var $t = this;
$t.hide();
};
})( jQuery );
$(window).load(function () {
var $div1 = $('#my_id1');
var $div2 = document.getElementById('my_id2');
$div1.simple_hide_function(); // this is working
$div2.simple_hide_function(); // but this is not working
});
</code></pre>
<p><strong>Adding example to make it more clear:</strong></p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<div id="my_id1" style="height:100px;background:#f00">div1</div>
<div id="my_id2" style="height:100px;background:#f00">div2</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
(function( $ ) {
$.fn.simple_hide_function = function() {
var $t = this;
$t.hide();
};
})( jQuery );
$(window).load(function () {
var $div1 = $('#my_id1');
var $div2 = document.getElementById('my_id2');
$div1.simple_hide_function();
$div2.simple_hide_function();
});
</script>
</body>
</html>
</code></pre>
|
javascript jquery
|
[3, 5]
|
669,052 | 669,053 |
EditText is growing as text entered
|
<p>I have an edittext that is 80% of the screen across and a button that should take the remaining 20%, but when text is entered into the box or removed the edittext grows and shrinks.</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100">
<Button
android:id="@+id/people_relationFilterB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="20" />
<EditText
android:id="@+id/people_searchBoxET"
android:text="Search Known"
android:singleLine="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="80" />
</LinearLayout>
<ListView
android:id="@+id/people_listLV"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</code></pre>
<p>Any Clues? Thanks!</p>
|
java android
|
[1, 4]
|
3,781,822 | 3,781,823 |
jQuery $.submit and files not working in IE and FF
|
<pre><code><?php
if (!empty($_FILES)){
echo "<pre>";
echo $_FILES['file']['type'];
echo "</pre>";
return;
}
?>
<script type="text/javascript">
function autoUpLoad(){
$("#txtHint").html("<center><img src='include/images/loader.gif' />Reading selected file...</center>");
$(document).ready(function(){
$("#file").change(function(){
$("#myForm").submit(function(data){
$("#txtHint").html(data);
});
});
});
}
</script>
<form id="myForm" method="post" enctype="multipart/form-data">
<input type="file" name="file" id = "file" onchange='autoUpLoad()'/>
<input type="submit" value="Send" />
</form>
<div id="txtHint">
test
</div>
</code></pre>
<p>The above code is not working and I am not sure what is wrong here? It works only if I remove these lines:</p>
<pre><code>function(data){
$("#txtHint").html(data);
}
</code></pre>
<p>It just doesn't allow me to return data to <code>txtHint</code>. Can anyone explain to me how to make it work?</p>
|
php jquery
|
[2, 5]
|
5,262,124 | 5,262,125 |
PHP Server responded "Forbidden" when trying to upload file from android
|
<p>I try to run code from this site <a href="http://reecon.wordpress.com/2010/04/25/uploading-files-to-http-server-using-post-android-sdk/" rel="nofollow">http://reecon.wordpress.com/2010/04/25/uploading-files-to-http-server-using-post-android-sdk/</a> but I have a problem, When I try to send file to server I get “Forbidden” response from server and on server is nothing. Do anyone know what is wrong with it? Maybe I need to change somethig in my php config? Thanks for every help.</p>
|
php android
|
[2, 4]
|
5,146,601 | 5,146,602 |
getting 503 error while logging in
|
<p>I am making an app using foursquare. Am unable to know what ip should i give in the statement</p>
<pre><code>if (FoursquaredSettings.USE_DEBUG_SERVER) {
return new Foursquare(Foursquare.createHttpApi("10.0.2.2:8080", version, false));
} else {
return new Foursquare(Foursquare.createHttpApi(version, false));
}
</code></pre>
<p>10.0.2.2:8080 doesn't seems to be working. It says 503 error while logging in the app.
Please help.</p>
|
java android
|
[1, 4]
|
4,668,733 | 4,668,734 |
Get id of element and post in sql query?
|
<p>Hey, I am trying to get the id of an element and then post that id in a sql query like this:</p>
<p>jQuery gets id of checkbox:</p>
<pre><code>$(document).ready(function() {
$(":checkbox").change(function(){
var id = $(this).attr('id');
$.post("index.php", { id: this.id, checked: this.checked },
function(data){
alert("Data Loaded: " + id);
}
);
//return false to insure the page doesn't refresh
});
});
</code></pre>
<p>Then I insert that into the php query, but it doesn't display anything on the page. What am I missing?</p>
<pre><code> $query1 = "SELECT * FROM explore WHERE category IN ('".$_POST["id"]."')
ORDER BY category LIMIT $start, $limit";
</code></pre>
|
php jquery
|
[2, 5]
|
3,411,391 | 3,411,392 |
Disable a button (in a data list) after a single click by user
|
<p>I want to disable the button that is contained in a data list row. Is it possible to disable the button after it has been clicked once by the user? If so, can someone please suggest how I can achieve that.</p>
<pre><code><asp:DataList ID="DataList1" runat="server" DataKeyField="Qno" OnItemCommand="DataList1_OnItemCommand"
DataSourceID="SqlDataSource1">
<ItemTemplate> <asp:RadioButton ID="RadioButton1" runat="server" Text='<%# Eval("Ans1") %>' GroupName="qu" />
<br />
<asp:RadioButton ID="RadioButton2" runat="server" Text='<%# Eval("Ans2") %>' GroupName="qu" /> <asp:Button ID="Button2" runat="server" Text="Submit" CommandName="Validate" />
<br />
</ItemTemplate>
</code></pre>
<p></p>
|
c# javascript asp.net
|
[0, 3, 9]
|
4,373,612 | 4,373,613 |
CustomValidator message doesnt show up
|
<p>I've a CustomValidator and I defined every possible parameter of it:</p>
<pre><code><asp:CustomValidator ID="custom" runat="server" Text="*" ErrorMessage="This email address is already registered" ControlToValidate="txtEmail" OnServerValidate="isExist" Display="None" ValidationGroup="valRegister"></asp:CustomValidator>
</code></pre>
<p>PS: I've a RequiredFieldValidator for same textbox and I dont want to check empty value.</p>
<p>Here are other objects of the form:</p>
<pre><code><div class="row"><asp:Label runat="server" Text="Email" AssociatedControlID="txtEmail"></asp:Label><asp:RequiredFieldValidator runat="server" ErrorMessage="Please enter your email" Text="*" ControlToValidate="txtEmail"></asp:RequiredFieldValidator><asp:TextBox ID="txtEmail" runat="server" CssClass="inpBox"></asp:TextBox></div>
<asp:Button runat="server" Text="Register" CssClass="btn" OnClick="register_member" CausesValidation="true" ValidationGroup="valRegister" />
<asp:ValidationSummary ID="validationSummary" runat="server" ShowMessageBox="true" ShowSummary="false" ValidationGroup="valRegister" />
</code></pre>
<hr>
<pre><code>protected void isExist(object sender, ServerValidateEventArgs args){
if (cre.member.isExist(args.Value)){
args.IsValid = false;
} else {
args.IsValid = true;
}
</code></pre>
<p>}</p>
<p>When I put an email already exist in the db table * appears on the form, but the error message doesnt show up. I tried all display options for custom error but no luck.</p>
<p>Thanks.</p>
|
c# asp.net
|
[0, 9]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.