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 |
---|---|---|---|---|---|
1,740,665 | 1,740,666 | prevent form submission if validation failed after iterating over each form element with jquery's .each() function | <p>I have the following code in which I'm trying to iterated over html text input elements, do some validation and prevent the form submission if the validation fails:</p>
<pre><code>$("#the_form").submit(function(){
$(":text", this).each(function(){
if($(this).val().length != 0)
{
var str = $(this).val();
str = $.trim($(this).val());
$(this).val(str);
if($(this).val().length < 4)
{
alert("You should enter at least 4 characters");
$(this).focus();
return false;
}
}
}) // end of each() function
return true;
})
</code></pre>
<p>If I remove the .each() function and do each element separately (which obviously is not a very good approach), I get the results wanted. However, if I use the code as it is, the form keeps on submitting even if the user has not entered at leas four characters. Any ideas on what I may be doing wrong here? Any help will be very appreciated. Thanks in advance.</p>
| javascript jquery | [3, 5] |
3,649,428 | 3,649,429 | Get text from span with a specific class | <p>I have the below HTML and JQuery code and i am needing some help to do the following, i have some radio buttons with freight types, when the user choose one of them i need to get its price, it is in the span with the class <code>price</code>. I've tried to use <a href="http://api.jquery.com/closest/" rel="nofollow"><code>.closest()</code></a> but i am getting and empty result (JQuery v1.7.2). Can anybody help me to get this?</p>
<p><strong>HTML</strong></p>
<pre><code><div class="freight">
<input type="radio" name="freight-type" id="FX" value="FX" />
<label for="FX">
<span class="blue">Fedex</span>-
<strong>US$ <span class="price">12.42</span> </strong>
<span class="small-text"> (Delivery time: <strong>3 business days)</strong></span>
</label>
</div>
</code></pre>
<p><strong>JQuery</strong></p>
<pre><code>$("input[name=freight-type]").change(function() {
alert( $(this).closest(".price").text() )
});
</code></pre>
| javascript jquery | [3, 5] |
2,468,849 | 2,468,850 | How to render response stream with jquery? | <p>I have this </p>
<pre><code> MemoryStream export = new MemoryStream();
iCalendarSerializer serializer = new iCalendarSerializer(iCal);
serializer.Serialize(export,System.Text.Encoding.UTF8);
return export;
</code></pre>
<p>so I am using the C# DDay.iCal library for exporting my calendars. Serialize takes in a "stream" so I passed it a memory stream.</p>
<p>I now have a generic handler that calls the method that contains the above code.</p>
<pre><code> public class CalendarHandler : IHttpHandler
{
private Calendar service;
private Membership membershipS;
public void ProcessRequest(HttpContext context)
{
service = new Calendar ();
membershipS = new Membership (null);
string userName = context.User.Identity.Name;
Guid userId = membershipS.GetUsersId(userName);
context.Response.ContentType = "text/calendar";
// calls the export calendar(the code that showed above that uses dDay ical.
var t = service.ExportCalendar(userId);
t.WriteTo(context.Response.OutputStream);
}
public bool IsReusable
{
get
{
return false;
}
}
}
</code></pre>
<p>So now I wrote the icalendar to the Outputstream. Now I have a jquery post that goes to this method and now I am not sure how to take the OutputStream result that the jquery post will get and make it popup with a save dialog box.</p>
<pre><code>$('#ExportCalendar').click(function(e)
{
$.post('../Models/CalendarHandler.ashx', null, function(r)
{
});
return false;
});
</code></pre>
| c# asp.net jquery | [0, 9, 5] |
4,581,794 | 4,581,795 | Thumbnail Generation | <p>Is there a "good" way to generate a thumbnail for a JPEG file that doesn't have on in the EXIF information?</p>
<p>If a user uploads an image, I'm trying to display the thumbnail, but if there's no thumbnail in the image the display is blank (src=""). Currently we replace blank images with a loading image that gets swapped out with the thumbnail generated on the server by an AJAX call back.</p>
<p>Is there anything I can do client-side (jQuery & jQuery UI are already integrated, but open to new libraries if they'll help) other than displaying a loading image that gets changed by the AJAX call back?</p>
<p>For clarification I don't just mean taking the Base64 raw data and changing the height and width attributes most of our users upload 5MB+ files, and the text alone crashes the browser if we use the raw data. I mean actually appending a thumbnail to the EXIF, or creating it and using the created base64 data as the image source.</p>
<p>Apologies in advance for breaches in etiquette or lack of clarity, this is my first question on Stack Overflow.</p>
| javascript jquery | [3, 5] |
3,189,271 | 3,189,272 | to store data in mysql from android | <p>Here i have attached my code this doesn't show me any sort of error.. But data is not being inserted into mysql table. can anyone help me out. I have made my ddms connection correctly. But still its not working.</p>
<p>my java code:</p>
<pre><code> public class MainActivity extends Activity {
Button b1;
EditText et1, et2;
String name, place;
InputStream is;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1 = (Button) findViewById(R.id.button1);
et1 = (EditText) findViewById(R.id.editText1);
et2 = (EditText) findViewById(R.id.editText2);
name = et1.getText().toString();
place = et2.getText().toString();
b1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
// Building Parameters
ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("name", name));
params.add(new BasicNameValuePair("place", place));
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(
"http://10.0.2.2/insert.php");
httppost.setEntity(new UrlEncodedFormEntity(params));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
</code></pre>
<p>and my php is here:</p>
<pre><code> <?php
$con=mysqli_connect("localhost","root","","sample");
if(isset($_POST['name'],$_POST['place']))
{
$name=$_POST['name'];
$place=$_POST['place'];
$sql="INSERT INTO sampletable (name,place) VALUES('$name','$place')";
mysqli_query($con,$sql);
}
echo "1 record added";
mysqli_close($con);
?>
</code></pre>
| php android | [2, 4] |
4,698,664 | 4,698,665 | What are the basic measures upon building a good form? | <p>Basic measures when building forms that interact with the sql database. What are the security measures (check insert strings, sql injection etc), and Do people use special controllers in order to format their data? I am using GridView and realizing its tables, which I dont like. If so are there any suggestions for data formatting controllers? Thanks! </p>
| c# asp.net | [0, 9] |
5,523,410 | 5,523,411 | Selecting an element inside of the hovered "li" tag | <p>I have a few <code><li></code> tags and I need to hide an element inside of the hovered <code><li></code>tag.
The following code is not working, please let me know how can I get it worked...</p>
<pre><code>$(function(){
$("#deals ul li").hover(function(){
$(this:has(".transform")).hide();
});
});
</code></pre>
<p>Thanks.</p>
| javascript jquery | [3, 5] |
3,610,719 | 3,610,720 | jquery array checkbox | <pre><code>var others = $("#6");
others.click(function() {
$('input:checkbox').attr('checked',false);
$("#6").attr('checked',true);
});
</code></pre>
<p>I have an array of check boxes which is drawn from database. I want to uncheck other check boxes when a certain check box is ticked in my case checkbox with id #6, and it uncheck a checkbox #6 if other checkbox is check.</p>
<p>The code above is able to uncheck other checkbox but how can I uncheck the checkbox with id 6,once the other checkbox is check.</p>
| javascript jquery | [3, 5] |
5,248,363 | 5,248,364 | Open a new window for each url created | <p>I want to open a new window for each $url created how could I do that?</p>
<pre><code><?php
require_once('sql.php');
$result = mysql_query("SELECT * FROM gamertags ORDER BY id DESC LIMIT 10");
while($row = mysql_fetch_array($result)){
// Prepare gamertag for url
$gamertag = strtolower($row['gamertag']);
$url = "http://halogamertags.com/tags/index.php?player_name=".urlencode($gamertag);
}
?>
</code></pre>
| php jquery | [2, 5] |
5,429,384 | 5,429,385 | remove </tr> from html query | <p>In my jQuery I have a <code>myTable</code> string:</p>
<pre><code>var myTable = "<table width='100%'><tr>";
</code></pre>
<p>After adding some data in <code><td></code>s to <code>myTable</code> like</p>
<pre><code>myTable += <td>...</td><td>...</td>
</code></pre>
<p>then closing the table like:</p>
<pre><code>myTable += "</tr><table>"
</code></pre>
<p>the <code>myTable</code> string is now:</p>
<pre><code>"<table width='100%'><tr><td>...</td><td>...</td></tr><table>"
</code></pre>
<p>Is it possible to remove the last (and only the last) <code>"</tr><table>"</code> from the table. The <code><td></code>s can contain nested <code><table></code>s.</p>
<p>So at the end <code>myTable</code> should be something like <code><table width='100%'><tr><td>...</td><td>...</td>"</code>.</p>
| javascript jquery | [3, 5] |
4,814,375 | 4,814,376 | How to evaluate data return boolean from jQuery $.get | <pre><code>$('#my_theme').click
(
function()
{
$('#my_theme option').each(function(){
//how do I test for this $.get to return true?
if ($.get('<?php echo get_bloginfo('template_directory') ?>/getStyle.php', {template: $(this).val()})==true)
{
$(this).attr("disabled","disabled");
}
});
}
);
<?php
//getStyle.php
$myTemplate = $_REQUEST['template'];
$file = "styles/".$myTemplate."/style.css";
if (file_exists($file))
{
return true;
}
else
{
return false;
}
?>
</code></pre>
| php jquery | [2, 5] |
3,996,132 | 3,996,133 | Http requests for php pages from android | <p>I am trying to request for a php page from my android app. The response text is supposed to be in an EditText view. Well there is no response text. I dont know what am doin wrong but in a normal java class when i system.out.println the reponse, it actually shows. What is it with android?
Here is my code:</p>
<pre><code>package com.httprequests;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URLConnection;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class httprequests extends Activity implements OnClickListener {
/** Called when the activity is first created. */
Button btnRequest;
EditText textRequest;
TextView mytextView;
BufferedReader buffereader;
URLConnection conn;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btnRequest=(Button)findViewById(R.id.btnRequest);
textRequest=(EditText)findViewById(R.id.textRequest);
mytextView=(TextView)findViewById(R.id.mytextView);
btnRequest.setOnClickListener(this);
}
@Override
public void onClick(View src) {
if(src==btnRequest)
{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost("http://localhost/practice/index.php");
HttpResponse response;
try
{
response = httpclient.execute(httpost);
HttpEntity entity = response.getEntity();
InputStream stream = entity.getContent();
BufferedReader br=new BufferedReader(new InputStreamReader(stream));
String str;
while((str=br.readLine())!=null)
{
mytextView.setText(str);
}
}
catch(Exception e)
{
textRequest.setText(e.getMessage());
}
finally
{
try
{
buffereader.close();
}
catch(Exception e)
{
textRequest.setText(e.getMessage());
}
}
}
}
}
</code></pre>
| php android | [2, 4] |
5,747,193 | 5,747,194 | Android to php (url) to sql, db shows nothing. Works in browser | <p>I execute by new CreateNewThread().execute();</p>
<pre><code>class CreateNewThread extends AsyncTask<String, String, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(CreateThread.this);
pDialog.setMessage("Creating Thread..");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
protected String doInBackground(String... args) {
tittel = inputTitle.getText().toString();
tekst = inputText.getText().toString();
if (!tittel.equals("") && !tekst.equals("")) {
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(
"http://.../createthread?title="
+ tittel + "&text=" + tekst);
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();
BufferedReader in = new BufferedReader(new InputStreamReader(
is,"iso-8859-1"));
System.out.println(tittel);
System.out.println(tekst);
System.out.println(in);
String line;
while ((line = in.readLine()) != null) {
JSONObject jo = new JSONObject(line);
System.out.println(jo.getString("svar"));
}
} catch (Exception e) {
System.out.println("catchgreiene" + e);
}
}
else {
System.out.println();
}
return null;
}
protected void onPostExecute(String file_url) {
pDialog.dismiss();
}
}
</code></pre>
<p>I'm trying just to run an url. The php-file runs in browser.. This is 2.2 Froyo.
What am I missing here?</p>
<p>I've tried other methods, but this works for a friend. So it should work.</p>
| java android | [1, 4] |
1,398,642 | 1,398,643 | how to view Listview edit template for user in ASP.NET | <p>I want the user to be able to switch between list view templates, according to button click event</p>
| c# asp.net | [0, 9] |
5,297,370 | 5,297,371 | If element exists in a document | <p>It's possible situation that my function is use out of date jquery element. For example when I use closer and callback:</p>
<pre><code> $("input").each(function () {
var input = $(this);
//here for example we remove input from DOM
//and insert the new one input
$.ajax(url, function(){
fun(input)
}
});
function fun(input){
//do something
input.val('newValue')
}
</code></pre>
<p>QUESTIONS ARE: How can I be sure that reference on variable is still right. And if element has been reacreated how can I get new reference on new input (input doesnt have id and classes)?</p>
<p><strong>UPDATE1:</strong> I made small update. we use old <em>input</em> reference in function <em>fun</em>. And <em>newValue</em> will not apply to new input coz current <em>input</em> is old value.</p>
| javascript jquery | [3, 5] |
2,726,437 | 2,726,438 | Get iframe url variable from inside the iframe | <p>I want to use jquery/javascript if possible and grab a url variable frim inside the iframe</p>
<p>my iframe link looks like the below - the source changes dynamically</p>
<pre><code><iframe class="box" src="lightbox.html?img=images/lightbox/blue-shoes.jpg" scrolling="no" frameborder="0"></iframe>
</code></pre>
<p>Then, from inside the lightbox.html iframe - I want to grab the img (images/lightbox/blue-shoes.jpg) variable and change the source of an image</p>
<p>problem is - I cant figure out how to grab the iframe source url variable from inside the iframe</p>
<p>I am trying to avoid using php</p>
<p>I have used this for something similiar but cant get it to work</p>
<pre><code>function getUrlVars() {
var vars = {};
var parts = document.referrer.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}
var first = getUrlVars()["ref"];
</code></pre>
| javascript jquery | [3, 5] |
5,666,122 | 5,666,123 | Javascript : Alert box only once when the user lands | <p>Is there a way to display an alert box literally only once, i.e. when the user hits the website, then when they navigate through it does not appear any more?</p>
| javascript jquery | [3, 5] |
2,162,105 | 2,162,106 | How to can i drag and drop cross tags in browser using javasript or jQuery? | <p>It look like Google search by images
Not only images but also selected text,...
Give me some simple example
thanks!</p>
| javascript jquery | [3, 5] |
5,340,001 | 5,340,002 | How to reference dynamically created controls? | <p>Is there a way to reference dynamically created controls, such as a couple TextBoxes and maybe a RadioButtonList when the user either click a button or changes the selected radio button.</p>
<p>I need to insert a record into a database but I need all of the values. I cannot hard-code the controls because they must be created on the fly.</p>
<pre><code>TextBox t1 = new TextBox();
PlaceHolder1.Controls.Add(t1);
TextBox t2 = new TextBox();
PlaceHolder1.Controls.Add(t2);
RadioButtonList rbList = new RadioButtonList();
rbList.Items.Add(new ListItem("Today", "1"));
rbList.Items.Add(new ListItem("This Week", "2"));
rbList.SelectedIndexChanged += new EventHandler(rbList_SelectedIndexChanged);
PlaceHolder1.Controls.Add(rbList);
</code></pre>
<p>I need to reference the two textboxes and the RadioButtonList within rbList_SelectedIndexChanged or some other event. Adding EventHandlers to the textboxes do my no good because I need all three values to insert into the database. </p>
<p>My inital thought was to somehow pass reference of the texboxes to the rbList_SelectedIndexChanged event but I am unsure of how to do this and even more unsure if it will even work.</p>
<p>Any help would be appreciated.</p>
| c# asp.net | [0, 9] |
2,087,894 | 2,087,895 | ANDROID: If...Else as Switch on String | <p>I'm writing an Android app for work that shows the status of our phone lines, but thats neither here nor there.</p>
<p>I make a call to one of our servers and get returned JSON text of the status. I then parse this putting each line into a SortedMap (TreeMap) with the Key being the name of the line and my own class as the value (which holds status and other details).</p>
<p>This all works fine.</p>
<p>When the app runs it should then show each line and the info I have retrieved, but nothing gets updated.</p>
<p>The JSON is returned and added to the Map correctly.</p>
<p>This is a snapshot of the code that isn't working. I simply iterate through the map and depending on the value of key update the relevant TextView. The problem I am having is that when it gets to the IF statement that matches it never runs that code. It skips it as if values don't match.</p>
<p>I can't see any errors. Is this the only way to do this as I know you can't use Switch..Case etc?</p>
<p>Can anyone see my error? I've been coding on Android for 1 week now so its probably a newbie error!!</p>
<p>Thanks
Neil</p>
<pre><code>Iterator iterator = mapLines.entrySet().iterator();
while(iterator.hasNext())
{
// key=value separator this by Map.Entry to get key and value
Map.Entry<String, Status> mapEntry = (Map.Entry<String, Status>)iterator.next();
// getKey is used to get key of Map
String key = (String)mapEntry.getKey();
// getValue is used to get value of key in Map
Status value = (Status)mapEntry.getValue();
if(key == "Ski")
{
TextView tvStatus = (TextView)findViewById(R.id.SkiStatus);
tvStatus.setText(value.Status);
}
else if(key == "Cruise")
{
TextView tvStatus = (TextView)findViewById(R.id.CruiseStatus);
tvStatus.setText(value.Status);
}
else if(key == "Villas")
{
TextView tvStatus = (TextView)findViewById(R.id.VillasStatus);
tvStatus.setText(value.Status);
}
}
</code></pre>
| java android | [1, 4] |
2,809,483 | 2,809,484 | Display JS Calculation Sum In An Input Field | <p>I want to display the sum of this calculation in an input field:</p>
<pre><code>function calculateSum1() {
var sum = 0;
//iterate through each textboxes and add the values
$("input.miles").each(function() {
//add only if the value is number
if(!isNaN(this.value) && this.value.length!=0) {
sum += parseFloat(this.value);
}
});
$("input.summiles").value(sum);
}
</code></pre>
<p>input field:</p>
<pre><code><input class="summiles" type="text" value="">
</code></pre>
<p>It works fine if I display it in a span, but I can't seem to get it to display in an input field. Any ideas? Thanks!</p>
| javascript jquery | [3, 5] |
3,291,887 | 3,291,888 | can a web page be manipulated through ajax from new window? | <p>Hi... I want to know that when a user posts a comment to my site ... to open a web page (in new window, with a fixed width and height like <code>window.open</code> ) which contains the form and after submit, I want to close that windows and show that comment in the parent page through ajax ... (or i guess after closing that window, to auto reload the parent page ... I don't know ) ... </p>
<p>Is there any solution to this .. ?
Or what is the best way to open a pop-up which contains the form (not a new window) ? </p>
<p>Thank you very much.</p>
| php jquery | [2, 5] |
4,181,305 | 4,181,306 | Keep user-only logs displayed in a PHP chatbox | <p>Well, the quetion isn't only "how" to keep them displayed but also how to "store" them. Notice, that I'm a semi-newbie in PHP development when it comes for a live chat application.</p>
<p><strong>Application Overview</strong></p>
<p>I'd like to creat a web-based chat room with jquery & php. Everything is fine, since there're hundreds of tutorials out there concerning this specific development issue. I've made everything, and it seems to be working fine till now. I'm storing the texts in the database, and this is a "final decision" for now, so please, keep in mind everything is in a db and not in a file. </p>
<p><strong>The Problem</strong></p>
<p>Well, yeah, chats are displayed well. But I want to have some user interaction. For example, a user could call a specific function (command) and have some results displayed. But those results are some kind of private data. So, I'm stuck on this. I don't really want to store every single log in the db, since this is the worst way and space-consuming I suppose. I want each user to have their own consol (like) place for a certain time let's say. I thought about using cache or something, but I'm really noob at this.</p>
<p>So, I came to the experts... Could you suggest something?
In case you need any further explanation, please ask for it.</p>
<p>Thanks in advance for the answer. :)</p>
| php jquery | [2, 5] |
780,190 | 780,191 | onclick div colour should change | <p>Am having several boxes(more than 100) that will create dynamically with</p>
<pre><code><div id="window5"></div>
<div id="window18"></div>
<div id="window190"></div>
</code></pre>
<p>Now If i click on one box the colour should be red,then if i click on the other box the colour should be changed to red(the first box colour should come to normal).I used some code like this,but it is not taking the css class.</p>
<p>How can i get the dynmic id of this case.</p>
<p>css file:</p>
<p>.selected{
color: red;
}</p>
<p>used javasscript code as;</p>
<pre><code> <script type="text/javascript">
$(document).ready(function () {
$("div[id *= 'window']").click(function (e) {
$(".selected").removeClass("selected");
$(this).addClass("selected");
e.stopPropagation();
});
$(document).click(function () {
$(".selected").removeClass("selected");
});
});
</script>
</code></pre>
| c# javascript asp.net | [0, 3, 9] |
397,022 | 397,023 | jQuery random image fader | <p>I have a header area which is divided up into block areas for images, these images are absolutely positioned within the block and are all different heights and widths.</p>
<p>I have a URL /random-image?width=x&height=y&random=34234 which generates a random image to use for the specific place.</p>
<p>I want these images to randomly fade out and change for another random image, or to fade on click. I have got it working, except the "setTimeout" or "setInterval" only triggers once. I need it to be on an infinite loop.</p>
<p>Here is my code, any ideas:</p>
<pre><code>jQuery(document).ready(function ($) {
$('#main-image img').live('click', function() {
var $image = $(this),
width = $image.width(),
height = $image.height(),
random = Math.random();
$('<img src="/random-image?width='+width+'&height='+height+'&random='+random+'" />').hide().load(function() {
$(this)
.appendTo($image.parentsUntil('div.columns'))
.fadeIn('slow', function() {
$image.remove();
});
});
});
$('#main-image img').each(function() {
var $image = $(this),
randVal = Math.round(5000 + Math.random()*(30000 - 5000)) ;
setTimeout(function() {
console.log($image.attr('src'));
$image.trigger('click');
},randVal);
});
});
</code></pre>
| javascript jquery | [3, 5] |
2,313,853 | 2,313,854 | How to upload files to ftp using asp.net and C#? | <p>I tried to upload image through ftp using asp.net & c# but it doesn't work.
Please guide me to solve the issue asap.</p>
<pre><code>try
{
//host name
//string ftphost = "fubar.walnut.com";
string ftphost = "fubar.walnut.com";
//file path
string ftpfilepath = "/ProductImages/" + FileUpload1.FileName;
string ftpfullpath = "ftp://" + ftphost + ftpfilepath;
//create ftp request
FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(ftpfullpath);
//userid and password for the ftp server
ftp.Credentials = new NetworkCredential("username", "password");
ftp.KeepAlive = true;
ftp.UseBinary = true;
ftp.UsePassive = true;
//select method as upload file (STOR command)
ftp.Method = WebRequestMethods.Ftp.UploadFile;
FileStream stream = File.OpenRead(Server.MapPath("~/" + FileUpload1.FileName));
byte[] buffer1 = new byte[stream.Length];
stream.Read(buffer1, 0, buffer1.Length);
stream.Close();
//get request stream
Stream ftpstream = ftp.GetRequestStream();
ftpstream.Write(buffer1, 0, buffer1.Length);
ftpstream.Close();
ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "alert('Image uploaded successfully.'); window.location.href = 'UploadZipXML.aspx?ProductIsOpen=true';", true);
return;
}
catch (Exception ex)
{
string excp = ex.Message;
ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "alert('Image not uploaded successfully." + excp + "')", true);
return;
}
</code></pre>
| c# asp.net | [0, 9] |
4,334,077 | 4,334,078 | how do I strip white space when grabbing text with jQuery? | <p>I'm wanting to use jQuery to wrap a mailto: anchor around an email address, but it's also grabbing the whitepace that the CMS is generating.</p>
<p>Here's the HTML I have to work with, the script as I have it and a copy of the output.</p>
<p>html</p>
<pre><code><div class="field field-type-text field-field-email">
<div class="field-item">
[email protected] </div>
</div>
</code></pre>
<p>jQuery JavaScript</p>
<pre><code>$(document).ready(function(){
$('div.field-field-email .field-item').each(function(){
var emailAdd = $(this).text();
$(this).wrapInner('<a href="mailto:' + emailAdd + '"></a>');
});
});
</code></pre>
<p>Generated HTML</p>
<pre><code><div class="field field-type-text field-field-email">
<div class="field-items"><a href="mailto:%0A%20%20%20%[email protected]%20%20%20%20">
[email protected] </a></div>
</div>
</code></pre>
<p>Though I suspect that others reading this question might want to just strip the leading and tailing whitespace, I'm quite happy to lose all the whitespace considering it's an email address I'm wrapping.</p>
<p>Cheers,<br />
Steve</p>
| javascript jquery | [3, 5] |
1,428,480 | 1,428,481 | multirow(array) form validation preventing user to leave textbox if user enters wrong value | <p>Is it possible in php (multirow(array) form) to prevent user from leaving textbox when user enters wrong value?</p>
| php jquery | [2, 5] |
4,821,328 | 4,821,329 | Multiply input value on keyup and add them | <p>I have some input generated like that</p>
<pre><code>while($donnees = mysql_fetch_array($reqmodel)){
?>
<form action="#" name="order" method="post">
<div style='float:left;width:100%'>
<input type='text' name='order_item_sku[]' value='<?php echo $donnees['product_sku'] ;?>'>
<input type='text' name='product_quantity[]' value='0' id="qty[]">
<input type='text' name='product_name[]' value='<?php echo $donnees['product_name'] ;?>'>
<input type='text' name='product_id[]' value='<?php echo $donnees['virtuemart_product_id'] ;?>' style='width: 15px;'>
<input type='text' name='product_price[]' value='<?php echo $price = number_format($donnees['product_price']*1.196,0) ;?>' style='width: 25px;' id="prix[]">
</code></pre>
<p>Then i don't know how many input i'll get. How can i have the <code>total price</code> by multiply <code>product_quantity * product_price</code> for each row ?</p>
| php jquery | [2, 5] |
4,826,973 | 4,826,974 | Send message from a hotspot to a connected client | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/10777678/send-message-from-a-basic-server-to-a-specific-client">Send message from a basic server to a specific client</a> </p>
</blockquote>
<p>Here is a scenario. I have enabled a hotspot through wifi tethering on my android phone. I also have two wifi modules which connects to this hotspot. Now, I want to send a message to only 'one client' (not all) connected to my hotspot. Is that even possible in Java if I dont want to use a Server-Client Application. As the hotspot itself acts as a server.</p>
<p>Thanks for any assistance.</p>
| java android | [1, 4] |
129,849 | 129,850 | submitting form with two buttons | <p>I have 2 buttons in HTML form. And both of them should submit the form. I would need to capture which button has been clicked so i can use it to perform different actions based on which button was clicked.</p>
<p>I am able to submit the form with both the buttons but how would i capture which button was clicked in the php file .</p>
<pre><code><INPUT type="button" name="submit" class="button" class="element_2" value="firstbutton">
<INPUT type="button" name="submit1" class="button" class="element_2" value="second button.. ">
</code></pre>
<p>i am using post method in Jquery to submit the form. How can i check which HTML button was clicked in server side php script</p>
| php jquery | [2, 5] |
1,924,621 | 1,924,622 | Customizing Spinner Android? | <p>I have spinner and code <code>android.R.layout.simple_spinner_dropdown_item</code>.
But I get weird height like this:</p>
<p><img src="http://i.stack.imgur.com/VhjzK.png" alt="enter image description here"></p>
<p>I want to have <code>dropdown_items</code> like they are by default but also I don't want to have weird height on the main screen.</p>
| java android | [1, 4] |
3,658,713 | 3,658,714 | call a function in jquery namespace from outside the jquery namespace | <p>here is the code</p>
<pre><code>test ('e');
function test(e) {
test2(e); //undefined
}
(function ($) {
function test2(e) {
alert('test');
}
})
</code></pre>
<p>Because of something restriction, i have to call like this. Anyone knows?</p>
| javascript jquery | [3, 5] |
2,009,801 | 2,009,802 | javascript windows "Yes/No" asking twice? | <p>I am using below code for javascript window "Yes/No". It is firing twice. Is there any way I can avoid this? Or use any other code?. I need this code behind.</p>
<pre><code>Response.Write("<script language='javascript'> { self.close() }</script>");
</code></pre>
| asp.net javascript | [9, 3] |
661,467 | 661,468 | Android face detection | <p>Can someone tell me if there is <code>Face detection</code> API for android? If so can someone share the link and any sample code that would help ?</p>
<p>Edit: I need to detect in real time (from the camera - like from a video)</p>
| java android | [1, 4] |
4,814,011 | 4,814,012 | Dynamically create and repeat the set of fields | <p>I have a PHP form which shows one 'User details' block by default. 'User details' section has first name, last name and address etc. I have a requirement to repeat the same block after clicking on the button so the user can enter 'n' number of users into on the form. Also I need to save all the information in MySQL database. What is the best way to achieve this? Please let me know. I appreciate any help.</p>
<p>Thank you.</p>
| php javascript | [2, 3] |
109,116 | 109,117 | Slide up from bottom with jQuery? | <p>I have a dropdown menu which animates the dropdown by increasing height, however it goes from the top to the bottom. Is it possible to go from the bottom to the top?</p>
<p>Here's my code:</p>
<pre><code>animate({height:'show',opacity:'show'}, ddsmoothmenu.transition.overtime)
</code></pre>
<p>Thanks.</p>
| javascript jquery | [3, 5] |
4,558,797 | 4,558,798 | Redirect and count down, jquery onclick | <p>Here is our current code:</p>
<pre><code>$('#click').click(function(e){
var country = $("#country").val();
$this = $("#conv");
$this.css({"text-align":"center","font-size":"18px"});
$this.html("<div style='margin-top: -4px;'>We're sorry but this website is not available in your country <strong>(" + country + ")</strong><br /><br /><a href='http://www.site.com/'>Please click here to visit our partner website!</a></div>")
});
</code></pre>
<p>Basically, we want the HTML to say:</p>
<blockquote>
<p>Please click here to visit our partner website or you'll be
automatically redirected in 5 seconds!</p>
</blockquote>
<p>We want the 5 seconds to count down, so it'll go 5, 4, 3, 2, 1 and then redirect to the website.</p>
<p>How can I do a counter and redirect the user? I'm guessing <code>setTimeout()</code> along side a count variable and <code>$count--</code> with a window location href?</p>
<p>Thank you</p>
| javascript jquery | [3, 5] |
1,312,358 | 1,312,359 | Which pattern jQuery $.fn.extend or $.extend use | <p>I was just reading <a href="http://stackoverflow.com/questions/3790909/javascript-module-pattern-vs-constructor-prototype-pattern">Javascript: Module Pattern vs Constructor/Prototype pattern?</a> and I was curious to know that when we extend our class with $.fn.extend or $.extend which pattern is used, Module Pattern or Constructor/Prototype pattern?</p>
| javascript jquery | [3, 5] |
5,249,517 | 5,249,518 | javascript to hide div if homepage | <p>I want to hide a #div if it's on homepage. Anyone can help with the javascript or php?</p>
<p>I found something like this but its certainly not working. Bear with me as im really clueless on codes.</p>
<pre><code><?php if (!is_page('home') ) { echo <div id="toolbar">;} ?>
</code></pre>
| php javascript | [2, 3] |
853,748 | 853,749 | edittext validation | <p>I have following small block of code to set validation on edit text when a button is pressed and display the validation message in a dialog.</p>
<p><strong>Java Code</strong> </p>
<pre><code>setContentView(R.layout.addnewcontacts);
Button buttonSave = (Button) findViewById(R.id.buttonSave);
final EditText editTextName = (EditText) findViewById(R.id.editTextName);
buttonSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
if (editTextName.getText().toString().length() == 0) {
editTextName.setError( "First name is required!" );
}
}
});
}
</code></pre>
<p>Code is working fine but the popup is not displaying text in it.</p>
<p><strong>Screen shot :</strong></p>
<p><img src="http://i.stack.imgur.com/rRguF.png" alt="enter image description here"></p>
<p>Why popup is not showing text?</p>
| java android | [1, 4] |
386,976 | 386,977 | Wrap all non-child HTML into a DOM-element | <p>I am working on a little hyphenation engine for a website, and I got to get my head around this. I am matching all <code>p.hyphenatable</code> and send the content to a PHP-script to have it hyphenated like this:</p>
<pre><code>jQuery(".hyphenatable").each(function() {
var hyphenatableObject = jQuery(this);
if (hyphenatableObject.children().size() == 0){ // Hyphenate only if there is no child elements to prevent HTML from being omitted
jQuery.ajax({
type: "POST",
url: phpHyphenatorUrl,
data : {
language:hyphenationLang,
text: hyphenatableObject.text()
},
dataType: "html",
success: function(data) {
hyphenatableObject.html(data);
}
});
}
});
</code></pre>
<p>To be able to have this script work on elements with children as well, I would like to wrap the non-encapsulated parts of the matched selectore into new elements, and send those to the web service. For example:</p>
<pre><code><p>My text <img src="img.jpg" /> with image</p>
</code></pre>
<p>becomes</p>
<pre><code><p><span class="whatever">My text</span> <img src="img.jpg" /> <span class="whatever">with image</span></p>
</code></pre>
<p>Any ideas on that?</p>
| javascript jquery | [3, 5] |
3,397,127 | 3,397,128 | Upload half file? | <p>Is it possible to upload a specific part of the file rather than the whole file? Say, I want to upload only first 100 bytes of the file, or the rest of the file given offset 100 bytes?</p>
| php javascript | [2, 3] |
3,602,506 | 3,602,507 | update query slider position based on value from textbox | <p>how can i update slider's position if slider's value differs from value from a textbox ?</p>
<pre><code>$("#slider").slider({
max: 30000,
min: 1000,
step: 1000,
range: true,
animate: true,
values: [1000, 15000],
slide: function(even, ui)
{
$("#edit-field-price-value-min").val(ui.values[0]);
$("#edit-field-price-value-max").val(ui.values[1]);
}
});
</code></pre>
<p>as you can see i am changing with the slider the values on some textbox but i want it vice versa also</p>
<p>i'd like to be using a if statement so that at any moment if the values from text box would change the slider would as well</p>
<p>is it possible to do it onload maybe ?</p>
<pre><code><div id="slider"></div>
</code></pre>
| php javascript jquery | [2, 3, 5] |
675,769 | 675,770 | how to make running activity disable while progress bar running in java android | <p>i have an activity or screen which contains mainly 3 views (ex.textview1,textview2,textview3) and a progress bar.</p>
<p>While progress bar running or loading if i click on either of textview1,textview2,textview3,
corresponding next activity or screen is opening.</p>
<p>But i want like while progress bar running relevant screen should disable(not tappable) or should not move to next screen if i click on any of these views. </p>
<p>please reply with an example</p>
| java android | [1, 4] |
5,320,146 | 5,320,147 | Firing event when TextBox is blank | <p>I need to fire an event when a TextBox in ASP.NET has been defocused - I currently handle the TextChanged event for this, but this obviously doesn't fire if they don't type into the box and then defocus. Can I do this?</p>
<p>EDIT: To clarify, I want to fire a server side event - not client side</p>
| c# asp.net | [0, 9] |
4,360,175 | 4,360,176 | How to get excel functions kind of functionality in text fields? | <p>I have a page which looks like below. Where some of the data are from database and there will be form fields also beside database data. All are dynamic so we need to validation for every field also. </p>
<p>Please check this <a href="http://jsbin.com/efinak/22/edit" rel="nofollow">http://jsbin.com/efinak/22/edit</a></p>
<pre><code>Total Spent Cost: ((t1*100+t2*200)*x%+(t3*110)*y%)spent for A + spent for B
Client : A
product No of Hours Avg Rate/Hour Cost
A1 t1 100 t1*100
A2 t2 200 t2*200
Total Cost: t1*100+t2*200
Percentage(%): x
Spent Cost: (t1*100+t2*200)*x%
Client : B
product No of Hours Avg Rate/Hour Cost
B1 t3 110 t3*100
Total Cost: t3*110
Percentage(%): y
Spent Cost: (t3*110)*y%
</code></pre>
<p>In the above example client, product and No of hours will come from database. I kept a text field for Avg Rate/Hour and a text field for Cost also. </p>
<p>Why i mentioned in the question excel kind of funcitonality is i will explain here.
If suppose i set Avg Rate/Hour text field then automatically cost should be calcualted without any redirecting. In the same way if you set cost Avg Rate/ hour should be calculated automatically. </p>
<p>Once costs are calculated Total cost should be calculated automatically.Like above percentage is also having a text field which will also set by user with some value. Based on that you need to calucalte spent cost.</p>
<p>I need to this thing for every cleint. Once after every cleint's spent cost calculated automatically total spent cost also should be calcualted on the fly.</p>
<p>I need ideas and if possible more help.</p>
| php javascript jquery | [2, 3, 5] |
3,403,816 | 3,403,817 | Compulsory option of jQuery plugin | <p>I am making my custom jQuery plugin whose code is this:</p>
<pre><code>(function($) {
$.fn.foo = function(options) {
var opt = $.extend({}, $.fn.foo.defaults, options);
return this.each(function() {
//do operation with opt
});
});
$.foo.defaults = {
item1:'value1',
item2:'value2',
item3:'value3',
};
})(jQuery);
</code></pre>
<p>It will be implemented like this:</p>
<pre><code> //Implementation
$(...).foo({
item1:'value1',
item2:'value2',
item3:'value3',
item4:'value4',
});
</code></pre>
<p>My question is that how can I make <em>item4</em> value to be compulsory? I want that user must enter value for <em>Item4</em> . In my plugin I need to do some operations with item4 so how can it be made compulsory. I will be having one or more items too which should be compulsory. Is there any way by which I can warn user if the that value is not passed by the user ? </p>
| c# php asp.net jquery | [0, 2, 9, 5] |
2,072,844 | 2,072,845 | Hot to map html input properties to object with jQuery? | <p>I want to read all page inputs ids and values
into object and pass it to function which loop throuhg them and extract id and value.</p>
<p>I started with:</p>
<pre><code>function send()
{
var data = [];
var inputs = $(":text");
for (var i = 0, l = inputs.length; i < l; i++) {
var input;
input.id = inputs[i].attr("id");
input.text = inputs[i].val();
data[i] = input;
}
receive(data);
}
function receive(data)
{
for (var input in data) {
alert(input.id);
alert(input.text);
}
}
</code></pre>
<p>Why this does not work?</p>
| javascript jquery | [3, 5] |
3,548,235 | 3,548,236 | How can I performance tunning on that javascript code? (JQuery selector based) | <p>How can I performance tuning in that code</p>
<pre><code>var isHighLighted = this.HighlightCell(this.GetOutcomeInList(i), i, "selectedByEditor "+((isCommonChoice) ? "Common" : "") );
if (!isHighLighted) {
isHighLighted = this.HighlightCell(this.GetOutcomeInOtherBetsButton(i), i, "selectedByEditor "+((isCommonChoice) ? "Common" : "") );
}
this.HighlightCell(this.GetOutcomeInOthers(i), i, "selectedByEditor "+((isCommonChoice) ? "Common" : "") );
var spacialcell = this.GetOutcomeInSpecial(i);
this.HighlightCell(spacialcell, i, "selectedByEditor "+((isCommonChoice) ? "Common" : "") );
if (spacialcell.length > 0) {
//Özel etkinliklerde kapalı alanları açar
var eventDetails = $(spacialcell).parent().parent().parent();
var eventHeaders = $(spacialcell).parent().parent().parent().prev().find('.Expand');
if (eventDetails.attr('status') != 'expand') {
eventDetails.show(); $(eventHeaders).not('.Collapse').addClass('Collapse');
BetFilter.ChangeExpandButtonStatus(this, false);
}
}
</code></pre>
<p>That function loop for each editor data in more than 1000 html cell elements. Editor data probably contains between 10 - 100 data. GetOutcomeInList, GetOutcomeInOtherBetsButton functions are jquery selectors returning spesific cells.</p>
| javascript jquery | [3, 5] |
4,998,784 | 4,998,785 | Why didn't header files catch on in other programming languages? | <p>Based on the response to this question: <a href="http://stackoverflow.com/questions/333889/in-c-why-have-header-files-and-cpp-files">Why does C++ have header files and CPP</a></p>
<p>I have seen the responses and understand the answers - so why didn't this catch on? C# Java?</p>
| c# java c++ | [0, 1, 6] |
1,983,653 | 1,983,654 | Using enum in c++ and c# via c++ header | <p>I've got a server written in C++ that sits at the end of a named pipe, um, serving things. The commands which can be sent to the server are defined in an enum which is located in a header file.</p>
<pre><code>enum {
e_doThing1,
e_doThing2
...
e_doLastThing
};
</code></pre>
<p>The value of the desired enum is put into the first byte of messages sent to the server so it knows what to do. I am now writing a C# client which needs access to the services. </p>
<p>Is there any way I can include the header into the C# code so I don't have to maintain the same list in two locations?</p>
<p>Thanks,
Patrick</p>
| c# c++ | [0, 6] |
2,781,796 | 2,781,797 | php javascript callback function | <pre><code>O3Global.Ajax.loadXML('Lackeys', 'hire', aPost, function (oResponse) {
hireCallback(oResponse, iCurLackey, iCredits);
}, Lackeys.cancel);
</code></pre>
<p>Is the oResponse calling back 2 times? how to handle this call back?</p>
<pre><code>this.doHire = function() {
if (!aLackeys[iCurLackey]) return;
// Fetch credits
var oCredits = $("#lackey_hire_credits");
var iCredits = oCredits.val() * 1;
if (iCredits <= 0) {
alert('You must enter a valid number of credits');
oCredits.focus();
}
else if (iCredits > iAvailableCredits) {
alert('You do not have enough credits. You only have' + iAvailableCredits + '.');
oCredits.val(iAvailableCredits);
oCredits.focus();
}
else {
// Send the Ozone event
var aPost = new Array();
aPost['type'] = iCurLackey;
aPost['credits'] = iCredits;
O3Global.Ajax.loadXML('Lackeys', 'hire', aPost, function(oResponse) {
hireCallback(oResponse, iCurLackey, iCredits);
}, Lackeys.cancel);
}
}
function hireCallback(oResponse, iLackey, iCredits) {
// Fetch data
var sCity = oResponse.getElementsByTagName('city')[0].firstChild.data;
// Process
aLackeys[iLackey].hired(iCredits, sCity);
Lackeys.modCredits(-iCredits);
// Close the box
Lackeys.cancel();
}
</code></pre>
| php javascript jquery | [2, 3, 5] |
3,638,109 | 3,638,110 | Javascript/jQuery undefined | <p>The reason that the title is named "jQuery / Javascript undefined" isn't because that I assume jQuery is a language, I do know that jQuery is a library of javascript language, just in case if some pedantic readers read this. The reason why I wrote that as the title is because I don't know what is wrong with the code, the jQuery or the Javascript (all jQuery's code compiled) is wrong.</p>
<p>Okay, back to the question, take a look at the following code, they give me an undefined value</p>
<pre><code>//username validation
function username_val(){
username_value = $("input[name='username']").val();
span_error = "span[name='username_error']";
$(span_error).load('ajax_signup_username', {php_username_error:username_value}, function(){
return true;
});
}
</code></pre>
<p>I alerted this, and then an "undefined" is returned. I assumed that a true would be returned instead.</p>
<pre><code>function final_val(){
alert( username_val() );
}
</code></pre>
<p><strong>EDIT:</strong> Some of you guys said that I can only return true on the success param, but I need this for validation, so if all of the validation methods are true, in the final_val will return true. The point is that I needed a true value in the final_val() or if you guys have other method to validate it, please tell me. Note: I'm in a hurry, so if I misunderstand your answer, please forgive me. I'll be gone for a few hours, until then I'll check your answers.</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
5,844,209 | 5,844,210 | What is PHP's pendant to pythons encode('hex')? | <p>In python you can encode a string as</p>
<pre><code>encoded = text.encode('hex')
text = encoded.decode('hex')
</code></pre>
<p>What are the corresponding functions in php?</p>
| php python | [2, 7] |
5,391,292 | 5,391,293 | Haschildnodes() does not work | <p>I have a tree view and a delete button on the webpage. The tree view loads with parent nodes and child nodes. If I click on delete after selecting a parent node with child nodes, it should give me a message provided below accordingly with a confirmation box.</p>
<p>Right now, when I select a parent node without any child nodes it gives me the following message: ""The element has at least one child.".
When it should be giving me this message: "The element has no children."</p>
<p>Code:</p>
<pre><code>function check() {
var treeViewData = window["<%=nav_tree_items.ClientID%>" + "_Data"];
var selectedNode = document.getElementById(treeViewData.selectedNodeID.value);
var hasChilds = selectedNode.hasChildNodes();
if (hasChilds) {
alert("The element has at least one child.");
} else {
alert("The element has no children.");
}
</code></pre>
<p>Please help.
Thank you and sorry if I may have caused confusion in my explanation </p>
| javascript asp.net | [3, 9] |
1,509,605 | 1,509,606 | jQuery access parent object attribute? | <p>So I have this code:</p>
<pre><code>function theObject(){
this.someelement = $("#someelement");
this.someotherelement = $("someotherelement");
this.someelement.fadeOut(500, function(){
this.someotherelement.attr("title", "something");
this.someelement.fadeIn(500);
});
}
</code></pre>
<p>for some reason <code>this.someotherelement</code> is undefined. I'm guessing because it's wrapped in a <code>function(){}</code>?</p>
| javascript jquery | [3, 5] |
1,554,941 | 1,554,942 | Why jQuery doing unwanted multiple actions of single command? | <p>When i resize browser the it gives multiple alerts. I used "return false" not working. </p>
<p>If I used unbind()/unbind('resize') then it works but it creates an other problem- the resize() function stops working from second time browser/window resize.</p>
<p>My code-</p>
<pre><code><script src="jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(e) {
alert($(".myclass").parent().width());
$(window).bind('resize',function() {
alert($(".myclass").parent().width());
});
});
</script>
<section class="myclass"></section>
</code></pre>
| javascript jquery | [3, 5] |
5,797,341 | 5,797,342 | Get Current Date time of the server on which my website is hosted | <p>Am working on a functionality that involves a few timing based tasks.I need to retrieve current EST time to continue with my functionality.I do not need the system time since it may be different for each users.Is it possible using javascript or c# to get Eastern Standard Time from another time server or get time from my hosted server so that i can convert it to Eastern Standard Time .</p>
<p>am currently using this line of code to get eastern standard time but this is not i wanted since it is based on system time.</p>
<pre><code> DateTime eastern = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, "Eastern Standard Time");
</code></pre>
| c# javascript asp.net | [0, 3, 9] |
1,111,155 | 1,111,156 | Doesn't jQuery('#id') do the same thing as document.getElementById('#id') in javascript? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4069982/document-getelementbyid-vs-jquery">document.getElementById vs jQuery</a> </p>
</blockquote>
<p>I have a function that will take all the spans with a certain class ("jobStatus") and remove an additional class from it ("orange"). I call the function from a SELECT onchange (onchange="chgJobstatus(this);"). It's working great.</p>
<p>However, I'm trying to get it to run on page load, based upon the selected value (this is server-side dynamically generated.)</p>
<p>This will work:</p>
<pre><code> $(document).ready(function(){
chgJobstatus(document.getElementById("chgStatus"));
});
</code></pre>
<p>This will NOT work:</p>
<pre><code> $(document).ready(function(){
chgJobstatus(jQuery('#chgStatus'));
});
</code></pre>
<p>Doesn't jQuery('#id') do the same thing as document.getElementById('#id') ??</p>
| javascript jquery | [3, 5] |
822,215 | 822,216 | Android Application Class Globals instance or static | <p>I am using the android.app.Application class (a subclass) to store some "global" information. An example is the user location the last time we grabbed it from the GPS/wifi. My question is whether I should be storing these "globals" as static variables or instance variables. Not sure which scenario is better or more correct.</p>
<p>Scenario A: using static variables --</p>
<pre><code>public class MyApplication extends android.app.Application {
private static Location myLocation;
public static Location getLocation() {
return myLocation;
}
public static void setLocation(Location loc) {
myLocation = loc;
}
}
</code></pre>
<p>Scenario A: usage --</p>
<pre><code>loc = MyApplication.getLocation();
MyApplication.setLocation(loc);
</code></pre>
<p>Scenario B: using instance variables --</p>
<pre><code>public class MyApplication extends Application {
private Location myLocation;
public Location getLocation() {
return this.myLocation;
}
public void setLocation(Location loc) {
this.myLocation = loc;
}
}
</code></pre>
<p>Scenario B: usage --</p>
<pre><code>loc = getApplication().getLocation();
getApplication().setLocation(loc);
</code></pre>
<p>Thank you.</p>
| java android | [1, 4] |
3,053,106 | 3,053,107 | how to insert php on jquery/javascript | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/9451212/how-to-insert-php-into-jquery">How to insert PHP into jQuery?</a> </p>
</blockquote>
<p>how to insert php on jquery/javascript ? for example </p>
<p>php </p>
<pre><code>$tot =4;
</code></pre>
<p>javascript</p>
<pre><code>$(function()
if( can put php here? )
eg : if( <?php tot > 4 ?> )
</code></pre>
<p>i want to put the php in 'if statement' ,it`s possible?</p>
| php jquery | [2, 5] |
4,634,353 | 4,634,354 | Swap image and show image zoom | <p>I have a website using BigCommerce that has a feature on the product page that displays some thumbnail images. When a user clicks on a thumbnail image, it shows some description for that image and should also swap the main image on the left to the large version of the selected thumbnail.</p>
<p>The script is doing the show/hide part correctly for the description but isn't swapping the main image. I was wondering if anyone might be able to help resolve this? Contacted BigCommerce but they say it's a template specific issue that they can't help with.</p>
<p>On checking web inspector, it says that there is an uncaught type error and that the 'largeimage' attribute for the rel tag is missing. I tried adding this back in, but it didn't have any effect.</p>
<p>Thank you.</p>
| javascript jquery | [3, 5] |
752,494 | 752,495 | What are the benefits and/or pitfalls of calling a function directly from an anchor tag vs creating events onload? | <p>Is there a proper/standard way?</p>
<pre><code><a href="#" onclick="function();">Link</a>
</code></pre>
<p>vs</p>
<pre><code><script>
$(document).ready(function(){
$('#link1').click(function(){ ... });
});
</script>
<a href="#" id="link1">Link</a>
</code></pre>
| javascript jquery | [3, 5] |
1,000,315 | 1,000,316 | Validation of viewstate MAC failed -View State Error | <p>In my website, when a web page is idle for more than 5 minutes, then that page is not working until I refresh. The following error occurs:</p>
<blockquote>
<p>Error:
Sys.WebForms.PageRequestManagerServerErrorException:
Validation of viewstate MAC failed. If
this application is hosted by a Web
Farm or cluster, ensure that
configuration specifies
the same validationKey and validation
algorithm. AutoGenerate cannot be used
in a cluster.</p>
</blockquote>
<p>I'm already using <code>EnableEventValidation="false" ViewStateEncryptionMode="Never" ValidateRequest="false"</code></p>
<p>But, nothing is working for me.</p>
| c# asp.net | [0, 9] |
4,578,150 | 4,578,151 | Drop down list issue | <p><strong>Html</strong></p>
<pre><code> <a id="btn" class="btn" href="#."></a>
<div id="main-dropdown" class="hide">
<ul id="dropdown">
<li><a href="/">Back </a></li>
<li><a href="/foo">Foo </a></li>
<li><a href="/bar">Bar </a></li>
<li><a href="/baz">Baz </a></li>
<li><a href="/no">No Bar </a></li>
</ul>
</div>
</code></pre>
<p><strong>Jquery</strong></p>
<pre><code>$(".btn").click(function(e) {
e.preventDefault();
$("#main-dropdown").removeClass('hide');
$("#main-dropdown").addClass('show');
return false;
});
$("#dropdown").mouseup(function() {
return false
});
$(document).mouseup(function(e) {
if($('#main-dropdown').hasClass('show')) {
$("#main-dropdown").removeClass('show');
$("#main-dropdown").addClass('hide');
return false;
}
$("#main-dropdown").removeClass("show");
$("#main-dropdown").addClass("hide");
});
</code></pre>
<p>Problem:
When I click on the href (id = btn) a drop down comes but when I again click on that button is should hide
which is not happening. Where i am doing wrong.</p>
| javascript jquery | [3, 5] |
332,800 | 332,801 | ckEditor potentially dangerous Request.Form value | <p>I am using <strong>ckeditor control</strong> in my web site to add page contents, On edit page when i changed contents and click on submit button i am getting error as <code>potentially dangerous Request.Form value was detected from the client</code>
i have also used <code>ValidateRequest="false"</code> but still i am getting error. Can any one tell me how can i resolve this problem. my web site is in <em>Framework 3.5, asp.net3.5</em></p>
<p>Thanks in advance.</p>
| c# asp.net | [0, 9] |
5,894,104 | 5,894,105 | What are some fun beginner-level Android programs to try? | <p>I'm beginning to write Android applications for one of my CS classes and I want to know what some fun things to try would be. I'll be writing them in Java (which I'd say I'm alright with) but I'm completely new to Android/mobile programming. Advice and suggestions are much appreciated. I want to learn what I can do. Thanks.</p>
<p>Brandon</p>
| java android | [1, 4] |
1,534,400 | 1,534,401 | how to change supports disabled attribute to true in c# | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/8521688/disabled-button-with-a-alert-is-clickable-in-ie8-browser-compatibility-issue-in">Disabled button with a alert is clickable in IE8 (browser compatibility Issue in Asp.net website)</a> </p>
</blockquote>
<p><img src="http://i.stack.imgur.com/IMO1S.png" alt="enter image description here"></p>
<pre><code> <asp:LinkButton ID="lnk_DeleteUser" ToolTip="Delete User" runat="server" OnClientClick="return confirm('Are you sure you want to delete this User?')">
<asp:ImageButton ID="Img_del" src="Styles/Images/icon_delete.png" OnClick="imgbtn_UserDeleteClick"
runat="server" Style="border-style: none" alt="Delete User" /></asp:LinkButton>
</code></pre>
<p>I want to disable the link button and image button for certain condition, but I am not able to disable the link button because when debugging I found the supports disabled attribute is false. because of that in IE8 the image is disable but the link button is not disabled and I am able to get the confirm popup. </p>
<p>this is the source code from browser</p>
<pre><code><a onclick="return confirm(&#39;Are you sure you want to delete this User?&#39;);" id="ctl00_MainContent_UserTable_ctl02_lnk_DeleteUser" title="Delete User" class="aspNetDisabled"><input type="image" name="ctl00$MainContent$UserTable$ctl02 $Img_del" id="ctl00_MainContent_UserTable_ctl02_Img_del" disabled="disabled" title="You don&#39;t have permission to delete users" class="aspNetDisabled" src="Styles/Images/icon_delete.png" alt="Delete User" src="" style="border-style: none" /></a>
</code></pre>
| c# asp.net | [0, 9] |
4,021,665 | 4,021,666 | jQuery Confirm Before Submit | <pre><code><form action ="/submit-page/" method='post' class="editable">
<fieldset>
<select name="status" id='status'>
<option value="Submitted">Submitted</option>
<option value="Canceled">Canceled</option>
<option value="Application">Application</option>
</select>
<input type="submit" name="submit" value="SAVE">
</form>
</code></pre>
<p>I have a form above: When I click on the drop down value "Canceled" and hit the Save button I want to give alert box with a warning message with a Yes and No button. </p>
<p>If the user cicks on Yes, take him to the submit-page as desired in the form action parameter.
if the user clicks No, stay on the same form page without refreshing the page.
Can this be done in jQuery?</p>
| php javascript jquery | [2, 3, 5] |
481,139 | 481,140 | Sending Binary Data problem | <p>I'm trying to send binary data from a database over an ASP.NET page. I can see that the property data.Length is 2400, that means 2400 bytes, right?
The weird thing is that when i receive this data the size is ~4kb, and appears to be corrupted. Any idea what the problem might be?</p>
<pre><code>byte[] data = proxy.getData(id);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=data.bin");
Response.AddHeader("Content-Length", data.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.Write(data);
Response.Flush();
</code></pre>
| c# asp.net | [0, 9] |
1,798,732 | 1,798,733 | How can i use Python and PHP together effectively | <p>I know PHP and i am currently learning django Python. </p>
<p>I am wondering the strengths and weaknesses of each language so that i can effectively use them together in order to program fater and more securly.</p>
<p>I know that PHP has much better(easier) string manipulation but python has better security. What are the other differences so that i know when to use the different languages?</p>
<p>I understand this is a 'very' broad question but i am hoping to hear your personal experience because that is something most books and tutorials wont talk about on this subject.
Any links, examples, theoris and facts are 'very' much appriciated!</p>
| php python | [2, 7] |
3,239,767 | 3,239,768 | How to programatically signin to website and download a file | <p>I am visiting a website regularly and need to download a file. When I visit the site it prompt me for login (No separate page for login. they might have used a script on Default.aspx) and then I need to make 3, 4 more clicks. After that I reach my file-download link.</p>
<p>I also tried to use Javascript make auto clicks and download file. I succeed upto loged-in but further it gives me error "Permission Denied" means cross domain problem when using iFrames and doesn't let me do it with Javascript.</p>
<p>Please let me know any alternative solution.</p>
<p>Thanks</p>
| c# javascript asp.net | [0, 3, 9] |
2,428,851 | 2,428,852 | How to use JavaScript to print the contents on a div? | <p>I would like to use the print() function to print the contents of a <code><div class="pagecontent"></div></code></p>
<p>I know you can do something like <code>onClick="window.print()"</code> but this prints the entire window...I only want the contents of <code>.pagecontent</code> to be printed.</p>
<p>What's the easiest way I can go about doing this using JavaScript or jQuery? </p>
| javascript jquery | [3, 5] |
766,836 | 766,837 | Passing Array of string from C# application to C++ DLL | <pre><code>string []URL = {"www.facebook.com","www.orkut.com","www.yahoo.com"};
Int32 result = URL.Length;
SetPolicyURL( URL,result );
</code></pre>
<p>this is my C# code where i am trying to pass the array of string to C++ Dll which is imported like this</p>
<pre><code> [PreserveSig]
[DllImport("PawCtrl.dll", SetLastError = true, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern void SetPolicyURL( string []policy, Int32 noURL);
</code></pre>
<p>but i am not able to receive it in my c++ DLL .</p>
<pre><code> PAWCTRL_API void __stdcall SetPolicyURL( char ** URLpolicy, __int32 noURL)
{
for ( int i = 0; i < noURL; i++)
{
URLvector.push_back(URLpolicy[i]);
}
}
</code></pre>
<p>Please can any one help me how i should pass the function</p>
<p>thanks InAdvance</p>
| c# c++ | [0, 6] |
1,087,595 | 1,087,596 | I want the elements which are in sequence (1,2,3) (6,7) (10,11) (15,16,17). separately | <p>Am having following array:<code>arrtooth</code></p>
<pre><code>var arrtooth = tooth.split('|');
</code></pre>
<p>It gets value </p>
<pre><code>arrtooth=[1,2,3,6,7,10,11,15,16,17];
</code></pre>
<p>I want the elements which are in sequence <code>(1,2,3) (6,7) (10,11) (15,16,17)</code>.
separately.My code is in Jquery.I just want the actual logic.</p>
<p>If i get the output as 3 2 2 3 in an array it will be fine or if you have any thing (output) which can elaborate the sequence will be ok.</p>
| javascript jquery | [3, 5] |
1,910,157 | 1,910,158 | On button click, select a sibling element with JQuery | <p>I have this code:</p>
<pre><code><div class="item">
<div class="hidden">44</div>
<input type="submit" id="btnAddCommentForAnswer" value="Add Comment" />
<script type="text/javascript">
$(document).ready(function () {
$('#btnAddCommentForAnswer').click(function () {
alert(XXX);
});
});
</script>
</div>
<div class="item">
<div class="hidden">12</div>
<input type="submit" id="btnAddCommentForAnswer" value="Add Comment" />
<script type="text/javascript">
$(document).ready(function () {
$('#btnAddCommentForAnswer').click(function () {
alert(XXX)
});
});
</script>
</div>
</code></pre>
<p>what code should I put at XXX to get the content of the div with class=hidden when i press the button at the same div with class=item?
<br />
If you click the first button you should get 44, and for clicking the second button you get 12.</p>
| javascript jquery | [3, 5] |
2,401,271 | 2,401,272 | Jquery and closure or function reference not working? | <p>I think it has something to do with a function running in a difference scope from where the jquery library is not accessable (shown being called as the last parameter on the second line below)</p>
<pre><code>var funcExpandHeight = container.animate({
height: '300px'
}, 300, function () {});
foo.animate({
height: 'show'
}, 300, funcExpandHeight);
</code></pre>
<p>Line one works, then crashes on <code>'f.easing[i.animatedProperties[this.prop]] is not a function'</code></p>
<p>Munging the lines up together as show below, and the operation completes successfully.</p>
<pre><code> foo.animate({
height: 'show'
}, 300, function () {
container.animate({
height: container[0].scrollHeight + 'px'
}, 300, function () {})
});
</code></pre>
| javascript jquery | [3, 5] |
3,744,867 | 3,744,868 | Jquery modification to add 1 and save the number in a txt file on every click | <p>I am using the following click function for a purpose. What can I add so it will add 1 in a txt file when it is clicked? Like a counter on how many times it was clicked.</p>
<p>Thank you</p>
<pre><code>$("#clearme").click(function(e) {
e.preventDefault();
// i have some stuff here
});
</code></pre>
| javascript jquery | [3, 5] |
5,079,196 | 5,079,197 | toggle checkbox attribute with jquery | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1467228/click-toggle-with-jquery">Click Toggle with jQuery</a> </p>
</blockquote>
<p>i tried 1 hour to toggle a checkbox. tried everything but i cant get this to work. </p>
<pre><code>$('#edit-customer-profile-shipping .fieldset-title').click(function() {
if ($('#edit-customer-profile-shipping input.toggler').is(':checked')) {
$('#edit-customer-profile-shipping input.toggler').attr('checked', false);
} else {
$('#edit-customer-profile-shipping input.toggler').attr('checked', true);
};
});
</code></pre>
<p>Could anyone help me out please??</p>
| javascript jquery | [3, 5] |
205,710 | 205,711 | ssl.SSLHandshakeException occurs when try to read xml from URL | <p>I got SSLHandshakeException when try to read XML from URL.
The error happens in this line:
Document doc = db.parse(new InputSource(url.openStream())); </p>
<pre><code> protected LinearLayout doInBackground(String... string) {
LinearLayout layout = new LinearLayout(DevicesActivity.this);
layout.setOrientation(1);
/** Create a new textview array to display the results */
TextView device[];
try {
URL url = new URL();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new InputSource(url.openStream()));
doc.getDocumentElement().normalize();
</code></pre>
<p>Log:</p>
<pre><code>05-30 15:18:21.742: I/Choreographer(12300): Skipped 59 frames! The application may be doing too much work on its main thread.
05-30 15:18:22.305: I/ActivityManager(290): Displayed com.example.wip/.DevicesActivity: +2s340ms
05-30 15:18:23.992: I/System.out(12300): XML Pasing Excpetion = javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
</code></pre>
<p>Also I got this message from Chrome when I try to see page info of the URL</p>
<pre><code>the identity of this website has not been verified.• server's certificate is not trusted
</code></pre>
<p>Is this the website server's problem? Can I fix it on my side?</p>
| java android | [1, 4] |
4,758,170 | 4,758,171 | Is it possible to replace a table cell without deleting it with javascript or jQuery? | <p>Is it possible to replace a table cell without deleting it with javascript or jQuery? For example, if I have a table with several rows, each row having 5 cells, could I change the first cell of the first row through assignment instead of removing the cell and then inserting a new one?</p>
<p>EDIT (simplified):</p>
<pre><code><table>
<tr id="currentRowId1" name="currentRowId1">
<td style="text-align:center">
</td>
<td style="text-align:center">
</td>
<td style="text-align:center">
<input type="submit" onclick="changeOrder()" />
</td>
<td style="text-align:center">
</td>
<td>
</td>
</tr>
<tr id="currentRowId2" name="currentRowId2">
<td style="text-align:center">
</td>
<td style="text-align:center">
</td>
<td style="text-align:center">
<input type="submit" onclick="changeOrder()" />
</td>
<td style="text-align:center">
</td>
<td>
</td>
</tr>
</table>
</code></pre>
<p>js</p>
<pre><code>function changeOrder(){
var row = document.getElementById("currentRowId1");
var otherRow = document.getElementById("currentRowId2");
row.cells[0] = otherRow.cells[0];
}
</code></pre>
| javascript jquery | [3, 5] |
5,174,330 | 5,174,331 | Time to transfer skills to java and resources | <p>I'm thinking about learning Java. I'm already a more than competent c# developer. Has anybody else been in a similar situation? Roughly how long (whilst doing a typical 9-5 job) did it take you to transfer your skills? What resources would you recommend?</p>
<p>(When talking about resources, I specifically mean resources aimed at developers who want to learn Java, not newbie material)</p>
| c# java | [0, 1] |
4,325,220 | 4,325,221 | jQuery and document.ready() firing twice | <p>I know it is quite a common issue, but even with research I was not able to understand what goes wrong in my call to document.ready() Javascript function.</p>
<p>For some reason, it gets called twice, even when I don't execute anything else than an alert.</p>
<p>As I said in the title, I am using jQuery, and figured something could come from $(function(){}), so I removed any execution in there as well. Nothing changes, document.ready() is still called twice.</p>
<p>What can be the origin of this issue? How to troubleshoot/solve it?</p>
<p>Thanks in advance!</p>
<p>Here's the code I've tried :</p>
<pre><code>$(function(){
//$( "#tabs" ).tabs();
});
$(document).ready(function() {
//getTableEntity("organisation", "getentitytable", "#testtable");
//standardDataTable('#tableOrga');
alert("document.ready");
});
</code></pre>
<p>Edit : I know I'm using the same function twice. Putting everything in one function doesn't solve the problem.</p>
| javascript jquery | [3, 5] |
2,453,014 | 2,453,015 | Why is my Javascript not working from the PHP file? | <p>I have the following files. For some reason my JavaScript (inside PHP 'echo' tags) does not work:</p>
<p>HTML (index.php):</p>
<pre><code><form action="submit.php" method="post">
<div id="edit-box">
<INPUT type="submit" name="save-text" id="save-text" value="Save">
<textarea id="editor" name="editor">
<?php echo $content; ?>
</textarea>
</div>
</form>
</code></pre>
<p>PHP (submit.php):</p>
<pre><code><?php
include('connect-db.php');
$submit_date = date("Ymd");
$content = mysql_real_escape_string(htmlspecialchars($_POST['editor']));
$ip_address = getRealIPAddress();
if ($content != '') {
mysql_query("INSERT source SET submit_date='$submit_date', ip='$ip_address', content='$content'")
or die(mysql_error());
// The following line is not working! I need help here!
echo '<script type="text/javascript"> alert("Your file saved!");</script>';
mysql_close($connection);
}
?>
</code></pre>
<p>The "submit.php" does not have any other PHP or HTML script/tags. I understand I am using obsolete PHP/MySQL API (instead of PDO / MySQLi), but that's beside the point.</p>
| php javascript | [2, 3] |
2,185,980 | 2,185,981 | How to bind tooltip on datagrid rows? | <p>I'm trying to bind datagrid rows with tooltip. In which event should i write the code? The row created event doesnt hold my data to bind and returning blank. The code reference is given below:</p>
<pre><code> protected void gdvActionItemView_RowCreated(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[2].ToolTip = e.Row.Cells[2].Text;
if (e.Row.Cells[2].Text.Length > 100)
{
e.Row.Cells[2].Text.Substring(0, 100);
}
}
</code></pre>
<p>Please help.</p>
| c# asp.net | [0, 9] |
4,247,117 | 4,247,118 | How to hide check all, clear all checkbox | <p>I am having check box in the column header. The function of this is to check or uncheck all the check boxes in that column.If the row check box is checked and say delete, that row can be deleted from the dataTable.</p>
<p>If the row object is used in some other table as a foreign key i put '-' in that row instead of check box which indicates that row cannot be deletable.</p>
<p>In these cases if all the row has '-" , there is no need to have the header check box. How to programatically hide this 'Check All | Clear All' check box, if there is nothing to be removed.</p>
<p>It would be even preferable to hide the 'Remove' button if there is no selection to be made.</p>
<p>What are the best practices to address the above scenario. I have attached the javascript which I am using.</p>
<pre><code><script type="text/javascript">
var tableId = '#user\\:userList';
jQuery(document).ready(function() {
jQuery('#selectAll').click(function() {
jQuery(tableId).find("input[type='checkbox']").attr('checked', jQuery('#selectAll').is(':checked'));
});
});
</script>
</code></pre>
| javascript jquery | [3, 5] |
4,222,144 | 4,222,145 | jQuery Children selector question | <p>I have the following code:</p>
<pre><code>$("#Table1 tbody").children().each(function(e){
$(this).bind('click',
function(){
// Do something here
},
false)
});
</code></pre>
<p>The Table1 html table has 2 columns; one for Names and one for a <code><button></code> element. </p>
<p>When I click on a table row, it works fine. When I click on the button, the button code fires; however, so does the row code.</p>
<p>How can I filter the selector so the button doesn't trigger the parent element's click event?</p>
| javascript jquery | [3, 5] |
557,219 | 557,220 | Finding the name of "this" | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2236028/jquery-finding-the-name-of-the-element-i-have-a-reference-to">jquery - finding the name of the element I have a reference to</a> </p>
</blockquote>
<p>I have a small problem with droppables / draggables. </p>
<p>is it possible to get the id of a dropped div if all you have is </p>
<pre><code>$(this)
</code></pre>
<p>coming in at the helper section. eg something like this:</p>
<pre><code>$("#"+ place).droppable({ accept: tile, drop: handler, zIndex: 0 });
</code></pre>
<p>... </p>
<pre><code>function handler(event, ui){
$(this).css('background-image','url(pretzel-icon-clip-art.jpg)');
$(ui.draggable).remove();
}
</code></pre>
<p>I have several tiles dragging so differentiating between them is becoming useful.</p>
<p>Any help appreciated, </p>
| javascript jquery | [3, 5] |
5,517,041 | 5,517,042 | Fancybox for .flv | <p>Is there a way to manipulate jquery Fancybox plugin to display flash video files (.flv)? I mean making it behave like Malsup's Media plugin that can handle both .swf and .flv</p>
<p><strong>Putting my question in context:</strong></p>
<p>I have a php file that works dynamically to read the videos:</p>
<pre><code> if($ext=="flv"){
$fileSize = filesize($file);
header("Expires: Mon, 20 Dec 1980 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
# content headers
header("Content-Type: application/x-shockwave-flash");
header("Content-Disposition: attachment; filename=\"" . $path . "\"");
header("Content-Length: " . $fileSize);
}
readfile("$file");
}
</code></pre>
<p>then my markup is as follows</p>
<pre><code> <li><a class="vids" href="viewThumb.php?type=media&amp;name=<?php echo $row['video']?>"><img src="viewThumb.php?type=artist&amp;name=a5339732e90416ee1df65dfe83bfba16.jpg" width="200" height="200"></a></li>
</code></pre>
<p>where $row['video'] is the name returned from an database query.</p>
<p>Now what I want is that when a client clicks on the thumbnail a fancybox with my video would display. It works well with .swf and other extensions explicitly noted in the fancybox documentation but not with .flv.</p>
<p>Help will be greatly appreciated</p>
| php jquery | [2, 5] |
2,606,410 | 2,606,411 | How can I add a simple counter function in javascript jquery? | <p>I'm using Shadowbox a jquery overlay and I wanted to count how many people are actually using the overlay. Thus, I would need a function that would write a counter to a file or sending a query through a php api...</p>
<p>has to be a a php url api because I cant use php on the server where the overlay is.</p>
<p>So I need help with executing a javascript function on the overlay click, tips on how to make a counter query through GET method. </p>
<p>Thanks</p>
<pre><code><script type="text/javascript">
</code></pre>
<p>Shadowbox.init({
handleOversize: "resize",
overlayOpacity: 0.9</p>
<pre><code> });
</code></pre>
<p></p>
| php javascript jquery | [2, 3, 5] |
4,116,392 | 4,116,393 | JQuery - using .on with element insertion | <p>I have a function which creates a tooltip for specific objects. Currently, I am running a tooltip function after ajax insertions to create and append the new tooltip objects. I am curious if there is a way to use .on() to auto-run the tooltip function on insertion, rather than manually running it. </p>
<p>For instance: </p>
<pre><code> $('[title]').on('inserted', function(){
tooltip(this);
});
</code></pre>
<p>I did some reading and it looks like custom triggers might be the way to go, but I'd love if it something like this existed :)</p>
| javascript jquery | [3, 5] |
5,334,674 | 5,334,675 | how to call an ajax request from subdomain | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3076414/ways-to-circumvent-the-same-origin-policy">Ways to circumvent the same-origin policy</a> </p>
</blockquote>
<p>Currently i'm trying to to call <code>site.com/ajax/countPM</code> from <code>jack.site.com</code> but the status of the request is <strong>canceled</strong>. </p>
| php javascript jquery | [2, 3, 5] |
1,033,429 | 1,033,430 | Looking for a programmer | <p>Where is a good place to find a programmer to assist me in the endeavour of creating a free computer game. Something fun. I would provide all of the artwork and i have a couple good ideas, one in particular that i have a few sketches for (I have more of a cartoon style and an obsession with beards). I know this isnt directly a programming question but i figured it was worth a shot.</p>
| java c++ | [1, 6] |
240,903 | 240,904 | How to set text of Image Button (Android)? | <p>In my Android project, I've a image button whose background is set to some image. I want so set some text on the image button. How do i do that/</p>
<p>I want to set the text because localization would be used in the project....</p>
| java android | [1, 4] |
2,967,882 | 2,967,883 | How can I reverse the order of HTML DOM elements inside a JavaScript variable? | <p>I need to print out receipts that inserted into my database, and the latest receipt should be on the top of my page. But when I query my database, I store all the data inside a var s, and naturally it will make the data that was inserted earliest on the top of my page, how do I reverse this?</p>
<pre><code>function querySuccess(tx, results){
if(results.rows.length == 0)
{
$("#ReceiptsList").html("<p>You have no receipts captured yet</p>");
}
else
{
var s = "";
for(var i = 0; i<results.rows.length; i++)
s += "<a href='edit.html?id="+results.rows.item(i).id+"'><strong><font size = 3> " + results.rows.item(i).name +"<font></strong>" + "&nbsp;&nbsp;&nbsp;&nbsp;<font size = 1>Date:" +results.rows.item(i).date + "<font></a> ";
}
//I tried s.reverse(); but didn't work, nothing was showed on the page
$("#ReceiptsList").html(s);
}
</code></pre>
| javascript jquery | [3, 5] |
5,068,012 | 5,068,013 | Deserilization an object in web browser | <p>I have a serialized object in C# .net 4 which contains some images and strings. </p>
<p>What I want is send that object to web browser and deserialize it in client's web browser. </p>
<p>What are the technologies that I will need? Is is possible to do this? My requirement is to save a class with images and few strings to hard disk and use it back. </p>
| c# asp.net | [0, 9] |
5,591,205 | 5,591,206 | When you use jQuery .removeClass() does it return an error when run on an element that does not have that class? | <p>I have four html elements that when clicked I want to have a specific class applied to. The problem is that that class is only for one of the four at any one time. I want to when one element is clicked have that class removed from the other three elements and applied to the one that was clicked. If I were to run a loop that removed that class from every single element before applying that class to the element clicked would there be an error on the elements that did not have that class?</p>
| javascript jquery | [3, 5] |
3,986,560 | 3,986,561 | How can I add a GET param to some anchor elements in jQuery? | <p>I have a bunch of <code>a</code> elements and I want to add a GET param to their <code>href</code> attribute.</p>
<p>I want to use <code>?</code> or <code>&</code> where appropriate.</p>
<p>For example, <code>http://example.com</code> should become <code>http://example.com?extra=true</code> and <code>http://example.com?already_got_a_param=true</code> should become <code>http://example.com?already_got_a_param=true&extra=true</code>.</p>
<p>What code would do that?</p>
| javascript jquery | [3, 5] |
5,461,714 | 5,461,715 | The remote server returned an error: 227 Entering Passive Mode () | <p>I am doing code which uploads file from one server to another, Following is my code:</p>
<pre><code> string CompleteDPath = "ftp://ExampleURL/photos/";
string UName = "USerName";
string PWD = "Password";
WebRequest reqObj = WebRequest.Create(CompleteDPath + fileName);
reqObj.Method = WebRequestMethods.Ftp.UploadFile;
reqObj.Credentials = new NetworkCredential(UName, PWD);
FileStream streamObj = System.IO.File.OpenRead(Server.MapPath(path));
byte[] buffer = new byte[streamObj.Length + 1];
streamObj.Read(buffer, 0, buffer.Length);
streamObj.Close();
streamObj = null;
reqObj.GetRequestStream().Write(buffer, 0, buffer.Length);
reqObj = null;
</code></pre>
<p>But first time it works fine, but next time it throws error as bellow:
The remote server returned an error: 227 Entering Passive Mode ()</p>
<p>Can you please tell me whats wrong with this.</p>
| c# asp.net | [0, 9] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.