Unnamed: 0 int64 65 6.03M | Id int64 66 6.03M | Title stringlengths 10 191 | input stringlengths 23 4.18k | output stringclasses 10 values | Tag_Number stringclasses 10 values |
|---|---|---|---|---|---|
988,694 | 988,695 | how to work UICollectionView in iOS 5 | <p>IS it work UICollictionview in IOS 5 error Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named NSLayoutConstraint'</p>
| iphone | [8] |
259,830 | 259,831 | jQuery data retrieve from div | <pre><code><div align="left" style="margin-bottom:3px;">
<b>ID:</b>
37749
<b>Active on:</b>
03/28/2012
</div>
</code></pre>
<p>this is my content, how to retrieve numbers. use Jquery </p>
| jquery | [5] |
4,102,166 | 4,102,167 | Java -- This seems like pass by reference to me | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/40480/is-java-pass-by-reference">Is Java pass by reference?</a> </p>
</blockquote>
<p>So consider the following two examples and their respective output:</p>
<pre><code>public class LooksLikePassByValue {
public static void main(String[] args) {
Integer num = 1;
change(num);
System.out.println(num);
}
public static void change(Integer num)
{
num = 2;
}
}
</code></pre>
<p>Output:</p>
<blockquote>
<p>1</p>
</blockquote>
<hr>
<pre><code> public class LooksLikePassByReference {
public static void main(String[] args) {
Properties properties = new Properties();
properties.setProperty("url", "www.google.com");
change(properties);
System.out.println(properties.getProperty("url"));
}
public static void change(Properties properties2)
{
properties2.setProperty("url", "www.yahoo.com");
}
}
</code></pre>
<p>Output:</p>
<blockquote>
<p>www.yahoo.com</p>
</blockquote>
<p>Why would this be <code>www.yahoo.com?</code> This doesn't like like passbyvalue to me.</p>
| java | [1] |
2,786,534 | 2,786,535 | Executing a function when the console window closes? | <p>I want to execute a function when the program is closed by user.</p>
<p>For example, if the main program is <code>time.sleep(1000)</code>,how can I write a txt to record unexpected termination of the program.</p>
<p>The program is packaged into exe by cxfreeze. Click the "X" to close the console window.</p>
<p>I know <a href="http://docs.python.org/3.3/library/atexit.html" rel="nofollow">atexit</a> can deal with sys.exit(),but is there a more powerful way can deal with close window event?</p>
<p><strong>Questions</strong></p>
<ol>
<li>Is this possible in Python?</li>
<li>If so, how can I do this?</li>
</ol>
| python | [7] |
5,760,286 | 5,760,287 | Can someone tell me what does "XThrowIfError" does? | <p>I cannot find its definition in the documentation...</p>
| iphone | [8] |
1,013,336 | 1,013,337 | My android application lags when i switch screens | <p>When i open one of my screens for the fist time, there is lag, but after it has been opened and i switch it runs smoothly. Is there a way to load the all the images before the app starts so that it doesn't lag the first time i switch to those screens?</p>
| android | [4] |
2,126,160 | 2,126,161 | jQuery use keypress on absolute input | <p>i'm using jquery to insert input tag on element absolute and i i want to use keypress on that.</p>
<p>after create and use keypress in <code>on()</code> i cant get keypress (enter).</p>
<p>jQuery inserted input element:</p>
<pre><code>$(event.target).html("<input value= '"+ $(event.target).text() +"' style='width:200px;float:right;height:17px;padding:0px;height:22px;padding-right:3px;' id='category_input_change' />");
$(event.target).append("<ul class='styledlist' style='width:50px;float:right;'><li style='line-height:13px;' id='save_category' >ذخیره</li></ul>");
$(event.target).append("<ul class='styledlist' style='width:50px;float:right;'><li style='line-height:13px;' id='cancel_save_category' >انصراف</li></ul>") ;
</code></pre>
<p>keypress functions:</p>
<pre><code>$('category_input_change').bind('keypress', function(e) {
if(e.keyCode==13){
alert('ddddd');
// Enter pressed... do anything here...
}
});
</code></pre>
<p>i'm try to use on() but getting this error:</p>
<pre><code>TypeError: $(...).on is not a function
</code></pre>
<p>code:</p>
<pre><code>$('category_input_change').on('keypress', function(e) {
if(e.keyCode==13){
alert('ddddd');
// Enter pressed... do anything here...
}
});
</code></pre>
| jquery | [5] |
1,054,814 | 1,054,815 | Read dropdownlist value from a gridview | <p>I have a gridview with a dropdownlist column, and i enabled the paging function. The problem is every time after it turns to the next page, the selected value of the dropdownlist on the previous page is back to default value. </p>
<p>I tried to wrap the code with <code>if(!ispostback)</code>, only the first page available other pages are disappear</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
List<CPDEmployee> employeelist = (List<CPDEmployee>)Cache["EmployeeList"];
unverifiedlist.DataSource = employeelist;
unverifiedlist.AllowPaging = true;
unverifiedlist.PageSize = 10;
unverifiedlist.DataBind();
}
}
protected void PageSelect_SelectedIndexChanged(object sender, EventArgs e)
{
int page = int.Parse(PageSelect.SelectedItem.Text);
unverifiedlist.PageIndex = page;
DataBind();
}
<asp:GridView ID="unverifiedlist" runat="server" AutoGenerateColumns="false" AllowSorting="true" AllowPaging="true" ViewStateMode="Enabled">
<Columns><asp:TemplateField HeaderText="Options" >
<ItemTemplate>
<asp:DropDownList ID="options" runat="server" AutoPostBack="true">
<asp:ListItem Value="1">Verified</asp:ListItem>
<asp:ListItem Value="0">Rejected</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerSettings Visible="false"/>
</asp:GridView>
<asp:DropDownList ID="PageSelect" runat="server" AutoPostBack="true" OnSelectedIndexChanged="PageSelect_SelectedIndexChanged"></asp:DropDownList>
</code></pre>
<p>does anyone know how to fix it, where should I put ispostback? thanks </p>
| asp.net | [9] |
2,665,720 | 2,665,721 | Create staticmethod from an existing method outside of the class? ("unbound method" error) | <p>How can you make a class method static after the class is defined? In other words, why does the third case fail? </p>
<pre>
>>> class b:
... @staticmethod
... def foo():
... pass
...
>>> b.foo()
>>> class c:
... def foo():
... pass
... foo = staticmethod( foo )
...
>>> c.foo()
>>> class d:
... def foo():
... pass
...
>>> d.foo = staticmethod( d.foo )
>>> d.foo()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unbound method foo() must be called with d instance as first argument (got nothing instead)
</pre>
| python | [7] |
4,617,993 | 4,617,994 | Convert kilobytes to bytes in PHP | <p>How can I convert kilobytes to bytes in PHP? Let's say I get the value 22.2 kb and I want to return this in bytes.</p>
| php | [2] |
4,750,361 | 4,750,362 | How to manage styles, themes, layouts so it looks similar on different android platforms including ICS, Honeycomb and Gingerbread | <p>Looking for prescribed approach for writing compatible android application on different platforms including ICS, Honeycomb and Gingerbread.</p>
<p>I already spike out regarding managing backward compatibility with action-bar, swipable-tabs, etc and now looking cleaner approach for managing UI aspects for the same.</p>
<p>Please suggest ? that will really speed up my job.
Thanks</p>
| android | [4] |
469,608 | 469,609 | FB redirection not working with custom image | <p>I am trying to allow user to login to my website using FB and then get redirected back to my website. I am unsure why it is not working. When I click on the image, it goes to FB website and then display "An error occurred. Please try again later." Here is the code I am using and not sure if there is better code I should use. I do not want to use the fb login button. All I want teh user to do is click on my custom FB image and login and then redirect back to my website <a href="http://www.XXXXX.com/wp" rel="nofollow">http://www.XXXXX.com/wp</a>.</p>
<p>FB Button
</p>
<p>Facebook.php
<pre><code>$app_id = XXXX;
$app_secret = "XXXX";
$my_url = "http://www.XXX.com/wp";
if(!isset( $_REQUEST["code"] ) ) {
$dialog_url = "http://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url);
echo("<script> top.location.href='" . $dialog_url . "'</script>");
} else {
$code = $_REQUEST["code"];
}
$token_url = "https://graph.facebook.com/oauth/access_token?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url) . "&client_secret="
. $app_secret . "&code=" . $code;
$access_token = file_get_contents($token_url);
$graph_url = "https://graph.facebook.com/me?" . $access_token;
$user = json_decode(file_get_contents($graph_url));
echo("Hello " . $user->name);
?>
</code></pre>
| php | [2] |
5,246,083 | 5,246,084 | Bitmap from url without scaling | <p>i am getting bitamap from a url. Everything is fine but i m having small issue i.e my bitmap from url gets scales down. I want bitmap of original size without scaling. How to achieve this. I tried options but no success yet. here is my code:</p>
<pre><code>try {
URL url = new URL(src);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
} catch (IOException e) {
e.printStackTrace();
return null;
}
</code></pre>
<p>I set this drawable to imagview. But image is scaled down. I want original size and original size is not too big so need to worry about outofmemory exception. Is there any way to avoid scaling while parsing bitmap from url stream.</p>
<p>Thanks.</p>
| android | [4] |
1,551,148 | 1,551,149 | How can I load more than one javasrcipt on the same page? | <p>This script works fine if my images rotate on a single page.</p>
<p>If I do this one once instance of this works at one time.</p>
<p>Question: How can I load more than one instance of javasrcipt on the same page?</p>
<pre><code><html>
<head>
<script type="text/javascript" src="js1.js"></script>
</head>
<body OnLoad="rotateImage('rImage')">
<div>
<img name="rImage" src="banners/chiropractor.jpg" width=222 height=218>
</div>
</body>
</html>
</code></pre>
| javascript | [3] |
1,281,000 | 1,281,001 | Having a form submit on every keypress | <p>I have a currency calculator that requires buttons to convert to/from currencies. I'd like to make it so that it converts (runs the form) as soon as anything is typed in. Currently, my jQuery that handles the button click looks like this (this is one of two click handlers):</p>
<pre><code> $('#convertFromButton').click(function() {
$("#currencySelectValue2").val($("#currencySelect").val());
$("#btcValueForm").val($("#btcValue").val());
$.post("php/convertFromForm.php", $("#convertFromForm").serialize(), function(data){
$('#fromCurrencyValue').removeClass('intra-field-label');
$('#fromCurrencyValue').val(data);
});
});
</code></pre>
<p>The first text field is <code>#fromCurrencyValue</code> and the 2nd one is <code>#btcValue</code>.</p>
<p>How can I get it to work in the manner I described?</p>
| jquery | [5] |
5,008,148 | 5,008,149 | help with error SCRIPT5007: Unable to set value of the property 'onclick' | <p>I have a link in the html page and it has the <code>id="redirect"</code></p>
<p>and this in (script.js)</p>
<pre><code>window.onload = initAll();
function initAll(){
document.getElementById("redirect").onclick = clickHandler;
}
function clickHandler(){
alert("Sure!");
return true;
}
</code></pre>
<p>I'm getting this error message </p>
<pre><code>SCRIPT5007: Unable to set value of the property 'onclick': object is null or undefined
</code></pre>
<p>I tried this in (IE9,IE8,chrome,Firefox 4.0.1) and still not running, please help</p>
| javascript | [3] |
3,303,260 | 3,303,261 | Parse Custom DateTime | <p>I'm having trouble parsing this datetime:</p>
<pre><code> DateTime ParseDateTime(string dateString)
{
//dateString is "2011-07-22 16:11:14,770"
var format = "yyyy-MM-dd hh:mm:ss,fff";
var dateTime = DateTime.ParseExact(dateString, format, CultureInfo.InvariantCulture);
return dateTime;
}
</code></pre>
<p>What am I doing wrong?</p>
| c# | [0] |
4,867,363 | 4,867,364 | Why is that Jquery not working in chrome? | <p>I have <a href="http://www.reelworks.net/wordpress/" rel="nofollow">this site</a> that i am working with. On the main page the slider rotates every 5 seconds and I have a surrounding div around the video and when clicked I fire this</p>
<pre><code>$('.video_button_a').click(function(event){
event.preventDefault();
$('#slideshow').cycle('stop');
});
</code></pre>
<p>The second command stops the slideshow from happening and firefox it works great but chrome the slideshow keeps going..</p>
<p>If you open up firebug in chrome and run this then it stops</p>
<pre><code>$('#slideshow').cycle('stop');
</code></pre>
<p>Any ideas on how to address this</p>
| jquery | [5] |
1,238,105 | 1,238,106 | Can you set a maximum limit to an integer (C++)? | <p>If I never want an integer to go over 100, is there any simple way to make sure that the integer never exceeds 100, regardless of how much the user adds to it?</p>
<p>For example, </p>
<pre><code>50 + 40 = 90
50 + 50 = 100
50 + 60 = 100
50 + 90 = 100
</code></pre>
<p>Thanks in advance</p>
| c++ | [6] |
4,287,003 | 4,287,004 | C#, quick generics question | <p>I have a need to create a quick class with just 2 properties (left and top), I'll then call these in a collection. </p>
<p>Is there a quick way to create the class structure without having to actually create the strongly typed class itself using generics?</p>
<p>Thanks in advance</p>
<p>Better still, does the framwework have a built in type than can just store left, top, right, bottom co-ordinates in integer values?</p>
| c# | [0] |
39,521 | 39,522 | is "Redundant #include Guards" necessary on Visual Studio? | <p>I used to use the following code to make sure that the include file is not loaded more than once.</p>
<pre><code>#ifndef _STRING_
#include <string>
#endif
// use std::string here
std::string str;
...
</code></pre>
<p>This trick is illustrated in the book "API Design for C++".</p>
<p>Now my co-work told me that this is not necessary in Visual Studio because if the implementation head file of string contains <code>#pragma once</code>, the include guard is not required to improve the compilation speed.</p>
<p>Is that correct?</p>
<p>Quote from original book:</p>
<pre><code>7.2.3 Redundant #include Guards
Another way to reduce the overhead of parsing too many include files is to add redundant preprocessor
guards at the point of inclusion. For example, if you have an include file, bigfile.h, that looks
like this
#ifndef BIGFILE_H
#define BIGFILE_H
// lots and lots of code
#endif
then you might include this file from another header by doing the following:
#ifndef BIGFILE_H
#include "bigfile.h"
#endif
This saves the cost of pointlessly opening and parsing the entire include file if you’ve already
included it.
</code></pre>
| c++ | [6] |
3,259,126 | 3,259,127 | Why am I not allowed to have multiple assignments in for each loop with different lengths of lists in python | <p>Just like I'm allowed to do this: </p>
<p>(EDIT - I'm NOT allowed to do this either, sorry messed up, but anyway I guess my question is more on the lines of how to go about doing parallel assignments in a loop)</p>
<pre><code>for (x,i) in ([0,1,2],[3,4,5]):
# do something
</code></pre>
<p>why am I not allowed to do this in a for each loop (different list length)</p>
<pre><code> for (x,i) in ([4,6,5,7,8,9],[1,2,3]):
# do something
</code></pre>
<p>I know you get a "ValueError: too many values to unpack", but why doesn't the loop stop when i is done with its iteration?</p>
<p>A real use of this would be for something like this that I was trying to do</p>
<pre><code>for (keys,i) in (sorted(dic.keys(),key=custom_sort), range(10)):
print dic[keys]
</code></pre>
<p>where I'm sorting the dictionary as well as printing only the first 10 top results (assume the dictionary has hundreds of keys) - I only wanted the top 10 results.</p>
<p>Since this kind of syntax is not allowed anyway what could be the next best thing to do?</p>
<p>thanks</p>
| python | [7] |
1,437,696 | 1,437,697 | Stopping interval if a user clicks on a li | <p>I have this jquery which works great, but i want to stop it emulating the clicks if a user actually clicks a tab...if anyone can help that would be great!</p>
<pre><code>//Homepage Tabs
$('#lcontent .tab:first').show();
$('#llist li').click(function() {
var thisTop = $(this).position().top;
$('.pointer').animate( {'top': thisTop} );
$('#llist li').removeClass('current');
$(this).addClass('current');
var id = $("li.current a").attr('href');
$("#lcontent div").fadeOut(500).hide();
$(id).fadeIn();
return false;
});
setInterval((function(){
var count = 0;
var ul = $('#llist li');
return function(){
ul.eq(++count % ul.length).click();
};
})(), 3000);
</code></pre>
| jquery | [5] |
5,546,869 | 5,546,870 | Android - java.lang.VerifyError | <p>I'm facing a recurrent problem that I don't know why it is happening. It happens all of a sudden. I didn't do anything different from what I was doing before.</p>
<p>I'm using these tabs: <a href="http://developer.android.com/resources/tutorials/views/hello-tabwidget.html" rel="nofollow">http://developer.android.com/resources/tutorials/views/hello-tabwidget.html</a></p>
<p>When I open one of the three tabs (Class name = Tab1), this problem comes out. Before, this error came out after clicking all of the tabs (????).
A part of the stack trace:</p>
<hr>
<p>Could not find class 'org.android.catsMobile.packageName.Tab1$OrderAdapter', refereced from method org.android.catsMobile.packageName.Tab1.onCreate
[...]</p>
<p>threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
java.lang.VerifyError: org.android.catsMobile.packageName.Tab1</p>
<hr>
| android | [4] |
1,192,816 | 1,192,817 | Changing the value of dynamically created dropdowns | <p>I have a list of drop-down elements dynamically created in my server side code.</p>
<pre><code><select id="color1">
<option value="blue">blue</option>
<option value="red">red</option>
<option value="green">green</option>
</select>
<select id="color2">
<option value="white">white</option>
<option value="orange">orange</option>
<option value="green">green</option>
</select>
<select id="color3">
<option value="black">black</option>
<option value="pink">pink</option>
<option value="brown">brown</option>
</select>
<select id="color4">
<option value="yellow">yellow</option>
<option value="black">black</option>
<option value="green">green</option>
</select>
</code></pre>
<p>I would require to write code in jQuery to change the value of all the SELECT values on a button click based on the selection of one of the SELECT elements.</p>
<p>For Eg: If I select red in the first SELECT, all the SELECT element value should be changed to red. If the value is already present in the target SELECTs, we just need to select the value, otherwise we need to append it.</p>
<p>Is it possible to write it in jQuery?</p>
| jquery | [5] |
1,224,274 | 1,224,275 | C# - Refresh dropdown after a child form closes | <p>I have a c# application with multiple "worker" forms. These forms have numerous comboboxes that are populated from the database on form load, with 'add' buttons beside them. When a user clicks the add button the administrative form is opened allowing the user to add a corresponding value to the database.</p>
<p>For instance, the combobox may be a list of street types. "Drive" is not in the street types table in the database, so the user wants to add it. They click the add button and the admin form is loaded so they can add the "Drive" value to the street types. When the admin form closes, I want to repopulate the combobox upon return to the worker form.</p>
<p>Any insight as to the best way to accomplish this?</p>
| c# | [0] |
893,668 | 893,669 | Getting "missing ; before statement error in javascript | <p>Only thing in the file is the following line:</p>
<pre><code>@include Menu.js
</code></pre>
<p>Is there any way that it stops showing this error??</p>
| javascript | [3] |
5,934,442 | 5,934,443 | adding a textbox server control from code behind? | <p>I'm trying to add a new textbox server control to my page from code-behind.</p>
<pre><code>TextBox txt=new TextBox();
txt.Width=100;
txt.Height=100;
Page.Controls.Add(txt);
</code></pre>
<p>When I write following Code, this error is thrown:</p>
<blockquote>
<p>"Control 'ctl02' of type 'TextBox' must be placed inside a form tag with runat=server. "</p>
</blockquote>
<p>What's the reason this error is thrown? How should this be done? </p>
| asp.net | [9] |
2,790,586 | 2,790,587 | why use c++ Typedef? | <p>My understanding of typedef is to give a declaration an alias.
Such the declaration for int will now be referred to as Integer. But why? Why would someone use typedef? What's the more advantageous reason? </p>
<pre><code>typedef int Integer;
Integer blamo = 50;
cout << blamo << endl;
</code></pre>
| c++ | [6] |
3,959,820 | 3,959,821 | Progress bar appears with loading string before fragment gets loaded in HoneyComb3.0 | <p>hi <br>
I am writing an Android application in which I displays a List . Clicking on any item on list will display another list which is a Fragment.Say this Fragment as Fragment1.I will display this fragment every time I click 1,2,4 listitems. But When I click ListItem3 I will display another Fragment say Fragment2 besides Fragment1. My question is before clicking the ListItem3, a ProgressBar with "Loading" text is displayed at a place where Fragment2 is supposed to be displayed when I click ListItem3. The ProgressBar is there even after the Fragment2 is displayed. Can anyone tell me the reason why this ProgressBar is displayed?
I will be waiting for reply.</p>
<p><br>
Thanks in Advance.</p>
| android | [4] |
1,206,859 | 1,206,860 | Finding closest id within span | <p>I have two images within span. I need the value of id1 for each image-click.</p>
<pre><code><span class="deleteid">
@Html.ActionLink(item.categoryModel.catName, "Show", new { id1=item.itemId})
<img id="iconItemEdit" src="@Url.Content("~/Content/MyIcons/ee.png")"
style="width: 13px; height: 13px;"/>
<img id= "iconDelete" src="@Url.Content("~/Content/MyIcons/delete.png")"
alt="delete" style="width: 13px; height: 13px;"/>
</span>
</code></pre>
<p>For first image I used</p>
<pre><code>$('#iconItemEdit').live('click', function () {
var it = $(this).prev().attr('id1');
</code></pre>
<p>It is working fine. I am having problem finding id for the second image. I tried using same code but it did not work.</p>
<pre><code>$('#iconDelete').live('click', function () {
var it = $(this).prev().attr('id1');
alert(it);
</code></pre>
<p>is returning <code>undefined</code> instead.</p>
| jquery | [5] |
5,660,683 | 5,660,684 | How add clip art at run time on button click | <p>Hello
I am working on project where I need to customize our card at run time.
Mean when user click on a button then it will show a horizontal slider(that contain images ) user click one of the image and images comes over the screen.</p>
| javascript | [3] |
2,702,659 | 2,702,660 | How do I throw and exception using `if` and `else` if the user enter something that isn't a valid integer? | <p>I'm writing a program that adds numbers. The program takes input from the user as an integer value and gives him a total of both numbers. But I want that when the user enters any character besides the number, a custom error is written to the console. How do you do that with <code>if</code> and <code>else</code>?</p>
<p>My code:</p>
<pre><code>class Program
{
static void Main(string[] args)
{
double firstnum, secondnum, total;
Console.WriteLine("FIRST NUMBER");
firstnum = Convert.ToDouble(Console.ReadLine());
if (Console.ReadLine == char)
{
Console.WriteLine("error... error wrong keyword, enter only numbers...");
}
Console.WriteLine("SECOND NUMBER");
secondnum = Convert.ToDouble(Console.ReadLine());
total = firstnum + secondnum;
Console.WriteLine("TOTAL VALUE IS =" + total);
Console.ReadLine();
</code></pre>
| c# | [0] |
826,976 | 826,977 | How to get scrollbars showing when when using an accordian in jQuery? | <pre><code>function pageLoad() {
$('#accordion h3').click(function() {
$(this).next().toggle();
return false;
}).next().hide();
<div id="accordion">
<h3><a href="#">Section A</a></h3>
<div id="a">
<Ctrl:A id="a" runat="server"></Ctrl:A>
</div>
<h3><a href="#">Section B</a></h3>
<div id="b">
<Ctrl:B id="b" runat="server"></Ctrl:B>
</div>
<h3><a href="#">Section c</a></h3>
<div id="c">
<Ctrl:C id="c" runat="server"></Ctrl:C>
</div>
</div>
</code></pre>
<p>The problem I am having is when say Setion A dn Section B are expanded, no scroll bars are showing in the broweser window and some fields are below the page and I have to tab to get to them and dont get a browser scrollbar.How can I get the scrollbar when the expansion is more than the height of the window?</p>
| jquery | [5] |
4,353,766 | 4,353,767 | Java for-loop, do i need continue statement here? | <p>Consider this code:</p>
<pre><code>if (int a == 0) {
System.out.println("hello");
continue;
}
</code></pre>
<p>This <code>if</code> is part of a <code>for</code> loop in java. What is the significane of continue statement here? I know <code>continue</code> is the opposite of <code>break</code> so that it wont break out of the loop rather just skip that iteration for anything below it. But in case it is inside an <code>if</code> statement, do I really need it like this?</p>
| java | [1] |
2,339,929 | 2,339,930 | Using HttpModules to modify the response sent to the client | <p>I have two production websites that have similar content. One of these websites needs to be indexed by search engines and the other shouldn't. Is there a way of adding content to the response given to the client using the HttpModule? </p>
<p>In my case, I need the HttpModule to add to the response sent to the when the module is active on that particular web.</p>
| asp.net | [9] |
207,932 | 207,933 | Alternative to scipy and numpy for linear algebra? | <p>Is there a good (small and light) alternative to numpy for python, to do linear algebra?
I only need matrices (multiplication, addition), inverses, transposes and such.</p>
<p>Why?</p>
<blockquote>
<p>I am tired of trying to install numpy/scipy - it is such a pita to get
it to work - it never seems to install correctly (esp. since I have
two machines, one linux and one windows): no matter what I do: compile
it or install from pre-built binaries. How hard is it to make a
"normal" installer that just works?</p>
</blockquote>
| python | [7] |
2,138,447 | 2,138,448 | Would calling a function like this be considered bad practice? | <p>Suppose I have this function signature:</p>
<pre><code>def foo(a=True, b=True, c=True, d=True, e=True):
</code></pre>
<p>I've decided these would be concise ways to call this function, considering all passed parameters should be <code>False</code>:</p>
<pre><code>foo(*5*[False])
foo(*[False]*5)
</code></pre>
<p>But something tells me that would be bad Python style. What do you think?</p>
| python | [7] |
43,071 | 43,072 | Why its dangerous to use pass by value when function parameter expects an Abstract class object? | <p>I read below statements in Addison Wesley FAQs.</p>
<blockquote>
<p>Beware: passing objects by value can
be dangerous in some situations. Often
it is better to pass objects by
reference-to-const than to pass them
by value. For example, pass-by-value
won't work if the destination type is
an abstract base class and can result
in erroneous behavior at runtime if
the parameter's class has derived
classes. However if the class of the
parameter is guaranteed not to have
derived classes, and if the function
being called needs a local copy to
work with, pass-by-value can be
useful.</p>
</blockquote>
<p>How it can be erroneous behavior at runtime if destination type is an Abstract class and if the parameter's class has derived class ?
Does copy constructor solve this problem ? If so, how ? Thank you.</p>
<p>EDIT: So, should the statement above be <strong>"erroneous behavior at compile time"</strong> ? Not "runtime" .</p>
| c++ | [6] |
4,581,482 | 4,581,483 | What is the point of a private pure virtual function? | <p>I came across the following code in a header file:</p>
<pre><code>class Engine
{
public:
void SetState( int var, bool val );
{ SetStateBool( int var, bool val ); }
void SetState( int var, int val );
{ SetStateInt( int var, int val ); }
private:
virtual void SetStateBool(int var, bool val ) = 0;
virtual void SetStateInt(int var, int val ) = 0;
};
</code></pre>
<p>To me, this implies that either the <code>Engine</code> class or a class derived from it, has to provide the implementation for those pure virtual functions. But I didn't think derived classes could have access to those private functions in order to reimplement them - so why make them virtual?</p>
| c++ | [6] |
5,895,694 | 5,895,695 | C# change string value to be next value in alphabetical order | <p>So this is what i'm trying to do. I have a string alphaCode, and what i simply want to do is increase from letter A to letter B. I did a way that assigned each letter an int and then did int++, but i'm assuming there has to be a better way.</p>
<pre><code>string alphaCode = "a"
result = "b"
</code></pre>
| c# | [0] |
5,788,749 | 5,788,750 | Search a space after a particular string in java | <pre><code> String text = "select ename from emp";
</code></pre>
<p>I want to know the space index after the word <strong>from</strong>. How to do it?</p>
| java | [1] |
735,091 | 735,092 | Does document.getElementById() consider temporarily created DIV | <p>I have a DIV like this </p>
<pre><code> var div = document.createElement('div');
div.innerHTML = "<div id='a'></div>";
</code></pre>
<p>And I have not appended it to document yet.. But I just want to retrieve the element <code>a</code> from temporary DIV.. </p>
<p>I have this way otherwise </p>
<pre><code> div.style.display = "none";
document.body.appendChild(div);
// then
var a = document.getElementById('a');
</code></pre>
<p>Is there any other better solution for this..?</p>
| javascript | [3] |
5,653,090 | 5,653,091 | Jquery when do you use $.get(index) instead normal selector | <p>Just wondering when do you actually use $.get(index); I am a bit confused on when and where to use $.get(index), when u can straight get any element by getting the id or class name?</p>
<p>(note i am not talking about the $.get() ajax call) sorry i confused some of your guys</p>
| jquery | [5] |
2,396,971 | 2,396,972 | Display message during cookie redirect | <p>I have a site that saves a cookie to a users computer, when they next get to the homepage they are redirected to another page via a cookie.</p>
<p>I have tried using jquery loading() and document.write, to display a message during the 2 seconds that the page takes to redirect but none work, right now the only events that fire are alert() functions but those stop the page from loading. wWat is the best way to do this a popup? </p>
<p>jQuery will not work here it has to be a pure javascript solution because the message has to display before a jQuery selector can bind to the html, such as by using document.ready</p>
| javascript | [3] |
1,154,270 | 1,154,271 | Error: '.class' expected or cannot find symbol method | <p>I can't figure out what exactly is wrong. This is what i get when i compile this program:</p>
<pre><code>cannot find symbol method kuce(java.util.List<java.lang.String>,java.lang.String[]).
</code></pre>
<p>If i change this row:</p>
<pre><code>System.out.print(mauka.kuce(mauka,temp));
</code></pre>
<p>to</p>
<pre><code>System.out.print(mauka.kuce(mauka,temp[]));
</code></pre>
<p>then i get this:</p>
<pre><code>'.class' expected
</code></pre>
<p>Here is the full code</p>
<pre><code>import java.io.*;
import java.util.*;
class metodes
{
String p="";
public String kuce(List x, String c[]) {
for (int v=0; v < x.size(); v++) p = p +c[v] ;
return p;
}
}
public class ShowFile
{
public static void main(String args[]) throws IOException
{
int i;
FileInputStream fin;
try {
fin = new FileInputStream(args[0]);
} catch(FileNotFoundException e) {
System.out.println(" Fails nav atrasts");
return;
} catch(ArrayIndexOutOfBoundsException e) {
System.out.println(" Ievadiet: ShowFile faila_vards");
return;
}
StringBuffer ab = new StringBuffer();
String a="";
String temp[];
do {
i = fin.read();
if (i!=-1) a= a + ((char) i);
} while(i != -1);
a = a.replace("\r\n", " ");
temp = a.split("\\.");
String h = ".";
for (int o = 0; o < temp.length; o++) {temp[o] = temp[o] + h;}
List<String> mauka = Arrays.asList(temp);
System.out.print(mauka.kuce(mauka,temp));
fin.close();
}
}
</code></pre>
| java | [1] |
29,899 | 29,900 | Need help setting up dev environment | <p>I'm working on different windows machines and virtual windows machines on a mac. I have a project wich uses SQL server and AD for autentication.</p>
<p>Right now I have to be connected to VPN so that the asp.net web application can connect to AD using LDAP string to autentivate users, I also have the SQL server on the other side of the VPN connection.</p>
<p>Is there any way to setup my enviroment so that I can work locally without the AD, and on a local SQL server and be able to publish the project without manually changing the web.config file? </p>
| asp.net | [9] |
1,324,314 | 1,324,315 | jQuery deletion of div childrens except one | <p>How can I delete everything inside <code>main</code> except the <code>ul</code> element?</p>
<pre><code><div id="main">
<div id="a">
<div id="b">
<div id="c"></div>
<div id="d"></div>
<div id="e">
<ul></ul>
</div>
</div>
</div>
</div>
</code></pre>
| jquery | [5] |
3,511,460 | 3,511,461 | javascript:if statement | <p>How to execute the if statement only when both the inputs are different not when both inputs are same.
suppose:</p>
<pre><code>var a=prompt("have Input","");
var b=prompt("have Input","");
if(a && !b){alert("ok")}
else{"wrong"}
</code></pre>
<p>the above condition works when both the inputs are true ,when both the inputs are false and when <strong>a</strong> is true and <strong>b</strong> is false but if <strong>a</strong> is false and <strong>b</strong> is true the if statement dont get executed .How to solve this issue through if statement.What is the way to get my problem solved?</p>
| javascript | [3] |
2,380,427 | 2,380,428 | i want the data to be save sucessfully | <p>I have a JFrame name opinion. in this form I have given a error message for each field means whenever I am filling the form and if I put any field empty and than click save button it should display that error message for that perticular empty field is empty. my code is saving the data but when I put any field empty and click on save button it shoowing the error msg that perticular field is empty but when I click on ok button of that error msg box it also saving the data but with that empty field my code is:</p>
<pre><code> String name= (String)cbNM.getSelectedItem();
if(name.equals(""))
JOptionPane.showMessageDialog(null," ENTER THE NAME");
String socialservice=(String)cbsocial.getSelectedItem();
if(socialservice.equals(""))
JOptionPane.showMessageDialog(null," SELECT THE SOCIAL SERVICE");
String whichservice=tasocial.getText();
if(whichservice.equals(""))
JOptionPane.showMessageDialog(null," ENTER SOCIAL SERVICE U LIKE");
String expectation=taexpectation.getText();
if(expectation.equals(""))
JOptionPane.showMessageDialog(null," ENTER UR EXPECTATION FROM WANI SAMAJ");
String revealinfo=(String)cbreveal.getSelectedItem();
if(revealinfo.equals(""))
JOptionPane.showMessageDialog(null,"SELECT UR DECISION ON REVEAL THE INFORMATION");
String addr=taaddress.getText();
if(addr.equals(""))
JOptionPane.showMessageDialog(null," ENTER THE ADDRESS");
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:wanisamajDB");
Statement stmt=con.createStatement();
String qry= "INSERT INTO Opinion(PersonName,LikeSocialService,WhichService,Expectation,RevealInformation,Address) VALUES('"+name+"','"+socialservice+"','"+whichservice+"','"+expectation+"','"+revealinfo+"','"+addr+"')";
stmt.executeUpdate(qry);
JOptionPane.showMessageDialog(null,"RECORD IS SAVED SUCCESSFULLY ");
con.close();
} catch(SQLException eM) {
JOptionPane.showMessageDialog(null,"RECORD IS NOT SAVED");
} catch(Exception et) {
System.out.println("error:"+et.getMessage());
}
</code></pre>
| java | [1] |
4,809,094 | 4,809,095 | Changing the width of an element only in IE browsers using javascript | <p>I wish to change the width of an element specifically only in IE browsers using javascript, but not getting any idea of how to do this.</p>
<p>Please help me as soon as possible.</p>
| javascript | [3] |
4,321,763 | 4,321,764 | Is there a way to trigger a window.onresize event in a cross browser way? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3856098/trigger-onresize-in-cross-browser-compatible-manner">trigger onresize in cross browser compatible manner</a> </p>
</blockquote>
<p>I library I use has some code I need called attached to the window.onresize event. <strong>Are there ways to fake this event programatically?</strong></p>
<ul>
<li><p>I can't call the attached event directly (one of my libraries is responsible for it and this is precisely the work I wish I could avoid)</p></li>
<li><p>I am <em>not</em> using Jquery</p></li>
<li><p>Since I could't find how to do this through Google, I suspect what I want might not be possible. In this case, I would still be happy so see this confirmed.</p></li>
</ul>
| javascript | [3] |
5,444,076 | 5,444,077 | What does & mean in python | <p>Hi I came across the following code</p>
<pre><code>numdigits = len(cardNumber)
oddeven = numdigits & 1
</code></pre>
<p>what exactly is going on here? I'm not sure what the "&" is doing.</p>
| python | [7] |
5,916,097 | 5,916,098 | read the url content | <p>I want to read the url content by bytes. I have to read the 64 kb from the content of url.</p>
<pre><code>public void readUrlBytes(String address) {
StringBuilder builder = null;
BufferedInputStream input = null;
byte[] buffer = new byte[1024];
int i = 0;
try {
URL url = new URL(address);
URLConnection urlc = url.openConnection();
input = new BufferedInputStream(urlc.getInputStream());
int bytesRead;
while ((bytesRead = input.read(buffer)) != -1) {
builder.append(bytesRead);
if (i==64) {
break;
}
i++;
}
System.out.println(builder.toString());
} catch (IOException l_exception) {
//handle or throw this
} finally {
if (input != null) {
try {
input.close();
} catch(IOException igored) {}
}
}
}
</code></pre>
<p>The above coding is for read character wise.</p>
<p>I need to read bytes.</p>
| java | [1] |
4,981,565 | 4,981,566 | Usages Some Android Method | <p>I want to update an Android project ... but some code is not recognized by me..</p>
<ol>
<li>Why we are using Debug.startMethodTracing("text"); </li>
<li>Why we are using Debug.stopMethodTracing();</li>
<li>What is Context,BaseContext in android?</li>
</ol>
| android | [4] |
3,738,205 | 3,738,206 | How to decrease size of c++ source code? | <p>For example</p>
<pre><code>#include <iostream>
using namespace std;
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cout << i;
}
return 0;
}
</code></pre>
<p>Decrease:</p>
<pre><code>#include <fstream>
int main() {
std::ifstream y("input.txt");
std::ofstream z("output.txt");
int n, i = 0;
y >> n;
while(i < n)
z << i++;
exit(0);
}
</code></pre>
<p>What's about "fstream"?</p>
<pre><code>std::fstream y("input.txt"), z("output.txt")
</code></pre>
<p>It's amazing but output is not correct.)
"output.txt" isn't remaking. Output is writing from begin of file.</p>
<p>How to decrease code?</p>
<p>Just for fun.</p>
| c++ | [6] |
4,329,388 | 4,329,389 | jquery: get value from clicked div | <pre><code><div>'.$i.'</div>
</code></pre>
<p>$i is auto generated by loop - which could lead to: </p>
<pre><code><div>'.$i.'</div>
<div>'.$i.'</div>
<div>'.$i.'</div>
</code></pre>
<p>etc. where each $i is different.</p>
<p>How do I get value of particular $i (using jQuery), when div is clicked.</p>
<p>In standard JS I would use onClick($i).
In jQuery I just do not know, how to pick that val.</p>
| jquery | [5] |
2,904,800 | 2,904,801 | When to Cache the data | <p>Q1) I am designing a iPhone app and want to know on what basis I should take the decision of caching data. </p>
<p>Q2) I have a huge data set which can change frequently. On my app I am showing the data under different categories and is planning to fetch the data from server when a particular category is tapped. This will reduce the data transfer. Also, this data can change frequently but I can store it for let say 30 minutes. What strategy should I take here? Should I store in core data or no caching all together and for each repetitive taps should hit the server?</p>
<p>Please suggest. </p>
| iphone | [8] |
5,334,741 | 5,334,742 | "from x import y as z" vs. "import x.y as z" | <p>I'm assuming they are functionally the same, bar some negligible under-the-hood differences. If so, which form is more Pythonic?</p>
| python | [7] |
3,475,415 | 3,475,416 | Trouble converting string from commandline to array of floats | <pre><code>char * temp_array;
strcpy(temp_array, argv[i + 1]);
for(int j = 0; j < 8; j++)
{
fann_input[j] = atoi(temp_array[j]);
printf("%f\n", fann_input[j]);
printf("o%c\n", temp_array[j]);
}
</code></pre>
<p>fann_input is a float array.</p>
<p>on the atoi line, I get the error:</p>
<pre><code>src/main.cpp: In function ‘int main(int, const char**)’:
src/main.cpp:117: error: invalid conversion from ‘char’ to ‘const char*’
src/main.cpp:117: error: initializing argument 1 of ‘int atoi(const char*)’
</code></pre>
<p>Any ideas?</p>
<p>each of the characters is either a 1 or a 0</p>
| c++ | [6] |
2,641,626 | 2,641,627 | Pointing ASP.Net Client to same service on another server | <p>I have a scenario, my asp.net application is consuming a WCF service. Now for the service has two version say for example testservice and prodservice. I have to use either of them at any given time. In order to test, I need to point my appplication to test or prod.
Can I achieve this by, simply changing url in endpoint in web.config of my asp.net application or need to add saperate service refernce for each of them.</p>
<p>Please guide.</p>
<p>Thaks</p>
| asp.net | [9] |
3,584,702 | 3,584,703 | how to do only this div | <pre><code><div id="container">
<div class="slides">
<div class="slides_container">
<p>1</p>
<p>2</p>
<p>3</p>
</div>
<a href="#" class="prev">Prev</a>
<a href="#" class="next">Next</a>
</div>
</div>
<div id="container">
<div class="slides">
<div class="slides_container">
<p>1</p>
</div>
<a href="#" class="prev">Prev</a>
<a href="#" class="next">Next</a>
</div>
</div>
</code></pre>
<hr>
<pre><code>var n = $(".slides_container > p").length;
if (n == 1) {
$(".prev", ".next").hide();
} else {
$(".prev", ".next").show();
}
</code></pre>
<hr>
<p>If "P" = 1 , i will hide .prev & .next (ONLY THIS DIV)</p>
<p>HOW TO ? THANKS :D</p>
| jquery | [5] |
4,253,889 | 4,253,890 | Array syntax error newbie | <p>I am lost in this error. I am trying to write a function and write a array in that function. in an external js file. This is going to be a random image loading function but i keep getting an error with the array and can't figure out why.</p>
<pre><code>function randImg(){
var imgs = new Array();
img[0]="banner1.png";
img[1]="banner2.png";
img[2]="banner3.png";
var maxium = img.length;
}
</code></pre>
<p>I am getting the error on the var imgs line. any ideas?</p>
<p>Here is my new code calling the variable "img" was throwing me off it loads ok but it only prints out the text in the variable and not the actually file!? so at run it say "banner1.png" or "banner3.png"? any thoughts</p>
<pre><code>function randImg(){
var banner = new Array();
banner[0] = "banner1.png";
banner[1] = "banner2.png";
banner[2] = "banner3.png";
var maxImg = banner.length;
var randNum = Math.floor(Math.random()*maxImg);
return banner[randNum];
}
</code></pre>
| javascript | [3] |
4,532,867 | 4,532,868 | What is memory space occupied for reference and object | <p>What happen at background(in case of memory) when I declare variable and then create object for that variable . Is reference variable store anywhere and in which format and how this variable points to the memory on heap. Please clarify below doubts in the comments.</p>
<p>For example</p>
<pre><code>ClassA instance; // Where this variable store and how much memory occupies
instance=new ClassA(); //How instance variable points to memory
</code></pre>
<p><strong>EDIT</strong></p>
<p>What will effect on my program memory if my program contains so many unused variable.</p>
| c# | [0] |
3,146,357 | 3,146,358 | how to toggle between the items in comboBox using c# .net for wpf application | <p>how to toggle between the items in comboBox using c# .net for wpf application.once i focus on combo box i can able to toggle between the items instead of focusing the comboBox i want to toggle between the items.</p>
| c# | [0] |
1,653,514 | 1,653,515 | javascript var declaration within loop | <pre><code>/*Test scope problem*/
for(var i=1; i<3; i++){
//declare variables
var no = i;
//verify no
alert('setting '+no);
//timeout to recheck
setTimeout(function(){
alert('test '+no);
}, 500);
}
</code></pre>
<p>it alerts "setting 1" and "setting 2" as expected, but after the timeout it outputs "test 2" twice - for some reason the variable "no" is not reset after the first loop...</p>
<p>i've found only an "ugly" workaround...</p>
<pre><code>/*Test scope problem*/
var func=function(no){
//verify no
alert('setting '+no);
//timeout to recheck
setTimeout(function(){
alert('test '+no);
}, 500);
}
for(var i=1; i<3; i++){
func(i);
}
</code></pre>
<p>Any ideas on how to workaround this problem in a more direct way? or is this the only way?</p>
| javascript | [3] |
199,445 | 199,446 | how to make rest webservices without using any framework | <p>I am working on rest webservices in php. I want to know that can i make rest webservices in php without using any framework(cakephp,zend,Tonic).
if anyone have some some idea. Please let me know ?</p>
| php | [2] |
3,380,761 | 3,380,762 | update a currently displayed variable | <p>I am writing some Python code, which will in the end will display something which looks like:</p>
<pre><code>Volt1: 3.1V
Volt2: 2.6V
Volt3: 5.6V
</code></pre>
<p>I am constantly monitoring some register values which will give me the current values of Volt1,Volt2,Volt3. As I read in the new values I want to update the field next to the variable name (i.e 3.1V becomes 3.12V), but without just simply printing a new line, but updated the old value.</p>
<p>I am just not sure how to do it, can someone point me in the right direction?</p>
<p>Thanks</p>
| python | [7] |
5,124,848 | 5,124,849 | How do I detect in jQuery if the contents of an anchor tag contains a string? | <p>How can i check <code><a href="#">sometext</a></code> equals something, trying to reach something like this:</p>
<pre><code>$('a').click(function() {
if ($("a:contains('sometext')")) {
alert('sometext');
}
else {
alert('text');
}
});
</code></pre>
| jquery | [5] |
5,042,309 | 5,042,310 | Nested get performance | <p>In Java, is there a performance hit if i continually use nested get to retrieve values? For instance:</p>
<pre><code>String firstname = getOffice().getDepartment().getEmployee().getFirstName();
String lastname = getOffice().getDepartment().getEmployee().getLastName();
String address = getOffice().getDepartment().getEmployee().getAddress();
</code></pre>
<p>VS:</p>
<pre><code>Employee e = getOffice().getDepartment().getEmployee();
String firstname = e.getFirstName();
String lastname = e.getLastName();
String address = e.getAddress();
</code></pre>
<p>Would the 2nd version be faster because it has less 'jumps'?</p>
| java | [1] |
223,191 | 223,192 | detecting a character in input box | <pre><code>if(document.form.user.value=='')
</code></pre>
<p>this is a javascript code which tests if it is empty input box,</p>
<p>but I need a piece of code which controls is there any character in input box?
could anyone help me?</p>
<p>I mean any character like /, &, or any letter... or I can say any character which is not number!</p>
| javascript | [3] |
951,887 | 951,888 | How to view the headers sent by HttpWebRequest | <p>I'm scraping a site with HttpWebRequest, but the site is returning an error. The page works fine when I hit it from my browser. I'd like to compare them to see what may be causing the error. I know how to intercept the request from my browser to inspect the headers, but how do I view the data sent by HttpWebRequest?</p>
| c# | [0] |
2,868,293 | 2,868,294 | Is Java 7 already available to develop? | <p>Is Java 7 already available to do development with?</p>
| java | [1] |
4,437,694 | 4,437,695 | What software can I use to auto generate class diagrams in PHP? | <p>I have some source code and I would like to auto generate class diagrams in PHP.
What software can I use to do this?</p>
<p><strong>Duplicate</strong></p>
<ul>
<li><a href="http://stackoverflow.com/questions/393603/php-uml-generator">http://stackoverflow.com/questions/393603/php-uml-generator</a></li>
<li><a href="http://stackoverflow.com/questions/704957/uml-tool-for-php">http://stackoverflow.com/questions/704957/uml-tool-for-php</a></li>
</ul>
| php | [2] |
668,377 | 668,378 | Python RAD (Desktop Deployment) | <p>please forgive me if this questions were answered so many times!</p>
<p>How can I deploy desktop applications with python (in RAD way), I mean:
1. there is an IDE and i can create user interface(gui) like virtual studio that you just <strong><em>drag and drop objects</em></strong> (label, combobox, radiobutton...) to the form.</p>
<p>2.editing code behind that objects(label, combobox, radiobutton...) for example <strong><em>when i click a button with my mouse something happens</em></strong>.</p>
<p>thanks in advance for answers. (forgive me for may English guys!)</p>
| python | [7] |
869,563 | 869,564 | Difference between window.location.assign() and window.location.replace() | <p>What is the difference between window.location.assign() and window.location.replace(), when both redirect to new page?</p>
| javascript | [3] |
2,918,020 | 2,918,021 | Simple explanation for why datatables uses $.fn.dataTableExt.afnSortData | <p>I saw a post out there:</p>
<p><a href="http://stackoverflow.com/questions/4083351/what-does-jquery-fn-mean">what does $.fn mean</a></p>
<p>However I still don't understand it. Can someone explain this in very simple terms to me. Why did they choose to specify it this way?</p>
| jquery | [5] |
398,782 | 398,783 | culture name is not supported | <p>I'm receiving "culture name 'uploads' is not supported" when my asp.net app start. Where I have to view/debug to toggle the error? A full-text for "uploads" returns o entries in my project</p>
| asp.net | [9] |
2,551,173 | 2,551,174 | Getting a statabase query returned as string in c# | <p>I am working with a dbf database. I need to query it to get information back in string format. The dbf file is set up as follows:</p>
<pre><code>Student Name Student Number Student Description
HelloWorld 123456789 Present
WorldHello 987654321 Absent
</code></pre>
<p>Here is the code i have so far:</p>
<pre><code> OleDbCommand command;
OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source = " + dbfPath + ";Extended Properties=dBase III");
command = new OleDbCommand("SELECT STUDENTNAME, STUDENTNUMBER, STUDENTDESCRIPTION" + " FROM " + DbfFile + " WHERE " + STUDENTNAME='HelloWorld', conn);
</code></pre>
<p>Now i want to get the result as a comma seperated string as follows:</p>
<p>HelloWorld,123456789,Present</p>
<p>How can i do this?</p>
| c# | [0] |
2,523,173 | 2,523,174 | How to draw a circle tangent to 3 circles | <p>I have three circles . I have the full information regarding that 3 circles .</p>
<p>I want the logic to draw another circle which is tangent to rest 3 circles . I dont have any information regarding that 4th circle(which is being tangent to rest 3) .</p>
| c++ | [6] |
3,852,103 | 3,852,104 | Can't get Google USB driver to load | <p>After getting my app to work in the emulator, I now want to test it on my Samsung Exhibit II Android phone. I follow the instructions from google here <a href="http://developer.android.com/sdk/win-usb.html" rel="nofollow">http://developer.android.com/sdk/win-usb.html</a> but can't get their USB driver to load. </p>
<p>When I plug the phone into the computer via the supplied USB data cable, Vista auto installs it's own driver and doesn't give me a chance to point to the google driver located here: <code>C:\Program Files\Android\android-sdk\extras\google\usb_driver\android_winusb.inf</code>.</p>
<p>When I go to the device manager and right-click on the Vista driver and try to Update Driver Software to point to the Google driver, it says it already has the best one and won't change it! (even though it doesn't work, ie. no drive label appears for the phone plus the device manager shows an ! for it)</p>
<p>I've spent many hours reading dozens of posts with similar problems but no solutions work for me. Any ideas?</p>
| android | [4] |
2,192,863 | 2,192,864 | How can I filter ListView data when typing on EditText in android | <p>I have a ListView and a EditText. How can I filter ListView data when typing on EditText ? </p>
<p>My code is given below: </p>
<pre><code> public class ListContacts extends ListActivity {
ListAdapter lAdapter;
EditText filterText;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Associate the xml with the activity
setContentView(R.layout.activitylist);
Cursor cursor = getContentResolver().query(
ContactsContract.Contacts.CONTENT_URI, null,
null, null,
null);
startManagingCursor(cursor);
// start mappings
String[] columns = new String[] { ContactsContract.Contacts.DISPLAY_NAME };
int[] names = new int[] { R.id.contact_name };
lAdapter = new ImageCursorAdapter(this, R.layout.main, cursor, columns,
names);
</code></pre>
<p>/**
* to filter contacts
*/</p>
<pre><code>filterText = (EditText) findViewById(R.id.EditText01);
filterText.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
}
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
public void onTextChanged(CharSequence s, int start, int before,
int count) {
}
});
}
</code></pre>
<p>}// end of class ListContacts</p>
<pre><code> public class ImageCursorAdapter extends SimpleCursorAdapter {
private Cursor c;
private Context context;
public ImageCursorAdapter(Context context, int layout, Cursor c,
String[] from, int[] to) {
super(context, layout, c, from, to);
this.c = c;
this.context = context;
}
public View getView(int pos, View inView, ViewGroup parent) {
}
</code></pre>
<p>}// end of class ImageCursorAdapter</p>
| android | [4] |
1,672,835 | 1,672,836 | most negative value for python | <p>I expect the most negative for python is <code>-maxint-1</code></p>
<p>I expect having -2, will make integer overflow.</p>
<pre><code>from sys import maxint
maximum_int = maxint
minimum_int = -maxint - 2
# 2147483647
# -2147483649
print maximum_int
print minimum_int
</code></pre>
<p>Yet. Correct result is displayed, and a value which is more negative than <code>-maxint-1</code> is shown.</p>
<p>May I know why?</p>
| python | [7] |
1,030,673 | 1,030,674 | Calling a base abstract method in an override of that method | <p>If I have the following:</p>
<p>e.g.</p>
<pre><code>public abstract class ClassA
{
protected abstract void ValidateTransaction();
}
public abstract class ClassB : ClassA
{
protected override void ValidateTransaction()
{
// some custom logic here
}
}
public class ClassC : ClassB
{
protected override void ValidateTransaction()
{
base.ValidateTransaction();
// some additional custom logic here
}
}
</code></pre>
<p>So <em>I did not find usages on ClassC's ValidateTransaction.</em> I don't see it being called anywhere. </p>
<p>So then I guess how does this work? I mean it's calling the mehtod at the top of the stack here (calls the ClassB's override method and then includes logic in my ClassC's override of ClassB's method?)</p>
<p>This doesn't make sense to me why or how this works or the intention here.</p>
<p><strong>UPDATED</strong></p>
<p>Ok so I did find a spot where ClassA's PerformTransaction() method is called from a lot of sub classes in our project. </p>
<p>So ClassA now looks like this with more details for you here:</p>
<blockquote>
<pre><code>public abstract class ClassA
{
public void PerformTransaction()
{
ValidateTransaction();
// and calls some other code here.
}
protected abstract void ValidateTransaction();
}
</code></pre>
</blockquote>
<p>Ok then we still have:</p>
<pre><code>public abstract class ClassB : ClassA
{
protected override void ValidateTransaction()
{
// some custom logic here
}
}
public class ClassC : ClassB
{
protected override void ValidateTransaction()
{
base.ValidateTransaction();
// some additional custom logic here
}
}
public class SomeAbritraryClass : ClassC
{
ClassA.PerformTransaction();
...
}
</code></pre>
<p>so ClassA.PerformTransaction() is being called in some classes that inherit ClassC.</p>
| c# | [0] |
150,191 | 150,192 | Is it possible to get Class attributes? C# | <p>I have a class which is using generics. This class do some operation which need serialization. So the class which will be given to myClass must hold the attribute [Serializable()]. Is it possible to request a class which attributes it holds? In best case at design time.</p>
<pre><code> [Serializable()]
public class clsSchnappschuss<T>
{
//Some operations which need serialization
}
</code></pre>
<p>So if someone uses clsSchnappschuss he must give the DataType (T) and i want to request that T implements [Serializable()]. Is this possible?</p>
<p>regards</p>
| c# | [0] |
881,758 | 881,759 | Could not Understand the usage of map in c++ | <p>Map is a container class that is used to store the aggregate data... Its very easy to retreive the datas stored in it as it uses hash algorithm for retrieval.
map is a key value pair...The data can be retrieved with the corresponding key...
Here in this declaration below I'm defining that the key has to be integer(4 bytes) and data as the string value...</p>
<pre><code>typedef map<INT32U,string> EventMapType;
</code></pre>
<p>I searched for the example program of using map in wikipedia... But i could not understand the example given over there..I need to know how the datas and keys are stored in the map and how it is retreived through the key...I am new to MFC...</p>
| c++ | [6] |
5,511,927 | 5,511,928 | Calculate the shortest way to rotate, right or left? | <p>Im making a simple computerplayer to my simple 2d action game. it suppose to turn towards me and shoot, but i cant figure out how to calc the shortest path... should it turn left of right if it want to shoot and kill me :P ?</p>
<p>Ive got two angles: cpu_facing (direction the cpu is facing) and player_degree (the angle calculated when cpu is in the center).</p>
<p>(im working with degrees, dont like radian :P)</p>
<p>Anyone done this in javascript?</p>
| javascript | [3] |
3,099,742 | 3,099,743 | Get spinner selected items text? | <p>How to get spinner selected item's text?</p>
<p>I have to get the text on the item selected in my spinner when i click on the save button.
i need the text not the Index.</p>
| android | [4] |
1,946,014 | 1,946,015 | Friendly URL adding to my links on the nav bar menu... creating issues | <p>Website is PHP/mySQL. Some of the pages (inventory) have friendly URLs. Great.</p>
<p>The problem is when on these profile pages (those with friendly URLs), it is also adding that friendly URL in front of the links of the top nav bar (aka menu drop down).</p>
<p>So instead of faq.php ... now the link is productA/faq.php which of course breaks the links.</p>
<p>It is not doing it in the footer though, just the header links.</p>
<p>We have looked everywhere and admit defeat!</p>
<p>Please help!</p>
| php | [2] |
3,222,066 | 3,222,067 | TypeError: $(...).tablesorter is not a function | <p>I am using jquery.tmpl to create tables through ajax call.
Table row is coming from database .</p>
<p>And i included all the tablesorter plugins that is ,tablesorte,js,latest.js and css</p>
<p>But it is giving error as tablesorter is not a function...</p>
<pre><code>$.ajax({
.....
success:function(){
$("#mytable").addClass("tablesorter");
$("#mytable:has(tbody tr)").tablesorter();
}
});
</code></pre>
| jquery | [5] |
2,139,626 | 2,139,627 | How to list from higher numbers to lowers ones in php? | <p>Say I have a variable like this:</p>
<pre><code>$votes
</code></pre>
<p>That variable will store positive and negative numbers: -1, 0, 2, 3, etc...)</p>
<p>How to code a function that arrange those numbers but higher ones to lower ones?</p>
| php | [2] |
5,167,975 | 5,167,976 | C# - Switching System.Text.Decoder mid-stream - buffered data | <p>I have a Decoder instance, and am using its convert method in conjunction with a file reader to read in data with the appropriate encoding.</p>
<p>I'd like to switch the Decoder instance I'm using mid-way through my read, however I'm conscious that the original decoder may have some bytes buffered internally (incomplete chars) despite bytesUsed equalling byteCount, and this switch sounds as though it could then result in data loss.</p>
<p>Can I retrieve the internal byte buffer so I might pass it through? Additionally, this switch is only to occur when a fallback takes place - I have considered using the invalid bytes position made available by the fallback exception to 'split' the current read buffer (as presumably at this point any previous buffered bytes have been used), but perhaps there's a better way?</p>
<p>Thanks in advance,</p>
<p>James</p>
| c# | [0] |
2,881,693 | 2,881,694 | jQuery : how to debug? | <p>Recently i watched a tutorial from youtube (<a href="http://www.youtube.com/watch?v=8mwKq7%5FJlS8" rel="nofollow">http://www.youtube.com/watch?v=8mwKq7%5FJlS8</a>)</p>
<p>The boy is typing jQuery code and as soon as he presses enter key we can see the result intently. What tool is that?</p>
| jquery | [5] |
4,901,850 | 4,901,851 | abstraction and interface explanation | <p>could some body explain me abstraction and interface in asp.net, C# by taking an apprpriate example...pleasse
i am not understanding it for long</p>
| asp.net | [9] |
890,697 | 890,698 | What is the SimpleDateFormat pattern that parses like the deprecated String constructor for Date? | <p>I have some code that looks like <code>"Sat May 12 04:46:05 EDT 2012"</code> that is currently being parsed by the <code>java.util.Date</code>'s <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Date.html#Date%28java.lang.String%29" rel="nofollow"><code>Date(String s)</code></a> constructor. However, now I am getting a warning in my IDE since it says that it is deprecated and the JavaDoc says:</p>
<blockquote>
<p>Deprecated. As of JDK version 1.1, replaced by DateFormat.parse(String s).</p>
</blockquote>
<p>I tried using the <code>SimpleDateFormatter</code> but the default formatter is causing an exception, so I want to try using a pattern, but what is the pattern to parse like the String constructor does?</p>
<hr>
<p>NB: this is different from other similar questions because it is specifically asking about replacing a deprecated (and popular) constructor, not just asking for help parsing an arbitrary date string.</p>
| java | [1] |
5,189,871 | 5,189,872 | Differentiating Test site from Development Site (ASP.NET) | <p>We have a couple of ASP.NET applications running here at work and our users get the test site confused with the production site. What is the best way to help the users know they are at the test site. Is there a best practice for how this can be accomplished? Maybe have a custom control or something on the screen display "TEST SITE"? Thanks </p>
| asp.net | [9] |
5,837,295 | 5,837,296 | loading image is taking too much time | <p>now Im doing an android application . In my app I have to swipe and show different pages.Each page is having some images.To make the sense of moving image [eg: smiling apple] I am using the logic of showing one image and hide that image and show second image in the same position and third so on.But this process is taking too much time to load image. </p>
| android | [4] |
3,260,179 | 3,260,180 | Facebook graph API integration in my android app | <p>i have downloaded facebook graph api, and when i am importing that api, after that i am getting lot of errors in <strong>Util.java</strong> file... please guide me, where am i doing mistake..</p>
<p>Thanks in advance..</p>
| android | [4] |
3,352,671 | 3,352,672 | How can I use JavaScript to read a local file when the html is local | <p>I would like to be able to read a file that is stored in the same directory as the html file. When the html file is accessed by http, there is no problem; I can just use a HttpXMLRequest. However when the HTML is being read off the local disk (as with File/Open in most desktop browsers, it seems HttpXMLRequest does not work. I used to do this with a Java Applet, but (a) I've noticed that doesn't work with some browsers and (b) I'd like a solution that uses just JavaScript: no Java and no Flash.</p>
| javascript | [3] |
1,118,061 | 1,118,062 | What standards and practices should I use to develop an application that runs on both the iPhone and on iPads? | <p>What standards and practices should I use to develop an application that runs on both the iPhone and on iPads?</p>
| iphone | [8] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.