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 |
---|---|---|---|---|---|
4,830,297 | 4,830,298 | .css function does not work inside of handler function | <p>I want to change css properties inside of a named function thant handles the click event. If I call .css in an anonymous function defined in the click event, it works. However, I want to call .css inside of a named function defined inside the handler function. Here's my code. </p>
<pre><code>$(document).ready(function () {
$('#popup').click(partial(coolTransition, $(this)));
});
function coolTransition(elem) {
shrink();
function shrink() {
elem.css('background-color', '#000000');
}
}
//used to implement partial function application so that I can pass a handler reference that takes arguments.
//see http://stackoverflow.com/questions/321113/how-can-i-pre-set-arguments-in-javascript-function-call-partial-function-applic
function partial(func /*, 0..n args */ ) {
var args = Array.prototype.slice.call(arguments, 1);
return function () {
var allArguments = args.concat(Array.prototype.slice.call(arguments));
return func.apply(this, allArguments);
};
}
</code></pre>
<p>Thanks in advance for help. </p>
| javascript jquery | [3, 5] |
1,999,886 | 1,999,887 | How to escape "\" characters in Java | <p>As we all know,we can use </p>
<pre><code>string aa=@"E:\dev_workspace1\AccessCore\WebRoot\DataFile"
</code></pre>
<p>in c# in order not to double the '\'.</p>
<p>But how to do in java?</p>
| c# java | [0, 1] |
2,530,792 | 2,530,793 | How do I validate that a text input contains only latin letters? | <p>How can I use jQuery to validate (on <code>keyup</code>) that a text input only contains latin letters (<code>only_english = 'abcdAbDKDk',</code>), without using a plugin?</p>
| javascript jquery | [3, 5] |
3,496,236 | 3,496,237 | dismiss or close a div permanently | <pre><code><a href="<?php echo base_url(); ?>"><div class="warningBox">Is this your first time here? Remmeber to change your password!</div></a>
</code></pre>
<p>I currently have a simple css div that displays a message to all my new users. I want to offer them the option to <strong>permanently</strong> dismiss / close the message once they have finished reading it.</p>
| javascript jquery | [3, 5] |
3,058,029 | 3,058,030 | Dynamically add/remove form input elements | <p>I'm trying to dynamically add/remove form elements using the following code:</p>
<pre><code><form method="post" action="" id="form-step2" class="form-vertical">
<fieldset>
<legend>Inputs</legend>
<div id="extender"></div>
<p><a id="add_btn" href="#">Add</a></p>
</fieldset>
</form>
$(function () {
//set a counter
var i = $('#form-step2 :input').length + 1;
//add input
$('a#add_btn').click(function () {
$('<p><input type="text" name="items[]" id="' + i + '" value="' + i + '" />' +
'<a class="dynamic-link" href="#step2">Remove</a></p>').fadeIn("slow").appendTo('#extender');
i++;
return false;
});
//fadeout selected item and remove
$(".dynamic-link").bind('click', function () {
$(this).parent().fadeOut(300, function () {
$(this).empty();
return false;
});
});
});
</code></pre>
<p>The input field is added but can't be removed. What am I doing wrong?
<a href="http://jsfiddle.net/VTqhJ/" rel="nofollow">http://jsfiddle.net/VTqhJ/</a></p>
| javascript jquery | [3, 5] |
5,298,936 | 5,298,937 | Pass Jquery alias into javascript function | <p>Im creating a theme for wordpress and I need to use some jQuery. Ive found bits of code online and ive made a few bits myself. However, when using jQuery provided by wordpress it is in noConflict mode and instead of using $ it is set to "jQuery". That is fine but I dont want to have to modify all my code and any code I find online to use "jQuery" instead of $.</p>
<p>So it tells me that by placeing <code>function ($)</code> at the end you are able to use the $ as the jQuery alias, but only in that functions scope. That is fine, but I was hoping that it would work and pass through to the functions I call from inside that scope. That is where my problem is. How can I make the jQuery code that uses $ inside my "resizeandcenter" function work.</p>
<pre><code>jQuery('.artworklist > li > a > img').load(function ($){
resizeitems('artworklist');
});
</code></pre>
<p>This is my function that I want to be able to use the $ inside as I dont want to have to modify all my code / and any code I find online.</p>
<pre><code>function resizeitems(elementname){
//Do some jquery stuff using $
}
</code></pre>
<p>Perhaps there is an alternative way to do what I am doing or I am doing it wrong?</p>
<p>EDIT:</p>
<p>My function "resizeitems" is on its own in a js file thats included in my page header.</p>
<p>The other code, the jQuery code in my first code block is at the bottom of the page in a script block.</p>
<p>So im a bit unsure about the answer saying to wrap my function?</p>
| javascript jquery | [3, 5] |
5,620,490 | 5,620,491 | how can i send file data from android to python? | <p>I want to send file of data from my android In other word { i want to Enter some data like name gender location age ....etc and this in android then take this data and send it to python } can this be file sending ?? or it must be data ?!! </p>
| python android | [7, 4] |
2,763,594 | 2,763,595 | How to show a jquery message after textbox in php | <p>I have a textbox to show date which follows icon of jquery calandar to choose date. I used jquery form validation to show message if the user doesn't select a date. if i enter submit means that message shows between textbox and icon. I want that message after that icon. How to show that message?</p>
| php jquery | [2, 5] |
2,586,160 | 2,586,161 | Assigning a variable via jQuery.fn.data() will keep a reference to the original tag value? | <p>Considering the following html:</p>
<pre><code><div id="test" data-test='["foo", "bar"]'></div>
</code></pre>
<p>and the following javascript:</p>
<pre><code>var dataValue = jQuery('#test').data('test');
dataValue.splice(0,1);
</code></pre>
<p>I will then have the following results:</p>
<pre><code>dataValue
['bar'] // as expected, i'm fine with that
jQuery('#test').data('test')
['bar'] // why ? i would expect ['foo', 'bar']
</code></pre>
<p>This might be something really basic I don't understand with javascript itself or jQuery but I'd be happy if someone could shed some light on this.</p>
| javascript jquery | [3, 5] |
3,783,497 | 3,783,498 | printing values of object in jquery | <p>I have below code that get values from a grid. Instead of printing the values, the grid is printing data in below object format. How to print values?</p>
<pre><code>[object Object], [object Object], [object Object], [object Object], [object Object]
</code></pre>
<p>CODE: </p>
<pre><code>$(document).ready(function () {
$("#check").click(function(){
var rows = $('#jqxgrid').jqxGrid('getrows');
alert(rows);
});
});
</code></pre>
| javascript jquery | [3, 5] |
1,092,622 | 1,092,623 | Is there a way to do this without each? | <p>I have many table cells which I want to show a tooltip once hovered. Each td element has a rel attribute with a request URI for ajax to fetch content into a tooltip. Right now I do it like this:</p>
<pre><code>$('table td.tooltipped').each(function() {
var uri = $(this).attr("rel");
$(this).bt({
ajaxPath: uri,
ajaxError: "<strong>Error!</strong> Here's what we know: <em>%error</em>."
});
});
</code></pre>
<p>It seems a little redundant to me but I can't figure out how to do it without the each loop. Any ideas?</p>
| javascript jquery | [3, 5] |
1,550,580 | 1,550,581 | how to specify multiple restiction values in connection.Getschema in c sharp | <p>i used
<code>odbcConnection.Getschema("Columns",new string[]{null,null,"Table1"})</code></p>
<p>to get the column names of a Table 'Table1'
now how do i specify multiple tables in the restriction in this function call to get list for multiple tables?
and also is there any way to say to get the info for all tables except Table1(not operator)</p>
| c# asp.net | [0, 9] |
2,703,995 | 2,703,996 | jQuery apply same functionallity to different divs | <p>I want to have 10 divs that when someone click on each of them or hover by any of them it will change. What I now have is a foreach from the php (goes over the array of stuff I want to show) and writes a script to each in a similar manner, with the only difference being the id of the div:</p>
<pre><code><?php
foreach($lines as $line) {
$lineId = $line->getId();
echo "$('#translation$lineId').hover(
function() { $('#translation$lineId').css('background-color', 'yellow'); },
function() { $('#translation$lineId').css('background-color', 'transparent'); });";
echo "$('#translation$lineId').focusin(function()
{ $('#translation$lineId').css('background-color', 'red'); });";
echo "$('#translation$lineId').focusout(function()
{ $('#translation$lineId').css('background-color', 'transparent'); });";
}
?>
</code></pre>
<p>In the browser it can get to hundreds of lines of code when the number of $lines is big.
Is there a better way? I want to use JQuery for that.</p>
<p>Another bonus question is how do I do in Jquery that when somebody clicks on a div it makes it red and when someone unclicks it (clicks somewhere else) it becomes transparent again. It is somewhat what I tried to do in my code. Jquery here too.</p>
<p>Thanks.</p>
| php javascript jquery | [2, 3, 5] |
5,966,390 | 5,966,391 | How to programmatically detect in which country the android device is located currently without using GPS? | <p>When my app runs, I want to detect the current location's country name and do some stuff for that specific country name, I can easily do it using geocoder, gps. But I want to get it from Locale or if anything more is available.</p>
| java android | [1, 4] |
4,274,144 | 4,274,145 | add an onclick event to a dynamically created linkbutton | <p>What I'm trying to accomplish is to set my dynamically created linkbutton with a onClick command so when click it will run a method in the code behind. This is my code:</p>
<pre><code>protected void Page_Init(object sender, EventArgs e)
{
LoadLeftSide();
}
private void LoadLeftSide()
{
string filepath = Server.MapPath("DataSource.xml");
List<Post> list = PostHelper.GetAllPosts(filepath);
HtmlTable table = FindControl("tbl") as HtmlTable;
HtmlTableRow hearderrow = new HtmlTableRow();
HtmlTableCell heardercell = new HtmlTableCell();
heardercell.InnerText = "Posts:";
hearderrow.Cells.Add(heardercell);
table.Rows.Add(hearderrow);
foreach (Post p in list)
{
HtmlTableRow row = new HtmlTableRow();
HtmlTableCell cell1 = new HtmlTableCell();
LinkButton lnkPost = new LinkButton();
lnkPost.ID =string.Format("{0}" ,Guid.NewGuid());
lnkPost.Attributes.Add("runat", "server");
lnkPost.Text = p.Title;
// lnkPost.CommandName = p.Id.ToString();
// lnkPost.CommandArgument = p.Id.ToString();
//lnkPost.Command += new CommandEventHandler(this.onLinkClick);
lnkPost.Click += new EventHandler(this.onLinkClick);
cell1.Controls.Add(lnkPost);
row.Cells.Add(cell1);
table.Rows.Add(row);
}
table.DataBind();
}
protected void onLinkClick(object sender, EventArgs e)
{
string filepath = Server.MapPath("DataSource.xml");
int id = 1;
Post post=PostHelper.GetPostById(id, filepath);
lblDescription.Text = post.Description;
}
</code></pre>
| c# asp.net | [0, 9] |
4,356,877 | 4,356,878 | from WPF to ASP.NET where do I start? | <p>I've been developning c# app in WPF for a few years now and I wanna start doing webapps in ASP.NET but I've now Idea where to start. Can anyone gimme some gudiance on where to start?</p>
| c# asp.net | [0, 9] |
2,617,877 | 2,617,878 | How to create a custom function which i can turn it off on a click? | <p>I am running a bit of code once the page load so in the footer i have got:</p>
<pre><code>$(function(){
//code to run on page load
});
</code></pre>
<p>But then i need to stop that code to run on a</p>
<pre><code>.click()
</code></pre>
<p>I was thinking of having a custom function which runs on page load and then be able to disabale that function on a click.</p>
<p>How to create a custom function which i can turn it off on a click?</p>
| javascript jquery | [3, 5] |
1,344,324 | 1,344,325 | Can I call instance function when using jQuery | <p>I have 2 methods, one is internal method and the other one is instance method,
When I'm calling my internal function(<code>onkeydown="javascript:return checkChatBoxInputKey();"</code>) it works great,<br>
But when I'm trying to activate the <code>onclick</code> event (<code>onclick="this.CloseChatBox();</code>) I get the following error:</p>
<blockquote>
<p>0x800a01b6 - Microsoft JScript runtime error: Object doesn't support
property or method 'CloseChatBox'</p>
</blockquote>
<p>Here is my code:</p>
<pre><code>function ChatBox(){
// Methods
this.CloseChatBox = ChatBox.CloseChatBox;
// Adding new chat box to page
$(" <div />").attr("id", "chatbox")
.html('<div class="chatboxhead">' +
'<a href="javascript:void(0)" title="Close chat box" onclick="this.CloseChatBox();">X</a>' + // This line fails to work
'</div>' +
'<div class="chatboxbody">' +
'<textarea onkeydown="javascript:return checkChatBoxInputKey();"></textarea>' +
'</div>')
.appendTo($("body"));
$("#chatbox_" + this.CallId).show();
return true;}
function checkChatBoxInputKey(){
alert("checkChatBoxInputKey");}
ChatBox.CloseChatBox = function (){
alert("CloseChatBox");}
</code></pre>
<p>What can I do?</p>
| javascript jquery | [3, 5] |
5,517,383 | 5,517,384 | How to reset select box using jquery | <p>i have two select boxes in html .I need to reset one select box when i select other</p>
<pre><code><select id="name" >
<option value="">select all</option>
<option value="1">Text 1</option>
<option value="2">Text 2</option>
<option value="3">Text 3</option>
</select>
<select id="name2" >
<option value="">select all</option>
<option value="1">Text 1</option>
<option value="2">Text 2</option>
<option value="3">Text 3</option>
</select>
</code></pre>
<p>When i select an option of the first id ie name i need to reset the second options to all and viceversa.
How can i do that</p>
| javascript jquery | [3, 5] |
453,297 | 453,298 | Clear all controls in a ASP.NET page with a Master page | <p>I have a asp.net page which is inherited from a master page .I want to clear all controls in this page .I tried using the bellow method .This is not working if a master page is there. Otherwise its working fine any ideas?</p>
<pre><code>private void ClearControls()
{
foreach(Control c in Page.Controls)
{
foreach (Control ctrl in c.Controls)
{
if (ctrl is TextBox)
{
((TextBox)ctrl).Text = string.Empty;
}
}
}
}
</code></pre>
| c# asp.net | [0, 9] |
4,471,002 | 4,471,003 | Calling textures dynamically | <p>I am iterating through a list that contains ints and I need them to link up with Textures that I have. </p>
<p>An example is </p>
<pre><code> for (int i = 0; i<spellsRectangles.size(); i++){
if(selectedSpells.contains(i){
drawSpellFromRect(Asset."spell"+i+"Light",i);
}else{
drawSpellFromRect(Asset."spell"+i+"Dark",i);
}
}
drawSpellFromRect(TextureRegion tr, int i){
spriteBatcher.draw(tr,spellsRectangles.get(i).x,spellsRectangles.get(i).y,spellsRectangles.get(i).height,spellsRectangles.get(i).width)
}
</code></pre>
<p>spellRectangles is an arraylist of rectangles</p>
<p>The textures are all already made and I just need to access them. Is there a way to use and iterator to call the textures. Instead of going to texture1, texture2, texture3, ect.</p>
<p>I have looked and realize I cannot create variables dynamically but can I call them?</p>
| java android | [1, 4] |
3,058,637 | 3,058,638 | How can I add a number to a variable to which I assigned a number in Javascript? | <p>I have the following:</p>
<pre><code>var offset;
offset = localStorage.getItem('test.MenuList.Offset.' + examID + "." + level) || 0;
offset += 100;
</code></pre>
<p>When I use the debugger this offset now has 0100. I want it to add like a number not a string. How can I do this?</p>
<p><strong>Please note</strong> I changed the question slightly because I realized I was getting the value from local storage. I assume this returns a string. But I am still not sure how to solve this.</p>
| javascript jquery | [3, 5] |
3,024,011 | 3,024,012 | Return User to Android App from Browser | <p>I am building a Twitter app that opens a webpage to allow someone to authorize my app. The problem occurs once the user has authenticated the site. It returns me back to my url, from which I'd like to close the browser window to return to my native app. I've tried the following, but the browser window remains open:</p>
<pre><code> <script>
window.close();
window.self.close();
</script>
</code></pre>
<p>The users would currently have to go back to the home screen and find my app again.</p>
<p>Is there javascript that would return the user to my app?</p>
<p>Thanks!</p>
| javascript android | [3, 4] |
242,939 | 242,940 | JQuery Setting variables when a website loads | <p>I have the following code... I'm trying to display the text in html on load:</p>
<pre><code> var hero_text_under_photo = 'Hero 1'
var hero_2_text_under_photo = 'Hero 2'
var hero_3_text_under_photo = 'Hero 3'
var hero_4_text_under_photo = 'Hero 4'
console.log(hero_text_under_photo);
$('hero_1_text_under_photo').setTextValue(hero_text_under_photo);
$('hero_2_text_under_photo').setTextValue(hero_2_text_under_photo);
$('hero_3_text_under_photo').setTextValue(hero_3_text_under_photo);
$('hero_4_text_under_photo').setTextValue(hero_4_text_under_photo);
</code></pre>
<p>I can read the variables with console.log, but I don't see the values set until I click them. How can I fix this?</p>
<pre><code><div id="whatsNew">
<h2>What's New</h2>
<ul id="topics" class="topics">
<li class="topic tab1 topicSelected" onclick="rotator.loadIndex(0); rotator.stop()">
<p id="hero_1_text_under_photo">
</li>
<li class="topic tab2" onclick="rotator.loadIndex(1); rotator.stop()">
<p id="hero_2_text_under_photo">
</li>
<li class="topic tab3" onclick="rotator.loadIndex(2); rotator.stop()">
<p id="hero_3_text_under_photo">
</li>
<li class="topic tab4" onclick="rotator.loadIndex(3); rotator.stop()">
<p id="hero_4_text_under_photo">
</code></pre>
<p></li>
</p>
| javascript jquery | [3, 5] |
4,172,734 | 4,172,735 | SyntaxError: Unexpected token ILLEGAL caused by \u2028 and \u2029 | <p>I am sending a sting as a parameter to a JavaScript function:</p>
<pre><code>theJSFunction('say hi dude');
</code></pre>
<p>Chrome gives me <code>SyntaxError: Unexpected token ILLEGAL</code> so after research, I've found that the following whitespaces generates the error <code>\u2028</code> and <code>\u2029</code>.</p>
<p>The problem is, the string posted to the function is printed via PHP and I need it to be printed via PHP (could use ajax, but I am required to let the PHP print it).</p>
<p>Is there any way to remove those to characters through PHP or JavaScript?</p>
| php javascript | [2, 3] |
1,795,918 | 1,795,919 | How can i get the Loged in user Name of Client machine | <p>How can i get the LogedIn in user Name of Client machine </p>
<p>without client providing the useid and password...
(wjen the users visits the page i need to get In which user Id he/she logedIn)</p>
<p>I tried</p>
<pre><code>string clientMachineName;
clientMachineName = (Dns.GetHostEntry(Request.ServerVariables["remote_addr"]).HostName);
Response.Write(clientMachineName);
</code></pre>
| c# asp.net | [0, 9] |
893,053 | 893,054 | dropdownlist custom databinding | <p>DropDownList inside Gridview.</p>
<p>Database Schema: </p>
<pre><code>Restaurants Menus Products
RestaurantID MenuID ProductID
RestaurantName MenuName ProductName
RestaurantID MenuID
</code></pre>
<p>it doesnt work with this:</p>
<pre><code><asp:DropDownList ID="DropDownList8" runat="server" DataSourceID="ObjectDataSource3"
SelectedValue='<%# Bind("MenuID") %>' DataTextField="RestaurantName" DataValueField="RestaurantID">
</code></pre>
<p>Gridview has GetAllProducts method.</p>
<p>ObjectDataSource3 has GetAllRestaurants method.</p>
<p>I want to edit and insert Menus of each Product. But I want to show RestaurantName indtead of MenuID..</p>
<p>When you want to bind Questions and Categories (just two) tables, this can work easily:</p>
<pre><code><asp:DropDownList ID="DropDownList8" runat="server" DataSourceID="ObjectDataSource3" SelectedValue='<%# Bind("CategoryID") %>' DataTextField="CategoryName" DataValueField="CategoryID">
</code></pre>
<p>I have 3 tables to reach data.. How can I do this?</p>
<p>Thanks</p>
| c# asp.net | [0, 9] |
5,841,262 | 5,841,263 | Iframe in the jquery UI dialog | <p>I have an iframe in the jquery UI dialog , setting its src at doument.ready event :</p>
<pre><code> $(document).ready(function() {
$("#iframe").attr("src", whatever);
$("#button").click(function() { $("#dialog").dialog(); });
});
<div id="dialog">
<iframe src="" id="iframe"></iframe>
<div>
</code></pre>
<p>Everything is going fine, when i <code>click over the button dialog open</code> but <code>the problem</code> is that it <code>loads iframe content everytime when dialog open</code>.I <code>want to stop</code> this behaviour and <code>load the contents only once at document.ready event</code>.How can i do this?</p>
| javascript jquery | [3, 5] |
4,576,357 | 4,576,358 | How to populate list view with three array? | <p>I have three String[] populated with JSon data. So I need list view with all three String[] ,for example : String[] name to be on the top, then String[] address and on the bottom String[] phone. I found few tuts about custom array adapter but I didn't understand them so well. So, to repeat I already have all data in String[] name, String[] address and String[] phone just I need to put them in right adapter.
Can anyone help me.
Thanks. </p>
| java android | [1, 4] |
3,667,097 | 3,667,098 | Should I learn Python after C++? | <p>I`m currently studying C++ and want to learn another language.<br>
For work I use C# + ASP (just started learning it, actually), but I want something "less Microsoft" and powerful.<br>
I have heard Python is a popular and powerful language, not so complicated as C++. But many people mentioned it was hard for them to get back to C++/Java from Python because they started thinking in it, get used to absence of memory management, etc.
What do you recommend?</p>
| c++ python | [6, 7] |
453,143 | 453,144 | Is there a way to globally intercept events when jquery is used? | <p>I have a site which has jquery included in the header. the application makes heavy use of jquery. now, that site uses ajax and shows up different message boxes when the user does something (it's a third party product used). I want to modify these boxes, but I need a piece of code to take action as soon as the DOM gets manipulated by ajax or jquery, or as soon as jquery receives any message with ajax, and then I must intercept that message, manipulate it and pass it on. I have no clue about jquery, but I do have about javascript. Does jquery offer something for this situation?</p>
| javascript jquery | [3, 5] |
1,207,536 | 1,207,537 | How Should I store values in DB from multiple text boxes | <p>I have 14 text boxes on application, in that user will enter single digit numbers. My task is to retrieve and save the values of all 14 text boxes into DB... I am facing a problem in passing a string for all text boxes. <strong>Could anybody help me out in writing some</strong> <strong>code in .aspx file</strong>? I did some work on it: actually I need help in writing a method in which we can pass all 14 values as a single string.</p>
<pre><code>BLL: public static SubmitParentReport GetItem(string needHours) {
return SubmitParentReportDB.GetItem(needHours);
}
BO: private string needHours = ""; public string NeedHours {
get { return needHours; }
set { needHours = value; }
}
DAL: This parameter I am using to store in database:
OracleParameter prm3 = new OracleParameter("i_need_hours", OracleType.VarChar, 2);
prm3.Direction = ParameterDirection.Input; prm3.Value = needHours;
myCommand.Parameters.Add(prm3);
</code></pre>
| c# asp.net | [0, 9] |
4,381,717 | 4,381,718 | JQuery javascript argument undefined in IE and Chrome | <p>I have following script and it works fine with FF and Safari.</p>
<pre><code>function swapimage(cid) {
jQuery('.imageshadowlg').attr("src", jQuery(cid).attr("src").replace('/thumb/', '/final/'));
}
<a href='javascript:;' id='expic1link' onclick='swapimage(expic1)' ><img id='expic1' src='../gallery/pics/thumb/test.jpg' /></a>
</code></pre>
<p>In IE, I'm getting following error</p>
<pre><code>SCRIPT5009: 'expic1' is undefined
</code></pre>
<p>Chrome is giving following error</p>
<pre><code>Uncaught TypeError: Cannot call method 'replace' of undefined
swapimagegal.js:139
(anonymous function)s_gallery.aspx:1
onclick
</code></pre>
<p>These scripts are located in separate js file.</p>
<p>Any ideas?</p>
| javascript jquery | [3, 5] |
5,841,089 | 5,841,090 | Look for specific word -- then change image | <p>Let's say I have an image and a textfield. Whenever I type a specific word into the textfield... I want the image to dynamically and ajax-acally change (without reloading the web page) to the image I set it at...</p>
<p>How is this done? Maybe using PHP/jQuery?</p>
| php jquery | [2, 5] |
357,021 | 357,022 | reading data from response | <pre><code>HttpWebRequest request = WebRequest.Create("https://www.google.com/accounts/o8/id") as HttpWebRequest;
request .Accept = "application/xrds+xml";
HttpWebResponse response = (HttpWebResponse)request .GetResponse();
</code></pre>
<p>returns xrds document.
how to read that document.</p>
| c# asp.net | [0, 9] |
5,016,230 | 5,016,231 | show hide content (wikipedia style) | <p>I've a lot of titles on my page (h1) and I want to add a "show/hide" function just after each title in order to show the SPECIFIC content that follows, without having to add manualy an id for each content and title.</p>
<p>I'm pretty new to jquery and thats what I've done so far. As you'll notice, the problem is that every div is being showed/hiden.</p>
<p>jQuery code:</p>
<pre><code>$(document).ready(function(){
$(&quot;h1&quot;).append(' [&lt;a class=&quot;show-hide&quot;&gt;Show/Hide&lt;/a&gt;]');
$(&quot;.show-hide&quot;).click(function(){
$(&quot;div&quot;).slideToggle(&quot;normal&quot;);
})
});
</code></pre>
<p>And the HTML code:</p>
<pre><code><h1>Title 1</h1>
<div>Content 1</div>
<h1>Title 2</h1>
<div>Content 2</div>
<h1>Title 3</h1>
<div>Content 3</div>
</code></pre>
<p>And it woul look like this:</p>
<pre><code>Title 1 [Show/Hide]
Content 1
Title 2 [Show/Hide]
Content 2
Title 3 [Show/Hide]
Content 3
</code></pre>
| javascript jquery | [3, 5] |
1,081,093 | 1,081,094 | Need help with error- The name 'lnk1' does not exist in the current context | <p>This is my link button:-</p>
<pre><code><asp:LinkButton ID="lnk1" Text="Set as Default" runat="server" Visible="false" OnClick="lnk1_OnClick"></asp:LinkButton>
</code></pre>
<p>In Code Behind I am simply making it visible</p>
<pre><code>lnk1.Visible = true;
</code></pre>
<p>I have checked the IDs over n over..whats wrong ? Intellisense wont detect it either..I am doing something really silly..just cant figure what it is ..help!</p>
<p>I even restarted Visual Studio..still same error</p>
| c# asp.net | [0, 9] |
1,112,694 | 1,112,695 | jQuery $.post doesn't work on Android 1.6 | <p>I'm experiencing this problem. My script works fine on later android, no problems at all, but on 1.6 it doesn't perform loads with $.post and does with $.get tho.
Also there's no problem with usuall html doctypes, but I need to use xml, in wich the script doesnt work as I said above</p>
<pre><code><html xmlns="http://www.w3.org/1999/xhtml">
</code></pre>
| jquery android | [5, 4] |
5,977,750 | 5,977,751 | PHP & JQuery Question | <p>I was wondering lets say I have a form that you can save and preview changes before you save the changes, what will be the best way to preview the changes in a different page, the same page or a lightbox? Can you give me some live examples if possible?</p>
| php jquery | [2, 5] |
751,105 | 751,106 | JQUERY Further More Ordering DIV's A-Z | <p>I just asked a question about ordering but it was only the first part of what I needed. I want to ask the full question now to see if its possible:</p>
<p>Its for a chat webpage and users can be online (active), offline (noactive) or have a message pending (msg) or no message pending (nomsg). Also keep the ID name in mind for A-Z
eg:</p>
<pre><code> <div id="chatCenterMembers">
<div id="lee" class="chatmember 10001 active msg"></div>
<div id="arch" class="chatmember 10008 noactive nomsg"></div>
<div id="steven" class="chatmember 10041 noactive msg"></div>
<div id="tim" class="chatmember 10432 active nomsg"></div>
<div id="ssan" class="chatmember 10007 active msg"></div>
<div id="yanti" class="chatmember 10034 noactive msg"></div>
</div>
</code></pre>
<p>Is it possible to order this as follows:
1. active msg (A-Z)
2. active nomsg (A-Z)
3. noactive msg (A-Z)
4. noactive nomsg (A-Z)</p>
<p>thx</p>
| javascript jquery | [3, 5] |
5,574,220 | 5,574,221 | Does python have something like php java bridge? | <p>Does python have something like <a href="http://php-java-bridge.sourceforge.net/pjb/" rel="nofollow">php java bridge</a>? I've found only py4j, but I couldn't find implementation of python + tomcat.</p>
<p>Could you recomend something?</p>
| java python | [1, 7] |
1,475,923 | 1,475,924 | Accepting a serialized form from jquery in asp.net | <p>In asp.net mvc it's pretty easy to receive a form collection in a ajax page webmethod like:</p>
<pre><code>public bool AddSomething(FormCollection form)
{
return true;
}
</code></pre>
<p>How do I receive serialized data in an asp.net page method:</p>
<pre><code> [WebMethod]
public static string AddSomething(??)
{
//...
return true;
}
</code></pre>
| jquery asp.net | [5, 9] |
5,295,611 | 5,295,612 | convert javascript function to C# (conversion question) | <p>since i'm poor with javascript I would like someone to convert this small function to C# code for me..</p>
<pre><code>var cn = 0;
function C(i,s)
{
return s.charCodeAt(i) ^ (cn|1) ^ ((cn++ & 1)?i:0) ^ 0x55
}
</code></pre>
<p>I would really appreciate your help. thanks in advance :)</p>
| c# javascript | [0, 3] |
938,386 | 938,387 | What happens when you put a function in parentheses? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/440739/what-do-parentheses-surrounding-a-javascript-object-function-class-declaration-me">What do parentheses surrounding a JavaScript object/function/class declaration mean?</a> </p>
</blockquote>
<p>I see functions inside parentheses in jQuery plugins and the like. </p>
<p>For example,</p>
<pre><code>(function(args) {
// ...
})(localVariable);
</code></pre>
<p>What does this do, exactly?</p>
| javascript jquery | [3, 5] |
1,678,515 | 1,678,516 | Asp.Net Singleton Pattern scenario | <p>In Asp.Net in what scenario i will use singleton as most of the job can be done with Session / Cache / Static by checking whether it is null nor not.</p>
<p>please refer to my previous question</p>
<p><a href="http://stackoverflow.com/questions/6934427/singleton-pattern-check-for-null-while-using-asp-net-with-session">Singleton Pattern / Check for Null - While using Asp.Net with Session</a></p>
| c# asp.net | [0, 9] |
4,847,706 | 4,847,707 | strange thing, ajax response includes whitespace | <p>I ave several JS functions that call different php files with $.ajax jquery method... yesterday everything was fine, but after cleaning up my code, i don't know what i did, but now the ajax response is like <code>"[space]data"</code> instead of <code>"data"</code>..</p>
<p>i could use a trim function in Js but i want to fix the source of the problem...</p>
<p>all my php files have the missing last <code>?></code> in order to avoid that, and before <code><?php</code> i'm sure, just checked, there is no space...</p>
<p>how come did I introduce this error? is the server? the browser?</p>
<p>The funny thing is that yesterday i cleaned my code with JSLINT..! bad idea..</p>
<p>thanks</p>
| php javascript jquery | [2, 3, 5] |
1,096,142 | 1,096,143 | JQuery List Events | <p>At the moment I'm building a list using the following code:</p>
<pre><code>$('<li id="li' + jJob.Id + '"><div style="width: 98%; background-color: #9E7BFF; colour: #000000"><a href="javascript:void(0);">' + jJob.Type + ' ' + jJob.AddressClean + ' (' + jJob.Status + ')' + '</a></div></li>').click(function(e) { ShowStatus('job ' + jJob.Id + ' is available'); UnassignJob(jJob.Id); $(this).remove(); }).bind("contextmenu", function(e) { alert('li' + jJob.Id); return false; }).appendTo('#assignmentList');
</code></pre>
<p>This works as previously required. However I need to be able to add another a link which will show another menu allowing various options. The problem is that I've attached the click event to the div. How can I attach it only to the a link?</p>
<ul>
<li>Create li</li>
<li>Create div</li>
<li>Create a link with click event</li>
<li>Create another a link click event</li>
<li>Append li to #assignmentList</li>
</ul>
<p>Mark</p>
| javascript jquery | [3, 5] |
1,660,800 | 1,660,801 | What's the difference between Admob and Adwhirl? | <p>I'm trying to figure what the difference is and which one would be more profitable for my app?</p>
| android iphone | [4, 8] |
2,793,003 | 2,793,004 | Determining target TD when TR is clicked | <p>Given some click event for a table row:</p>
<pre><code>$("tr.somerow").click(function(){
//do some stuff
//can I determine the TD under the cursor at the time of clicking?
})
</code></pre>
<p>Can I determine which TD (or any child elements) was under the cursor at the time of clicking?</p>
| javascript jquery | [3, 5] |
45,305 | 45,306 | Play HTML5 videos on tablets | <p>I have a working solution to view HTML5 videos in android phones. It does not work at all on android tablets (samsung galaxy tab 2 for example). When I start the video, I can hear audio but the screen is black.</p>
<p>Here is my code : <a href="http://pastebin.com/P9ebDKha" rel="nofollow">http://pastebin.com/P9ebDKha</a></p>
<p>Do I have to rewrite all the code? Small mistake?</p>
| java android | [1, 4] |
1,961,932 | 1,961,933 | number of trailing zeros | <p>What <code>Integer.numberOfTrailingZeros(x)</code> does in Java, is there a similar function in C#?
tnx</p>
| c# java | [0, 1] |
3,819,989 | 3,819,990 | How to get the first value of class attribute of a tag? | <p>Let's say the body tag has a few class attributes:</p>
<pre><code><body class="html logged-in frontpage no-sidebar">
...
</body>
</code></pre>
<p>Currently, I use jQuery to get all class attributes of body tag using:</p>
<pre><code>$('body').attr('class');
</code></pre>
<p>I want to get the very beginning/first class attribute (which is 'html' class here).
How?</p>
| javascript jquery | [3, 5] |
233,892 | 233,893 | Insert a new record (asp .net & c#) | <p>I'm a newbie to asp .net and c# world. I'm trying to insert a very new record into a simple task manager database table, tasks (name, description, priority, start_date, end_date)</p>
<p>Here is my Task.cs and add.aspx code:
<a href="http://pastie.org/691005" rel="nofollow">http://pastie.org/691005</a></p>
<p>When I submit the form, it just redirect me back to the Default.aspx page. Is there anyway to debug the inside the Insert method of Task.cs? How can I output the sql query from within the Task.cs file? I'm using Microsoft SQL express.</p>
<p>Thank you</p>
| c# asp.net | [0, 9] |
3,632,754 | 3,632,755 | How to initialize textbox to hide for first display and still have jquery work | <p>So I now have the following jquery to hide or show a textbox based on specific values selected in a DropDownList. This works except that I need the first display of the popup to always be hidden. Since no index change was made in the drop down list, the following does not work for that. If I code it as visible="false", then it always stays hidden. How can I resolve this?</p>
<pre><code><script language="javascript" type="text/javascript">
var _CASE_RESERVE_ACTION = "317";
var _LEGAL_RESERVE_ACTION = "318";
function pageLoad() {
$(".statusActionDDLCssClass").change(function() {
var value = $(this).val();
if (value == _CASE_RESERVE_ACTION || value == _LEGAL_RESERVE_ACTION) {
$(".statusActionAmountCssClass").attr("disabled", false);
$(".statusActionAmountCssClass").show();
}
else {
$(".statusActionAmountCssClass").attr("disabled", true);
$(".statusActionAmountCssClass").hide();
}
});
}
</script>
</code></pre>
<p>Thank you,
Jim in Suwanee, GA</p>
| c# asp.net jquery | [0, 9, 5] |
5,730,137 | 5,730,138 | Best way to integrate Python and JavaScript? | <p>Is it possible to integrate Python and JavaScript? For example, imagine you wanted to be able to define classes in JavaScript and use them from Python (or vice versa). If so, what's the best way? I'm interested not only if this is possible but if <strong>anyone has done it within a "serious" project or product</strong>.</p>
<p>I'm guessing it would be possible using <a href="http://www.jython.org/Project/">Jython</a> and <a href="http://www.mozilla.org/rhino/">Rhino</a>, for one example, but I'm curious whether or not anyone's ever actually done this, and if there are solutions for other platforms (especially <a href="http://en.wikipedia.org/wiki/CPython">CPython</a>).</p>
| javascript python | [3, 7] |
2,135,640 | 2,135,641 | Is there a way to force the app to always start with Activity1 following use of the Home button? | <p>This app has multiple activities: eg: Activity1 -> Activity2 -> Activity3. If the app is opened after the Home button is used while in Activity2, the app returns to Activity2, but the desired functionality is for the app to always start with Activity1 from the launcher. Adding a finish() to the onStop() for Activity2 does cause app to start with Activity1 following use of the Home button, but then Activity3 causes the app to revert to Activity1 when it finishes, rather than Activity2, which is also undesirable. Is there a way to force the app to always start with Activity1 following use of the Home button?</p>
<pre><code>public class Activity1 extends Activity {
...
public void onCreate(Bundle savedInstanceState) {
...
button1.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
startActivity(Activity2);
...
public class Activity2 extends Activity {
...
private boolean applyMenuChoice(MenuItem item) {
switch (item.getItemId()) {
case R.id.menuItem1:
startActivity(Activity3);
...
</code></pre>
| java android | [1, 4] |
3,787,014 | 3,787,015 | Javascript to access control in MasterPage | <p>I have a textbox control Super1 in my MasterPage.</p>
<p>I am using javascript to access this control from my content page like this:</p>
<pre><code><asp:Content ID="ContentPage" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript">
function Somethin() {
{
document.forms[0].elements['Super1'].value = "sdfsd";
//document.getElementById('<%=Super1.ClientID%>').value = "sdfsdf";
}
}
</script>
</asp:Content>
</code></pre>
<p>But while page load it says Super1 not found. How can I access Super1?</p>
| asp.net javascript | [9, 3] |
5,987,330 | 5,987,331 | about Speed: Python VS Java | <p>Just curious about speed of Python and Java..
Intuitively, Python should be much slower than java, but I want to know more...Could anybody give me more? or introduce some nice post to read?</p>
| java python | [1, 7] |
1,121,872 | 1,121,873 | How to load jQuery if it's not already loaded? | <p>I'm working on a weather widget, so in order to optimize it i want to check if jQuery has been loaded in the page, if Not, the widget will load it from my website.
Because not all the websites use jQuery. how to do that?</p>
<p>Example of how to put my widget:</p>
<pre><code><html>
blah blah blah
.................
<script src="http://www.xxx.com/weather.js"></script>
</body>
</html>
</code></pre>
<p>Thank you</p>
| javascript jquery | [3, 5] |
3,268,624 | 3,268,625 | How to use a drawable shape in Android through Java? | <p>If I have a drawable shape:</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="2dp" android:color="#FFFFFFFF" />
<gradient android:startColor="#DD000000" android:endColor="#DD2ECCFA"
android:angle="225"/>
<corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp"
android:topLeftRadius="7dp" android:topRightRadius="7dp"/>
</shape>
</code></pre>
<p>How would I go about using this as the background for a textview? I tried something like below, but it didn't work.</p>
<pre><code>TextView jObjTv = new TextView(getActivity());
jObjTv.setBackgroundDrawable(findViewById(R.drawable.sample_box));
</code></pre>
| java android | [1, 4] |
2,193,803 | 2,193,804 | JavaScript call to server side event | <p>So I havent done any ASP.net for awhile, and im trying to call some javascript validation, which works, then I need to call a Code behind event.</p>
<p>I thought it was going to be easy, but its turned into a right nuisance.</p>
<p>All i want to do is check if the text box is empty, if so thow an alert and dont run any service side methods, if its not not empty then run method.</p>
<p>dont mind changing the code, (although have to keep using materpages and content sections).</p>
<pre><code> <input type="submit" value="Update" onclick="validate()"/>
<SCRIPT LANGAUGE="JavaScript">
function validate() {
var jname = document.getElementById('MainContent_txtname').value;
if (jname == null) {
alert("Please Enter Name");
}
else {
CallServerMethod();
}
}
function CallServerMethod() {
UpdateClient() //I dont work
}
</SCRIPT>
</code></pre>
<p>any ideas?
Thanks</p>
| javascript asp.net | [3, 9] |
796,780 | 796,781 | How to call a function in more than one page in asp.net (C#)? | <p>I have three different .aspx pages (abc1.aspx,abc2.aspx,abc3.aspx). Now I want to call one function <code>func()</code> in three of them. I want to define the definition of a function only 1 time and call it on 3 different pages. </p>
| c# asp.net | [0, 9] |
5,417,303 | 5,417,304 | How to bind list inside a list to a GridView in ASP.NET | <p>I have a class named Student</p>
<pre><code>public class Student
{
public string Name { get; set; }
public List<int> Marks { get; set; }
public Student()
{
}
}
</code></pre>
<p>and I need to bind a list of Student to GridView</p>
<pre><code> List<Student> StudentList = new List<Student>();
Student stud = new Student();
stud.Name = "Scott";
List<int> marks = new List<int>();
marks.Add(10);
marks.Add(20);
marks.Add(30);
stud.Marks = marks;
StudentList.Add(stud);
Student stud1 = new Student();
stud1.Name = "Jon";
List<int> marks1 = new List<int>();
marks1.Add(10);
marks1.Add(20);
marks1.Add(30);
stud1.Marks = marks1;
StudentList.Add(stud1);
GridView1.DataSource = StudentList;
GridView1.DataBind();
</code></pre>
<p>The gridview shows the name field only. how I can show the list of marks also with name field. (In this all the students have same number of marks, means sometimes 3, or sometimes 5. etc.) </p>
<p>I need show gridview like this</p>
<pre><code>Name Mark1 Mark2 Mark3
Scott 10 20 30
Jon 10 20 30
</code></pre>
| c# asp.net | [0, 9] |
3,442,933 | 3,442,934 | problem with .attr() method for getting value of attributes of elements | <p>i have a string like this : </p>
<pre><code>string_data = "<option value='1'>ahmad</option><option value='2'>mohammad</option><option value='3'>ali</option>"
</code></pre>
<p>now i want get the value of value attribute of options and alert it. for this i write this : </p>
<pre><code>$(string_data).contents()
.each(function(){
value = $(this).attr('value');
text = $(this).text();
alert(value);
});
</code></pre>
<p>but this code return <strong>undefined</strong> for all of them .<br>
in Addition <strong>string_data</strong> is a string that i get it from a php script with Ajax via $.post() jQuery method.<br>
i am using jquery 1.6 .</p>
| javascript jquery | [3, 5] |
3,470,645 | 3,470,646 | Multiple Inheritance in Android/Java | <p>I need to connect my Android <code>Activity</code> with <code>SQLite</code> Database.</p>
<p>Now the problem is the <code>Class</code> for <code>Activity</code> will <code>extend</code> (inherit) <code>Activity</code> Class and for Database I need to inherit (<code>extend</code>) <code>SQLiteOpenHelper</code>, that is need to extend both classes at the same time.</p>
<p>So what should I do?</p>
| java android | [1, 4] |
1,809,244 | 1,809,245 | time picker in php | <p>please help me out regarding time in php. I want to make time selection for a website that offers their services at different time . I want to make it like a date picker calendar . I haven't find anything yet . i can make in drop down box but showing the 60 min drop down looks quite ugly . plz help me out regarding this .</p>
| php javascript | [2, 3] |
2,858,004 | 2,858,005 | C++ and python simultaneously. Is it doable | <p>I am totally new to programming as though I have my PhD as a molecular biologist for the last 10 years. Can someone please tell me: Would it be too hard to handle if I enrolled simultaneously in C++ and python? I am a full time employee too. Both courses start and finish on the same dates and is for 3 months. For a variety of complicated reasons, this fall is the only time I can learn both languages. Please advise.
GillingsT</p>
<p><strong>Update:</strong>
A little more detail about myself: as I said I did a PhD in Molecular Genetic. I now wish to be able to obtain programming skills so that I can apply it to do bioinformatics- like sequence manipulation and pathway analysis. I was told that Python is great for that but our course does not cover basics for beginners. I approached a Comp Sci Prof. who suggested that I learn C++ first before learning Python. So I got into this dilemma (added to other logistics).</p>
| c++ python | [6, 7] |
2,485,678 | 2,485,679 | From Python to Java | <p>I need to "translate" this code(in python) to Java. </p>
<pre><code>re.sub(r'<EM[^C]*(CATEG="[^"]+")[^>]*>', r'<\1>', text).replace(r'</EM>', '')
</code></pre>
<p>Thanks.</p>
| java python | [1, 7] |
1,897,588 | 1,897,589 | about android calendar | <pre><code>Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("beginTime",XXX);
intent.putExtra("allDay",false);
intent.putExtra("eventLocation",XXX);
intent.putExtra("description","XXX");
startActivity(intent);
</code></pre>
<p>When i load this application locally calendar showing in all mobiles . We uploaded application into Android market. But calendar not showing any of the android mobiles. </p>
<p>What's wrong?
Thanks in advance!!</p>
| java android | [1, 4] |
4,955,726 | 4,955,727 | Accessing key of an array on HTML check boxes | <p>I have a tree with checkboxes and their id has key for item and value as their value.</p>
<pre><code><input type="checkbox" name="list_code[4]" id="list_code[4]" value="AG12345678" checked="checked">
</code></pre>
<p>When users select a tree element I can access those by</p>
<pre><code>$('input[name^="list_code"]').each(function() {
if ($(this).attr('checked'))
list_code = $(this).val();
});
</code></pre>
<p>I am able to get value <code>AG12345678</code> but I need to get key value too which is <code>4</code> from list_code[4] in this case. How can I access that value? </p>
| javascript jquery | [3, 5] |
5,770,257 | 5,770,258 | how to fire both client side and server side validations at once? | <p>I have a textbox and I do CustomValidation which does client side and server side validations,
how do I fire both client side and server side validations at once? now server side validation fires only after client side validation.</p>
<p>is it possible?</p>
| c# asp.net | [0, 9] |
5,873,129 | 5,873,130 | Javascript function that reassigns itself | <p>How do I keep <code>accordions</code> from being initialized when the page loads... I'd like it only to be run from inside of a method (other than <code>init()</code> of course) but only when needed</p>
<pre><code>$.extend($.fn, {
accordion: function () {
var accordion = (function () {
var accordions = (function () {
alert('test');
return 1;
})();
return {
init: function (el) {
el.click(function (e) {
accordion.show(el);
});
},
show: function (el) {
console.log(accordions);
}
}
})();
this.each(function() {
accordion.init($(this));
});
}
});
</code></pre>
<p>I hope I've provided enough detail :-\</p>
| javascript jquery | [3, 5] |
3,499,542 | 3,499,543 | Getting difference of 1 day when date is sent from android application to php | <p>I am developing the android application in which persons can enter leave application.
Here users select the date from the Android Calendar and from this selected Date Epoch value is sent to php page on converting the epoch readable date format i get a difference of 1 Day.</p>
<p>As on php page i calculate the to date for the leave using the number of leave and from date but here i m getting the wrong value as from date on the php differs from the selected date on the android application.</p>
<p>Kindly help..</p>
| java php android | [1, 2, 4] |
4,413,838 | 4,413,839 | Visible window height instead of $(window).height; | <p>Is there any way to get the visible height of the whole page from inside an iframe , $(window).height() gives me iframes height ?</p>
<p>Thank you in advance.</p>
| javascript jquery | [3, 5] |
944,188 | 944,189 | Set MaxLength for dynamic <p> | <p>I have script which allows to display Bing search results. I can call for the search results url's like this:</p>
<pre><code>'<p class="width"><a href="' , imgResult.Url , '">',imgResult.DisplayUrl,'</a></p>' ,
</code></pre>
<p>The problem is that sometimes the url is to long an 'sloppy' like this:</p>
<pre class="lang-none prettyprint-override"><code>http://www.art-wallpaper.net/Game-Wallpapers/Assassins-Creed-Brotherhood/imagepages/image3.htm
</code></pre>
<p>I would like to 'hide' or 'delete' the beginning of the url (<code>http://www.</code>) and do the same from <code>/Game...</code> etc This way I can get a 'clean' and 'short' url like: <code>art-wallpaper.net</code> I there a (simple) way of doing this?</p>
| javascript jquery | [3, 5] |
4,667,174 | 4,667,175 | How to uncheck a check box on another check click and also set the control visibility to false | <p>I write the sample code to un-check a check box on another check box click. At the same time i would like to set the visibilty of control to false based on check or uncheck of check box here is what i have written</p>
<pre><code><form name="formName">
<input type="checkbox" name="priorityHigh"
onclick="if(this.checked) {document.formName.priorityLow.checked=false;}">High Priority
<input type="checkbox" name="priorityLow"
onclick="if(this.checked) {document.formName.priorityHigh.checked=false;}">Low Priority
<asp:TextBox ID="txtLastName" runat="server" visible=
"false">
</asp:TextBox>
<asp:TextBox ID="txtfirstName" runat="server" visible=
"false">
</asp:TextBox>
</form>
</code></pre>
<p>Now assume on first check box click i will have visibility of text box1 now on second check box click i would like to uncheck the first one and set the visibility of textbox1 to false and make the second one visible to true.</p>
<p>Any help please</p>
| javascript asp.net | [3, 9] |
4,923,396 | 4,923,397 | How can I attach an event when a certain class is added/removed to any tag? | <p>Let's suppose I have a css class named "foo".</p>
<p>I would like to have two event handlers:
- the first event handler would be triggered when "foo" is added as a class to any tag
- the second event handler would be triggered when "foo" is removed as a class from any tag</p>
<p>How can I achieve this?</p>
<p>Thank you in advance.</p>
| javascript jquery | [3, 5] |
3,770,397 | 3,770,398 | small calculation issue | <p>I have a small problem with a javascript calculation. I have a function like this:</p>
<pre><code>$( "#main-nav li[class]" ).each(function( index ) {
var position = $(this).offset();
var width = $(this).width();
var center = parseInt(position) - (parseInt(width) / 2);
console.log("Position: " + position.left + ", width: " + width + ", center: " + center);
});
</code></pre>
<p>But it results in this. Anyone have an idea how the calculation isn't done?</p>
<pre><code>Position: 722, width: 83, center: NaN
</code></pre>
| javascript jquery | [3, 5] |
1,052,375 | 1,052,376 | Problem with custom Jquery function (show/hide) | <p>Here is my Javascript:</p>
<pre><code><script type="text/javascript">
$(document).ready(function(){
function showhideitems(itemID){
if ($(itemID).css('display') == 'none')
{
$(itemID).show('slow');
} else {
$(itemID).hide('slow');
}
}
});
</script>
</code></pre>
<p>When I call the function using:</p>
<pre><code>`<a href="#" onClick="showhideitems('#players1')">`
</code></pre>
<p>It doesn't work (the div doesn't show/hide). What is wrong with the above function?</p>
| javascript jquery | [3, 5] |
2,787,560 | 2,787,561 | Get class name dynamically with jquery | <p>I am trying to get this class name dynamically in jquery:</p>
<pre><code>echo "<div id=\"maini\" class=\"type_" .$category. " start_" .$adSize. " color_" .$color. "\"> \n";
echo " " . $siteName . " \n";
echo "</div> \n";
</code></pre>
<p>as you can see the class name is generated with PHP.</p>
<p>I need the class name for this snippet of code. But what I tried does not work -> $("div." + this.id). :</p>
<pre><code> $(document).ready(function() {
maini_s = $("div." + this.id).remove();
num_of_arts = maini_s.length;
ipp = 3;
</code></pre>
<p>Here is the entire js file in case you need to see the other elements before.</p>
<pre><code>var maini_s;
var num_of_arts;
var ipp;
function handlePaginationClick(new_page_index, pagination_container) {
var pc = $(pagination_container);
pc.children('div#maini').remove();
for(var i=new_page_index*ipp; i < (new_page_index+1)*ipp ;i++) {
if (i < num_of_arts) {
pc.append(maini_s[i]);
}
}
return false;
}
$(document).ready(function() {
maini_s = $("div." + this.id).remove();
num_of_arts = maini_s.length;
ipp = 3;
// First Parameter: number of items
// Second Parameter: options object
$("#News-Pagination").pagination(11, {
items_per_page:ipp,
callback:handlePaginationClick
});
});
</code></pre>
| php jquery | [2, 5] |
735,890 | 735,891 | Subbing in Variables into Jquery | <p>I have the following jQuery script running on my page:</p>
<pre><code><script type="text/javascript" charset="utf-8" src="{{ STATIC_URL }}js/raty/js/jquery.raty.min.js"></script>
<script type ="text/javascript">
jQuery(document).ready(function($) {
$('.yourrating').each(function(index){
$(this).raty({
readOnly: false,
path: "{{ STATIC_URL }}js/raty/img/",
score: $(this).children("span:first").text(),
click: function(score, evt) {
var vote_url = "/spice/rate/" + this.attr('id').substring(2) + "/" + score + "/";
$.ajax({
url: vote_url,
success: function(){
alert('vote successful');
}
});
}
});
$('.thingrating').raty({
readOnly: true,
start: 2,
path: "{{ STATIC_URL }}js/raty/img/",
score: $(this).children("span:first").text(),
});
});
});
</script>
</code></pre>
<p>Right now, when the user clicks it's not recognizing the action and showing the pop-up, which tells me the variables are not being subbed in correctly. To confirm this, I changed <code>var vote_url</code> to a direct path <code>"spice/rate/1/2"</code> and this indeed worked properly.</p>
<p>This leads to two questions:</p>
<ol>
<li>How can I debug it to see which URL is being used (ie. the variables being subbed in?)</li>
<li>How can I correct this problem?</li>
</ol>
<p>Here is the relevant snipped of code from the template:</p>
<p><code><div class="yourrating" id="t_{{ item.id }}"><span style="display:none;">{{score}}</span></div></code></p>
| javascript jquery | [3, 5] |
5,613,522 | 5,613,523 | How can i get connected user id when using signleR | <p>I'm trying to get the connected user id in my signleR application but I didn't manage to find it. Is there any way to get it because I want when two users are chatting just the two of them will receive each other's messages and not the whole group they are connected to, or all clients connected to signleR hub. My main goal is to send private messages between two connected clients.</p>
<p>My code is so complicated but all I have found is how to broadcast my message to all the clients or to a specific group, but I couldn't manage to send a private message. I did this to send user typing message: </p>
<pre><code>public void UserTyping(string msg, int ToClient) { // display User is Typing Msg
Clients.Others.OtherUserIsTyping(msg, ToClient);
}
</code></pre>
<p>ClientSide: </p>
<pre><code>var keyPressCount = 0;
$("#<%=MsgToSend.ClientID %>").keypress(function () {
// Throttle the server call with some logic
// Don't want to call the server on every keypress
var ToClientID = $("#ToClientID").val();
if (keyPressCount++ % 10 == 0) {
chat.server.userTyping("Is typing...", ToClientID); // call the server side function
}
});
chat.client.OtherUserIsTyping = function (msg, ToClient) { // declare the function on the chat hub so the server can invoke it
$("#UserTyping").html(msg);
}
</code></pre>
| c# javascript | [0, 3] |
4,991,911 | 4,991,912 | cross-browser way of getting navigator.{browserLanguage, systemLanguage, userLanguage} | <p>Is </p>
<pre><code>var b = navigator.browserLanguage;
var sy = navigator.systemLanguage;
var u = navigator.userLanguage;
</code></pre>
<p>cross-browser and safe? Does JQuery have a better way of doing it?</p>
<p>One side question:-
What is safe?</p>
<pre><code> obj == null
obj === null
</code></pre>
<p>-Ajay</p>
| javascript jquery | [3, 5] |
4,592,944 | 4,592,945 | is it posible to call java class from javascript? | <p>I need to make some UI part in javascript for android application for that I'm writing some code in javascript and load it in android web view. Now, I want to call java class from javascript. </p>
<p>Is it possible to call java class from javascript?</p>
<p>Thanks in Advance!</p>
| java javascript android | [1, 3, 4] |
1,248,391 | 1,248,392 | Is it possible to attach an onclick event to specific coordinates in a document? | <p>I am wondering if it is possible to attach an onclick event to specific coordinates in a document. Maybe something similiar to "area coords" in an image map that would allow me to create a rectangular or circular area that when clicked on would execute some code. Been trying to find a solution all morning hope someone with better coding knowledge could clarify this for me.</p>
| javascript jquery | [3, 5] |
4,480,385 | 4,480,386 | CheckBox [Entering the index to database] | <p>Add a check box to the form and then how to insert respective value 1 if checked else 0 to the database where I have a field which is of type integer. </p>
| c# asp.net | [0, 9] |
5,087,941 | 5,087,942 | Access to hyperlink in listview in Itemtemplate | <p>I'm trying to access a <code>hyperlink</code> on my <code>listview</code>. When the user logs in,
the hyperlink will show on my homepage. It doesn't show.</p>
<pre><code>protected void lvtop6_ItemCommand(object sender, ListViewCommandEventArgs e)
{
ListView hlBuy = (ListView)lvtop6.FindControl("hlBuy");
if (User.Identity.IsAuthenticated==true)
{
hlBuy.Visible = true;
}
else
{
hlBuy.Visible = false;
}
}
</code></pre>
<p>Please somebody advise me to figure out what is wrong with my code behind</p>
| c# asp.net | [0, 9] |
3,490,297 | 3,490,298 | how to calculate page rendering time with or without any javascript or with multple javascript seperately | <p>how to calculate page rendering time with or without any javascript or with multiple JavaScript separately?</p>
<p>I want to know how much page will go slow if i use any javascript/jquery with plugin/ multiple javascript/jquery plugin files etc.?</p>
<p>javascript code in any form inline, in-page code, external file.</p>
| javascript jquery | [3, 5] |
1,943,968 | 1,943,969 | Pass value from one page to another using jQuery | <p>I have a simple script setup using jQuery to pass a value from one page to another. The value is stored in an array. When the link is clicked, the value of the array should be sent to the community.php page, but it's not working and I'm not sure how to pull the contents of the array on the community page, any advice?</p>
<p><strong>JQUERY</strong></p>
<pre><code>$("#subscribe_link").click(function () {
$.post("community.php", { 'choices[]': ["Jon", "Susan"] });
});
</code></pre>
<p><strong>PHP</strong></p>
<pre><code>print_r($choices);
</code></pre>
| php jquery | [2, 5] |
5,881,667 | 5,881,668 | Uncaught TypeError: Object #<HTML Document> has no method 'ready' | <p>I'm trying to implement a simple javascript into a website (website is on weebly), and I'm getting this error.
In the resources tab on chrome I can see it's loading all of the scripts.
Here's a piece of code:</p>
<pre><code><script type="text/javascript" src="/files/theme/cufon-yui.js"></script>
<script type="text/javascript" src="/files/theme/cufon-yanone-250.js"></script>
<script type="text/javascript" src="/files/theme/script.js"></script>
<script type="text/javascript" src="/files/theme/coin-slider.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#coin-slider').coinslider();
});
</script>
</code></pre>
<p>That's all fitted on the bottom of the .html file. It's a coin slider gallery.</p>
<p>Anyone out to help me ?</p>
<hr>
<p><em>From comment...</em></p>
<p>I am loading jQuery in the <code><head></code>...</p>
<pre><code><script src="ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"; type="text/javascript"></script>`
</code></pre>
| javascript jquery | [3, 5] |
642,713 | 642,714 | How to ignore "remote" validation for an input field using jQuery validation plugin | <p>I am trying to ignore a "remote" validation property for a form using jQuery validation plugin, so I can enable it when the form is submitted instead of an onBlur of a field. I have the following code, but am getting a syntax error. How can I fix it?</p>
<pre><code>$(document).ready(function()
{
$("#checkNameForm").validate( {
"onkeyup":false,
"rules":{
"Name":{
"required":true,
"minlength":5,
"maxlength":10,
"remote":"\/abc\/def\/checkname"
}
},
"messages":{
"Name":{
"required":"Please enter a Name.",
"remote":"Name is already in use."
}
},
"ignore":"input[
remote
] ",
success:function(label) {
label.addClass("success");
},
"validClass":"success"
} );
});
</code></pre>
| javascript jquery | [3, 5] |
4,814,832 | 4,814,833 | Minimize jQuery Function | <p>I have a function that adds change events for form items based on the row name(uses the database to get these).</p>
<p>Heres the current function:</p>
<pre><code> $sql = "SELECT * FROM product WHERE storeno = '1' ORDER BY descript";
$result = mssql_query($sql, $msConnection);
if ($result && mssql_num_rows($result) > 0) {
while ($row = mssql_fetch_object($result)) {
$sku = trim($row->mas90sku);
$JQueryReadyScripts .= "
$('#newCount_" . $sku . "_row .cases').change(function() {
var count = 0;
$('#newCount_" . $sku . "_row .cases').each(function () {
count += parseFloat($(this).val());
});
$('#cases_total_" . $sku . "').text(count);
});
$('#newCount_" . $sku . "_row .units').change(function() {
var count = 0;
$('#newCount_" . $sku . "_row .units').each(function () {
count += parseFloat($(this).val());
});
$('#units_total_" . $sku . "').text(count);
});";
}
mssql_free_result($result);
}
</code></pre>
<p>How can I consolidate this into a call that affects every row so that I can get rid of the DB portion and have just 2 pieces (or 1) of code instead of 2 for every row.</p>
| php javascript jquery | [2, 3, 5] |
2,656,024 | 2,656,025 | Intent new Instance private variable | <p>when I use
<code>intentMap.putExtra ("id", id). addFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP)</code> -
I have a new instance of my class IntentMap and lose all the private variables.</p>
<pre><code>public class MapaActivity extends MapActivity {
...
private ArrayList<Wplatomat> list; //null
@Override
public void onCreate(Bundle savedInstanceState) {...}
...
}
</code></pre>
<p>Can I use the same instance always?
I do not want every time to send my list //ArrayList//</p>
| java android | [1, 4] |
4,524,889 | 4,524,890 | Add character(s) to value | <p>I have a Table, TextArea and Button, when a user type in the Textarea such as " Hello World! " and then clicks on the button I want the text to become " Hello World! (*) ".</p>
<p>How can I do that with this Jquery code that I'm using:</p>
<pre><code>$(document).ready(function () {
$('#Button').click(function () {
if ($("#MyTextArea").val().indexOf('|') > -1) {
alert("The box has special characters. \nThese are not allowed.\n");
} else {
if ($.trim($("#MyTextArea").val()).length > 0) {
$('#MyTable tbody').append(
$('<tr/>', {
click: function () {
$(this).remove()
},
html: $("<td />", {
html: $("#MyTextArea").val(),
'data-sharp-id': 8
})
}));
return false;
}
}
});
});
</code></pre>
| javascript jquery | [3, 5] |
3,090,057 | 3,090,058 | Which is better: Jquery.animate() or css transitions with setTimeOut | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/10863000/is-it-better-to-use-jquery-fadein-or-css3-animations">Is it better to use jQuery fadeIn or CSS3 animations?</a><br>
<a href="http://stackoverflow.com/questions/10984771/whats-faster-css3-transitions-or-jquery-animations">what’s faster? CSS3 transitions or jQuery animations?</a> </p>
</blockquote>
<p>I am trying to do an animation and speed is of an essence. I have tried two methods both of which work, however I would like to know which one is more effective. </p>
<p>Method 1: Using Jquery.animate()
My code looks something like:</p>
<pre><code>$("div").animate({opacity: "show"}, 100, "linear", function() {
console.log("Animation Complete");
});
</code></pre>
<p>Method 2: Using Css transitions with setTimeOut:
This is what the code looks like:</p>
<pre><code>$("div").addClass("hidden") //On Page load
</code></pre>
<p>Then to animate the fade in:</p>
<pre><code>setTimeout(function () {
$("div").removeClass('hidden');
}, 100);
</code></pre>
<p>Hidden has the following style property:</p>
<pre><code>.hidden { opacity: 0 !important; }
</code></pre>
<p>Both work rather well, but I want to know which one is more efficient/better.</p>
| javascript jquery | [3, 5] |
2,334,308 | 2,334,309 | Simple jQuery but can't get it working | <p>So the following code:</p>
<pre><code>$product_id = $(this).parent().parent().html();
</code></pre>
<p>Produces this:</p>
<pre><code><div class="right">
<input value="6" name="quantity" id="" maxlength="2" type="text">
<label> Places required</label>
<p class="btn update">Update</p>
<input name="product_id" value="2" class="product_id" type="hidden">
<p class="btn remove">Remove from basket</p>
</div>
<a href="/product//"><img src="http://dummyimage.com/100x100/333/eee" alt="" class="border-thick shadow"></a>
<div class="left">
<h5>Title</h5>
<select name="courses_details_id">
<option value="">Select date/venue...</option>
<option value="6">10 Oct 2011 - Chicago, USA</option>
<option value="4">13 Oct 2011 - Hastings</option>
<option value="2">18 Nov 2011 - Paris, France</option>
</select>
<br>
<p class="price"><span class="small">From</span> £77.88</p>
</div>
</code></pre>
<p>And I simply want to get the value for product_id, so this makes sense:</p>
<pre><code>$('#basket li form select[name=courses_details_id]').change( function(){
$(this).parent().parent().children("input[name$=product_id]").val();
});
</code></pre>
<p>but it returns a value of undefined</p>
| javascript jquery | [3, 5] |
3,934,379 | 3,934,380 | Get position of selected elements, not index of element in DOM | <pre><code><div>
<h3>Heading one</h3>
<h3>Heading two</h3>
<h4>heading caption</h4>
<h3>Heading three</h3>
</div>
</code></pre>
<p>I want to get the position of the element within the jQuery selection, rather than it's index in the DOM.</p>
<p>At the moment, if I <code>alert($("h3").eq(2).index());</code> I'll get '3' - I want '2'.</p>
<p><a href="http://jsfiddle.net/4QmEF/" rel="nofollow">http://jsfiddle.net/4QmEF/</a></p>
| javascript jquery | [3, 5] |
2,325,025 | 2,325,026 | asp.net jquery newbie question | <p>I have a webform that contains a file upload button.</p>
<p>when I click on the button to upload the file, the C# code behind contains some code in the event handler that I want to execute <em>first</em> before jquery executes.</p>
<pre><code><script>
$(document.ready() {
$('.uploadButton').click(function() {
// do some additional processing *AFTER* code behind stuff executes
});
}
</script>
// In my ASP.NET C# code behind
protected void uploadButton_Click(object sender, EventArgs e)
{
// Code to fire off here *FIRST* before jquery executes
}
</code></pre>
<p>Is something like this possible? I know I can implement a jquery post in my javascript, but since I have most of the code already laid out (and am changing this on a client request), I was just wondering if something like this was possible.</p>
| javascript jquery asp.net | [3, 5, 9] |
1,597,914 | 1,597,915 | Converting a javascript function to pass in an object | <p>I have this javascript which is working great - </p>
<pre><code>var employeename = $("#employeename");
var employeenameInfo = $("#employeenameInfo");
employeename.blur(validateEmployeename);
function validateEmployeename(){
//if it's NOT valid
if(employeename.val().length < 4){
employeename.addClass("error");
employeenameInfo.text("We want names with more than 3 letters!");
employeenameInfo.addClass("error");
return false;
}
//if it's valid
else{
employeename.removeClass("error");
employeenameInfo.text("Full Name.");
employeenameInfo.removeClass("error");
return true;
}
}
</code></pre>
<p>However instead of having a big list of this functions for all my different fields I want to pass a field in e.g.</p>
<pre><code>function validateGeneric(field){
</code></pre>
<p>However whatever I try just gives me errors and I'm really stuck. Any help appreciated. This also brings up another problem with the info field, any way I can store the orginal text and just restore that instead of a new string?</p>
| javascript jquery | [3, 5] |
1,755,757 | 1,755,758 | Javascript / jQuery - Full Page Slider | <p>I'm looking for some sort of solution/plugin to make it so that I can take full page content, and slide it in from the left or right. </p>
| javascript jquery | [3, 5] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.