Unnamed: 0
int64 302
6.03M
| Id
int64 303
6.03M
| Title
stringlengths 12
149
| input
stringlengths 25
3.08k
| output
stringclasses 181
values | Tag_Number
stringclasses 181
values |
|---|---|---|---|---|---|
3,939,310
| 3,939,311
|
Android & Java simple Code
|
<p>I Wonder what is and does (this) in this code:</p>
<pre><code>Button btn = new Button(this);
</code></pre>
|
java android
|
[1, 4]
|
959,260
| 959,261
|
How much of the Java 6 API is implemented by Android?
|
<p>I want to port an small open source AES encryption class to Android, and it would cut my work down a lot if the API of Android is as close as possible to the Java 6 API. </p>
<p>How much is implemented (or referenceable), as I have tried searching about this on google, and i have not yet come up with anything useful?</p>
|
java android
|
[1, 4]
|
2,250,755
| 2,250,756
|
problem with use of effect fadeOut.?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/7153079/dont-work-fadeout-if-there-is-replacewith">don't work 'fadeOut' If there is 'replaceWith'.?</a> </p>
</blockquote>
<p>I want after delete row(s) in table, for it row that deleted use of effect <code>fadeOute('slow')</code>, but it don't work in my code.(if not use of <code>.replaceWith()</code> it worked.)<p>
<a href="http://www.binboy.gigfa.com/admin/accommodation/show" rel="nofollow">EXAMPLE</a> => checked and clicke on DELETE</p>
<p>code:</p>
<pre><code>$.ajax({
type: "POST",
url: url,
data: dataString,
cache: false,
success: function(html){
var $html = $(html);
////////////////////////////////// here ////////////////////////////////
$('.ser_form #paginate input:checkbox:checked').parent().parent().fadeOut("slow");
$('#num_count').replaceWith($html.find('#num_count'));
$('tr#paginate').replaceWith($html.find('tr#paginate'));
$('.pagination').replaceWith($html.find('.pagination'));
////////////////////////////////// here ////////////////////////////////
},
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,758,835
| 1,758,836
|
jQuery ajax post success - saving data to variable
|
<p>I have this function:</p>
<pre><code>function getReport(name,x) {
var xArr = [];
var yArr = [];
$.ajax({
async: false,
type: "POST",
//async: false,
//dataType: "json",
url: "reportAjax.php",
data: "name="+ name,
success: function(data){
var json = $.parseJSON(data);
var chartDesc = json.INFO.DESC;
$.each(json.RESULT, function(i, object) {
$.each(object, function(property, value) {
//alert(property + "=" + value);
if (property == x) {
xArr.push(value);
}
else {
yArr.push(parseInt(value));
}
});
});
}
});
console.log(xArr);
console.log(yArr);
console.log(chartDesc);
drawChart(xArr,yArr,chartDesc);
}
</code></pre>
<p>For some reason, I can see in the <code>console.log</code> the values of <code>xArr</code> and <code>yArr</code>, but I get <code>chartDesc is not defined</code> for <code>chartDesc</code>.</p>
<p>If I move the <code>console.log(chartDesc)</code> line to be under this line <code>var chartDesc = json.INFO.DESC</code> I can see it properly.</p>
<p>Why is that?</p>
|
javascript jquery
|
[3, 5]
|
2,644,915
| 2,644,916
|
assign value to javascript variable In C# CodeBehind
|
<p>How can i assign value to javasctipt variable from code-behind (C#)?</p>
<pre><code><script type="text/javascript">
String.prototype.trim = function () { return this.replace(/^\s+|\s+$/, ''); };
function ConstantByCode(_Obj, _Div) {
var pl = new SOAPClientParameters();
_Obj.value = _Obj.value.trim();
pl.add("Code", _Obj.value);
pl.add("Group", _Obj.Grp);
alert(_Obj.Grp);
var _Value = SOAPClient.invoke("ConstantWS.asmx", "GetConstantByCode", pl, false, CallBackEvent);
if (_Value == null || _Obj.value == "" || _Obj.value == null || IsNumeric(_Obj.value) == false) {
_Obj.value = "";
_Div.innerHTML = "";
}
else {
_Div.innerHTML = _Value;
}
}
function CallBackEvent(r) {
}
function IsNumeric(input) {
return (input - 0) == input && input.length > 0;
}
</code></pre>
<p></p>
<p>BehindCode</p>
<pre><code> txtCode.Attributes.Add("Grp", Me.ConstValue)
txtCode.Attributes.Add("onchange", "ConstantByCode(this," & DivTitle.ClientID & ");")
txtCode.Attributes.Add("onkeyup", "ConstantByCode(this," & DivTitle.ClientID & ");")
</code></pre>
<p>_obj.Grp has now value.
alert said : undefined</p>
|
c# javascript asp.net
|
[0, 3, 9]
|
3,731,537
| 3,731,538
|
android/java getIdentifier with
|
<p>I'm having trouble getting <code>getIdentifier</code> to work with a class variable. It's strange, because this works:</p>
<pre><code>public Drawable getStationIcon(Context context) {
int resId = context.getResources().getIdentifier("m1m2_16", "drawable", "com.mypackage.namehere");
Drawable drawable = context.getResources().getDrawable(resId);
return drawable;
}
</code></pre>
<p>But this doesn't:</p>
<pre><code>public Drawable getStationIcon(Context context) {
int resId = context.getResources().getIdentifier(this.stationIcon, "drawable", "com.mypackage.namehere");
Drawable drawable = context.getResources().getDrawable(resId);
return drawable;
}
</code></pre>
<p>And nor does this:</p>
<pre><code>public Drawable getStationIcon(Context context) {
String stationI = this.stationIcon;
int resId = context.getResources().getIdentifier(stationI, "drawable", "com.mypackage.namehere");
Drawable drawable = context.getResources().getDrawable(resId);
return drawable;
}
</code></pre>
<p>And <code>this.stationIcon</code> definitely equals <code>m1m2_16</code>. I've tried other alternatives, ie using <code>""+this.stationIcon</code>, but nothing works when the first parameter is a variable. Is there something I'm missing?</p>
|
java android
|
[1, 4]
|
5,548,538
| 5,548,539
|
Get correct window width after resize or orientationchange event for Android
|
<p>I bound functions to the resize and orientationchange event. In this function i'm trying to read the windowwith. Iphone always gives me the correct sizes but Android devices (2.2, 2.3 and 4.0) seem to trigger the event before actually changing the windowssize. So I always get the last windowsize and not the newest. Is there some way (without timeouts) to get the correct windowsize?</p>
<p>I tried following attributes / functions:
$(window).innerWidth(true)
$(window).outerWidth(true)
screen.width
$(window).width()</p>
<p>None of them are giving the correct width.</p>
<p>Any suggestions?</p>
|
javascript jquery android
|
[3, 5, 4]
|
568,625
| 568,626
|
any reference for Asp.net with c# initial programming video or code
|
<p>give me any site for asp.net with c# video & code.....
That start for basic of it.....NOT youtube,asp.net,etc </p>
|
c# asp.net
|
[0, 9]
|
744,230
| 744,231
|
Having problems using percentages passed in through ("input").val()
|
<p>To be honest, I think I just have to convert the values to integers, but I've tried a bunch of things and keep getting 'NaN' or something along the lines of 'cannot use this action on an object'. I want to do things like use replace to remove the % or simply apply math to it. I have tried String and parseInt() to try to convert but just get NaN.</p>
<p>This example gives me an alert box that says "10%" or "20%"...whatever the user types in</p>
<pre><code>thisInvoiceDiscount = $("#clientSearchInvoiceDiscountTextbox").val();
percentPresent = thisInvoiceDiscount.indexOf("%");
if (percentPresent == "-1") {
}
else {
alert (thisInvoiceDiscount);
//I can't seem to do anything with thisInvoiceDiscount here
}
</code></pre>
<p>UPDATE: Using the 1st response:</p>
<pre><code>thisInvoiceDiscount = $("#clientSearchInvoiceDiscountTextbox").val();
var numberOnly = $("#clientSearchInvoiceDiscountTextbox").val().replace(/\D/g, '');
percentPresent = thisInvoiceDiscount.indexOf("%");
if (percentPresent == "-1") {
}
else {
var integerValue = parseInt(numberOnly, 10);
alert (integerValue);
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
855,709
| 855,710
|
Javascript echo via PHP
|
<pre><code>echo "<br><font face='Segoe UI' color='blue'><a href='#' onClick='javascript:alert(".$nam.");return false;'>".$nam."</a></font>";
</code></pre>
<p>I'd like to know if there's any syntax error in the above code. I don't think alert() is being called. </p>
<p>Thanks! </p>
|
php javascript
|
[2, 3]
|
3,913,972
| 3,913,973
|
Script not executing with a dynamically generated JQuery script tag
|
<p>I have the following code in an external JS file (ie: test.js); which creates an additional script tag pointing to a JQuery source if it detects that a JQuery source isn't already there. The code actually creates the script tag and inserts it before the actual script that's doing the creating:</p>
<pre><code>if (typeof(jQuery) == "undefined") {
var head = document.getElementsByTagName("head")[0];
// get any and all script tags
var scripts = document.getElementsByTagName("script");
// the actual script call the actions (ie: this one "test.js")
thisScript = scripts[scripts.length - 1];
// create element
var script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
head.insertBefore(script,thisScript);
}
</code></pre>
<p>The above works fine. However, the problem I'm having is that once the JQuery source script tag is created, the rest of the code on "test.js" doesn't work. It's as if the code can't access the JQuery functions (or doesn't know that JQuery is there).</p>
<p>Thus, the following code on "test.js" doesn't work:</p>
<pre><code>$(document).ready(function() {
// ...
});
</code></pre>
<p>The error I'm getting according to FireBug with FF 12 is: "$ is not defined"
Any ideas as to why this is happening or how I can fix it?</p>
<p>NOTE: I know I can just place JQuery on target page; however, that isn't an option as
the code has to be able to detect if JQuery is there; and if not, then create the script tag pointing to JQuery and run the Jquery code.</p>
|
javascript jquery
|
[3, 5]
|
3,255,316
| 3,255,317
|
How to check if two string are of the same length?
|
<p>I want to check if two string are of the same length. I tried the following, but it doesn't work.</p>
<pre><code>string passnew = "1233";
string passcnfrm = "1234";
if((passnew.Length&&passcnfrm.Length)>6 ||(passnew.Length&&passcnfrm.Length)<15)
{
// ...
}
</code></pre>
<p>Why does it not work? What do I need to change?</p>
|
c# asp.net
|
[0, 9]
|
524,735
| 524,736
|
Wrap <a> tag around phone number using jquery
|
<p>I'm loading a page with AJAX and would like to use Jquery to search for phone numbers (whose format is 555.555.5555) on the loaded page and wrap them with tel links:</p>
<pre><code><a href="tel:phone-number-here"> </a>
</code></pre>
<p>I know the parts I need to accomplish this (I think): Regex and .wrap(). I'm just not sure how to piece them together with the code I've got. I'm also not sure how to get Jquery to retain found numbers and insert them inside the tel links. Would I have to use each and $(this) with variables?</p>
<p>Here's the regex I found for identifying 7 - 10 digit numbers. I want to leave it open to various delimiters in case our site stops using periods in the future:</p>
<pre><code>^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$
</code></pre>
<p>And here's the code I'm using to load each page:</p>
<pre><code> $(".services").click(function(){
var loadUrl = "http://www.example.com";
$("#content").html(ajax_load).load(loadUrl + " #content");
});
</code></pre>
<p>Any help would be appreciated.</p>
|
javascript jquery
|
[3, 5]
|
2,680,930
| 2,680,931
|
How to retrieve a value from <input> using jQuery?
|
<p>I have to hidden input fields such as:</p>
<pre><code><input name="foo" value="bar">
<input name="foo1" value="bar1">
</code></pre>
<p>I'd like to retrieve both of those values and POST them to the server using jQuery. How does one use the jQuery selector engine to grab those values?</p>
|
javascript jquery
|
[3, 5]
|
3,271,094
| 3,271,095
|
Custom adapter to use with array of custom classes. (to populate a gridview)
|
<p>I've been fiddling with a Gridview lately for a few items that I'm trying to accomplish. The others have been relatively simple and easily done. The one I'm getting stuck at is I am trying to populate a gridview with multiple power control widgets (ImageButtons) (named.. wifiWidget, gpsWidget & syncWidget etc..). Would this be done with an array of these custom classes? If so how would i populate an adapter with them to use with the gridview. I created this layout simply as a demonstration - <a href="http://dl.dropbox.com/u/11748819/widgets.png" rel="nofollow">http://dl.dropbox.com/u/11748819/widgets.png</a> .</p>
<p>Any help would be greatly appreciated. If this is even possible.</p>
|
java android
|
[1, 4]
|
3,843,479
| 3,843,480
|
android- menu settings customization
|
<p>i added settings option in android menu. it works fine while testing in emulator. but when i try in device it wont change.. can i know what is the problem? Do i need to change anything in androidmanifest.xml file.<br>
following is my code: </p>
<pre><code>@Override
public boolean onCreateOptionsMenu(Menu menu)
{
menu.add(1,1,0,"Settings").setIcon(R.drawable.ic_tab_settings_grey);
setMenuBackground();
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch(item.getItemId())
{
case 1:
Intent in = new Intent(TransactionSummaryActivity.this, WelcomePage.class);
startActivity(in);
finish();
return true;
default:
return true;
}
}
protected void setMenuBackground(){
getLayoutInflater().setFactory( new Factory() {
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
// TODO Auto-generated method stub
if ( name.equalsIgnoreCase( "com.android.internal.view.menu.IconMenuItemView" ) ) {
try { // Ask our inflater to create the view
LayoutInflater f = getLayoutInflater();
final View view = f.createView( name, null, attrs );
new Handler().post( new Runnable() {
public void run () {
view.setBackgroundResource(R.drawable.menu_selector);
// view.setBackgroundColor(Color.parseColor("#257CB5"));
((TextView) view).setTextColor(Color.WHITE);
}
} );
return view;
}
catch (InflateException e) {}
catch (ClassNotFoundException e) {}
}
return null;
}
});
}
</code></pre>
|
java android
|
[1, 4]
|
3,008,542
| 3,008,543
|
Performance of conditional logic with gridview RowDataBound vs ItemTemplate/Regular databind
|
<p>I have a gridview that contains around 16 ItemTemplate columns. The values in each column are decimal properties. In each column, I'm doing some conditional logic to display N/A or actual value etc, etc. Something like,</p>
<pre><code><asp:TemplateField HeaderText="Test" ItemStyle-CssClass="test">
<ItemTemplate>
<%# Eval("TestExpense", "{0:n}").ToString() == "-1.00" ? "N/A" : "$" + Eval("TestExpense", "{0:n}")%>
</ItemTemplate>
</asp:TemplateField>
</code></pre>
<p>The grid returns many rows, say 30,000 in most cases. There is paging for the grid so only 10 rows are visible at a time. (Yes, I do bring all rows from the db back, no paging in SQL. The search is complicated and takes time)</p>
<p>The question is, should I do this logic in the RowDataBound Event where I can say do this logic only when the row is visible. This makes sure that only 10 visible rows (for the active page) are processed with this logic at a time. If I do a regular databind, is the datagrid smart enough to do the ItemTemplate logic only for 10 rows or does it do for all 30,000 rows. That will be unnecessary.</p>
<p>To add to this question, I have some Template columns that are derived from other properties. If I do a regular databind, does the grid calculate through all the columns for each row or only does it for the visible rows.</p>
<p>I believe if I use the RowDataBound event, I can control all this. But the other option is more convenient. If the gridview automatically does this, then I don't have to worry about it. Any thoughts?</p>
|
c# asp.net
|
[0, 9]
|
1,650,516
| 1,650,517
|
How do I find the current window offset using javascript?
|
<p>When I open a page, the window offset would be 0 but when i scroll through the page, the offset of the window would increase correspondingly? How can I find the window's offset at any particular point of my web page?</p>
|
javascript jquery
|
[3, 5]
|
5,491,588
| 5,491,589
|
Can php detect if javascript is on or not?
|
<p>I have page which created dynamically.</p>
<p>Now I want to add ajax function, so I want to add if statement to change the outputs.</p>
<pre><code>if(js is on){
...
...
echo "js is on";
}else{
...
echo "js is off";
}
</code></pre>
<p>Is there any way I can detect if js is on with php? </p>
<p>Or is there any way I can remove/hide it by jquery?</p>
<p>Thanks in advance.</p>
|
php javascript
|
[2, 3]
|
5,574,748
| 5,574,749
|
Accessing a javascript object with jQuery
|
<p>After creating an object with JavaScript I am looking to access it with jQuery to manipulate it. Here is some code to make things clearer:</p>
<pre><code>ObjectFunction = function(content) {
this.content = content
}
ObjectFunction.prototype = {
showobject : { return this.appendTo(document.body)}
}
obj = New ObjectFunction()
</code></pre>
<p>What I would like to do is as follows, but the syntax is wrong:</p>
<pre><code>$(obj).css{(background:'red')}
</code></pre>
<p>This doesn't work. If I create a function in prototype, which would look something like this, it works:</p>
<pre><code>ObjectFunction.prototype = {
showobject : { return this.appendTo(document.body)},
objectmodify: { return this.css{(background:'red')}}
}
// then call something like
obj.objectmodify()
</code></pre>
<p>Is there any way to avoid this ugly code for a direct jQuery function applied on the object? </p>
|
javascript jquery
|
[3, 5]
|
61,864
| 61,865
|
JavaScript Yes/No Preceding ASP.NET Button Event
|
<p>Hi I'm trying to learn more JavaScript AJAX. Basically I would like to have a popup Yes No on a delete button that would precede the actual C# event being fired. I could do this all in C# but I know doing it client side would be beneficial as it would reduce server load.</p>
<p>I'm not sure exactly how to go about this. Any ideas?</p>
|
c# javascript asp.net
|
[0, 3, 9]
|
5,799,720
| 5,799,721
|
Submit form and get redirect url
|
<p>I need to submit some data on a website in-order to register a server. I need to enter information onto a form in the first webpage and upon submitting the information, the webpage takes me to a dynamically created page (I also need to retrieve this page) where I have to enter more information in the form. </p>
<p>I need to accomplish this task programmatically. I can either use Java, Javscript or C#. I am familiar with the languages, but not completely sure what libraries could I use in any of the languages to achieve this task. I would really appreciate it if you guys can provide some help/hints or starting points on this issue. </p>
<p>Thanks</p>
|
c# java javascript
|
[0, 1, 3]
|
347,633
| 347,634
|
How to get the correct path in asp.net when deploying from localhost to a development server?
|
<p>I have a simple web application that contains a folder called documents on the root of the website. Inside documents, is a file called test.doc. The path and file are stored in a database and when the web app is run, it reads in the values and creates the correct link to test.doc, in this case, it is <a href="http://localhost/documents/test.doc" rel="nofollow">http://localhost/documents/test.doc</a>. The problem occurs when I publish to a folder on a development server. When I do that, my url is broken because it becomes something like this, <a href="http://development/testapp/documents/test.doc" rel="nofollow">http://development/testapp/documents/test.doc</a>. This fails because it is looking for test.doc in <a href="http://development/documents/test.doc" rel="nofollow">http://development/documents/test.doc</a>. I am not sure how to resolve this issue.</p>
<p>I am currently doing this in the markup, but I am unsure how to use ResolveUrl or ResolveClientUrl with it:</p>
<pre><code><a runat="server" href='<%# Eval("url") %>'><%#Eval("title") %></a>
</code></pre>
|
c# asp.net
|
[0, 9]
|
3,455,886
| 3,455,887
|
file not saved correctly
|
<p>Im trying to get image using webservice and saved to sd card. The file saved but i couldnt open the file. Once i open the file it saying "could not load image". Below is my code.</p>
<pre><code>httpTransport.call(SOAP_ACTION, envelope);
Object response = envelope.getResponse();
test = response.toString();
Blob picture = org.hibernate.Hibernate.createBlob(test.replaceAll("-", "").getBytes());
String FILENAME = "voucher1.jpg";
File root = Environment.getExternalStorageDirectory();
FileOutputStream f = new FileOutputStream(new File(root, FILENAME));
InputStream x=picture.getBinaryStream();
int size=x.available();
byte b[]= new byte[size];
x.read(b);
f.write(b);
f.close();
</code></pre>
<p>Please help. Thanks</p>
|
java android
|
[1, 4]
|
4,509,864
| 4,509,865
|
how to convert unordered list( UL, LI) to continuous string
|
<p>I want to convert following html code into continuous string using jquery/javascript.</p>
<pre><code><ul>
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
</code></pre>
<p>This is the html placed inside the textarea(with id "description") when I read these contains using <code>$('#description').text()</code>, I get this description as</p>
<pre><code>one
two
three
</code></pre>
<p>instead I would like to get it as "one two three" i.e. continuous, any suggestion?</p>
|
javascript jquery
|
[3, 5]
|
3,841,880
| 3,841,881
|
Dynamically adding a command button to a GridView
|
<p>I'm having an issue with trying to add a button to my grid. My GridView is first loaded with data in the PageLoad event.</p>
<p>I'm then taking the data in the first cell of each row, and creating a button that will link to a URL. To get the URL, I have to run a query with the data in the first cell as a parameter. I was doing this in the RowDataBound event at first, but hitting that query for every row was making it really slow.</p>
<p>So I decided to add a button that would retrieve the URL only when you clicked the button.</p>
<p>Here's my GridView:</p>
<pre><code><asp:GridView ID="gvResults" runat="server"
OnRowDataBound="gvResults_RowDataBound"
OnRowCommand="gvResults_RowCommand">
</asp:GridView>
</code></pre>
<p>And my code:</p>
<pre><code>protected void gvResults_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.DataItem != null)
{
LinkButton lb = new LinkButton();
lb.CommandArgument = e.Row.Cells[0].Text;
lb.CommandName = "NumClick";
lb.Text = e.Row.Cells[0].Text;
e.Row.Cells[0].Controls.Add((Control)lb);
}
}
protected void gvResults_RowCommand(object sender, CommandEventArgs e)
{
switch (e.CommandName.ToLower())
{
case "numclick":
string url = GetUrl(e.CommandArgument.ToString());
Response.Redirect(url);
break;
default:
break;
}
}
</code></pre>
<p>The grid generates fine, the button gets added to the grid for each row. But when I click on it, the RowCommand event doesn't fire, and the page just refreshes.</p>
<p>Does anyone know what the issue is?</p>
|
c# asp.net
|
[0, 9]
|
3,124,423
| 3,124,424
|
Saving Android application state
|
<p>I understand how to save an application's state by using SharedPreferences, onSavedInstanceState() & onRestoreInstanceState(), etc as outlined in a similar post ( <a href="http://stackoverflow.com/questions/151777/how-do-i-save-an-android-applications-state">http://stackoverflow.com/questions/151777/how-do-i-save-an-android-applications-state</a> ), but how do I save the last activity?</p>
<p>To be more specific, my application starts up and goes to a login screen. Once a user logs in and navigates through several activities, lets say he or she leaves the app using the home button or in some other way. Next time the user starts the app, it will go back to the login screen and do a login again. Instead, I want the app to start up and go to the last activity that was on top of the stack when the user left the app in the previous session.</p>
<p>How is the last activity saved so that it can be restored on app startup?</p>
|
java android
|
[1, 4]
|
1,069,900
| 1,069,901
|
jquery click function load php-page only first click
|
<p>page is loaded only once, that is, when you press the button the first time. How to make so that it is loaded and on subsequent pressings? And how to pass data from php to javascript? javascript alert work fine, but page bbb.php load only 1-st time. tnx</p>
<pre><code> <body>
<div id="stage">STAGE</div>
<div id="driver"><p>click to load graph</p></div>
<script type="text/javascript" language="javascript">
function bindClicks() {
$("#driver").live('click', function() {
$.get("http://127.0.0.1/bbb.php", { year: "2011", $month: "08", day: "06" }, function(data){
$('#stage').html(data);
alert("work fine");
});
});
}
</script>
<script type="text/javascript" language="javascript">
$(document).ready(function(event){
bindClicks();
event.preventDefault();
});
</script>
</body>
</code></pre>
|
php javascript jquery
|
[2, 3, 5]
|
4,279,750
| 4,279,751
|
Merge Merger header columns in gridview?
|
<p>How can I create below type of gridview with merge merged header columns? If anybody have example share with me.</p>
<p><img src="http://i.stack.imgur.com/LqC9E.jpg" alt="alt text"></p>
<p>Thanks in advance.</p>
|
c# asp.net
|
[0, 9]
|
541,057
| 541,058
|
Need only Vertical scrollbars in window.showModalDialog
|
<p>I have following code in - </p>
<pre><code>function getPopup1(redirectString) {
var dialog = window.showModalDialog(redirectString , null,
'status:no;dialogWidth:700px;dialogHeight:900px;dialogHide:true;help:no;scroll:1');
}
</code></pre>
<p>and the .aspx page has following code, on which I am redirecting-</p>
<pre><code><body style="background-color:White; padding-right:16px; padding-left:16px; width:650px" onload="ScrollData()">
</code></pre>
<p>I reffered, Stackoverflow Question <strong>Show only Vertical scrollbar in ModalDialog window?</strong></p>
<p>but, it is not working in my case. Can anyone suggest, whats wrong in it?</p>
|
javascript asp.net
|
[3, 9]
|
3,241,657
| 3,241,658
|
String Mapping in Javascript
|
<p>Currently I have implemented a Javascript Ajax search where if user types a city name I am populating the name in the search result. Problem is there are cities which have alternate names (for example Mumbai has Bombay as alternate name.....Bangalore has Bengaluru as alternate name). I want to map the alternate names of the city to the correct name using javascript. ALSO there might be multiple alternate names for the city not only one. so how can I map alternate cities name to correct one using javascript.</p>
|
javascript jquery
|
[3, 5]
|
4,217,872
| 4,217,873
|
What's the best way to send JavaScript array to PHP script using GET?
|
<p>I have an interactive web application powered by jQuery where users can manipulate visual objects on the screen. When done, the "state" of JavaScript objects should be sent to PHP to store into database. I'd prefer to use GET for this, but solution that uses POST to submit the data is also viable. </p>
<p>I'm currently thinking to serialize all JS objects using something like base64 encoding and just use something like:</p>
<pre><code>var str = encode_objects();
document.location = 'result.php?result='+str;
</code></pre>
<p>However, something tells me there has to be some, more elegant, way than writing my own base64 encoding function in JavaScript. Isn't there something already built into JavaScript that can do the job?</p>
<p><strong>Update:</strong> decoding in PHP is not the problem. I know how to decode base64, JSON, whatever in PHP. The problem is how to encode data on JavaScript side.</p>
<p>AJAX is out of the question. It has to be a clean GET or POST with page reload.</p>
|
php javascript jquery
|
[2, 3, 5]
|
2,332,946
| 2,332,947
|
Expire a particular page on back button of browser
|
<p>if users press the browser's back button to reach the prior page, the page should display a message like "web page expired".</p>
<p>can i use javascript for this???</p>
<p>for example:
there are 4 pages in web sites. on page 1,2 and 3 the user can use the back-button, wheras on the 4th page the user gets the desired message.</p>
<p>i thought that i can do this by using counter.</p>
<p>i used following javascript on the master page ..</p>
<pre><code><script type="text/javascript">
function GoBack() {
window.history.go(+1);
}
</script>
</code></pre>
<p>and call the function in body like this:</p>
<pre><code><body onload="GoBack();">
</code></pre>
<p>and on the 4th <code>page_load</code> i do the following:</p>
<pre><code>Response.Cache.SetCacheability(HttpCacheability.NoCache);
</code></pre>
<p>it is working for all pages .. but i want to do this only for the 4th page</p>
|
c# asp.net
|
[0, 9]
|
1,073,391
| 1,073,392
|
Get number of elements based on data attribute value
|
<p>Should be a simple thing, but I'm getting no where.</p>
<p>I want to get the number of elements with a given data-attribute value.</p>
<p>I have some html elements with various data-size='values'. Need to get the number of items with each value.</p>
<p>If you look at the code below, I want to get the number of 'p' sizes and 'l' sizes</p>
<pre><code>$('.overview li img').each(function () {
var s = $(this).data('size');
switch (s) {
case 'p':
r = 0.66667
break;
case 'l':
r = 1.5
break;
}
var imgW = $(this).css({
width: h * r + 'px'
});
</code></pre>
<p>})</p>
<p>any help greatly appreciated</p>
<p>cheers
dave</p>
|
javascript jquery
|
[3, 5]
|
956,975
| 956,976
|
How do i get the css properties by specifying its id
|
<p><a href="http://stackoverflow.com/questions/590602/padding-or-margin-value-in-pixels-as-integer-using-jquery">Padding or margin value in pixels as integer using jQuery</a>
after reading the above Answers . One of the user exaplained these </p>
<pre><code> alert($("a").css("margin-top"));
</code></pre>
<p>Now I wanted to do these</p>
<pre><code> alert($("#cool").css("margin-top")); ' #cool is my table id <table id="cool">
</code></pre>
<p>but it did not work. How do i get the css properties of a tag by specifying its id ?</p>
|
javascript jquery
|
[3, 5]
|
4,204,783
| 4,204,784
|
calling javascript function from .net codebehind with a value
|
<p>I am trying to call a javascript function from asp.net codebehind using onclientclick for a linkbutton. Code is like this:</p>
<pre><code>string x = "redirecttoimagepage"+"("+ y+")";//y has an int value i need and it varies
lnkimagepage.OnClientClick = x;
</code></pre>
<p>i need to use the value y in the javascript function for using. </p>
<pre><code> function redirecttoimagepage(variable)
{
var strURL = "Subpages.aspx?tabID="+variable;
window.open(strURL,"_blank");
return true;
}
</code></pre>
<p>Right now, with the code i have shared, it doesnt do anything. After the link is clicked, it stays in the same page. What am i doing wrong? Appreciate all your help guys. Thanks a lot!</p>
|
c# javascript asp.net
|
[0, 3, 9]
|
758,789
| 758,790
|
Call client script from button with submit behaviour false?
|
<p>How do I call a client script function from a server side button click(with submit behaviour set to false) .</p>
<pre><code>protected void Button4_Click(object sender, EventArgs e)
{
//System.Threading.Thread.Sleep(2000);
lbDateTime.Text=System.DateTime.Now.ToString();
ClientScript.RegisterClientScriptBlock(this.GetType(),"success","saveSuccess()");
}
</code></pre>
|
javascript asp.net
|
[3, 9]
|
4,454,400
| 4,454,401
|
How to implement this keyboard hooking function in javascript/jquery?
|
<p>I need to implement a keyboard for my language. For example, I want that if you type <code>"a"</code> then in the textbox or input box will show: <img src="http://cl.cooltext.com/rendered/cooltext530153213.png" alt="ka">.....If i press "m" it will show: <img src="http://i.stack.imgur.com/5hL2n.png" alt="enter image description here"></p>
<p>Now, this is not possible in current webbrowsers because there is no hooking functionality here. For this,I have decided that this algorithm:</p>
<ol>
<li>Detect keycode of the typed letter (in this case <code>"a"</code>)</li>
<li>Maintain a keymap and found from the keycode (in step1) which key will be replaced by <code>"a"</code></li>
<li>Replace the textarea/textInput as: "string before --a--"+ replaced key from step2 + "rest of the portion after --a--"</li>
<li>return false so that "a" is not written into the textarea/textInput by the browser.</li>
</ol>
<hr>
<p>I am searching for a better idea than running <strong>substring</strong> method after keystroke...Please help.</p>
|
javascript jquery
|
[3, 5]
|
3,730,588
| 3,730,589
|
Filling label value with javascript. Label empty in code behind after postback?
|
<p>I have some text that needs to be changed after a click of a button. The button triggers a Javascript. This Javascript changes the value of the label. When I check the value of the label in the in different places its always empty.
I check the value of the label in page load and the pre render.</p>
<pre><code>void Page_PreRender(object sender, EventArgs e)
{
string siteALias = lblSiteAliasDiscription.Text; //empty
}
protected void Page_Load(object sender, EventArgs e)
{
string siteALias = lblSiteAliasDiscription.Text; //empty
}
function setDiscription(siteAlias, discription) {
alert(siteAlias);
document.getElementById("ctl00_contentHolder_lblSiteAliasDiscription").InnerHTML = siteAlias;
alert(document.getElementById("ctl00_contentHolder_lblSiteAliasDiscription").InnerHTML);
}
</code></pre>
<p>Both alerts are filled in the right way, this is why I'm sure the label gets clear after the Javascript runs. Is there a way to read be able to read the label with the filled in value in the code behind?</p>
|
c# javascript asp.net
|
[0, 3, 9]
|
4,387,340
| 4,387,341
|
Multiple JavaScript Issue
|
<p>I include the following in my header</p>
<pre><code><!-- scripts -->
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<script type="text/javascript" src="./js/script.js"></script>
<script type="text/javascript" src="./js/jquery.infinitecarousel.js"></script>
<script type="text/javascript" src="./js/news.ticker.js"></script>
<script type="text/javascript" src="./js/jquery.autogrowtextarea.js"></script>
</code></pre>
<p>but the autogrowtextarea dont work if the script.js,jquery.infinitecarousel.js and news.ticker.js are included, but if i remove those three lines my autogrow textbox function work, why can this be. thanks</p>
|
javascript jquery
|
[3, 5]
|
2,308,475
| 2,308,476
|
JQuery add onclick string to anchor that are not of a class
|
<p>I have some html code which is loaded by reading some json. Inside that data there are some links.</p>
<p>I need to add <code>onclick="myfunction();"</code> to the anchors of these links.</p>
<p>As I don't want any other links to be changed I have added a class to all internal link (Links which are not imported).</p>
<p>What I need is some jquery which would do this:</p>
<p>IF Links have not go <code>class="internal"</code> then add onclick="myfunction();"**</p>
<p>So if link looks like:</p>
<pre><code><a href="" class="internal">Click me</a>
</code></pre>
<p>then nothing is done</p>
<p>but if it's like this:</p>
<pre><code><a href="">Click me</a>
</code></pre>
<p>then it's changed to this:</p>
<pre><code><a href="" onclick="myfunction();">Click me</a>
</code></pre>
<p>How can I do this?</p>
|
javascript jquery
|
[3, 5]
|
3,687,580
| 3,687,581
|
Using jQuery .change() to change values in a <p> element
|
<p>I have a select element with a few options for currencies, and then a <code><p></code> element at the bottom that currently prints the current exchange rate for USD to another currency. What I'm trying to do, is upon <code>.change()</code> of the select element value, I want to insert the value of the select element into a PHP script, and then re-<code>.load()</code> the <code><p></code> element.</p>
<p>How can I pass a value from jQuery .val() to a PHP script?</p>
|
php jquery
|
[2, 5]
|
3,449,431
| 3,449,432
|
JQuery Check All/ Uncheck All not working on ASP.NET
|
<pre><code>$(document).ready(function() {
$('#chkRFI').click(
function() {
$("INPUT[type='checkbox']").attr('checked', $('#chkRFI').is(':checked'));
}); });
<div class="grid_3">
<div class="box">
<div class="boxheader">
<asp:CheckBox ID="chkRFI" runat="server" Text="RFI" />
</div>
<div class="boxbody">
<asp:CheckBoxList ID="chklstRFI" runat="server" CssClass="boxbodylist">
<asp:ListItem Text="RFI No" Value="RFI" />
<asp:ListItem Text="RFI Date" Value="RFI_Date" />
</asp:CheckBoxList>
</div>
</div>
</div>
</code></pre>
<p>How to solve? Please provide me any ideas...
Thanks</p>
|
c# jquery asp.net
|
[0, 5, 9]
|
5,307,440
| 5,307,441
|
jQuery sticky top menu bar request
|
<p>Im looking for a jQuery pluging (or code/guide) that does this: <a href="http://codecanyon.net/item/jquery-css3-sticky-mega-menu-bar/full_screen_preview/239093" rel="nofollow">http://codecanyon.net/item/jquery-css3-sticky-mega-menu-bar/full_screen_preview/239093</a></p>
<p>This one is not free</p>
<p>Note: Notice the navigation bar is not placed at the top from the beginning. It sticks once the viewport "hits" it.</p>
|
javascript jquery
|
[3, 5]
|
4,923,061
| 4,923,062
|
Binding sub Objects to DataField and DataSource
|
<pre><code>class A
{
int ID;
B ClassB;
}
class B
{
string Title;
}
</code></pre>
<p>Using the above mock classes as examples - I have a dynamically created GridView. To this I bind (add to the Columns collection) X number of BoundFields and then assign a collection to the DataSource, however, my sub objects are not binding.</p>
<p>The DataField property of the BoundFields is set to "ClassB.Title" and the DataSource is a collection of objects of type A but it keeps throwing the exception "A field or property with the name 'ClassB.Title' was not found on the selected data source. "</p>
<p>Any thoughts why?</p>
<p>Cheers</p>
|
c# asp.net
|
[0, 9]
|
4,660,604
| 4,660,605
|
referencing dynamically loaded things from a previously loaded jquery script
|
<p>let's say that i have something like this:</p>
<pre><code><head><script src="script1.js" ...></script></head>
<body><div id="div1"></div></body>
</code></pre>
<p>which i call index.html, and div1's content is loaded dynamically, like</p>
<pre><code>$("#div1").html ("div1.html");
</code></pre>
<p>where div1.html is something like</p>
<pre><code><div id="div2"><canvas id="canv1" ... /></div>
</code></pre>
<p>and i want to reference canv1 somehow in script1.js; by just operating on $("#canv1") nothing happens because script1.js is loaded <strong>before</strong> div1.html; is there a way (e.g. $(document).on(...)) to "do something as soon as [..] is loaded"? i tried</p>
<pre><code>$(document).on ("load", "#canv1", ...);
</code></pre>
<p>but it doesn't work. it's worth noticing that $(document).on ("click", "#canv1", ...) works, but it's not what i want (as in, i want to draw something in the canvas before caring of what happens on click...); any ideas?</p>
|
javascript jquery
|
[3, 5]
|
3,114,111
| 3,114,112
|
Question about Client IDs
|
<p>I have a user control that is emmitting javascript using the ClientId function. For example:</p>
<pre><code>Out &= "ValidatorHookupControlID(" & Quote & ddlMonth.ClientID & Quote & "), document.all(" & Quote & CustomValidator1.ClientID & Quote & "));" & vbCrLf
</code></pre>
<p>It appears to me that the ClientID function DOES not return the ultimate ID that is sent to the browser. Instead, the ClientID function only appears to be aware of its current parent control, which in this case is a the User Control and so the ID that is returned is the ID "dtmPassportExpirationDate_ddlMonth"</p>
<p>When in fact the usercontrol is included in a master page and the ultimate ID that is used is:</p>
<p>"ctl00_phPageContent_dtmPassportExpirationDate_ddlMonth"</p>
<p>I may be nuts, but that's what it appears to be doing. I expect that the ClientID function would return the ultimate ID used in the HTML.</p>
<p>Am I missing something?</p>
|
asp.net javascript
|
[9, 3]
|
3,417,748
| 3,417,749
|
Using variables in JQuery
|
<p>I have the following code:</p>
<pre><code>$("#tag-add-button").click(function () {
var text = $("#tagadd").val();
var tagcounter=0;
$("#set-tags").append("<%= render 'tag' %>");
$("#tag"tagcounter).val(text);
$("#tagadd").val("");
tagcounter=tagcounter+1;
});
</code></pre>
<p>Clearly its wrong, but here is what I'm trying to accomplish:</p>
<p>Someone clicks the tag-add-button, the text from tagadd is stored in the "text" var.</p>
<p>The variable tagcounter is set to 0</p>
<p>An input is rendered (within the set-tags div) containing an id such as "tag0", "tag1" etc.</p>
<p>The input ("tag0" etc.) then receives the value from the "text" var. </p>
<p>The original input box "tagadd" is then replaced with nothing ("").</p>
<p>Lastly the tagcounter variable increases by 1.</p>
<p>How can I make this work?</p>
|
javascript jquery
|
[3, 5]
|
5,889,714
| 5,889,715
|
my jquery code dont work?
|
<p>
<p>UCCN1003</p>Edit</p>
<pre><code><script type="text/javascript">
$(function(){
$('a.edit').click(function(event){
var change = $(this).parent('div').find('p');
var changeText = change.text();
var wrapper = $(this).parent('div');
var clone = change.clone(true);
var changeBox = $(this).parent('div').find('.editBox');
var changeBoxText = changeBox.val();
if($(this).text() == 'Edit'){
wrapper.prepend("<input class='editBox' type='text' value='"+ changeText + "'/>");
wrapper.append("<a href='#' class='save' style='margin-left:10px' >Save</a>");
change.remove();
$(this).text("cancel");
}else if($(this).text()=='cancel'){
wrapper.prepend("<p>" + changeBoxText +"</p>");
$('.editBox').remove();
$('.save').remove();
$(this).text('Edit');
}
});
$('.save').click(function(event){
var editBox = $(this).parent('div').find('.editBox');
var editBoxText = editBox.text();
var wrapper = $(this).parent('div');
wrapper.prepand("<p>" + editBoxText + "</p>");
editBox.remove();
$(this).remove();
});
});
</script>
</code></pre>
<p>
</p>
<p>My part that work work is </p>
<pre><code> $('.save').click(function(event){
var editBox = $(this).parent('div').find('.editBox');
var editBoxText = editBox.text();
var wrapper = $(this).parent('div');
wrapper.prepand("<p>" + editBoxText + "</p>");
editBox.remove();
$(this).remove();
});
</code></pre>
<p>where the wrapper wont prepand the p tag and the editBox and the .save wont be remove.
i try to add alert("work") in this and it wont alert at all. anyone know why?</p>
|
javascript jquery
|
[3, 5]
|
3,379,727
| 3,379,728
|
Keeping scroll distance from top of page despite window height
|
<p>I am changing the background color of my page based on the scroll position from the top of the page, but I want to cycle through all of the colors regardless of of the height of the window. What I have now is strictly based on the number of pixels the scroll is from the top of the page, but you'll see that is dependent on the window height. How could I modify this to get it to always scroll through all of the colors, even if the browser is resized?</p>
<p>What I have so far:
<a href="http://jsfiddle.net/keith/P7ER3/" rel="nofollow">http://jsfiddle.net/keith/P7ER3/</a></p>
|
javascript jquery
|
[3, 5]
|
2,488,716
| 2,488,717
|
Hide submit button after submission?
|
<p>After submit, I want the submit button to get hide via jQuery. It hides, but soon after the page reloads... Why?</p>
<p>HTML:</p>
<pre><code><!DOCTYPE html>
<html>
<head>
<script src="js/submit_rsvp.js"></script>
<script src="js/jquery-1.2.3.pack.js"></script>
<script src="http://code.jquery.com/jquery-git.js"></script>
</head>
<body>
<form name="rsvp" method="post" action="" id='form'>
<input type='submit' name='submit' value='submit' id='submit' class='clickMe'>
</form>
</body>
</html>
</code></pre>
<p>JS:</p>
<pre><code>$(document).ready(function() {
$(".clickMe").click(function() {
$("submit").hide();
});
});
</code></pre>
<p>Thanks!
Coulton</p>
|
javascript jquery
|
[3, 5]
|
611,268
| 611,269
|
How to rewrite the code using jQuery
|
<p>How to rewrite the code using jQuery?</p>
<pre><code> <script type="text/javascript">
window.onload = function(){
var array = document.getElementsByTagName('div');
for (var i=0; i<array.length; i++) {
(function(i) {
array[i].onclick = function() {
alert(i);
}
})(i);
}
};
</script>
<div>0</div>
<div>1</div>
</code></pre>
<p>Thanks...</p>
|
javascript jquery
|
[3, 5]
|
785,880
| 785,881
|
Override jQuery functions
|
<p>Is there way to override jQuery's core functions ?
Say I wanted to add an alert(this.length) in size: function()
Instead of adding it in the source </p>
<pre><code>size: function() {
alert(this.length)
return this.length;
},
</code></pre>
<p>I was wondering if it would be possible to do something like this :</p>
<pre><code>if (console)
{
console.log("Size of div = " + $("div").size());
var oSize = jQuery.fn.size;
jQuery.fn.size = function()
{
alert(this.length);
// Now go back to jQuery's original size()
return oSize(this);
}
console.log("Size of div = " + $("div").size());
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,636,820
| 1,636,821
|
jquery variable not being set within function.asynchronous?
|
<p>i think this has something to with the function being asynchronous but i'm not sure. i think it's a quick answer but i can't figure it out.</p>
<p>i'm trying to check if images exist on the server. if they do, then set a variable. if they don't then move on and check the next image.</p>
<p>every time i alert the variable though i keep getting 0. i know the urls are correct and everything. for some reason though i can't get the variable. any tips?</p>
<pre><code> $('.rightPostContent img').each(function(){
var c = $(this).attr('src');
var pot1 = c.replace('_B.png','_pt1.gif');
var pot2 = c.replace('_B.png','_pt2.gif');
var pot3 = c.replace('_B.png','_pt3.gif');
$.get(pot3)
.done(function() {
var t = 3;
}).fail(function() {
})
$.get(pot2)
.done(function() {
var t = 2;
}).fail(function() {
})
$.get(pot1)
.done(function() {
var t = 1;
}).fail(function() {
})
alert(t);
});
</code></pre>
<p>the variable <code>t</code> wont alert anything, even though all <code>pot</code> images exist in this example.</p>
|
javascript jquery
|
[3, 5]
|
483,542
| 483,543
|
change image url when click image button
|
<p>I had three image buttons they had default image url and I tried to change image url when user click on any image button and the default retrieve when user click to other image button tried to do that but I did not </p>
<pre><code><aspx>
<div class="hom_but_sa hom_but_saR">
<asp:ImageButton ID="BTNPromotion" ImageUrl="images/home-bu_npro.jpg"
runat="server" Width="134" Height="34" border="0"
OnClick="BTNPromotion_Click" />
</div>
<div class="hom_but_a hom_but_sbR">
<asp:ImageButton ID="BTNNewProduct" ImageUrl="images/home-bu_pro.jpg"
runat="server" Width="134" Height="34" border="0"
OnClick="BTNNewProduct_Click" />
</div>
<div class="hom_but_a">
<asp:ImageButton ID="BTNEvent" runat="server" ImageUrl="images/home-bu_news.jpg"
Width="134" Height="34" border="0" OnClick="BTNEvent_Click" />
</div>
</div>
<cs>
protected void BTNEvent_Click(object sender, ImageClickEventArgs e)
{
BTNEvent.ImageUrl = "images/home-bu_news.jpg";
}
protected void BTNNewProduct_Click(object sender, ImageClickEventArgs e)
{
BTNNewProduct.ImageUrl = "images/home-bu_pro_r.jpg";
}
protected void BTNPromotion_Click(object sender, ImageClickEventArgs e)
{
BTNPromotion.ImageUrl = "images/home-bu_npro_r.jpg";
}
</code></pre>
|
c# asp.net
|
[0, 9]
|
3,555,274
| 3,555,275
|
Display JS Calculation Sum In An Input Field
|
<p>I want to display the sum of this calculation in an input field:</p>
<pre><code>function calculateSum1() {
var sum = 0;
//iterate through each textboxes and add the values
$("input.miles").each(function() {
//add only if the value is number
if(!isNaN(this.value) && this.value.length!=0) {
sum += parseFloat(this.value);
}
});
$("input.summiles").value(sum);
}
</code></pre>
<p>input field:</p>
<pre><code><input class="summiles" type="text" value="">
</code></pre>
<p>It works fine if I display it in a span, but I can't seem to get it to display in an input field. Any ideas? Thanks!</p>
|
javascript jquery
|
[3, 5]
|
4,812,034
| 4,812,035
|
connect to ms sql database in a server
|
<p>i am working on a app which should take data from a database on a server. it is a ms sql database. i need some help like little code hints or some useful information.</p>
<p>thank you!</p>
|
java android
|
[1, 4]
|
4,119,447
| 4,119,448
|
Evaluating specific array value using jQuery or JavaScript
|
<p>I have 160 inputs in my page. I want to add every 8 inputs and output it elsewhere. Instead of manually using </p>
<pre><code>var total1 = inputVals[0] + inputVals[1] + inputVals[2] + inputVals[3] + inputVals[4] + inputVals[5] + inputVals[6] + inputVals[7] + inputVals[8];
</code></pre>
<p>I want a function with which you can just specify the starting and ending index like addarray(9, 17) and it will add all the values between and will return it. I prefer the function to be in javascript but jquery is OK.</p>
|
javascript jquery
|
[3, 5]
|
1,495,114
| 1,495,115
|
do datatype choices affect performance?
|
<p>I have an object model that I use to fill results from a query and that I then pass along to a gridview.</p>
<p>Something like this:</p>
<pre><code>public class MyObjectModel
{
public int Variable1 {get;set;}
public int VariableN {get;set;}
}
</code></pre>
<p>Let's say variable1 holds the value of a count and I know that the count will never get to become very large (ie. number of upcoming appointments for a certain day). For now, I've put these data types as int. Let's say it's safe to say that someone will book less than 255 appointments per day. Will changing the datatype from int to byte affect performance much? Is it worth the trouble?</p>
<p>Thanks</p>
|
c# asp.net
|
[0, 9]
|
1,390,311
| 1,390,312
|
Thread synchronization Java
|
<p>I am working on Android App and unable to synchronize View with Hardware.
Let me explain.</p>
<p>1) I mute and unmute microphone of Android based on random values (which are random sleeps) stored in array A, from within run method of Thread 1.</p>
<p>2) I draw blue pulses that reflects the mutes of microphone. This is done by independent View class. </p>
<p>3)I move a red line across the graph drawn in above view, by calling from within onTick of a countdown timer. </p>
<p>I start the two threads one after other, this way:</p>
<p>Thread1.start</p>
<p>counter.start();</p>
<p>How to synchronize both of these, I want to do three things at a time and avoid multiple threads. Three things are: Draw the pulses (which is constant) , make the red line move across x axis and touch the blue pulse as soon as the phone is muted, and keep moving every second, the width of pulse reflects duration of delay. as soon as microphone is about to be unmuted, red line should leave the pulse and move forward.</p>
<p>Currently, code is doing what I want. but there is no synchroization. Either microphone does its job first, or graph moves fast. They are not in Sync. </p>
<p>Is there a way to hold a thread, force it to behave as coutdowntimer or sync both of them.
I cannot embed the red line movement in thread 1 because, it will have to progress across x axis every second.</p>
|
java android
|
[1, 4]
|
4,235,753
| 4,235,754
|
jquery not properly serializing json in ajax call
|
<p>Let me start by saying I am not extremely familiar with Javascript and I cannot figure out what is going on here. </p>
<p>I have the following function: </p>
<pre><code> self.search = function () {
var searchTerms = {
"City": this.cityName,
"State": this.stateName,
"StoreNumber": this.storeNumber,
};
$.ajax("/api/SearchApi", {
data: searchTerms,
type: "POST", contentType: "application/json",
success: function (result) {
alert(result);
}
}
});
</code></pre>
<p>When I submit, what happens is that instead of submitting a nice JSON object as expected, it submits a JSON objected formatted as so: <code>"City=testing&State=AL&StoreNumber=test "</code></p>
<p>Ideally I would like to use a GET method that passes the object to my server so that I can return the results, but when I use a get method, it simply appends the above to the API call url resulting in a URL request formed as so: <code>http://localhost:57175/api/SearchApi?City=testing&State=AL&StoreNumber=test</code></p>
<p>Any help would be appreciated. </p>
|
javascript jquery
|
[3, 5]
|
4,385,057
| 4,385,058
|
why is thread.join commonly used to stop threads in android
|
<p>looking at several android examples i see a trend where threads are paused using join() method:</p>
<p>EDIT: please assume that the 2 threads are properly defined. edited the calls to join() </p>
<pre><code>public class MainUI extends Activity{
private GraphicsViewThread g;
private BackendDataViewThread b;
void onCreate(){
g = new GraphicsViewThread();
g.start();
b = new BackendDataViewThread();
b.start();
}
.
.
.
void pauseGame(){
try {
g.join();
}catch (InterruptedException e){
e.printStackTrace();
}
try {
b.join();
}catch (InterruptedException e){
e.printStackTrace();
}
GraphicsViewThread = null;
BackendDataViewThread = null;
}
}
</code></pre>
<ol>
<li>which thread does GraphicsViewThread and BackendDataViewThread join to? </li>
<li>what is the need for using join()? can i not set the references immediately to null?</li>
</ol>
|
java android
|
[1, 4]
|
4,931,159
| 4,931,160
|
loop trough (input and select) elements and check if the value is empty
|
<p>i want to loop trough all the (input and select) elements inside a div and check if the value is empty and then hide it</p>
<p>i have tried this , but it doesn't work : </p>
<pre><code>$("#tabspanel").find('input[type=text] , select').each(function (){
if (!(jQuery.trim(this.value).length > 0)) {
this.hide();
}
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,946,468
| 5,946,469
|
JavaScript Error: Script5007: Object Expected
|
<p>Error reads:</p>
<p>SCRIPT5007: Object expected.
<a href="http://rsatestamle.dminsite.com/Javascript/jqueryplugins.js" rel="nofollow">http://rsatestamle.dminsite.com/Javascript/jqueryplugins.js</a> , line60 character 2.</p>
<p>I'm not sure what's going on with it. Any ideas? Not sure what that error means honestly.</p>
|
javascript jquery
|
[3, 5]
|
1,967,320
| 1,967,321
|
Choosing div placement using append in jQuery
|
<p>Using the following code:</p>
<pre><code><script type="text/javascript">
function moveFront(el){
var me = $('#'+el.closest('div').attr('id'));
var parent = me.parent();
parent.find('div:first').prepend(me);
//?
}
</script>
<div class="comments">
<div id="105">
105
<p>...</p>
<form>...</form>
<div id="116">
116
</div>
<div id="106">
106
</div>
<div id="109">
109
<button onclick="moveFront($(this));"></button>
</div>
</div>
</div>
</code></pre>
<ol>
<li><p>I would like to append a new <code>div</code> element in the element with the ID of 105, however, I don't want it at the end or the start. It should be before the other <code>div</code> elements.</p></li>
<li><p>If a button was used, as demonstrated in the <code>div</code> element with the ID of 109, how would I move it as the first <code>div</code> element with the ID of 105?</p></li>
</ol>
|
javascript jquery
|
[3, 5]
|
1,345,600
| 1,345,601
|
How to get user control javascript function in aspx.cs page
|
<p>In my web application, I have one user control and one aspx page. In the user control, I have one link button and when I click the link button I am calling one Javascript function in the onclientclick event. So here are my requirements</p>
<ol>
<li>I want to Call that user control javascript function in default.aspx.cs page</li>
<li>need to write the code for programatically click the link button</li>
</ol>
|
javascript asp.net
|
[3, 9]
|
3,261,733
| 3,261,734
|
Limit characters via jquery
|
<p>I have a div that displays a bunch of text but I only want 75 characters to be displayed and the rest of the text is replaced by ...</p>
<pre><code><div class="text-info">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation</div>
$('text-info').replaceWith(this).length(75 + "...");
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,534,654
| 3,534,655
|
Insert values into the table depending on the selected dropdown value
|
<p>I have a form in which I have a ComboBox control with two values.</p>
<p>Once the user selects one item in the list, I need to display a table of data corresponding to the option selected.</p>
<pre><code>if (DropDownList1.SelectedValue == 1)
{
// open a SqlCommand
// read values
// fill table
}
else if (DropDownList1.SelectedValue == 2)
{
// etc
</code></pre>
<p>The problem is that I only want to fill the table <em>after</em> the user makes a selection. But when the form is loaded the ComboBox automatically chooses the first option and my code runs, filling the table.</p>
<p>How do I prevent this from happening?</p>
|
c# asp.net
|
[0, 9]
|
5,402,831
| 5,402,832
|
jQuery - check whether string contains numeric value
|
<p>How to check whether a string contains any numeric value by jquery? </p>
<p>I search through many examples but I only get the way to check for a number, NOT number in a STRING. I am trying to find something like <code>$(this).attr('id').contains("number");</code> </p>
<p>(p/s: my DOM id will be something like <code>Large_a</code> (without numeric value) , <code>Large_a_1</code> (with numeric value), <code>Large_a_2</code>, etc.)</p>
<p>What method should I use?</p>
|
javascript jquery
|
[3, 5]
|
3,498,670
| 3,498,671
|
Date Validation not working using JavaScript
|
<p>I have two two date fields - from date and to date, and i need to validate 3 things</p>
<ul>
<li>Both the values are entered or not</li>
<li>Date datatype check </li>
<li>To date must be greater than from date.</li>
</ul>
<p>But my script is not working.</p>
<p>can some body please check?</p>
<p>Thanks</p>
<pre><code> function checkBothDates(sender,args)
{
var from = document.getElementById(sender.From);
var to = document.getElementById(sender.To);
var behaviorId = sender.behavior;
var from_value = from.value;
var to_value = to.value;
if((from_value == "")&&(to_value == ""))
{
args.IsValid = true;
}
else
{
if((from_value != "")&&(to_value != ""))
{
if((isValidDate(from_value))&&(isValidDate(to_value)))
{
if(from_value < to_value)
{
args.IsValid = false;
sender.errormessage = "To date must be greater than or equal to the from date";
}
}
else
{
args.IsValid = false;
sender.errormessage = "Please enter valid dates in both the fields";
if(behaviorId != null)
{
openCollapsiblePanel(behaviorId);
}
}
}
else
{
args.IsValid = false;
sender.errormessage = "Please make sure you enter both the values";
if(behaviorId != null)
{
openCollapsiblePanel(behaviorId);
}
}
}
}
function isValidDate(val)
{
var format = 'dd/MM/yyyy'
var regexp = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
if (!regexp.test(val))
{
return false;
}
else
{
try
{
$.datepicker.parseDate(format,val,null);
return true;
}
catch(Error)
{
return false;
}
}
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
610,591
| 610,592
|
How to get the value of Preprocessor constant at runtime in ASP.NET / C#?
|
<p>If I have</p>
<pre><code><%@ Page CompilerOptions="/d:QUUX" %>
</code></pre>
<p>how can I test QUUX constant in my C# Code ?</p>
|
c# asp.net
|
[0, 9]
|
1,079,541
| 1,079,542
|
Convert C# row to PHP
|
<p>I want to convert a C# row to PHP, but it doesn't work (the result isn't the same):</p>
<p>C#:</p>
<p>PHP:</p>
<p>Someone know how to do this?</p>
<p>Thanks</p>
|
c# php
|
[0, 2]
|
3,067,847
| 3,067,848
|
function(¶m) - like in PHP
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3877675/javascript-pass-variables-through-reference">JavaScript Pass Variables Through Reference</a> </p>
</blockquote>
<p>How can you do something like this in javascript?</p>
<p>In PHP you can put a <code>&</code> in a function in front of the parameter to write directly back to the variable.. How can you do something like this in javascript?</p>
|
javascript jquery
|
[3, 5]
|
4,548,946
| 4,548,947
|
Extract informations from a list inside a list.
|
<p>In my js I get a list 'data' that looks like that:</p>
<pre><code>data = {test: 'test', test2:'test2', test3 : buffer}
</code></pre>
<p>My 'buffer' has this form: </p>
<pre><code>buffer =[{testa: 'testa', testb : 'testb'}, {testc: 'testc', testd : 'testd'}, {teste: 'teste', testf : 'testf'} ... ]
</code></pre>
<p>What I would like to do is for each element of the buffer, use the data it contains an do an append like this.</p>
<pre><code>$('.try').append('<div> <p> '+testa+' </p> <p> '+testb+' </p> <div>')
$('.try').append('<div> <p> '+testc+' </p> <p> '+testd+' </p>)
...
</code></pre>
<p>html:</p>
<pre><code><div class='try' >
</code></pre>
<p>Any idea on how to do that?</p>
<p>I know I can access 'buffer' with 'data.buffer'. But then, I need to create a loop with each element of 'buffer' and then for each element of buffer, extract the data in it and create a new div...</p>
<p>Any help would be very welcome.</p>
<p>EDIT:
Here is what I tried:</p>
<pre><code> for (var i in data.buffer) $('.try').append('<div> <p> '+i.testa' </p> <p> '+i.testb' </p> </div>')
</code></pre>
<p>But it doesn't work.</p>
|
javascript jquery
|
[3, 5]
|
2,486,776
| 2,486,777
|
dropdownlist bind datatext field with a calculation
|
<p>I have a datatable with one column that is taken from DB</p>
<pre><code>DataTable dt = ent.GetDataTable();
</code></pre>
<p>I am binding it to dropdownlist with </p>
<pre><code>ddl.Datasource = dt;
ddl.datatextfield = "Test";
ddl.DataBind();
</code></pre>
<p>Now i want multiply each value in that column by 1000 and bind to dropdownlist. Is there a way to do this with out looping and changing each value.
I cannot modify the method or query that calls getdatatable() because these are predefined and used in many places.</p>
|
c# asp.net
|
[0, 9]
|
4,355,850
| 4,355,851
|
how do I know when/where to invoke the overridden method of the super class
|
<p>This question occured to me while programming a Android application,
but it seems to be a general programming question more.</p>
<p>The situation is, I am extending (subclass-ing) an class from a library, and overriding a method. how do I know if I should invoke the method of super-class? and when? (in the beginning of the overridden method or in the end?)</p>
<p>For example, I am overriding the method "public boolean onCreateOptionsMenu(Menu menu)" from class "Activity" in Android platform. And I saw someone write "return super.onCreateOptionsMenu(menu)" in the end of the method, in an example. But how do I know it should be done this way? and it is correct or not? what's the difference if I begin my method with "super.onCreateOptionsMenu(menu)"?</p>
<p>BR,
Henry</p>
|
java android
|
[1, 4]
|
2,930,399
| 2,930,400
|
check if the given date(in string format) has past present date using JS
|
<p>I have a date range like 12/20/12-12/24/12(start date-end date) in string format .
I need to check if start date has past the present date. Can it be done using JS or j-query?
the date range is in string ?</p>
|
javascript jquery
|
[3, 5]
|
5,479,654
| 5,479,655
|
How to cancel/kill window.setTimeout before it happens on the client?
|
<p>I have a few places where I use the line below to clear out a status for example. I have a few of these that hang out for 10 seconds or more and if the user gets clicking around the action can occur at incorrect time intervals. Is it possible to cancel or kill this w/ some jQuery or JavaScript so I don't have this process hanging around?</p>
<pre><code>window.setTimeout(function() { removeStatusIndicator(); }, statusTimeout);
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,807,388
| 2,807,389
|
Hyperlink inside aspx.cs page
|
<p>Instead of the following code coming up with messages -</p>
<p><code>public partial class mylogin1 : System.Web.UI.Page</code>
{
<code>protected void Page_Load(object sender, EventArgs e)</code>
{
<code>if (User.Identity.IsAuthenticated)</code>
{
<code>if (User.IsInRole("Principal") || User.IsInRole("Teacher")</code>|| <code>User.IsInRole("Student") || User.IsInRole("Solicitor"))</code>
{
<code>Label wlcm_lbl = (Label)LoginView1.FindControl("Label1");</code>
<code>wlcm_lbl.ForeColor = System.Drawing.Color.Black;</code>
<code>wlcm_lbl.Text = "Welcome " + User.Identity.Name + ". You are approved to use this website. Please select an Option from the left menu to continue.";</code></p>
<p>Instead of this message coming up is there anyway that I can say if Role = teacher go to this page or if role = principle go to this page</p>
|
c# asp.net
|
[0, 9]
|
4,260,722
| 4,260,723
|
Issue with changing an attribute with jquery
|
<p>I'm having an issue with changing the attribute for an id and can't seem to figure out what I'm doing wrong. I guess it doesn't help that I'm new to this also.</p>
<p>I have a function that tests to make sure that I am pulling the correct id from the row in my form that I have dynamically created. It goes something like this:</p>
<pre><code>myFunction() {
var id = $(id).attr("id");
alert("This is my id " + id);
}
</code></pre>
<p>This works with no problem and when I click the button assigned to alert me of my id it will give me the id of the dynamic row in my form. The issue is now when I try to change the id with this:</p>
<pre><code>changeId() {
var newId = $(id).attr("id", "x");
alert("This is my new id " + newId);
}
</code></pre>
<p>What happens in this case is that it will alert saying "This is my new id [object Object]" instead of giving me the new id. Any suggestions? I'd really appreciate any help with this.</p>
|
javascript jquery
|
[3, 5]
|
3,562,698
| 3,562,699
|
Filter values similar
|
<p>I want filter values similar, i tried as following js code, but this code can not filter value <code>111</code> because this no <code>,</code>. my html code is as following (Some do, some do not this: <code>,</code>).</p>
<p>How can fix js code for filter all strings?</p>
<p><strong>DEMO:</strong> <a href="http://jsfiddle.net/bNuRE/" rel="nofollow">http://jsfiddle.net/bNuRE/</a></p>
<p><strong>HTML:</strong></p>
<pre><code><div class="oo">111</div>
<div class="oo">111, 222, 333</div>
<div class="oo">444, 111</div>
<div class="oo">222, 333</div>
///////////////////////////////////////////////////////
<div class="ww">111</div>
<div class="ww">777</div>
<div class="ww">333</div>
<div class="ww">666</div>
</code></pre>
<p><strong>JS:</strong></p>
<pre><code>var valeache = $('.oo').text().split(', ');
$.each(valeache, function (a, val) {
$('.ww').filter(function () {
return $(this).text() == val
}).remove();
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,954,170
| 1,954,171
|
How to use an anchor link and scroll at the same time?
|
<p>Here for some help again :)</p>
<p>I've got this site: sharemyplaylists.com</p>
<p>that uses this scrolling plugin to smoothly bring the user to an anchor when clicked, here is the code:</p>
<pre><code>// Smooth anchor link script
$(document).ready(function()
{
$('a[href*=#]').click(function()
{
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
&& location.hostname == this.hostname)
{
var $target = $(this.hash);
$target = $target.length && $target
|| $('[name=' + this.hash.slice(1) +']');
if ($target.length)
{
var targetOffset = $target.offset().top;
$('html,body')
.animate({scrollTop: targetOffset}, 1000);
return false;
}
}
});
});
// open panel on click script
$(".btn-slide").click(function()
{
$("#panel").slideToggle("slow");
$(this).toggleClass("active"); return false;
});
</code></pre>
<p>Anyway, I also have a button "Submit your playlist" that opens the top panel to reveal a form in the sidebar and when I click this, it just opens the panel (meaning I am not brought up to the top anchor also). It's like the 2 bits of code are conflicting and only one script will work. Any ideas on how to Click the "Submit your playlist" in the sidebar, bring the user to the top header anchor and open the panel also in one click?</p>
<p>Cheers,
Keith</p>
|
javascript jquery
|
[3, 5]
|
508,484
| 508,485
|
jQuery selector by classname minus classname
|
<p>I have the following jquery line in a click event of a <em>p</em> element:</p>
<pre><code>$(this).nextUntil('.Maintheme not:.Document')
</code></pre>
<p>I would like to get all the next elements with class .Maintheme but not .Document.</p>
<p>To explain myself a little better, this is the html that i have:</p>
<pre><code><div id="DocumentContents">
<p class="Maintheme">ParentTheme1</p>
<p class="Document">Document1</p>
<p class="Maintheme">ParentTheme2</p>
<p class="Subtheme">SubTheme1</p>
<p class="Document">Document1</p>
<p class="Document">Document2</p>
<p class="Document">Document3</p>
<p class="Subtheme">SubTheme2</p>
<p class="Document">Document1</p>
</div>
</code></pre>
<p>Having this html content i would like that when you click in a p element if there is not subthemes then show documents. Else if there are subthemes with documents below, just show the subthemes, and if you click in a subtheme show the next documents.</p>
|
javascript jquery
|
[3, 5]
|
2,120,861
| 2,120,862
|
How do I overlay a busy icon on an image?
|
<p>I've been looking through SO and Google trying to find a simple way to overlay a busy icon on an existing image. While applying filters and effects to images I'd like to let the user know it's being processed by showing a busy icon on top of the current image. </p>
<p>Do I need to create some sort of overlay image that I show at the start of the process and hide after it's complete using jquery? </p>
<p>Just looking for some ideas from people that might have done this already.</p>
|
php javascript jquery
|
[2, 3, 5]
|
5,903,965
| 5,903,966
|
JavaScript: Get unique values and their counts from an array of objects?
|
<p>Using jQuery, how can I iterate over an object, and get the unique values of a key with a count of each value?</p>
<p>For example, for this array:</p>
<pre><code>var electrons = [
{ name: 'Electron1', distance: 1 },
{ name: 'Electron2', distance: 1 },
{ name: 'Electron3', distance: 2 },
{ name: 'Electron4', distance: 2 },
{ name: 'Electron5', distance: 2 },
{ name: 'Electron6', distance: 2 },
{ name: 'Electron7', distance: 2 },
{ name: 'Electron8', distance: 2 },
{ name: 'Electron9', distance: 2 },
{ name: 'Electron10', distance: 2 },
{ name: 'Electron11', distance: 3 },
];
</code></pre>
<p>I'd like to get back the following:</p>
<pre><code>var distance_counts = {1: 2, 2: 8, 3: 1};
</code></pre>
<p>I've got this, which works but is a bit clumsy:</p>
<pre><code>var radius_counts = {};
for (var i = 0; i < electrons.length; i++) {
if (electrons[i].distance in radius_counts) {
radius_counts[electrons[i].distance] += 1;
} else {
radius_counts[electrons[i].distance] = 1;
}
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,566,310
| 3,566,311
|
jQuery: Hide element on click anywhere else apart of the element
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/152975/how-to-detect-a-click-outside-an-element">How to detect a click outside an element?</a> </p>
</blockquote>
<p>I'm trying to achieve that a 'div' hides if user clicks anywhere except on the element. I've got following code doing toggle() if user clicks on a button. I want the button click to stay plus if the 'Details' element is visible, reacts to other parts of the screen.</p>
<pre><code> $('.nav-toggle').click(function(){
//get collapse content selector
var collapse_content_selector = $(this).attr('href');
//make the collapse content to be shown or hide
var toggle_switch = $(this);
$(collapse_content_selector).toggle(function(){
if($(this).css('display')=='none'){
//change the button label to be 'Show'
toggle_switch.html('Show Details');
}else{
//change the button label to be 'Hide'
toggle_switch.html('Hide Details');
}
});
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,382,784
| 4,382,785
|
CS0234 Error on runtime, for classes in the same assembly
|
<p>We have an ASP.NET 4 Web Application Project. This project contains a number of pages. After having made some changes I get an error at runtime (ASP.NET Compile time) that this or that namespace cannot be found.</p>
<p>At design time (in Visual Studio 2010) there is no problem for Intellisense to see these namespaces and classes, which are in the project assembly themselves. And there is no problems at compile time in Visual Studio either.</p>
|
c# asp.net
|
[0, 9]
|
3,118,635
| 3,118,636
|
how to add pdf file as an attachment to an email
|
<p>I am dynamically storing each person report as <code>pdf</code> and should send it to them <code>attached with email</code>. How do i send it as an attachment to an email. Here is my code.</p>
<pre><code>public void Esendmail(string EmailFrom, string EmailTo, string EmailBody, string EmailSubject, string EmailCC)
{
MailMessage message = new MailMessage();
message.From = new MailAddress(EmailFrom);
message.CC.Add(EmailCC);
message.To.Add(new MailAddress(EmailTo));
message.IsBodyHtml = true;
message.Body = EmailBody;
message.Subject = EmailSubject;
SmtpClient client = new SmtpClient();
client.Send(message);
}
</code></pre>
|
c# asp.net
|
[0, 9]
|
2,633,212
| 2,633,213
|
Watermark Textbox using javascript
|
<p>I need some help in my code.</p>
<p>I want the code dynamic like using a class in javascript, but I have not been too strong using javascript. I need your solution.</p>
<p>E.g the textbox display a text 'Enter key word or phrase', if someone enter the textbox. text 'Enter key word or phrase' disappear. and if not enter or mouse over the textbox the text 'Enter key word or phrase' appear again in color gray.
I have the code below:</p>
<pre><code><asp:TextBox ID="txtQuery" runat="server" style="color: Gray;"
ValidationGroup="req" value='Enter key word or phrase'
onblur="if (this.value == '') { this.value = 'Enter key word or phrase';
this.style.color = 'Gray'; }"
maxlength="255" onfocus="if(this.value == this.defaultValue){this.value='';
this.style.color='Black'}"></asp:TextBox>
</code></pre>
<p>Please help.</p>
|
c# asp.net
|
[0, 9]
|
470,976
| 470,977
|
javascript method works localy but not on server
|
<p>The following JavaScript method works perfectly fine on local machine, but returns an error after uploading it to GoDaddy server:</p>
<pre><code>//add to saved profiles
function addFav() {
/* opens a dialog */
$("#addFavourite").dialog("open");
/* error occurs in the next line */
var profileName = document.getElementById("MainContent_lblMainName").textContent;
SendMessageWebService.saveProfile(profileName);
};
</code></pre>
<p>i'm using google chrome browser for debugging</p>
|
javascript asp.net
|
[3, 9]
|
6,025,543
| 6,025,544
|
Get value of hidden input field in JS
|
<p>I need to get the value of a hidden input field using JS,</p>
<pre><code> var credoff = parseInt($(this).children('input.credoff:hidden').val());
</code></pre>
<p>which works fine in FF but does not work in IE, the input im talking of is the following...</p>
<pre><code><input type='hidden' value='$row->coff' class='credoff' name='credoff'/>
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,735,927
| 4,735,928
|
Detecting collisions and and walking around obects
|
<p>I am writing a program for an Android phone (Which uses Java as the programming language)</p>
<p>I am writing a game that needs objects to - move around - other objects. For example: if an object was to move from point A to point B and there was another game object in the way, it would move around it.</p>
<p>I also need to detect collisions with object, for example if an object hits another object.</p>
<p>Any good resources for this stuff?</p>
|
java android
|
[1, 4]
|
1,546,019
| 1,546,020
|
Unable to find meaning of }); curly bracket, round bracket in Android
|
<p>As a beginner in Android and having been away from programming for many years, I could not find an answer for this one on the internet. It involves the following code from a book I have been reading, but the syntax is common for Android. I couldn't work out what the }); represented. As someone who, in the past, has made an effort to make bracketing readable, I find this code amazing, surely a better way of showing this is possible?</p>
<p>Here's the code:</p>
<pre class="lang-java prettyprint-override"><code>CheckBox checkBox = (CheckBox)findViewById(R.id.chkAutosave);
checkBox.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v) {
if (((CheckBox)v).isChecked())
DisplayToast("CheckBox is checked");
else
DisplayToast("CheckBox is unchecked");
}
});
</code></pre>
<p>Anyway does anyone know the meaning of the }); at the end?</p>
|
java android
|
[1, 4]
|
3,348,697
| 3,348,698
|
Jquery/javascript datetime
|
<p>i want to convert this string 23/08/2009 12:05:00
to javascript datetime </p>
<p>how can i do it?</p>
|
c# javascript jquery
|
[0, 3, 5]
|
5,370,082
| 5,370,083
|
AutoComplete fixed selection?
|
<p>How do i have an AutoComplete selection based on alphabetic instead of fixed switch cases? The situation is, everything working except when i input keyword with "B" showing Badrul as first suggestion but when clicked it will still refer to the first switch cases which is opening up Adidas.class instead of Badrul.class</p>
<p>Please help, i am new in this. Is AutoComplete suitable for my requirement?</p>
<pre><code>public class Search extends Activity
{
public void onCreate(Bundle savedInstanceSate)
{
super.onCreate(savedInstanceSate);
setContentView(R.layout.searchshop);
AutoCompleteTextView autoComplete = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_item, shops);
autoComplete.setAdapter(adapter);
autoComplete.setThreshold(1);
autoComplete.setOnItemClickListener(new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3)
{
switch(position)
{
case 0:
startActivity(new Intent(Search.this, Adidas.class));
break;
case 1:
startActivity(new Intent(Search.this, Affin.class));
break;
case 2:
startActivity(new Intent(Search.this, AlamArt.class));
break;
case 3:
startActivity(new Intent(Search.this, Badrul.class));
break;
}
}
});
}
static final String[] shops = new String[]
{
"Adidas", "Affin Bank", "Alam Art Gallery", "Badrul"
};
}
</code></pre>
|
java android
|
[1, 4]
|
4,247,455
| 4,247,456
|
The system class loader's resource lookup algorithm
|
<p>In Java <a href="http://developer.android.com/reference/java/lang/ClassLoader.html" rel="nofollow">docs</a> I see such statements:</p>
<blockquote>
<p>The system class loader's resource
lookup algorithm is used to find the
resource.</p>
</blockquote>
<p>But where can I learn how this "lookup algorithm" actually works, especially in context of Android.</p>
|
java android
|
[1, 4]
|
232,624
| 232,625
|
Javascript redirect causing a security exception in asp.net 4.0 forms
|
<p>As part of my current project I have had to make a page take on two functions due to some functional limitations.</p>
<p>At present the two views are turned on and off based on a query string value. The page is loaded from an menu that is similar to that of the original ipods and as such uses Javascript to kick things off.</p>
<p>The problem is when I select my url (along with the query string value) I get a potential security risk error. I believe that its down to security not allowing Javascript to redirect with the query string, however I am at a loss as to how we solve this one.</p>
<p>The error reads -- 'A potentially dangerous Request.Path value was detected from the client (?).'</p>
<p>I know that I can turn the security off on the page, however this is not an option in this instance.</p>
<p>Any ideas would be greatly recieved.</p>
<p>Thanks in advance</p>
|
javascript asp.net
|
[3, 9]
|
2,429,866
| 2,429,867
|
if user pastes 32 characters into the license text-box first split textbox
|
<p>if user pastes 32 characters into the license text-box first split textbox, the method will place 8 characters into each of the 4 text boxes</p>
<p>see
i have 4 text box ... max length (8)</p>
<pre><code><input type = "text" size = "8" maxlength="32" name = "LicenseNumber1"
id="LicenseNumber1">
<input type = "text" size = "8" maxlength="32" name = "LicenseNumber2"
id="LicenseNumber2">
<input type = "text" size = "8" maxlength="32" name = "LicenseNumber3"
id="LicenseNumber3">
<input type = "text" size = "8" maxlength="32" name = "LicenseNumber4"
id="LicenseNumber4">
</code></pre>
<p>& my license is 32 characters like 06e1823681f48e2f013904403b33ff08
now if i paste the whole 32 character in my first test box i.e. LicenseNumber1 then i </p>
<p>want other three textbox wil be automatic fill bcause(8*4=32)</p>
|
javascript jquery
|
[3, 5]
|
608,128
| 608,129
|
convert json object to json array of object
|
<p>I had received a json snippet, which has the following lines (string converted to json object)</p>
<pre><code>"profile":{"id":"billg","name":"Bill Gates","countryCode":"US"}
</code></pre>
<p>now user adds one more profile, i need to convert profile object to an array of profile objects. </p>
<pre><code>"profile":[{"id":"billg","name":"Bill Gates","countryCode":"US"},{"id":"steve","name":"Steve Jobs","countryCode":"US"}]
</code></pre>
<p>Any pointers or code is highly appreciated</p>
|
javascript jquery
|
[3, 5]
|
3,605,569
| 3,605,570
|
Using python to run a C++ program and test it
|
<p>Suppose I have a simple C++ program that takes in inputs and outputs some string. Like this (actual program is much more complicated but still text based):</p>
<pre><code>$ ./game
$ what kind of game? type r for regular, s for special.
$ r
$ choose a number from 1 - 10
$ 1
$ no try again
$ 2
$ no try again
$ 5
$ yes you WIN!
</code></pre>
<p>I haven't used Python before, but is it possible to write a python script to run this program, feeds it input, and outputs the results to standard output? I have ask the question <a href="http://stackoverflow.com/questions/6783256/run-c-program-in-c-program">here</a> about running it using C++ but it seems much too complicated. It would be awesome it you could direct me to some code examples. Any help would be appreciated.</p>
|
c++ python
|
[6, 7]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.