Unnamed: 0
int64 302
6.03M
| Id
int64 303
6.03M
| Title
stringlengths 12
149
| input
stringlengths 25
3.08k
| output
stringclasses 181
values | Tag_Number
stringclasses 181
values |
---|---|---|---|---|---|
1,205,915 | 1,205,916 | (jquery) enabling a submit button when OPTION value selected | <p>So I want to enable a submit button whenever an option in my select box (#purchase) is selected (so long as the selection is not the default value. </p>
<p>Here is the jquery code I put together, which is apparently not very good. :)</p>
<pre>
<code>
$(document).ready(function(){
$('input[type=\"submit\"]').attr('disabled','disabled');
$('#purchase').change(function(){
$('input[type=\"submit\"]').attr('disabled', 'enabled');
});
});
</code>
</pre>
<p>Here is my simple little form...</p>
<pre>
<code>
<input type='submit' id='submit' value='Purchase'>
<select name='purchase' id='purchase'>
<OPTION value='default' DEFAULT>default</OPTION>
<OPTION value='small'>11 x 14" Print - $17.00</OPTION>
<OPTION value='big'>20 x 30" Print - $40.00</OPTION>
</select>
</code>
</pre>
<p>Can anybody give me a push in the right direction? :)</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
2,182,767 | 2,182,768 | jQuery / iScroll - Scrolling panel with clickable images | <p>I have a scrolling panel (using <a href="http://cubiq.org/iscroll-4" rel="nofollow">iScroll4</a> & jQuery) to navigate a horizontal list of thumbnails, like below.</p>
<p><img src="http://i.stack.imgur.com/qB1du.png" alt="enter image description here"></p>
<p>Using my mouse, I can grab and slide this panel nicely, works a treat. The problem is, I have now added a click event to each image in the list, so when the user grabs and slides, it clicks on an image, causing the event to fire. This is annoying as the user didn't want to select that image, they just wanted to look further.</p>
<p>How can I make this so if they definitely click on the image, without a left or right movement, it selects the image, but if the scroller moves then it doesn't?</p>
<p>An example of what I am saying can be found on the Fotorama slider plugin <a href="http://fotoramajs.com/" rel="nofollow">here</a>. If you try sliding the thumbnails across and then try clicking on a thumbnail, you will see what I mean.</p>
<p>Any help or suggestions would marvelous.</p>
<p><strong>UPDATE</strong></p>
<p>I have found that there is an onScrollMove and onScrollEnd callbacks in the iScroll4 docs. Maybe: <code>onScrollEnd: function() { $(".uploaded_images").unbind("click"); }</code></p>
<p><strong>ANOTHER UPDATE</strong></p>
<p>For now, I have got around this by making the images double-clickable, instead of single, but I would still like to know how it's possible.</p>
| javascript jquery | [3, 5] |
1,083,610 | 1,083,611 | Replace an image in code behind for Asp.net | <p>I have a page, which is called from 2 different functions. For each function, the page has to be display different image. I have 2 images. </p>
<p>On the aspx page, code is like this. Please help me out how to display different image for different functions!! Thanks Guys!!</p>
| c# javascript asp.net | [0, 3, 9] |
3,974,637 | 3,974,638 | How do I dynamically get the value of a property of a JavaScript object? | <p>I might not know what to call this, but essentially I want to pass the name of the property dynamically and then get the value of that property within my objects data property. Something like this:</p>
<pre><code>function myFunc(e, myProperty) {
alert( e.data[myProperty] );
}
var myValue = myFunc(myObject, "someField");
</code></pre>
<p>I get the value <em>undefined</em>.</p>
<p>I think the equivalent in ColdFusion would be something[myPropertyName] and I'm wondering if there is something similar in JavaScript.</p>
<p>UPDATE: Apparently getting the value works, but not where I'm trying to pass the dynamic property as a name/value pair to an AJAX request.</p>
<pre><code>var myValue = e.data[myProperty];
var myData = { myProperty: myValue }
</code></pre>
<p>In the code above <em>myProperty</em> is being passed as <em>"myProperty"</em></p>
| javascript jquery | [3, 5] |
747,403 | 747,404 | AutoScroll div content both ways | <p>I want to make a div autoscroll it's content. The content height is variable. Here is what I managed to work out, but if I set the height to .childElement.outerHeight or height, it will only scroll 78px, I don't know why.</p>
<pre><code> var element = jQuery('#content');
setInterval(scrollDown(element), 1000)
function scrollDown(element) {
var childElement = element.children();
scrollAmount = childElement.outerHeight();
element.animate({ scrollTop: 1000 }, 3000, null, scrollUp(childElement));
}
function scrollUp(element) {
element.animate({ scrollTop: 0 }, 500);
}
});
</code></pre>
<p>Any help is highly appreciated.</p>
<p>Thanks,
Sebastian</p>
| javascript jquery | [3, 5] |
5,450,779 | 5,450,780 | How to choose all the elements of INPUT? | <p>How to choose all the elements of INPUT with style="color: #F20808"?</p>
<pre><code><form>
<input type="text" value="1">
<input type="text" value="2" style="color: #F20808">
<input type="text" value="3" style="color: #F20808">
<input type="submit" value="submit">
</form>
$('form').submit(function(){
if($(this).find('input').css('color') != 'rgb(242, 8, 8)'){
return true;
}
return false;
});
This way works, but I dont like:
$('form').submit(function(){
if($(this).find('input:eq(1), input:eq(2)').css('color') != 'rgb(242, 8, 8)'){
return true;
}
return false;
});
</code></pre>
<p>Are there any other ways?</p>
| javascript jquery | [3, 5] |
4,759,297 | 4,759,298 | Use Jquery variable to identify a div class/Id | <p>I'm sure the answer to this is simple, I've just been able to figure it out.</p>
<p>I have a simple click function which applies to any links in a list being clicked. When one is clicked, I want it to remove a class on a div, which is related to one of the links attributes. E.g:</p>
<pre><code>// The link
<li><a href="#" title="example1">example1</a></li>
// The div
<div id="example1" class="selected"></div>
</code></pre>
<p>This is the kinda thing that I've tried, but it aint right:</p>
<pre><code>$("ul.switcher a").click(function(e){
e.preventDefault();
$("#" + $(this().val).removeClass("selected");
});
</code></pre>
<p>Any help would be much appreciated! If anyone could also tell me the JavaScript equivalent of doing this too that would be a nice bonus!</p>
| javascript jquery | [3, 5] |
2,471,960 | 2,471,961 | Folder Browser Dialog Box in ASP.Net | <p>I've created a word document generator in C sharp and I want that generated word document to be save in a specific place in the client. I'm looking for a similar functionality like FolderBrowserDialog in Windows Form. I'm using ASP.Net and I tried may solutions but still no luck. Anyone can help me.</p>
| c# jquery asp.net | [0, 5, 9] |
1,326,948 | 1,326,949 | Calling Javascript on a page programmatically (in c#) and then submitting it back to the server | <p>I need to request a page (I'm using httpwebrequest at the moment), call some javascript ( e.g</p>
<p>function selected(id) {
document.getElementById("selected").value = id;
}</p>
<p>and then submit that back to the server . . . is this possible?</p>
<p><strong>EDIT</strong></p>
<p>Sorry for the vagueness.</p>
<p>The page I'm trying to interface with is already 100% working, all I need to do is find a way to trick the server into thinking that someone has loaded up the page, caused a piece of jScript to be run, and submit it back to the server, like a faux user. I'm trying to use the embedded webBrowser on a winForm at the moment, it's easiest to do it this way because the code that waits to be told when to make this request is already written, it just needs to be able to simulate the squishy human that's not in the middle.</p>
<p>Incase you can't tell I'm currently learning javascript so forgive me if I'm not too sure with something basic ^_^</p>
| c# javascript | [0, 3] |
5,326,297 | 5,326,298 | Some Javascript variables not displaying in window when they should | <p>I have a web form and I am using JQuery to pull values the user has input and display them on the screen with an additional string added to it. The problem is that only two of the values are being displayed. When I look at the debugger, I can see the variables are populated but they aren't showing up on the screen.</p>
<p>My web form:</p>
<pre><code><form method="POST" id="sas_form" action="#">
<select name="var_type" id="var_type">
<option value="1">1</option>
</select>
<input type="text" name="name" id="name">
<input type="text" name="value" value="0" id="value">
<input type="text" name="something" id="something">
<a href="#" id="add-row">Add Another row</a>
<div id="renderArea"></div>
</form>
</code></pre>
<p>My Javascript:</p>
<pre><code>$(document).ready(function() {
var i = 0;
$('#add-row').click(function() {
var var_type = $('#var_type').val();
var name = $('#name').val();
var value = $('#value').val();
var something = $('#something').val();
$('#renderArea').append({'-Var VarType="'+var_type+'" Position="'+i+'"
Name="'+ name +'"><Imputed Value>' + value + '</Imputed Value>
Something = ' + something});
// increment the position
i += 1;
})
});
</code></pre>
| javascript jquery | [3, 5] |
5,600,515 | 5,600,516 | How can i determine whether a mouse is connected or not using PHP? | <p>Is it possible to determine whether mouse or keyboard is plugged in or not in PHP? If not is it possible in Java? </p>
| java php | [1, 2] |
4,932,703 | 4,932,704 | Transfer data from desktop to android device | <p>I have started working on Android platform a few days ago. I want to transfer data from a desktop computer to a android device (ICONIA TAB). I am using C# in the desktop computer and want to transfer data using wireless network. </p>
<p>For instance, if I move the cursor in a C# form, it will pass the corresponding coordinate values to the tablet. </p>
<p>any link / sample code to solve the problem would be greatly appreciated</p>
| c# android | [0, 4] |
1,079,503 | 1,079,504 | Is it a good idea to store my DataContext in Session Memory? | <p>I'm writing a pretty straightforward ASP.net project. It's using a Linq2Sql DataContext to access stored procedures. There's a IDisposable class that creates a new DataContext in it's constructor and disposes it in it's dispose.</p>
<p>Whenever possible I group together requests inside the:</p>
<pre><code> using(var dc = new MyDataAccessClass())
{
//All the data requests in here
}
// Do stuff with the data here
</code></pre>
<p>So there are quite a few of these throughout the code mostly in the UserControls, and I was just thinking if it would make sense to Create a single DataAccess Class in the PageLoad of the starting page (Or the master page), store it in Session Memory, and reference in all the UserControls and whatnot, then dispose of it in the PreRender stage.</p>
<p>So here's my question, is this a bad idea? I imagine this would involve a few dangling connections to the database, as exceptions or debugging would stop the PreRender running.
Maybe a check on the MasterPage's Load to see if there's anything in that session Variable and to dispose it if it is, would sort it.</p>
<p>Or is there a smarter way to share a DataContext throughout the page life cycle without your DBA wanting to hit you with your keyboard?</p>
| c# asp.net | [0, 9] |
5,524,148 | 5,524,149 | Super Noob Question: Getting a returned integer value from a Method | <p>This is a super noob question... I created a method that gets a sharedpreference and returns it. However, I don't know how to get and use the integer that is returned by the method.</p>
<p>here is the method:</p>
<pre><code>public int getX() {
return mPrefs.getInt("x", 1);
}
</code></pre>
<p>How do I call this method in a way that allows me to get and use that integer value?</p>
| java android | [1, 4] |
5,750,481 | 5,750,482 | Attaching event handler to each table cell at runtime | <p>I have created a table at design time and adding rows to it at runtime.
I want to attach a mouseover event to each row of first column which displays the respective tooltip.</p>
<pre><code>for(ctr=0;ctr<noOfRows;ctr++){
var myTable=document.getElementById("myTable");
var newRow = myTable.insertRow(1);
var cell0 = newRow.insertCell(0);
cell0.innerHTML="Cell Data"+"<div class='hiddenToolTip' id='tip"+ctr+"'>"+tooltip+"</div>";
cell0.onmouseover=function(){
$("#tip"+ctr).show('blind',500);
};
cell0.onmouseout=function(){
$("#tip"+ctr).hide();
};
}
</code></pre>
<p>The problem is that the 'ctr' variable is always coming as the highest value inside 'onmouseover' and 'onmouseout' function.</p>
| javascript jquery | [3, 5] |
365,274 | 365,275 | onContextItemSelected to Dialog | <p>I get this error when i am selecting a ContextMenu Item to pop up a custom Dialog.</p>
<pre><code> W/InputManagerService(59): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44f518c0
</code></pre>
<p>Code below </p>
<pre><code> public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
Map<String, String> data = (Map<String, String>) getListView().getItemAtPosition(info.position);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
String user_ids = preferences.getString("userID", null);
switch (item.getItemId()) {
case R.id.pm:
pms(data.get("pid"),user_ids,data.get("Name"));
return true;
}
return super.onContextItemSelected(item);
}
private void pms(final String fu2, final String to,final String to2) {
dialog = new Dialog(this.getParent());
dialog.setContentView(R.layout.popup_reply);
dialog.setTitle("To: "+to2);
dialog.setCancelable(true);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
body = (EditText) dialog.findViewById(R.id.editText2);
sub = (EditText) dialog.findViewById(R.id.editText1);
Button button = (Button) dialog.findViewById(R.id.Button01);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
Button button2 = (Button) dialog.findViewById(R.id.Button02);
button2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
new ADownloadFileAsync().execute(fu2);
}
});
dialog.show();
}
</code></pre>
<p>I am only assuming that the Contextmenu is not out of focus before it calls the dialg. Because I can call the dialog from a button just fine.</p>
| java android | [1, 4] |
95,985 | 95,986 | C# - Get JavaScript variable value using HTMLAgilityPack | <p>I currently have 2 JavaScript variables in which I need to retrieve values from. The HTML consists of a series of nested DIVs with no id/name attributes. Is it possible to retrieve the data from these variables using HTMLAgilityPack? If so how would I go about doing so, if not what would be required, regular expressions? If the latter, please help me in creating a regular expression that would allow me to do this. Thank you.</p>
<pre><code><div style="margin: 12px 0px;" align="left">
<script type="text/javascript">
variable1 = "var1";
variable2 = "var2";
</script>
</div>
</code></pre>
| c# javascript | [0, 3] |
5,060,743 | 5,060,744 | microsoft jscript runtime error object doesn't support this property or method jquery | <p>I a using asp.net vs 2008.I am trying jquery. I am getting this error
<strong>"microsoft jscript runtime error object doesn't support this property or method jquery"</strong><br>
Any help is appreciated.</p>
<p>This is the code i am using.</p>
<pre><code> <title></title>
<script type="text/javascript" src="jquery-1.6.4.js"></script>
<script type="text/javascript">
$(document).ready(function() {
("button").click(function() {
$("p").hide();
});
}); </script>
</head>
<body>
<form id="form1" runat="server">
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Click me</button>
</form>
</body>
</code></pre>
| jquery asp.net | [5, 9] |
2,722,980 | 2,722,981 | ImageView Not Shown After Rotation In Android | <p>Actually I programming a app that use image rotation. But when I rotate image, it doesn't show anything.</p>
<p>This is my code:</p>
<p>XML file:</p>
<pre><code><?xml version="1.0" encoding="utf-8" ?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rotate_test_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/android"
android:src="@drawable/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:scaleType="matrix"
android:adjustViewBounds="true"
android:contentDescription="@string/android_description" >
</ImageView>
</LinearLayout>
</code></pre>
<p>Activity file:</p>
<pre><code>public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.rotate_test_layout);
ImageView imageView = (ImageView)findViewById(R.id.android);
imageView.setScaleType(ScaleType.MATRIX);
Matrix matrix = new Matrix();
matrix.postRotate(90);
imageView.setImageMatrix(matrix);
}
</code></pre>
| java android | [1, 4] |
4,137,212 | 4,137,213 | Combine two objects into one | <p>I'm preparing to pass values to a method:</p>
<pre><code> private string BuildMessage(int templateID, string body, object data)
</code></pre>
<p>where the <strong>data</strong> param is an array of name/value pairs. To prepare my values for that <strong>data</strong> param I need to combine the properties of a strongly typed class with the values of a simple 2d array.</p>
<p>What's the best way to merge those values?</p>
| c# asp.net | [0, 9] |
2,013,931 | 2,013,932 | Add and transform layers of images and text like Photoshop fx | <p>This is just a question of approach and ideas, rather than solving an issue.</p>
<p>You know it from Photoshop, where you can add layers of text and images onto each other and transform and move them around to design a complete image. </p>
<p>What do you call this? And do you know some jQuery plugins that does this?</p>
<p>Thank you in advance.</p>
<p>EDIT:
I don't need any other Photoshop feature, as blending, filters etc.</p>
| javascript jquery | [3, 5] |
3,749,975 | 3,749,976 | Jquery / Javascript find first visible element after scroll | <p>I have code like below:</p>
<pre><code><div id="container">
<div class="item" id="1">blah blah</div>
<div class="item" id="2">blah blah 2</div>
</div>
</code></pre>
<p>But actually there are lots and lots of with class='item'. </p>
<p>Basically as the user scrolls this great long list of items I want to change the style of the current top visible one (like google reader!). Have looked around for solution in jquery or plain javascript but can't seem to find one. Anyone have any ideas?</p>
<p>Thanks</p>
<p>Mark</p>
| javascript jquery | [3, 5] |
5,331,625 | 5,331,626 | How to use for loop to scan all controls in page in ASP .NET? | <p>How to use for loop to scan all controls in page in ASP .NET?</p>
<p>as i would like to validate all textboxs' text in one for loop</p>
| c# asp.net | [0, 9] |
889,895 | 889,896 | How can I use a JavaScript variable as a PHP variable? | <p>I'm trying to include JavaScript variables into PHP code as PHP variables, but I'm having problems doing so. When a button is clicked, the following function is called:</p>
<pre><code><script type="text/javascript">
function addTraining(leve, name, date)
{
var level_var = document.getElementById(leve);
var training_name_var = document.getElementById(name);
var training_date_var = document.getElementById(date);
<?php
$result = "INSERT INTO training(level, school_name, training_date) VALUES('level_var', 'training_name_var', 'training_date_var')" or die("Query not possible.");
?>
</script>
</code></pre>
<p>How can this problem be fixed?</p>
| php javascript | [2, 3] |
3,591,432 | 3,591,433 | How to access data binding object in aspx page in ASP.NET? | <p>I am trying to hide or show a certain section of my table depending on the value of a property in my binding object(s). </p>
<pre><code>public class Class1
{
public bool Display { get; set; }
}
</code></pre>
<p>In ASP.NET MVC, I can just do the following (assuming that Class1 is the model that binds to the page.)</p>
<pre><code><table>
<tr>Row 1</tr>
<tr>Row 2</tr>
<% if(Model.Display) { %>
<tr>Row 3</tr>
<tr>Row 4</tr>
<% } %>
</table>
</code></pre>
<p>How can I achieve the same behavior in transitional ASP.NET? That "Model" variable is not available. How do I retrieve the data binding object? Thanks.</p>
| c# asp.net | [0, 9] |
4,630,454 | 4,630,455 | How to find elements without a class in Jquery? | <p>I have the following html</p>
<pre><code><div class="one">One<div>
<div class="two">two<div>
<div >three<div>
<div >four<div>
<div class="three">five<div>
</code></pre>
<p>How would I find the div elements which don't have a class attribute? ie three and four?</p>
| javascript jquery | [3, 5] |
234,154 | 234,155 | Disable button refresh browers | <p>I have a problem with sending message. I create a jsp page with calling form to send message using method Post. when i click button refresh on browers FF, it automatically send message again. I don't want to again send it. How could i disable button refresh?.</p>
| java javascript jquery | [1, 3, 5] |
2,543,765 | 2,543,766 | Determine OS using the Environment.OSVersion object - C# | <p>What is the best to determine the Microsoft OS that is hosting your ASP.NET application using the <code>System.Environment.OSVersion</code> namespace </p>
<p>I need an example for Windows XP, Windows Server 2003 and Windows Vista</p>
<p>Here is what I am trying to accomplish using pseudocode</p>
<pre><code>switch(/* Condition for determining OS */)
{
case "WindowsXP":
//Do Windows XP stuff
break;
case "Windows Server 2003":
//Do Windows Server 2003 stuff
break;
case "Windows Vista":
//Do Windows Vista stuff
break;
}
</code></pre>
| c# asp.net | [0, 9] |
3,792,138 | 3,792,139 | Get value of each on blur() event | <p>I have a page which contain a bunch of text area generated by a PHP script. There is a hidden input type that contains an id of a variable. Basically what I want to do is to call the .ajax() JQuery method on .blur() on any of the text areas and pass the value of the textarea + the id from the hidden input.
All of my text areas are named like this: tr1,tr2,tr3,etc. And the hidden fields:tr_id1,tr_id2,etc</p>
<p>So how can I get the value from both elements so I can use them somewhere else?</p>
| javascript jquery | [3, 5] |
2,902,586 | 2,902,587 | How do i remove/destroy all child elements from a div entirely- .remove() does not seem to work properly | <p>Im dynamically loading content into gallery format-</p>
<p>i have a table or list of image data, it needs to be able to discard the entire set of data, and reconstruct it again with new data.</p>
<p>The problem i have, is when i call .remove() on the entire div structure, it stores all of the child elements if i got to put them back.</p>
<p>This is a problem because if i have one page of information that has say 24 items, then calling the remove and adding the next set- which might have say only the last 3 items in the set- the other 21 items that were constructed before are showing up because the structure is the same- is there a more appropriate way to completely destory the information and all child elements of a div?</p>
| javascript jquery | [3, 5] |
2,046,221 | 2,046,222 | Multicast delegates in C++ | <p>I am in the process of converting some C# code into C++. I had initially though of replacing the delegates with C-style callbacks. However, on further inspection of the code, I have realized that this is not going to work, as the delegates are being used in a multicast manner, with (pseudo C# code) statements like:</p>
<pre><code>DelegateTypeOne one = new DelegateTypeOne(someCallbackFunc1)
one += new DelegateTypeOne(someCallbackFunc2)
</code></pre>
<p>I understand that if the code being ported used the delegates in a single cast fashion, then using regular C style function pointers may have worked. On that note, I have one question, is the following C++ code valid?:</p>
<pre><code>typedef std::vector<int> (CallbackTypeOne*) (const std::string& s, const bool b);
std::vector<int> foo (const std::string& s, const bool b);
CallbackTypeOne func_ptr = NULL;
func_ptr = new CallbackTypeOne(foo); // Note: new being used on a typedef not a type
// or should I just assign the func the normal way?
func_ptr = foo; // this is what I am doing at the moment
</code></pre>
<p>My original idea on implementing delegates would be to write an ABC called Delegate, which would be a functor. All other delegates would derive from this ABC, and they will have a STL container (most likely, a list), which will contain a list of any assigned functions, to be called in a sequential order.</p>
<p>This seems to be rather a lot of work, and I'm not even convinced its the most suitable approach. Has anyone done this sort of C# to C++ traqnslation before, and what is the recommended way to implement multicast delegates in C++?</p>
| c# c++ | [0, 6] |
3,170,915 | 3,170,916 | Unescape JavaScript's escape() using C# | <p>Are the any functions in C# that handle escape/unescape like JavaScript?</p>
<p>I have a JSON string like this:</p>
<p><code>{"Feeds":[{"Url":"www.test.com","FeedType":"Twitter"},{"Url":"www.test2.com","FeedType":"Youtube"}]}</code></p>
<p>Which looks like this after <code>escape()</code></p>
<p><code>%7B%22Feeds%22%3A%5B%7B%22Url%22%3A%22www.test.com%22%2C%22FeedType%22%3A%22Twitter%22%7D%2C%7B%22Url%22%3A%22www.test2.com%22%2C%22FeedType%22%3A%22Youtube%22%7D%5D%7D</code></p>
<p>In my C# code I would like to unescape this string so that it looks exactly the same as it did before the <code>escape()</code></p>
<p>Is this possible?</p>
| c# javascript asp.net | [0, 3, 9] |
5,207,456 | 5,207,457 | load more using jquery? | <p>I have a div having 100 results like.</p>
<pre><code><div id="main">
<div class="sub">This is a test 1</div></br>
<div class="sub">This is a test 2</div></br>
<div class="sub">This is a test 3</div></br>
.
.
.
<div class="sub">This is a test 1oo</div></br>
</div>
</code></pre>
<p>At a time I am showing 10 results how can I add another 10 results on clicking add more button and so on.</p>
| javascript jquery | [3, 5] |
697,873 | 697,874 | Why this codeblock is creating an infinite loop? | <p>I was playing with a fiddle earlier today while trying to answer a question and found a confusing thing. Being a JS newbie I am not being able to debug whats going wrong myself. I even tried to check the source0 of <code>$.fn.show</code> in jQuery source but couldn't figure out whats going wrong.</p>
<p><strong>HTML:</strong></p>
<pre><code><input type='text' id='dataBox'/>
<input type='button' value='toggle' id='toggleButton' />
</code></pre>
<p><strong>jQuery code:</strong></p>
<pre><code>jQuery(function ($) {
var _oldShow = $.fn.show;
$.fn.show = function (speed, oldCallback) {
return $(this).each(function () {
var obj = $(this),
newCallback = function () {
if ($.isFunction(oldCallback)) {
oldCallback.apply(obj);
}
obj.trigger('afterShow');
};
obj.trigger('beforeShow');
if(speed)
_oldShow.apply(obj, [speed,newCallback]);
else
_oldShow.apply(obj, [newCallback]);
});
}
});
$('#dataBox').bind('beforeShow', function () {
alert('beforeShow');
});
$('#toggleButton').click(function(){
$('#dataBox').show();
});
</code></pre>
<p>The problem is for some mistake that I did, is causing this line to execute infinite number of times
obj.trigger('beforeShow'); </p>
<p>and hence the <code>alert</code> in this block</p>
<pre><code> $('#dataBox').bind('beforeShow', function () {
alert('beforeShow');
});
</code></pre>
<p>seems not to stop.</p>
<p>Irrespect of what I am trying to do or if this can be done any other way, can someone please explain what I am doing wrong here. I have been trying for several hours but couldn't figure out.</p>
<p><a href="http://jsfiddle.net/joycse06/evdpj/" rel="nofollow">FIDDLE</a></p>
| javascript jquery | [3, 5] |
3,091,514 | 3,091,515 | Change dates inside span to match user's timezone | <p>I have this function:</p>
<pre><code>function get_time_zone_offset() {
var current_date = new Date();
return -current_date.getTimezoneOffset() / 60;
}
</code></pre>
<p>I want a jQuery code to change every span which class is 'timeago' title value to its value plus the number the function above returns. For example:</p>
<p>Before: </p>
<pre><code><span class="timeago" title="7/4/2012 9:28:30 AM">7/4/2012 9:28:30 AM</span>
</code></pre>
<p>After: </p>
<pre><code><span class="timeago" title="7/4/2012 12:28:30 PM">7/4/2012 12:28:30 PM</span>
</code></pre>
| javascript jquery | [3, 5] |
504,942 | 504,943 | how to change class of <a> tags in jquery | <p>I have a table structure, something similar to</p>
<pre><code><table style="width: 100%;">
<tr>
<td>
<a href="#" class="xx">one</a>
</td>
<td>
</tr>
<tr>
<td>
<a href="#" class="xx">Two</a>
</td>
<td>
</tr>
<tr>
<td>
<a href="#" class="xx">Three</a>
</td>
<td>
</tr>
</table>
</code></pre>
<p>css:</p>
<pre><code>.xx {
border: 5px solid green;
}
.yy {
border: 5px solid red;
}
</code></pre>
<p>Now what I expect is, if I click on 1st row/1st <code><a></code> its border will turn to red, and rest of <code><a></code> in green, again if I clcik on 1st row/1st <code><a></code> it should turn to green. Also if I click on any other <code><a></code> then only it should turn to red, but rest of the <code><a></code> should be green.</p>
<p>I tried:</p>
<pre><code>$(function () {
$("a.xx").click(function () {
if ($(this).hasClass("xx")) {
$(this).removeClass("xx").addClass("yy");
} else {
$(this).removeClass("yy").addClass("xx");
}
});
});
</code></pre>
<p>But it's not working.</p>
| javascript jquery | [3, 5] |
4,316,537 | 4,316,538 | Make button with function in jquery? | <p>I am trying to make a button with click function to run my jquery:</p>
<pre><code>Function tester(){alert("test")}
</code></pre>
<p>My raw html button code is:</p>
<pre><code><button class="t1" id="52" onClick="tester()">sometext</button>
</code></pre>
<p>But i want to make the button using just jquery code...</p>
<p>How can I make this button with jquery?</p>
| javascript jquery | [3, 5] |
2,468,146 | 2,468,147 | Java / Android rookie here, please help me | <p>{@link android.media.MediaMetadataRetriever#METADATA_KEY_ARTIST}</p>
<p>What is happening above?</p>
<p>What does "@link" mean?</p>
<p>and why is there a #? What does that # mean? </p>
<p>thanks a lot, experts @ Stack Overflow~</p>
| java android | [1, 4] |
4,398,292 | 4,398,293 | Android Shared preferences with multiple activities | <p>How do i retrieve shared preferences that have been saved from a previous activity? Do i need to enable file writing or some other manifest modifications?</p>
| java android | [1, 4] |
1,957,505 | 1,957,506 | Coloring Map in C# | <p>i have map of a city i want to color the diffent area of that map with deffernt color , any one help me with example please, one thing more i am beginer in stackoberflow and also in in c# coloring
so i have no idea from where to start and no idea about coloring in C#</p>
| c# asp.net | [0, 9] |
247,648 | 247,649 | How do I add an additional window.onload event in Javascript | <p>In my asp.net User Control I'm adding some script to the window.onload event like so:</p>
<pre><code>if (!Page.ClientScript.IsStartupScriptRegistered(this.GetType(), onloadScriptName))
Page.ClientScript.RegisterStartupScript(this.GetType(), onloadScriptName,
"window.onload = function() {myFunction();};", true);
</code></pre>
<p>My problem is, if there is already something in the onload event, than this overwrites it.
How would I go about allowing two user controls to each execute javascript in the onload event?</p>
<p>*<em>Edit:</em>*Thanks for the info on third party libraries. I'll keep them in mind. </p>
| c# asp.net javascript | [0, 9, 3] |
411,917 | 411,918 | why .on can't be used in my $(document).ready() function? | <p>The page can be viewed at</p>
<p><a href="http://cistrome.org/cps/seqconfig?did=2693" rel="nofollow">http://cistrome.org/cps/seqconfig?did=2693</a></p>
<p>When load in Firebugs, it gives me this error:</p>
<pre><code>TypeError: $(".open_gene").on is not a function
[Break On This Error]
$(".open_gene").on('change', function(event) {
</code></pre>
<p>However, if I type in this expression in Firebug's console, it can be evaluated as a function without any problems:</p>
<pre><code>>>> $(".open_gene").on
function()
</code></pre>
<p>I was wondering what might be the reason to cause this issue.
Does anyone have ideas about this? Thanks!</p>
| javascript jquery | [3, 5] |
1,968,182 | 1,968,183 | Can I programmatically tell when a new tab is opened in the browser? | <p>I'm addressing a problem with an ASP .NET web application where I want to avoid using query strings to uniquely identify dynamic content. I want to index the content relative to the opened tab/window that is displaying it. Is this programmatically possible? If so, what is the compatibility of the approach across multiple browsers? Thank you for your help.</p>
| asp.net javascript | [9, 3] |
4,702,123 | 4,702,124 | Why does release mode affect on Thread.CurrentThread.CurrentCulture? | <p>I have ASP .NET application.
I set culture in Application_Begin request:</p>
<pre><code>System.Threading.Thread.CurrentThread.CurrentCulture = myCulture;
System.Threading.Thread.CurrentThread.CurrentUICulture = myCulture;
</code></pre>
<p>When I get current culture from page, it is <code>myCulture</code> in debug mode and it is "en-GB" in release mode.</p>
<p>I don't understand why Release mode affects on <code>Thread.CurrentThread.CurrentCulture</code></p>
<p>I use VS2010 and .NET 4.0</p>
<p>Thanks</p>
| c# asp.net | [0, 9] |
1,083,828 | 1,083,829 | How to set the value to a variable in the script(.js) file from the script in aspx file | <p>Im having a variable 'multi' , the same name i used within the js file. I need to set a value to the variable within my aspx page and pass it on to the javascript file. Couldnt find any help. </p>
<p>aspx script code</p>
<p></p>
<pre><code> var itemdata = [];
var multi;
//var plot;
$(document).ready(function () {
$.ajax({
type: "POST",
url: "ChartBinder.asmx/BindChart",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
//alert(multi);
var resultObj = $.parseJSON(response.d);
multi = resultObj;
// alert(resultObj.Pie);
multi.Trend = resultObj.Trend;
//alert(multi.Trend);
$.getScript('Scripts/highcharts.src.js', function () {
DrawPie(resultObj.Pie);
DrawTrend(resultObj.Trend);
// do something here
});
},
error: function (msg) {
alert("Error");
}
});
});
</code></pre>
<p>js script</p>
<pre><code>(function () {
var seriesCount = window.multi.Trend.length;
var newcolors = [];
for (i = 0; i < seriesCount; i++) {
newcolors[i] = multi.Trend[i].color;
}
})
</code></pre>
| javascript jquery asp.net | [3, 5, 9] |
539,947 | 539,948 | Clean way of using polymorphism at the presentation layer - ASP.NET | <p>A lot of times, I find myself doing UI control manipulation in the code behind and wanted to find a clean way of doing this.</p>
<p>Use Case:
A drop down has CSS1 style, editable in Edit mode but
has CSS2 style, view only in View mode</p>
<p>I can achieve this by simply have a set of switch case statements. I can use polymorphism and create a EditMode and ViewMode class but that requires me to have a reference to the UI control to be passed to these classes. This tightly couples the UI and the logic layer which I want to avoid.</p>
<p>Any ideas?</p>
<p><strong>EDIT:
Can anyone give an example of externalizing the UI logic from the code behind?</strong></p>
| c# asp.net | [0, 9] |
2,079,522 | 2,079,523 | check in .cs page and displaying in .aspx | <p>In my .cs page i want to check some condition and depending on that i will show/hide a div in my .aspx page. Is that possible?</p>
<p>like </p>
<pre><code>if(j==0)
{
div id="hi".visible=false; //something like that
}
</code></pre>
<p>I hope u guys understood the problem.</p>
<p>Thank you</p>
| c# asp.net | [0, 9] |
162,019 | 162,020 | Display "Enable JavaScript" message only when JavaScript is disabled | <p>I want to display to the user a message that says "please enable JavaScript" in the case that JavaScript is disabled. I want that message, and nothing else to be displayed when JavaScript is disabled.</p>
<p>So, to do this, I can put the message in the DOM and hide all other elements with display:none. Then in JavaScript I can set the message to display hidden and show all other elements.</p>
<p>But I get a flicker with this approach. The error message shows up for a while (especially on mobile browsers) before it gets hidden.</p>
<p>How can I minimize the time the error message is displayed for?</p>
| javascript jquery | [3, 5] |
3,526,690 | 3,526,691 | Multi month selector | <p>Does anybody know whats the name of the multi-month selector control used in Mint.com?
.
I have a video of it been used <a href="http://www.youtube.com/watch?feature=player_embedded&v=p3ceNFLLR3E" rel="nofollow">here</a>. I've come across a lot of date picker and calendar controls but all of them are pretty much the same. </p>
<p>Preferably in jquey</p>
| javascript jquery | [3, 5] |
3,987,331 | 3,987,332 | Sending email to a user | <p>I am using this code to send email</p>
<pre><code>var message = new MailMessage("[email protected]", "[email protected]");
message.Subject = "Testing";
message.IsBodyHtml = true;
message.Body = "<html><body>IMAGINE A LOT OF HTML CODING HERE</body></html>";
</code></pre>
<p>The problem is I just copied the HTML that I want to send as email and now I have to make the whole HTML code in ONE single line! Otherwise it is saying ";" missing! I mean, now I can't keep on removing spaces and put it ALL in one line! It's too much HTML code that I need to send. What do I do ? :/</p>
<p><strong>[EDIT]
Another question: Is there a limit to this <code>message.Body</code>? Like a limit to how much HTML can be inserted in this?</strong></p>
| c# asp.net | [0, 9] |
4,537,299 | 4,537,300 | Page wise Loading in Gridview in Asp.net and C# | <p>I am using Linq to SQL to load data around 10k records which is taking time for paging. can you please let me know how to implement page wise loading of records for Grid View</p>
| c# asp.net | [0, 9] |
2,679,271 | 2,679,272 | Getting Textbox value in Javascript | <p>I am trying to get the value of the textbox in a javascript, but its not working. Given below is the code of my test page</p>
<pre><code><%@ Page Title="" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="false"
CodeFile="test3.aspx.vb" Inherits="test3" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
<script language="javascript">
function GetAlert() {
var TestVar = document.getElementById('txt_model_code').value;
alert(TestVar);
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
<asp:TextBox ID="txt_model_code" runat="server" ></asp:TextBox><br /><br />
<input type="button" value="db Function" onclick="GetAlert()" /><br />
</asp:Content>
</code></pre>
<p>So where am i going wrong?? How to get the text entered in the textbox in the javascript???</p>
| javascript asp.net | [3, 9] |
5,846,667 | 5,846,668 | Click on Div to get information box for a few seconds | <p>I have this code below:
And what I need to do is to be able to click on the Div right below and when done the #info_page div would show up in the middle of the screen for a few seconds. Like a dialog but just a simple jquery temp show() with a timer?
Is this possible?</p>
<p>The current code is below.</p>
<pre><code><div onclick="show_info_box">Click to get message</div>
<div id="info_box" style="display:none">
<span class="custom info">
<img src="info.png" alt="info" height="48" width="48" />
<em>Information</em>
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type specimen book.
</span>
</div>
</code></pre>
| javascript jquery | [3, 5] |
4,268,807 | 4,268,808 | jQuery selector to grab cells in the same column | <p>Given a multirow, multicolumn table, how can I select all cells in the same <em>column</em> as any arbitrary cell (e.g. a cell that is clicked on).</p>
<p>Something like:</p>
<pre><code>$("td").click(function(){
var columnNo = $(this).columnNo?
$(this).closest("table").find("tr td:eq("+columnNo+")").css("color", "red");
});
</code></pre>
<p>I need to do this without naming the columns individually. E.g. it should work on simple generic <code>table</code> markup without extra classes or IDs..</p>
| javascript jquery | [3, 5] |
3,026,820 | 3,026,821 | Provide link to lightbox image | <p>I'm using a light box(jquery.lightbox-0.5.js) for my gallery page. And my code for display the image is</p>
<pre><code><ul>
<div class="gallery" id="gallery1">
<li> <a style="display: inline;" href="sample.jpg" target="_blank"> <img src="sample_thumb.jpg" alt="" /> </a> </li>
</div>
</ul>
</code></pre>
<p>It's working fine. </p>
<p>But now i want to provide the link to the Lightbox image. i.e., On clicking the Image within the Lightbox, i want to redirect the user to some other page.</p>
<p>But i dont know how to achieve this? Does anyone have any idea about this? Thanks in advance.</p>
| php jquery | [2, 5] |
1,668,166 | 1,668,167 | create an object | <p>how can i create an object so i can get the item.
i found an example that said </p>
<pre><code> Object item2 = getListView().getAdapter().getItem(holder.position);
</code></pre>
<p>to create the object but thing is different in my class
can you help me to find how
cause i need the object</p>
<p>here is my class. how can i do it here:</p>
<p>i need the object to do some functions.</p>
| java android | [1, 4] |
5,123,945 | 5,123,946 | Call PHP function from android? | <p>I want to call specific php function on server from Android application and also to send some parameters. Till now I achieved that I can open php file using HttpClient and executed data transfer to Json and show that in my app. So, now I want to be able to call specific function and send parameter to it, how can I do that??
Thanks.</p>
| java android | [1, 4] |
1,364,414 | 1,364,415 | adding event listeners in onCreate | <p>I want to implement a <code>LocationListener</code>. Checked some tutorials and found this:</p>
<pre><code>/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Acquire a reference to the system Location Manager
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
// Define a listener that responds to location updates
LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
// Called when a new location is found by the network location provider.
makeUseOfNewLocation(location);
}
public void onStatusChanged(String provider, int status, Bundle extras) {}
public void onProviderEnabled(String provider) {}
public void onProviderDisabled(String provider) {}
};
// Register the listener with the Location Manager to receive location updates
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
}
</code></pre>
<p>But are event listeners really added in the <code>onCreate</code> method? Looks pretty messy to me. Is it more common to add them to a separate class and create an instance of the class in <code>onCreate</code>? I would like to know the best practices here. </p>
<p>Thanks!</p>
| java android | [1, 4] |
3,651,062 | 3,651,063 | How to pass variable from PHP to JS, perform math on the variable then output to an on page element | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/7705921/how-to-access-php-variables-from-within-javascript">how to access PHP variables from within JavaScript?</a> </p>
</blockquote>
<p>I am trying to pass a variable from mySQL to PHP then to JavaScript to perform some math on it then have the result displayed on page in a specific area (in a <code><p></code> element with a specific ID assigned to it). Is this possible or is there an easier solution?</p>
<p>Thanks!</p>
<p>I already know how to get the variable from MySQL to PHP just having trouble on what to do after that.</p>
<p>Here is my updated code after reading responses. Still not working but I am sure I'm doing something wrong!</p>
<pre><code><p id="p_id"><?php echo $price; ?></p>
<input type="radio" group="radio_group" value="Reduce 10%" onclick="radio_click();" />
<script type="text/javascript">
var price = <?php echo $price; ?>;
function radio_click() {
var target = document.GetElementById('p_id');
var final_number; // this will be variable your store the final number in
final_number = price * .9;
target.innerHTML = final_number;
}
</script>
</code></pre>
| php javascript | [2, 3] |
5,264,860 | 5,264,861 | How to get image width and height uploaded using ajaxfileupload asp.net | <p>I think ajaxcontroltoolkit:ajaxfileupload has too many bugs and wane. since I'm using this component frequently in my projects, I overcome to many serious disturbing bugs and functionality of this control.
Now, I seriously need to get uploaded image width and height using ajaxfileupload before I save it to check either width or height are correct and based on retrieved information, informing users in case of image width and height are not compatible and then prevent the process to go further and save the picture.
Any Ideas please?!</p>
<p>HTML Side:</p>
<pre><code><asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server"
onuploadcomplete="AjaxFileUpload1_UploadComplete" ThrobberID="myThrobber" MaximumNumberOfFiles="1" AllowedFileTypes="jpg,jpeg"/>
</code></pre>
<p>Behind Code:</p>
<pre><code>protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
string filePath = "~/upload/" + e.FileName;
AjaxFileUpload1.SaveAs(filePath);
}
</code></pre>
| c# asp.net | [0, 9] |
2,928,728 | 2,928,729 | javascript inline callback function to separate function | <p>Why is this code working:</p>
<pre><code>function onCordovaReady() {
navigator.globalization.getLocaleName(function (locale) {
jQuery.i18n.properties({
name:'message',
path:'lang/',
mode:'map',
language:locale.value,
callback: function(){
alert(locale.value);
alert(jQuery.i18n.prop('msg_hello'));
alert(jQuery.i18n.prop('msg_complex', 'John'));
}
});
});
}
</code></pre>
<p>And this one not:</p>
<pre><code>function onCordovaReady() {
navigator.globalization.getLocaleName(function (locale) {
jQuery.i18n.properties({
name:'message',
path:'lang/',
mode:'map',
language:locale.value,
callback: onLanguageReady(locale)
});
});
}
function onLanguageReady(locale) {
alert(locale.value);
alert(jQuery.i18n.prop('msg_hello'));
alert(jQuery.i18n.prop('msg_complex', 'John'));
}
</code></pre>
<p>I want to make the callback in a different function so my code will look cleaner, but couldn't get it to work. The first alert will work (it will display nl_NL), but the second and third alert will output [msg_hello] and [msg_complex].</p>
<p>Many thanks!</p>
| javascript jquery | [3, 5] |
463,616 | 463,617 | How can I access a GridView on a page from a control on a Page? | <p>I have an aspx page which has a GridView and a Panel with Summary Data. The Summary Data is in a control and the GridView is on the aspx page. When someone clicks an item in the Summary Data, I want to rebind the GridView, but I can't figure out how to do it from the control.</p>
<p>I tried using FindControl, but probably did not use it correctly.</p>
<p>I tried this with FindControl, but it didn't work:</p>
<pre><code>GridView gv = (GridView)FindControl("gvSearchResults"); //returns null
</code></pre>
| c# asp.net | [0, 9] |
2,094,560 | 2,094,561 | How to convert a string to a 24hr time? | <p>So I have a JSON returning times like "10:00am"> i need to create an array with eight other times from the current system time. so it would go like "10:00am, 11:00am, 12:00pm, 1:00am, etc"</p>
<p>Here's my current code so far:</p>
<pre><code> var katie=new Array();
var webdate = new Date().getHours();
var firsthr = day.date.start.time;
for (i=0; i<=8; i++){
katie{i] = webdate;
webdate = webdate +1;
}
</code></pre>
| javascript jquery | [3, 5] |
5,661,564 | 5,661,565 | send array using jquery | <p>i have a variable $visitRecord->getReferallist() which get the list of doctors in an array . i need to send the array to a php file and do foreach action in php file.. how do i send this array variable in the jquery . This code did not work.</p>
<pre><code> function seekOpinion()
{
var queryUrl = "<?php echo $this->url(array('controller' => 'consultant', 'action' =>'opiniondoclist'));?>";
$.post(queryUrl,{referal:'<?php echo $gotreferal; ?>',visitId:'<?php echo $gotvisitId; ?>',referalList:'<?php echo $visitRecord->getReferallist(); ?>'},function(data)
{
$('.opiniondoclistData').html(data);
});
document.getElementById('opiniondoclistDiv').style.display = "";
}
</code></pre>
| php jquery | [2, 5] |
1,626,754 | 1,626,755 | Android database from website | <p>i was wondering a few things.</p>
<p>I Have a database with 3 rows, and i have to use the database on my website cause it has to be shared with every one that downloads my app cause they can add more things.</p>
<p>Table is called </p>
<p>Poka</p>
<p>And the rows are
- ID
- word(TEXT)
- reply(TEXT)</p>
<p>The Reply is hooked onto the word.</p>
<p>Sense there can be more then 1 of the same "word" text i need it to search threw each of the word that was inputed in the EditText and pick a random reply from that and display it in EditText . And if there are no words, it will say cannot find one.</p>
| java android | [1, 4] |
3,933,073 | 3,933,074 | Struts vs Zend ? Java vs PHP? | <p>I know it's a hot question that need anwsers ^^
From my viewpoint, using Java vs PHP, is nowadays a problem of system resources (Hardware, Software, etc.).</p>
<p>For Java, you have to deploy J2EE Stack (JDK, AppServer, etc.) (~200M) on your server, for PHP you need to deploy a LAMP system (~100M).
Using Java was in my opinion due to object oriented programming in web application, but today we have a lot of Object Oriented Web Language (Ruby, Python, PHP).</p>
<p>So the question when to choose between Java or PHP for new projects ? Maybe the community difference ?</p>
<p>I know that stackoverflow is not made for discussion, but it's a (good?) question that need answers (for me and for others maybe) ^^.</p>
| java php | [1, 2] |
3,202,598 | 3,202,599 | Using != with counter controlled loops | <p>Last question for today all...I will get back with tomorrow..I have a lot to follow up on...</p>
<p>I am looking in Reilly Java text- talking about counter controlled loop patterns..(does not matter what language..)</p>
<p>The author for counter controlled loops (for, while, etc) and with nesting loops...uses the != for test...Now I realize != is used for certain situations with event controlled loops-like sentinel or EOF type of loops- but to me- using it with a counter controlled loop is a bad idea...very prone to errors..</p>
<p>Examples:</p>
<pre><code>x = 0;
while (x != 100) {
y = 0;
while (y != 100) {
...
y++;
}
x++;
}
</code></pre>
<p>Would it be better to just say..using the other relational operators...</p>
<pre><code>x = 0;
while (x < 100) { //or even better some defined constant...
y = 0;
while (y < 100) {
...
y++;
}
x++;
}
</code></pre>
<p>Which from what I have seen is usually the way presented in texts..classes.etc.. </p>
<p>Once again- would all you considered this bad- or just a different way of doing it...
Thanks...</p>
| java c++ | [1, 6] |
5,196,334 | 5,196,335 | Issue when scrolltofixed plugin switches to position: absolute | <p>i'm having a problem using the scrolltofixed jquery plugin</p>
<p><a href="https://github.com/bigspotteddog/ScrollToFixed" rel="nofollow">https://github.com/bigspotteddog/ScrollToFixed</a></p>
<p>i use:</p>
<pre><code>$('#tostick').scrollToFixed({ limit: $('#app-footer').offset().top - $('#tostick').height() - 20});
</code></pre>
<p>my #tostick is inside a </p>
<pre><code> margin:0 auto
</code></pre>
<p>div container and as soon it hits the fixed footer and the script switches from fixed to absolute positioning it jumps out of the container because </p>
<pre><code>left: 1107px
</code></pre>
<p>is applied, which is the distance to the left border of the browser window, instead of the left border of the centered div container. it tried to add:</p>
<pre><code>offsetLeft: -$('#container').offset().left
</code></pre>
<p>which is completely ignored.
thanks in advance for any tip!</p>
| javascript jquery | [3, 5] |
3,230,419 | 3,230,420 | Put commas in input value | <p>Having an issue with commas and values.</p>
<p>I have a value that keeps changing all the time from checkboxes, sliding from jQuery ui slider and keyup functions. I want to add commas to the total that is being changed each time rather than building it into each function. If I have to build it into each function, I am not opposed to that either though. The end value just needs to have commas in it.</p>
<p>Here's a fiddle: <a href="http://jsfiddle.net/ZSeHU/" rel="nofollow">http://jsfiddle.net/ZSeHU/</a></p>
<p>Any thoughts here?</p>
| javascript jquery | [3, 5] |
5,862,407 | 5,862,408 | Why the autocomplete widget doesn't work if the text is NOT empty? | <p>How is ti possible that the code below show the array ONLY if the text is empty... It should show the list during the typing NOT when the text is empty.</p>
<p>STEPS:</p>
<ol>
<li>Focus on text</li>
<li>type a text, like 'abc' (this text returns an array doing the ajax call)</li>
<li>nothing happen</li>
<li><p>delete 'abc' and i see the array correctly.</p>
<pre><code>$('#titolare').keyup(function(){
var titolare = $.trim($('#titolare').val());
$.ajax({
type: "POST",
url: "page.php",
data: { titolare: titolare },
success: function(msg){
var obj = jQuery.parseJSON(msg);
if (obj.result){
var tit = obj.titolare
, tit_a = [];
$.each (tit, function (a) {
tit_a[a] = { titolare: tit[a].titolare, cod_fis: tit[a].cod_fis };
});
$("#titolare").autocomplete({
minLength: 0,
source: tit_a,
focus: function( event, ui ) {
$("#titolare").val(ui.item.titolare);
return false;
},
select: function( event, ui ) {
$("#titolare").val(ui.item.titolare);
return false;
}
})
.data( "autocomplete" )._renderItem = function(ul, item) {
return $( "<li></li>" )
.data( "item.autocomplete", item )
.append( "<a>" + item.titolare + "<br />("+ item.cod_fis +")</a>")
.appendTo( ul );
};
}
}
});
});
</code></pre></li>
</ol>
| javascript jquery | [3, 5] |
2,367,099 | 2,367,100 | Layout touch rotation | <p>What is the correct approach to rotate a layout that is filled with ImageViews, but the rotation should happen via the touch event?</p>
<p>I.e. I have 4 ImageView objects in one layout, when the user does a rotate "gesture" with the finger, I want the Layout to rotate as the finger goes (not animation). And of course, stop when the touching stops.</p>
<p>Thanks</p>
| java android | [1, 4] |
4,542,902 | 4,542,903 | Custom beforeunload prompt with javascript | <p>I'm trying to setup an exit survey so that when a user leaves our checkout page they are prompted asking them why they're leaving.</p>
<p>Is this possible?</p>
<p>I've spent some time on Google but it appears as though the only solution is a simple browser-controlled confirm-like prompt. Is this true?</p>
<p><strong>update</strong></p>
<p>The following confirm dialog never appears, the page just changes or exits. How can I prevent the page from changing/exiting until I wait for a user's response. I guess I should ask, how can I resume a user's exit/page change action after using <code>e.preventDefault();</code> ?</p>
<pre><code>jQuery(window).bind('beforeunload', function() {
return function () {
alert('x');
setTimeout(50000, function () {
confirm('you sure?');
});
}();
});
</code></pre>
| javascript jquery | [3, 5] |
2,340,582 | 2,340,583 | Bind multipal value in grid | <p>I try :</p>
<pre><code> <asp:TemplateField HeaderText="Local ">
<ItemTemplate>
<asp:TextBox ID="txtLocal" runat="server" Text='<%# Eval("LPName") == null ? "" : Eval(Title) %>' ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</code></pre>
<p>i want if field<code>LPName</code> have not any value, take value from <code>title</code>.But unable to do this.Is there any method or i am in wrong way.Thanks.</p>
| c# asp.net | [0, 9] |
3,582,455 | 3,582,456 | Is cursor over element (on page load)? | <p>I have a .hover() action assigned to an element to hide/show something depending on the cursor being over it. The problem I am running into is that when the page loads and the cursor is OVER the element it doesn't register as being over because its not firing the mouseenter event.</p>
<p>Is there a another way to tell if the cursor is over a desired element?</p>
| javascript jquery | [3, 5] |
5,095,051 | 5,095,052 | How do you Response.Redirect to another website with the same name, but with different port? | <p>I have two separate websites running locally on my IIS server at work. One is on normal port 80 and the other 90. Now, I have a Default page which makes the users select one of the pictures that will redirect them to the correct website. </p>
<p>It works fine with the port 80, since you don't have to specify which port you are running a normal website, but how can I redirect the second picture to redirect to port 90.</p>
<p>This is the code I have, but it keeps adding a stupid forward slash... </p>
<pre><code>Response.Redirect(Request.ApplicationPath + ":90/login.aspx");
</code></pre>
<p>It ends up showing <a href="http://192.168.2.122/:90/login.aspx" rel="nofollow">http://192.168.2.122/:90/login.aspx</a>.</p>
<p>Any help will be gladly appreciated. Thanks!</p>
| c# asp.net | [0, 9] |
393,770 | 393,771 | Calling C# Code behind code from Java Script | <p>We are using VS2008. We are calling ActiveX shell scrip object which is created as EXE executable, which reads the Pinpad for authentication and returns the result. This object is called in Javascript in ASPX page.</p>
<p>After getting the result we need to store the information, which we have written in C# code behind page. </p>
<p>My question is, how we should call the code behind or a WCF service in ASPX java script.</p>
<p>my java script code is as follows:</p>
<pre><code> function launchExecutable(strdata) {
try {
var shellActiveXObject = new ActiveXObject("WScript.Shell");
shellActiveXObject.Run("c:\\Test\\EBCK.exe " + strdata, 1, true);
}
catch (e) {
alert(e.message);
}
try {
var abc = window.clipboardData.getData('Text');
// from here we have to call the C# code which is written in CS file or
// call a WCF Web service
}
catch (e) {
alert(e.message);
}
</code></pre>
<p>}</p>
| c# javascript | [0, 3] |
1,040,516 | 1,040,517 | Hierarchical treeview implementation | <p>What is the best way to generate a hierarchical treeview in asp.net (C#) from a SQL database table filled with all of a company's employees? I will never know at what level or employee I will be starting at. Any links or directions would be appreciated.</p>
| c# asp.net | [0, 9] |
3,021,308 | 3,021,309 | Detect if launcher is on foreground | <p>I'm using the following code to understand the processes currently on foreground:</p>
<pre><code>ActivityManager activityManager = (ActivityManager) newContext.getSystemService( Context.ACTIVITY_SERVICE );
List<RunningAppProcessInfo> appProcesses = activityManager.getRunningAppProcesses();
for(RunningAppProcessInfo appProcess : appProcesses){
if(appProcess.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND){
Log.i("Foreground App", appProcess.processName);
[...]
}
}
</code></pre>
<p>But it works only if I'm using a 4.0.4 launcher like stock one, apex, nova launchrs.
If I switch to GoLauncher or Launcher Pro, they are not logged. It looks like they never go foreground (or this portion of code can't detect them).</p>
| java android | [1, 4] |
4,984,506 | 4,984,507 | Submit button clicking changing the value of it to another thing | <p>maybe very easy!
I'm php coder and I don't have experience in js but I must do this for one of my codes
suppose I have sub1 in page after clicking it must be that sub1 but value now is sub2</p>
<pre><code> <html>
<head>
<title>pharmacy</title>
</head>
<body>
<form method="post" action="pharmacy.php">
<?php
//some code
if(array_key_exists('update',$_POST)){
//somecode
}
?>
<input type="submit" name="update" value="<?php echo if(isset($_GET['update'])) ? 'Show' : 'Update' ?> ">
</form>
</body>
</html>
</code></pre>
| php javascript | [2, 3] |
5,790,408 | 5,790,409 | Accessing JS data from PHP | <p>A remote site is supplying a data structure in a js file.</p>
<p>I can include this file in my page to access the data and display it in my page.</p>
<pre><code><head>
<script type="text/javascript" src="http://www.example.co.uk/includes/js/data.js"></script>
</head>
</code></pre>
<p>Does anyone know how I use PHP to take this data and store in it a database?</p>
| php javascript | [2, 3] |
5,741,603 | 5,741,604 | Tipsy tooltip is not working | <p>In <a href="http://www.designingstudios.com/projects/LSI_Html/detail.html" rel="nofollow">this page</a>, I have implemented tipsy tooltip, jbgallery two jquery plugins. You can observe tool tip appears when you rollover logo, i have written the same for icons appearing right bottom of the page i.e. (Tag, Facebook, Twitter icons etc...) can any one help me in this please...</p>
| javascript jquery | [3, 5] |
1,348,290 | 1,348,291 | Highlighting search words like Chrome with jQuery | <p>I have recently done a very simple highlighting with jQuery and a highlight plugin. It looks like this:</p>
<blockquote>
<p>$('myButton').click(function() {</p>
<p>$('body').highlight($('#myInputText').val());</p>
<p>});</p>
</blockquote>
<p>But I wonder how can I do the Chrome like highlighting, I mean highlight the letters whenever I type in some letter in textbox without submitting. I think maybe use a keyup event... Any ideas?</p>
<p><strong>Thanks Andy, i changed 'this[0]' to 'search[i]' in your code and it works if there is only one 'p' tag</strong></p>
<pre><code>$(document).ready(function(){
var search = ['p', 'div', 'span'];
$("#highlighter").bind('keyup', function(e){
var pattern = $(this).val();
$.each(search, function(i){
var str = search[i];
var orgText = $(str).text();
orgText = orgText.replace(pattern, function($1){
return "<span style='background-color: red;'>" + $1 + "</span>"
});
$(str).html(orgText);
});
});
});
</code></pre>
| javascript jquery | [3, 5] |
4,239,821 | 4,239,822 | for hovering 3 items at a time with javascript using same class | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/14579369/how-to-create-javascript-function-for-hovering-3-or-4-element-at-a-time">How to create javascript function for hovering 3 or 4 element at a time</a> </p>
</blockquote>
<p>I want to hover 3 element at a time. when i will put cursor one of them. It should hover other two item. i want to do this with javascript.
please see this:</p>
<p><a href="http://jsfiddle.net/Taslimkhan/wTcTU/14/" rel="nofollow">http://jsfiddle.net/Taslimkhan/wTcTU/14/</a></p>
<p>I have used class three times in my html document. when i hover on 1st box set it show all box hover.
but i need:
when i will hover box 1 it should show only A box, and when i will hover A box it should show only box1,</p>
<p>when i will hover box 2 it should show only B box, and when i will hover B box it should show only box2,</p>
<p>same behaviour should do for third set of box. </p>
<p>I cant use same class two times. but I want to use same class. again and again. but how can i do them? please help me.</p>
<p>There are code i have used:</p>
<pre><code>$(document).ready(function(){
// box 1
$('.box1').mouseover(function(){
$('.box1').css('background-color', '#F7FE2E');
$('.box4').css('background-color', '#F7FE2E');
$('.hov').css('color', '#0f0');
});
$('.box1').mouseout(function(){
$('.box1').css('background-color', '#FFF');
$('.box4').css('background-color', '#FFF');
$('.hov').css('color', '#fff');
});
</code></pre>
| javascript jquery | [3, 5] |
5,093,723 | 5,093,724 | Alternative of this script in jQuery? | <p>I use the following script to get the content of the <code>remaining.php</code>.
<br>
The drawback is that sometimes it doesn't work or it is kinda slow to display the text. Is there any other way of doing this ?</p>
<p>Thank you</p>
<pre><code>$(document).ready(function(){
$("#SubmitButton").click(function (){
$('#remaining').load('remaining.php');
});
});
</code></pre>
| javascript jquery | [3, 5] |
3,381,653 | 3,381,654 | Converting simple python method(s) to C++ | <p>I want to create an RLE compression and decompression method for a CS project I have to do. The problem is not so much the logic, but the know-how of C++. All I currently have learned in school is Python so I tried doing this project in Python and it was really easy...</p>
<p>I plan to become well read in C++ but tonight there is not enough time. I hope to get help because if I can understand the equivalent C++ code I might feel much more comfortable with the language.</p>
<p><strong>Can someone help me convert the following python code into C++ equivalent code?</strong></p>
<pre><code># compresses data using RLE compression
def compress(data):
letter_counter = 1
new_data = []
for i in range(len(data)):
try:
# if the element is the same as the next one
if data[i] == data[i + 1]:
letter_counter += 1
# if different element than previous index
else:
new_data.append(str(letter_counter) + data[i])
letter_counter = 1 # reset the letter count
except IndexError: # when the index is out of range (no more elements)
new_data.append(str(letter_counter) + data[i])
return new_data
data = ['w', 'w', 'w', 'w', 'w', 'b', 'b', 'b', 'c', 'd', 'e', 'e']
data2 = ['w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w']
return compress(data) # prints ['5w', '3b', '1c', '1d', '2e']
return compress(data2) # prints ['14w']
</code></pre>
| c++ python | [6, 7] |
5,027,230 | 5,027,231 | jquery wrap element around a lot of elements | <p>I have following html and want to wrap with javascript or jquery a div around all li's (its not definied how many li's there are)</p>
<pre><code><div class='example1'>
<div class='example2'>
<h1>Test</h1>
<div class='example3'>
<li></li>
<li></li>
...
<li></li>
<li></li>
</div>
</code></pre>
<p>The Result should look like</p>
<pre><code><div class='example1'>
<div class='example2'>
<h1>Test</h1>
<div class='example3'>
<div class='lis'>
<li></li>
<li></li>
...
<li></li>
<li></li>
</div>
</div>
</code></pre>
<p>I'm not able to add anything else the existing html :(</p>
<p>Can you please help me?</p>
| javascript jquery | [3, 5] |
4,169,054 | 4,169,055 | Getting sender in jQuery | <p>I have a large list of check boxes all with unique <code>id</code> values. I'd like to get the <code>id</code> of the checkbox that executes my JavaScript function. Can I do this using <code>$(this)</code>? Can you provide an example?</p>
<p>Many thanks in advance!</p>
| javascript jquery | [3, 5] |
3,113,797 | 3,113,798 | Getting value in <select>, using JQuery | <p>I need to get a current value of SELECT tag. And for this I'm using <code>$('select').val()</code>, but this return only default value and it's don't changed. May be I can help me?</p>
<pre><code>$('div#buy input').fancybox({
ajax : {
type : "POST",
data : {
id: $('input[name="id"]').val(),
count: $('#count').val()
}
}
});
<select id="count">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</code></pre>
| javascript jquery | [3, 5] |
4,430,527 | 4,430,528 | jquery expanding and resizing problem | <p>Im using this jquery to try and control how wide and high a div opens depending on the screen resolution this is the code im using but it doesn't seem to be having any effect apart from cropping my image. I say it doesnt seem to work becuase it leaves a big space and when I look at firebug it tells me the box has expanded to the 600px x 488px when im viewing in the lower resolution. </p>
<p>Im not sure if the images are pushing the div out the that size because the pictures are exactly 600px x 488px but I need them to be the same file just smaller for dynamic PHP gallery updating in the future, how can I fix this code and how can I easily resize the images depending on the resolution?</p>
<pre><code>$(document).ready(function(){
if ((screen.width>=1440) && (screen.height>=764)) {
$("#slideshow_box")
.animate({"height": "600px"}, 500)
.animate({"width": "488px"}, 500);
}
else {
$("#slideshow_box")
.animate({"height": "400px"}, 500)
.animate({"width": "288px"}, 500);
}
});
</code></pre>
| javascript jquery | [3, 5] |
3,359,188 | 3,359,189 | Android custom list slow | <p>Is there a better way to create a custom list, for my code here seems to make for a less-responsive list. I can't use any of the standard Android lists because I need two ListView's in a ScrollView.</p>
<pre><code> setContentView(R.layout.alertsview);
inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
topRows = new ArrayList<View>();
topLayout = (LinearLayout)findViewById(R.id.topListLayout);
topLayout.removeAllViews();
topRows.clear();
List<Camera> camList = new ArrayList<Camera>(SitesOrchestrator.getInstance().currentSite.cameraList);
for (int i = 0; i < camList.size(); i++)
{
Camera cam = camList.get(i);
View row = inflater.inflate(R.layout.cameraalertrow, null);
TextView name = (TextView)row.findViewById(R.id.cameraNameAlerts);
CheckBox chk = (CheckBox)row.findViewById(R.id.camAlertChk);
name.setText(cam.name);
chk.setChecked(cam.alertsEnabled);
chk.setOnCheckedChangeListener(this);
String index = Integer.toString(i);
chk.setTag(index);
topRows.add(row);
topLayout.addView(row);
}
</code></pre>
| java android | [1, 4] |
4,482,298 | 4,482,299 | Which Form of Java should I learn before getting into Android Developing? (J2ME, J2SE, J2EE, servlet adn etc.) | <p>I want to take Java course for developing Android applications. I have all the necessary tools. But wanna ask before proceeding for course, Which Form of Java should I learn before getting into Android Developing? (J2ME, J2SE, J2EE, servlet adn etc.). What are the things which I should learn in that form?</p>
| java android | [1, 4] |
1,629,996 | 1,629,997 | javascript prompt input | <pre><code>function show_prompt()
{
var name=prompt("Please enter your name");
}
</code></pre>
<p>I am calling this function when a button is clicked before submitting the form. </p>
<p>How would I post the 'name' var with form so I can use it with php?</p>
<p>Also, would it be possible to verify the user input before letting it to be submitted? For example to make sure it's at least 4 characters? The user should not be able to click the button before the input meets the criteria. I'm guessing that is not possible, at least with the alert() function. Or could it display another alert message if the input is invalid and re-prompt?</p>
| javascript jquery | [3, 5] |
3,720,341 | 3,720,342 | reference another dropdown value from js method call | <p>I am trying to pass in values from another dropdown (ddlColor) and pass it's selected id and text value into the event method for ddlEngine</p>
<pre><code><asp:DropDownList ID="ddlEngine" runat="server" onchange="GetSearchResults(ddlColor.value, ddlColor.text, this.options[selectedIndex].text);" />
</code></pre>
<p>I guess I can't reference the ddlColor like this, something is not right in my syntax and I can't see what.</p>
<p>Here is my attempt:</p>
<p>this is defined globally at the top of my page just after the js tag:</p>
<pre><code>var ddlColor = document.getElementById('<%=ddlColor.ClientID %>');
var colorid_dropdown = ddlColor.options[ddlColor.selectedIndex].value;
var colorname_dropdown = ddlColor.options[ddlColor.selectedIndex].text;
</code></pre>
<p>then in teh onchange of my dropdown I tried to append it to the call:</p>
<pre><code>onchange="GetSearchResults("' + colorid_dropdown + ", " + "'colorname_dropdown + '" + ", this.options[selectedIndex].text);"
</code></pre>
| javascript asp.net | [3, 9] |
1,154,240 | 1,154,241 | dropdownlist selectedvalue | <p>I've used a webservice to create a dropdownlist of countries and I'm trying to add the dropdownlist selection to the sql database, but when I do that by using ddlCountry.SelectedValue in my insert statement, only the first value in the dropdownlist is showing up in the table. Should I use onselectedindexchanged to somehow store the value? What code should I be using?</p>
| c# asp.net | [0, 9] |
1,308,982 | 1,308,983 | cycle through list, change style every x seconds | <p>I have a simple slideshow (jQuery Cycle) that displays an image every ten seconds (7 total images). In an adjacent div, I have a list with 7 bullet points. What's the easiest way to script a method in which the css/style of the appropriate bullet point changes as its accompanying image. The idea is to have all list items displayed, but 1 highlighted every 10 seconds?</p>
| javascript jquery | [3, 5] |
1,351,036 | 1,351,037 | Increase element ID by one after every click? | <p>I am trying to clone multiple divs on my page by using the jQuery <code>.clone()</code> method. The problem is, as soon as a div is cloned, it needs to have a unique ID. The cloned ID has to be there too. I was thinking I could keep the old ID and then just add a number on, increasing as more div's are on the page. </p>
<p>Example: base ID = one, so div one would be <code>id</code>, then div two would be <code>id-2</code>, then div three would be <code>id-3</code>, etc.</p>
<p>Is this possible? My attempt at this is below:</p>
<pre><code>$("a").click(function(){
var target = $(this).attr("href");
var id = $(target).attr("id");
$(target).clone().attr("id",id + $(id).size()).attr("class","drag").appendTo("body");
});
</code></pre>
<p>Each <code>a</code> tag looks like this:</p>
<pre><code><a href="#one">One</a>
<a href="#two">Two</a>
</code></pre>
<p>Then the cloned element looks like this:</p>
<pre><code><div class="drag base" style="background-color:blue" id="one"></div>
<div class="drag base" style="background-color:green" id="two"></div>
</code></pre>
| javascript jquery | [3, 5] |
5,473,405 | 5,473,406 | How to increase performance of jQuery | <p>i have an chat application written in jsp and jQuery. I have used the setTimeout method for threads who are continuously posting request in some URL. My browser is hanging after some time and cpu utilization is very high. </p>
<p>Is there any way to increase performance of JS?</p>
| javascript jquery | [3, 5] |
5,170,722 | 5,170,723 | jquery: if (target) is child of ('.wrapper') then (do something) | <pre><code>var target = $(this).attr("href");
if {target is child of ('.wrapper')} then (do something)
</code></pre>
<p>simple syntax? can someone show me the correct syntax here?</p>
| javascript jquery | [3, 5] |
729,323 | 729,324 | implement two interfaces in an anonymous class | <p>I have two interfaces:</p>
<pre><code>interface A {
void foo();
}
interface B {
void bar();
}
</code></pre>
<p>I am able to create anonymous instances of classes implementing either of these interfaces like so:</p>
<pre><code>new A(){
void foo(){}
}
</code></pre>
<p>or:</p>
<pre><code>new B(){
void bar(){}
}
</code></pre>
<p>I want to create an anonymous class that implements both interfaces. Something like (the fictitious):</p>
<pre><code>new A implements B {
void foo(){}
void bar(){}
}
</code></pre>
<p>This obviously gives a compiler error: "B cannot be resolved to a type".</p>
<p>The workaround is quite simple:</p>
<pre><code>class Aggregate implements A, B {
void foo(){}
void bar(){}
}
</code></pre>
<p>I then use Aggregate where ever I would have used the anonymous class. </p>
<p>I was wondering if it is even legal for an anonymous class to implement two interfaces.</p>
| java android | [1, 4] |
2,677,674 | 2,677,675 | jquery change div | <p>hello my friends I have two div's and I doing this div's change</p>
<pre><code>div class="switchLeft
div class="switchRight"
<tab>
(function ($) {
$(".switchLeft").click(function ()
{ $(this).toggleClass("switchLeft switchRight"); });
})(jQuery);
</tab>
</code></pre>
<p>and I have other two div's
I changed the div above, I would like to see that change this div</p>
<p>I have done this but not working thank you</p>
<pre><code>$(".switchLeft").click(function (){
{ $(this).toggleClass("switchLeft switchRight"); });
var myClass = $(this).attr("class");
if (myClass == "switchLeft") {
$('.advertTabMenu').hide();
$('.searchTabMenu').show();
}
else {
$('.searchTabMenu').hide();
$('.advertTabMenu').show();
}
};
</code></pre>
<p>I can not add code to the site</p>
| jquery asp.net | [5, 9] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.