Unnamed: 0
int64 302
6.03M
| Id
int64 303
6.03M
| Title
stringlengths 12
149
| input
stringlengths 25
3.08k
| output
stringclasses 181
values | Tag_Number
stringclasses 181
values |
|---|---|---|---|---|---|
2,635,473
| 2,635,474
|
How do i draw the scribling using canvas in android?
|
<p>I want to draw the scribling using <code>canvas</code> in android like free hand drawing....</p>
<p>Here is my code.....</p>
<pre><code> x = motionEvent.getX();
y = motionEvent.getY();
switch (motionEvent.getAction())
{
case MotionEvent.ACTION_DOWN:
td=1;
currentDrawingPath = new DrawingPath();
currentDrawingPath.paint = currentPaint;
currentDrawingPath.path = new Path();
currentDrawingPath.path.moveTo(x, y);
mX = x;
mY = y;
break;
case MotionEvent.ACTION_MOVE:
currentDrawingPath.path.lineTo(mX, mY);
float dx = Math.abs(x - mX);
float dy = Math.abs(y - mY);
tm=1;
isDrawings=true;
if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE)
{
currentDrawingPath.path.quadTo(mX, mY, (x + mX)/2, (y + mY)/2);
mX = x;
mY = y;
}
break;
case MotionEvent.ACTION_UP:
tu=1;
isDrawings=false;
currentDrawingPath.path.lineTo(mX, mY);
drawingSurface.addDrawingPath(currentDrawingPath);
undoBtn.setEnabled(true);
redoBtn.setEnabled(false);
break;
}
</code></pre>
<p>the scrible will appears only in touches up, so please help me to drawing in touchesmove...</p>
<p>Thanks in advance</p>
|
c# java javascript android
|
[0, 1, 3, 4]
|
1,176,094
| 1,176,095
|
How to query database from javascript (or JQuery) click?
|
<p>I have a summary view of a database table. When clicking on a row in the table, I'd like to have a popup showing the full data plus some controls for manipulating that item. I've attached a click handler to the item, which then grabs the primary key from one of the table cells in the row. How can I now pass this primary key to ASP.NET and run server code to query my database and update my UI?</p>
|
javascript jquery asp.net
|
[3, 5, 9]
|
2,528,054
| 2,528,055
|
Having trouble with a dynamic fade in/fade out hover transition (jsfiddle included)
|
<p><a href="http://jsfiddle.net/XztsH/1/" rel="nofollow">http://jsfiddle.net/XztsH/1/</a></p>
<p>The hover class seems to be pushed down a 20 pixel and I'm not quite sure why.</p>
<p>Maybe it's late and my brain is dead...</p>
|
javascript jquery
|
[3, 5]
|
3,188,611
| 3,188,612
|
How to compare a session's value? asp.net
|
<p>I cannot find the way of how to compare a session's value.</p>
<p>Query for the database:</p>
<pre><code> conexion.Open();
SqlCommand comando = new SqlCommand("SELECT id_cliente,alias,area FROM tbleuser WHERE usuario=@username AND pass=@thepassword",conexion);
comando.Parameters.AddWithValue("@username",user.Text);
comando.Parameters.AddWithValue("@thepassword", pas.Text);
SqlDataReader r = comando.ExecuteReader();
while(r.Read())
{
Session["UsuarioId"] = r["id_cliente"].ToString();
Session["AreaUsuario"] = r["area"].ToString();
Session["AliasUsuario"] = r["alias"].ToString();
checkUser();
}
</code></pre>
<p>The checkUser method should compare what kind of user is with the Alias field and here are the opcions i have used.</p>
<h1>1</h1>
<pre><code>if(Session["AliasUsuario"].ToString() == "Doctors")
{
//not working
}
</code></pre>
<h1>2</h1>
<pre><code>if(Convert.ToString(Session["AliasUsuario"]) == "Doctors")
{
//not working
}
</code></pre>
<h1>3</h1>
<pre><code>if(Convert.ToString(Session["AliasUsuario"]).Equals("Doctors"))
{
//not working
}
</code></pre>
<h1>4</h1>
<pre><code>if(Session["AliasUsuario"].ToString().Equals("Doctors"))
{
//not working
}
</code></pre>
<p>Any suggestions? I need to know what kind of user is login in before continue.
Thanks</p>
|
c# asp.net
|
[0, 9]
|
3,476,780
| 3,476,781
|
jQuery autocomplete special character (Norwegian) problems
|
<p>I'm using jQuery's autocomplete function on my Norwegian site. When typing in the Norwegian characters æ, ø and å, the autocomplete function suggests words with the respective character, but not words starting with the respective character. It seems like I've to manage to character encode Norwegian characters in the middle of the words, but not characters starting with it.</p>
<p>I'm using a PHP script with my own function for encoding Norwegian characters to UTF-8 and generating the autocomplete list.</p>
<p>This is really frustrating!</p>
<p>Code:</p>
<p>PHP code:</p>
<pre><code>$q = strtolower($_REQUEST["q"]);
if (!$q) return;
function rewrite($string){
$to = array('%E6','%F8','%E5','%F6','%EB','%E4','%C6','%D8','%C5','%C4','%D6','%CB', '%FC', '+', ' ');
$from = array('æ', 'ø', 'å', 'ä', 'ö', 'ë', 'æ', 'ø', 'å', 'ä', 'ö', 'ë', '-', '-');
$string = str_replace($from, $to, $string);
return $string;
}
</code></pre>
<p><code>$items</code> is an array containg suggestion-words.</p>
<pre><code>foreach ($items as $key=>$value) {
if (strpos(strtolower(rewrite($key)), $q) !== false) {
echo utf8_encode($key)."\n";
}
}
</code></pre>
<p>jQuery code:</p>
<pre><code>$(document).ready(function(){
$("#autocomplete").autocomplete("/search_words.php", {
position: 'after',
selectFirst: false,
minChars: 3,
width: 240,
cacheLength: 100,
delay: 0
}
)
}
);
</code></pre>
|
php javascript jquery
|
[2, 3, 5]
|
3,767,170
| 3,767,171
|
Two dimensional grid
|
<p>is it possible with basic ASP.net controls or Telerik's RadControls to get a two dimensional grid ?
I can't find informations so far ...
thanks in advance for your help!</p>
|
c# asp.net
|
[0, 9]
|
3,931,238
| 3,931,239
|
Using setOnItemClickListener, is undefined for the type TextView?
|
<p>I have a ListView with Checkboxes, (TextView+Checkboxes) and I did the setOnLongClickListener for the items itself:</p>
<pre><code>view = inflator.inflate(R.layout.rowbuttonlayout, null);
final ViewHolder viewHolder = new ViewHolder();
viewHolder.text = (TextView) view.findViewById(R.id.label);
viewHolder.text.setOnLongClickListener(new OnLongClickListener() {
public boolean onLongClick(View arg0) {
</code></pre>
<p>Viewholder comes from my custom adapter to my Listview, no need to specify details I guess. This works pretty good, problem is: if I try to to the same just with setOnItemClickLister (I just want to do a "small" click) I get the error:</p>
<blockquote>
<p>The method setOnItemClickListener(new OnItemClickListener(){}) is
undefined for the type TextView</p>
</blockquote>
<p>Tried this way:</p>
<pre><code>viewHolder.text.setOnItemClickListener(new OnItemClickListener() {
</code></pre>
<p>and </p>
<pre><code>viewHolder.text.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener(){
</code></pre>
<p>But I always get that error. What can I do ?</p>
|
java android
|
[1, 4]
|
3,831,126
| 3,831,127
|
How to read single question from text file containing several question and options as well as information?
|
<p>I have a Text file which contains data (4 to 5 paragraph) and then contain 100 question along with each containing four option (a,b,c,d). Later it contain answer for above question (1.a,2.b and so on). My problem is I want to read each time a single question and options to display. Here when the user selects the option I want to check whether he choose the right one or not. Similarly I want to do this for all questions. And at last I want to display how many question are correct and how many are false. </p>
<p>My question is, how can I get each question and option separately? Similarly the answer. How to get information present in text file separately when required?</p>
<p>my file</p>
<pre><code>Section I – General Questions
Instructions: choose the most correct answer.
1. The International Labour Organization’s first Maternity Protection Convention was issued in:
A.) 1952.
B.) 2000.
C.) 1919.
D.) 1997.
2. Beyond the 5th month of pregnancy, noise in excess of _______________________ may cause
hearing loss in the fetus:
A.) 90 dBA TWA per OSHA requirements
B.) 155 dBC peak and 115 dBC TWA per ACGIH® TLV® Booklet notes
C.) 75 dBA TWA per American Academy of Pediatrics guidelines
D.) 65 dBC peak per EPA studies
ANSWERS – Section I General Questions
1. C
2. B
</code></pre>
|
java android
|
[1, 4]
|
2,925,871
| 2,925,872
|
adding a combo box at run time - JQUERY
|
<p>i have added html elements at run time using append
Code:</p>
<pre><code>function addFormField() {
$("#inputss").append("<strong>asif</strong>"); }
</code></pre>
<p>but how can i add a select element at run time that looks like this..</p>
<p>PHP Code:</p>
<pre><code><select name="pre_req" id="pre_req" class="inputs"
value=<? if($this->uri->segment(2)=='update') echo $results['pre_req']?>>
<option value='None'>None</option>
<? foreach($combo1 as $row)
echo "<option value=$row[sub_name]>$row[sub_name</option>";
?>
</select>
</code></pre>
|
php jquery
|
[2, 5]
|
2,224,620
| 2,224,621
|
update a hidden field value based on country
|
<p>Here is the situation.
A hidden field needs to be updated based on country selection (Denmark (DK), Germany (DE), Netherland (ML).
-If none of these countries is selected, set the hidden field to Regular
-If any of these is selected, set it to Double
-There is another checkbox called "Please contact me". If this is checked, set the hidden field to "Contact me".</p>
<p>I cannot modify the form codes so it must be done by javascript only. </p>
<pre><code><script type="text/javascript">
function updateEmail_Type(country) {
if(document.forms[0].dUSContactMe.checked == false){
countryValue = C_country.options[C_country.selectedIndex].value;
if (countryValue=="DE") { document.forms[0].hiddenOfferType.value="DS Double"; }
if (countryValue=="DK") { document.forms[0].hiddenOfferType.value="DS Double"; }
if (countryValue=="NL") { document.forms[0].hiddenOfferType.value="DS Double"; }
if(countryValue!= "" && countryValue!= "DE" && countryValue!="DK" && countryValue!="NL" && countryValue!="other"){ document.forms[0].hiddenOfferType.value="DS Regular"; }
if (countryValue=="other") { document.forms[0].hiddenOfferType.value="15.00"; }
}
else
{
document.forms[0].hiddenOfferType.value="DS Contact Me";
}
}
</script>
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,238,735
| 5,238,736
|
Confirmation message on user input in php
|
<p>I have a doubt in the following code. I have a single function for both Insert and Update. Based on the row count each function will be executed. I want to provide a Confirmation box before performing the operation. On cancel message it should not perform the function. How can I do this?<br>
Following is the code:</p>
<pre><code>if (isset($_POST['Save']))
{
$query = "SELECT * FROM `table_name` WHERE `submission_id` = '$submission_id'";
$sqlsearch = mysql_query($query);
$resultcount = mysql_num_rows($sqlsearch);
if ($resultcount > 0)
{
mysql_query("UPDATE `table_name` SET
`name` = '$name',
`email` = '$email',
`phone` = '$phonenumber',
`subject` = '$subject',
`message` = '$message'
WHERE `submission_id` = '$submission_id'") or die(mysql_error());
}
else
{
mysql_query("INSERT INTO `table_name` (submission_id, formID, IP,
name, email, phone, subject, message)
VALUES ('$submission_id', '$formID', '$ip',
'$name', '$email', '$phonenumber', '$subject', '$message') ") or die(mysql_error());
}
}
?>`
</code></pre>
|
php javascript
|
[2, 3]
|
3,037,997
| 3,037,998
|
UPDATE STATEMENT in asp.net using c#
|
<p><P>i am using asp.net with C# as code behind
<Pre><code>
OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Documents and Settings\CJP\My Documents\Visual Studio 2005\WebSites\NewElligibleSoft\elligiblity.mdb;Persist Security Info=False");
cn.Open();
string sql = "UPDATE main SET s_name='"+TextBox1.Text+"',inst_code='"+DropDownList1.SelectedItem+"',ms_oms='"+Label7.Text+"',elligiblity='"+Label12.Text+"',Board='"+DropDownList5.SelectedItem+"',percentage='"+TextBox4.Text+"' WHERE elg_id = '"+DropDownList4.SelectedItem+"'";
OleDbCommand cmd = new OleDbCommand(sql, cn);
cmd.ExecuteNonQuery();
cmd.Dispose();
cn.Close();
Response.Write("alert('DATA UPDATED')");
</pre></code>
<p> i am getting error on </p>
<pre><code>cmd.ExecuteNonQuery();</code></pre>
<p>that Data type mismatch in criteria expression.</p>
|
c# asp.net
|
[0, 9]
|
4,466,440
| 4,466,441
|
Uploading docx corrupts file
|
<p>I am using the code below to upload a file. The files upload without error, but when I open a file with a .docx extension M$ says that the file is corrupted. It is able to repair the file and then open, however. I'd like to fix this so the document opens correctly.</p>
<pre><code>string strExtension = Path.GetExtension(context.Request.Files[0].FileName).ToLower();
string fileName = @"C:\" + Guid.NewGuid().ToString() + strExtension;
using (FileStream fs = new FileStream(fileName, FileMode.CreateNew))
{
byte[] bytes = new byte[16 * 1024];
int bytesRead;
while ((bytesRead = context.Request.InputStream.Read(bytes, 0, bytes.Length)) > 0)
{
fs.Write(bytes, 0, bytesRead);
}
}
</code></pre>
<p>Thanks.</p>
<p>EDITED:</p>
<p>File saves correctly with this code:</p>
<pre><code>while ((bytesRead = context.Request.Files[0].InputStream.Read(bytes, 0, bytes.Length)) > 0)
</code></pre>
<p>Also saves correctly with <code>context.Request.Files[0].SaveAs(...);</code></p>
|
c# asp.net
|
[0, 9]
|
3,022,729
| 3,022,730
|
Equivalent of set= and getActionCommand in Android Java?
|
<p>I've just started learning Android development and as a little project, I'm building a calculator. The way it works is that when a number button is pressed, the number is appended to the EditText. I don't want to write this code for each of the buttons, because it's tedious and blatantly inefficient but i'm not sure how to go about it. </p>
<p>When I programmed in Java, I got around the problem by setting the ActionCommand of the JButton equal to the number and then making a general </p>
<pre><code>textField.append(button.getActionCommand());
</code></pre>
<p>Is this possible in Android? Is there a better approach?
Thanks for your help!</p>
|
java android
|
[1, 4]
|
926,717
| 926,718
|
Javascript and Php (MVC)
|
<p>i'm creating my own MVC Framework.
I have a basic form in my view </p>
<pre><code><form action="?" method="post" >
<input type="hidden" name="envoie" value="envoie" />
<?php dico('INSCRIPTION_NOM'); ?><input id="name" type="text" name="name" /><br />
<?php dico('INSCRIPTION_EMAIL'); ?><input id="email" type="text" name="email" /><br />
<?php dico('INSCRIPTION_PWD'); ?><input id="pwd" type="password" name="pwd" /><br />
<input type="button" value="<?php dico('INSCRIPTION_SINSCRIRE'); ?>" onclick="verifForm(document.getElementById('email').value);"/>
</form>
</code></pre>
<p>when I clock on the button they have a javascript function like that : </p>
<pre><code>function verifForm(email) {
var url ="?c=Inscription&a=VerifForm&email="+email;
$.get(url, function(data){
alert('resultat == '+data);
});
}
</code></pre>
<p>Inscription was my controllers and VerifForm an method of the controller. email was the value of a input.</p>
<p>The Php function was :</p>
<pre><code>public function actionVerifForm() {
echo "OK";
}
</code></pre>
<p>When i click on the button i have all the code of the page on my alert but i only want the message "OK".</p>
<p>Thanks for helping me</p>
|
php javascript jquery
|
[2, 3, 5]
|
5,105,708
| 5,105,709
|
Change button background on touch
|
<p>i want to change the green background of a button when this is touched without using OnTouchListener. i have this situation: i put some butons in a layer, then the layer in another layer, and the last layer in onother layer. when i touch the button the background is changing(i m using OnTouchListener right now) but if i drag the finger outside of the button and then get it out of the screen the background of the button remains the image from the state when it s touch(otherwise if i click the button and the the finnger off the button it is k the background is changing) </p>
|
java android
|
[1, 4]
|
4,075,169
| 4,075,170
|
Separate web links from paragraph into a JS array
|
<p>I checked all answers above to see if mine was answered , please don't tag this as duplicate</p>
<p>In the application that i am building there is a div </p>
<pre><code><div class="paragraphlink"> </div>
</code></pre>
<p>I am allowing users enter any text like this</p>
<blockquote>
<p>Räikkönen was among the two Formula One drivers <strong>http://www.formula1.com</strong> who made it into the Forbes magazine's The Celebrity 100 list, the other being Fernando Alonso <strong>http://www.google.com</strong>. He is 36th on Forbes magazine's <strong>http://www.forbesmagazine.com</strong></p>
</blockquote>
<p>If you notice there are urls present in the above para. can you please help me with a javascript code to extract all the urls from the para above?</p>
|
javascript jquery
|
[3, 5]
|
1,764,706
| 1,764,707
|
Android Spinner can't add to xml file
|
<p>I am trying to add spinner to one of my fragment, when i add spinner to xml. file, even i haven't create any events in my fragment, it's crash every time i try to open that fragment.
and my Fragment is binding with simple adapter to get information, the error show "Spinner is not a view that can be bound by this Simple Adapter
Anyone can help on this?</p>
|
java android
|
[1, 4]
|
2,184,428
| 2,184,429
|
Selecting a form that doesn't have two or more names
|
<p>I'm selecting a form that doesn't have the name "someform", like this:</p>
<pre><code> $("form[name!=someform]").bind("keyup", function(e){
[some code]
});
</code></pre>
<p>What if I want to select a form that doesn't have multiple names, like "someform1" or "someform2"?</p>
<p>How do I do that?</p>
|
javascript jquery
|
[3, 5]
|
426,303
| 426,304
|
How to dynamically return all functions in scope?
|
<p>I have the code below, as you can see I'm manually specifying the properties I want to return, I don't care about having private/public functions here, so I'd like a quick & dynamic way to just return all functions in the scope. Is this possible? I've tried a few things but having trouble, it has to be done inside the scope otherwise it can't see the functions.</p>
<pre><code>var MyObj = {
(function() {
function MyFuncOne() {}
function MyFuncTwo() {}
return {
MyFuncOne: MyFuncOne,
MyFuncTwo: MyFuncTwo
}
})()
}
var MyObjTwo = {
(function() {
function MyFuncOne() {}
function MyFuncTwo() {}
return {
MyFuncOne: MyFuncOne,
MyFuncTwo: MyFuncTwo
}
})()
}
</code></pre>
<p>Pseudo code of what I want:</p>
<pre><code>function ReturnAllProperties() { //foreach func in scope append to list }
</code></pre>
<p>then in the <code>return { ReturnAllProperties(); }</code></p>
|
javascript jquery
|
[3, 5]
|
4,348,204
| 4,348,205
|
echofon's website like Logo's Hover Effect
|
<h1>What I Want</h1>
<p>First, Go here -> <a href="http://www.echofon.com/twitter/windows/" rel="nofollow">http://www.echofon.com/twitter/windows/</a> and then, hover your mouse over the Echofon logo on the top bar ( top-left corner ). I want to achieve the same thing.</p>
<h1>What I am doing</h1>
<p>I have two images -> logo1.png and logo2.png. When a user hovers over the img tag with src:logo1.png, the current logo should fade out and the logo2.png should fade in just like the echofon logo. I tried to do it myself and the code is given below:</p>
<pre><code>$(document).ready(function(){
$(".mainlogo")
.mouseover(function() {
$(this).fadeOut('slow',function(){
$(this).attr("src", "/CSS/logo2.png");
$(this).fadeIn();
});
})
.mouseout(function() {
$(this).fadeOut('slow',function(){
$(this).attr("src", "/CSS/logo1.png");
$(this).fadeIn();
});
});
});
</code></pre>
<h1>The Problem with the Code</h1>
<p>Yes, the script is working, but the problem is that the timing is wrong. on hover, logo1.png completely fades out leaving behind a blank space and then logo2.png appears. But, I want the same effect as echofon logo. Please Help.</p>
|
javascript jquery
|
[3, 5]
|
5,957,877
| 5,957,878
|
Contact us section
|
<p>I am having problems with my asp.net application i can run the program with no errors when i fill in the boxes on the contact us section i then get a error saying.</p>
<blockquote>
<p>SMTPException was unhanded by user code</p>
</blockquote>
<p>Here is my code</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class contactUs : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void submitform(object sender, EventArgs e)
{
MailMessage email = new MailMessage()
{
Subject = "Email From CraigavonAquatics Contact Us Section",
Body = commentBox.Text,
IsBodyHtml = false,
From = new MailAddress(emailBox.Text, nameBox.Text)
};
email.To.Add(new MailAddress("craigavonaquatics@gmail.com", "Philip Harrison"));
SmtpClient server = new SmtpClient();
server.Send(email);
msgSuccess.Visible = true;
}
</code></pre>
|
c# asp.net
|
[0, 9]
|
959,517
| 959,518
|
setting back the cursor/carat at the end of the appended string in div
|
<p>So to reproduce the issue, here's a fiddle to play around with: <a href="http://jsfiddle.net/QRgE9/1/" rel="nofollow">http://jsfiddle.net/QRgE9/1/</a></p>
<p>Type in the following string into the box: Hello @An</p>
<p>And then make a selection from the dropdown. </p>
<p>You can see that after you've made the selection the cursor is no where to be found and user have to click again on the div. How do I make it such that the cursor blinks (doesn't loses it's focus) after I made the selection? I know facebook can do this just fine.. so I think I am missing something. </p>
<p>Also the cursor is not always appended at the end of the string. If the case is I am inserting this in the middle of the string, then the cursor should start again at the middle of the string.</p>
<p>Here's the code that is triggered when the user made a selection:</p>
<pre><code>$(".display_box").live("mousedown",function(event)
{
$("#friendsList").hide();
selRange = saveSelection();
var startOffset = selRange.startOffset;
var endOffset = selRange.endOffset;
var username = $(this).attr('title');
var currentContent = $("#recommendTextArea").html();
var E ="<span contenteditable='false' title=\"" + username + "\">"+ username + "</span> ";
var newContent = currentContent.replace(word, E); //replacing @abc to users real name
$("#recommendTextArea").html(newContent);
selRange.setStart($("#recommendTextArea")[0].childNodes[0], startOffset);
selRange.setEnd($("#recommendTextArea")[0].childNodes[0], endOffset);
restoreSelection(selRange);
event.preventDefault();
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
780,351
| 780,352
|
Really cool JS tools: does anybody know what this is?
|
<p>Very cool JS components: <a href="http://www.msnbc.msn.com/id/40664031/ns/us_news-crime_and_courts/" rel="nofollow">http://www.msnbc.msn.com/id/40664031/ns/us_news-crime_and_courts/</a></p>
<p>Check out the icons next to the vertical scrollbar in your browser, and the expanding 'sharing' toolbar at the bottom.</p>
<p>Does anybody know if these are publicly available components? Has anybody seen these before?</p>
<p>Edit: I'm talking about:</p>
<ol>
<li>The way the sections in the bottom bar expand into tabs to show more controls. Try clicking on "Login and settings", for example.</li>
<li>The way the links near the scrollbar take you to the respective sections. Very cool tool to aid user discovery in a long page.</li>
</ol>
|
javascript jquery
|
[3, 5]
|
1,311,562
| 1,311,563
|
JQuery issue while deploying on tomcat and weblogic
|
<p>i am trying to run a jQuery on tomcat server and weblogic server but its not working </p>
<pre><code> <html>
<head>
<script src="/WEB-INF/js/jquery-1.7.1.js" language="javascript" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$("p").hide();
});
});
</script>
<link href="/WEB-INF/css/styles.css" type="text/css" rel="Stylesheet" />
<title>Dual List Box</title>
</head>
<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Click me</button>
</body>
</html>
</code></pre>
<p>can any one help me ..!!</p>
|
java javascript jquery
|
[1, 3, 5]
|
17,199
| 17,200
|
How to pass two value in to HyperLinkColumn on asp.net 1.1?
|
<p>Here is the code:</p>
<pre><code><asp:DataGrid id="dataGrid1" runat="server" OnItemDataBound="dataGrid1_ItemDataBound">
<Columns>
<asp:HyperLinkColumn DataNavigateUrlFields="Valid,CouponCode"
DataTextField="Valid"
HeaderText="Enable / Disable"
DataNavigateUrlFormatString="?id={0}orgValue={1}" />
</Columns>
</asp:DataGrid>
</code></pre>
<p>In newer version of .net they got <code>DataNavigateUrlFields</code>, but in asp.net only have <code>DataNavigateUrlField</code>. (Ref: <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.hyperlinkfield.datanavigateurlfields(v=vs.80).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.hyperlinkfield.datanavigateurlfields(v=vs.80).aspx</a>)</p>
<p>So, how can I pass two value into <code>HyperLinkColumn</code>? Thanks. </p>
|
c# asp.net
|
[0, 9]
|
2,896,844
| 2,896,845
|
add/edit text to video which is linked to database
|
<p>I am creating a website to allow users to upload their videos. The problem I'm facing is that I do not know how to allow the user to add or edit the text to the video they have uploaded. Any pointers?</p>
|
c# asp.net
|
[0, 9]
|
1,815,554
| 1,815,555
|
Different styles of flow of program?
|
<p>I am a computer science student therefore I do not know that much. </p>
<p>I was recently talking with a friend who just got a job as a (java) software developer. He told me that in his job there is a guy who is really experienced in C++, but unfortunately every time he writes code in java, he is using the try-catch to control the flow of the program. According to my friend this is a wrong style in Java. Is this true? What are the differences (if any) in using try-catch(-finally in java) between C++ and Java? </p>
|
java c++
|
[1, 6]
|
2,207,612
| 2,207,613
|
Difference between loadUrl and loadData with javascript
|
<p>I try to load in an Android webview a html page with an ajax post request.</p>
<p>When I load the webview with loadUrl, the javascript works fine, but when I try to load with loadData (I need it) I get an error : "<code>NETWORK_ERR: XMLHttpRequest Exception 101</code>". This error sounds like a access control origin problem.</p>
<p>The parseJsoup function replace some string in the html page with good strings. I check the data that I pass to loadData and the script part is not alterate.</p>
<p>My oncreate function :</p>
<pre><code>public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String html = parseJsoup("index.html");
setContentView(R.layout.main);
myBrowser = (WebView)findViewById(R.id.mybrowser);
myBrowser.getSettings().setJavaScriptEnabled(true);
myBrowser.setWebViewClient(new MyWebViewClient());
//myBrowser.loadUrl("file:///android_asset/index.html");
myBrowser.loadDataWithBaseURL("", html, "text/html", "utf-8", null);
}
</code></pre>
<p>And my javascript code :</p>
<pre><code>$.ajaxSetup({
contentType: "application/json; charset=utf-8",
datatype: "json",
async: false,
});
$.ajax({
type: "POST",
url: "my url",
data: 'my data',
success: function(data){
// Do some action here with the data variable that contains the resulting message
document.write("OK "+JSON.stringify(data));
console.log(data);
},
error: function(data){
document.write("KO "+JSON.stringify(data));
console.log(data);
}
});
</code></pre>
<p>Thanks</p>
|
javascript android
|
[3, 4]
|
3,113,495
| 3,113,496
|
How to register click event only once?
|
<p>I am trying to register click event once to my element in my project.</p>
<p>I have simplfy my codes and basically my structure looks like the following:</p>
<pre><code>function objectParent(){
}
objectParent.prototype.click=function()(
$('#create').click(function(){
var var1=new objectchild();
var1.add();
})
}
function objectchild(){
}
objectchild.prototype.add=function()(
//The '#aButton' click event will be registered 4 times if the '#create' button is clicked 4 times.
//so the alert will pop 4 times when 'aButton' is clicked which is not what I wanted.
//I can use $('#aButton').unbind('click') to remove the click event but I have many buttons in my project
//and I want to have better solution for this.
$('#aButton').click(function(){
alert('click')
})
}
var test=new objectParent()
test.click();
</code></pre>
<p>html</p>
<pre><code><a id='create' href='#'>test</a>
//everytime this <a> is clicked, it will create a new objectchild object
//after click 4 times of this button and click 'aButton', it will pop the alert box 4 times
//I know it register click event 4 times to the 'aButton'
//I only want to pop the alert box once.
//I can use $('#aButton').unbind('click); to remove the click event but I have many many buttons in my codes
//ex bButton, cButton...etc. I want to have a better approach for my codes.
<a id='aButton' href='#'>button</a>
</code></pre>
<p>I hope I explain my problem well. Thanks for the help!</p>
|
javascript jquery
|
[3, 5]
|
5,307,249
| 5,307,250
|
jQuery: How to calculate the maximal attribute value of all matched elements?
|
<p>Consider the following HTML:</p>
<pre><code><div class="a" x="6"></div>
<div class="a" x="9"></div>
<div class="a" x="2"></div>
...
<div class="a" x="8"></div>
</code></pre>
<p>How would you find the maximal <code>x</code> value of all <code>.a</code> elements ?</p>
<p>Assume that all <code>x</code> values are positive integers.</p>
|
javascript jquery
|
[3, 5]
|
6,028,429
| 6,028,430
|
Move div element to the middle of the screen in animation
|
<p>How do you animate a div element to the middle of the screen from the left side</p>
<p>I get this invalid obect or prperty
i can't seem to reference the jQuery(document) object through jQuery anymore </p>
<pre><code>form.each(function () {
jQuery(this).animate({ marginLeft: jQuery(document).width / 2 }, 750); <-- this line here gives me errors
jQuery('input[name^=Next]').click(function () {
});
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,981,786
| 5,981,787
|
Can I run separate asp.net c# page load events using JQuery multipage/same file data-role=page?
|
<p>So,</p>
<p>I'm using a c# code-behind in my mobile web site.</p>
<p>I need to run different <code>Page_Loads</code> based on which page is being displayed using Jquery Mobile <code>data-role="page"</code> attribute.</p>
<p>Ex: I have </p>
<pre><code><div data-role="page" id="page1">
<div data-role="content">Content</div>
</div>
<div data-role="page" id="page2">
<div data-role="content">Content</div>
</div>
</code></pre>
<p>Depending on which "page"(div) was loaded, how can I run a <code>Page_Load</code> on code behind?</p>
<p>Thanks</p>
|
c# jquery
|
[0, 5]
|
1,878,190
| 1,878,191
|
Java/Android retrieving and saving values
|
<p>I am making a game where I will have a large list (100-200) of monsters with their associated stats (name, health, attack, defense, type, etc). I set it up to have a monster class that contains all the stats as variables and will do the necessary methods such as attacking or gaining xp. When the player is playing the game, they will have their own monster which will have stats that change as the level and I will need to save this information. All the other monsters will be stored in a list where I will ask for one specific monster only when it is time to battle. </p>
<p>With my limited knowledge of Java and the Android SDK, I have come up with a possible solution but it seems like more work than is needed. I plan on having separate resource value xml files for each stat, so one for the monster name, one for its health, etc with the values being stored in an array. In my game, I will create an array for each stat then retrieve the value based upon an index number generated corresponding to a monster.</p>
<p>This seems like more work than needed because I am creating and importing all the arrays from the file instead of just the values corresponding to the one monster I want. Is there a way that would be less resource intensive on my game and easier to deal with? Also what would be the best way to save the particular monster that player is using and leveling up that I can retrieve the next time the start the app?</p>
|
java android
|
[1, 4]
|
869,795
| 869,796
|
Detecting referral url
|
<p>I can't detect referral url if user type url directly to browser or if he has some anti-virus or firewall which removes referral url. Is it possible to detect when user typed url directly in browser?</p>
|
php asp.net
|
[2, 9]
|
2,939,347
| 2,939,348
|
JS/jQuery: Get depth of element?
|
<p>What's the easiest way to get the depth of an element in pure JavaScript or jQuery? By "depth" I mean how many elements deep is it nested, or how many ancestors does it have.</p>
|
javascript jquery
|
[3, 5]
|
2,004,103
| 2,004,104
|
PHP rendering JS useless
|
<p>Ok, so, I'm not at all familiar with PHP dev, however, here I find myself. I have a page I created in HTML/CSS and JS that works great with several JS plugins. However, when I turn it into a php page, the JS is conflicting and rendered useless.</p>
<p>It is because the PHP is aggregating it into one large js file. When I run it in debug and loading up all the files separately everything is fine. Has anyone hit this before?</p>
<p>Here is how I am loading them:</p>
<pre><code>register_script( array(
'base_path' => PROJECTURL,
'scripts' => array(
'js/libs/jquery-1.5.min.js',
'js/libs/jquery.jscrollpane.js',
'js/libs/jquery.selectbox-0.6.1.js',
'js/libs/jquery.mousewheel.js',
'js/libs/jquery.autocomplete.min.js',
'js/libs/jquery.watermark.js',
'js/propriatary-name.js',
)
) );
</code></pre>
|
php javascript
|
[2, 3]
|
2,697,724
| 2,697,725
|
Need help on performing asynchronous operations
|
<p>I have a folder structure:</p>
<ul>
<li>Parent
<ul>
<li>1st Child</li>
<li>2nd Child</li>
<li>3rd Child</li>
<li>...</li>
</ul></li>
</ul>
<p>There could be any number of child folders.</p>
<p>On deleting parent it should delete all its subcategories and each subcategory is asscoiated to different entities (e.g. permissions).</p>
<p>If a user deletes a parent folder with a large amount (e.g. 1000) sub categories it takes a long time, and therefore the UI hangs (as it deletes the subfolders before parents).</p>
<p>How can I do this asynchronously - allowing the user to continue working with the UI while the delete completes in the background? How would I notify them that the work has completed?</p>
<p>This is a web (ASP.Net) application.</p>
|
c# asp.net
|
[0, 9]
|
3,066,767
| 3,066,768
|
variable scope clarification
|
<p>I have a snippet of javascript code, that I have found in the "<strong>Secrets of the JavaScript Ninja</strong>" (a John Resig book). I have a problem to understand the behaviour of a variable.
The following is the code (simplified with respect to the original one):</p>
<pre><code>(function() {
var results;
this.assert = function assert() {
var li = document.createElement("li");
results.appendChild(li);
return li;
};
this.test = function test(name, fn) {
results = document.getElementById("results");
results = assert().appendChild(document.createElement("ul"));
fn();
};
})();
window.onload = function() {
test("A test.", function() {
assert();
assert();
});
};
</code></pre>
<p>My problem is the <strong>results</strong> variable. When you enter the "test" function, the results variable will take the value <strong>"ul#results"</strong> first and then the value <strong>"ul"</strong>, as a result of the <strong>appendChild</strong> function. But when you enter the <strong>"fn()"</strong> function the value of "results" is still "ul#results". Why? I have some difficult to understand the scope of this variable. </p>
<p>Can someone help me to understand this topic?</p>
<p>Thank you very much.</p>
|
javascript jquery
|
[3, 5]
|
5,217,058
| 5,217,059
|
jQuery find/replace without changing original text
|
<p>Is there a way in jQuery to find a string of text in jQuery and not replace it with something else but wrap that text with an element so when the script is finished it spits out the original text with the string of text wrapped.</p>
<p>Example:</p>
<p>Original Text</p>
<pre><code>"Hello world to all people"
</code></pre>
<p>Search string</p>
<pre><code>"world to"
</code></pre>
<p>Replace with <code><i></i></code></p>
<p>Final output</p>
<pre><code>"Hello <i>World to</i> all people"
</code></pre>
<p>Thanks in advance for the help!</p>
<p>Kind of working code:</p>
<pre><code>function highlightChild(child) {
$(childElements[child]).text("");
console.log(child);
$('.child_element_' + child).bind('textselect', function(e){
var selection = e.text;
var str = $("#construct_version").text();
var wrap = jQuery(childElements[child]).text(selection);
var re = new RegExp("" + selection + "", "g");
console.log(str.replace(selection, function(match, key, val){
console.log(match);
console.log(key);
console.log(val);
jQuery(childElements[child]).text(val)
}));
});
}
</code></pre>
<p>The above code does the replace but where it actually does the replace it shows as undefined.</p>
<p>So if the original string is Hello world to all and I am wanting to replace world to with <code><b>world to</b></code>, it shows in the console.log as Hello undefined all </p>
|
javascript jquery
|
[3, 5]
|
4,079,476
| 4,079,477
|
design patterns for persisting state on android app
|
<p>For android I am trying persist state if onDestroy() is called. I'm wondering what are common design patterns used to do such a thing so that the actual app functionality is decoupled from the persistence functionality? For example, I have a for loop that iterates through all of the players in the game. This update happens at the end of each round in the game. Would it be possible that the app gets destroyed half way through the update? If that happened, what kind of logic would i need to include to remember which player was updated.</p>
|
java android
|
[1, 4]
|
590,474
| 590,475
|
ASP.net best way to change links
|
<p>Given:</p>
<pre><code><div class="subMenu">
<a href="products.aspx" class="subLink">Products</a> <a href="productCats.aspx" class="subLink">Categories</a> <a href="example.aspx" class="subLink">Another</a>
</div>
</code></pre>
<p>In my code behind, how would I programatically change the list of links in that div?</p>
<p>In my code behind I would have something along the lines of:</p>
<pre><code>if(menuID == 0) {
// Display some links here
}else if(menuID == 1) {
// Display some links here
}else if(menuID == 2) {
// Display some links here
}
</code></pre>
<p>Sorry for the simplicity, just trying to learn.</p>
|
c# asp.net
|
[0, 9]
|
4,825,454
| 4,825,455
|
use of "response" in fetching tweets from search API
|
<p>I am new to jquery and javascript. here i have a code which fetches tweets using twitter;s search api. Can yo please tell me why are we passing the argument "response" to the function after .done()? How is this working ? </p>
<pre><code> $('#input').submit(function(e){
e.preventDefault();
e.stopPropagation();
var hashtag = $(this).find('input[name="hashtag"]').val();
var twitterapi = "http://search.twitter.com/search.json?";
jQuery.ajax({
type: "GET",
url: twitterapi,
data: {
"q": hashtag,
"rpp": 1000
},
dataType: 'jsonp'
}).done(function (response) {
var results = response.results;
for (var i = 0; i < results.length; i++) {
$("#tweet").append("<p class='tweet'>" +
"<span class='username'>" +
results[i].from_user +
"</span> <span class='tweet_content'> " +
results[i].text + "</span></p>");
}
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,424,242
| 5,424,243
|
Is it Possible to read CSV file using Javascript or Jquery?
|
<p>How do I read a CSV file uploaded through file input using Javascript or jQuery? Is it possible to get the number of rows in the uploaded file?</p>
|
javascript jquery
|
[3, 5]
|
6,008,390
| 6,008,391
|
Jquery animate scroll in diagonal
|
<p>How can I put a diagonal scroll in my page via JQuery ? </p>
<p>Example, I hid the scroll bar and if my user click in some link, my page has to scroll in diagonal until some part of my page (is possible?)</p>
<p>this is my jquery code, but I know that just gone to the bottom of my page.</p>
<pre><code>.animate({ scrollTop: 350}, 500);
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,258,959
| 2,258,960
|
problems with create an object on post back
|
<p>i have an issue with creating an object in ASP.net</p>
<p>My Page Load function is:</p>
<pre><code>public partial class hangMen : System.Web.UI.Page
{
abc ltr;
Words word = null;
static Label [] lbl = null;
static Button[] btn = null;
Game game;
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
show_current_word();
SetBord();
}
else
{
SetBord();
SetWords();
}
}
}
</code></pre>
<p>My issue is:
Iam not sure where should i put the
game = new Game();</p>
<p>if i put it in the else part so i get null reference exception.
and i also dont want to create this oject every post-back.</p>
<p>this object count the player score and the times that click "Hint" and make a wrong </p>
<p>any ideas??</p>
|
c# asp.net
|
[0, 9]
|
2,352,153
| 2,352,154
|
Listbox scrolling to the selected item in ASP.net
|
<p>I wanto to make my ListBox control scroll to the selected item.</p>
<p>Here is my code:</p>
<pre><code>protected void Button2_Click(object sender, EventArgs e)
{
ListBox1.SelectionMode = ListSelectionMode.Multiple;
ListBox1.SelectedIndex = -1;
for (int i = 0; i < ListBox1.Items.Count; i++)
{
if (ListBox1.Items[i].Text == TextBox1.Text)
{
ListBox1.SelectedIndex = i;
}
}
}
</code></pre>
<p>Thank you!</p>
|
c# asp.net
|
[0, 9]
|
2,068,880
| 2,068,881
|
How to provide elements/tags dynamically inside the find() in jquery
|
<p>I have created several div with id's such as window1, window2 and so on. Now all I want to is find the <p> tag from these above created divs. I am doing this inside the for loop but it is not working for me. Here is what I am doing</p>
<pre><code> for(connectWindow=1;connectWindow<=xmlLength;connectWindow++)
{
//look for the to tag inside the html
var windo = "window"+connectWindow;
var to = "to"+connectWindow;
alert("Making connections" + windo +to)
//$("div#windo").find('strong#to')(function())
$("div#windo").find('p#to').each(function(){
alert("@@@@@@@@@@@@@@@@@@@@");
var name = $(this).text();
//display_function(name,country);
alert("Name is :::"+name);
});
}
</code></pre>
<p>Please let me know where I am going wrong. Also please let me know if there is any solution in JavaScript either.
Thanks !</p>
|
javascript jquery
|
[3, 5]
|
2,695,476
| 2,695,477
|
What's a easy way to truncate an array with Jquery?
|
<p>Linq has a convenient operator method called Take() to return a given number of elements in anything that implements IEnumerable. Is there anything similar in jQuery for working with arrays?</p>
|
javascript jquery
|
[3, 5]
|
1,099,604
| 1,099,605
|
issue with handling json data from server
|
<p>i have an problem with handling data come from server , please see the code bellow :</p>
<p>php</p>
<pre><code>echo json_encode(array("toshow"=>"<span class='text'><img src='greencheck.png'/>"));
</code></pre>
<p>javascript </p>
<pre><code>$('#data').ajaxForm({
dataType: 'json',
success: function(data){
if(data.error == 1){
$('#preview').html("<span class='text'><img src='close.png'/>"+data.filename+" File exsist ..</span>");
}else{
$('.first').after(data.toshow);
}
}
}).submit();
</code></pre>
<p>problem is when i send data from the server as {'data'=>someData} , i have no problem .. when i send any html tags such as <code>{'data'=>"<span>some data</span>"}</code> success function in javascript is not processing anything so success = fails .. </p>
<p>case 1 : sending json data from the server example , {'error'=>1,'msg'=>file exists} , in this case every thing is ok .
<img src="http://i.stack.imgur.com/LssRX.jpg" alt="enter image description here"></p>
<p>case 2 : sending json data from the server example ,{'toshow'=>linkdatta...etc} , so in case of adding any html tag in json problem start so success function not working at all </p>
<p><img src="http://i.stack.imgur.com/qZWCi.jpg" alt="enter image description here"> </p>
|
php javascript jquery
|
[2, 3, 5]
|
3,503,868
| 3,503,869
|
JS syntax breaks the page
|
<p>I have the following code in my external JS file:</p>
<pre><code>var myDiv = $(".myDiv");
if (myDiv.css('left') == 'auto') {
var pos = myDiv.position();
myDiv.css({ "left:" + pos.left + "px", "top:" + pos.top + "px" });
}
</code></pre>
<p>It appears that the following line breaks my page:</p>
<pre><code>myDiv.css({ "left:" + pos.left + "px", "top:" + pos.top + "px" });
</code></pre>
<p>If I comment it out everything works fine, except this functionality, obviously. </p>
<p>And if I put the values in alert I get them correctly as well.</p>
<pre><code>alert(pos.left + ' ' + pos.top)
</code></pre>
<p>What am I missing?</p>
|
javascript jquery
|
[3, 5]
|
4,712,815
| 4,712,816
|
What does $([]) mean in jQuery?
|
<pre><code>var username = $("#username"),
password = $("#password"),
allFields = $([]).add(username).add(password);
</code></pre>
<p>What is allFields? What is $([])? </p>
<p>Being a newbie to Javascript/jQuery, I've never seen this $([]) notation before and I'm interested in its associated methods. </p>
<p>Given that its "$([])", it's tricky to search for. And a Google search of arrays in Javascript (guessing that thing is an array of some sort) yields the typical arrays I'm familiar seeing.</p>
<p>So what is $([])? Can anyone point me to some documentation? I'm interested in learning how to use this strange thing.</p>
|
javascript jquery
|
[3, 5]
|
401,829
| 401,830
|
Call URL before closing of Browser Window
|
<p>I want to call an URL in the unload-Function of a Webpage but in the unload-function the get request is not working. My code looks like this:</p>
<pre><code>$(window).unload( function () {
jQuery.get("someurl")
} );
</code></pre>
<p>We want to be informed about the closing of the window for some logging of user actions. Is it possible somehow?</p>
<p>If i add an alert() after the jQuery.get(), the Get-Request has enough Time, to do this, but that's not what we prefer. </p>
|
javascript jquery
|
[3, 5]
|
5,119,914
| 5,119,915
|
determine url is true or false
|
<p>I use ASP.NET with javascript ,</p>
<p>I have a question in my code </p>
<p>I need to determine url exists or not</p>
<pre><code>url="http://www.404.com"
If url == exists then
{
}
else if url == not then
{
}
</code></pre>
|
javascript asp.net
|
[3, 9]
|
1,884,823
| 1,884,824
|
How to Submit only after Jquery finished updating the field
|
<p>I have a form where a user inputs a word, when pressing the button I want it to translate the word (using the jquery script) into the same field.
Only after completed to populate the field, it should continue and submit the translated word.</p>
<p>everything is working except that it will submit as soon as it translating causing the original word to be submitted instead of the translated one.
the original page shows that the word had been translated.</p>
<p>please help on how to make it submit only after the word have been translated in the text field. ?
should I use a delay ? if so how ?
or is there an oncomplete, "onpopulate" or something like that ?</p>
<p>here is the script: </p>
<pre><code><script type="text/javascript">
$(function transle() {
$('#transbox').sundayMorningReset();
$('#transbox input[type=submit]').click(function(evt) {
$.sundayMorning(
$('#transbox input[type=text]').val(),
{ source:'', destination:'ZH', menuLeft:evt.pageX, menuTop:evt.pageY},
function(response) {
$('#transbox input[type=text]').val(response.translation);
}
);
});
});
</script>
</code></pre>
<p>and the form:</p>
<pre><code> <table id="transbox" width="30px" border="0" cellspacing="0" cellpadding="0">
<form action="custom-page" method="get" name="form1" target="_blank" id="form1" >
<tr>
<td><input id="q" name="q" type="text" class="search_input" value="Evening dress" /></td>
<td><input type="submit" /></td>
</tr>
</form>
</table>
</code></pre>
<p>there are another JS called for the script but I don't sure its needed for the question.</p>
<p>thank you.</p>
|
javascript jquery
|
[3, 5]
|
4,746,755
| 4,746,756
|
Downloading images from a server iPhone SDK
|
<p>I have created a program which allows me to upload images to my server. They are given a random file name when uploaded. I want to be able to download all the images from a folder on the server so I can display them in my application. The only example I have seen requires that I know the file name of the images which I don't. How could I download all the images in a given directory (and store the downloads in an NSArray)? If there is no native way to do it does anyone know a way that it could be done via calling a PHP script? (I use a PHP script which the iPhone calls to upload the images).</p>
<p>Thanks.</p>
|
php iphone
|
[2, 8]
|
3,750,718
| 3,750,719
|
Get real height of div plus css generated content (if possible)
|
<p>I'm trying to use javascript to give three ULs nested inside divs a negative top position equal to their height. I've got it working, sort of (thanks to help from here!) but instead of calculating the height of each nested UL and calculating the top position accordingly, each UL is being assigned a negative top position of -367px:</p>
<pre><code><script type="text/javascript">
$(document).ready(function() {
//Get height of footer popup
var pHeight = $('footer ul li > ul').outerHeight();
//Calculate new top position based on footer popup height
var nHeight = pHeight + "px";
$('footer ul li > ul').css({
//Change top position to equal height of footer popup
'top' : "-" + nHeight
});
});
</script>
</code></pre>
<p>I've tried this using <code>.height</code>, <code>.outerheight</code>, and even <code>.getheight</code> which someone mentioned on the Jquery documentation for <code>.height</code>. I also tried using an each statement, though it didn't seem to work; I may have written it incorrectly. </p>
<p>In addition (if possible), I'd like the negative position to take into account the height of a content being generated using the css <code>:after</code> psuedo-property, though I can always manually add that in to the calculation if javascript has no way to access that.</p>
<p><strong>EDIT:</strong> Added a test page link. It's the bottom divs (and nested ULs) I'm trying to target with JS; the "tails" on each box should line up at about 1.2em above their parent divs.</p>
<p><a href="http://www.qualityprinters2.com/test/float-tab-test.html" rel="nofollow">http://www.qualityprinters2.com/test/float-tab-test.html</a></p>
|
javascript jquery
|
[3, 5]
|
5,216,712
| 5,216,713
|
Radiobuttonlist - Access Click/change using jquery and reading values (rbList values are bound using binding)
|
<p>I am trying to access the value of the radio button option selected by the user. The radio buttons in the radio button list are generated by binding using datasource</p>
<pre><code>radioButtonList.DataSource = data;
radioButtonList.DataBind();
</code></pre>
<p>Now I want to check the value of the selected radio button and do something after. I can generate an alert message but i am not able to get the value of the selected radio button</p>
<pre><code>$('#<%= rbDepartment.ClientID %>').change(function() {
alert("working!");
}).change();
</code></pre>
<p>Can someone show me how to ge the value of selected radio button.</p>
<p>Thanks,
Madhav</p>
|
c# jquery asp.net
|
[0, 5, 9]
|
408,327
| 408,328
|
How can I create a progress bar with percentage?
|
<p>I want to create a progress bar with jquery or javascript that finds the percentage while loading the javascript. All the images are loaded in the javascript, they use the jquery append tag and so I want to load all these images with a screen that is shown with a loading bar based on percentage of how much of the data has been loaded. What is the best way to do this?</p>
|
javascript jquery
|
[3, 5]
|
172,329
| 172,330
|
making files in the folder donwloadable using php or javascript
|
<p>I am trying to making files to be downloadable after clicking the link of the listed file. I am not getting idea how to make it possible. I have completed to list file using following scripts. Now I have to provide listed file to be downloadable after clicking the file name. Plz help...</p>
<pre><code>$dir = 'd:/temp_file/voice/';
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if($file != '.' && $file != '..')
echo "filename: ".$file."<br />";
// header('Content-type: audio/wav');
// header('Content-Disposition: attachment; filename="'.$dir.$file.'"');
// readfile($dir.$file);
}
closedir($dh);
}
}
</code></pre>
|
php javascript
|
[2, 3]
|
5,236,560
| 5,236,561
|
Check if domain is available for purchase - C#
|
<p>Is there any way that I check if a certain domain is available for purchase?
If there is any library out there that will do this?</p>
<p>THanks</p>
|
c# asp.net
|
[0, 9]
|
1,676,674
| 1,676,675
|
jQuery pseudo selector with variable as selector
|
<p>I've set a variable equal to a frequently-referenced selector:</p>
<pre><code>var allSteps = $("#makeIntoSlideshowUL > li");
</code></pre>
<p>Additionally, I'm using a custom-defined search function that makes contains (which I'm using to search) case-insensitive</p>
<pre><code>jQuery.expr[':'].Contains = function(a,i,m){
return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0;
};
</code></pre>
<p>Without using the variable selector, I can do this</p>
<pre><code>$("#makeIntoSlideshowUL > li:Contains('" + $(this).val() + "')").css("display","block");
</code></pre>
<p>How do I use the variable selector and this defined psuedo selector together? I've tried this, but it doesn't work</p>
<pre><code>allSteps+":Contains('" + $(this).val() + "')".css("display","block");
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,860,786
| 1,860,787
|
passing file path to http handler as posted file in the format of context.request..files
|
<p>I need to send a file to http handler in the form of context.request.files[index].Actually this is happen when we choose file from file upload controler.but my task is to do same thing with out file uploader controler.Here i am getting file path dynamically.i did not find till now how i can set(convert) this file path to context.request.files.we have any other options are there for sending this path to handler.i dont have a chance to edit handler.i must pass file path as a posted file.</p>
|
c# asp.net
|
[0, 9]
|
793,458
| 793,459
|
What is the default behavior for items added to System.Web.Caching.Cache?
|
<p>What are the default expiration parameters associated with items added to the ASP.NET cache?</p>
<p>Do items added expire after an absolute period of time, and if so, what is the default expiration time? Or do they use a sliding-window?</p>
<p>I can't seem to find any references to default behavior of items added and I need to know because I am supporting a code-base where all calls to the Cache are done via Cache[key] = value rather than specifying explicit dependencies / expiration policies </p>
|
c# asp.net
|
[0, 9]
|
2,446,422
| 2,446,423
|
jquery to add one cell without refreshing the page
|
<p>I want to add one cell in a section each time I click the add button. The page is updated without refreshing.
The html code is:</p>
<pre><code><section>
<p class="cell">content</p>
</section>
<button type="button" id="addCell">add</button>
</code></pre>
<p>How should I implement the js?Thanks!</p>
|
javascript jquery
|
[3, 5]
|
2,406,948
| 2,406,949
|
Returning a json object without square brackets
|
<p>I have a function which returns an object of form:
<code>[{"key":"name","value":"ali","key":"age","value":"56"}]</code> when called as given below. How can I have it return same kind of object but without the square brackets?</p>
<pre><code>setProperties('{"name":"ali","age":"56"}');
function setProperties(str) {
var properties = [];
var json = jQuery.parseJSON(str);
for (property in json) {
properties.push({
key: property,
value: json[property]});
}
return properties;
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
553,900
| 553,901
|
Showing timer countdown
|
<p>In my game I have set the timer to 30000ms (30 secs). When the timer ends the game ends. I want to show the user the timer to give them some idea of how long they have left. How would I do this, I have tried to do it like this:</p>
<pre><code>setTimeout(function() {
$("#message").html('Thank you for playing. </br> You answered </br>' + hit + '/' + attempted + ' correctly. </br> Press "Play" to start again.').fadeIn('slow');
$(".character").fadeIn('slow');
}, 500);
});
}, 30000).show('#timer'); //here I am trying to display the time in the "#timer"
}
</code></pre>
<p>I think I am approaching this all wrong can someone give me a point in the right direction?</p>
<p>Fiddle: <a href="http://jsfiddle.net/cFKHq/8/" rel="nofollow">http://jsfiddle.net/cFKHq/8/</a></p>
|
javascript jquery
|
[3, 5]
|
1,668,163
| 1,668,164
|
How do I fire an ASP.NET custom validator from JavaScript?
|
<p>I want to code a function in javascript that every time I call it in the webform it fires up an specific validator in that same webform.</p>
|
asp.net javascript
|
[9, 3]
|
2,515,704
| 2,515,705
|
javascript on window close event
|
<p>I am currently detecting if a user of my site closes the window/tab or changes the url.</p>
<p>I am using the follwoing code, which works perfectly:</p>
<pre><code>var validNavigation = false;
function endSession() {
// Browser or broswer tab is closed
// Do sth here ...
alert("bye");
}
function wireUpEvents() {
window.onbeforeunload = function() {
if (!validNavigation) {
endSession();
}
}
// Attach the event keypress to exclude the F5 refresh
$(document).bind('keypress', function(e) {
if (e.keyCode == 116){
validNavigation = true;
}
});
// Attach the event click for all links in the page
$("a").bind("click", function() {
validNavigation = true;
});
// Attach the event submit for all forms in the page
$("form").bind("submit", function() {
validNavigation = true;
});
// Attach the event click for all inputs in the page
$("input[type=submit]").bind("click", function() {
validNavigation = true;
});
}
$(document).ready(function() {
wireUpEvents();
});
</code></pre>
<p>My problem is i would like to change the event from an alert to a overlay. I have setup up a hidden div overlay and replaced the alert in the above code with:</p>
<pre><code>$('.overlay').css('display','block');
</code></pre>
<p>This now no longer works, as there is nothing within the div to get the user to stay on the page. (the user doesn't have to click a button within an alert)</p>
<p>Any suggestions on how i can get around this?</p>
<p>Cheers, Dan</p>
|
javascript jquery
|
[3, 5]
|
4,152,568
| 4,152,569
|
Jquery focus(in|out) run in weird order
|
<p>The problem is that when there is a focus on one <code>#input1</code>, and i try to focus it on <code>#input2</code>
by running</p>
<pre><code>$('#input2').focus();
</code></pre>
<p>first runs the <code>focusin</code> event of <code>#input2</code> then the <code>focusout</code> of the <code>#input1</code></p>
<p>Why does this happen, why isn't <code>focusout</code> running first?</p>
<p>Please see for an example <a href="http://jsfiddle.net/zZZsD/3/" rel="nofollow">http://jsfiddle.net/zZZsD/3/</a>
Type in first input 4 symbols</p>
<p>UPDATE: Btw, I've used delegated binding instead of direct for performance reasons,there will be potentially lots of input fields...</p>
|
javascript jquery
|
[3, 5]
|
1,178,334
| 1,178,335
|
Jquery - Truncate Text by Line (not by character count)
|
<p>I need a Jquery script to truncate a text paragraph by line (not by character count).</p>
<p>I would like to achieve an evenly truncated text-block. It should have a "more" and "less" link to expand and shorten the text paragraph. My text paragraph is wrapped in a div with a class, like this:</p>
<pre><code><div class="content">
<h2>Headline</h2>
<p>The paragraph Text here</p>
</div>
</code></pre>
<p>The closest solution i could find on SOF is the one below (but it`s for textarea element and does not work for me):
<a href="http://stackoverflow.com/questions/556767/limiting-number-of-lines-in-textarea">Limiting number of lines in textarea</a></p>
<p>Many thanks for any tips.
Ben</p>
|
javascript jquery
|
[3, 5]
|
205,287
| 205,288
|
Call class function in BroadcastReceiver onReceive function
|
<p><br/>I have a service with a <code>BroadcastReceiver</code>.<br/>How can I call a function in the service class from the <code>onReceive</code> function of the <code>BroadcastReceiver</code>?<br/>And if I can't, what can I do?<br/>Here is some code :</p>
<pre><code>public class MyService extends Service {
private BroadcastReceiver broadcastReceiver;
@Override
public IBinder onBind(Intent arg0) {
return null;
}
@Override
public void onCreate() {
broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
... // How to call myFunction() here?
}
};
... // intentFilter, registerReceiver, etc...
}
private void myFunction() {
... // do something
}
}
</code></pre>
|
java android
|
[1, 4]
|
3,963,538
| 3,963,539
|
Delete a table row with javascript / jquery
|
<p>This is not working. Firebug is not throwing any error though. </p>
<p>HTML: </p>
<pre><code><table>
<tr><td>BookA</td><td><a href="javascript:deleteRow($(this));" class="red">Delete</a></td></tr>
<tr><td>BookB</td><td><a href="javascript:deleteRow($(this));" class="red">Delete</a></td></tr>
<tr><td>BookC</td><td><a href="javascript:deleteRow($(this));" class="red">Delete</a></td></tr>
<tr><td>BookD</td><td><a href="javascript:deleteRow($(this));" class="red">Delete</a></td></tr>
</table>
</code></pre>
<p>Javascript:</p>
<pre><code>function deleteRow(ref) {
$(ref).parent().parent().remove();
}
</code></pre>
<p><strong>If possible, I would like to use a solution with inline javascript</strong></p>
|
javascript jquery
|
[3, 5]
|
3,434,834
| 3,434,835
|
ASP.net - building online basketball manager how to keep game logic running
|
<p>my question is this, how can i simulate a text base basketball game in a web application.</p>
<p>The game logic class is ready and in use in my WPF application, however I want to transfer it to a web base application.
But I have no idea how to keep the game thread a live + updating the UI every second.(only text update are required).</p>
<p>Any ideas ?
Thanks.</p>
|
c# asp.net
|
[0, 9]
|
2,655,917
| 2,655,918
|
Toggle DIV with JQuery
|
<p>I have a FAQ area on my page that has all of the questions in a list and when a user clicks on a title, a DIV with the answer will expand into view. However, I'm having trouble when it comes to closing the answer DIV layer. One of two things happen...</p>
<p>This one will simply open and close each DIV layer individually therefore multiple answers can be open at once. I want only one open, when a user either clicks the same title or another title, the currently open layer should collapse.</p>
<pre><code><script type="text/javascript">
jQuery(document).ready(function() {
jQuery(".faq_answer").hide();
jQuery(".faq_heading").click( function() {
jQuery(this).next(".faq_answer").slideToggle(500);
});
});
</script>
</code></pre>
<p>This one will collapse whatever layer is currently open when another title is clicked (which is good). However, when the SAME title is clicked it closes it and then reopens it.</p>
<pre><code><script type="text/javascript">
jQuery(document).ready( function() {
jQuery(".faq_answer").hide();
jQuery(".faq_heading").click( function() {
jQuery(".faq_answer").hide(500);
jQuery(this).next(".faq_answer").slideToggle(500);
});
});
</script>
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,894,447
| 4,894,448
|
If URL contains anything, then fire a Javascript function
|
<p>Basically, if the URL/<code>window.location</code> contains absolutely any variable whatsoever (past domain.com/, of course), I'd like javascript to execute something. </p>
<p>Currently, I have the following jQuery code which only executes when <code>window.location</code> contains the exact wording "#hash", but as stated before I'd like to expand the functionality for all variables.</p>
<p><strong>Edit:</strong> Sorry, to clarify, by variable I mean any one of the following examples:</p>
<ul>
<li>domain.com/<strong>#hash</strong></li>
<li>domain.com/<strong>#hash2</strong></li>
<li>domain.com/<strong>sub/folder</strong></li>
<li>domain.com/<strong>textwithoutahash</strong></li>
</ul>
<p><em>Also, if someone knows how to do this in basic Javascript and without the need for the jQuery library, that would be an added bonus!</em></p>
<pre><code>$(function() {
if ( window.location.href.indexOf('#hash') > -1 ) {
myfunctionhere;
}
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,681,246
| 1,681,247
|
jQuery plugin: ":hover" doesnt work in IE8
|
<p>I've written a jQuery plugin which makes an element pulse. It's working great in Chrome and Internet Explorer 9. In Internet Explorer 8, it's not working after the setTimeout call.</p>
<p>I've created a jsFiddle to demonstrate the problem: <a href="http://jsfiddle.net/Guykp/" rel="nofollow">http://jsfiddle.net/Guykp/</a>
Here's the javascript code:</p>
<pre><code>$(document).ready(function() {
$.fn.pulseEffect = function(delay, duration) {
var $element, animateOptions;
$element = $(this);
if (!$element.is(":hover")) {
animateOptions = {
opacity: $element.css("opacity") === "1" ? .6 : 1
};
$element.animate(animateOptions, duration);
}
return setTimeout((function() {
return $element.pulseEffect(delay, duration);
}), delay + duration);
};
$("#pulse-element").pulseEffect(0, 1000);
});
</code></pre>
<p>How can I make it working in Internet Explorer 8?</p>
<p>This is the error message from Internet Explorer 8: <strong>Syntax error, unrecognized expression: unsupported pseudo: hover</strong></p>
<p><strong>This is the solution:</strong>
<a href="http://stackoverflow.com/questions/1273566/how-do-i-check-if-the-mouse-is-over-an-element-in-jquery/2846405#2846405">How do I check if the mouse is over an element in jQuery?</a></p>
|
javascript jquery
|
[3, 5]
|
2,935,396
| 2,935,397
|
Dynamically loaded User control ID and javascript
|
<p>I have a host page that dynamically loads multiple instances of the same user control by assigning different IDs.</p>
<p>After the UC loads, I will need to use JS to get a reference to a textbox. For this, I need the User control Client ID. I do have access to the UC Client ID on the server side and can set a hidden form variable with this information. But I run into the problem of referencing this form variable from javascript as I need the UC client ID to be able to do so.</p>
<p>What's the best approach for this problem?</p>
|
asp.net javascript
|
[9, 3]
|
3,063,930
| 3,063,931
|
how to get back to the most recent created fragment in android?
|
<p>Hi i have created two activities? first activity launches a layout with a fragment. when user clicks on that fragment it launches a new activity which creates a layout with a fragment. Now to go back to the first activity ( i mean the layout created by the first activity) the only way is pressing back button on android. so now i have come to the first activity but i thought to see the second activity back. as there is no forward button how will i see the 2nd activity without relaunching from the first activity. </p>
<p>with pure activity this is not possible as i move back with the back button the 2nd activity will be popped out and will be destroyed. so there is no point in going forward. Is this the same case when i use fragments(fragmentActivity)?</p>
|
java android
|
[1, 4]
|
2,744,016
| 2,744,017
|
Android logical operation &&?
|
<p>This one has been giving me fits for over an hour... I could swear the code is right. Am I missing something?</p>
<pre><code>if((fType != "EXACT") && (dateTime > System.currentTimeMillis())){
myIntent = new Intent(getBaseContext(), MyScheduledReceiver1.class);
} else {
myIntent = new Intent(getBaseContext(),MyScheduledReceiver2.class);
}
</code></pre>
<p>Even if the <code>String</code> <code>fType</code> is "EXACT" & <code>long</code> <code>dateTime</code> is in the future... it's still calling MyScheduledReceiver1.class... when since 1 is false it should be calling MyScheduledReceiver2.class.</p>
|
java android
|
[1, 4]
|
3,091,654
| 3,091,655
|
How to check if someone is a user?
|
<p>I'm designing a website (ASP.NET, c#), in which you can see the controls, but you can only use them after you've logged in (for example, you can see a list of games, but you can only place a bet after you've logged in, so if you try to place a bet when you are not logged in, the site should redirect you to the login page).</p>
<p>All said, my problem is this: How can you tell, if a certain user is logged in, BEFORE he types in his credentials?</p>
<p>He his not a user yet right? For me he is just someone that is browsing my website.</p>
|
c# asp.net
|
[0, 9]
|
2,447,081
| 2,447,082
|
Calling Method in Android
|
<p>I am trying to call a method I have written. It compiles except for one line...</p>
<pre><code>public class http extends Activity {
httpMethod(); //will not compile
public void httpMethod(){
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://site/api/");
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
String test = "hello";
TextView myTextView = (TextView) findViewById(R.id.myTextView);
myTextView.setText(test);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
}
}
}
</code></pre>
<p>I'm not the best java guy, but I would think calling the method like so would get a response. "Hello" is not displayed however... </p>
<p>How do I properly call the method?</p>
|
java android
|
[1, 4]
|
4,422,177
| 4,422,178
|
How to overwrite (NOT append) a text file in ASP.NET using C#
|
<p>I have included a text file in my website with multiple lines.
I have put a textbox (Multimode=true) and a button in the page.
On Page_Load the content from the textFile should be displayed in the textbox.
Then the user can edit the textbox. On button click the current content of TextBox should be overwritten in that text file (it should not be appended).</p>
<p>I'm successfully displaying the text file data in a textbox. But while overwriting, it appends in the text file rather than overwriting.</p>
<p>This is my code:</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
if (File.Exists(Server.MapPath("newtxt.txt")))
{
StreamReader re = new StreamReader(Server.MapPath("newtxt.txt"));
while ((input = re.ReadLine()) != null)
{
TextBox1.Text += "\r\n";
TextBox1.Text += input;
}
re.Close();
}
else
{
Response.Write("<script>alert('File does not exists')</script>");
}
}
protected void Button1_Click(object sender, EventArgs e)
{
StreamWriter wr = new StreamWriter(Server.MapPath("newtxt.txt"));
wr.Write("");
wr.WriteLine(TextBox1.Text);
wr.Close();
StreamReader re = new StreamReader(Server.MapPath("newtxt.txt"));
string input = null;
while ((input = re.ReadLine()) != null)
{
TextBox1.Text += "\r\n";
TextBox1.Text += input;
}
re.Close();
}
</code></pre>
<p>How can I overwrite the text file and then display it in my TextBox on the same button click?</p>
|
c# asp.net
|
[0, 9]
|
3,673,677
| 3,673,678
|
How to store <TR> id value in array, when I toggle?
|
<p>I am toggling <code>'tr.subCategory1'</code>and its siblings <code>.RegText</code>. at the same time I am trying to store its ids in the array like this <code>list_Visible_Ids[$(this).attr('id')] = $(this).css('display') != 'none' ? 1 : null;</code> (When I collapsed I need store <code>'null'</code> in array at its id place, If I expand I need store I need store <code>1</code> at its id place). But everytime <code>alert($(this).css('display'))</code> showing <code>block</code>. How can I handle this?. So When I collapsed or expanded it is storing <code>1</code> only.</p>
<pre><code>$(document).ready(function() {
$('tr[@class^=RegText]').hide().children('td');
list_Visible_Ids = [];
var idsString, idsArray;
idsString = $('#myVisibleRows').val();
idsArray = idsString.split(',');
$.each(idsArray, function() {
if (this != "" || this != null) {
$('#' + this).siblings('.RegText').toggle();
list_Visible_Ids[this] = 1;
}
});
$('tr.subCategory1')
.css("cursor", "pointer")
.attr("title", "Click to expand/collapse")
.click(function() {
$(this).siblings('.RegText').toggle();
$(this).siblings('.VolumeRegText').toggle();
//alert($(this).css('display'))
list_Visible_Ids[$(this).attr('id')] = $(this).css('display') != 'none' ? 1 : null;
});
$('#form1').submit(function() {
idsString = '';
for (var index in list_Visible_Ids) {
idsString += (idsString != '' ? ',' : '') + index;
}
$('#myVisibleRows').val(idsString);
form1.submit();
});
});
</code></pre>
<p></p>
|
javascript jquery
|
[3, 5]
|
895,943
| 895,944
|
stripping file.html out of the link
|
<p>So, I am writing a script that is suppose to illuminate different sections of the nav. each nav link is set up to be /directory/subdir/. It worked until I realized there needs to be more to this. if you are in a directory that is not the index file it doesn't work since it was directly matching HREF attribute. Now, how would I strip out the filename.html from the link and just get the directory? Thanks for all your help contributors!</p>
|
javascript jquery
|
[3, 5]
|
1,267,295
| 1,267,296
|
Unexpected token in jQuery
|
<p><a href="http://www.jamesperrett.co.uk/" rel="nofollow">This site</a> was working fine but suddenly errors have appeared.</p>
<p>Unexpected token ( - what does this mean? Looks correct to me, and has been working fine for many months.</p>
<pre><code><script>
function (){ <--"Uncaught SyntaxError: Unexpected token (" here
$(".message").focus(function() {
$("#bubble").fadeOut();
}).blur(function() {
$("#bubble").fadeIn();
});
})();
</script>
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,831,451
| 2,831,452
|
Performance Tips try/catch blocks
|
<p>In ASP.NET I would like your opinion regarding what is the best way for Handling Exceptions.</p>
<ul>
<li>Would you suggest to use try/catch blocks?</li>
<li>Better to use try/catch blocks on every single piece of code/component? Or in wich situations?</li>
</ul>
<p>I am new in dev, I really appreciate your help thanks!</p>
|
c# asp.net
|
[0, 9]
|
5,437,241
| 5,437,242
|
Make Session expire
|
<p>I am using <code>authentication mode=forms</code> in web.config file. Because it is a secure application so I want to expire my session in 5 minutes. Right now I am doing it in programming in codebehind.<br/><br/>
Is there any other easy way to do it?</p>
|
c# asp.net
|
[0, 9]
|
379,844
| 379,845
|
quick jQuery question
|
<p>Should be a really quick one for you pro's:</p>
<p>I'm learning to use JS, in particular a plugin called (embarassingly) 'Easy Image'.</p>
<p><a href="http://cssglobe.com/post/3783/jquery-plugin-easy-image-or-content-slider" rel="nofollow">http://cssglobe.com/post/3783/jquery-plugin-easy-image-or-content-slider</a></p>
<p>Here's my code:</p>
<p><a href="http://jsfiddle.net/tomperkins/LnES6/" rel="nofollow">http://jsfiddle.net/tomperkins/LnES6/</a></p>
<p>JS files are from here:
<a href="http://cssglobe.com/post/3783/jquery-plugin-easy-image-or-content-slider" rel="nofollow">http://cssglobe.com/post/3783/jquery-plugin-easy-image-or-content-slider</a>
And obviously jQuery (1.5)</p>
<p>I've stripped it down to the basics and can't figure out why it's not working.</p>
<p>Any tips are much appreciated!</p>
<p>Thanks in advance,</p>
<p>Tom</p>
|
javascript jquery
|
[3, 5]
|
5,783,372
| 5,783,373
|
JQuery Bubble Popup: innerhtml hidden div
|
<p>I'm using the JQuery Bubble Popup library, trying to show a hidden div in the innerHtml variable. Right now I have this:</p>
<pre><code><div class="button"> Show stuff </div>
<div class="information"> foo </div>
<div class="button"> Show stuff </div>
<div class="information"> bar </div>
<script>
$(document).ready(function(){
$('.information').hide();
$('.button').CreateBubblePopup({
position: 'bottom',
align: 'center',
width: '300',
innerHtml: $(this).next(".information").html(),
innerHtmlStyle: { color:'#000', 'text-align':'left', 'font-size':'110%' },
themeName: 'grey',
themePath: '/static/images/jquerybubblepopup-theme',
selectable: true,
});
});
</script>
</code></pre>
<p>The thing is, it isn't working as I expected, the problem is in the line </p>
<pre><code>innerHtml: $(this).next(".information").html(),
</code></pre>
<p>Because if I put this it works:</p>
<pre><code>innerHtml: 'testing jquery bubblepopup',
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,854,382
| 2,854,383
|
How to differentiate between click and drag/drop event?
|
<p>I have a problem with element which is both draggable and also has a click event.</p>
<pre><code>$('.drag').mousedown(function() {
//...
});
$('.class').click(function() {
//...
)};
<div class="drag class"></div>
</code></pre>
<p>When I drag and drop the element, the click event gets fired, too. How to prevent that?</p>
|
javascript jquery
|
[3, 5]
|
3,497,682
| 3,497,683
|
How to track user response to confirm box, generated at runtime from c# code?
|
<p>I am trying to get user confirmation from c# code behind file, to confirm if user wants to overwrite the existing file on server of cancel the operation but so far no luck.</p>
<p>this is my code :</p>
<pre><code>if (File.Exists(filePath))
{
string alertMsg = @"confirm('A File already exists with the same name. \n Would you like to overwrite the existing file ?');";
ScriptManager.RegisterStartupScript(this, this.GetType(), "Test", alertMsg, true);
}
else
{
fuPSD.SaveAs(filePath);
}
</code></pre>
<p>any help would be highly appreciated.</p>
|
c# asp.net
|
[0, 9]
|
4,985,458
| 4,985,459
|
apply methods of most objects jquery
|
<p>e.g.</p>
<pre><code>var $magicLine = $("#magic-line");
var $magicLine2 = $("#magic-line2");
</code></pre>
<p>how do I apply the methods to two objects?
I now use:</p>
<pre><code>$magicLine.width($(".current_page_item").width()
$magicLine2.width($(".current_page_item").width()
</code></pre>
<p>if i use this method the programm not work:</p>
<pre><code>$magicLine.width($(".current_page_item").width()
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,113,610
| 1,113,611
|
What is significance of putting "$" sign before a parameter in Java / Android?
|
<p>What is the difference or significance of putting $ sign before any variable or parameter..</p>
<p>e.g. </p>
<p>Suppose here is my class...</p>
<pre><code> public class Vector3 {
public Vector3(float x, float y, float z){
//...
//... my ctor code
//...
}
}
</code></pre>
<p>and what will be the difference between these two declarations...</p>
<p><strong>Declaration 1</strong></p>
<pre><code> Vector3 $vec = new Vector3(1f,1f,1f);
</code></pre>
<p><strong>Declaration 2</strong></p>
<pre><code> Vector3 vec = new Vector3(1f,1f,1f);
</code></pre>
<p>If you can notice $ sign before "vec" in Declaration 1 and Declaration 2.</p>
<p>Any clues?</p>
<p>Also, declaring the same constructor as below,</p>
<pre><code>public class Vector3 {
public Vector3(float $x, float $y, float $z){
//...
//... my ctor code
//...
}
}
</code></pre>
<p>What is difference between above constructor and the initial constructor ?</p>
<p>Thanks...</p>
<p>Edit: Thanks to all your responses, I did this with different combinations and there is no major significance :) I appreciate all your answers.</p>
|
java android
|
[1, 4]
|
4,368,585
| 4,368,586
|
How to put a textbox text in my jQuery function in ASP.NET?
|
<pre><code><script type="text/javascript">
var progress_key = '<?= $uuid ?>';
$(document).ready(function() {
$(".pb3").progressBar({ max: 2000, textFormat: 'fraction', callback: function(data) { if (data.running_value == data.value) { } }} );
$(".pb4").progressBar({ max: 2000, textFormat: 'fraction', callback: function(data) { if (data.running_value == data.value) { } }} );
$(".pb5").progressBar({ max: 2000, textFormat: 'fraction', callback: function(data) { if (data.running_value == data.value) { } }} );
});
</script>
</code></pre>
<p>I am using a jQuery progress bar, and I want to dynamically generate the max field
with text from a text box control. Is this possible and what would I use?</p>
<pre><code>maxValue3 = $(['[id*=label4']).val();
maxValue4 = $(['label5']).val();
maxValue5 = $(['id*=label6']).val();
$(".pb3").progressBar({ max: (maxValue3), textFormat: 'fraction', callback: function(data) { if (data.running_value == data.value) { } }} );
$(".pb4").progressBar({ max: (maxValue4), textFormat: 'fraction', callback: function(data) { if (data.running_value == data.value) { } }} );
$(".pb5").progressBar({ max: (maxValue5), textFormat: 'fraction', callback: function(data) { if (data.running_value == data.value) { } }} );
</code></pre>
|
jquery asp.net
|
[5, 9]
|
6,033,883
| 6,033,884
|
What is the most efficient way to include many javascript functions (with PHP in them) in a PHP page?
|
<p>In one of my sites, I need to use PHP 'foreach' to keep including some Javascript code. In this code contains PHP $variables that change within the foreach loop. </p>
<pre><code>foreach ($a as $b) {
include("javascript.php");
}
</code></pre>
<p>javascript.php contains codes like this: </p>
<pre><code><script>
$(".<?php echo $somevariable?>").something;
</script>
</code></pre>
<p>My question is: What is the most efficient (if any) way to load javascript that contains PHP variables?</p>
<p>I keep reading that it's better to call large javascript codes in a .js script rather than writing it on the page, But apparently .js files can not have PHP.</p>
<p>Thanks for your insight.</p>
|
php javascript
|
[2, 3]
|
5,367,222
| 5,367,223
|
Setting var to sum of two textbox values is 0, how come?
|
<p>I am experiencing something odd, please see below. Why is alert 1 outputting 0 but alert 2 outputting the correct sum? They are set to the same thing...</p>
<pre><code>var sumTotal = parseFloat($('#tb1').val()) + parseFloat($('#tb2').val());
//tb1.val() == 3, tb2.val() == 5;
1) alert(sumTotal); //Outputs 0;
2) alert(parseFloat($('#tb1').val()) + parseFloat($('#tb2').val())); //Outputs 8;
</code></pre>
<p>Exact code:</p>
<pre><code> $(document).ready(function () {
var koh = 1;
var sumTotal = parseFloat($('#tb1').val()) + parseFloat($('#tb2').val());
window.setInterval(function () {
// correct value
tb3.val(parseFloat($('#tb1').val()) + parseFloat($('#tb2').val()));
tb3.val(parseFloat(sumTotal)); // 0
tb3.val(sumTotal); // 0
tb3.val(koh++) //increments +1
}, 2500);
})
</code></pre>
<p>since koh increments +1 can this still be a scoping issue?</p>
|
javascript jquery
|
[3, 5]
|
5,801,772
| 5,801,773
|
threads in android no output
|
<p>I've created an android app where the user inputs a string and a number, where the number will be calculated to its factorial. Everything's working fine but when i enclose my code inside the thread there's no output.</p>
<p>here's my source code:</p>
<pre><code>package com.inputandfactorial;
import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
Button chkCmd;
EditText input1, input2;
TextView display1, display2;
int res = 1,factint;
String fact;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
chkCmd = (Button) findViewById(R.id.bProcess);
input1 = (EditText) findViewById(R.id.etString);
input2 = (EditText) findViewById(R.id.etFactorial);
display1 = (TextView) findViewById(R.id.tvString);
display2 = (TextView) findViewById(R.id.tvFactorial);
chkCmd.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Thread t1 = new Thread(){
public void run(){
String change = input1.getText().toString();
fact = input2.getText().toString();
factint = Integer.parseInt(fact);
for (int i = 1; i <= factint; i++) {
res = res * i;
}
try {
display2.setText("The factorial of " + fact + " is " + res);
display1.setText("The string value is " + change);
} catch (Exception e) {
}
}
};
t1.start();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
</code></pre>
<p>I know i don't need to put it in a thread, i just was just experiment to see if this will work and it didn't.</p>
|
java android
|
[1, 4]
|
3,626,793
| 3,626,794
|
Custom Section in Web.config
|
<p>how to create and use a custom section in web.config ?</p>
|
c# asp.net
|
[0, 9]
|
4,049,857
| 4,049,858
|
Calling a jQuery method named in variable
|
<p>I have a JavaScript variable which contains the name of a jQuery method: <br></p>
<pre><code>var method = 'attr("src")';
</code></pre>
<p>How can I make it work like:</p>
<pre><code>console.log($('img').method)
</code></pre>
<p>I tried</p>
<pre><code>console.log($('img')[method]())
</code></pre>
<p>but it gives this error:</p>
<pre><code>Uncaught TypeError: Object [object Object] has no method 'attr("src")'
</code></pre>
|
javascript jquery
|
[3, 5]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.