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,863,814 | 1,863,815 | Javascript JQuery link to download a txt file | <p>Is there a way to 'force' the browser to download a file instead of opening that?</p>
<pre><code><a href="file.txt">Download this file</a>
</code></pre>
<p>I've tried the method via js using the window.open("file.txt", "Download"); </p>
<p>but no success.</p>
<p>Thx.</p>
<p>Updating:</p>
<p>I've done a php file as follow;</p>
<pre><code><html>
<a href='dl.php?bid=3'>
<php>
$sql="select barquivo from bibilioteca where bid=$_GET[bid]";
$row=mysql_fetch_assoc(mysql_query($sql));
header("Content-Disposition: attachment;filename=biblioteca/$row[barquivo]");
</code></pre>
<p>And it download a file "biblioteca_" with 0 bytes.</p>
| javascript jquery | [3, 5] |
4,492,872 | 4,492,873 | change DropdownList Datasource Dynamicly | <p>I have a <code>dropDownlist</code> that have tow <code>Datasource</code> with names <code>Datasource1</code>,<code>Datasource2</code>.
when the page_Load accrued the datasource1 is assigned to <code>Dropdownlist</code>. I have a button on page that i want when i clicked on button, Datasource2 assign to <code>Dropdownlist</code> in <code>button click event</code> i wrote this:</p>
<pre><code>Ddl_Num.DataSource = SqlDataSource8;
Ddl_Num.DataBind();
</code></pre>
<p>but it doesn't changed.
how can i do that?</p>
| c# asp.net | [0, 9] |
2,427,244 | 2,427,245 | Decoding an input stream | <p>So I have a page that is accepting XML through a POST method. Here's a small bit of the code:</p>
<pre><code>if (Request.ContentType != "text/xml")
throw new HttpException(500, "Unexpected Content Type");
StreamReader stream = new StreamReader(Request.InputStream);
string x = stream.ReadToEnd(); // added to view content of input stream
XDocument xmlInput = XDocument.Load(stream);
</code></pre>
<p>I was getting an error, so I converted the stream to a string, just to see if everything was being sent correctly. When I looked at the content, it looked like this:</p>
<blockquote>
<p>%3c%3fxml+version%3d%271.0%27+encoding%3d%27UTF-8%27%3f%3e%0d%0a</p>
</blockquote>
<p>So I guess I need to decode the stream. The only problem is that I don't know how I can use HtmlDecode on the stream, and still keep it as a StreamReader object.</p>
<p>Is there any way to do this?</p>
| c# asp.net | [0, 9] |
4,055,375 | 4,055,376 | .click function .load not working | <p>I am a total novice at jQuery, but giving it a go. I cant seem to get the <code>.click</code> function below to work. Can anyone tell me were I am going wrong?</p>
<pre><code>$(".news").click(function() {
$("#contentarea").load("console/news.php");
});
</code></pre>
| javascript jquery | [3, 5] |
2,745,222 | 2,745,223 | How to pass string from OnStartCommand into OnHandleIntent in an IntentService? | <p>Android/Java noob here. I have a URL that I am discovering in another part of my application. I am successfully passing that URL as a string into an intent service's OnStartCommand. I would then like to make that string containing my URL available to HttpURLConnection residing in a thread in OnHandleIntent as shown below. How can I get I get the URL within the myUrl string into OnHandleIntent?</p>
<pre><code>@Override
public int onStartCommand(Intent intent, int flags, int startId) {
String myUrl;
myUrl = intent.getExtras().getString("myUrl");
return super.onStartCommand(intent, flags, startId);
}
@Override
protected void onHandleIntent(Intent intentNotify) {
try {
URL url = new URL("myUrl");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
readStream(con.getInputStream());
} catch (Exception e) {
e.printStackTrace();
}
}
</code></pre>
| java android | [1, 4] |
54,224 | 54,225 | In Javascript, what does this syntax mean? | <p>I found this snippet when i was looking at jQuery plugins and wonder what it actually does</p>
<p>A jQuery plugin skeleton:</p>
<pre><code>(function($) {
...
})(jQuery);
</code></pre>
<p>And more recently in <a href="http://net.tutsplus.com/tutorials/html-css-techniques/building-persistant-sticky-notes-with-local-storage/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+nettuts+%28NETTUTS%29&utm_content=Google+Reader" rel="nofollow">nettuts</a>:</p>
<pre><code>var STICKIES = (function () {
...
}());
</code></pre>
| javascript jquery | [3, 5] |
4,246,329 | 4,246,330 | How to hide a control in asp | <p>I have a asp page in which i placed a button on clicking this button a calendar will show up.now what i want to do is on clicking any where apart from the button the calendar should be hided.it looks like a silly question but i am very new to this development </p>
| javascript asp.net | [3, 9] |
2,155,447 | 2,155,448 | autoplay: true with jQuery flowslideshow when the window is resized | <p>I want:</p>
<p>autoplay: false when is width>900 in window size and ,</p>
<p>autoplay: true when is width<900 & width>701 in window size and ,</p>
<p>autoplay: false when is width<701 in window size</p>
<p>with jQuery flowslideshow and when the window is resized run this code</p>
<p>but notworking.</p>
<pre><code>$(window).resize(function () {
var width = $(window).width();
if (width > 900) {
$(function () {
$(".slidetabs").tabs(".images > div", {
// enable "cross-fading" effect
effect: 'fade',
fadeOutSpeed: "slow",
// start from the beginning after the last tab
rotate: true,
showMultiple: 5
// use the slideshow plugin. It accepts its own configuration
}).slideshow({ **autoplay: false**, clickable: false });
});
}
else if (width < 900 & width > 701) {
$(function () {
$(".slidetabs").tabs(".images > div", {
// enable "cross-fading" effect
effect: 'fade',
fadeOutSpeed: "slow",
// start from the beginning after the last tab
rotate: true,
showMultiple: 5
// use the slideshow plugin. It accepts its own configuration
}).slideshow({ **autoplay: true**, clickable: false });
});
}
else (width < 701)
{
$(function () {
$(".slidetabs").tabs(".images > div", {
// enable "cross-fading" effect
effect: 'fade',
fadeOutSpeed: "slow",
// start from the beginning after the last tab
rotate: true,
showMultiple: 5
// use the slideshow plugin. It accepts its own configuration
}).slideshow({ **autoplay: false**, clickable: false });
});
} });
</code></pre>
| javascript jquery | [3, 5] |
4,741,110 | 4,741,111 | JQuery advice needed | <p>I have a page and I want to show some paragraphs after clicking a link, before that it should be hidden. So i wrote a simple JQuery code, but the problem is when I click the open link all the other hidden divs are also shown. My code is given below please advice how to solve the issue.</p>
<p>HTML</p>
<pre><code><div>
<a href="#" class="open_div">Read More</a>
<div class="expand_div">
<a href="#" class="close_div"><img src="images/close_button.gif" width="50" height="12" alt="Close" border="0" /></a>
<p>My hidden content goes here..</p>
</div>
</div>
</code></pre>
<p>and I want to repeat the above <code><div></code> block 7 times. So when I click the first div's Read more button the remaining 6 hidden divs are also showing!!! </p>
<p>JQuery</p>
<pre><code><script language="JavaScript">
$(document).ready(function(){
$('a.open_div').click(function(){
$('.expand_div').show();
});
$('a.close_div').click(function(){
$('.expand_div').hide();
});
});
</script>
</code></pre>
<p>how to solve this issue..?</p>
<p>any answers would be appreciated!</p>
<p>Thanks</p>
<p>Paul</p>
| javascript jquery | [3, 5] |
3,028,462 | 3,028,463 | Radiobuton list click show hide label control | <p>I am trying to show/hide Label control if the Radio button List value is 'N'. The code works fine but when I uncheck the radio button the Label control doesn't hide. Also I am using Jquery mousedown event to clear the selection. Please suggest.</p>
<pre><code>var radioList = "#<%= radioLst1.ClientID %>";
var lblID = document.getElementById('<%=LblIDNumber.ClientID%>');
$(radioList + " input:radio").click(function (e) {
if ($('#<%= radioLst1.ClientID %> input:checked').val() == "N") {
lblID.style.display = $(this).attr("checked") ? 'inline' : 'none';
}
else {
lblID.style.display = 'none';
}
});
</code></pre>
<p>I am using the following code to clear the selection of the radio button list.</p>
<pre><code> $(radioList + " input:radio").mousedown(function (e) {
if ($(this).attr("checked") == true) {
setTimeout("$('input[id=" + $(this).attr('id') + "]').removeAttr('checked');", 200);
lblID.style.display = 'none';
}
else {
return true
}
});
<asp:Label ID="LblIDNumber" style="display:none" runat="server">Number</asp:Label>
<asp:RadioButtonList ID="radioLst1" runat="server">
<asp:ListItem Value="U">Unknown</asp:ListItem>
<asp:ListItem Value="N">Not Applicable</asp:ListItem>
</asp:RadioButtonList>
</code></pre>
| jquery asp.net | [5, 9] |
342,480 | 342,481 | Client side showing , hiding is risky | <p>I have a div which contains a button .I am initially setting div display:none & depending upon the user rights i am showing it to user using javascript.</p>
<pre><code><div id="mydiv" style="display:none">
<asp:Button id="btn" runat="server"/>
</div>
PageMethods.GetRights(onsuccess);
function onsuccess(result){
if(result.isaccessible)
{
$("#mydiv").show();
}
}
</code></pre>
<p>Is Showing,Hiding at client risky. I dont want to use updatepanel if it is risky what is an alternative to this i have?</p>
| javascript asp.net | [3, 9] |
5,794,167 | 5,794,168 | The javascript code from server side is not working in asp.net? | <p>i am developing an Asp.net application when i call javascript function from codebehind i found that for example:</p>
<ol>
<li>click event not fired</li>
<li>i have a javascript function that fill the dropdown list with items using ajax but when page loaded i found dropdown list empty</li>
</ol>
<p>i am using RegisterClientScriptBlock to execute the javascript code</p>
<p>so is there any solution for these problems?</p>
<p>code snippet:</p>
<p>code behind:</p>
<pre><code> ClientScript.RegisterClientScriptBlock(this.GetType(), "ClientBlock", javacode.ToString());
</code></pre>
<p>this what in javacode variable :</p>
<pre><code> <script type="text/javascript">
<!--
function ExecuteScript()
{
$("#divGender input").click();
GetDMspecifyList(5);
$("cp1_drpDMSpecify").removeAttr('disabled');
$("cp1_drpDMSpecify option:selected").val(4);
$("#divFamily input").click();
}
</script>
// -->
</code></pre>
<p>this the function used to fill dropdown list but it is not working</p>
<pre><code> function GetDMspecifyList(DMID) {
$("#DMLoader").show();
$.getJSON('FillDropDownLists.aspx?DMTypeID=' + DMID, function (types) {
$.each(types, function () {
$("#cp1_drpDMSpecify").append($("<option></option>").val(this['DMTypeCode']).html(this['DMTypeName']));
});
$("#DMLoader").hide();
$("#DMSpecify_span").show();
$("#cp1_hdDMType").val($("#cp1_drpDMSpecify").val());
$("#cp1_drpDMSpecify").removeAttr('disabled');
});
</code></pre>
<p>} </p>
| javascript asp.net | [3, 9] |
4,248,814 | 4,248,815 | how to split image into multiple pices and join them as requested by user | <p>I am trying to load a large image <strong>( size > 80 MB)</strong> into web page. User doesn't really need to see the whole image at once and only need to see the requested portion. </p>
<p>The dimensions of the image are approx <strong>10k x 10k</strong>.</p>
<p>I looked around a little bit but couldn't found a reasonable solution to the problem.</p>
<p>I would like to split the image into some amount of pieces as needed (for ex 9 pieces, 3k x 3k each) and load them into the page as user request or moves into next section of the image (ex. if user crosses <strong>3k x 3k</strong> boundary, server will send side or bottom piece as needed). </p>
<p>I did found ways how to split image but couldn't find a way to do that dynamically and sew them together dynamically.</p>
<p><strong>UPDATE</strong></p>
<p>I tried using <strong>Microsoft Deep Zoom Composer</strong> but it didn't work. I think it does not support such large image size. I came to that conclusion as I tried the same image in <strong>Microsoft PhotoSynth</strong> and got an error message that it only supports files up to <strong>32MB</strong>. <strong>Deep Zoom Composer</strong> and <strong>Photo Synth</strong> use same file format so I think they might have same file size constraints.</p>
<p>Deep zoom Composer didn't produced meaningful error message as the error message was, <strong>file format is not right</strong>, but file is in right format (i.e. jpg).
Thanks</p>
| c# asp.net | [0, 9] |
664,509 | 664,510 | Serialize form to a specific json format | <p>When I use .serializeArray(), my data looks like:</p>
<pre><code>[ Object { Name="Name", Value="MyName" }, Object { Name="Age", Value="15"} ]
</code></pre>
<p>But I want it to look like:</p>
<pre><code>{ Name: "MyName", Age: 15 }
</code></pre>
<p>What do I need to do?</p>
<p>My form:</p>
<pre><code><form id="newUser">
<input id="Name" name="Name" />
<input id="Age" name="Age" />
<input type="submit" />
</form>
</code></pre>
| javascript jquery | [3, 5] |
5,184,671 | 5,184,672 | Create multiple directories in Android | <p>This is my directory structure on my Android sdcard</p>
<pre><code> sdcard/alQuranData/Reader1/Surah
</code></pre>
<p>Here is my code to make Directories</p>
<pre><code>File SDCardRoot = new File(Environment.getExternalStorageDirectory().toString() + "alQuranData/Reader1/Surah");
Toast.makeText(getApplicationContext(), SDCardRoot.toString(), Toast.LENGTH_LONG).show();
if (!SDCardRoot.exists()) {
Log.d("DIRECTORY CHECK", "Directory doesnt exist creating directory");
SDCardRoot.mkdir();
}
</code></pre>
<p>Now <code>alQuranData</code> is already created in my <code>sdcard</code> root. If i only create Reader1 directory than it works fine, but when is add <code>Reader1/Surah</code> than it did not create. </p>
<p>I also tried <code>mkdirs()</code> but it doesn't work. </p>
| java android | [1, 4] |
4,803,364 | 4,803,365 | Jquery Ignore Event | <p>Let's say we have this markup:</p>
<pre><code><span href="">Text <a href="">Link</a></span>
</code></pre>
<p>We have events bound to both elements. How do I make it such that when I click on the anchor tag, the event on the parent will not be triggered? I've tried using the Jquery method <a href="http://api.jquery.com/event.stopPropagation/" rel="nofollow"><code>stopPropagation()</code></a> but still no luck. Any thoughts? Thanks.</p>
| javascript jquery | [3, 5] |
1,383,287 | 1,383,288 | Converting a string | <p>How do I convert a string</p>
<pre><code>This:
file:///C://Program%20Files//Microsoft%20Office//OFFICE11//EXCEL.EXE
To this:
C:\\Program Files\\Microsoft Office\\OFFICE11\\EXCEL.EXE
</code></pre>
| javascript jquery | [3, 5] |
1,086,064 | 1,086,065 | Replacing ASP.NET POSTBACK with jQuery form posting | <p>I have a login screen wheren i have 2 text boxes and 2 radio buttons.I have a ASP.NET button too.When the user clicks on the button in my codebehind, in the click even of button ,i have the below lines to check the user login</p>
<pre><code> string emailId=txtEmailId.Text.Trim();
string password=txtPassword.Text.Trim();
//Code to Check user is valid...
if(isValid)
{
Response.Redirect("index.aspx");
}
else
{
lblMSg.Text="InValid Login";
}
</code></pre>
<p>This is the typical ASP.NET procedure.Now i want to avoid the post bak of the page and would like to use jQuery's form posting.Can any one guide me how to do it ? HEre i can read the ASP.NET controls value as "=txtEmailId.Text" . Can i do it in jQuery form posting method.I know i can do this by passing emailid and password as query string.Now I dont want to use query string to do this. Any thoughts ??</p>
<p>Thanks in advance</p>
| asp.net jquery | [9, 5] |
1,428,592 | 1,428,593 | jquery return false not Working in Function called from onclientclick button event | <p>in my ASPX page i have declared a jquery function and called it in button's onclientclick function but the return false is not occuring in it</p>
<pre><code> <asp:Button ID="btnRemove" Text="Remove" runat="server" CausesValidation="true" CssClass="submitButton" OnClientClick="CheckConfirm();" OnClick="btnRemove_Click" />
function CheckConfirm() {
if ($("['txtServerName']").val() != "") {
var r = confirm("The selected server will be deleted from the Database!!");
if (r == true) {
return true;
}
else {
return false;
}
}
}
</code></pre>
<p>I am new To jquery. Please let me know why the return false is not stopping hte event from proceeding.</p>
| javascript jquery | [3, 5] |
2,075,587 | 2,075,588 | Write date in asp:TextBox | <pre><code><asp:TextBox ID="txtDate" runat="server" Value="<%= DateTime.Today.ToShortDateString() %>" />
</code></pre>
<p><code>Value="<%= DateTime.Today.ToShortDateString() %>"</code> does not write date in txt field but whole string. What i am doing wrong?</p>
| c# asp.net | [0, 9] |
1,339,211 | 1,339,212 | How to get HTML of HtmlControl object in backend | <p>I have a short snippet of C# code like this:</p>
<pre><code>HtmlGenericControl titleH3 = new HtmlGenericControl("h3");
titleH3.Attributes.Add("class", "accordion");
HtmlAnchor titleAnchor = new HtmlAnchor();
titleAnchor.HRef = "#";
titleAnchor.InnerText = "Foo Bar";
titleH3.Controls.Add(titleAnchor);
</code></pre>
<p>What I want is a way to return a string that looks like this:</p>
<pre><code><h3 class="accordion"><a href="#">Foo Bar</a></h3>
</code></pre>
<p>Any thoughts or suggestions?</p>
| c# asp.net | [0, 9] |
4,682,479 | 4,682,480 | How to run a setInterval that loops and tries a max of 10 times before breaking? | <p>I have the following to try to reload on a connection drop:</p>
<pre><code>setInterval(window.location.reload(), 1000);
</code></pre>
<p>My concern with this is that it could continue forever, ddos'ing my application.</p>
<p>How can I update the above to try at max 20 times before giving up and breaking?</p>
<p>Thank you</p>
| javascript jquery | [3, 5] |
2,388,396 | 2,388,397 | jQuery extension is undefined in document.ready | <p>I'm just baffled on this one. I'm using linq.js, which is a great library that adds LINQ-style extension methods to js and jQuery. One of them is <code>$.Enumerable</code>, which is used to translate a jQuery list into another object that has the LINQ goodness. This has worked fine for weeks. </p>
<p>Today I did some refactoring, and this broke, but in a way that I can't figure out <em>at all</em>. Specifically, I've put debugging in and verified that <code>$.Enumerable</code> exists <em>until</em> document.ready is called, and in the ready callback rountine, <code>$.Enumerable</code> is undefined, even though it <em>was</em> defined until document.ready was called. So, something is resetting the global jQuery ($) object to a new one, or else unsetting the <code>$.Enumerable</code> property, but I can't figure out what. And whatever it is just started today, but I can't see how any of my changes would have caused this; I moved some stuff from one page to another, but AFAICT, everything is in the same order. Hoping this rings a bell for someone who can point me in the right direction.</p>
| javascript jquery | [3, 5] |
1,985,287 | 1,985,288 | Is it possible to reference object within the same object? | <p>I've been messing around with jQuery plugin code and I'm trying to put all of my common variables into a single object for easy access. I have included a few examples below on how I've done this, but I'm wondering how others deal with this problem.</p>
<p>Lets say I have this</p>
<pre><code>var x = function(options){
var defaults = {
ulist : $('ul#list'),
listLen : $('ul#list').children().length
}
$.extend(options, defaults);
// do other stuff
}
</code></pre>
<p>What I'm trying to do is use the <code>ulist</code> object in as a base, then find the number of <code>li</code>'s</p>
<p>I guess I could do this:</p>
<pre><code>var x = function(options){
var defaults = {
ulist : $('ul#list'),
listLen : 0
}
defaults.listLen = defaults.ulist.children().length;
$.extend(options, defaults);
// do other stuff
}
</code></pre>
<p>or this:</p>
<pre><code>var x = function(options){
var defaults = {
ulist : $('ul#list')
};
var defaults2 = {
listLen : defaults.ulist.children().length
}
$.extend(defaults, defaults2);
$.extend(options, defaults);
// do other stuff
}
</code></pre>
<p>The above code samples are just thrown together, and only meant to get the idea across to you. Anyway, is there a better way to do this?</p>
| javascript jquery | [3, 5] |
1,318,714 | 1,318,715 | Is there a way to search for text inside rows of a table with Javascript? | <p>I have an input text box and an html table with rows of text.</p>
<p><strong>Table:</strong></p>
<ul>
<li>This is the first row of my table. </li>
<li>This is the second row of my table.</li>
<li>This is the third row of my table.</li>
</ul>
<p>When I start typing in the input text box, I want the rows that do not match to disappear.</p>
<p>For example, if I type <strong>second row</strong>, I would like my table to show only this row:</p>
<ul>
<li>This is the <code>second row</code> of my table.</li>
</ul>
<p>If I type <strong>this is the</strong>, I would like my table to show all 3 matching rows:</p>
<ul>
<li><code>This is the</code> first row of my table. </li>
<li><code>This is the</code> second row of my table.</li>
<li><code>This is the</code> third row of my table.</li>
</ul>
<p>If anyone knows of a script to do this, I would appreciate it! (javascript or jquery)</p>
| javascript jquery | [3, 5] |
4,702,128 | 4,702,129 | Call Jquery library only for specific tasks | <p>I'm scraping a news website with PHP and injecting the Jquery library in the head, along with my own script which depends on Jquery. I have experienced some loss of functionality regarding some websites. So I was wondering if it would be possible to make the Jquery library function only for my script and thus not "assimilating" itself with other scripts on the page.</p>
<p>I have Googled for this but all I can find is Jquery noConflict() but it doesn't get the job done. </p>
| javascript jquery | [3, 5] |
4,211,158 | 4,211,159 | Accessing variables from onclicklistener | <p>So I have an onItemLongClickListener for a list view that gets a parameter 'int position' passed in. Inside, I have an alertDialogBuilder which has two buttons. I have another onclickListener for the buttons. I need to access the position from inside the second listener. Is there anyway to do this without making it a global?</p>
<pre><code>
public boolean onItemLongClick(AdapterView parent, View itemView, int position, long id){
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(BookFace.this);
alertDialogBuilder.setTitle("Choose an option.");
alertDialogBuilder
.setMessage("What would you like to do?")
.setCancelable(true)
.setPositiveButton("Edit", new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent();
intent.putExtra("position", position); //Can't access this variable
intent.setClass(SomeClass.this, EditActivity.class);
startActivity(intent);
}
</code></pre>
<p>Thanks for your help.</p>
| java android | [1, 4] |
4,226,762 | 4,226,763 | How do I loop through elements and use the index number to present the relative array object properties? | <p>I have created an array object with some dummy properties, I have have also dynamically created some list items that I would like to attach a click handler to. When a list item is clicked I would like to present the appropriate data inside #container using the template Ive set up. Im assuming I can use the index from the for loop of dynamic list items and some how use this to show the correct object properties? If you could advise me where I have gone wrong with this that would be great, sorry but Ive lost my way a little with this.</p>
<pre><code>$(document).ready(function () {
var data = [
{
name: 'kyle',
age: 23,
sex: 'male'
}, {
name: 'james',
age: 19,
sex: 'male'
}, {
name: 'catrina',
age: 28,
sex: 'female'
}];
var template = $('#template').html();
// Links created dynamically
for (var i = 0; i < 3; i++) {
var link = '<li>Link ' + i + '</li>';
$('#links').append(link);
}
// When li is clicked show related data properties, li[0] = data[0], li[1] = data[1] ...
$('li', '#links').live('click', function (e) {
$.each(data, function (index, value) {
$('#container').append(data.name[i], data.age[i], data.sex[i]);
});
$('#container').html(data);
});
});
</code></pre>
<p>Code can be found here <a href="http://jsbin.com/otirax/6/edit" rel="nofollow">http://jsbin.com/otirax/6/edit</a></p>
| javascript jquery | [3, 5] |
2,056,403 | 2,056,404 | Does JQuery have a way to unbind events in random HTML string? | <p>I'm using JQuery to set the HTML inside a div. Something like this:</p>
<pre><code>$(div).html(strHtmlBlob);
</code></pre>
<p>strHtmlBlob is a chunk of HTML returned via Ajax from the server. After, it's assigned, I set up some events for elements in the new HTML blob by doing this:</p>
<pre><code>$(div).find("a").click(a_ClickHandler);
</code></pre>
<p>That all works perfectly fine. The problem is REMOVING the events. I want to make sure I clean up the DOM properly.</p>
<p>I'm removing the HTML like so:</p>
<pre><code>$(div).html("");
</code></pre>
<p>But I can see that the events are still there. Is there a way to clean up events for elements that no longer exist?</p>
| javascript jquery | [3, 5] |
1,690,822 | 1,690,823 | Is Annotation in Javascript? If not, how to switch between debug/productive modes in declarative way? | <p>This is but a curious question. I cannot find any useful links from Google so it might be better to ask the gurus here.</p>
<p>The point is: is there a way to make "annotation" in javascript source code so that all code snippets for testing purpose can be 'filtered out' when project is deployed from test field into the real environment?</p>
<p>I know in Java, C# or some other languages, you can assign an annotation just above the function name, such as :</p>
<pre><code>// it is good to remove the annoying warning messages
@SuppressWarnings("unchecked")
public class Tester extends TestingPackage
{
...
}
</code></pre>
<p>Basically I've got a lot of testing code that prints out something into FireBug console.
I don't wanna manually "comment out" them because the guy that is going to maintain the code might not be aware of all the testing functions, so he/she might just miss one function and the whole thing can be brought down to its knees.</p>
<p>One other thing, we might use a minimizer to "shrink" the source code into "human unreadable" code and boost up performance (just like jQuery.min), so trying to match testing section out of the mess is not possible for plain human eyes in the future.</p>
<p>Any suggestion is much appreciated.</p>
| javascript jquery | [3, 5] |
4,772,356 | 4,772,357 | jQuery - Building object arrays with html5 data attribute selection | <p>I'm using HTML 5 data attributes to key rows of data in a table. I need to iterate the rows and gather the data into an object collection. I created a class to represent my row data:</p>
<pre><code>function SomeItem(description, finalPrice, percentDiscount) {
this.Description = description;
this.FinalPrice = finalPrice;
this.PercentDiscount = percentDiscount;
}
</code></pre>
<p>An event fires which triggers the collection of this data.</p>
<pre><code>$.each($('.ItemPriceBox'), function () {
var uniqueid = $(this).data('uniqueid');
var finalPrice = $(this).val();
});
</code></pre>
<p>The final piece of data, percentDiscount should be retrieved using the <code>data-uniqueid</code> attribute. I'm not sure how to do this.</p>
<p>I want...</p>
<pre><code>SomeItem[] items;
$.each($('.ItemPriceBox'), function () {
var uniqueid = $(this).data('uniqueid');
var finalPrice = $(this).val();
var percentDiscount = $('.ItemDiscountBox').where("uniqueid = " + uniqueid);
items[i] = new SomeItem(uniqueid,finalPrice,percentDiscount);
});
</code></pre>
<p>How can I solve this?</p>
| javascript jquery | [3, 5] |
3,852,837 | 3,852,838 | functions, variable and jquery | <p>I have 8 search filters user can choose. When user clicks on filter it opens options for this filter. When user clicks out, the function <code>hideFilterSearch()</code> is triggered. I have problem about understanding of scope for variable formData (see below).</p>
<pre><code>$(document).ready(function() {
var formData = $("form").serialize();
});
function hideFilterSearch() {
console.log(formData);
$(".filters").hide();
newFormData = $("form").serialize();
if (formData != newFormData) {
//newFormData is sent with ajax and search results are updates
}
formData = $("form").serialize();
}
//show, hide filter changer
$('body').click(function(event) {
if (!$(event.target).closest('.filter').length) {
hideFilterChanger();
};
});
</code></pre>
<p>Console log gives me empty string in this case. I tried also to send <code>formData</code> as argument <code>()hideFilterSearch(formData)</code>, but then the problem is <code>formData</code> won't be updated. I am not sure what is the correct way to pass <code>formData</code> to function, but still update it's value inside function when it is changed.</p>
| javascript jquery | [3, 5] |
233,726 | 233,727 | Marshalling data for C# | <p>I have not many experience in such language as C# so I would be pleased if you guys could help me. I wrote this method in C++ using MPIR library:</p>
<pre><code>mpz_class SchnorrProtocol::getX(const mpz_class& r) const
{
mpz_class x;
mpz_powm(x.get_mpz_t(), this->params_.getBeta().get_mpz_t(), r.get_mpz_t(), this->params_.getP().get_mpz_t());
return x;
}
</code></pre>
<p>and now I want to import it to C#:</p>
<pre><code> #region Filter & P/Invoke
#if DEBUG
private const string DLL = "schnorrd.DLL";
#else
private const string DLL = "schnorr.DLL";
#endif
[DllImport(DLL)]
"method definition"
...... SchnorrProtocol::getX(......);
</code></pre>
<p>my problem, I don't know how to do it. Could u please help me?</p>
| c# c++ | [0, 6] |
1,810,949 | 1,810,950 | Exception: Object reference not set to an instance of an object | <p>I have been using the code,</p>
<pre><code> object amountObject = MySqlDAL.ExecuteQuerySingle(query);
if (amountObject.Equals(System.DBNull.Value))
{
return amount;
}
</code></pre>
<p>here in some point am getting an exception "Object reference not set to an instance of an object." from the sentence amountObject.Equals(System.DBNull.Value). Its working fine for some set of data.</p>
<p>What may be the reason? Can any one please help me out?</p>
| c# asp.net | [0, 9] |
4,271,691 | 4,271,692 | click event doesnt get clicked in javascript | <p>I am having problem with jquery click event. Here is what my app does. User enters names in textfield. when he he clicks on add button then that name appears in contents div tag. This name also has a delete button. Now the problem is when user clicks on delete button it does not give any response. So how can I make this work?</p>
<p>Here is my <a href="http://jsfiddle.net/tSTEK/" rel="nofollow">code</a></p>
<p><strong>HTML:</strong></p>
<pre><code><div class="container">
<label>Name</label>
<input type="text" class="name" name="name" />
<input type="button" class="addBtn" name="add" value="Add" />
</div>
<div class="contents"></div>
</code></pre>
<p><strong>jQuery:</strong></p>
<pre><code>$('.addBtn').click(function() {
var name = $('.name').val();
var contents = $('.contents');
var div = $('<div class="names"></div>');
div.append(name);
div.append("<button class='delete'>X</button>");
contents.append(div);
$('.name').val('');
});
$('.delete').click(function() {
console.log('click');
});
</code></pre>
| javascript jquery | [3, 5] |
4,381,849 | 4,381,850 | Sending element id's upon form submit | <p>I need to take the data I get from an element id pulled from dropped items (using jqueryui draggables/droppables/sortables) to be sent via a form (to be emailed) along with data here:</p>
<pre><code> function submitForm() {
$.ajax({type:'POST',
url: 'send_tile.php',
data:$('#tiles_collected').serialize(),
success: function(response) {
$('#tiles_collected').find('.form_result').html(response);
}});
return false;
}
</code></pre>
<p>the function for getting the ids is this (not sure if it works right yet either):</p>
<pre><code> function getSku() {
var myIds = new array();
$("#collection li").each(function(index, element){
alert($(this).attr('id'));
myIds.push(element.id);
});
</code></pre>
<p>and the form looks like this:</p>
<pre><code> <form id="tiles_collected" name='tiles_collected' method="post" onsubmit="return submitForm();">
Email:<input name='email' id='email' type='text'/><br />
Name:<input name='name' id='name' type='text' /><br />
Zip code: <input name='zip' id='zip' type='text' /><br />
<input type='hidden' id='sku' />
<input type="submit" name="submit" value="Email collection to yourself and us" /><br/>
<div class="form_result"></div>
</form>
</code></pre>
<p>Can anyone give me an assist?</p>
| javascript jquery | [3, 5] |
4,106,709 | 4,106,710 | Click closest submit button when any 'enter' key event occurs on any input field | <p>I have multiple submit button on the page. What I want is if user presses enter on any input field it should click the related submit button. I tried the way below but it even couldnt catch the key press on the input fields. </p>
<p>Thanks in advance, </p>
<pre><code>$('* input').keypress(function (e) {
if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
$(this).closest('input[type=submit]').click();
}
});
</code></pre>
| javascript jquery | [3, 5] |
2,400,207 | 2,400,208 | how to populate asp:DropDownList from C# side | <p>I am trying to populate asp:DropDownList with data items and here is the code i have written so far</p>
<p>.aspx side</p>
<pre><code><asp:DropDownList ID="ddl" runat="server" />
</code></pre>
<p>C# side</p>
<pre><code>protected void btnAdd_Click(object sender, EventArgs e)
{
ddl.DataTextField = "hello";
ddl.DataTextField = "2";
ddl.DataBind();
}
</code></pre>
<p>The method <code>btnAdd_Click</code> is invoked. I tested it. But the data list is not getting populated with those data items.</p>
| c# asp.net | [0, 9] |
1,676,979 | 1,676,980 | How to add +9 hours on my jQuery script? | <p>How can I add +9 hours on my script below ? I don't prefer to just add 9 hours to the correct time, for example if I want it 13:22:54 to make it 22:22:54 for this to work but on the script.</p>
<p>I create the unix timestamp in a php file doing</p>
<pre><code>$end = mktime(16, 54, 0, 8, 18, 2011);
</code></pre>
<p>and the copy it below</p>
<p><strong>Countdown Script</strong>
</p>
<pre><code><script type="text/javascript">
var end_date = new Date(<?php echo $end; ?>*1000);
$(document).ready(function() {
$("#time").countdown({
date: end_date,
onComplete: function( event ){
$(this).html("completed");
},
leadingZero: true
});
});
</script>
<p id="time" class="time"></p>
</code></pre>
| php javascript jquery | [2, 3, 5] |
4,729,736 | 4,729,737 | jquery - Remove class from parent in list | <p>I need a Javascript <code>IF</code> statement that detects if: </p>
<pre><code>$('.ms-quickLaunch .menu ul.static li a .menu-item-text') == "Manage"
</code></pre>
<p>And if it does equal "Manage" then set the list to <code>.show().</code></p>
<pre><code><ul class="root static">
<li class="static linksBelow">
<a href="#" class="static menu-item">
<span class="additional-background">
<span class="menu-item-text">Manage</span>
</span>
</a>
<ul class="static" style="display: none;">
<li>
<a href="javascript:open();" class="static menu-item">
<span class="additional-background">
<span class="menu-item-text">Manage List</span>
</span>
</a>
<a href="#" class="static menu-item">
<span class="additional-background">
<span class="menu-item-text">Manage Documents</span>
</span>
</a>
</li>
</ul>
</li>
</ul>
</code></pre>
<p>*</p>
| javascript jquery | [3, 5] |
1,031,569 | 1,031,570 | Edit links in place | <p>I use this javascript to edit text in place: <a href="http://josephscott.org/code/javascript/jquery-edit-in-place" rel="nofollow">http://josephscott.org/code/javascript/jquery-edit-in-place</a> now I need to edit links as well. But when I click on link instead of just making it editable I'm redirected to the link address. How can I change it so that if double click a link just make it editable and don't redirect anywhere?</p>
<p>Can anyone please help?</p>
| javascript jquery | [3, 5] |
1,016,049 | 1,016,050 | Facebook Javascript vs PHP SDK | <p>I am somewhat confused by the facebook developers guide. Some tutorials show the javascript SDK being used while some show the PHP SDK being used. Do I need to load both of these? Are there any differences between the two (besides one being client and one being server)?</p>
<p>I am wanting to use Facebook's SDK for User Authentication, Social Plugins, and the Graph API.</p>
| php javascript | [2, 3] |
5,420,984 | 5,420,985 | loading DXT texture files in android using Java | <p>I am looking to load compressed jpg and png files in android. Loading the raw files is just too slow. The plan is to compress the files ahead of time into DXT files. I tried to use DXTViewer to compress some images and attempt to load them as textures.</p>
<p>Currently I am getting a GL_INVALID_ENUM from gl.glCompressedTexImage2D(...).</p>
<p>Here is the code.</p>
<p><i></p>
<pre><code> InputStream is = ESGLTextureUtility.loadFile(iFile, assetManager);
ByteBuffer bb = this.readToByteBuffer(is);
textureInfo.source = iFile;
is.close();
this.checkError(gl);
gl.glGenTextures(1, textureInfo.textures, 0);
gl.glBindTexture(GL10.GL_TEXTURE_2D, textureInfo.textures[0]);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
gl.glCompressedTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, 512, 512, 0, (int) this.total, bb);
</code></pre>
<p></i></p>
<p>Like I said, this triggers a GL_INVALID_ENUM.</p>
<p>There seems to be very little documentation or examples on this topic. </p>
<p>Thanks in advance.</p>
| java android | [1, 4] |
3,722,466 | 3,722,467 | How can I automate certain actions on a certain web page using javascript and jquery? | <p>I am learning javascript and would like to exercise a simple task, which I just fail to get right.</p>
<p>All I want is to automate these actions:</p>
<ol>
<li>Navigating to a url</li>
<li>Logging into the site by typing the password and clicking the login button</li>
<li>Then click another button, which would open a list of items.</li>
<li>Enumerate the list of items, expanding each item by clicking a certain link.</li>
</ol>
<p>This should be basic for any experienced javascript/jquery programmer, but I am kind of lost.</p>
<p>Here is what I have until now:
html:</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Bump the site</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="bump.js"></script>
</head>
<body>
</body>
</html>
</code></pre>
<p>bump.js:</p>
<pre><code>jQuery(function($) {
var intervalID = null;
function checkPasswordField() {
$("#password").val("my-password");
if ($("#password").val() === "my-password") {
clearInterval(intervalID);
$("#login")[0].click();
}
}
window.location.href = "http://www.the-site.co.il";
$(document).ready(function() {
intervalID = window.setInterval(checkPasswordField, 1000);
});
});
</code></pre>
<p>Of course, it does not work. When the site is loaded, the bump.js script is no longer with us - Chrome does not show it in the list of the loaded scripts. I guess, this behavior is logical, but then how do I do it?</p>
<p>Thanks.</p>
| javascript jquery | [3, 5] |
252,145 | 252,146 | The android emulator is not reflecting changes I have made in .xml layout file | <p>I have re-started eclipse, re-run the application numerous times, and saved all of my files in my application. In my .xml, I have gotten rid of a button. The .xml is inflated in my .java file. However, when I run my application on the android emulator, it keeps showing the button that I deleted. Any help???</p>
| java android | [1, 4] |
3,283,575 | 3,283,576 | How to play .swf with flash player lite in android 2.2 sdk in java? | <p>How can I get the full path of flash player lite, </p>
<p>and use it to play my target <code>.swf</code> ?</p>
| java android | [1, 4] |
3,622,391 | 3,622,392 | how to merge to two bitmap one over another | <p>*<em>i have two images and i want to save one bitmap image over another exactlly at the same point where it is present i also move image using gesture..... *</em></p>
<p>`public Bitmap combineImages(Bitmap ScaledBitmap, Bitmap bit) {</p>
<pre><code> int X = bit.getWidth();
int Y = bit.getHeight();
Scaled_X = ScaledBitmap.getWidth();
scaled_Y = ScaledBitmap.getHeight();
System.out.println("Combined Images");
System.out.println("Bit :" + X + "/t" + Y);
System.out.println("SCaled_Bitmap :" + Scaled_X + "\t" + scaled_Y);
overlaybitmap = Bitmap.createBitmap(ScaledBitmap.getWidth(),
ScaledBitmap.getHeight(), ScaledBitmap.getConfig());
Canvas canvas = new Canvas(overlaybitmap);
canvas.drawBitmap(ScaledBitmap, new Matrix(), null);
canvas.drawBitmap(bit, new Matrix(), null);
return overlaybitmap;
}`
</code></pre>
| java android | [1, 4] |
1,471,090 | 1,471,091 | change css classes of element added to DOM at runtime | <p>I've included some JavaScript from a third party in my page. This adds the following element to the page some time after the page is loaded:</p>
<pre><code><a class="foo">some link</a>
</code></pre>
<p>I need to ensure that this is changed to:</p>
<pre><code><a class="bar">some link</a>
</code></pre>
<p>ASAP after the element is added to the page. I tried adding the following to a JQuery ready handler</p>
<pre><code>$('a.gullSearchBtn').removeClass('gullSearchBtn').addClass('roundButton');
</code></pre>
<p>But this executes before the element is added and therefore doesn't work. I've searched the web and it seems like the jQuery feature known as "livequery" might be the solution to my problem, but I can't seem to get it to work.</p>
| javascript jquery | [3, 5] |
3,011,186 | 3,011,187 | Javascript - Getting data from XML for later use... put in array or object? | <p>I am extracting a bunch of data from an XML file using jQuery. I need to use the data to fill in image paths, names, etc.</p>
<p>What is the best way to gather all of this data for use? For instance, I get everything like so:</p>
<pre><code> $(document).ready(function() {
$.ajax({
type: "GET",
url: "stuff.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('speaker').each(function(){
var img_path = $(this).find('speaker_image').text();
var name_text = $(this).find('speaker_name').text();
// should I build an array or object here?
});
}
});
});
</code></pre>
<p>Should I stick everything into an array in the success method? Maybe in an object? What I will do is take the collected data and use it to build a list of names and images. There will be quite a few elements in this and it will look something like (with <code>img_path</code> being used in the image url and <code>name_text</code> being used for the label:</p>
<pre><code><ul>
<li><img src="images/bobsmith.jpg" /><br /><lable>Bob S. Smith</label></li>
<li><img src="images/crystalforehead.jpg" /><br /><lable>Crystal X. Forehead</label></li>
...
</ul>
</code></pre>
<p>What is the best way to handle the collected data so I can go through and build the html I need using it?</p>
| javascript jquery | [3, 5] |
53,431 | 53,432 | chunk_split in python | <p>I'm trying to find a pythonic way to do this PHP code:</p>
<pre><code>chunk_split(base64_encode($picture));
</code></pre>
<p><a href="http://us2.php.net/chunk%5Fsplit" rel="nofollow">http://us2.php.net/chunk_split</a></p>
<p>chunk_split split the string into smaller chunks of 76 character long by adding a "\r\n" (RFC 2045). </p>
<p>thank you</p>
| php python | [2, 7] |
1,256,265 | 1,256,266 | Stop user to Shift+F5 on the Page | <p>Does any one here know how can I stop user to Shift+F5 or F5 (refresh the page) on the Page by Jacascript or jQuery?</p>
<p>The reason is just to stop the page resubmit the same variable into the server side after the user clicked on the 'submit' button then pressed F5 again</p>
| javascript jquery | [3, 5] |
2,116,810 | 2,116,811 | Storing user details in application variable | <p>How to store some 100 users details (username) in Application variable?I know how to use session but i dont know how to use Application variable and how to store in global.asax file?</p>
| c# asp.net | [0, 9] |
1,060,970 | 1,060,971 | jquery: drawing and erasing border on focus and blur on any child elements of a div | <p>I'm having a div which can have many (not less then 5) child elements (mostly they are <code>div</code>, <code>table</code> and <code>img</code>). I want to draw border (e.g. with <code>jquery.css</code> method) when a user clicked on any child element of that div. It can be easily done with something like</p>
<pre><code>$div.click(function() {
//drawing frame here
});
</code></pre>
<p>Removing frame on click outside is much more harder. Of cause I can handle deselecting on click event thrown by any other div or body. But... maybe there's more elegant solution?</p>
<p>Thank you in advance!</p>
| javascript jquery | [3, 5] |
1,469,439 | 1,469,440 | android hello world app help | <p>i am learning android apps and i made this app and it doesnt work</p>
<pre><code> package com.android.test;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class HelloWorld extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button) findViewById(R.id.Button01);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(HelloWorld.this, "Hello World", Toast.LENGTH_SHORT).show();
}
});
}
}
</code></pre>
<p>but it doesnt work!!! please tell me what is wrong and help me to solve it!1</p>
| java android | [1, 4] |
3,353,358 | 3,353,359 | Tryied window.open with Ajax, window.print not working (IE9) | <p>I'm trying to open new window and send form data with javascript and jquery-1.8.3.</p>
<p>With Bernhard's help I succeeded to call a new window with page for print.</p>
<p>(Thank you so much Bernhard. <a href="http://stackoverflow.com/questions/14226470/window-open-and-sending-form-data-not-working">window.open and sending form data not working</a>)</p>
<p>But, <code>window.print()</code> function does not working in IE9! (FF, Chorme do well)</p>
<p>I refreshed the page, then IE9 calls <code>window.print()</code></p>
<p>Here is source code.</p>
<pre><code><a href="#" onclick="printPage()">Print this</a>
<script type="text/javascript" src="/common/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
function printPage(){
$.post('/common/print.jsp', {view:$("#ctn").html()}).success(function(response){
var oWindow = window.open('', "printWindow", "width=700px,height=800px");
oWindow.document.write(response);
oWindow.print(); // I added this line. But IE9 not working.
});
}
</script>
</code></pre>
<p>Is there something I missed?</p>
| javascript jquery | [3, 5] |
4,171,260 | 4,171,261 | Plugin architecture | <p>I am trying to understand plugin-architecture. Specifically the one used in the implmentation of Windows Live Writer. I am referring to the style where you can configure/enable/disable/add/remove additional functionality just by adding/removing DLL's(+ config). </p>
<p>I hope to see something similar for a web-based application. Can anyone please point me to the right direction?</p>
<p>Thanks in advance.</p>
<p>-SK</p>
| c# asp.net | [0, 9] |
3,915,497 | 3,915,498 | PHP echo inside javascript | <p>I've got jwplayer installed in wordpress and have it showing in a single.php page... the way I have it I need to get a custom field in the javascript and I;m having no luck echoing it in there. I know you cant straight up run PHP in a javascript function, hence I'm here asking noob questions :)</p>
<pre><code><script type='text/javascript'>
jwplayer("lbp-inline-href-1").setup({
'flashplayer': '/wp-content/uploads/jw-player-plugin-for-wordpress/player/player.swf',
'image': '/wp-content/themes/sometheme/images/vid.png',
'file': '<?php echo get_post_meta($post->ID, 'video', true); ?>',
'skin': '/wp-content/plugins/jw-player-plugin-for-wordpress/skins/skewd.zip',
'stretching': 'exactfit',
'controlbar': 'bottom',
'width': '640',
'height': '360'
});
</script>
</code></pre>
<p>is it possible to get </p>
<pre><code><?php echo get_post_meta($post->ID, 'video', true); ?>
</code></pre>
<p>Running in there for the file path?</p>
<p>Thanks for any advice.</p>
| php javascript | [2, 3] |
535,978 | 535,979 | How can I improve this? | <p>[http://83.80.140.99/jp/index.php]</p>
<p>At the moment I am trying to create a japanese rehearsal system, and its working perfectly. However, I am not pleased with the code. Basically I had a .txt file called lesson1.txt. I saved it as UTF-8 so it can contain japanese characters. </p>
<p>I had the problem I couldn't directly use the japanese characters in javascript, so I tried bypassing that issue by finding the unicode code point of each character in php, echo that out in as a javascript array and use a javascript function to convert it back to the japanese characters. </p>
<p>Now I figured this is not the way to go, because someone on this site told me this is an awful way of coding. My question is, how do I go by improving this? How can I get the japanese characters into my javascript code the most efficient way? Also, have a look at how badly it is coded right now to get a better way of understanding my problem. The link is at the top.</p>
<p>In case necessary: I used this php loop to get each unicode point transfered into characters and saved into a javascript array:</p>
<pre><code>$x = 0;
//$LineArray is an array in which each element contains a line of lesson1.txt
// so for example: $LineArray[0] = "あつい";
foreach($LineArray as $s)
{
echo "TextCharacters[" . $x . "] = new Array();\n";
for($i = 0; $i < mb_strlen($s,"utf-8"); $i++)
{
$char = mb_substr($s, $i, 1, "utf-8");
// REMOVE BOM
if(strtoupper(bin2hex(iconv('UTF-8', 'UCS-2', $char))) != "FEFF")
{
echo "TextCharacters[" . $x . "].push(go(\"" . strtoupper(bin2hex(iconv('UTF-8', 'UCS-2', $char))) . "\"));\n";
}
}
$x++;
}
</code></pre>
| php javascript | [2, 3] |
2,483,013 | 2,483,014 | When is $_FILES created/cleared | Relationship to javascript reloads | <p>I use this line</p>
<pre><code>isset( $_FILES['ufile']['tmp_name'] );
</code></pre>
<p>to test for a file upload. The issue I'm having is that I can't get the value to "clear".</p>
<p>If I go in and manually type</p>
<pre><code>unset( $_FILES['ufile']['tmp_name'] );
</code></pre>
<p>I can clear it but once I remove it, it is somehow populated by PHP. There are not actual file uploads in this process.</p>
<p>How can I accurately detect when a file has been uploaded and when the upload script is done.</p>
<p>The reason I ask is because Control Class works off this variable and it recently stopped working.</p>
<p>In javascript I recently changed the way I do reloads and I think this is causing a persistence issue with my PHP variables.</p>
<p>Particularly I went from window.location.href = location....to window.reload()</p>
<pre><code><?php
include 'class.Control.php';
$ControlEntryObject = new ControlEntry();
class ControlEntry
{
public function __construct()
{
if( isset( $_FILES['ufile']['tmp_name'] ) )
{
if( ( $_FILES['ufile']['tmp_name']) != '' )
{
Control::upload( $_FILES['ufile']['type'], $_FILES['ufile']['tmp_name'] );
}
else
{
Control::reload();
}
}
else if( isset($_POST['ajax_type']) )
{
Control::ajax( $_POST['ajax_type'] );
}
else
{
Control::reload();
}
}
}
</code></pre>
| php javascript | [2, 3] |
1,129,957 | 1,129,958 | What i am doing wrong with Class Overview? | <p>This code not work. Anyone can helpme?</p>
<p>.java</p>
<pre><code>package rfmsoftware.util.test1;
import android.app.Activity;
import android.os.Bundle;
public class test1 extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button)findViewById(R.id.Button01); <---- Error at this line !?
}
}
</code></pre>
<p>.xml</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<EditText android:id="@+id/EditText01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="10"></EditText>
<Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Scan"></Button>
<View android:id="@+id/View01" android:layout_width="wrap_content" android:layout_height="wrap_content"></View>
</LinearLayout>
</code></pre>
<p>.error</p>
<p>Button cannot be resolved to a type (type Java problem) ???</p>
| java android | [1, 4] |
1,831,326 | 1,831,327 | Select all text in textarea jquery | <p>How to make all text in textarea selected when user open it through jquery?</p>
| javascript jquery | [3, 5] |
3,734,257 | 3,734,258 | $ at the beginning and at the end of variable | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/205853/why-would-a-javascript-variable-start-with-a-dollar-sign">Why would a JavaScript variable start with a dollar sign?</a> </p>
</blockquote>
<p>I realized some syntax with jquery and didnt know what it is. here goes:</p>
<pre><code>var $foo = $("bar").blah();
var hello$ = $("stgelse").etc();
</code></pre>
<p>What is the difference between these? and why are they like that?</p>
<p>Also, For example: </p>
<pre><code>var $foo = $("").blah();
</code></pre>
<p>var should already contain whatever right side is returning ? no?</p>
<p>Can you please elaborate?</p>
| javascript jquery | [3, 5] |
828,138 | 828,139 | Returning values from Asynctask | <p>Okay I have been trying to get this to work for some time now. I want to be able to have my user login without having the UI hang until the server responds. When the doinbackground is complete I want it to pass an int value or perhaps a boolean value to the postexecute and then the rest of my code will execute. For some reason I have having problems passing values.</p>
<p>Would anyone be able to help me?</p>
<pre><code>private class login extends AsyncTask<Integer, Void, Void>{
ProgressDialog dialog = ProgressDialog.show(MainActivity.this, "", "Loading, Please wait...", true);
String user = "";
@Override
protected int doInBackground(Integer... params) {
// TODO Auto-generated method stub
Log.i("thread", "Doing Something...");
int val = 0;
if(db.userLogin(userTxt.getText().toString(), passTxt.getText().toString(), getApplicationContext()) == "No User Found, please try again!"){
val = 0;
}
return val;
}
protected void onPreExecute(){
//dialog.dismiss();
Log.i("thread", "Started...");
dialog.show();
}
protected void onPostExecute(int result){
Log.i("thread", "Done...");
dialog.dismiss();
if(result == 0){
toast.setText("No User Found, please try again!");
toast.show();
}else{
Intent myIntent = new Intent(ctx, userInfo.class);
myIntent.putExtra("user", user);
startActivityForResult(myIntent, 0);
}
}
}
</code></pre>
| java android | [1, 4] |
4,881,338 | 4,881,339 | How to format date to match specific pattern? | <p>I need to format <strong>DateTime.Now</strong> to match this pattern <strong>Example:</strong> 10-March-2011.</p>
<p>How can I accomplish it?</p>
| c# asp.net | [0, 9] |
1,707,426 | 1,707,427 | Calling javascript from codebehind c# & Asp.Net | <p>Am unable to understand why Cannot the below javascript code is not called from code behind</p>
<p>I have a simple javascript block like this</p>
<pre><code> function callsCox(res) {
alert(res);
}
</code></pre>
<p>From my code behind :</p>
<pre><code> ....
string res="COX23";
string script = String.Format("callsCox({0})", res);
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Cox",script,true);
</code></pre>
<p>Am I missing anything? There aren't any exceptions or errors.</p>
| c# javascript asp.net | [0, 3, 9] |
1,311,952 | 1,311,953 | Return True or False & how to get just on true in a loop | <p>I have this script that sends via $.post some information</p>
<pre><code>$("#clickme").click(function(e){
var selected = $(".img input:checked").map(function(i,el){return el.name;}).get();
var prelucrare = selected.join(";")
$.post('test.php', {
rezultat: prelucrare,
},
function(data){
$('#rez').html(data)
});
});`
</code></pre>
<p>And the PHP file that handles the $.post</p>
<pre><code><?php
require_once '../config.php';
If(isSet($_POST['rezultat'])) {
$d = explode(';', $_POST['rezultat']);
foreach($d as $numar_inregistrare){
$SQL = "DELETE FROM galerie_foto WHERE numar_inregistrare = '$numar_inregistrare'";
$rezultat = mysql_query($SQL) or die(mysql_error());
return true;
}
} else {
exit;
}
?>
</code></pre>
<p>I have two questions:
1. How can I make the js script do a thing if the return value is true and an other thing if the return value is false ? Something like this ?</p>
<pre><code> $.post('test.php', {
rezultat: prelucrare,
success: function(msg){
valid = (msg == 1) ? true : false;
if(!valid) {
$("#valid_input").html("Please enter valid info");
} else {
$("#valid_input").html("");
}
}
)};
</code></pre>
<ol>
<li>My other question is about the returning result, because I'm in a loop if there are 3 things in the array the result will be truetruetrue instead of just one true, what can I make to get just one true ?</li>
</ol>
| php jquery | [2, 5] |
73,453 | 73,454 | Can we impliment the operator over loading in Web services? | <p>Hi
is it possible to implement operator over loading in Web services in .net</p>
<p>Mehar</p>
| c# asp.net | [0, 9] |
5,232,380 | 5,232,381 | Check if mail already exist when register new user | <p>I need some feedback on this code:</p>
<pre><code>protected void RegisterUser_CreatingUser(object sender, LoginCancelEventArgs e)
{
var mail = RegisterUser.Email.ToString();
if (mail == "already existing mail")
{
e.Cancel = true;
}
}
</code></pre>
<p>I want stop new users to register with an email that is already registered. What is the best way to go??</p>
| c# asp.net | [0, 9] |
2,452,054 | 2,452,055 | JavaScriptInterface not called | <p>Why my code below doesn't trigger my JavaScriptInterface : I can't see any dialogbox popup (I guess that android.widget.Toast is supposed to do) when webview loads.</p>
<pre><code>package com.example;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class MyActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String data = "<html>" +
"<body><h1>Test JavaScriptInterface</h1></body>" +
"<script>Android.showToast(toast);</script>" +
"</html>";
WebView engine = (WebView) findViewById(R.id.web_engine);
engine.getSettings().setJavaScriptEnabled(true);
engine.addJavascriptInterface(new JavaScriptInterface(this), "Android");
engine.loadData(data, "text/html", "UTF-8");
}
}
</code></pre>
<p>package com.example;</p>
<pre><code>import android.content.Context;
import android.widget.Toast;
public class JavaScriptInterface {
Context mContext;
/** Instantiate the interface and set the context */
JavaScriptInterface(Context c) {
mContext = c;
}
/** Show a toast from the web page */
public void showToast(String toast) {
Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
}
}
</code></pre>
| javascript android | [3, 4] |
917,201 | 917,202 | how do asp.net and c# work together? | <p>In regards to web development PHP works seamlessly embedded inside HTML pages and is parsed before the HTML itself (hence the name PHP!).
I'm thinking of starting to learn ASP.NET and C# and it greatly boggles me how do these two Microsoft technologies work in tandem when compared to PHP which is a single entity in itself. I still can't understand how any logic written in C# files is tied to HTML pages that contain ASP.NET scripts.</p>
<p>And yes, if PHP is a scripting language, are C# and ASP.NET too server-side scripting languages??</p>
| c# php asp.net | [0, 2, 9] |
2,370,152 | 2,370,153 | JavaScript ternary operator example with functions | <p>I am using jQuery 1.7.1</p>
<p>I am just starting to use the JavaScript ternary operator to replace simple if/else statements. I have done so successfully in several places. I was surprised when I successfully made something else work when I thought for sure it wouldn't, but I tried anyway.</p>
<p>Here's the original statement:</p>
<pre><code>function updateItem() {
$this = $(this);
var IsChecked = $this.hasClass("IsChecked");
if (IsChecked == true){
removeItem($this);
} else {
addItem($this);
}
}
</code></pre>
<p>Here's the same function using the ternary operator:</p>
<pre><code>function updateItem() {
$this = $(this);
var IsChecked = $this.hasClass("IsChecked");
(IsChecked == true) ? removeItem($this) : addItem($this);
}
</code></pre>
<p>I was surprised because all of the examples I saw being used were merely setting variables like this:</p>
<pre><code>x = (1 < 2) ? true : false;
</code></pre>
<p>My question is whether this is "normal" use and will it work in most versions of JavaScript? Where will it fail? Are there other less obvious uses for it?</p>
<p><strong>UPDATE -- Thanks for the "real world" advice!!!</strong></p>
<p>I am using this as my function:</p>
<pre><code>function updateItem() {
$this = $(this);
$this.hasClass("IsChecked") ? removeItem($this) : addItem($this);
}
</code></pre>
| javascript jquery | [3, 5] |
1,207,618 | 1,207,619 | Refresh a view Android | <p>I want to refresh a listview. When I am getting a value from different class I want it to update that to list view. I am creating a thread for refreshing the list but I am getting an exception:</p>
<p><code>Only the original thread that created a thread a view hierarchy can touch its views</code></p>
<p>How to proceed?</p>
| java android | [1, 4] |
3,926,181 | 3,926,182 | Is there a way to play the role of Javascript with any other language like C#? | <p>Is there a way to play the role of Javascript with any other language like C#? One way came up in my head is, having silverlight installed, using C# instead of Javascript for all the client side scripting (Though C# is not a scripting language). Is it possible?</p>
<p>I am not talking about something like GWT(Java) or Script#(C#). Probably the question can be stated as- "With silverlight installed, can I do everything supported by Javascript(like DOM manipulation etc) with C#?" Hope it's clearer.</p>
| c# javascript | [0, 3] |
1,122,710 | 1,122,711 | Delete cookies in java script | <p>My actual prob is <a href="http://stackoverflow.com/questions/9428458/asp-post-back-issue-and-html-controls">asp post back issue and html controls</a>.<br>
i try to solve this in this way.<br></p>
<pre><code>if ($('#rdb1').attr("checked")) {
document.cookie = $('#rdb1').attr("id");
check = document.cookie.split(';');
flag = check[0];
} else {
document.cookie = $('#rdb2').attr("id");
check = document.cookie.split(';');
flag = check[0];
}
if (flag == "rdb1") {
$('#rdb1').attr("checked", true);
$('#rdb2').attr("checked", false);
} if (flag == "rdb2") {
$('#rdb1').attr("checked", false);
$('#rdb2').attr("checked", true);
}
</code></pre>
<p>its work.But how to remove cookie i dont know.I search hear and find<a href="http://stackoverflow.com/questions/2144386/javascript-delete-cookie">javascript - delete cookie</a> I don't want a function.Just want to delete cookies in next button.how to do this?Thanks.</p>
| c# javascript jquery asp.net | [0, 3, 5, 9] |
4,451,018 | 4,451,019 | Referencing explicit element id | <p>My javascript function looks like this - </p>
<pre><code>function updateSuccess(aEle) {
//Here aEle doesn't have the correct id
percIncrease.innerText = "Success";
}
</code></pre>
<p>in realizing it's bad to get the element this way, what would be a safer way of getting that element?</p>
<p>Some more info -
Here is how I call it from C#..</p>
<pre><code>DropDownList ddl = new DropDownList();
ddl.ID = "ddlData1";
ddl.Attribute.Add("onchange", "updateSuccess('" + ddl.ClientID + "')";
</code></pre>
| c# javascript asp.net | [0, 3, 9] |
4,909,016 | 4,909,017 | Android won't show special character from PHP page | <p>I have a simple web page that displays the word "Entrée". It looks perfect on the web but, when I use an HTTPClient in Android to show the webpage that should display this single word it does not know how to handle the "é". I'm not familiar with character codes and such, but I've been looking around and have seen that most people recommend UTF-8. How do I make sure Android can read this special character?</p>
<p>Webpage PHP code:</p>
<p><code><?php echo "Entrée"; ?></code></p>
<p>Any ideas?</p>
| java php android | [1, 2, 4] |
405,318 | 405,319 | Validation Viewstate error | <p>I got this error when I tried to call a <code>OnClick</code> in my form </p>
<p><strong>Error:</strong> <code>Failed validation of viewstate MAC. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same <machineKey> validationKey and validation algorithm. AutoGenerate can not be used in a cluster.</code></p>
<p><strong>Code-Behind</strong></p>
<p><code><form runat="server" id="form1">
<asp:Button ID="btnImprimeBematech" runat="server" OnClick="btnImprimeBematech_OnClick" Text="Imprime Novo Bematech" />
</form></code></p>
<p>I don't understand becaus in others thread here in StackOverflow, some solutions was the action in the <code><Form></code> tag, but I don't have any <code>action</code> in my form.</p>
<p>I tried put <code>EnableViewStateMac="false" EnableSessionState="False" EnableViewState="false"</code> in my <code><%@ Page</code> but still the same error</p>
| c# asp.net | [0, 9] |
2,122,679 | 2,122,680 | Returning html of an element along with the element in jquery | <p>I have mark up like</p>
<pre><code><div id="div1">
<div id="div2">
blah blah
</div>
</div>
</code></pre>
<p>If I use $("#div1").html(), it returns the div#div2. But I want to get the complete html. i.e, along with div#div1. </p>
<p>Is there any way to do this?</p>
| javascript jquery | [3, 5] |
1,547,029 | 1,547,030 | How to use zindex in JavaScript | <p>What is the syntax for zindex?</p>
<p>I tried like this </p>
<pre><code>document.getElementById('iframe_div1').style.zIndex =2000;
document.getElementById('iframe_div1').style.z-index =2000;
</code></pre>
<p>It is not working, it doesn't even show an error.</p>
<p>This is my snippet. It is working fine in HTML, but I want to set this CSS property in jQuery or JavaScript. The top/position attributes are not working...</p>
<blockquote>
<p>z-index:1200px; top:450px; position:absolute; right:300px;</p>
</blockquote>
<pre><code>document.getElementById('iframe_div1').style.display='block';
$("#iframe_div1").css("z-index", "500");
$("#iframe_div1").css("right", "300");
$("#iframe_div1").css("top", "450");
document.getElementById('iframe_div1').style.position = "absolute";
</code></pre>
<p>This snippet is not as perfect as I expect. I want to move my div center of the page, but it just moving my div to the bottom of the page.</p>
| javascript jquery | [3, 5] |
3,130,797 | 3,130,798 | Android app can be launched when press icon? | <p>I've build my project as .apk file and then I installed it into my device.
My step is:</p>
<p>1) Press an icon in app drawer, the Main Activity was started.</p>
<p>2) Press some action to go to Second Activity</p>
<p>3) Press Home Button</p>
<p>4) Press icon again</p>
<p>My expectation is the Second Activity should be resume but it just relaunch Main Activity.</p>
<p>How can I fix that I have tried set LaunchMode as </p>
<p>android:launchMode="singleTask"</p>
<p>android:launchMode="singleTop"</p>
<p>but it doesn't work.</p>
<p>Here is my setting in Manifest.xml file</p>
<pre><code> <activity
android:name=".auction.MySplashScreen"
android:configChanges="orientation"
android:label="@string/app_name"
android:launchMode="singleTask"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</code></pre>
| java android | [1, 4] |
2,564,733 | 2,564,734 | C# class similar to Java Desktop class | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/10174156/open-file-with-associated-application">Open file with associated application</a> </p>
</blockquote>
<p>I want to open a file in it respective application, e.g. open function of windows.</p>
<p>Same thing can be done in java with the help of <code>Desktop</code> class where you pass the file name and the respective file is opened.</p>
<p>But no idea how to do in C#.</p>
| c# java | [0, 1] |
1,426,192 | 1,426,193 | Trying to do some Obfuscation, How should I approach this particular case? | <p>I currently have an assignment that is really pushing my limits so I need some help on how to approach this. </p>
<ol>
<li>We have a set of 25 results</li>
<li>We are using a jquery plugin to vertically scroll through these 25 results, the container displays five results at a time. </li>
<li>When viewing the source code of the page, you can see the html for all 25 results. Obviously the jquery plugin is what is making them visible or not.</li>
<li>The task is to make it so that only five of the result set are displaying at any time during a source code viewing. All the rest of the results must come from javascript or some other technique.</li>
</ol>
<p>So I somehow have to either:</p>
<ol>
<li>Send a pool of 25 results to JS and have it generate the div info on the fly
OR</li>
<li>Some type of timed script that grabs five results at a time and displays them. But this all has to continuously scroll vertically so that is a consideration also.</li>
</ol>
<p>So I am trying to get my head around how I should approach this: One idea I had was to run an ajax call every five or ten seconds that has a php script generate five new results, then display them in the appropriate div. This is slow and would basically mean a page that is constantly sending out ajax calls. the random results are coming from a php script that is parsing an xml feed.</p>
<p>I am really just looking for a roadmap or some conceptual directions on how this could be approached.</p>
| php javascript jquery | [2, 3, 5] |
655,983 | 655,984 | Sign in to other website using asp.net | <p>Hey guys, I'm trying to make a website that can sign into other websites for the users, and grab certain information. For example: a web based game forum that automatically pulls your game statistics. My website would have to navigate to the game url, fill in the user name and password, sign in, then read the html once signed in (this is the easy part, for which I would simply use the HTML agility pack or something similar). Is this sign in process possible with asp.net?</p>
| c# javascript asp.net | [0, 3, 9] |
3,609,714 | 3,609,715 | Can one integrate PHP in Javascript? | <p>I've a webpage, which is currently completely build with PHP. Now, it would be great if it works on my local machine outside the web server, too. I figured out, that most of the stuff is just client side operations. I can easily rewrite them using Javascript. However, at one point, I am reading <code>Date</code> information from files stored on the server as follows (PHP):</p>
<pre><code>function getFileDate($file) {
$time = filemtime($file);
$date = date('d.m.y', $time);
return $date;
}
</code></pre>
<p>Is it possible to integrate that call into Javascript? And, can I implement some kind of switch, so that it will only be executed on my local machine (maybe replaced by a dummy date)?</p>
<p>Thanks for your help!</p>
| php javascript | [2, 3] |
5,682,702 | 5,682,703 | Dynamically change option values in drop down list | <p>Hi I want to add multiple drop down lists to my html page. Which they are contained same option values. (name,email,state,city,country,phone) condition is when user select "name" in first drop down list it should be disabled in all other drop down list. Assume when user select "email" in second drop down list, both email and name should be disabled in other drop down lists.
I only select one option value for one drop down list.
Previously selected option values should be disable in other drop down lists. </p>
<p>please can anyone help me??? </p>
| php jquery | [2, 5] |
661,458 | 661,459 | multi cloned select menu to submit form using Jquery? | <p>im trying to make a simple form which have a select menu with clone and remove button and once any of those select menus changed it must post the form using .Ajax call .
its working but have some issues
HTML</p>
<pre><code><form action="action.php" method="post" id="LangForm" >
<div id="fileds">
<select name="lang[]" id="lang" class="lang">
<option value="">Select</option>
<option value="arabic">Arabic</option>
<option value="english">english</option>
</select>
</div>
</form>
<button class="clone">Clone</button>
<button class="remove">Remove</button>
<div id="content"></div>
</code></pre>
<p>JS</p>
<pre><code>$(function(){
var counter = 1;
$(".clone").click(function(){
$('#lang').clone().appendTo('#fileds');
counter++ ;
});
$(".remove").click(function(){
if (counter > 1) {
$('#lang:last').remove();
counter-- ;
}
});
$('.lang').change(function(){
$.ajax({type:'POST',
url: 'action.php',
data:$('#LangForm').serialize(),
success: function(response) {
$('#content').html(response);
}
});
});
});
</code></pre>
<p>it have 2 issues
first one when i click the remove button it remove the original select menu first then the cloned one and keep the last cloned one what i need is to remove the cloned menus first and keep the original one</p>
<p>second issue its submit form only when original menu changed what i need is to submit form whenever any menu changed original or cloned.
below is the PHP code from the action PHP page its something simple just to show result
PHP</p>
<pre><code><?php
print_r ($_POST['lang']);
?>
</code></pre>
<p>Thanks</p>
| php javascript jquery | [2, 3, 5] |
5,895,951 | 5,895,952 | Web Application Architecture (ASP.NET 3.5,JavaScript) | <p><strong>hey all ,</strong></p>
<p>background -</p>
<p>I'm using an activx that allow me to access some information on the client side,</p>
<p>By using the activex events and callback i'm updating server side from client.</p>
<p>i wrote a user control that register all activex's events so when one of the events occuer there is a callback to the server that handle this event.</p>
<p>I need to write some other user controls based on this control so on every callback this user controls will be render on the client side.</p>
<p><strong>My question is -</strong></p>
<p>what is the best way to make a shared infrastructure that handle this events and render the right content base on user controls?
is there any other ways i can use ?</p>
<p>thanks!</p>
| asp.net javascript | [9, 3] |
5,275,226 | 5,275,227 | Pass a javascript variable to php | <p>Newb question so excuse me if there's an obvious answer (I've tried everything I can think of).</p>
<p>I have a javascript variable setup like so:</p>
<pre><code>var imageURL = <?php echo json_encode($imageRows[0]['URL_Path']); ?>;
</code></pre>
<p>Where $imageRows[0] can be an integer from 0 to whatever.</p>
<p>I also have another variable like so:</p>
<pre><code>var count = 15
</code></pre>
<p>I need to pass the count into the imageURL variable... can this be done?</p>
<p>I guessed something like:</p>
<pre><code> var imageURL = <?php echo json_encode($imageRows['count']['URL_Path']); ?>;
var imageURL = <?php echo json_encode($imageRows[(count)]['URL_Path']); ?>;
</code></pre>
<p>etc but nothings working.</p>
<p>Thanks</p>
<p>Edit:
Answered by Mike Brant.</p>
<p>Thanks</p>
| php javascript | [2, 3] |
2,676,888 | 2,676,889 | Set focus to a textbox in a nested iframe | <p>I use TinyMce in my app. So, I have nested body elements and iframes. One from my html page, and one from the TinyMce. To the body of the tinymce I append div with many textboxes. Their ids are hello1, hello2 etc.</p>
<p>How to set focus to 'hello1'?</p>
<p>This code:</p>
<pre><code>$iframe.contents().find('body').find('hello1')
</code></pre>
<p>returns the correct textbox.</p>
<p>But this:</p>
<pre><code>$iframe.contents().find('body').find('hello1').focus()
</code></pre>
<p>doesn't work. How to solve this?</p>
| javascript jquery | [3, 5] |
2,762,718 | 2,762,719 | LineNumberReader setLineNumber not working | <p>i use LineNumberReader to read text file , when call setLineNumber and getLinenumber it print == 0 But when call readLine again ์Nit thing happen how can i fix it
Here is my code</p>
<pre><code> BufferedWriter writer = new BufferedWriter(new FileWriter("text.txt"));
writer.write("This is a line1\n" +
"This is a line2\n" +
"This is a line3");
writer.newLine();
writer.close();
File myFile = new File("text.txt");
FileReader fileReader = new FileReader(myFile);
LineNumberReader reader = new LineNumberReader(fileReader);
// Read from the FileReader.
String lineRead = "";
while ((lineRead = reader.readLine()) != null) {
System.out.println(lineRead);
}
// Determine the number of lines that were read.
System.out.println("Total lines read: " +
reader.getLineNumber());
// Reset the number of lines read.
reader.setLineNumber(0);
System.out.println("Total lines read after reset: " +
reader.getLineNumber());
String lineRead2 = "";
while ((lineRead2 = reader.readLine()) != null) {
System.out.println(lineRead2);
}
System.out.println("End");
// Close the LineNumberReader and FileReader.
fileReader.close();
reader.close();
</code></pre>
<p>Thank</p>
| java android | [1, 4] |
5,475,864 | 5,475,865 | The status code returned from the server was 413 | <p>Getting this error on pages using https when a event handler is called. e.g selecting a row of data.</p>
<p>the data is in a infragistic webgrid.</p>
<p>Please advise.</p>
| c# asp.net | [0, 9] |
525,329 | 525,330 | countdown timer on alert box in android | <p>How do i display a countdown timer in my alert box .i want to notify the user that the session will end in 5 minutes and show a timer running in the alert pop up box in android</p>
| java android | [1, 4] |
2,558,345 | 2,558,346 | How to display selected auto drop down/autofill value into another div? | <p>If i select name/keywords from autofill/auto dropdown means, selected keyword should display into another div.</p>
<pre><code> <div class="iD_textarea" >
<table>
<tr class="organName" style="display:none;"><td width="124px">
<b><span>Organization Name</span>:</b></td><td id="organName"></td>
</tr>
</table>
</div>
<input type="text" class="organizationSearch" id="organizationSearch"
name="NAME">
</code></pre>
<p>Here is my jquery Code,</p>
<pre><code> $(document).on('mouseout keyup click','#organizationSearch',function(){
var organSearch=$(this).val();
if(!(organSearch=='')){
$('.organName').css('display','block');
}else{
$('.organName').css('display','none');
}
$('#organName').text(organSearch);
});
</code></pre>
| javascript jquery | [3, 5] |
1,291,761 | 1,291,762 | How to ensure HTML form elements visibly update before executing javascript events | <p>I have found that events like .click and .change, if they result in some processing that takes significant time (like a second or two) actually delay the screen update, so the user does not see e.g. the radio button select move until after some time. This is of course a big no-no in terms of user experience. The button should change at once, and the cursor indicate if there is a wait going on.</p>
<p>Example: <a href="http://jsfiddle.net/needlethread/uFjZf/1/" rel="nofollow">http://jsfiddle.net/needlethread/uFjZf/1/</a></p>
<pre><code>$('[name="myradio"]').change(function() {
delay(); // one second of code execution
$("#aaa").html("myradio changed"); // happens same time as radio moves
});
</code></pre>
<p>What is the best way to ensure that the button visibly changes as soon as the user clicks on it? I tried the .click event, same thing.</p>
| javascript jquery | [3, 5] |
4,774,172 | 4,774,173 | Detect when an alert box is OK'ed and/or closed | <p>Basically as the title says.</p>
<p>How can I detect when an alert box is OK'ed and/or closed?</p>
| javascript jquery | [3, 5] |
2,845,647 | 2,845,648 | Add Control to website via Code | <p>I am writing some controls for an asp.net website and i want make this controls contain .ascx file and .dll file.<br>
I dont want upload site for every control.<br>
so is there a way that make this control add to site via code like adding module in <strong>DotNetNuke</strong>.</p>
| c# asp.net | [0, 9] |
3,232,191 | 3,232,192 | figuring out this Javascript code | <p>I am trying to figure out how the get the featured area</p>
<p>at <a href="http://blueoceanportfolios.com" rel="nofollow">http://blueoceanportfolios.com</a> to link to webpages rather than displaying it within the featured box on the left .</p>
<p>This area is using JS file to display the videos on content in the featured box when different items on the menu are clicked, here is the working example :</p>
<p><a href="http://www.blueoceanportfolios.com/company/" rel="nofollow">http://www.blueoceanportfolios.com/company/</a></p>
<p>Okay ,
<strong>The problem:</strong> Loading a new webpage rather than displaying the content at featured box at the homepage of above website</p>
<p>Tried solutions: linking to javascript functions like onclick="window.location="http://someplace.com";" etc but still the content loads up in the featured box ,
try clicking on 2) it displays stackoverflow.com rather than loading new page.</p>
<p>Any suggestions ?</p>
| javascript jquery | [3, 5] |
3,421,455 | 3,421,456 | How do I clear the selection in an Android Submenu? | <p>I have a menu in my Android application and this menu has a <code>SubMenu</code>. The items are exclusively selectable.</p>
<p>How can I remove a selection made by the user (such that the submenu looks like it was at the beginning, with no item selected?</p>
<p>I was looking for a method that would do this, in a similar way as the <code>SubMenu</code>'s <code>setGroupEnabled</code> method, so I tried it by looping over the items of the submenu and call <code>setChecked(false)</code> on them. However, as it seems, deselecting an item in an exclusive list does not remove the selection, but shifts it to the next item. So after the loop, there was still any item selected.</p>
<p>What is the correct way of removing the selection (so that the user can select a new item)?
I appreciate your help.</p>
| java android | [1, 4] |
1,279,471 | 1,279,472 | retrieving multiple records from the database using jQuery | <p>I have a method in ASP.NET web service. jQuery calls this method to retrieve several records with multiple fields from the database. </p>
<p>I have problem to display the data in tabular format in the web page. I know if my method in web service returns just one string with appropriate table tags, it can be displayed in a web page very easily. </p>
<p>But I would like to do it in a different way. My method would return JSON data. Jquery's <code>.each</code> function will show the data in the webpage. I can do it if my method returns a single row. I don't know how to do it if several rows are returned. Any help will be appreciated. </p>
| jquery asp.net | [5, 9] |
4,341,255 | 4,341,256 | data transfer gird view to excel sheet | <p>data transfer grid view to excel in asp dot net code is run but blank sheet generate of excel but data is not loaded in excel sheeet how to solve this type of broblem</p>
<pre><code>protected void btnexcel_Click1(object sender, EventArgs e)
{
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition",
"attachment;filename=ActualsAndBudgets.xls");
Response.Charset = "";
Response.ContentType = "application/ms-excel";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
gvdetails.AllowPaging = false;
gvdetails.DataBind();
gvdetails.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}
public override void VerifyRenderingInServerForm(Control control)
{
}
</code></pre>
| 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.