Unnamed: 0
int64 302
6.03M
| Id
int64 303
6.03M
| Title
stringlengths 12
149
| input
stringlengths 25
3.08k
| output
stringclasses 181
values | Tag_Number
stringclasses 181
values |
|---|---|---|---|---|---|
5,143,746
| 5,143,747
|
Convert.ToDouble("4089.90") outputs 40.899,00 why?
|
<p>Hi everyone I am developing a software that uses number precision, but I have this problem, it happens that when I take a string to convert to double it outputs me with a different culture.</p>
<p>For example I use </p>
<pre><code>Convert.ToDouble("4089.90"); // it outputs 40.899,00
</code></pre>
<p>Is strange cause in my computer it works OK but on the client's PC (with the same culture in regional settings) shows me the latter output. I know I can fix it using </p>
<pre><code>Convert.ToDouble("4089.90", System.Globalization.CultureInfo.InvariantCulture);
</code></pre>
<p>But there is a lot of code in the program using "Convert.ToDouble" and I wouldn't like to change all of it, on the other hand I want to understand why this happens.</p>
<p>Thanks in advance.</p>
|
c# asp.net
|
[0, 9]
|
331,469
| 331,470
|
how do i add a selector change event to this?
|
<p>Here is my jquery which works great </p>
<pre><code>$(document).ready(function(){
$('#new_average, #max_occupancy').keyup(function(){
factor = $(".industry_picker option:checked").attr("title");
average = $('#new_average').val();
if($('#new_average').val().indexOf("$") != -1){
average = average.substring(1);
}
if($("#max_occupancy").val() != ""){
max_occupancy = $("#max_occupancy").val();
max_total = ((average * factor) * max_occupancy) * 30;
if(factor != ""){
$("#new_calc").val("$" + max_total + ".00");
}
}
});
});
</code></pre>
<p>but the problems is I need this to fire off on keyup and on </p>
<pre><code> $(".industry_picker")
</code></pre>
<p>changed ....i know I can copy this exact functionality over and have a </p>
<pre><code> $(".industry_picker").change
</code></pre>
<p>but i feel that is a hack...is there a better way of having the </p>
<pre><code>$('#new_average, #max_occupancy").keyup
</code></pre>
<p>and </p>
<pre><code>$(".industry_picker").change
</code></pre>
<p>in the same selector or a better way of achieving this without copying the entire function again</p>
|
javascript jquery
|
[3, 5]
|
4,741,012
| 4,741,013
|
NullReferenceException on Page_Load
|
<p>I'm trying to edit a textbox's text in a Page_Load form on an ASP.NET page, but when I try to edit TextBox1.Text it throws a NullReferenceException because the TextBox has not yet been instantiated. Specifically what I'm trying to implement is this: <a href="http://www.codeproject.com/KB/user-controls/popupcalendarcontrol.aspx" rel="nofollow">http://www.codeproject.com/KB/user-controls/popupcalendarcontrol.aspx</a> but it is written for an older version of ASP.NET and does not work for me. Is there a way to instantiate the controls at the start of Page_Load? or another event that I can catch on load? With a normal windows form I would call InitializeComponent() in the constructor.</p>
|
c# asp.net
|
[0, 9]
|
1,317,004
| 1,317,005
|
Multiple autosuggest fields, filters depending on previous results
|
<p>I'm trying to figure out a method to see if it is possible to have one text field value (the result of a mysql query of an autosuggest field) be used as a filter for another mysql query for another autosuggest field. As in first field autosuggests a country, and the second field would autosuggest a city based in that country, reading from the mysql results.</p>
<p>I've been using nodstrum's tutorial for the autosuggester, <a href="http://www.nodstrum.com/2007/09/19/autocompleter/" rel="nofollow">http://www.nodstrum.com/2007/09/19/autocompleter/</a>, and everything seems to be working, but the only method for multiple fields I can think of is having several "rpc.php" files that have different queries within.
Any suggestions?</p>
|
php javascript
|
[2, 3]
|
940,025
| 940,026
|
can I view two separate aspx files in one webpage?
|
<p>I have an issue where I have two pages that deal with very similar things and as such quite a few of their methods and aspx server controls have identical method names and variables. In short, it's pretty obvious that the code was copy/pasted and the innards were merely altered. I have a pending request that the two pages be merged so I've explored a number of options as to how I should best merge them.</p>
<p>First I thought that perhaps I could put one of the pages in a masterpage that will allow for a content place holder wherein I'd then put the code/controls, but it looked to be a bad idea once I started to make plans. For one the similar names would probably still be a problem and second it seems a rather clunky way to merge two pages together.</p>
<p>I've considered renaming all the methods and controls but on the other hand it's going to take a lot of time picking over the code and the controls to rename them all. My worry is that if I try to change the problematic method names, controls, IDs, I'll introduce a lot of bugs in the code. </p>
<p>Is there a better way to view two pages in one webpage?</p>
|
c# asp.net
|
[0, 9]
|
4,545,688
| 4,545,689
|
Passing an array of functions as a parameter
|
<p>Here's my code:</p>
<pre><code>function test(e, f) {
for (var i = 0; i < e.length; i++) {
$('#clickme').append("<button id='op" + i + "'>" + e[i] + "</button>")
$('#op' + i).click(function () {
f[i]();
})
}
}
$(function postPunk() {
var func1 = function () {
alert('1');
}
var func2 = function () {
alert('2');
}
var func3 = function () {
alert('3');
}
test(['Option1', 'Option2', 'Option3'], [func1, func2, func3]);
})
</code></pre>
<p>The click events aren't calling the functions. If I place an alert test in the click event, it fires fine. </p>
<p>Any ideas why this isn't working? It seems to be a problem with passing the array of functions as a parameter. Is there a better way to do this?</p>
|
javascript jquery
|
[3, 5]
|
2,494,218
| 2,494,219
|
Prevent users to click RadioButton
|
<p>In my form I have some TextBoxes. Once the value of TextBox is changed then corresponding RadioButton will be selected. But I want to prevent users from changing the value of RadioButton.
I tried disabling like this.</p>
<pre><code> optA.Attributes.Add("disabled", "disabled");
</code></pre>
<p>But this script greys out the radiobutton which is not looking good. Is there any script to prevent users from clicking/changing the selected value of radiobutton?</p>
<p>Small example is</p>
<pre><code>totalval=document.getElementById('txt1').value+document.getElementById('txt2').value
if (totalval>101)
document.getElementById('optA1').checked=true;
else if(totalval<100)
document.getElementById('optA2').checked=true;
</code></pre>
<p>This is what I want. So the users should not change the value of radiobuttons (optA1,optA2)
if am using </p>
<pre><code>optA1.Attributes.Add("disabled", "disabled");
</code></pre>
<p>I couldnt get the value of optA1 at server side.
My aspx code is</p>
<pre><code><asp:RadioButton ID="optA1" GroupName="optAchieve" runat="server" Text="30" value="30" onclick="indicateColor()" />
<asp:RadioButton ID="optA2" GroupName="optAchieve" runat="server" Text="20" value="20" onclick="indicateColor()" />
</code></pre>
|
javascript asp.net
|
[3, 9]
|
4,819,234
| 4,819,235
|
How to use javascript or jQuery to read a pixel of an image?
|
<p>How to use javascript or jQuery to read the color of a pixel of an image when user click on it? (of course we have the (x,y) value of this pixel by subscribing to the click event).</p>
<p>Thanks!</p>
|
javascript jquery
|
[3, 5]
|
525,469
| 525,470
|
Number formator - jQuery or Javascript or Java
|
<p>I have a number 100000. I need to display like 1,00,000. How can I achieve this <strong>without</strong> using the string manipulation functions in jQuery or Javascript or Java. Thanks in advance.</p>
|
java javascript jquery
|
[1, 3, 5]
|
3,610,215
| 3,610,216
|
communication between page
|
<p>I have a page (<code>Page A</code>) where user can send email to others, then user should can choose the recipients.</p>
<p>So when user click the "Choose contact" button in <code>Page A</code>, a new browser page (<code>Page B</code>) will open where all their contacts in the database will be displayed using the check box list.</p>
<p>Then the user can choose the contacts he want, when he click "OK" button in <code>Page B</code>,the <code>Page A</code> will close. Then how should I get, in <code>Page A</code>, the contacts the user chosen over at <code>Page B</code>?</p>
|
javascript asp.net
|
[3, 9]
|
1,861,917
| 1,861,918
|
Why is there usually a reference to Java when when people talk about C#?
|
<p>I don't know much about C# but I've been programming in Java for a few months now. I had always heard what C and C++ were, but was a little curious about where C# came from. I'm a little confused about the C# language since even though it's one of the 'C' languages (C, C++, C#), on the other hand all of my professors seem to line it up against Java, and not the others.</p>
<p>If anyone can clarify that would be great :)</p>
|
java c#
|
[1, 0]
|
559,271
| 559,272
|
PHP/jQuery : jQuery posts variable but PHP not reading it
|
<pre><code>echo "function disp_player (playerID) {";
echo "$.post('editor.php', {'idval': playerID});";
echo "alert(playerID);";
echo "alert(" . $playerlist[$_POST['idval']][0] . ");";
</code></pre>
<p>I'm writing a PHP script that is supposed to change text based on a selection made from a drop down.</p>
<p>The page can be viewed here - <a href="http://superonlinehockey.com/editor.php" rel="nofollow">http://superonlinehockey.com/editor.php</a></p>
<p>The first alert works and the playerID is output. Setting $playerlist[$_POST['idval']][0] to a static value like $playerlist[770][0] also works. Using Firebug, I see that the value is added to post and, also using Firebug, it looks like the code all works. However, that second alert gives me an 'Undefined' when I would expect it ot be the same as the first alert.</p>
<p>Can anyone help me? Am I posting wrong? I'm new to jQuery so I'm not sure how this is supposed to work but, based on what I do know, I don't see anything wrong with my code.</p>
|
php jquery
|
[2, 5]
|
8,482
| 8,483
|
Declare a class in another class in android
|
<p>i want to use a class in another class
e.g</p>
<pre><code>public class storge extends Activity {
public void save() {
//
}
}
public class Startuo extends Activity {
.
.
.
.
storge s=new stoge();
s.save();
}
</code></pre>
<p>when i run it the program stop immediately!! Do i have to add a permission or something to let it work ??? are there wrong in the declaration or what ? </p>
|
java android
|
[1, 4]
|
2,882,168
| 2,882,169
|
How many times can I have jQuery's document ready function declared on a page?
|
<p>How many times is it permitted to have the jQuery document ready function declared on a page, i.e.:</p>
<pre><code>$(function () { ... });
</code></pre>
<p>or</p>
<pre><code>$(document).ready(function () { ... });
</code></pre>
<p>Is there any difference between the two?</p>
<p>If it's permitted more than one, do they fire in order of declaration?</p>
|
javascript jquery
|
[3, 5]
|
4,904,013
| 4,904,014
|
How can I insert my own JavaScript into page?
|
<p>I'm using Internet Explorer as the default browser. (Firefox is not an option). </p>
<p>There are some web apps that I like but whose layout and workflow does not quite agree with me. </p>
<p>Given that I am merely a visitor to the website, is it possible to insert <a href="http://jquery.com/" rel="nofollow">jQuery</a> into the webpages I'm browsing so that I can re-arrange the web content and call the javascript functions included? Sort of like using jQuery as a scripting language for IE?</p>
|
javascript jquery
|
[3, 5]
|
3,670,318
| 3,670,319
|
Is there a sexier way to write this jQuery selector?
|
<p>I want to select all the children of the <code>body</code> element before element with id <code>foo</code> (which is a child of <code>body</code>). Since it doesn't look like there are <code>:before()</code> or <code>:after()</code> selectors, I've got it working like this:</p>
<pre><code>$('body > :first').nextUntil('#foo').andSelf();
</code></pre>
<p>but it seems kludgy. Could this be done with fewer function calls, or more efficiently? Maybe something akin to <code>$('body > *:before(#foo)')</code> ?</p>
|
javascript jquery
|
[3, 5]
|
4,933,359
| 4,933,360
|
Kill session on popup close until the closing of browser
|
<p>I want to show a popup about browser compatibility to the users visiting my website. I have used the popup in about 5 pages and it would be annoying for the users to see the same popup for more than once when they visit my website. So I am thinking to use a session and kill it when the user closes the poup. IT should not be shown until the browser is restarted. Could someone tell me how it can be done. I know what can be done but not how? Thanks a lot inadvance!!</p>
|
c# javascript asp.net
|
[0, 3, 9]
|
3,865,437
| 3,865,438
|
Detect if address bar is shown in iPhone browser
|
<p>I'm trying to detect, in a future-proof and device-independent way, when the address bar in the iPhone browser is showing. This is the toolbar that is shown at the top in order to display the URL. It can be hidden by calling:</p>
<pre><code>window.scrollTo(0, 0)
</code></pre>
<p>What I'd like to do, is detect when it's being show (thus reducing the available viewing space) and set a timer to hide it again a second or so later. Any more frequent than that and it'll be quite annoying since users won't be able to get to the address bar.</p>
<p>I've tried checking <code>window.pageYOffset</code>, unfortunately, this returns zero if any part of the url bar is visible.</p>
<p>I <em>don't</em> want to hard code any dimensions on the iPhone and check those against the current viewport size. It's too fragile.</p>
<p>Anyone know a solution here?</p>
|
javascript iphone
|
[3, 8]
|
1,507,223
| 1,507,224
|
Session timeout on server side in asp.net c#
|
<p>I have problem with session timeout even i added code in web.config as follows but its not working, it expires within 10 mins. </p>
<pre><code><sessionState mode="InProc" timeout="300"></sessionState>
</code></pre>
<p>Server has session timeout of 20 mins.</p>
<p>Please help me to solve session timeout issue?</p>
|
c# asp.net
|
[0, 9]
|
5,670,214
| 5,670,215
|
Eval in anchor href
|
<p>I have the following code behind:</p>
<pre><code>protected string VcdControlPanelLink { get; set; }
protected void Page_Load(object sender, EventArgs e) {
VcdControlPanelLink = "http://www.mywebsite.com";
}
</code></pre>
<p>And the following markup:</p>
<pre><code><a href='<%# Eval(VcdControlPanelLink) %>' target="_blank" title="View the VDC control panel">VDC control panel</a>
</code></pre>
<p>But when I run the page, the href tag is rendered as an empty string:</p>
<pre><code><a title="View the VDC control panel" target="_blank" href="">VDC control panel</a>
</code></pre>
<p>I have tried various combinations of markup etc, but cannot get it to work. What am i missing?</p>
|
c# asp.net
|
[0, 9]
|
4,635,417
| 4,635,418
|
$(window).width() and $(window).height() return NULL -JQuery
|
<p>I want to get the size of browser window using <code>$(window).width()</code> and <code>$(window).height()</code> functions. However this two return null. the <code>$(window)</code> is not null, it's returning "object".
I have tried also using <code>$(document).width()</code> and <code>$(document).height()</code>, this two do not return null, they are returning specific values, but they are bigger than the window size. Any idea why the <code>$window</code> 2 values are null?</p>
<pre><code>$(window).load(function () {
var view = $("#view");
var image = $("#image");
var hiResImage = $("#hi-res-image");
var zoom = $("<a id='zoom'><span><br /></span></a>");
log("ERROR 1 = " + $(window).width());
log("ERROR 1 = " + $(window).height());
log("ERROR 1 = " + $(window));
image.width($(window).width());
image.height($(window).height());
</code></pre>
<p>.....</p>
<p>Should I initialize somw how the $(window) variable?</p>
|
javascript jquery
|
[3, 5]
|
525,062
| 525,063
|
Problem with JavaScript alert on button click
|
<p>I am having a bit of a problem. I have the following code:</p>
<pre><code>if (GetSelectedUsers().Count() > 0) {
string script = "alert('not show this message');";
System.Web.UI.ScriptManager.RegisterClientScriptBlock(btnActivateDeactivate, this.GetType(), "Test", script, true);
Response.Redirect("FUserManagement.aspx");
} else {
string script = "alert('This Message works');";
System.Web.UI.ScriptManager.RegisterClientScriptBlock(btnActivateDeactivate, this.GetType(), "Test", script, true);
}
</code></pre>
<p>The second message works, but the first does not. I am new to ASP.NET. Can you help to archive this type of functionality? The problem in appears to be in the <code>Response.Redirect</code> method. When I comment it out, everything works normally, but I cant delete <code>Response.Redirect</code> as this is part of my functionality.</p>
|
c# javascript asp.net
|
[0, 3, 9]
|
5,454,506
| 5,454,507
|
jquery alertbox is getting disabled automatically
|
<p>I have written the code on
ascx script:</p>
<pre><code><script src="JScripts/jquery.alerts-1.1/jquery.alerts.js" type="text/javascript"></script>
<script>
$(function() {
$('#ImageButton1').click(function() {
jAlert('Please enter a valid Suggestion ID.', 'Case Entry');
});
});
</script>
</code></pre>
<p>and on
Code behind:</p>
<pre><code>Page.ClientScript.RegisterStartupScript(this.GetType(), "Window", "callAlert();", true);
</code></pre>
<p>the problem is alert box is automatically getting disabled after some time when page load fully</p>
<p>What could be the reason that the alert box is being disable after clicking on OK button and how to call the callAlert function in proper way.</p>
|
c# jquery asp.net
|
[0, 5, 9]
|
596,202
| 596,203
|
Compare system date with a date field in SQL
|
<p>I am trying to compare a date record in SQL Server with the system date. In my example the user first register with his name and date of birth which are then stored in the database. The user than logs into the web application using his name only. After logging in, his name is shown on the side where it says <code>"Welcome "player name</code>" using <code>Sessions</code>. </p>
<p>What I am trying to show in addition to his name is a message saying "happy birthday" if his date of birth matches the system date. I have tried working with <code>System.DateTime.Now</code>, but what I think is that it is also comparing the year, and what I really want is the day and the month only. I would really appreciate any suggestion or help. </p>
<p>CODE In Login page:</p>
<pre><code>protected void Button1_Click(object sender, EventArgs e)
{
String name = TextBox1.Text;
String date = System.DateTime.Today.ToShortDateString();
SqlConnection myconn2 = new
SqlConnection(ConfigurationManager.ConnectionStrings["User"].ToString());
SqlCommand cmd2 = new SqlCommand();
SqlDataReader reader;
myconn2.Open();
cmd2 = new SqlCommand("Select D_O_B from User WHERE Username = @username",
myconn2);
cmd2.Parameters.Add("@username", SqlDbType.NVarChar).Value = name;
cmd2.Connection = myconn2
cmd2.ExecuteNonQuery();
reader = cmd2.ExecuteReader();
while (reader.Read().ToString() == date)
{
Session["Birthday"] = "Happy Birthday";
}
}
</code></pre>
<p>Note: I using the same reader in the code above this one, but the reader here is with a different connection. Also, <code>reader.Read()</code> is different than <code>reader.HasRows</code>? </p>
<p>Code in Web app Page:</p>
<pre><code>string date = (string)(Session["Birthday"]); // Retrieving the session
Label6.Text = date;
</code></pre>
|
c# asp.net
|
[0, 9]
|
590,020
| 590,021
|
Retaining select box based values on page refresh
|
<p>i have problem in drop down select menu from mysql and database</p>
<p>whenever i select the value from drop down select value page reload and page refresh and then return to option select option?</p>
<pre><code>function getComboB(sel) {
var roomtype=document.getElementById("roomtype");
var value = sel.options[sel.selectedIndex].value;
checkin.action = "checkin.php?item_combo="+value+"";
checkin.submit();
}
<select name="roomtype" id="roomtype" style="width:150px;" onchange="getComboB(this)">
<option><--Select--> </option>
$query=mysql_query("SELECT * FROM roomtype order by id");
while($row=mysql_fetch_assoc($query))
{
$val2=$row['id'];
?>
<option value="<?=$val2;?>" <? if ($roomtype == $val2) { echo "selected='selected'"; }?> > <?=$row['roomtype'];?> </option>
<?php }?>
</select>
</code></pre>
|
php javascript
|
[2, 3]
|
644,351
| 644,352
|
Reset a Checkbox Field Clientside
|
<p>I have a checkbox control and a reset button on a web page. I want the chekbox to be unchecked whenever the rest button is pressed. This should be a clientside process.</p>
<p>How can i achieve it? can it be done by using document.getelementbyID()?</p>
|
javascript asp.net
|
[3, 9]
|
3,390,643
| 3,390,644
|
Jquery:Content search error
|
<p>I have a problem about searching a text. I think it is Ja because of the whitespaces</p>
<p>This is my script that working. </p>
<pre><code>$('td > a:contains("Hallow")').each(function(){
if($(this).parent().next('td').text() == 'Secured') {
alert("working well")
}
else {
alert($(this).text());
}
});
</code></pre>
<p>There is no whitespaces and my script is working : <a href="http://jsfiddle.net/FrE9Q/7/" rel="nofollow">http://jsfiddle.net/FrE9Q/7/</a></p>
<pre><code><td width="140" align="right">Secured</td>
</code></pre>
<p>There is no whitespaces</p>
<hr>
<p>Here is real html with whitespaces and my script isnt working: <a href="http://jsfiddle.net/FrE9Q/8/" rel="nofollow">http://jsfiddle.net/FrE9Q/8/</a></p>
<pre><code> <td width="140" align="right">
Secured
</td>
</code></pre>
<p>Whitespaces...</p>
<p>Thank you for your helps.</p>
|
javascript jquery
|
[3, 5]
|
3,764,832
| 3,764,833
|
Scrollable Menu position on reload
|
<p>I've followed and successfully completed this tutorial in order to create a scrollable menu:</p>
<p>" <a href="http://valums.com/scroll-menu-jquery/" rel="nofollow">http://valums.com/scroll-menu-jquery/</a> "</p>
<p>My problem is that I need the menu to stay in the same position after a new page is loaded rather than reset itself.</p>
<p>An example of the menu can be found here: " <a href="http://valums.com/files/2009/menu/final.htm" rel="nofollow">http://valums.com/files/2009/menu/final.htm</a> "</p>
<p>As you can see, the menu resets itself to the far left every time the page is refreshed. I need my menu to stay in the same position.</p>
<p>Any help would be appreciated!</p>
|
javascript jquery
|
[3, 5]
|
2,803,569
| 2,803,570
|
Replace last occurence of character in string
|
<p>Is there an easy way in jQuery to replace the last occurence of an '_' (underscore) in a given string?</p>
|
javascript jquery
|
[3, 5]
|
3,433,864
| 3,433,865
|
ontouch - Switching positions of two views(images) in Android
|
<p>I've been looking for that 2 days long and haven't found anything related to it.</p>
<p>I'll give an example for my goal. Let's say I have 2 images positioned side by side horizontally. I want the user to be able to switch their positions onlongtouch listener. so let's say that the first image was on the left and the second was on the right side, after switching positions between them, the first image would be in the right and the second would be on the left side. </p>
<p><strong>Basically,</strong> it is just like in the launcher where you can switch apps positions.</p>
<p>Please, if anything is not clear for you, I would like to know, and I'll try to explain it better, thank you.</p>
|
java android
|
[1, 4]
|
2,322,449
| 2,322,450
|
Visible window height instead of $(window).height;
|
<p>Is there any way to get the visible height of the whole page from inside an iframe , $(window).height() gives me iframes height ?</p>
<p>Thank you in advance.</p>
|
javascript jquery
|
[3, 5]
|
4,041,124
| 4,041,125
|
How to parse XML file from sdcard using Dom
|
<p>I want to parse xml file from sdcard. i used DOM concept. here i attached the code </p>
<pre><code>InputStream filename = null;
Document obj_doc = null;
DocumentBuilderFactory doc_build_fact = null;
DocumentBuilder doc_builder = null;
filename = new FileInputStream("/sdcard/filename.xml");
doc_build_fact = DocumentBuilderFactory.newInstance();
doc_builder = doc_build_fact.newDocumentBuilder();
obj_doc = doc_builder.parse(filename);
NodeList obj_nod_list = null;
if (null != obj_doc) {
org.w3c.dom.Element feed = obj_doc.getDocumentElement();
obj_nod_list = feed.getElementsByTagName("MyTag");
}
</code></pre>
<p>I dont know how to get a String from xml file. can anyone guide me to get a string variable from xml. </p>
|
java android
|
[1, 4]
|
4,933,207
| 4,933,208
|
How to make each loop work in IE7?
|
<p>I'm currently working on a project where I hide/show some table rows based on the contents of the table cells.</p>
<p>I'm using jQuery's each method to loop through the table rows, this works fine in all modern browsers except IE7.</p>
<p>This is my code:</p>
<pre><code>$('li').click(function() {
var listLetter = $(this).text();
$("td").hide();
$("tr").each(function(){ // this is where IE7 goes huh
var cellLetter = $("td:first", this).text().substr(0,1);
if (cellLetter == listLetter) {
$('td', this).show();
}
})
});
</code></pre>
<p>Is there a way to make this work in IE7?</p>
|
javascript jquery
|
[3, 5]
|
4,125,470
| 4,125,471
|
send fieldset values by jquery
|
<p>look at this code : </p>
<pre><code>[WebMethod]
public static string GetFacilities(string id)
{
int hotelid = System.Convert.ToInt32(Tools.DecryptString(id));
string ret = "";
foreach (var item in new FacilityGroupBL().Load())
{
if(item.Facilities.Count != 0)
{
ret += "<fieldset>";
if (item.Facilities.Count() != 0)
{
foreach (var subitem in item.Facilities)
{
if (subitem.HotelFacilities.Where(obj => obj.HotelId == hotelid).Count() != 0)
ret += "<input type='checkbox' checked='false' />" + subitem.Name;
else
ret += "<input type='checkbox' checked='true' />" + subitem.Name;
}
}
else
{
ret += "There is no facility in this fieldset.";
ret += "</fieldset>";
}
}
}
return ret;
}
</code></pre>
<p>by this code i load some checkboxes in a DIV,then user change some checkboxes and press the SAVE button.at this time ,i should send the values of these checkboxes to server to update my data in database.by i dont know how?:( please help</p>
<p>note: my default code for this probem is here but it does not work($("#FacilitiesDIV input[type=checkbox]").serializeArray() is empty)</p>
<pre><code>$.ajax({
type: "POST",
url: "HotelsList.aspx/SaveFacilities",
data: "{ 'id' : '" + $("#HiddenField").val() + "', 'Facilities' : '" + $("#FacilitiesDIV input[type=checkbox]").serializeArray() + "' }",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
},
error: function () {
$('#dialogMessage').dialog('open');
$('#dialogMessage span').html("Operation Error");
}
});
</code></pre>
|
c# jquery asp.net
|
[0, 5, 9]
|
4,795,806
| 4,795,807
|
Making a datarow Select() Query
|
<p>The thing is i have a data row array which contains ID and parent id as its fields.</p>
<p>I have used the following code and it returned the correct values ,</p>
<pre><code>datarow [] dt = datarow.select(" Parent = '0' ");
</code></pre>
<p>I want to select only those rows which don't have the '0' as its Parent.I know sql i am not getting how the select function works. </p>
|
c# asp.net
|
[0, 9]
|
1,081,315
| 1,081,316
|
JQuery detecting Programatic change event
|
<p>If i do jQuery(expr).change( function), then I can get an event function to fire when the user makes a change to the value.</p>
<p>Is it possible to get this to fire if it's changed programatically, ie if I call jQuery(expr).val("moo").</p>
<p>or if some Plain old JavaScript changes it's value?</p>
<p>Thanks for any help.</p>
|
javascript jquery
|
[3, 5]
|
2,230,993
| 2,230,994
|
jQuery Navigator with 3 rows
|
<p>I'm trying to scroll a set of thumbnails that are displayed in 3 rows inside a div.</p>
<p>I want to achieve <a href="http://flowplayer.org/tools/scrollable/navigator.html" rel="nofollow">this effect</a> but with 3 rows.</p>
|
javascript jquery
|
[3, 5]
|
1,910,846
| 1,910,847
|
List<Object> vs List<dynamic>
|
<p>I need to create a heterogeneous <code>List</code> of objects (custom classes). My first thought was to create a <code>List<ISomeMarkerInterface></code> but I quickly learned that this is not what I want. My next thought was <code>List<dynamic></code> and this didn't seem to be a bad idea. However, I was doing some research and came across this <a href="http://msdn.microsoft.com/en-us/library/yz2be5wk.aspx" rel="nofollow">article about boxing and unboxing</a> and in the example, they're doing basically what I want using <code>List<Object></code>. </p>
<p>Aside from the fact that <code>dynamic</code> will be evaluated at runtime and <code>Object</code> at compile-time, what is the difference between <code>List<dynamic></code> and <code>List<Object></code>? Aren't they essentially the same thing?</p>
|
c# asp.net
|
[0, 9]
|
3,486,478
| 3,486,479
|
trying to send data using POST from android to sql
|
<p>I am trying to POST data from my android to my sql server</p>
<p>This is in my android application </p>
<pre><code>List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("firstName",value));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
</code></pre>
<p>This is my php</p>
<pre><code>$firstName = $_POST["firstName"];
$sql = "SELECT firstName FROM `colleague` WHERE `lastName`
LIKE '%$firstName%' LIMIT 0, 5 ";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)) $output[] = $row['firstName'];
echo implode("<br/>",$output);
print(json_encode($output));
</code></pre>
<p>But this now selects the first five rows .. it does not receive anything in $firstName = $_POST["firstName"]; ??</p>
<p>php Notice</p>
<pre><code>Undefined index: firstName in C:\xampp\htdocs\
</code></pre>
<p>http declaration</p>
<pre><code>HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://192.168.1.1/Search.php");
</code></pre>
|
php android
|
[2, 4]
|
5,955,524
| 5,955,525
|
Adding title tag to hyperlinks placed in bulleted list
|
<p>I have a bulleted list set to <code>BulletedListDisplayMode.HyperLink</code> display mode, and it works fine but I cannot find a way to specify the title tag for each hyperlink. Can this be done?</p>
<p>Thanks!</p>
|
c# asp.net
|
[0, 9]
|
344,094
| 344,095
|
How can I wrap the entire page contents in a div using jquery
|
<p>Here is my code.</p>
<pre><code>$(function(){
$("body").prepend('<div id="loading"><span id="pagename"></span></div><div id="fade_wrapper">');
$("body").append('</div> <!-- closing #fade_wrapper -->');
});
</code></pre>
<p>The problem is that chrome auto closes the open <code><div id="fade_wrapper"></code> so that the HTML looks like this:</p>
<pre><code><div id="loading"><span id="pagename"></span></div><div id="fade_wrapper"></div>
</code></pre>
<p>That closing DIV in the second code shouldn't be there. How can I wrap the entire page contents in a div using jquery?</p>
|
javascript jquery
|
[3, 5]
|
1,822,912
| 1,822,913
|
convert a arraylist to string
|
<p>How can I convert a arraylist to a string?</p>
|
c# asp.net
|
[0, 9]
|
3,478,557
| 3,478,558
|
Issue with Popup
|
<p>I am using a window.open() in a hyperlink to open a popup in my page. I have a folder structure like </p>
<pre><code> parent
Controls
Reports
reportviewer.aspx
Search.aspx
</code></pre>
<p>form search.aspx i need to open reportviewer.aspx in a popup(javascript) .How to achive this ?How to pass the url ?</p>
|
c# asp.net
|
[0, 9]
|
4,795,743
| 4,795,744
|
jquery - Prevent onclick and retrieve parameters of function call
|
<p>We've been asked to put in a band-aid measure to some code so this is going to look really dumb but bear with me.</p>
<p>We need to prevent an onclick method of an anchor and retrieve the parameters of the function call being made in order to call a different function with those parameters.
Here is the code and html we have so far:</p>
<pre><code><p><a href="#" onclick="openMoreProductVideos('Title of video','VideoCode','false');return false;"><span class="txt">View all videos</span></a></p>
</code></pre>
<p>JS:</p>
<pre><code>// undefine onclick so it is not handled with broken function
$('a[onClick^=openMoreProductVideos]').each(function () {
this.onclick = undefined;
});
// grab parameters from onclick function call and submit to new function.
$('a[onClick^=openMoreProductVideos]').click(function () {
strStart = "openMoreProductVideos(";
strFinish = ");return false"
srctext = $(this).parent().html();
var re = strStart + ".*?"+strFinish
var newtext = srctext.match(re)[1];
var callparams = newtext.substring(1,newtext.length-1);
testparams(callparams);
});
// test function to see if parameters are working
function testparams (a,b,c){
console.log (a,b,c)
}
</code></pre>
<p>Problem is that the returned string (callparams) is seen as one parameter. I am not a regex expert so I'm hoping that someone with more experience than I can quickly see the solution.</p>
<p>Many thanks.</p>
|
javascript jquery
|
[3, 5]
|
2,791,269
| 2,791,270
|
create border around div and his children using wrapAll
|
<p>My code not workin well.
I want to create border around div id="wrap_all" and his children
using warpAll().
Did Is it possible to use with <code>$("#wrap_all").wrapAll("<div></div>");</code>
If yes I don't know how to that.
I am allso don't know how to include <code>id="xxx"</code> inside <code>("<div id="xxx"></div>")</code>
order for manipulate the new div with id xxx to make </p>
<pre><code>$(#'xxx')..css("border", "3px double red");
</code></pre>
<p>link for examle:<a href="http://jsfiddle.net/centerwow/9TPtn/27/" rel="nofollow">http://jsfiddle.net/centerwow/9TPtn/27/</a>
Thanks.</p>
<p>code html:</p>
<pre><code><div class="foo">a</div>
<div class="foo">b</div>
<div class="foo">c</div>
<div id="foo" class="foo">d</div>
<div id ="wrap_all">
<div class="foo">r</div>
<div class="foo">f</div>
<div class="foo">g</div>
</div>
<div class="foo">h</div>
<span></span>
</code></pre>
<p>link for examle.</p>
<p>jquery code:</p>
<pre><code>var modWidth = 50;
$('#wrap_all').hover(function() {
$(this).warpAll()
$(this).css("background", "green");
$(this).css("border", "3px double red");
$(this).width(modWidth);
}, function() {
$(this).css("background", "#cac");
$(this).width(40);
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,586,061
| 2,586,062
|
jquery/javascript wait for a function to complete
|
<p>I have script that performs from DOM manipulation to change the way a div looks. The way the application is, when the page loads, the div is rendered in its original state, the function manipulates the DIV. The problem is it renders the original div before rendering the changed div.</p>
<p>I tried:</p>
<pre><code>//Make div invisible
//Call function to change the DIV
//Make div visible
</code></pre>
<p>This does not work</p>
|
javascript jquery
|
[3, 5]
|
2,002,342
| 2,002,343
|
Where should I store jQuery data for html elements?
|
<p>To better learn jquery I decided to write a plugin that creates a <a href="https://github.com/ed-lea/jquery-collagePlus" rel="nofollow">gallery collage effect</a> like google+. Here's an <a href="http://www.devurl.co.uk/collagePlus/" rel="nofollow">example</a>. </p>
<p>I want to trigger it again on resizing the html element that contains the images. Part of the problem I'm having is that I need to store the original image size in order to recalculate the image sizes to make them fit.</p>
<p>I don't know where to store and how to retrieve those original image sizes. Full plugin is linked above, but I'll put a summary here.</p>
<pre><code>;(function( $ ) {
$.fn.collagePlus = function( options ) {
var settings = $.extend(
//...
'images' : $('img', $(this))
//...
);
return this.each(function() {
settings.images.each(function(index){
//...
/*
* get the current image size
*/
var w = (typeof $(this).data().width != 'undefined') ? $(this).data().width : $(this).width();
var h = (typeof $(this).data().height != 'undefined') ? $(this).data().height : $(this).height();
/*
* store the original size for resize events
*/
$(this).attr( "data-width" , w );
$(this).attr( "data-height" , h );
//... Do some other stuff
}
);
});
}
})( jQuery );
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,931,597
| 4,931,598
|
Android drawBitmap draws a kind of checkerboard pattern
|
<p>Okay maybe I'm missing something here but when I do </p>
<pre><code> canvas.drawRGB(0x80, 0x80, 0x80);
</code></pre>
<p>I get a clean and expected grey screen:
<img src="http://i.stack.imgur.com/BIqrD.png" alt=""></p>
<p>But when I use this code</p>
<pre><code>pixels = new int[800*480];
...
for(int x = 0; x < 800; x++)
{
for(int y = 0; y < 480; y++)
{
pixels[x+y*800] = 0xff808080;
}
}
canvas.drawBitmap(pixels, 0, 800, 0, 0, 800, 480, false, null);
</code></pre>
<p>My phone draws something like this: (note the 'checkerboard' pattern; which shouldn't be there)
<img src="http://i.stack.imgur.com/5T64b.png" alt="enter image description here"></p>
<p>The same happens in the emulator, so I guess I'm doing something wrong?</p>
|
java android
|
[1, 4]
|
4,444,983
| 4,444,984
|
Cloning an element and adding it to Dom multiple times
|
<pre><code>//I am cloning a dom element and inserting it in dom element multiple times
<div class='toBeCloned'>some text</div>
<div id='target'></div>
var _clone=$('.toBeCloned').clone(true);//create clone
var _target=$('#target'); //this is target
_target.append(_clone); //append target
_target.append(_clone); //append target
_target.append(_clone); //append target
//this should add 3 elements but it's adding only one
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,072,976
| 2,072,977
|
jQuery function on form input
|
<p>I want users to enter something in an text field, press OK and then run a function on the value of that text.</p>
<p>I have been looking at jQuery docs, I found keyup which gets the value instantly (not what I want) and the only things I can find about doing stuff with submitted form data involve POSTing the results to a php file or something.</p>
<p>I am keen to learn so if you could post links to resources where I could find out more along with your answer I would be most grateful. Thanks.</p>
|
javascript jquery
|
[3, 5]
|
2,312,196
| 2,312,197
|
How to pass objects, not values, between pages in ASP.net c#?
|
<p>At the moment I pass values from one page to another. I need to pass objects between pages, how can I do this.</p>
<p>Any help is appreciated.</p>
|
c# asp.net
|
[0, 9]
|
3,128,913
| 3,128,914
|
Need help with jQuery to clone form dropdown (dynamic dropdown)
|
<p>I am using PHP to generate dynamic dropdown, the dropdown list items are fetched from database.</p>
<p>Here's the php code for that and it works.</p>
<pre><code><select name="title[]" id="title">
<?php $categories = Category::find_by_cid(5); foreach($categories as $category): ?>
<option value="<?php echo $category->name; ?>"><?php echo $category->name; ?></option>
<?php endforeach; ?>
</select>
</code></pre>
<p>What i want to do is, Using jQuery whenever a link with id AddNew is clicked, a new dropdown should appear below that, containing same values.</p>
<p>Also, is there any way to execute php code inside javascript??</p>
<p>ex :</p>
<pre><code><script>
var name = "<?php echo $user->name; ?>";
</script
</code></pre>
|
php jquery
|
[2, 5]
|
1,019,355
| 1,019,356
|
i am trying to get value of particular hidden input text box using jquery it's not working
|
<p>i tried before insert this </p>
<pre><code> var req=$('#'+investor_id+'#requestId');
var requestId=document.getElementById(req).value;
alert(requestId);)
</code></pre>
<p>code it's it's working fine but after it's not working, <a href="http://jsfiddle.net/sureshpattu/9fTPh/5/" rel="nofollow">here is code</a></p>
|
javascript jquery
|
[3, 5]
|
1,249,411
| 1,249,412
|
encoding empty array in JavascriptSerializer using custom JavascriptConverter
|
<p>I'm using a custom converter to encode an object model. On the client, I need an empty array but I don't want to include this array in the object model on the server because the array is only used client-side.</p>
<p>This is what I have:</p>
<pre><code>public override IDictionary<string, object> Serialize(object obj, JavaScriptSerializer serializer)
{
MyObjectModel TheObjectModel = obj as ObjectModel;
Dictionary<string, object> OutputJson = new Dictionary<string, object>();
OutputJson.Add("MyEmptyArray", new Array()); // not working here
</code></pre>
<p>What do I need to put instead of <code>new Array()</code>?</p>
<p>Thanks</p>
|
c# asp.net
|
[0, 9]
|
920,041
| 920,042
|
Select option onclick function works in FF but not in Chrome
|
<p>I can successfully change the chart option in firefox, but it doesn't work in chrome (no errors). I have read almost all of the topics about this issue, but none of them worked for me. What is the correct way to catch when user selects options ?</p>
<p><img src="http://i.stack.imgur.com/Bxch4.jpg" alt="enter image description here"></p>
<pre><code><select id="sortby2">
<option id="byweek" value="date">7 days</option>
<option id="by14" value="spent">14 days</option>
<option id="bymonth" value="clicks">30 days</option>
</select>
$("#by14").OnClick(function(){
$.ajax({
type: "POST",
url: "chartdata.php",
data: 'by14=on',datatype:"html", async: false,
success: function(d){
$('.cantent').html(d);
}
});
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
691,519
| 691,520
|
Setting TreeViewNode to selected on PageLoad
|
<p>I have a tree view that I'm dynamically loading on the PageLoad event. Here is my tree view and data source:</p>
<pre><code><asp:TreeView ID="tv" runat="server" DataSourceID="xds"
SelectedNodeStyle-ForeColor="Red" NodeStyle-ForeColor="Black">
<DataBindings>
<asp:TreeNodeBinding DataMember="Node"
ValueField="Id" TextField="Title" />
</DataBindings>
</asp:TreeView>
<asp:XmlDataSource ID="xds" runat="server" EnableCaching="false" />
</code></pre>
<p>This is the code I run on PageLoad </p>
<pre><code>StringBuilder sb = new StringBuilder();
XmlWriter xw = XmlWriter.Create(sb);
WriteTreeViewXml(xw);
xw.Flush();
xw.Close();
xds.Data = sb.ToString();
xds.DataBind();
tv.Nodes[0].Selected = true; // error here
</code></pre>
<p>This works fine, the tree view gets loaded correctly. Now I'm trying to add styling to the SelectedNode. This works when I click on a specific node, but the root node isn't styled when the page loads. So I'm trying to set the root node to selected on PageLoad</p>
<p>I get this error when I try to set the root node as selected:</p>
<blockquote>
<p><strong>Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index</strong></p>
</blockquote>
<p>For some reason the tree view is empty after I bind the data source.</p>
<p>Does anyone know how I can do this?</p>
|
c# asp.net
|
[0, 9]
|
10,576
| 10,577
|
System.Web.UI.DataVisualization.Charting missing error in .net 4.0?
|
<p>I'm trying to use the Chart control in asp.net 4.0. While I know it required a separate install as part of 3.5, it's included by default with 4.0.</p>
<p>I can see the Chart control in my toolbox, and I can drag it to my designer and see a preview of the chart. However, when I try to compile my website, I get an error stating:</p>
<pre><code>The type or namespace name 'DataVisualization' does not exist in the namespace 'System.Web.UI' (are you missing an assembly reference?)
</code></pre>
<p>I receive the same error when I take a brand new page and add the following:</p>
<pre><code>using System.Web.UI.DataVisualization;
</code></pre>
<p>Any ideas? I can understand why I would get this error in 3.5, but no clue why I would receive in 4.0, especially when I can see the control in the toolbox.</p>
|
c# asp.net
|
[0, 9]
|
754,619
| 754,620
|
Outputting errors to a different location than function called from
|
<p>I have a functions.php file that I keep at the top of pages that looks out for POST requests and runs the appropriate function. The only trouble is I wan't to be able to output the errors to a different area of the page as they can't be seen at the moment. I want to keep the functions.php at the top of the page and output to a different place if this is possible? I was attempting to with javascript but I had no luck. Any ideas?</p>
|
php javascript
|
[2, 3]
|
3,156,279
| 3,156,280
|
How to iterate through Java collection in Javascript
|
<p>I'm trying to do scripting with Javascript in a Java program. I haven't found a way to iterate through a Java collection in Javascript. If I call the iterator() method for the collection, I get the method names instead of the elements.</p>
<p>Here's a sample code:</p>
<pre><code>function getValue(row, components) {
var apartment = components.get(0);
var rooms = apartment.getRooms();
for (var room in rooms.iterator()) {
println(room);
}
return rooms.toString();
}
</code></pre>
<p>The apartment.getRooms() returns a collection of rooms. When I study the value returned by this function, I know that its content are correct, but the values that get printed are the method names.</p>
<p>I invoke the Javascript from my Java program like this:</p>
<pre><code>getInvocable().invokeFunction("getValue", row, components);
</code></pre>
|
java javascript
|
[1, 3]
|
947,585
| 947,586
|
HOW NOT update a variable in post back
|
<p>Consider the code</p>
<pre><code>public partial class Classname: somethng
{
bClass objClass = new bClass();
Boolean isfindclicked=false;
protected void Page_Load(object sender, EventArgs e)
{
//rowid = 0;
if (!IsPostBack)
{......
...
}
}
protected void btnFind_Click(object sender, EventArgs e)
{
isfindclicked=true;
}
</code></pre>
<p>On a button click,certain operations are performed if the isfindclicked value is true.But once the button is clicked the page is reloaded and the value of isfindclicked sets to false.So the fn inside the buttn clicked is not executed...</p>
<p>So any way to make the varible isfindcliked <strong>not updated during page postbacks.</strong>.I ave tried with Session,it worked..but is there any other way out in not updating the isfindclicked value during page reloads...?</p>
|
c# asp.net
|
[0, 9]
|
2,055,489
| 2,055,490
|
Is it possible to obtain a web-browser's Java VM without using an applet?
|
<p>We have an ages old Java applet that we want to move forward to a newer version of Java (5 or 6), however until today we've always supported people using Java VMs as far back as version 1.1 (specifically for those still using the Microsoft VM)</p>
<p>As part of the upgrade, we'd like to be able to serve a web page to people using out-of-date VMs telling them which versions we now support and where they can download them from. Ideally we want to do this <strong>without</strong> having to serve a Java 1.1 applet first just to determine the JVM version.</p>
<p>Answers to either of the following (with code samples if possible) would be appreciated:</p>
<p>Question 1: is it possible to determine the JVM in a script on the server using information from the HTTP headers?</p>
<p>Question 2: is it possible to determine the information on the client using just JavaScript?</p>
|
java javascript
|
[1, 3]
|
3,440,408
| 3,440,409
|
Get one script to cycle through multiple variables
|
<p>I have a page that rates the top 15 websites one the web (from Alexa), and it uses javascript to write the new ratings, but this is very inefficient. There are 6 variables for each rating. And it writes one code block for each rating, using the variables. Is there a way to just make it use one code block to write all 15 of the ratings? Here is some code:</p>
<pre><code>var topID1 = 1;
var topWidth1 = 100;
var topPageURL1 = 'www.google.com'
var topPageTitle1 = 'Google';
var topRate1 = rateStar9;
var topMargin1 = 0;
$('#topSites1').html('<div class="meter-wrap" style="margin-top: ' + topMargin1 + 'px;"><div class="meter-value" style="background-color: ' + topSitesBack + '; width: ' + topWidth1 + '%;"><div class="meter-text"><span class="toplist"><span class="topnum">' + topID1 + '. </span><span class="favico" id="ico1"><img src="img/blank.gif" style="width:16px;height:16px;"></img></span><a href="http://' + topPageURL1 + '/">' + topPageTitle1 + '</a><span class="rating" style="width: ' + topRate1 + 'px;"><img src="img/blank.gif" style="width:100%;height:16px;"></img></span></span></div></div></div>');
$('#ico1').css('background', 'url(' + topPageFavicon + topPageURL1 + ') no-repeat');
</code></pre>
<p>(repeat both 15 times)</p>
|
javascript jquery
|
[3, 5]
|
2,488,643
| 2,488,644
|
How to pass a parameter name in JavaScript?
|
<p>Is there a way to get a handler to a variable dynamically in JavaScript? I think this won't make sense so here's what I'm trying to do.</p>
<p>I'm using <a href="http://code.google.com/p/flot/" rel="nofollow">JQuery Flot</a> to generate graphs in my web app. Everything works fine until I have two graphs in the same page. </p>
<p>I get the data from the database using c# and convert it into a JavaScript array and write onto the page like this.</p>
<p>HTML/C#:</p>
<pre><code>@{
KII.Models.JsonPerformGraphData items = new KII.Models.JsonPerformGraphData();
foreach (KII.Models.PerformanceGraphItem item in Model.PerformanceGraphItems)
{
items.Add(item);
}
<script type="text/javascript">
@Html.Raw("var pgdata"+Model.Id+" = ") @Html.Raw(items.toJson()) ;
</script>
}
</code></pre>
<p>Then, I call a method on document ready to draw the graph</p>
<p>JavaScript:</p>
<pre><code>if ($(".PerformanceGraph")) {
$(".PerformanceGraph").livequery(function () {
//Display the graph for risk and reward.
var options = { series: {
bars: { show: true, barWidth: 0.45, align: "center" }
},
legend: {
show: true, position: "ne", backgroundOpacity: 0, container: $("#PerformanceGraphLegend")
},
multiplebars: true
};
var dataArray = $(this).attr('data-array');//I get the name of the variable as String.
$.plot($(".PerformanceGraph"), pgdata, options);
});
}
</code></pre>
<p><code>pgdata</code> from javascript must match <code>"var pgdata"+Model.Id+"</code> from HTML/C#. </p>
<p>How can I get the variable that the HTML/C# code spits out to the HTML?</p>
|
javascript jquery
|
[3, 5]
|
1,500,926
| 1,500,927
|
Check if a username has been registered
|
<p>I am using the builtin ASP.NET logon and user management features. Is there a way to just identify if a username or email address is already registered? I would've thought it's part of FormsAuthentication or similar, but can't find such a function.</p>
|
c# asp.net
|
[0, 9]
|
3,623,650
| 3,623,651
|
re-write javascript so that it doesn't contain " anywhere?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/10688513/escape-double-quotes-javascript">escape double quotes javascript</a> </p>
</blockquote>
<p>pardon me if this is a stupid question, but is it possible to write the following javascript without actually using " anywhere in either php, javascript or jquery?</p>
<pre><code> var uagent = navigator.userAgent.toLowerCase();
if (uagent.search("iphone") > -1){
document.write("<img src=http://www.demiads.com/images/bc-1300119669-722.gif />"); }
else{
document.write("<object classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000
codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0 width=728 height=90 id=lang align=middle style=margin-left:3px;>
<param name=allowScriptAccess value=sameDomain />
<param name=allowFullScreen value=false />
<param name=movie value=http://koha.net//repository/reklamat/17_05_12_131575_koha.net_hej_reveal_675x88px.swf />
<param name=quality value=high />
<param name=bgcolor value=#ffffff />
<param name=wmode value=transparent />
<embed src=http://koha.net//repository/reklamat/17_05_12_131575_koha.net_hej_reveal_675x88px.swf
quality=high WMODE=transparent bgcolor=#ffffff width=728 height=90
name=ifm_al align=middle allowScriptAccess=sameDomain
allowFullScreen=false type=application/x-shockwave-flash
pluginspage=http://www.macromedia.com/go/getflashplayer />
</object>");
}
</code></pre>
|
php javascript jquery
|
[2, 3, 5]
|
211,417
| 211,418
|
Visualization for a Query builder using items from a Tree like structure
|
<p>I am trying to build a dynamic query based on the user selections from the items that are arranged in a tree like structure. Once the user selects an item from the tree, I should display the conditions (like equals, not equals, wild card match etc) and text field to enter a value. Users will be able to select more than one item from the tree and provide values. Items in the tree are grouped by their type (or parent). After all the selections, I compose a query (sql like) form the user input. I would like to do this using Javscript and back end is supported by java code. In my research I found out that there are many JQuery plugins to display the tree like structure. I want to take the community input on building other types of visualization for this. Is there any other better way to graphically display this to the user instead of a Tree like structure?</p>
<p><img src="http://i.stack.imgur.com/dG8sy.png" alt="enter image description here"></p>
<p>Thanks.</p>
|
javascript jquery
|
[3, 5]
|
1,050,611
| 1,050,612
|
alert another page
|
<p>I have an index.php.
It has a log in function.
Let's say I have 2 users A and B.</p>
<p>Page1(index.php of user A)
-with function(checks whether there are changes in the database, if yes: alert('message'))</p>
<p>Page2(index.php of user B)
-with button which when clicked should update the database</p>
<p>I can already update the database, the function from page1 already works, it can detect changes, but only when you reload it. So I want to reload Page1 whenever page2 updates the database. I thought of just using setTimeout(something, timeInterval) in Page1 but it doesn't seem appropriate since the components of Page1 are flickering everytime it reloads. I want Page1 to reload if and only if there are changes in my database. I also thought of just putting the Page1's function inside an infinite while loop but it doesn't seem appropriate either, since the page just loads..</p>
<p>Another thing is, I was informed about JSON and REST. So I could just access the database from the script file. But I'm not that knowledgeable in it. Neither am I in jQuery.</p>
<p>I've tried searching about refreshing a page from another but the answers I found were either vague or difficult for me. And my pages have the same name, they only differ with the user logged in. But If I can find a way to do this, then I'll just do something with my pages' names.</p>
<p>Is there any other way I can do this? Thank you.</p>
|
php javascript jquery
|
[2, 3, 5]
|
4,110,621
| 4,110,622
|
ListView with scrolling/fixed header rows
|
<p>In Android I would like to have a ListView control that lists various categories of data. I would like a header/special row for each category.</p>
<p>I would also like it so the header row gets fixed as the first row while scrolling through that category. When scrolling reaches the next category the new header gets fixed and the previous one just scrolls off the screen.</p>
<p>A quick example is shown below. Header 1 is fixed until we reach Header 2 which then takes the place of Header 1 and so on.</p>
<p>I'm having trouble finding a solution for this as i'm not exactly sure what to call it.. any ideas on a solution would be greatly appreciated. Thanks.</p>
<pre><code>----------------------------
Header 1
----------------------------
H1-Item
H1-Item
H1-Item
H1-Item
H1-Item
H1-Item
----------------------------
Header 2
----------------------------
H2-Item
H2-Item
H2-Item
H2-Item
----------------------------
Header 3
----------------------------
H3-Item
H3-Item
</code></pre>
|
java android
|
[1, 4]
|
791,317
| 791,318
|
Clearing a text input (if it's empty) when another text box is clicked - jQuery
|
<p>I have an email text box that contains the text '(Not Required)' until a user clicks on it, at which point it turns blank. I'm trying to make it to where if the user clicks another text box without entering an email address (or entering anything), the text box will revert to containing (Not Required).</p>
<p>Here's what I have:</p>
<pre><code>$(document).ready(function () {
$('#email').val("(Not Required)");
// this part works fine
$('#email').click(function(){
if ($(this).val() == '(Not Required)'){
$(this).val('');
}
});
// this isn't working
$(':text').click(function(){
var em = $('#email').val().length();
if (em<3){
$('#email').val('(Not Required)');
}
});
});
</code></pre>
<p>I can't figure out why the second part isn't working correctly. Any help would be rewarded with a lifetime's devotion to yourself from myself in a very big way. Forever. </p>
|
javascript jquery
|
[3, 5]
|
2,965,021
| 2,965,022
|
Continuously run a piece of code in Android
|
<p>I'm making an Android game, and I'll need a continuously running thread for basically everything.
Now, however, I'm making the main menu (I always start simple, I'm new to coding), and I want an image to float across the main screen. I know how I could code that (determining the starting location, changing it), but I don't know how to run such a piece of code continuously (outside the UI thread).</p>
<p>P.S.: Please be easy on me. I know I'm probably missing something obvious, but I have virtually no Java experience at all.</p>
|
java android
|
[1, 4]
|
3,478,598
| 3,478,599
|
How to show part of other website in my website?
|
<p>Suppose in other website exists a <code>div element</code> with a <code>table</code> in it.
The content of <code>div element</code> changes during the time.
I want to show that <code>div element</code> and it's contents in my website.
Is it possible using Asp or jquery or javascript or other ways?
I have heard about socket programming.</p>
<p><strong>EDIT:</strong><br>
I don't want whole webpage. just a part of it.I think Iframe can't help me.</p>
|
javascript jquery asp.net
|
[3, 5, 9]
|
447,387
| 447,388
|
slide content based on button selection
|
<p>I am trying to set up a content area where there are 3 button choices. Based upon the button the user chooses, different content will slide into place. Depending upon which section they are under (which button was selected) the button will be a different color - white instead of orange.</p>
<p>Here is a link to the general idea of what I am trying to accomplish.
Your help is appreciated.</p>
<p><a href="http://jsbin.com/epibab/2/edit" rel="nofollow">http://jsbin.com/epibab/2/edit</a></p>
|
javascript jquery
|
[3, 5]
|
1,267,765
| 1,267,766
|
how to change mouse pointer on mouseover a division to hand?
|
<p>how can i change the default arrow pointer style to hand when client move the pointer to a particular division?</p>
|
c# asp.net
|
[0, 9]
|
1,713,311
| 1,713,312
|
C#, Operator '??' cannot be applied to operands of type 'decimal' and 'decimal'
|
<pre><code>public decimal v1 {
get {
return this._v1;
}
set {
this._v1 = value ?? 0M; // also I tried, default(decimal)
}
}
</code></pre>
<p>Error message say : </p>
<p><strong>Operator '??' cannot be applied to operands of type 'decimal' and 'decimal'</strong></p>
<p>Why it does not work, and how should I do make it works?</p>
|
c# asp.net
|
[0, 9]
|
2,668,785
| 2,668,786
|
Unzipping from SD card - filenotfound error - Android 2.2 SDK
|
<p>I keep getting a file not found error, even though it exists at /mnt/sdcard/folder/Samples.zip. I downloaded the file there, so there are "write" permissions, but it just doesn't want to unzip! Why is this?</p>
<pre><code> ZipInputStream in = null;
try {
final String zipPath = "/folder/Samples.zip";
in = new ZipInputStream(getAssets().open(
Environment.getExternalStorageDirectory() + zipPath));
for (ZipEntry entry = in.getNextEntry(); entry != null; entry = in
.getNextEntry()) {
}
} catch (IOException e) {
System.out.println("file error of some kind" + e);
} finally {
try {
if (in != null) {
in.close();
}
} catch (IOException ignored) {
}
in = null;
}
</code></pre>
|
java android
|
[1, 4]
|
3,030,577
| 3,030,578
|
Capturing Ctrl-Alt-Del in JavaScript/jQuery
|
<p>While just playing with jQuery/JavaScript I ran across this problem. I could capture <kbd>Alt</kbd> and <kbd>Ctrl</kbd> keys but NOT <kbd>Del</kbd> and certainly not all of them together.</p>
<pre><code>$(document).ready(function() {
$("#target").keydown(function(event) {
if (event.ctrlKey && event.altKey && event.keyCode == '46') {
alter("Ctrl-Alt-Del combination");
}
});
});
</code></pre>
<p>Is it possible to capture all these three keys together?</p>
|
javascript jquery
|
[3, 5]
|
4,697,547
| 4,697,548
|
how to access javascript variable in scriplet jsp
|
<p>I have a <code>javascript variable</code> say,</p>
<pre><code>var a ='2013-01-03'
</code></pre>
<p>I want to access this variable inside my <code>scriptlet</code>. i.e.] I have a <code>map</code> that contains my data.<br>
I want to fetch the value of the <code>map</code> corresponding to the <code>key='2013-01-03'</code> that is in <code>javascript variable 'a'</code>.</p>
<p>How can i use like following in my scriptlet.?</p>
<pre><code>map.get(a);
</code></pre>
<p>I know the <code>scriptlets</code> will execute first even then without <code>reloading</code> I want to access the <code>variable</code> a inside my <code>scriptlet</code>. Can any one help me solve this problem.? </p>
|
java javascript
|
[1, 3]
|
870,729
| 870,730
|
Retrieve Html Control Value in other Classes
|
<p>I have an element like this in <strong>Default.aspx</strong> :</p>
<pre><code><asp:HiddenField ID="hfID" runat="server" />
</code></pre>
<p>And now I need to retrieve this element value in another class like the following: </p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Sample001 {
public class SlaveValue {
public void RetrieveValue() {
}
}
}
</code></pre>
<p>How can I do this?</p>
<p>Edit:</p>
<p>It's some complicated, I add value to element inside of jQuery Script and when the request of jQuery Ajax send I need this value in HttpHandler to response correctly.</p>
|
c# asp.net
|
[0, 9]
|
2,426,266
| 2,426,267
|
asp.net masterpage jQuery function
|
<p>I'm creating a new web project and i trying to get jQuery working with masterpages</p>
<p>I want to have a link that if it is pressed will do an expansion of a div.</p>
<p>Problem: jQuery isn't fired and the page do a postback</p>
<p><img src="http://i.stack.imgur.com/e2OoY.png" alt="enter image description here"></p>
|
jquery asp.net
|
[5, 9]
|
2,754,574
| 2,754,575
|
Is there a better way to hide & store read only data for a JQuery/JavaScript app than putting it in PHP arrays?
|
<p>I am making a mostly client side JavaScript / JQuery app that processes data I store on the server. I do not want this data easily scrape-able by bots, so right now I am storing all of the read-only data inside PHP files that the app gets via JSON and parses on the client side. I decided to do this instead of a MySQL database because I will never need to update the data (and I assumed - perhaps incorrectly - that it would be much easier for the web server to spit out JSON than query a database).</p>
<p>I know this isn't 100% secure, but I thought it would be better than keeping the data in an easily readable javascript or json file.</p>
<p>Is there a better way I can store data on my server so it can only be read when the app needs it, or make it harder to scrape?</p>
<p>Cheers,</p>
|
php javascript jquery
|
[2, 3, 5]
|
4,255,426
| 4,255,427
|
Adding a javascript variable to html
|
<p>I need to add some JavaScript into my HTML.</p>
<p>I have a JavaScript variable. How can I add it to my HTML code?</p>
<pre><code><a href="index.php?something=MYJAVASCRIPT VARIABLE">
</code></pre>
<hr>
<p><strong>UPDATE:</strong> Tried this:</p>
<pre><code><a href="#" onclick="window.location.href = 'index.php?month=' +thisyear+'-1-1'" rel="external"> Jan </a>
</code></pre>
<p>But it's not working for some reason...</p>
|
javascript jquery
|
[3, 5]
|
1,405,386
| 1,405,387
|
Convert imageUrl to byte[] for caching
|
<p>I have an image that I capture from an ip camera and post it on a webpage to an image tag. Now I would like to convert to access the picture so that I can save it to our cache blob. Here is my code:</p>
<p>asp tag:</p>
<pre><code><asp:Image ID="imgPhoto" runat="server" ImageAlign="Middle" />
</code></pre>
<p>code behind image assignment:</p>
<pre><code>imgPhoto.ImageUrl = "http://10.10.40.35/axis-cgi/jpg/image.cgi?resolution=640x480";
</code></pre>
<p>my attempt to convert the image to byte[]:</p>
<pre><code>System.Drawing.Image _newImage = System.Drawing.Image.FromFile(imgPhoto.ImageUrl);
MemoryStream ms = new MemoryStream();
_newImage.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] _fileBytes = new byte[ms.Length];
</code></pre>
|
c# asp.net
|
[0, 9]
|
4,910,707
| 4,910,708
|
Did jQuery kill the JavaScript discussions?
|
<p>There are over 100,000 questions on Stack Overflow tagged as questions relating to JQuery troubleshooting/usage. Compare this to the 124,000 questions on stack overflow that are tagged for JavaScript issues. We are very close to almost half of all JavaScript related questions on Stack Overflow being attributed to JQuery (plus or minus any margin for the few other JS frameworks that get questions on SO).</p>
<p>What I'm getting at is, jQuery is not a language and it is not the be all and end all of frameworks that must be applied to every scenario in which JavaScript is present, yet it is quickly catching (and I predict will soon eclipse) JavaScript as a source of discussion/inquiry on sites like Stack Overflow.</p>
<p>Is jQuery killing the JavaScript star? Is there no longer a firm grasp by the next generation of web developers regarding the power, simplicity and use of JavaScript as a means for DOM manipulation? Is this just the natural evolution of things and the viewpoint I'm presenting typical of the coder's ego (i.e., is this how assembly programmers view the .NET/Java/Web crowd?) or is this really the beginning of the end of the true JavaScript developer? </p>
|
javascript jquery
|
[3, 5]
|
3,478,187
| 3,478,188
|
Datetime format for a month and year
|
<pre><code>DateTime ExpMonth = Convert.ToInt32(ddExpMonth); ---- DropDown(user selects a month)
DateTime ExpYear = Convert.ToInt32(ddExpYear); ---- Dropdown(user selects year)
Datetime ExpDate = ///// I want this part to be saved as Datetime 02/2012
</code></pre>
<p>How is this possible. Or any other way.</p>
|
c# asp.net
|
[0, 9]
|
1,840,136
| 1,840,137
|
Need to change div's contents while slider changes
|
<p>My jquery banner needs to some fixes. I have used echo slider for banner. when banner image change to another image, we need to change the content in a div which is not inside the slider's boundary. The Div is separate div (No connection with slider ).</p>
<p>I have tried with the code. i just put if statement based on slider's navigation. </p>
<p>My codes affected the 1st banner image only. it doesnt affect next banner</p>
<p>Help me</p>
<p>Here below my codes</p>
<pre><code><div class="echo-nav">
<a rel="0" class="echo-control active" href="javascript:;">1</a>
<a rel="1" class="echo-control" href="javascript:;">2</a>
<a rel="2" class="echo-control" href="javascript:;">3</a>
<a rel="3" class="echo-control" href="javascript:;">4</a>
<a rel="4" class="echo-control" href="javascript:;">5</a>
<a rel="5" class="echo-control" href="javascript:;">6</a>
</div>
<script>
$(document).ready(function(){
if($('.echo-nav a.active').attr('rel')=='0'){
$('#app_info').text('Some dummy contents for one');
}
else if($('.echo-nav a.active').attr('rel')=='1'){
$('#app_info').text('Some dummy contents for Two ');
}
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,543,499
| 3,543,500
|
Javascript Image OnLoad event
|
<p>I know I can attach an event listener to a loading image so that it'll trigger when the image finishes loading like this:</p>
<pre><code><img id="mine" src="image.jpg" />
<script>
$('#mine').load(function() {
console.log($(this).height()); //The image's height
console.log($(this).width()); //The image's width
})
</script>
</code></pre>
<p>But my browser knows how big the image is going to be as soon as the header is loaded - can I tap into that event, so that as soon as the browser knows the image's size I can resize elements on my page?</p>
<p>Thanks!</p>
|
javascript jquery
|
[3, 5]
|
1,867,405
| 1,867,406
|
How use keyboard arrow keys to move a div 100px left/right respectively
|
<p>I have a div with an id of <code>bottom_arrow</code> and I want to use my keyboard arrows left/right to move the div left and right 100px. How can I do this?</p>
|
javascript jquery
|
[3, 5]
|
4,680,115
| 4,680,116
|
manipulating the screen from subclass
|
<p>So I have created an android app and things are working alright.</p>
<p>In my main class I do a </p>
<pre><code>new Game();
</code></pre>
<p>Now from the constructor of the game object I try and manipulate the screen, but it does not seem to do anything. Is it even possible?</p>
<pre><code>public class Game extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.board);
}
}
</code></pre>
|
java android
|
[1, 4]
|
4,866,528
| 4,866,529
|
MEF CS0234: The type or namespace name 'Composition' does not exist in the namespace 'System.ComponentModel' (are you missing an assembly reference?)
|
<p>I have added in ComponentModel.Composition; assembly .But showing this error for </p>
<p>using System.ComponentModel.Composition;</p>
<p>and reference for the assembely</p>
<p>still gets the error</p>
<p><strong>CS0234: The type or namespace name 'Composition' does not exist in the namespace 'System.ComponentModel' (are you missing an assembly reference?)</strong></p>
|
c# asp.net
|
[0, 9]
|
5,154,718
| 5,154,719
|
javascript (jquery) script perfomance synchronous vs asynchronous
|
<p>I have a javascript function that filter dom elements based on a input text changes, so:</p>
<pre><code>$(".input").keyup(function(e) {
filter();
});
var cache = $(".dom");
var filter = function() {
cache.each(function() {
// if field contains some text show else hide
}
};
</code></pre>
<p>My problem happens when there are many dom elements to filter, the whole pages gets inaccessible because of the <strong>synchronous processing (like the example above)</strong>. Im trying to come out with a solution that dont locks the entire page with synchronous processing.</p>
<p><strong>The problem is NOT related to the filter logic (it's completely trivial), it's NOT related to the jquery or javascript itslef, it's related to the synchronous processing and the quantity of dom elements.</strong></p>
|
javascript jquery
|
[3, 5]
|
2,965,174
| 2,965,175
|
Changing Android Device name in code
|
<p>I am trying to change the name of the Android Device that my program that is currently running on because the name of the device will contain information that is relevant when it communicates with other phones. The name of the phone will be constantly changed as phone scans for other phones and calculates information. Any ideas on how to change the name of the phone within the java code? I can't image it being more than a few lines of code, but I can't find anything.
Thanks in advance.</p>
|
java android
|
[1, 4]
|
786,207
| 786,208
|
jqtransform onclick events not firing
|
<p>I have a form using the jqtransform jQuery plugin that gives forms an aesthetic makeover. However, I can't get my onclick events to fire.</p>
<p>I have a form setup similar to this:</p>
<pre><code><select name="person">
<option value="1">Yes</option>
<option value="2">No</option>
<option class="maybe" value="0">Maybe</option>
</select>
</code></pre>
<p>I also have a hidden div container which expands the form:</p>
<pre><code><div class="expander" style="display:none;">
More info <input type="text" name="moreinfo" />
</div>
</code></pre>
<p>Then the final piece of the puzzle:</p>
<pre><code><script>
$(".maybe").click(function () {
$(".expander").show("slow");
});
</script>
</code></pre>
<p>Any help would be greatly appreciated.</p>
|
javascript jquery
|
[3, 5]
|
172,879
| 172,880
|
Loop through all text boxes in a form using jQuery
|
<p>I have a form which is laid out like a spreadsheet.</p>
<p>I want to validate the text in each textbox and if it's not numeric, change the background of the textbox and display a message.</p>
<p>I can do everything except for the looping part.</p>
<p>I'm guessing it's a for...each statement?</p>
|
javascript jquery
|
[3, 5]
|
4,054,366
| 4,054,367
|
uncaught exception error "Illegal operation on WrappedNative prototype object"
|
<p>Any idea why the following javascript/jquery code might produce the error message:
uncaught exception: [Exception... "Illegal operation on WrappedNative prototype object" ?</p>
<p>Code:</p>
<pre><code>function deletereceipt(id){
var $delconfdialog = $('<div id="dialog-confirm"></div')
.html('Are you sure you want to delete this receipt?')
.dialog({
autoOpen: true,
title: 'Delete Confirmation',
buttons: {
"Delete": function(){
$.post('Receipt.py',{'cm':'Delete','receiptid': obj},function(){
$('#receiptrow'+id).remove();
});
$(this).dialog('close');
},
"Cancel" :function(){
$(this).dialog('close');
}
}
});
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,690,804
| 5,690,805
|
Simple Javascript Help Request
|
<p>I'm after a little help with some JS not behaving. I would like to make it so that I can pass an some JavaScript to affect the end URL destination as below: The end destination being (<code>delete-page.php?id=1</code>)</p>
<pre><code><a href ="javascript:deletemessage('id=1')">Delete Page </a>
<script type="text/javascript">
function deletemessage(url) {
$.msgbox("Are you Sure you would like to delete this page", {
type: "confirm",
buttons: [{
type: "submit",
value: "No"
}, {
type: "submit",
value: "Yes"
}]
}, function(result) {
if (result == "Yes") {
window.location.href = "delete-page.php(URL)";
}
});
}
</script>
</code></pre>
<p>Any help would be very much appreciated!</p>
|
javascript jquery
|
[3, 5]
|
5,369,812
| 5,369,813
|
jQuery class count on a certain table column number
|
<p>I've been at this for a while and want to know the best way of achieving my goal if anyone has any ideas!</p>
<p>Example:</p>
<pre><code><table>
<tbody>
<tr>
<td>Hello</td>
<td>Hello (I want to check this column)</td>
</tr>
<tr>
<td>Hello 2</td>
<td class="active">Hello 2 (this column)</td>
</tr>
</tbody>
</table>
</code></pre>
<p>jQuery I've got so far (I'm traversing from a clicked element):</p>
<pre><code>var length = $(self).closest("tbody").find("tr").find("td.active").length;
</code></pre>
<p>Obviously this gets all the active classes of td, when I only want the second column. I've tried:</p>
<pre><code>var length = $(self).closest("tbody").find("tr").find("td:eq(1).active").length;
</code></pre>
<p>This does not work.</p>
<p>Any ideas?</p>
|
javascript jquery
|
[3, 5]
|
3,210,584
| 3,210,585
|
Why is app shutting down and catch-clause doesn´t catch error?
|
<p>I have two fields that i want to calculate. The program works fine if i put in numbers in both fields, but if i have one empty and presses my "buttonSubtract" (calc-button) it just shuts down with "application closed...". Why doesn´t the catch-clause catch the exception?</p>
<pre><code>protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
buttonSubtract = (Button) findViewById(R.id.buttonsubtract);
editTextNumber1 = (EditText) findViewById(R.id.textnumber1);
editTextNumber2 = (EditText) findViewById(R.id.textnumber2);
textSum = (TextView) findViewById(R.id.textViewSum);
try
buttonSubtract.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
if (editTextNumber1.getText().toString() == ""
|| editTextNumber2.getText().toString() == "")
{
textSum.setText("Put numbers in both fields");
} else
{
int sum = Integer.parseInt(editTextNumber1.getText()
.toString())
- Integer.parseInt(editTextNumber2.getText()
.toString());
textSum.setText("sum: " + sum);
}
}
});
} catch (NumberFormatException e)
{
textSum.setText("Put numbers in both fields");
}
</code></pre>
|
java android
|
[1, 4]
|
1,884,775
| 1,884,776
|
How would I sanitize this string? (perferably in JQuery)?
|
<p>I have a webpage where people type stuff into a text box, and it displays that text below them. That's it. There is no server side.</p>
<p>Let's say someone types <code><script src="blah">hello</script></code></p>
<p>I want to display that as text. Not as a script, of course. How can I do that (all in javascript)?</p>
<p>I want to display the entire text. Don't stip the tags out.</p>
|
javascript jquery
|
[3, 5]
|
3,981,110
| 3,981,111
|
Only Allow jquery to load certain pages
|
<p>Sorry if this has been asked already, I've did a google search and couldn't find the answer.</p>
<p>I am new to jquery and I am wondering how to protect my backend pages from being loaded by external users?</p>
<p>For example, if my jquery .post or .get calls "delete-post.php" I only want the jquery to be able to load that page. I don't want some John Doe user realizing he can post data from his own form to delete-post.php and delete whatever he wants, or calling delete-post.php?id=whatever_id_he_wants.</p>
<p>I hope this makes sense? Like I said I am new to jQuery and am wondering about security.</p>
|
php jquery
|
[2, 5]
|
5,830,636
| 5,830,637
|
Converting date and time to iso format in javascript
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2573521/how-do-i-output-an-iso-8601-formatted-string-in-javascript">How do I output an ISO-8601 formatted string in Javascript?</a> </p>
</blockquote>
<p>I am trying to convert a date and time input to an ISO format but I am getting .toISOString is undefined? I have to be missing something silly.</p>
<pre><code>var startDate = "10/11/2012";
var startTime = "12:12:00";
var fullDate = startDate + " " + startTime;
var fullDateReal = new Date(fullDate);
var iso = fullDateReal.toISOString();
</code></pre>
<p>Why would .toISOString() show as undefined?</p>
<p>I need to end up with the ISO format ("2012-10-11T12:12") timezone is optional.</p>
<p><strong>Update</strong>
It looks like this problem is because IE8 does not support this. So how could I go about converting my inputs to the format listed?</p>
|
javascript jquery
|
[3, 5]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.