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 |
---|---|---|---|---|---|
6,025,300 | 6,025,301 | Jquery selected tab | <p>I wanna get selected id from my tabs. I tried anything but but I am very weak in javascript. This my tabs. </p>
<pre><code><li><a href="#tab" class="days" id="day_1">Pondelok</a></li>
<li><a href="#tab" class="days" id="day_2">Utorok</a></li>
<li><a href="#tab" class="days" id="day_3">Streda</a></li>
<li><a href="#tab" class="days" id="day_4">Štvrtok</a></li>
<li><a href="#tab" class="days" id="day_5">Piatok</a></li>
<li><a href="#tab" class="days" id="day_6">Sobota</a></li>
<li><a href="#tab" class="days" id="day_7">Nedeľa</a></li>
</code></pre>
<p>This is my attempt, which return undefined.</p>
<pre><code><script>
var selected_tab = $(".ui-state-active").attr("id");
document.write(selected_tab);
</script>
</code></pre>
| javascript jquery | [3, 5] |
4,122,373 | 4,122,374 | Modify JavaScript to use ASCII character or image instead of text | <p>I have a DIV that expands or collapses when clicked. There is a + sign to indicates it expands, which changes to a - sign to indicate you can collapse it. Instead of the + and - sign, I want to use up and down arrows.</p>
<p>jsfiddle here: <a href="http://jsfiddle.net/9PzRr/" rel="nofollow">http://jsfiddle.net/9PzRr/</a></p>
<p>I changed the .text to .html and plugged in the unicode values for the up/down arrows in place of the + and - symbols, but only the down arrow would show. I'm open to using an image instead of the ASCII characters, but I am not familiar enough with Javascript/jQuery to know how to tell it to display an image instead of text.</p>
<p>Thanks for any help.</p>
| javascript jquery | [3, 5] |
2,151,279 | 2,151,280 | multiple dropdown lists validation using javascript/jquery | <p>I have five (5) individual dropdown lists on my web page.</p>
<ol>
<li>cities</li>
<li>iptypes </li>
<li>purposes</li>
<li>billings</li>
<li>protocols</li>
</ol>
<p>I want to validate that user must have at-least to select any one [ drop down list ] of them [ from 5 dropdowns ] to proceed next </p>
| javascript jquery | [3, 5] |
3,219,844 | 3,219,845 | How to determine who uploaded file | <p>I have a system that allows users to upload .doc files..I'm using PHP and renaming these files the memberid.doc so that I can determine which user uploaded that file and give him the option to delete that file. I would like to keep the file name the same though. Is there any way I can do this and still track which user uploaded that file?</p>
| php javascript | [2, 3] |
2,193,248 | 2,193,249 | Serious Problem with special characters and multi-languages | <p>I created a simple comment wall that submits using ajax.</p>
<p>Using javascript i collect user input:</p>
<pre><code>var sharetxt = encodeURIComponent(document.getElementById("cw_share_txt").value);
</code></pre>
<p>then pass it to a php page, on the php page, i collect the passed data:</p>
<pre><code>$text=nl2br(htmlentities(trim(utf8_decode($_POST["txt"]))));
</code></pre>
<p>Encoding of the php page above:</p>
<pre><code>header("Content-Type: text/xml; charset=utf-8");
</code></pre>
<p>My problem is that </p>
<ol>
<li><p>the wall doesnt still support multi languages (displays as ???? and causes my xml not to work)</p></li>
<li><p>i still problems with some special characters (displays as � or ?)</p></li>
</ol>
<p><strong>What am i not doing right? please assist</strong></p>
| php javascript | [2, 3] |
807,522 | 807,523 | How to create loading popup which stay 5 seconds | <p>Can somebody help me how to create on function <code>loading()</code> ( I have<code><div id="l" onclick="loading"></div></code>) to show popup with loading gif for 5 seconds (like <a href="http://www.queness.com/resources/html/modal/jquery-modal-window.html" rel="nofollow">http://www.queness.com/resources/html/modal/jquery-modal-window.html</a> Simple Modal Window</p>
| javascript jquery | [3, 5] |
1,058,206 | 1,058,207 | Is JavaScript allowed to call a remote web page during a click event? | <p>When viewing the click in firebug, the call turns red (i.e. error) but I can't see the error because the page redirects.</p>
<p><strong>So is it allowed to call a remote website (in my case, its a 1x1 image using a standard url like <a href="http://www.example.com/becon" rel="nofollow">http://www.example.com/becon</a>).</strong></p>
| asp.net javascript jquery | [9, 3, 5] |
1,048,832 | 1,048,833 | Show once popup | <p>Say I wanted to create a popup for my website that only showed once (if the user either filled it out or clicked the "do not display again" button), how would I do so. I am creating the popup and form using javascript and html, passing it in php to a database.</p>
| php javascript | [2, 3] |
4,471,064 | 4,471,065 | Testing function that creates a list of DOM components | <p>I have a function which creates an Array of components. Each component is an outer div with a few inner divs.</p>
<pre><code>function createDivs(quizQuestions) {
var returnElements = new Array();
$.each(quizQuestions.questions, function(i, val){
// create the div.
quizDiv = $('<div class="questionContainer radius">')
questionDiv = $('<div class="question"><b><span>QuestionText</span></b></div>');
quizDiv.append(questionDiv);
// Now change the question div text.
questionDiv.text = val.question;
answerDiv = $('<div class="answers">');
// ...
// ...
// Now the answers.
questionDiv.append(answerDiv);
returnElements[i] = quizDiv;
});
return returnElements;
</code></pre>
<p>I pass JSON such as:</p>
<pre><code> {questions:[{"question":"Name the best Rugby team?",
"answers":["Leinster", "Munster", "Ulster", "Connaught"],
"correct_answer":"Leinster"},
{"question":"Name the best DJ?",
"answers":["Warren K", "Pressure", "Digweed", "Sasha"],
"correct_answer":"Leinster"}]};
</code></pre>
<p>I'd like to write a simpe unit test so that I could test the array of div returned made sense</p>
<p>Any tips?</p>
<p>Also, are my better to return a DOM component or just text? The latter would be easier to test.</p>
<p>Thanks.</p>
| javascript jquery | [3, 5] |
4,637,118 | 4,637,119 | how to pick up string inside a <li> tag using jquery | <p>I've a simple list and a form text-field:</p>
<pre><code><ul>
<li class="item">one</li>
<li class="item">two</li>
<li class="item">three</li>
<li class="item">four</li>
</ul>
<input id="field" type="text" />
</code></pre>
<p>When the user clicks on an <code><li></code> item, I want the string inside the li element to be assigned the value of the input field.</p>
<p>Something like:</p>
<pre><code>$('.item').click( function(){
$('#field').val(/*put the string inside the li element just clicked*/);
});
</code></pre>
<p>So how do I get the string in the <code>li</code> element?</p>
| javascript jquery | [3, 5] |
5,297,931 | 5,297,932 | how to make iphone app in c# | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/8126248/is-there-a-way-to-make-applications-in-c-sharp-for-iphone">Is there a way to make applications in C# for iphone</a> </p>
</blockquote>
<p>Are there ways to create iPhone apps in C#? If so, what are they? I want to know if there are other ways of making iPhone apps that don't involve me buying a mac. </p>
| c# iphone | [0, 8] |
1,360,110 | 1,360,111 | How can I populate a javascript array with values from a database using PHP? | <p>I have to create a javascript array whose elements are fetched by php from a database. Is it possible? If so, how?</p>
<p><em>(I dont want to use ajax to do that)</em></p>
| php javascript | [2, 3] |
4,340,484 | 4,340,485 | Selected text event trigger in Javascript | <p>It may sound a newbie question but I wanted to know how I can trigger a custom JavaScript function when someone selects a given text fragment on a page using mouse. Also is there any way to find the position of selected text on the webpage?</p>
<p>Update:
To be more clear, text fragment can be part of a sentence or a word or a phrase or whole a paragraph.</p>
| javascript jquery | [3, 5] |
3,419,856 | 3,419,857 | Javascript ASP>NET get siblings/neighbours | <p>I have a gridview and i have text boxes and uneditable text fields in each row.
For the textbox that I have ...I have an onblur function...
I generate these textboxes from the server as follows </p>
<pre><code> "<input type=text name=\"txtPrice\" id=\"txtPrice_{0}\" value=\"{1}\" maxlength=\"10 \" runat=\"server\" class=\"g1 g2\" style=\"width:71px;\" onblur=\"javascript:myfun(this);\" />");
</code></pre>
<p>For each text box that I have in the row I want to get its neigbouring labels/txtboxes by using javascript
Remeber I cannot pass values rather I want to pass the textbox object just like I am doing in the above code</p>
<p>IMPORTANT:I dont know weather the label will be its direct neighbour...i want to get the neighbour using the coulmn name/header text</p>
<p>Or if I can pass the complete row to Javascript from the server side??</p>
<p>Thanks</p>
| javascript asp.net | [3, 9] |
4,055,073 | 4,055,074 | trying to get focus to end of textarea after creating a dynamic value with jquery | <p>Here is my javascript:</p>
<pre><code>$(document).ready(function(){
$(".reply").click(function(){
var replyId = $(this).attr("id");
$("textarea[name='comment']").val("<reply:"+replyId+">");
$("textarea[name='comment']").ready(function(){
moveCursorToEnd($(this));
});
});
});
function moveCursorToEnd(el) {
if (typeof el.selectionStart == "number") {
el.selectionStart = el.selectionEnd = el.value.length;
} else if (typeof el.createTextRange != "undefined") {
el.focus();
var range = el.createTextRange();
range.collapse(false);
range.select();
}
}
</code></pre>
<p>I am somewhat new to functions with javascript however this does not seem to work It will put the value in but not focus to the textarea. I am sure I am doing something very dumb, any ideas?</p>
| javascript jquery | [3, 5] |
1,881,246 | 1,881,247 | Still confused about $'s before variables in javascript / jquery | <p>In my previous <a href="http://stackoverflow.com/questions/10443463/do-i-need-to-put-a-dollar-before-variable-names-with-javascript">question</a> a poster suggested the following:</p>
<pre><code>var formSubmitHandler = function (link, form) {
var $form = $(form);
var val = $form.valid();
var action = $form.data('action');
var entity = $form.data('entity');
</code></pre>
<p>I understand now that the $ before is used to show the variable is a jQuery object. My question is Why do I need the line "var $form = $(form)" ? Could I not just have $form = form?</p>
| javascript jquery | [3, 5] |
794,666 | 794,667 | MultiViewControl issues | <p>I'm presently in the process of reworking a MultiViewControl based wizard process for our web application. I am having an rough time trying to make sense of the order that events are happening (Page_Load, Init, prerender, etc). Does anyone out there on the interwebs have details on dealing with one of these controls? Please don't just say 'google' it. I've done that and have yet to find a good, comprehensive site yet.</p>
<p>Admittedly, I haven't really elaborated on the problems I'm having with this control, so I'll try to do that:</p>
<ol>
<li>Primary problem is the initialization of UserControls that live in different Views. In the existing codebase, the programmer was using a combination of multiviewcontrol.ActiveViewIndex = WHATEVER and Response.Redirect("PageWithMultiView.aspx?nextstep") and it made it all very convoluted. My task is to attempt to remove the Response.Redirect calls and use only the setting of the ActiveViewIndex. Is this even possible? Also, there are some cases where I need to initialize a control in a particular view only on the initial load and not on subsequent postbacks. I can use something like the IsPostBack flag but this is only ever set to false on the initial load. Subsequent reloads IsPostBack == true. I basically want to have IsPostBack set to false for the initial load of each View. Can this be done without doing a Response.Redirect to itself?</li>
</ol>
<p>Hopefully this will make some sense to someone out there.</p>
<p>Thanks.
Greg.</p>
| c# asp.net | [0, 9] |
3,590,336 | 3,590,337 | Is it possible to read data from a local port using Javascript or ASP.NET? | <p><strong>I written the following to broadcast a data in a Windows Application using C#</strong> </p>
<pre><code> UdpClient server = new UdpClient("127.0.0.1", 9050);
string welcome = "Hello, are you there?";
data = Encoding.ASCII.GetBytes(welcome);
server.Send(data, data.Length);
</code></pre>
<p><strong>But, How can I read the same data by a web application using javascript or asp.net?</strong></p>
| javascript asp.net | [3, 9] |
144,243 | 144,244 | jQuery .contains(+number+) | <p>it's been a long day and I think I just have code blindness but..</p>
<p>Trying to figure out if an element contains a number, do something to another element.</p>
<pre><code>result_val = 9;
$(".result").contains("+result_val+") (function() {
$(".parag").css("color", "#eee");
});
</code></pre>
<p>Maybe I'm taking the wrong approach? But there is no effect on the <code>.parag</code> div.</p>
<p><a href="http://jsfiddle.net/xzeCq/" rel="nofollow">http://jsfiddle.net/xzeCq/</a></p>
| javascript jquery | [3, 5] |
2,783,787 | 2,783,788 | Easy question on a jQuery script | <p>I have the following think.</p>
<p>When a user types a number bigger than 10 then there is a message appeared. How to remove this message let's say after 2 seconds ?</p>
<p>Also if you type a number let's say 8 and hit the backspace, there is a 0 appeared. How to have number 1 appeared in the textbox from the beginning but also any time that the user hits backstage to delete his choice like my example above? I tried to add <code>value="1"</code> into the textbox but it does not show the result in the div from the beginning.</p>
<p>Thank you for your help</p>
<p>UPDATE
I had a small problem with the fiddle, I updated it</p>
| javascript jquery | [3, 5] |
3,197,785 | 3,197,786 | How to create rotating tag cloud in jQuery | <p>I cannot explain the functionality actually. I want to rotate the links in spheric form. Visit this <a href="http://www.chemicalformula.org/" rel="nofollow">http://www.chemicalformula.org/</a>. On this site, see the region "Chemical formulas" in middle-left of the page, where links are rotating in spheric, circular form. I want this functionality using jQuery / jQuery in ASP.net application. Can I achieve this ?</p>
| jquery asp.net | [5, 9] |
4,916,673 | 4,916,674 | IOException: Broken pipe when running Android application | <p>When trying to run my Android app from Eclipse I get this error in the console:</p>
<pre><code> [2013-03-04 14:19:05 - ddmlib] Broken pipe
java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:89)
at sun.nio.ch.IOUtil.write(IOUtil.java:60)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:450)
at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213)
at com.android.ddmlib.Client.sendAndConsume(Client.java:605)
at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:348)
at com.android.ddmlib.Client.requestAllocationStatus(Client.java:451)
at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:837)
at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:805)
at com.android.ddmlib.DeviceMonitor.processIncomingJdwpData(DeviceMonitor.java:765)
at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:652)
at com.android.ddmlib.DeviceMonitor.access$100(DeviceMonitor.java:44)
at com.android.ddmlib.DeviceMonitor$3.run(DeviceMonitor.java:580)
</code></pre>
<p>How do I fix this kind of error? </p>
<p>When I did <code>adb connect <IP_ADDRESS></code> it showed connected to 192.168.0.109:5555</p>
| java android | [1, 4] |
2,787,601 | 2,787,602 | Creating a .NET page to embed other .NET pages | <p>I have created certain functionalities for an application. These functionalities include -
1.)ADD USER
2.)EDIT USER
3.)DELETE USER and so on</p>
<p>Now I have written all these in seperate pages. So when i have to delete a user i go to USER_DELETE.aspx page to do that.
My new requirement is that there should be a single page from which all these can be done. Being more specific, I want that there should be seperate panels in a page called "USER_MANAGER". Each panel will have the required functionality.
Is there a way i can do this by just creating the new UI of the USER_MANAGER page and calling the other pages (as USer Controls or any other easier way) into the UI of USER_MANAGER.
I dont want to do any changes to the existing pages for various functions. I hope the question is clear, I am a bit novice in this technology so i am not really sure.</p>
<p>Thanks and regards</p>
| c# asp.net | [0, 9] |
3,206,361 | 3,206,362 | TopDesk overview | <p>I'm creating a overview of TopDesk. I've wanted to ask some of you what the best way would be to get this done.</p>
<p>At the end the application will be set on a big screen so everyone could see how many topdesk calls we have.</p>
<p>I've thought of the following options:</p>
<ul>
<li>Web based. (PHP or ASP/.NET)</li>
<li>Java application</li>
</ul>
<p>Could someone get me started on this one?</p>
| java php asp.net | [1, 2, 9] |
3,200,937 | 3,200,938 | JavaScript: How do I debug in chrome to find out why this code doesn't work? | <p>How do I use the JavaScript console to see why this code:</p>
<pre><code>// Empty info
if ($('.perma-info').text() == '') {
$('.perma-info').remove();
}
</code></pre>
<p>Doesn't work in this page: <a href="http://dev-indiehaz.tumblr.com/post/22897976111/vans-vw" rel="nofollow">http://dev-indiehaz.tumblr.com/post/22897976111/vans-vw</a></p>
<p>I want it so that if the element is empty, I can remove it.</p>
| javascript jquery | [3, 5] |
1,669,579 | 1,669,580 | jquery: fire a function when a specific div loads? | <p>I want to fire a function when a specific div is load.<br>
by searching I found that <code>onload</code> is not functioning on div . </p>
<p>so I tried it by an image that work perfect But problem is that it fire the function only one time . for example when I refresh the page it fire the function but if I again refresh the page it can't fire the function again.. why is it happened ?</p>
<p><em>Any suggestion please</em> </p>
<p><strong>EDIT</strong></p>
<pre><code><div id="divID">
<img src="myimage.jpg" alt="image"/>
</div>
$('#divID').load(function() {
// code to function
});
</code></pre>
| javascript jquery | [3, 5] |
2,327,509 | 2,327,510 | How can I access the value after a # in a URL? | <blockquote>
<p><strong>Possible Duplicates:</strong><br>
<a href="http://stackoverflow.com/questions/1032242/how-to-obtain-anchor-part-of-url-after-in-php">How to obtain anchor part of URL after # in php</a><br>
<a href="http://stackoverflow.com/questions/484113/is-it-possible-to-access-anchors-in-a-querystring-via-php">Is it possible to access anchors in a querystring via PHP?</a> </p>
</blockquote>
<p>i need to find a way to do this, facebook does it so it has to be possible.... </p>
<p>If a user goes to this URL in the browser<br>
<a href="http://localhost/index.php?photos=p#" rel="nofollow">http://localhost/index.php?photos=p#</a><strong>12345</strong></p>
<p>Then I can have my PHP load a photo with the ID <strong>12345</strong> from mysql</p>
<p>If a user went to<br>
<a href="http://localhost/index.php?photos=p#" rel="nofollow">http://localhost/index.php?photos=p#</a><strong>123456</strong>
Then it would load a photo with id <strong>123456</strong></p>
<p>I just need help in getting the value in the URL after the <strong>#</strong> and accessing it with PHP if possible? IF it is not possible, then I maybe I can access it with jQuery and then make an AJAX call to load an image based on this value.</p>
<p>So does anyone know how I can get that value?</p>
| php javascript jquery | [2, 3, 5] |
746,395 | 746,396 | Basics of inertia in JavaScript | <p>I am looking to produce a draggable element with inertia when you move it. I am pretty new to JavaScript, looking for the basics of doing it. I would like to use a library like jquery ui for the drag n drop functionality then add inertia, I have done some as3 inertia but am wondering where to begin with JavaScript.</p>
| javascript jquery | [3, 5] |
4,751,380 | 4,751,381 | How do i delete a file? And file questions about limits? Java Android | <pre><code>FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_WORLD_READABLE);
fos.write(string.getBytes()
fos.close();
</code></pre>
<p>Above is how i write my files. Now is there a limit to it? i'm asking this because i set some text to it that i get from my text view, then later, when i get the text from that file, it isn't the full text.Secondly, how would i delete a file when using the above method?</p>
| java android | [1, 4] |
2,304,458 | 2,304,459 | Error with adding JQuery | <p>I added JQuery to my HTML file:</p>
<pre><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
</code></pre>
<p>Then I add a link to my JavaScript file:</p>
<pre><code><script src="public/javascripts/new_javascript.js" type="text/javascript"></script>
</code></pre>
<p>(I checked that this link work.)</p>
<p>In the file I do</p>
<pre><code>$(document).ready(function() {
alert("hey!");
});
</code></pre>
<p>But the Google Chrome developer tool shows an error:</p>
<pre><code>Uncaught TypeError: Object #<HTMLDocument> has no method 'ready'
</code></pre>
<p>How can it be an error?</p>
<p>I'm doing this in Rails, and the HTML is like:</p>
<pre><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="public/javascripts/prototype.js?1349898477" type="text/javascript"></script>
<script src="public/javascripts/effects.js?1349898477" type="text/javascript"></script>
<script src="public/javascripts/dragdrop.js?1349898477" type="text/javascript"></script>
<script src="public/javascripts/controls.js?1349898477" type="text/javascript"></script>
<script src="public/javascripts/rails.js?1349898477" type="text/javascript"></script>
<script src="public/javascripts/application.js?1349898477" type="text/javascript"></script>
<script src="public/javascripts/new_javascript.js?1351137775" type="text/javascript"></script>
</code></pre>
| javascript jquery | [3, 5] |
529,430 | 529,431 | Create a cookie with a non url encoded value using JQuery and the Cookie plugin | <p>I am creating a cookie on the client side and adding 3 string values in it separated by commas. The string have special characters. The problem is when I am fetching the value of the cookie in my code behind, the cookie has value as follows:-</p>
<pre><code>4%2CHealth%20Related%2C%2Fmysite%2FYourKB%2FHealth-Related
</code></pre>
<p>I want to get rid of these % signs and values.. Is replacing these characters the only way? How can I make my cookie not have these values and just simple text with some special characters?</p>
<p>edit 1</p>
<p>I am creating cookie like this now but still the problem persists. Please help me out.</p>
<p>$.cookie('MyCookie', unescape(myString), { path: '/' }, { expires: 30 });</p>
| c# javascript jquery asp.net | [0, 3, 5, 9] |
1,953,425 | 1,953,426 | changing the index positioning in InputStream | <p>I have a binary file which contains keys and after every key there is an image associated with it. I want to jump off different keys but could not find any method which changes the index positioning in input stream. I have seen the <code>mark()</code> method but it does not jump on different places.</p>
<p>Does anybody have any idea how to do that?</p>
| java android | [1, 4] |
1,715,120 | 1,715,121 | Dropdownmenu SELECTED value as per value return fromDB | <p>All i am trying to do is to set the selected value of drop down menu according to the particular value returned from the database</p>
<p>like if person saved his gender as 'Male' and he wants to update his profile then the selected option shown on the Gender's dropdown llist should be
shown as Male
cause if this doesn't happen 'Poor guy becomes a female due to this small problem in my code'
KINDLY HELP!!!!!!!</p>
<p>MY Current Code:</p>
<pre><code><select name="Gender" id="Gender">
<option selected="selected"><?php echo $row_Recordset1['Gender']; ?></option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</code></pre>
<p>The above code work fine but causes repitition of values in dropdown like
Male
Male
Female</p>
| php javascript | [2, 3] |
2,996,415 | 2,996,416 | Understanding the Google specification for crawlable ajax | <p>Im using dotnet c#, and jQuery plus webservices for ajax calls. My paginations works like twitter and facebook paginations. In the onload event, a ajax call fill a content area with 10 rows, and a click or a roll the page down event call the same ajax call, with a page parameter, that brings more 10 rows, and so on. I dont have a canonical pagination for non javascript users. I read the Google specification about crawlable ajax, but Im not sure how to convert my model to the google new model. </p>
<p>First of all, I use jQuery ajax post, using json format. So its possible to create a aspx page that read a URL like <code>http://www.domain.com/search.aspx?_escaped_fragment_=somevalue</code> and use the _escaped_fragment_ value to return content. But, somehow I have to propagate this page link to the google crawler <code>http://www.domain.com/search.aspx#!somevalue</code>. Is this ok?</p>
<p>Ok! But when the Google Crawler access my paginations, the crawler will not see any link to <a href="http://www.domain.com/search.aspx#!1" rel="nofollow">http://www.domain.com/search.aspx#!1</a>, unless I point it in the sitemap, and it makes no sense to me. Im in a big mess. Can someone give me a tip?</p>
| c# asp.net | [0, 9] |
5,220,140 | 5,220,141 | How to encapsulate definitions into a class? (Use const and then scope it) | <p>All my PHP files conform to class.className.php as a naming conventoin. So I put all my definitions in a class called class.Configure.php like below. Is there a best practice way to put this in an acutal class. Consistency makes it easier for me to manage my code. </p>
<p>This is the only "loose" code I have in my library.</p>
<p>I guess the actual question is should I put this code in a class? I would like to unless I'm breaking some sort of best practice.</p>
<p>Also in C++ the preprocessor comes through and replaces all you #defines with the actual values before compilation. So I atleast undertand the concept of definitions in C++..they are simple text substitutions before compilation.</p>
<p>Is it the sameway in PHP?</p>
| php c++ | [2, 6] |
1,324,701 | 1,324,702 | jQuery fixed content that scrolls if larger than view | <p>This is hard to explain but if you go here: <a href="https://developers.facebook.com/docs/reference/api/" rel="nofollow">https://developers.facebook.com/docs/reference/api/</a></p>
<p>You will see that BOTH the sidebar and header are fixed but because the height of the sidebar may be larger than the viewport it scrolls slightly until the user has been able to view all of it and then becomes fixed again.</p>
<p>My question is how could I do something like this with jQuery? I have built similar things using just CSS but would like to overcome the problem with the sidebar.</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
3,943,254 | 3,943,255 | Evaluate in Jquery | <p>Just wondering if its possible to convert the following to an IF statement in Javascript:</p>
<pre><code>$('.Nav table tr:has(table.navheader) + tr:has(table.navitem)').addClass('linksbelow');
</code></pre>
<p>Example:</p>
<pre><code>IF $('.Nav table tr:has(table.navheader) + tr:has(table.navitem)').addClass('linksbelow'); = **TRUE** (
$('.Nav table .navheader').addClass('linksbelow');
)
**ELSE** (
$('.Nav table .navheader').addClass('Nolinksbelow');
</code></pre>
| javascript jquery | [3, 5] |
4,054,035 | 4,054,036 | Use jQuery to load a url on change of table with many input fields | <p>I have tabled data in which most of the cells are text inputs or text areas.</p>
<p>Each cell is named with the row, then the column such as </p>
<pre><code><input type=text name=4_16>
</code></pre>
<p>where 4 is the row, underscore the divider, and 16 the column number</p>
<p>I have this javascript (using jquery)...</p>
<pre><code> $(document).ready(function() {
$('#parent').change(function() {
$('#subcats').load('updatecell.php','value=' + $(this).val());
return false;
});
});
</code></pre>
<p>from another project. How can i modify the above to work dynamically with each cell? I will need to send the input's name (coords), and the updated value (value) to the updatecell.php. I can use name, id, or class to identify the input names if need be.</p>
| javascript jquery | [3, 5] |
3,624,525 | 3,624,526 | jQuery date picker to have date format as default value | <p>I'm using this plugin for a date picker. </p>
<p><a href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePicker.html" rel="nofollow">http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePicker.html</a></p>
<p>I need to have the default value of the text box be mm/dd/yyyy (kinda like value="mm/dd/yyyy"). </p>
<p>So when I click on the field or calendar icon, the default value goes away and the date picker appears for me to pick the date.</p>
<p>Any ideas?</p>
| javascript jquery | [3, 5] |
666,147 | 666,148 | What is the purpose of "self.each(callback, array)" in the jQuery source code? | <p>jQuery's <code>.each</code> function takes exactly one argument- a function. And yet, In this piece of jQuery code, we see the following:</p>
<pre><code>if ( callback ) {
self.each( callback, [ responseText, status, jqXHR ] );
}
</code></pre>
<p>Two args are being passed to <code>.each</code>. I'm assuming the values in brackets are params to the callback function, but I'm not clear on why this is possible and why someone would do this rather than calling the function directly? :</p>
<pre><code>if ( callback ) {
self.each( callback(responseText, status, jqXHR) );
}
</code></pre>
| javascript jquery | [3, 5] |
782,492 | 782,493 | pass a js variable to a php variable | <p>I have a javascript value given by google maps and i need i to save it in a mysql database.</p>
<p>Actually i have the variable </p>
<pre><code><script>
...
var lugar = results[0].geometry.location;// this gives me a latitud, longitud value, like: -34.397, 150.644
...
</script>
</code></pre>
<p>and i need to pass thar variable to the php variable lugar</p>
<pre><code><?
$lugar= ?????
?>
</code></pre>
| php javascript | [2, 3] |
3,177,681 | 3,177,682 | Is this a good use for a static class? | <p>I have a read only list that is shared across all instances of the application and won't change very often. Is it good practice to make a property on a static class to access this list? the list is filled from the database in the static constructor. Setting the app pool to recycle every night would guarantee the list would be up to date every day correct? Are there any reasons this is a bad idea? Thanks!</p>
| c# asp.net | [0, 9] |
5,467,815 | 5,467,816 | change order of object in row of listview programmaticaly | <p>currently i have:</p>
<pre><code> <TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="15:22:33 \nApr 13 1999"
android:textColor="#FFFFFFFF"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dip"
android:background="@drawable/incoming_message_buble"
android:paddingLeft="10dip"
android:text="Hello bubbles!"
android:textColor="@android:color/primary_text_light" />
</code></pre>
<p>and it work fine.</p>
<p>here is adapter code:</p>
<pre><code>public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
if (row == null) {
LayoutInflater inflater = (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(R.layout.activity_sms_row_layout, parent, false);
}
wrapper = (LinearLayout) row.findViewById(R.id.wrapper);
OneComment coment = getItem(position);
countryName = (TextView) row.findViewById(R.id.comment);
countryName.setText(coment.comment);
countryName.setBackgroundResource(coment.left ? R.drawable.incoming_message_buble : R.drawable.outgoing_message_buble);
wrapper.setGravity(coment.left ? Gravity.LEFT : Gravity.RIGHT);
return row;
}
</code></pre>
<p>i have to change order, for gravity left, i need shown textview comment first, and textView1 second
for gravity right, keep xml setting.</p>
<p>please advise.</p>
| java android | [1, 4] |
92,507 | 92,508 | Adding functionality to an imageButton in a gridview | <p>I have an ImageButton control as part of a GridView control that is displayed as an ItemTemplate and in the same GridView. I have a regular Button control to which I added some code like this</p>
<pre><code>if (e.CommandName == "addToSession")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow selectedRow = ((GridView)e.CommandSource).Rows[index];
string ISBN = selectedRow.Cells[0].Text;
string bookTitle = selectedRow.Cells[1].Text;
string image = selectedRow.Cells[2].Text;
//storing title, author, pictureUrl into session variables to 'carry them over' to RateBook.aspx
Service s = new Service();
Session["ISBN"] = ISBN;
Session["bookTitle"] = bookTitle;
Session["ImageUrl"] = s.returnImageUrl(bookTitle);
if (Session["userName"] == null)
{
Response.Redirect("registerPage.aspx");
}
else
{
Response.Redirect("RateBook.aspx");
}
}
else if (e.CommandName == "ratedBooks")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow selectedRow = ((GridView)e.CommandSource).Rows[index];
string bookTitle = selectedRow.Cells[1].Text;
Service s = new Service();
Session["ImageUrl"] = s.returnImageUrl(bookTitle);
Response.Redirect("BookRated.aspx");
}
</code></pre>
<p>when I run this code I get a format exception and again I am not sure why. I have altered the image button a bit and nested the image in a link button which seems to be more correct.</p>
<pre><code><asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="ratedBooks">
<asp:Image ID="ImageButton1" ImageUrl='<%#Eval("pictureUrl") %>' runat="server" />
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</code></pre>
<p>Please advise.</p>
<p>Regards,</p>
<p>Arian</p>
| c# asp.net | [0, 9] |
374,209 | 374,210 | Jquery collapse and expand server side control | <p>i am using asp.net 3.5 and c#.</p>
<p>I have a server-side div (runat="server") and , what I want is this that when I click on the link, div1 will collapse. I have to do this in JQuery.</p>
<p>I already achieve the target to use the following example. It collapse and expand the client side div.. now i want to do the same thing to the server-side div control</p>
<p><a href="http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm" rel="nofollow">http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm</a></p>
| c# jquery asp.net | [0, 5, 9] |
2,407,385 | 2,407,386 | Does logging slow down a production Android app? | <p>Before releasing my Android app to the marketplace, should I comment out all logs?</p>
<pre><code>Log.d(tag, "example of a log")
</code></pre>
<p>If I leave them there, will the app run slower?</p>
| java android | [1, 4] |
5,794,223 | 5,794,224 | How to make a Jquery event on the change of an object? | <p>I'm sure there is some really easy solution to this problem, at least it seems like there should be. But I haven't been able to find it...</p>
<p>I have an object (it's not part of the DOM) and its properties are periodically getting updated:</p>
<pre><code>var myobject;
//wait 10 seconds
myobject.property1 = "abc";
</code></pre>
<p>I want to trigger an action when this property gets changed (it's not just 1, but many different properties). How do I go about doing this in JQuery?</p>
| javascript jquery | [3, 5] |
3,815,415 | 3,815,416 | Does jQuery dialog display as hidden by default? | <p>I am using jQuery dialog in a simple, typical use case:</p>
<p>In the Javascript:</p>
<pre><code>$('myDialog').dialog({
modal: true;
});
</code></pre>
<p>In HTML:</p>
<pre><code><div id="myDialog" title="Dialog Title">
Dialog contents here
</div>
</code></pre>
<p>However, the CSS I'm using to control the layout & look-and-feel of the <code>myDialog</code> div is hosted on a server that my local machine doesn't have access to (don't ask why). Ergo, in Firebug, I see a network 404 error of file not found for the CSS file.</p>
<p>When I test this dialog out locally, it displays perfectly fine. However I just noticed that the contents of the <code>myDialog</code> div are actually displayed on my HTML page <em>prior</em> to when the code that executes the dialog's invocation is triggered.</p>
<p>So, this leads me to believe one of two things:</p>
<ul>
<li>A jQuery dialog's respective <code><div></code> element is invisible/hidden by default; however this weird situation where the browser can't find the CSS file is causing the <code><div></code> to display to the user before the dialog even pops up on screen; or</li>
<li>A jQuery dialog's respective <code><div></code> element is visible by default, and that I must take action to hide it on page load</li>
</ul>
<p><strong>Can someone please tell me which of those two assertions are correct?</strong></p>
<p>If the former assertion is correct, then the problem <em>should</em> resolve itself when we push the code to our dev environment (which <em>does</em> have access to the CSS file).</p>
<p>If the latter assertion is correct, then how can I hide the <code>myDialog</code> div on page load?</p>
<p>Thanks in advance!</p>
| javascript jquery | [3, 5] |
1,063,909 | 1,063,910 | Constructing HTML after getJSON works in Safari but not in Chrome or Firefox | <p>Hi i'm actually a newbie using javascript and html/css.</p>
<p>I can't understand why my script works on safari, but not on chrome and firefox...
any ideas?</p>
<p>EDIT: Both in chrome anda firefox the ul and li elements do not show... Also the previous alerts don't work. I'll check errors in the console and edit the post again</p>
<pre><code><!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div id="patients" style="text-align:center">
</div>
<script type="text/javascript">
$.getJSON("http://www.url.com/json",
function(data) {
var items = [];
alert(data[1].patient);
alert(data[1].hr);
$.each(data, function(index, val) {
items.push('<li id="' + index + '">' + val.patient + '<div style="display: none" id="'+val.patient+'"></div></li>');
});
$('<ul/>', {
'class': 'my-new-list',
html: items.join('')
}).appendTo('#patients');
});
</script>
</body>
</html>
</code></pre>
| javascript jquery | [3, 5] |
2,295,469 | 2,295,470 | How to use activity to request data from service? | <p>Now, my program have an activity and a service. The service runs in the background and sometimes vibrates to ask users give some selection. I meet a problem here. I know broadcast could pass data from service to activity. But if the activity is not working, then it cannot receive the broadcast information, so if user feels vibration but after a period of time start the activity then the activity will miss the broadcast information and cannot ask user to choose a selection. So does anybody know how to actively request the data from the service by activity? I just want when I onCreate() or onResume() the activity, my app could update UI in time?</p>
<p>Thanks</p>
| java android | [1, 4] |
3,748,280 | 3,748,281 | Accesing contents of res/raw programatically (Android) | <p>I'm working on an app for Android with a few other people, and the primary content is specified by our designers as text files in a certain file format, which we then parse, process, and serve in the app. We're currently storing them in <code>res/raw</code>.</p>
<p>This makes things great for the designers because when they want to add content, they simply add a file to <code>res/raw</code>. This is annoying as a developer, however, since we developers then need to add <code>R.raw.the_new_file</code> to an array in the code specifying which files to process at startup.</p>
<p>Is there a way to access the resource ID's of <code>res/raw</code> programatically? Ideally when the application starts, we could make a call to see which files are in <code>res/raw</code>, process all of them, so we could eliminate the small overhead with matching up the contents of <code>res/raw</code> with that of our array in the code.</p>
<p>The most promising path I've seen is <a href="http://developer.android.com/reference/android/content/res/Resources.html#getAssets()" rel="nofollow"><code>getAssets</code></a> from <a href="http://developer.android.com/reference/android/content/res/Resources.html" rel="nofollow">Resources</a>, which would let me call <a href="http://developer.android.com/reference/android/content/res/AssetManager.html#list(java.lang.String)" rel="nofollow"><code>list(String)</code></a> on the <a href="http://developer.android.com/reference/android/content/res/AssetManager.html" rel="nofollow">AssetManager</a>, but I've had trouble getting this to work, especially since you can't directly call <code>"res/raw"</code> as your filepath (or at least, it hasn't worked when I've tried. </p>
<p>Suggestions? Thanks</p>
| java android | [1, 4] |
1,519,719 | 1,519,720 | DOM element position based on view | <p>How can I get position of an element based on view? So as viewer scroll I get different values.</p>
<p>jQuery is prefered.</p>
| javascript jquery | [3, 5] |
35,155 | 35,156 | how to create a multi dimensional array out of dynamically created fields and variables | <p>here is my url: <a href="http://iadprint.com/products?product=business%20card" rel="nofollow">http://iadprint.com/products?product=business%20card</a></p>
<p>the fields that you see on this page are all dynamically created on the backend. i decided to use the fieldnames created as variables to display the price as you can see in the js below. I have two problems one being that when the page refreshes the pricing div values cleans out and the selections do not stay and the second one is i cant figure out how to add all items selected into an array for the cart page.</p>
<p>for the first problem i figured it was best to place each selection into a cookie in an array form and on refresh pull out the data and select the needed fields. unless there is another way.</p>
<p>this is what im guessing the array would look like</p>
<pre><code>$products = array("product" => "business_card", array("ProdID" => "1"), ("ProdID" => "2") ..and so on)
</code></pre>
<p>basically i would add only the fields who have a length of greater than zero so that i know it was selected. what my question is would that be the correct way to format the array? and is there a way i can do array_push in javascript to push in new elements each time a selection change is occurred?</p>
<p>as for problem two im hopefully guessing it will be easy once the cookie is created with its correct data.</p>
| php javascript jquery | [2, 3, 5] |
1,818,836 | 1,818,837 | Confirm function in codebehind | <p>I my application i am using ajax(Updatepanel).I am using the following code to show confirmation dialog box after finishing some update process in database. but it is not working for me.</p>
<p>Problem:</p>
<p>Confirmation box is not displaying.</p>
<p>code:</p>
<pre><code> protected void imbtnUpdate_Click(object sender, ImageClickEventArgs e)
{
// Database process
string javaScript = "<script language=JavaScript>\n " + "if(confirm('Do you want to update
the files?'))window.location.href = \"Upload.aspx?ID=" + ID +
"&pt=Gm&page=Gms\"; else return false;\n" + "</script>";
RegisterStartupScript("imbtnUpdate_Click", javaScript);
}
</code></pre>
| c# asp.net javascript | [0, 9, 3] |
5,893,293 | 5,893,294 | Using SharedPreferences inside MyXMLHandlerTemp | <p>I have a class named <strong>MyXMLHandlerTemp</strong> which <strong>extends DefaultHandler</strong>. The class is used for parsing data. </p>
<p>I want to use <strong>SharedPreferences</strong> inside MyXMLHandlerTemp class but it gives me error saying </p>
<blockquote>
<p>getSharedPreferences(String,int) is undefined for the type MyXMLHandlerTemp </p>
</blockquote>
<p>Is it possible to use SharedPreferences inside MyXMLHandlerTemp? If not then what can be alternative solution?</p>
| java android | [1, 4] |
4,765,405 | 4,765,406 | Tools for searching string literals in an application | <p>Are there any tools for locating all the strings that I've to Internationalize?
My app is already "partially" designed for Internationalization support. However I want to make sure that there arent' any hardcoded string within my app.</p>
<p>Regular expression search didn't help a lot as trying to find "***" returns every aspx page.</p>
<p>Are there any tools to do this?</p>
| c# asp.net | [0, 9] |
1,505,827 | 1,505,828 | Change background based on text in TextView in Android | <p>I'm trying to get the backgound of the layout to change based on what's in a textview. I know how to set the background in Java:</p>
<pre><code>mainbg.setBackgroundResource(R.drawable.erburrows);
</code></pre>
<p>but if I wrap that call in an if statement, nothing happens. There are no error flags or anything, it just doesn't display anything in the background. Here's the code I'm using:</p>
<pre><code> //--- BACKGROUND CHANGE ---
String tvString = showBook.getText().toString();
bookDisp.setText(tvString);
View mainbg = bgview.getRootView();
if(bookDisp.equals("Green Eggs")){
mainbg.setBackgroundResource(R.drawable.seuss);
}else if (bookDisp.equals("Tarzan")){
mainbg.setBackgroundResource(R.drawable.erburrows);
}
//--- END BACKGROUND CHANGE ---
</code></pre>
<p>Any idea why it doesn't work?</p>
| java android | [1, 4] |
5,091,650 | 5,091,651 | Asp.net static object behaviour | <p>I have the following class as part of an asp.net application.</p>
<pre><code>public sealed class SomeClass
{
private static string appId = Guid.NewGuid().ToString();
public static ReadSomethingFromDb(){}
public static WriteSomethingToDb(){}
}
</code></pre>
<p>There are more than one application instances in the same application pool, and they all access the same database. I want the operations performed by the above class to be uniquely tied to the instance that performed it, hence the use of the appId. So adding a record to the database would for example contain a name, address and appId. This has been simplified for discussion purposes.</p>
<p>Assuming that I have two instances running at mysite.a and mysite.b the above class would generate two different guids.</p>
<p>My problem is that mysite.a sometimes produces more than one guid, which is unexpected.</p>
<p>Thank you in advance</p>
| c# asp.net | [0, 9] |
2,861,023 | 2,861,024 | How to detect whether an image exists in the server using Javascript or Jquery | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3646914/how-do-i-check-if-file-exists-in-jquery-or-javascript">How do I check if file exists in jQuery or Javascript?</a> </p>
</blockquote>
<p>I need to find out image exists at specific path on server using javascript. </p>
<p>If the image exists at specific path on server in that case I need to display a default image without showing an error. </p>
<p>Thank you very much for your help.</p>
| php javascript jquery | [2, 3, 5] |
21,391 | 21,392 | Does technology exist that could allow devices to access and use data without having to download or stream it? | <p>Say the data never has to be copied to the client device, but always remains locked in the server. Say all the requesting device does is "hack in" to the server using a special code and only downloads some kind of tiny-size alias that gives it access to the entire file(s) on the server? Does this technology already exist, or if not, does it sound possible?</p>
| php javascript asp.net | [2, 3, 9] |
2,306,809 | 2,306,810 | Android:converting int to string and passing to methods | <p>Hi I am using the android wheel and getting the values of the time as below</p>
<pre><code> //get values of the wheel
hourvalue = hours.getCurrentItem();
Log.d(TAG, "hour value" +hourvalue );
minutevalue = mins.getCurrentItem();
Log.d(TAG, "minute value" +minutevalue );
</code></pre>
<p>i want to pass them to a method as string , how can i do that and also iam getting the values of hours and minutes separately i want to store the hours and minutes in a single string variable anAndroid :numberpicker in alert dailog</p>
<pre><code>private String getTraceId(String fbuserser,int hour) {
String traceId = null;
HttpClient client = new HttpClient();
GetMethod get = null;
try {
get = new GetMethod("http://" + Constants.CLOUD_SERVER_URL
+ Constants.facebookTrace);
NameValuePair[] params = new NameValuePair[4];
NameValuePair param = new NameValuePair();
param.setName("gadget");
param.setValue("gettraceid");
params[0] = param;
param = new NameValuePair();
param.setName("fbuserid");
param.setValue(fduserUser);
params[1] = param;
param = new NameValuePair();
param.setName("expiry");
-------------> param.setValue(hour);
params[2] = param;
get.setQueryString(params);
int statusCode = client.executeMethod(get);
traceId = get.getResponseBodyAsString();
} catch (Exception e) {
Log.e(TAG, "For Facebook Trace Id:", e);
} finally {
get.releaseConnection();
get = null;
}
return traceId;
</code></pre>
<p>In the above method i want to pass <code>int hour</code> as string.Any help is appreciated</p>
| java android | [1, 4] |
2,621 | 2,622 | Returning through multiple functions | <p>Alright, this might be kinda simple, but I cannot figure out how to do this. How can I change this function to return the <code>String class_name</code>? I know that I need to change the function from <code>void</code> to <code>String</code>, but what else do I need to do?</p>
<p>Much appreciated!</p>
<pre><code>public void addClass() {
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Add Class");
final EditText input = new EditText(this);
alert.setView(input);
alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String class_name = input.getText().toString();
}
});
alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
alert.show();
}
</code></pre>
| java android | [1, 4] |
4,246,983 | 4,246,984 | C++ for C# Developers | <p>I know C# pretty well (self-taught, sadly) and need to do some C++ programming for a Windows application. I have been able to find a ton of information for C++ developers learning C# but haven't been able to find much on learning C++ when you already know C#. Has anyone come across a good rundown of the basics? </p>
<p><a href="http://msdn.microsoft.com/en-us/library/yyaad03b.aspx">MSDN has a comparison</a> but it is not very in-depth.</p>
<p>I can piece together several sources but figured something was out there - I just can't find it. Thanks for your help.</p>
| c# c++ | [0, 6] |
866,658 | 866,659 | Prevent Refresh 'Jump' with Javascript | <p>I've noticed that if you are on a page and you have scrolled down a good bit, if you refresh the page, most browsers will jump you back down to your position. Is there any way to prevent this? </p>
<p>I have looked at two options and neither are consistent across Webkit / Firefox.</p>
<pre><code> window.scrollTo(0, 1);
$('html, body').animate({ scrollTop: 0 }, 0);
</code></pre>
<p>Any ideas? </p>
<p>You can check a google search result for an example.</p>
| javascript jquery | [3, 5] |
5,494,834 | 5,494,835 | access values of controls dynamically created on postback | <p>My problem is:
I've got a table, dynamically created, fill with a lot of dropdownlists witches IDs are dynamically created.</p>
<p>When a button is pressed, I need to scan all controls in the table and save their value.</p>
<p>But after the postback I can't no longer access to the table, and I've no idea how can I get those values...</p>
<p>Thanks!</p>
| c# asp.net | [0, 9] |
5,349,231 | 5,349,232 | jQuery $.submit and files not working in IE and FF | <pre><code><?php
if (!empty($_FILES)){
echo "<pre>";
echo $_FILES['file']['type'];
echo "</pre>";
return;
}
?>
<script type="text/javascript">
function autoUpLoad(){
$("#txtHint").html("<center><img src='include/images/loader.gif' />Reading selected file...</center>");
$(document).ready(function(){
$("#file").change(function(){
$("#myForm").submit(function(data){
$("#txtHint").html(data);
});
});
});
}
</script>
<form id="myForm" method="post" enctype="multipart/form-data">
<input type="file" name="file" id = "file" onchange='autoUpLoad()'/>
<input type="submit" value="Send" />
</form>
<div id="txtHint">
test
</div>
</code></pre>
<p>The above code is not working and I am not sure what is wrong here? It works only if I remove these lines:</p>
<pre><code>function(data){
$("#txtHint").html(data);
}
</code></pre>
<p>It just doesn't allow me to return data to <code>txtHint</code>. Can anyone explain to me how to make it work?</p>
| php jquery | [2, 5] |
5,068,866 | 5,068,867 | How to use jQuery's delay() as a sleep()? | <p>Can jQuery be used as a sleep() or wait() function? Suspending the execution of the statements after the wait. I tried $().delay(5000) but there was no 5 second wait. Is delay() only used in effects?</p>
<p>I am not looking for solutions which involve setTimeout delayed execution of another function or a CPU hogging solution. I want a sleep() function which can be reused in different scripts.</p>
<p><strong>Addition:</strong></p>
<p>I didn't mean to suggest a solution which doesn't use setTimeout at all. I have seen solutions which required to move all code after where the delay is needed into its own function so that setTimeout can call it. I don't want that. Either a self contained wrapper function for using setTimeout or use jQuery delay() in a dummy non visual effect just for the purpose of simulating a sleep function.</p>
| javascript jquery | [3, 5] |
2,205,354 | 2,205,355 | Updating value of input field onclick - code have to reflect in source code | <p>I have issues updating input fields values on clicking "Save", it's basicaly not saving the newly typed stuff into the value (value stays old, if you right-click and check source)...</p>
<pre><code>function editCartInfo(){
$('#CheckEdit').html('edited');
$("#FullName").prop('disabled', false);
$("#Address").prop('disabled', false);
$("#DOB").prop('disabled', false);
$("#EditSave").html('<a onclick="saveCartInfo()" class="big-white-links">Save</a>');
}
function saveCartInfo(){
$("#FullName").val();
$("#FullName").prop('disabled', true);
$("#Address").val();
$("#Address").prop('disabled', true);
$("#DOB").val();
$("#DOB").prop('disabled', true);
$("#EditSave").html('<a onclick="editCartInfo()" class="big-white-links">Edit</a>');
}
</code></pre>
<p>input field code inside my PHP file:</p>
<pre><code><input type="text" name="Address" id="Address" value="' . $cart['StreetAddress'] . '" style="width: 299px" disabled="disabled" />
</code></pre>
<p>HTML:</p>
<pre><code><div class="link-in-heading-dark" id="EditSave">
<a onclick="editCartInfo()" class="big-white-links">Edit</a>
</div>
</code></pre>
| php jquery | [2, 5] |
4,155,014 | 4,155,015 | Jquery Evolution from simple plain javascript | <p><br/>
i have been using jquery for a while now but only thing i know about jquery is probably a dozen of functions that get my job done. but i want to understand how jquery evolved from simpl plain javascript i.e how</p>
<pre><code>$("#xyz").val();
</code></pre>
<p>is converted to </p>
<pre><code>document.getElementById('xyz').value;
</code></pre>
<p>i have searched for my answer on the web but most of the writers are happy to show how you can hook on to different DOM elements with jquery, selector details etc. but nothing can be found about how actually the transition was made. can anyone refer me to some tutorial where i can get my required material?<br/>
thanks</p>
| javascript jquery | [3, 5] |
1,252,758 | 1,252,759 | How to pass a variable into a dialog function? | <p>How do i pass my rating variable from updateRating() function into my window.location.replace(url + rating) which in the "proceed" function in my dialog? </p>
<p>Here are my codes:</p>
<pre><code> <script type="text/javascript">
$(document).ready(function(){
$(".hireraccept").click(function(){
$('.jRating').jRating();
$("#dialog-rate").dialog("open");
itervalue = $(this).attr("value");
return false
});
$("#dialog-rate").dialog({
autoOpen: false,
resizable: false,
height: 200,
width: 200,
modal: true,
buttons: {
"Proceed": function(){
window.location.replace("{{ domain_url }}/workroom/accept/" + itervalue +"/" + rating);
$(this).dialog("close");
}
}
}); }); </script>
<script>
function updateRating(rate,proceed){
goodtogo = proceed;
rating = rate;
}
</script>
</code></pre>
| javascript jquery | [3, 5] |
78,307 | 78,308 | How to capture on browres open new tab the target url | <p>Is it possible to catch the attribute of hyperlink with JavaScript or Jquery on browsers open new tab event? </p>
<p>lets say I have a hyperlink <code><a href="http://example.com/something">MyLink</a></code> and using right click on link and opening new tab should alert first "<code>http://example.com</code>"</p>
| javascript jquery | [3, 5] |
226,882 | 226,883 | Passing JavaScript Variable to PHP Session variable | <p>I am trying to update/create session variable when I change the option thru a drop-down box. TThe value is stored in a javascript function. Can any1 tell me how I can pass this variable to my PHP session variable without using a AJAX request.
Thanks</p>
| php javascript | [2, 3] |
23,005 | 23,006 | When removing a class with jQuery, is it better to include the class in the selector? | <p>Probably this will not result in any noticable performance difference, but I was just interested. If I am removing a class on a list of elements using jQuery, is it better practice or performance to include the class in the selector?</p>
<p>So either include it:</p>
<pre><code>$('#myList li.classToRemove').removeClass('classToRemove');
</code></pre>
<p>or don't include it:</p>
<pre><code>$('#myList li').removeClass('classToRemove');
</code></pre>
<p>So basically is there any difference to narrowing the list in the selector and in the removeClass method.</p>
| javascript jquery | [3, 5] |
2,921,410 | 2,921,411 | Math function to round up the values to .0 or .5 | <p>How can I round numbers up to the nearest whole <em>or</em> to the nearest half?</p>
<p>For Example:</p>
<pre><code>> 23.15 --> 23.5
> 23.56 --> 24.0
</code></pre>
<p>The rounding functions I know about are <code>floor</code> and <code>ceil</code>, but those only round to the nearest integer.</p>
| c# asp.net | [0, 9] |
5,007,172 | 5,007,173 | Parent-Child Gridview in ASP.net | <p>I have two GridView in ASP.net 3.5 page. I have HyperLink field as one of the fields in the First GridView.</p>
<p>On click of this hyperlink I need to call display the 2nd grid by passing some values to a method showAllRecords(value from hyperlink)</p>
<p>How do I do this?</p>
<p>Thanks</p>
| c# asp.net | [0, 9] |
3,926,182 | 3,926,183 | Adding feedback buttons | <p>I've a static html file that is generated from docbook5 sources. Now I need to add feedback buttons, at the end of each section, so I'm appending (using jQuery) a link after
each title:</p>
<pre><code>$(document).ready(function() {
$("div[title]").append('<a href="mailto:me@host?subject=XXX">feedback</a>');
})
</code></pre>
<p>how to insert the div[title] into subject? </p>
<p><strong>EXAMPLE</strong></p>
<pre><code><div title="Foo">
...
</div>
<div title="Bar">
...
</div>
</code></pre>
<p>I want two buttons placed right after the closing div:</p>
<pre><code><div title="Foo">
...
</div><a href="me@host?subject=Foo">feedback</a>
<div title="Bar">
...
</div><a href="me@host?subject=Bar">feedback</a>
</code></pre>
| javascript jquery | [3, 5] |
1,796,297 | 1,796,298 | How is my session variable defined on a remote page? Just curious for background knowledge | <p>Hey guys, one more quick question for any experts out there. I have a form that is submitted via jquery ajax, works perfectly (I tested), and uses a form token (I set a session variable and pass through form and check that the token is equal to the posted token to prevent csrf attacks, see below...). My question is that I defined my session variable on the form page and used php session_start() on the validation page, but I am not sure how $_SESSION['token'] is still defined if I am not actually posting to that page or physically accessing that page with my browser (I am sending an ajax call). How $_SESSION['token'] be defined on a remote page?</p>
<p>Ex. set variable</p>
<pre><code>if (!isset($_SESSION['token']) and $session->logged_in)
{
$_SESSION['token'] = md5(uniqid(rand(), TRUE));
}
$token =$_SESSION['token'];
</code></pre>
<p>pass token through form in hidden input, then check</p>
<pre><code>if ($_POST['token'] == $_SESSION['token']){
</code></pre>
| php jquery | [2, 5] |
3,792,548 | 3,792,549 | Is it possible to use jQuery to grab the HTML of another web page into a div? | <p>I am trying to integrate with the FireShot API to given a URL, grab HTML of another web page into a div then take a screenshot of it. </p>
<p>Some things I will need to do after getting the HTML </p>
<ul>
<li>grab <code><link></code> & <code><script></code> from <code><head></code> </li>
<li>grab <code><body></code> into <code><div></code> </li>
</ul>
<p>But 1st, it seems when I try to do a </p>
<pre><code>$.get("http://google.com", function(data) { ... });
</code></pre>
<p>I get a 200 in firebug colored red. I think it has to do with sites not allowing you to grab their page with JS? Then is opening a window the best I can do? But how might I control the other page with jQuery or call fsapi on that page?</p>
<p><strong>UPDATE</strong></p>
<p>I tried to do something like below to do something when the new window is ready, but FireBug says "Permission denied to access property 'document'"</p>
<pre><code>w = window.open($url.val());
setTimeout(function() { // if I dont do this, I always get about:blank, is there a better way around this?
$(w.document).ready(function() {
console.log(w.document.body);
});
}, 1000);
</code></pre>
| javascript jquery | [3, 5] |
3,050,734 | 3,050,735 | Restarting countdown clock | <p>This is how it looks currently:</p>
<pre><code>final CountDownTimer countdown = new CountDownTimer(5000, 1000) {
public void onTick(long millisUntilFinished) {
clock.setText("Seconds Remaining: " + millisUntilFinished / 1000);
}
public void onFinish() {
qcount++;
if (qcount < 10)
{
this.start();
switch (diff) {
case 0: //Novice difficulty
</code></pre>
<p>but it says the countdown variable isn't used and it doesn't run at all in the app.</p>
| java android | [1, 4] |
1,502,410 | 1,502,411 | How to refresh CursorAdapter on spinner selection? | <p>I have a SpinnerListner class that is nested in ListActivity inherited class. My aim is to update the CursorAdapter that is implemented by the ListActivity class.</p>
<p>Here is my code:</p>
<pre><code>public class test extends ListActivity {
private testAdapter adapter;
protected SQLiteDatabase db;
protected Cursor cursor;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Display wrapper
setContentView(R.layout.wrapper);
// Query Database
db = (new DatabaseHelper(this)).getWritableDatabase();
cursor = getCursor();
adapter = new testAdapter(this, cursor);
setListAdapter(adapter);
}
public class SpinnerListener implements OnItemSelectedListener {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
Toast.makeText(parent.getContext(), "The planet is " + parent.getItemAtPosition(pos).toString(), Toast.LENGTH_LONG).show();
String[] values = getResources().getStringArray(R.array.values);
SharedPreferences.Editor editor = pref.preferences.edit();
editor.putString("planet", values[pos]);
editor.commit();
// notifyDataSetChanged is not working
adapter.notifyDataSetChanged();
// requery is not working either
cursor.requery();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
// Do nothing.
}
}
}
</code></pre>
<p>Both requery() and notifyDataSetChanged() are not working. What am I doing wrong here?</p>
| java android | [1, 4] |
4,451,377 | 4,451,378 | Add new class and attributes to div if it exists on the page | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/11618822/how-to-add-new-class-and-attributes-to-div-if-it-exists-on-the-page">How to add new class and attributes to div if it exists on the page</a> </p>
</blockquote>
<p>I need JavaScript code on my master page which tries to find if a div exists. If so, it should add a new class and also add a new id attribute.
For example if the page has this div:</p>
<pre><code><div class="toplink">abc..</div>
</code></pre>
<p>Then JavaScript code should make it exactly like this:</p>
<pre><code><div class="toplink adin" data-aid="114">abc..</div>
</code></pre>
<p>The code inside the div should remain the same.</p>
<p>I tried this code but this is not working</p>
<pre><code> <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js" type="text/javascript">
if ($('.toplink').exists()) {
$('.toplink').addClass('adin').attr('data-aid', '114');
}
</script>
</code></pre>
<p>What wrong with this code? what where i placed this code,in header on footer?
Can i do this with javascript, not jquery</p>
| c# javascript jquery | [0, 3, 5] |
4,313,534 | 4,313,535 | Shutdown XML-RPC server from client/test-harness | <p>My problem context is as below:-</p>
<ol>
<li>I have an Apache XMLRPC server implemented on Java using Webserver</li>
<li>A client implemented in Android running on the device/emulator, connecting against the XML-RPC in step 1.</li>
<li>Test cases running on the Android emulator which pass data to the client, which in turn sends it to the server. The server does some comparisons etc. and sends response back to the client which then has logic to say if a test passed/failed.</li>
</ol>
<p>All of this works fine however where I am stuck at the moment is, once I have run all my tests I would like to shutdown the server remotely i.e. through the test-case to Android client route. I can do something like "client.execute("server.shutDown"), which works fine, the only issue is since the server is shut-down it ends up hanging my client on the line "HttpResponse response = client.execute(postMethod);"</p>
<p>Any suggestions would be helpful.</p>
<p>Regards,
Mayank </p>
| java android | [1, 4] |
249,461 | 249,462 | How to show a label message, then hide it after some seconds? | <p>I would like to show a message on my ASP.Net page like "Record saved" on save button click. After 5 seconds, I would like to hide it.<br>
How can I do in JavaScript? Can I avoid to add jQuery (I'm not using it)?</p>
| javascript asp.net | [3, 9] |
804,426 | 804,427 | is(':first') returns different (wrong?) results for what should be the same element. jsFiddle inside | <p><a href="http://jsfiddle.net/garnwraly/sfrwU/2/">http://jsfiddle.net/garnwraly/sfrwU/2/</a></p>
<p>given HTML of only</p>
<pre><code><li>
<button id="bam">click</button>
</li>
</code></pre>
<p>and this script</p>
<pre><code>$('body').on('click', 'button', function (e) {
//console.log( e.currentTarget == $('button')[0] ); //true;
//console.log($('li').is('li:first')); //true
console.log($(e.currentTarget).parent().is('li:first')) //false
console.log($('button').parent().is('li:first')); //true
console.log($($('button')[0]).parent().is('li:first')); //false
});
</code></pre>
<p>why is <code>$(e.currentTarget).parent().is('li:first')</code> false? </p>
| javascript jquery | [3, 5] |
3,106,278 | 3,106,279 | DropdownList with Multi select option? | <p>I have a DropDownList as following</p>
<pre><code><asp:DropDownList ID="ddlRoles" runat="server" AutoPostBack="True" Width="150px">
<asp:ListItem Value="9" Text=""></asp:ListItem>
<asp:ListItem Value="0">None</asp:ListItem>
<asp:ListItem Value="1">Ranu</asp:ListItem>
<asp:ListItem Value="2">Mohit</asp:ListItem>
<asp:ListItem Value="3">Kabeer</asp:ListItem>
<asp:ListItem Value="4">Jems</asp:ListItem>
<asp:ListItem Value="5">Jony</asp:ListItem>
<asp:ListItem Value="6">Vikky</asp:ListItem>
<asp:ListItem Value="7">Satish</asp:ListItem>
<asp:ListItem Value="8">Rony</asp:ListItem>
</asp:DropDownList>
</code></pre>
<p>I want to select Multiple name at once suppose I want to select Ranu Mohit or Ranu Kabeer Vikky, How its possible?</p>
| c# asp.net | [0, 9] |
1,379,316 | 1,379,317 | Get changes to multiselect listbox selected items | <p>I have a listbox databound if not postback and items selected from a database (if applicable). If i select new items in the listbox and postback, my foreach logic always sees only the original selection, not the changes. Been banging my head trolling google for the answer. Here's the code behind:</p>
<pre><code> foreach (ListItem li in lsb.Items)
{
if (li.Selected)
{
try
{
[sql insert]
}
}
}
</code></pre>
<p>EDIT: I should add the listbox is contained within and updatepanel</p>
| c# asp.net | [0, 9] |
3,656,023 | 3,656,024 | Get the id of an option chosen in a select by a user | <p>I'm tryin to get the id of an option chosen in a select by a user.</p>
<pre><code>$(document).ready(function(){
$(".my_select_class").change(function(){
var d = $(this).find('option:selected').attr('id');
alert(d);
return false;
});
});
</code></pre>
<p>The id exists cause I display it in my php code but the alert open a white frame without any character, I don't understand why. Maybe because "attr('id')" doesn't work with "find('option:selected')" ?</p>
| javascript jquery | [3, 5] |
3,042,784 | 3,042,785 | how to paint link that i visit and link that i dont visit with green ? (asp.net) | <p>i have link in my webform </p>
<p>how to do that even i visit or not visit the color will be green ?</p>
<p>thanks in advance</p>
| c# asp.net | [0, 9] |
2,501,351 | 2,501,352 | How to Set Layout Background in Android UI | <p>I'm new to Android programming. I have a UI with some <code>TextView</code> and <code>Button</code> controls. How do I set a background behind those components? Lets call it <code>background.png</code>. </p>
| java android | [1, 4] |
3,794,865 | 3,794,866 | How would I toggle the state of a setInterval function in jQuery? | <p>I want to be able to click a an element with an id of pause to start a count of the elements in a time object and if I re click the pause it will stop it and reclick start it exactly like the toggle feature in JQuery but with a setInteval function how would I go about doing this?</p>
<pre><code>$("#pause").click(function(ffe) {
if(on == true) {
on = false
alert("on");
}
else {
on = true;
alert("off");
}
if(on == false) {
setInterval(function() {
$("#timet ul").append("<li>" + $("#time ul")
.children('li').length +"</li>");
}, 100);
}
else {
alert("Error");
}
});
</code></pre>
| javascript jquery | [3, 5] |
1,653,595 | 1,653,596 | translating php array into asp.net arraylist | <p>i'm trying translate some php code into asp.net code </p>
<p>php code:</p>
<pre><code> function setOption ($result) {
foreach ($result as $value) {
$parentid[$value['id']] = $value['parentid'];
$subid[$value['parentid']][] = $value['id'];
$name[$value['id']] = $value['name'];
$display[$value['id']] = $value['display'];
}
return array($parentid, $subid, $name, $display);
}
</code></pre>
<p>asp.net code </p>
<pre><code>ArrayList al = new ArrayList();
ArrayList parentid = new ArrayList();
ArrayList subid = new ArrayList();
ArrayList name = new ArrayList();
ArrayList display = new ArrayList();
DataTable tbl = ds.Tables[0];
for (int i = 0; i < tbl.Rows.Count; i++)
{
DataRow myRow = tbl.Rows[i];
int id = Convert.ToInt32(myRow["id"]);
int parent_id = Convert.ToInt32(myRow["parent_id"]);
int oid = Convert.ToInt32(myRow["oid"]);
int dis = Convert.ToInt32(myRow["display"]);
string title = myRow["title"].ToString();
parentid.Insert(id, parent_id);
subid.Insert();
name.Insert(id, title);
display.Insert(id, dis);
}
al.Add(parentid);
al.Add(subid);
al.Add(name);
al.Add(display);
return al;
</code></pre>
<p>but at $subid[$value['parentid']][] = $value['id']; is two dimensional array code, how do asp.net present it in asp.net arraylist code?</p>
| c# php asp.net | [0, 2, 9] |
2,086,010 | 2,086,011 | jquery Arrays, how to use each | <p>I current have the following which works well:</p>
<pre><code>channel.bind('pusher:subscription_succeeded', function(members) {
members.each(set_status_online);
})
function set_status_online(member) {
var user_temp;
user_temp = findWallUser(member.info.uid);
if (user_temp) {
user_temp.status('online');
}
else {
console.log('user not found');
}
}
</code></pre>
<p>I am trying to update the first part to give me more control of the members.each. I want something like this:</p>
<pre><code>channel.bind('pusher:subscription_succeeded', function(members) {
members.each {
set_status('online');
}
})
</code></pre>
<p>Is there a way I can do that with the array & .each? thanks</p>
| javascript jquery | [3, 5] |
3,305,533 | 3,305,534 | append to file android | <p>hey there, i need to append to my file but it is not working, it keeps overwriting the file, can anyone please tell me what is wrong:</p>
<pre><code> public void generateNoteOnSD(String sBody){
try
{
File root = new File(Environment.getExternalStorageDirectory(), "AdidasParticipants");
if (!root.exists()) {
root.mkdirs();
}
File gpxfile = new File(root, "participants.txt");
BufferedWriter bW;
bW = new BufferedWriter(new FileWriter(gpxfile));
bW.write(sBody);
bW.newLine();
bW.flush();
bW.close();
//Toast.makeText(mContext, "Tus datos han sido guardados", Toast.LENGTH_SHORT).show();
}
catch(IOException e)
{
e.printStackTrace();
// importError = e.getMessage();
// iError();
}
}
</code></pre>
<p>Thanks in advance.</p>
| java android | [1, 4] |
5,409,999 | 5,410,000 | What does this java line do? | <pre><code>response1 = CustomHttpClient.executeHttpPost("http://gamesdsxd.com/appfiles/login.php", postParameters);
String res = response1.toString();
res = res.replaceAll("\\s+", "");
</code></pre>
<p>I'm wondering what \s+ does and what this replaceAll does and why it is needed.</p>
| java android | [1, 4] |
5,474,213 | 5,474,214 | C++ to Java code translation | <p>I have following code in C++:</p>
<pre><code>struct Foo { };
std::ostream& operator<<(std::ostream& os, const Foo& f) {
return os << "Foo";
}
Foo foo;
std::cout << print("Ha! %1%, x=%2% %1% %3%") % "Hej" % 1 % foo;
</code></pre>
<p>Because I don't think I understand that C++ code. What is appears, is that it is some kind of printf like function.
What I need, is to make it Java way. Any ideas, how to mark it work as it is, but in Java?</p>
| java c++ | [1, 6] |
5,579,270 | 5,579,271 | Asp.net need Simultaneous display in Second Text Box | <p>I have two text boxes I need a functionality like If I am typing in 1st text box The text should be getting displayed in 2nd text Box with some other font. This is a web Application. And so Text Box doesn't have OnKeyDown event? Do you suggest any way to implement this?</p>
<p><strong>Note:</strong> I don't want to implement this with Javascript.</p>
| c# asp.net | [0, 9] |
3,745,258 | 3,745,259 | How to achieve JavaScript Object inheritance? | <p>I want create a new JavaScript object based on an existing JavaScript object.<br>
Till now my research led me to jQuery extend function.<br>
<br>example:</p>
<pre><code>var object1 = {
name:'same name',
age:'1',
occupation:'programmer'
}
var object2 = {
name:'same new name'
}
</code></pre>
<p>Now, when I call:</p>
<pre><code>$.extend({},object1,object2);
</code></pre>
<p>it works perfectly, my problem is when I have object member within the object!<br></p>
<pre><code>var object1 = {
name:'same name',
age:19,
occupation:'programmer',
parent:{
name:'parent name',
age:35
}
}
var object2 = {
name:'same new name',
parent:{
age:40
}
}
</code></pre>
<p>Now, when I call</p>
<pre><code>$.extend({},object1,object2);
</code></pre>
<p>object1.parent is:</p>
<pre><code>{
age:40
}
</code></pre>
<p>I want it to be:</p>
<pre><code>{
name:'same new name',
age:40
}
</code></pre>
<p>Is there a way to achieve this?</p>
| javascript jquery | [3, 5] |
1,629,450 | 1,629,451 | How to call a parent class's method from child class in c#? | <p>I have a master page with a method I use a lot from content page code behinds. In those code behinds, I have a method that gets duplicated a lot, so I thought I'll put it in something I can inherit from. Unfortunately, I now can't call the method in my master page code behind from the base class. I think I should know how and I'm probably being pretty stupid today but I can't figure it out.</p>
<p>Here's some code! Please ignore any howling errors, I just typed this off the top of my head :)</p>
<p><strong>Master Page Code-behind</strong></p>
<pre><code>public partial class Site : MasterPage
{
public void MyMethod()
{
// Do Something...
}
}
</code></pre>
<p><strong>Content (Child) Page</strong></p>
<p><em>Declarative</em></p>
<pre><code><%@ MasterType VirtualPath="~/Site.Master" %>
</code></pre>
<p><em>Code-behind</em></p>
<p>Works</p>
<pre><code>public class Test : Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.Master.MyMethod();
}
}
</code></pre>
<p>Does Not Work</p>
<pre><code>public class Test : TestClass
{
protected void Page_Load(object sender, EventArgs e)
{
OtherMethod();
}
}
public class TestClass : Page
{
public void OtherMethod()
{
this.Master.MyMethod();
}
}
</code></pre>
<p>Now, looking at it, I intuitively know "this.Master" can't work but I don't have any lightbulbs going off for an answer. How do I get the reference to my master page method back?</p>
<p>Thanks,
Richard</p>
| c# asp.net | [0, 9] |
766,579 | 766,580 | How to create one javascript/jquery function-handler for many items? | <p>I have the html like below: </p>
<pre><code><table class="table" id="subscriptions">
<tbody id="subscriptions-tbody">
<tr>
<td>Item 1</td>
<td><a href="#">delete</a></td>
</tr>
<tr>
<td>Item 2</td>
<td><a href="#">delete</a></td>
</tr>
<tr>
<td>Item 3</td>
<td><a href="#">delete</a></td>
</tr>
</tbody>
</table>
</code></pre>
<p>Items can be added dynamically there.</p>
<p>Now, I should create the function, which will help me to delete the element from the list, if user clicks delete.
Looks like I should:</p>
<ol>
<li>assign some unique id for each item in the list (I have such ids) - where should I keep them? part as <code>href</code>?;</li>
<li>once user clicks on the link, I should prevent default action and pass control to my function (it will hide the element from the list and will sent POST request to the server) with item id as parameter.</li>
</ol>
<p>How to do it?</p>
| javascript jquery | [3, 5] |
752,518 | 752,519 | PHP + jQuery change background based on server time | <p>I have an Apache based server, which currently hosts my PHP + HTML5 app. I wrote a jquery script, which should change background image of specific div, if some conditions regarding server time are met. Problem is - the script is not working :)</p>
<p>I've already red some issues here, and tried to fix script, but those didn't help, because they are not completely related to my problem.</p>
<p>Ok, here's the script:</p>
<pre><code>$(document).ready(function () {
var serverdate = new Date("<?php echo date('l,g,i,s'); ?>");
var currentTime = serverdate.getTime();
var gameTime = getTimeFromString("8:45 pm");
var endTime = getTimeFromString("11:45 pm");
var currentDay = serverdate.getDay();
var weekday=new Array(7);
weekday[0]="Sunday";
weekday[1]="Monday";
weekday[2]="Tuesday";
weekday[3]="Wednesday";
weekday[4]="Thursday";
weekday[5]="Friday";
weekday[6]="Saturday";
if (currentDay === "Tuesday" || currentDay ==="Wednesday"){
if (currentTime<gameTime) {
$('#bodymain').addClass('day').removeClass('game');
}
else if (currentTime>endTime) {
$('#bodymain').addClass('day').removeClass('game');
}
else {
$('#bodymain').addClass('game').removeClass('day');
}
}
else {
$('#bodymain').addClass('day').removeClass('game');
}
function getTimeFromString(timeString){
var theTime = new Date();
var time = timeString.match(/(\d+)(?::(\d\d))?\s*(p?)/);
theTime.setHours(parseInt(time[1])+(time[3]?12:0));
theTime.setMinutes(parseInt(time[2]) || 0);
return theTime.getTime();
}
});
</code></pre>
<p>Any clues?</p>
| php jquery | [2, 5] |
Subsets and Splits