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 |
|---|---|---|---|---|---|
4,689,151 | 4,689,152 | about:blank page after running my ASP.NET web app using Ctrl + F5 | <p>my web application open about:blank page when i tried to run it using Ctrl+F5.</p>
<p>i am using VS2008 C# ASP.NET web application.</p>
<p>also i set a start up page to the my project.</p>
<p>please what is this page?and how to overcome it?</p>
<p>thanks</p>
| asp.net | [9] |
2,097,881 | 2,097,882 | warning C4251: needs to have dll-interface to be used by clients of class | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4145605/stdvector-needs-to-have-dll-interface-to-be-used-by-clients-of-class-xt-war">std::vector needs to have dll-interface to be used by clients of class 'X<T> warning</a> </p>
</blockquote>
<p>This is my first post in this group.</p>
<p>I am creating a DLL and calling it in the main file of the application. The code compiles fine but I get the following error:</p>
<pre><code> warning C4251: 'PNCBaseClass::m_vAvailChannelsFromRx' : class 'std::vector<_Ty>' needs to have dll-interface to be used by clients of class 'PNCBaseClass'
3> with
3> [
3> _Ty=int
3> ]
</code></pre>
<p>My code is as follows:</p>
<pre><code>#define TEST_API __declspec(dllexport)
class TEST_API PNCBaseClass
{
public:
vector<int> m_vAvailChannelsFromRx
};
</code></pre>
<p>I have looked up for solutions and tried and failed.</p>
<p>I do not want to disable the warning. </p>
<p>Your help will be greatly appreciated.</p>
<p>Best Regards</p>
<p>Chintan</p>
| c++ | [6] |
2,951,796 | 2,951,797 | a list > a list of lists | <p>In python, how can I split a long list into a list of lists wherever I come across '-'. For example, how can I convert:</p>
<pre><code>['1', 'a', 'b','---', '2','c','d','---','3','123','e','---','4']
</code></pre>
<p>to </p>
<pre><code>[['1', 'a', 'b'],['2','c','d'],['3','123','e'],['4']]
</code></pre>
<p>Many thanks in advance.</p>
| python | [7] |
4,637,097 | 4,637,098 | dynamic tree creation using jquery | <p>i Want to create dynamuc dree using jquery at client side and java(jsp/servlet) at backend using mysql database.Please suggest me how can i implemet that.I want to add further functionality like add node,add child,add leaf node.</p>
| jquery | [5] |
5,362,713 | 5,362,714 | jQuery: How to select elements inside a div? | <p>I have a list of <code>video objects</code> that are rendered in HTML as </p>
<pre><code> <div class="video">
<p class='title'> {{ video.title }} </p>
<p class='url'> {{ video.url }} </p>
<button class="btn btn-primary queue" href="#">queue</button>
</div>
<br />
</code></pre>
<p><strong>What I want?</strong></p>
<p>whenever I click on any video list, the title and url should be selected </p>
<p>I have a <code>jQuery</code> as </p>
<pre><code>$(function(){
$('body').on('click', '.video', function(event) {
var title = $(this).closest('.title');
console.log(title);
alert(title);
});
});
</code></pre>
<p>When I see in firebug, the <code>console.log(title)</code> as <code>jQuery( )</code> in firebug, what is that I am doing wrong?</p>
| jquery | [5] |
1,144,574 | 1,144,575 | How can i make this output easier? | <p>The problem i am having is i have to input 50 integers, and when i hit space it wont recongnize the number and when i hit enter then my output box is very very long for just 1 digit #'s</p>
<pre><code>static final int MAX = 50;
public static void main(String[] args)
{
int index;
int check;
int infants = 0, children = 0, teens = 0, adults = 0;
System.out.println("This program will count the number of people "
+ "and how many of that age group cameto the college fair.");
System.out.println("**********************************************************");
System.out.println("Please enter the interger value data:");
int [] peopleTypes = new int[MAX];
Scanner keyboard = new Scanner(System.in);
for(index=0; index<MAX; index++)
{
peopleTypes[index] = keyboard.nextInt();
if(peopleTypes[index] == 1)
infants = infants + 1;
if(peopleTypes[index] == 2)
children = children + 1;
if(peopleTypes[index] == 3)
teens = teens + 1;
if(peopleTypes[index] == 4)
adults = adults + 1;
else
index = index-1;
System.out.print("");
}
System.out.println("The number of infants that were at the college fair was: " + infants);
System.out.println("The number of children that were at the college fair was: " + children);
System.out.println("The number of teenagers that were at the college fair was: " + teens);
System.out.println("The number of adults that were at the college fair was: " + adults);
</code></pre>
| java | [1] |
624,518 | 624,519 | Effective activity List | <p>Iam trying to make my Activity List more effective.
I have an Activity List in my app, on every call its going to the database collecting some information and show it on the screen(as List).</p>
<p>so basiclly everytime you finish and re-call that list, it's calling onCreate.. again and again..
my problem here is with the allocation i am trying to reduce!</p>
<p>for example i have an Arraylist which is being allocated every time on the onCreate Method of my activity list, and many more allocations which i do onCreate. </p>
<p>i find it slowing my program very much, my program is very un-stable, and i try to reach to some performances... any idea how can i avoid this onCreate everytime i re-call my Activity List? mybe another technics to reduce re-allocations?
Thanks,
Idan.</p>
| android | [4] |
224,556 | 224,557 | Java library to scan image using a scanner | <p>In my project I want to scan an image using a scanner. Which Java library could I use to grab the scanned image from a scanner?</p>
| java | [1] |
1,377,899 | 1,377,900 | How can I call a particular base class method in Python? | <p>Let's say, I have the following two classes:</p>
<pre><code>class A(object):
def __init__(self, i):
self.i = i
class B(object):
def __init__(self, j):
self.j = j
class C(A, B):
def __init__(self):
super(C, self).__init__(self, 4)
c = C()
</code></pre>
<p>c will only have the i attribute set, not the j.
What should I write to set both of attributes/only the j attribute?</p>
| python | [7] |
1,981,023 | 1,981,024 | iPhone UISlider question | <p>Why is it that in the following code:</p>
<pre><code>-(IBAction)updateSlider:(id)sender {
UISlider *slider = (UISlider *) sender;
int amount = (int)(slider.value);
NSString *newText = [[NSString alloc]initWithFormat:@"%d", amount];
sliderLabel.text = newText;
newText.release;
</code></pre>
<p>}</p>
<p>the line "int amount = (int)(slider.value);" is the way it is? Why couldn't it be simply "int amount = int slider.value"???</p>
| iphone | [8] |
3,768,464 | 3,768,465 | ListView items won't show focus color when click | <p>When i click on listview, its not show the focus color .</p>
<blockquote>
<pre><code><ListView
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="@color/grey"
android:dividerHeight="1px"
android:drawSelectorOnTop="true"
android:cacheColorHint="@android:color/transparent"/>
</code></pre>
</blockquote>
| android | [4] |
5,136,781 | 5,136,782 | closing pop up window on button click(if successcede) and reload parent window | <p>I am using this code.This pop up window pops up when I clicks a button on the main page.Now I want the pop up window to be closed if the password is successfully changed and reload the main page,but if the password is not changed then refresh the pop up window again.
I used javascript for form validation<code>enter code here</code>
Here is the code..... </p>
<pre><code><asp:Textbox id="curnt_paswrd" textmode="Password" runat="server" size="30" />
<asp:Textbox id="new_paswrd" textmode="Password" runat="server" size="30" />
<asp:button ID="btnChange" class="submit-button"
OnClientClick="return validate()" runat="server" Text="Change"
onclick="btnChange_Click" />
</code></pre>
| asp.net | [9] |
4,379,411 | 4,379,412 | Can I write an .aspx app on Windows XP? | <p>I'm planning to write a aspx pages on Windows XP machine. I have IIS 7.0 enabled and virtual directory setup. Are aspx page developments allowed on Win XP?</p>
| asp.net | [9] |
2,547,426 | 2,547,427 | Writing files on iPhone | <p>I am going to store a .xml file on the iphone through an app I have made. I have written some code:</p>
<pre><code>NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *resPath = [documentsPath stringByAppendingPathComponent:@"FILENAME"];
[MY_NSDATAREFERENCE writeToFile:resPath atomically:YES];
</code></pre>
<p>This works on simulator, however is this the correct way of saving files?</p>
<p>I know you can't write to the application bundle, however which paths/places are valid to write and read information from.</p>
<p>Any help much appriciated!</p>
| iphone | [8] |
115,174 | 115,175 | How to tie into a domain server's login for program access rights | <p>I need to write a program used internally where different users will have different abilities within the program.</p>
<p>Rather than making users have a new username and password, how do I tie into an existing domain server's login system?</p>
<p>Assume .NET (C#, VB, ASP, etc)</p>
| c# | [0] |
357,950 | 357,951 | C# - How to add a reference do system.numerics.dll | <p>I want to use the BigInteger class from the System.Numerics but if i want to write </p>
<pre><code>using System.Numerics
</code></pre>
<p>Numerics is not found.
I searched the web and I found that I have to add a reference to System.Numerics.dll
But how can I do that?</p>
| c# | [0] |
413,322 | 413,323 | How to expose internal System.Array | <p>I have a class that is a container for two fixed length arrays as well as some other members. I want to expose the elements of the array for assignment outside the class.</p>
<p>Example would be:</p>
<pre><code> using System.Collections.ObjectModel;
class ArrayContainer<T, U>
{
private T[] x;
private U[] y;
// Some other members and constructor
public Collection<T> X
{
get { return new Collection<T>(this.x); }
}
public Collection<U> Y
{
get { return new Collection<U>(this.y); }
}
}
</code></pre>
<p>If I try to do instance.X[i] = value I get an exception saying the collection is readonly. So I have three questions:</p>
<ol>
<li>Why can't I make the above assignment?</li>
<li>Is this the correct was to expose internal members?</li>
<li>Are there any performance issues with making a "new" Collection every time the array is created?</li>
</ol>
| c# | [0] |
5,254,880 | 5,254,881 | hide scrollview stick android | <p>i have build an app in which i need to use <strong>scroll-view</strong> in but i dont need to appear scroll stick on screen so how can i do that?make sure scroll functionality should be working. </p>
<p><img src="http://i.stack.imgur.com/18vmw.png" alt="enter image description here"> </p>
| android | [4] |
3,575,504 | 3,575,505 | Validate plugin and CK Editor? | <p>Before submitting my form I:</p>
<pre><code>CKEDITOR.instances.ckEditor.updateElement();
</code></pre>
<p>This copies the content of CKEditor to the text area it replaced (id of ckEditor, name of article).</p>
<p>Using validate plug in I have the following rules:</p>
<pre><code>rules: {
article: {
required: true
}
},
</code></pre>
<p>The problem is I get no error when CK editor is empty, I check that the content is being copied across to the text area, and it is. I only get errors when I remove the style display:none from my text area (but then it shows up in the page which I do not want).</p>
<p>Any ideas how to get it to validate?</p>
<p>Thanks</p>
| jquery | [5] |
5,379,250 | 5,379,251 | iphone development | <p>What are the options for developing iPhone apps?
Currently I've tried to install gnu kit for Linux without success! Too many steps, and at the and I was unable to compile a single app.
The Apple SDK seems to be much more easy, but I don't have a Mac.
So am I missing something?</p>
| iphone | [8] |
3,338,125 | 3,338,126 | How do you check for end of line in c++? | <p>I have to accept space separated integers from user but stop when i encounter a new line.
For example: </p>
<pre><code>3 5 7 9
23 47
6
</code></pre>
<p>In this example I must store <code>3, 5, 7, 9</code> in array 1, <code>23, 47</code> in array 2, <code>6</code> in array 3.
Unfortunately, I don't know how to check for the end of line in C++. Please help me out. </p>
| c++ | [6] |
2,016,915 | 2,016,916 | how to choose load factor | <p>I have read about the concept of Load factor for hash based collections. I got the concept. But I am unable to answer that "Load factor should be less or more. On what basis should I choose Load factor and what is the impact if I choose small value for load factor and what if I choose big".</p>
| java | [1] |
3,319,769 | 3,319,770 | Use ZXing camera decoding confusion | <p>I check the Internet and see using ZXing to solve two-dimension code. But the code I do not understand.</p>
<pre><code>PlanarYUVLuminanceSource source = new PlanarYUVLuminanceSource( data, width, height, dstLeft, dstTop, dstWidth,dstHeight, false);
</code></pre>
<p>What the meaning of the parameter? </p>
| android | [4] |
3,647,292 | 3,647,293 | java file/directory api | <p>Is there an API that can provide me more in depth information on a file/directory on the disk? For e.g. I would want to know if a drive is a root drive or a floppy drive , a file is a hidden file etc..?</p>
<p>Thanks
Shafi</p>
| java | [1] |
4,694,031 | 4,694,032 | Fetch data from a given website | <p>I want to create a web service in ASP.NET that fetches data from a website every hour or so (the storing part I got it covered). <a href="http://www.metacritic.com/video/titles/12rounds" rel="nofollow">In this example</a>, metacritic.com, how can I get the Users score of a movie at any given time interval? </p>
<p>What I know is, I would have to get the source of the website and then find the html element that contains the data I want (by name in the best of the cases) but I don't know how to do it.</p>
<p>Thanks in advance for any help!</p>
<p><img src="http://img354.imageshack.us/img354/9351/200907030136.png" alt="alt text" /></p>
| asp.net | [9] |
5,003,670 | 5,003,671 | (Python) Can some explain what this function is doing (use of object attributes) | <p>I am carrying out code maintenance on an old Python script. I have come accross a piece of the code, which has me flumoxed. Earlier on in the code (not shown in the snippet below), class are defined, with minimal attributes. Further on in the code, assignments are made to non existent fields in the class. For example</p>
<pre><code>tempvar = MyClassObject()
tempvar.this_field_was_not_defined_in_the_class = 42
</code></pre>
<p>Later on in the script, the variable tempvar is written to a CSV file by calling:</p>
<pre><code>write_csv('test.csv', tempvar, ('declared_field1', 'declared_field2',
('declared_field3', 'New Label'),
'this_field_was_not_defined_in_the_class') )
</code></pre>
<p>Here is the (confusing [to me]) function that writes the object to file:</p>
<pre><code>def write_csv(filename, objects, fields, add_weightings=True):
# The items in fields can either be a tuple of the attribute name and a label for that
# attribute, or just an attribute name. In the later case replace it with a tuple with an
# automatically generated label.
fields = list(fields)
for i in xrange(len(fields)):
if isinstance(fields[i], tuple):
continue
else:
fields[i] = (fields[i], fields[i].replace('_', ' '))
with open(filename, 'wb') as f:
f.write(codecs.BOM_UTF8)
c = csv.DictWriter(f, [i[0] for i in fields])
c.writerow(dict(fields))
c.writerows(
[utf8ify(add_weighting(i.__dict__) if add_weightings else i.__dict__) for i in objects])
</code></pre>
<p>Can anyone explain what is going on? BTW <strong>utf8ify</strong> and <strong>add_weighting</strong> are global functions defined in the script.</p>
| python | [7] |
5,490,302 | 5,490,303 | Can constructorless classes have their methods called without instantiation? | <p>Can I avoid initializing this?</p>
<p>I have a simple factory with <strong>no constructor</strong>. I use it like this:</p>
<pre><code>var slf = new GenericSelectListFactory();
vm.Works = slf.getWorkgsl(0);
vm.Cars = slf.getCargsl(0);
</code></pre>
<p>I can also use it like this:</p>
<pre><code>vm.Cars = new GenericSelectListFactory().getCargsl(0);
</code></pre>
<p>Is there any way to use it without the new keyword?</p>
<pre><code>vm.Cars = GenericSelectListFactory.getCargsl(0);
</code></pre>
| c# | [0] |
2,453,996 | 2,453,997 | Alternatives to jquery hide()/show()? | <p>I am trying to hide an element in my page (it is a youtube player instance). When I use jquery's hide() method, the player gets a bit wonky, in that it stops responding, even after I call .show() again.</p>
<p>Is there another variant on hide(), maybe something like .opacity(0), or .visibility('none') that I can use? I don't mind the player taking up space on the page, I just want to hide it so the user can't interact with it until I'm prepared to show a video (the player happens to require a video to load immediately, but I don't have one until the user selects one from another ui element!)</p>
<p>Thanks</p>
| jquery | [5] |
727,624 | 727,625 | How to lock android device by using programatically...Is it Possible? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4545079/lock-the-android-device-programatically">Lock the android device programatically</a> </p>
</blockquote>
<p>Can any one help me how to lock a device using java Program, and here i am not using any UI means i am doing on the Service and user can not know what happening in his device.
by using msm Notification i am going to locking the device without user permission.
I Tried KeygardManager and DeviceAdmin but they are giving Security exceptions.</p>
<p>Is there any one to help.
Thanks in advance.</p>
| android | [4] |
4,142,526 | 4,142,527 | access and modify array through include file and function | <p>Not sure why I can't modify an array by calling a function that includes a file that then references that array.</p>
<p>Here is the situation:</p>
<p>config.php:</p>
<pre><code>$db['default']['password'] = "password";
$db['default']['database'] = "dbname";
check_if_local_file_exists(__FILE__);
</code></pre>
<hr>
<pre><code>function check_if_local_file_exists( $calling_file )
{
$local_version = dirname( $calling_file ) . '/' . basename( $calling_file , '.php' ) . '.local';
if ( file_exists ( $local_version ) ) {
@include_once( $local_version );
}
} // function
</code></pre>
<hr>
<p>config.local:</p>
<pre><code>global $db;
$db['default']['password'] = "password_modififed";
$db['default']['database'] = "dbname_modified";
</code></pre>
<hr>
<p>Not sure why I can't modify the $db array in the included file: config.local that is included by the check_if_local_file_exists function.</p>
<p>When I print_r ($db ) after calling check_if_local_file_exists(<strong>FILE</strong>) in config.php, the $db array has not been modified at all. . .</p>
| php | [2] |
3,537,900 | 3,537,901 | onRestoreInstanceState() not being called when it is expected | <p>I have run into some trouble lately with <code>onSaveInstanceState()</code> and <code>onRestoreInstanceState()</code>. I have multiple activities that use these methods to save state in the case that they are cleaned up by the system. Most of them work, except for one, and I have no idea why.</p>
<p>What specifically happens is this: </p>
<ul>
<li>I have my emulator running, and the dev tools setup to <code>destroy()</code> all activities when they are no longer visible. (So that I can prove that save/restore are working properly.) </li>
<li>The Activity in question is started up, and I proceed to change some of its state. </li>
<li>I start a new Activity, let it run for a moment, and then use the 'back' button to go to my previous Activity. </li>
<li>Upon arriving back at the Activity in question, I notice that the default state is back, thus, it does not have the state it should.</li>
</ul>
<p>I have noticed that the <code>onSaveInstanceState()</code> is called, <code>onCreate()</code> is called, but has a null bundle, and <code>onRestoreInstanceState()</code> is never called.</p>
<p>Has anyone seen this before?</p>
| android | [4] |
4,621,275 | 4,621,276 | how to pass a variable thru URL in php | <p>Hi I am trying to pass a value from one file to another file via URL.</p>
<p>The way i do is: <code><a href='fund_view.php?idfund="<? echo $row['idfund']; ?>"'></code></p>
<p>after all i get the right value in other file using </p>
<pre><code>$aidi = $_GET['idfund'];
echo 'ID= '.$aidi;`
</code></pre>
<p>But the result i get is this format <code>ID= \"10\"</code></p>
<p>the url after i pass the id looks like </p>
<pre><code>http://example.com/fund_view.php?idfund="10"
</code></pre>
<p>and what i want the result to be is just <code>ID="10"</code>.</p>
| php | [2] |
4,339,088 | 4,339,089 | Android: float - get rid of trailing point zeros | <p>i did a lot of search on the internet but could not get a satisfacting solution.
The best I did was:</p>
<pre><code>String b = new BigDecimal(floatNumber.stripTrailingZeros().toPlainString();
</code></pre>
<p>But it hast some nasty bugs, e.g. if the number is 1.6 i get 1.600000744 (or similar). </p>
<p>thanks</p>
| android | [4] |
5,883,232 | 5,883,233 | What is the use of IClonable interface in .NET? | <p>I just wanted to know what is the use of IClonable interface in .NET?</p>
| c# | [0] |
847,136 | 847,137 | How to set onclick function to dynamic textview in android? | <p>I set the <code>onClick()</code> function, but when I click the text it works two times that mean I have two dynamic text view. How to resolve it?</p>
<p>My code:</p>
<pre><code>TextView tView[] = new TextView [Array.length];
for(int i =1; i<Array.length; i++)
{
tview[i] = new TextView(this);
tview[i].setId(i);
tview[i].setText(Array[i]);
tview[i].setOnTouchListener(new OnTouchListener()
{
Public boolean onTouch(View v ,MotionEvent event)
{
Toast.makeText(getApplicationcontext,"MapVal",Toast.LengthShort).show();
}
});
}
</code></pre>
| android | [4] |
27,847 | 27,848 | Autocomplete list for group of text boxes | <p>From my particular question I have got answer for implementing auto complete list..but issue is when I clicked on any suggested it blanks my input box. I have input boxes with class <code>track</code>. My function that I used for on blur event is..</p>
<pre><code><input name="track[]" type="text" class="track" maxlength="150"/>
<div class="suggestionsBox" id="suggestions" style="display: none;">
<img src="images/upArrow.png" style="position: relative; top: -12px; left: 50px;" alt="upArrow" />
<div class="suggestionList" id="autoSuggestionsList">&nbsp;</div>
</div>
<script>
$('input.track').keyup(function() {
var poetname = $(this).val();
if(poetname.length == 0) {
// Hide the suggestion box.
$(this).parent().find('#suggestions').hide();
}
else {
$.ajax({
url: "rpc.php",
type: "post",
data: {queryString: poetname},
context: this, // i.e. the text box
success: function(data) {
if(data.length >0) {
$(this).parent().find('#suggestions').show();
$(this).parent().find('#autoSuggestionsList').html(data);
}
}
});
}
});
$('input.track').blur(function() {
$(this).val( );
$(this).parent().find('.suggestionsBox').hide();
});
</script>
</code></pre>
| jquery | [5] |
721,741 | 721,742 | Is it possible to open a new window using location.href=""? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/11540085/open-and-close-javascript-window">open and close javascript window</a> </p>
</blockquote>
<p>Is it possible to open a new window using <code>location.href=""</code>? If so, how?</p>
| javascript | [3] |
4,332,202 | 4,332,203 | how to redirect to login page if the users copy the link and paste it in the other tab | <p>I am Developing an application where the user enters their username and password to get into the application. If f he copies the url and pastes it into another other tab it should redirect to the login page with a warning message. How can I do this?</p>
| c# | [0] |
4,659,399 | 4,659,400 | Is there a way to capture all FormClosed event in C# within an application automatically? | <p>I would like to centralize code handler for all FormClosed Event, is there a way to be notified automatically by all forms that are closing ?</p>
| c# | [0] |
2,328,359 | 2,328,360 | How to give space in javascript? | <p>I have a response where I have an Image in that response and after every response I need to give a space.How can I do that?</p>
<p>Any help will be appreciated!</p>
<p>Here is my script:</p>
<pre><code><script type="text/javascript>
$("#thumbnail").append(response)
</script>
</code></pre>
| javascript | [3] |
154,390 | 154,391 | segmentation fault for the code | <pre><code>#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<stdio.h>
using namespace std;
union type{
int a;
char b;
int *p;
char *s;
int arr[10];
};
int fn(union type *exp){
exp->p = exp->p+1;
cout << *(exp->p);
cout << "\n";
return 0;
}
int main(){
union type *str;
str->a = 10;
str->b = 'n';
str->p = &(str->a);
cout << (str->p);
cout << "\n";
fn(str);
cout << str->p;
cout << "\n";
return 0;
}
</code></pre>
<p>This code is giving me segmentation fault. Is it because i need to allocate memory to the union explicitly using malloc?? I am new to coding and trying to learn c++. </p>
| c++ | [6] |
2,326,504 | 2,326,505 | Preventing Negative Numbers in TextView | <p>I have a TextView that displays a number (in this case, the number is 10). </p>
<p>Now, i have a button so the user has to press that button 10 times in order for the number to hit 0, resulting in moving on to the next level. However, </p>
<p>I can keep hitting that button and it starts its way back into the negatives (-1, -2, etc.). </p>
<p>I tried to think of how I would prevent this but I'm at loss.. any ideas?</p>
<p>-----------------------------------EDIT-----------------------------------------</p>
<p>Okay, so here is my update (I got it to stop at 0):</p>
<pre><code>public void onClick(View v) {
// TODO Auto-generated method stub
if (scr >= 1) {
scr = scr - 1;
TextView Score = (TextView) findViewById(R.id.Score);
Score.setText(String.valueOf(scr));
}
if (scr == 10)
{
aCounter.start();
}
if (scr == 1)
{
aCounter.cancel();
new AlertDialog.Builder(Tap_Game_Activity.this)
.setTitle("Congratulations!").setMessage("Go to Level 2?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface AlertDialog, int PositiveButton) {
setContentView(R.layout.activity_level02_activity);
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface AlertDialog, int NegativeButton) {
}
}).show();
}
}});
</code></pre>
<p>}</p>
<p>(EDIT!): I fixed the AlertDialog by changing the 2 'Else If' statements to just 'If' statements. However, my timer still doesn't work :(, any help?</p>
| android | [4] |
399,476 | 399,477 | How to Custom Tab bar item text | <p>I am using five tab bar items in the tab bar,i want to custom the text which is displayed on that.Is it possible.Please help me in this.Thanks in advance</p>
<p>Thanks
ask</p>
| iphone | [8] |
2,087,474 | 2,087,475 | Is it possible to use sub folders in drawables in Android? | <p>In my application I have several folders and subfolders of images. They are inside drawables. How can I retrieve images from drawables subfolders?</p>
<p>Example:</p>
<p>drawable>actions>sports>soccer.png</p>
<p>How can I get this "soccer.png" photo?</p>
<p>Any help is appreciated.</p>
<p>Thanks!</p>
| android | [4] |
1,974,379 | 1,974,380 | Android TextToSpeech setLanguage works on emulator but not on the phone | <p>I am having a very annoying problem with Android TextToSpeech API.
When I try to set up a language like this for example :</p>
<pre><code>int result = tts.setLanguage(Locale.GERMANY);
</code></pre>
<p>The result is SUCCESS, but the TTS still uses default language, instead of the one I set up.</p>
<p>The weird thing is that on the emulator it works perfectly, the problem only occurs on my galaxy S.</p>
| android | [4] |
1,264,034 | 1,264,035 | Modify the hover jquery function | <p>Consider the following:
There is a panel (let it be a div element) who's height is controlled using the hover function. The only css property that is animated is height. Both of the animations (on mouse over height+=500px; on mouse out height-=500px) have duration of 10 seconds.
Can u imagine this: douring the period of those 20 seconds, you can 'accidentally' roll the mouse in and out at least 10 times.</p>
<p>What jquery does is it remembers all that happened (with the mouse) and chains a looong list of unnecessary animations.</p>
<p>I need u guys to help me prevent this.</p>
| jquery | [5] |
4,531,472 | 4,531,473 | Window Focus Disable in Android | <p>I am stuck in a scenario. I have a login Form. I want to show it as disabled for some users. I can get that users but I dont know how to remove the focus from the window.</p>
<pre><code>//to check whether the current user is administrator or not
public void checkAdministrator(){
String owner = ParseValues.parsedGroupList.get(indexofGroup).getGroup_owner();
String currentUser = CCMStaticVariable.loginUserId+"@abc.com";
if(owner.equalsIgnoreCase(currentUser)){
administrator=true;
}
else{
administrator=false;
}
}
</code></pre>
<p>Now - </p>
<pre><code>if(!administrator){
//here I want to disable the whole Activity, I just want to show the activity in disabled state
}
</code></pre>
| android | [4] |
2,458,612 | 2,458,613 | javascript text wrapper | <p>i want to create a simple text editor for a website which works something like forums.. eg. if the user clicks on font color(<strong>after selecting a particular text</strong>), the selected text should be wrapped around some text something like [FONT COLOR="some_color"]sample text[/FONT]</p>
<p>i don't wanna use tinymce, because it's mammoth for my needs..any suggestions?? thankx..</p>
| javascript | [3] |
2,937,646 | 2,937,647 | from server check for file on another server | <p>I have two server may be they will be at same network or not,while doing some work in jsp page at server 1 ,I want to check if file exist or not on the second server , How I can do this?</p>
| java | [1] |
3,439,231 | 3,439,232 | Function file with 2,000 rows adding to each page. Is it ok? | <p>I have PHP function file with ~2,000 rows and I always include it for each page. Do those many rows make my site slower? Should I separate function file to different files? Thank you.</p>
| php | [2] |
4,978,760 | 4,978,761 | Regarding download image from url in android | <p>I am developing an android application in which i have data coming from Url,The url has 3 images,along with text.I want to show all the images in list along with text.I looked at the some sample url along with lazy loading,code,,,,can anyone guide me how to do this</p>
<p>It is the url
<a href="http://www.harpreetvirk.com/PMEvents/PMe.svc/Speakers" rel="nofollow">http://www.harpreetvirk.com/PMEvents/PMe.svc/Speakers</a></p>
<p>Regards</p>
| android | [4] |
5,658,344 | 5,658,345 | Difference between these two types of self executing function on JavaScript | <p>I always use the following self executing function in order to avoid exposing my code to global scope in JavaScript:</p>
<pre><code>(function() {
//Code comes here
})();
</code></pre>
<p>I believe that this is also called <em>self executing anonymous function</em> as well. Sometimes, I also see the below code used for the same purpose:</p>
<pre><code>(function(d){
//Code comes here
})(document.documentElement);
</code></pre>
<p>I am not sure what makes the difference here so I am asking this question.</p>
<p>What is the difference (or are the differences) between these two types of self executing function on JavaScript?</p>
| javascript | [3] |
1,422,085 | 1,422,086 | How can I add a where into my foreach loop in C# | <p>I have the following:</p>
<pre><code>foreach ( var menuItem in Model.menuItems) {
if (menuItem.Type == "02") {
}
}
</code></pre>
<p>The code within the foreach executes only when Type==2 so is there some way that I could add the check for Type == "02" into the top part of my loop.</p>
| c# | [0] |
4,626,801 | 4,626,802 | Problem of subclassing UITableViewCell | <p>I have a class A that inherits UITableViewCell (to customize a table cell). It has members say x which is a UILabel.</p>
<p>Now, if I want to set values like a.x.text ="some text" in the cellForRowAtIndexPath method, I am getting compiler error "error for member x in cell which is of non-class type UITableViewCell".</p>
<p>Could you please let me know how can I fix this problem?</p>
<p>Thanks.</p>
| iphone | [8] |
2,581,242 | 2,581,243 | To calculate the sum of numbers in a list by Python | <p>My data</p>
<pre><code>466.67
465.56
464.44
463.33
462.22
461.11
460.00
458.89
...
</code></pre>
<p>I run in Python</p>
<pre><code>sum(/tmp/1,0)
</code></pre>
<p>I get an error.</p>
<p><strong>How can you calculate the sum of the values by Python?</strong></p>
| python | [7] |
2,045,906 | 2,045,907 | First next/previous substring positions in Javascript | <p>Let's say I have a long string, for instance:</p>
<pre><code>var sentence = "Marry had a little lamb, Peter had a little wolf, the wolf ate the little lamb and the little wolf was happy.";
</code></pre>
<p>I need to find the position of the substring "Peter" inside the string.</p>
<p>That, of course, is <code>var pos = sentence.indexOf("Peter");</code>.</p>
<p>But now I have a problem - I need to find the <em>last</em> occurrence of the substring "lamb" <code>before</code> <code>pos</code> and the <em>first</em> occurrence of the substring "wolf" <em>after</em> <code>pos</code>.</p>
<p>How do I do that? Pure Javascript please, no jQuery.</p>
| javascript | [3] |
1,714,912 | 1,714,913 | Is the android:id attribute required for all views in my layout? | <p>Is the <a href="http://developer.android.com/guide/topics/ui/declaring-layout.html#id" rel="nofollow"><code>android:id</code></a> attribute required for all views in my layout? What is the best practice?</p>
<p>I would prefer to specify IDs in the rare instances that I need it (like <code>x:Name</code> in WPF), but it seems like Android and Eclipse like to have it on everything.</p>
| android | [4] |
5,629,555 | 5,629,556 | c# logic to get the first non-repeating(distinct) character from the string | <p>In c# i want to create logic that if i a string like abcabda is passed to a method then it should return first non repeative character from string like in above it should return c.
i am unable to convert a string to array of character then how to make comparison of each array character to the string and return the first non repeative character.</p>
<p>CanI make it like this?</p>
<pre><code>class A
{
static void main()
{
A a=new A();
char ch=a.m1(abcabd);
}
}
class B
{
char m1(string s)
{
string s1=s;
char[] ch1=new char[s.length];
for(int x=0; x<s.length;x++)
{
ch1[x]=s[x];
}
for(int x=0; x<s.length; x++)
{
for(int y=0; y<s.lenth; y++)
{
if(s[x]=ch1[y])
{
/// here i am confused how to create logic for comparison please let me know
// and how to return the character
}
}
}
}
}
</code></pre>
| c# | [0] |
3,111,666 | 3,111,667 | Inserting a string into a list without getting split into characters | <p>I'm new to Python and can't find a way to insert a string into a list without it getting split into individual characters:</p>
<pre><code>>>> list=['hello','world']
>>> list
['hello', 'world']
>>> list[:0]='foo'
>>> list
['f', 'o', 'o', 'hello', 'world']
</code></pre>
<p>What should I do to have:</p>
<pre><code>['foo', 'hello', 'world']
</code></pre>
<p>Searched the docs and the Web, but it has not been my day.</p>
| python | [7] |
3,602,649 | 3,602,650 | android application running in simulator but not in mobile devices | <p>Recently I've created one android application using eclipse and ran it using android virtual device manager. It ran successfully in the simulator, but whenever I am trying to install it in mobile device HTC Salsa (2.3 ginger bread) it is showing an error message and not proceeding. The error message is:</p>
<blockquote>
<p>Parse Error: There is a problem parsing the package </p>
</blockquote>
<p>As it was my first demo application in android so it will be very helpful if you will guide me in this.</p>
| android | [4] |
598,105 | 598,106 | extract url from string with Javascript | <p>this sounds like something you could just google, but been looking for hours.</p>
<p>basically have this string i am ajaxing from another site</p>
<pre><code>'function onclick(event) { toFacebook("http://www.domain.com.au/deal/url-test?2049361208?226781981"); }'
</code></pre>
<p>it comes out like that because im extracting the onclick.</p>
<p>i just want to extract the url from the string.</p>
<p>any help would be greatly appreciated.</p>
<p>---- edit ----</p>
<p>OK IF I GO HERE..http://regexlib.com/RESilverlight.aspx regext online tester</p>
<p>and run this regex. </p>
<pre><code>(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?
</code></pre>
<p>on my string, it highlights the url perfectly.. i just can get it to run with JS?</p>
| javascript | [3] |
2,067,944 | 2,067,945 | How to detect the position of an element changed? | <p>Consider the situation where <strong>div-A</strong> has a relative position to <strong>div-B</strong> (actually,<strong>div-A</strong> is hovering over <strong>div-B</strong> by different <strong>Z-Index</strong>). When the position of <strong>div-B</strong> changes, <strong>div-C</strong> is to be inserted before it and <strong>div-A</strong> is to be hidden.</p>
<p>The question is: how to detect the position changing of <strong>div-B</strong>?</p>
| javascript | [3] |
654,705 | 654,706 | Iterating a dictionary | <p>I have a dictionary where the values are list elements:</p>
<pre><code>dict1={'A':[9,0,8],'B':[6,5,4],'C':[]}
</code></pre>
<p>Now I have to process this dictionary to check if all the values in the dictionary are empty lists; and if so, collect the keys.</p>
<p>Is there a better option than simply iterating through the entries?</p>
| python | [7] |
1,912,092 | 1,912,093 | alertbox in android | <pre><code>AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
</code></pre>
<p>when i wrote this error is shawn that</p>
<pre><code>The constructor AlertDialog.Builder(new Runnable(){}) is undefined
</code></pre>
<p>.. so just tell me what i m do... </p>
| android | [4] |
581,376 | 581,377 | please explain to me nature of this error showing up when setting static variable | <p>What I wanted to do is to set static $variable to value 'new value', but there an error shows up, saying: </p>
<pre><code>Parse error: syntax error, unexpected '=' in D:\!TC\www\error.php on line 8
class myobj {
static protected $variable = null;
static function test() {
static::variable = 'new value'
}
}
$obj = new myobj();
$obj->test();
</code></pre>
| php | [2] |
3,041,641 | 3,041,642 | dirname(php) similar function in c++ | <p>is there is any function in c++ ,similar to <code>dirname</code> in php...it is used to normalize the url </p>
<pre><code>eg
<?php
$url = "../tets/index.html";
$currentURL = "http://example.com/somedir/anotherdir";
echo dirname($currentURL).substr($url, 2);
?>
</code></pre>
| c++ | [6] |
2,354,625 | 2,354,626 | set focus from class library | <p>In my C# (3.5) solution, i have 2 projects- a Class Library and WinForm project.</p>
<p>All business logic are in class library. while adding/updating data from WinForm, if Class Library finds any error, it will raise error and set focus to associate control in WinForm.</p>
<p>Is it possible?</p>
<p>Thanks,
SKPaul.</p>
| c# | [0] |
3,559,424 | 3,559,425 | How can I detect if a user is away from keyboard? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4516179/detecting-that-the-user-is-away-from-the-pc-with-net">Detecting that the user is away from the PC with .NET</a> </p>
</blockquote>
<p>I want to make a function which determines if someone is currently AFK or not.
For that I want to listen to the Keyboard Keys.
Any ideas how to realize such a function?</p>
<p>The normal <code>KeyPressed</code> event works only if the Form is focused, right?</p>
| c# | [0] |
5,176,901 | 5,176,902 | browse file from sdcard in android | <p>how to browse file from specific folder from sdcard in android?
and if file is media file then on click event of each item it will play.
i am creating project like call recorder so please help me to browse file and how to play this file.
thanx in advance</p>
| android | [4] |
5,798,081 | 5,798,082 | import class defined in same module file? | <p>I have a module file called <code>mymodule.py</code>, which contains the following code:</p>
<pre><code>class foo:
def __init__(self):
self.foo = 1
class bar:
import foo
def __init__(self):
self.bar = foo().foo
</code></pre>
<p>The <code>__init__.py</code> file in the same directory has </p>
<pre><code>from mymodule import foo
</code></pre>
<p>From a script in the same directory, I have the following code:</p>
<pre><code>from mymodule import bar
</code></pre>
<p>When I try to run <code>bar()</code>, I get the error that <code>No module named foo</code>. How can I create an instance of <code>foo</code> in <code>bar</code> when they are defined within the same module file?</p>
| python | [7] |
5,333,993 | 5,333,994 | Are semicolons needed after an object literal assignment in JavaScript? | <p>The following code illustrates an object literal being assigned, but with no semicolon afterwards:</p>
<pre><code>var literal = {
say: function(msg) { alert(msg); }
}
literal.say("hello world!");
</code></pre>
<p>This appears to be legal, and doesn't issue a warning (at least in FireFox 3). Is this completely legal, or is there a strict version of JavaScript where this is not allowed? I'm wondering in particular for future compatibility issues... I would like to be writing "correct" JavaScript, so if technically I need to use the semicolon, I would like to be using it.</p>
| javascript | [3] |
3,767,650 | 3,767,651 | Java read utf-8 encoded file, character by character | <p>I have a file saved as utf-8 (saved by my application in fact). How do you read it character by character?</p>
<pre><code>File file = new File(folder+name);
FileInputStream fis = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(fis);
DataInputStream dis = new DataInputStream(bis);
</code></pre>
<p>The two options seem to be:</p>
<pre><code>char c = dis.readByte()
char c = dis.readChar()
</code></pre>
<ul>
<li>The first option works as long as you only have ascii characters stored, ie english.</li>
<li>The second option reads the first and second byte of the file as one character.</li>
</ul>
<p>The original file is being written as follows:</p>
<pre><code>File file = File.createTempFile("file", "txt");
FileWriter fstream = new FileWriter(file);
BufferedWriter out = new BufferedWriter(fstream);
</code></pre>
| java | [1] |
1,875,227 | 1,875,228 | Python move cursor to end of .txt lines | <p>I need to write() text at the end of every line in a text file. How do I point the cursor to the end of a specific line.</p>
<p>Note: seek(0,2) will put me at the end of the file, but I need the end of each line.</p>
<p>Appreciate the help guys - I've combined your solutions to achieve what I need:</p>
<pre><code>AllLines = [ (str.rstrip('\n') + 'Val2' + "\n" ) for str in AllLines ]
</code></pre>
<p>I can then write AllLines to a new output file.</p>
| python | [7] |
1,449,241 | 1,449,242 | The best practice for not null if statements | <p>I've been writing my "If this variable is not empty" statements like so:</p>
<pre><code>if ($var != '') {
// Yup
}
</code></pre>
<p>But I've asked if this is correct, it hasn't caused a problem for me. Here is the answer I found online:</p>
<pre><code>if (!($error == NULL)) {
/// Yup
}
</code></pre>
<p>This actually looks longer than my approach, but is it better? If so, why?</p>
| php | [2] |
4,045,331 | 4,045,332 | Alert user when they hit the browser back button - with good reson | <p>I know this borders on the taboo here, and please don't reply with "you should never do this etc" I have a very long form in a wizard, some users are too used to using the browsers back and forward buttons that they use those instead of the "Back" and "Next" buttons on the form wizard. If they hit the browsers back button they lose all of their form data which is a pain in the ass, since form is so long. Is it possible to display an alert that when will have a "take me out of here" and a "cancel" button so if they hit cancel it will cancel the function of the back button?</p>
<p>Thanks!</p>
| jquery | [5] |
2,490,189 | 2,490,190 | Zip and UnZip a file programmatically in iphone? | <p>Can we zip and unzip a file through coding? Please send me the rough idea how it's possible.I tried very much but not succeed ...</p>
| iphone | [8] |
4,493,827 | 4,493,828 | php renaming (unknown) uploaded file extension | <p>hi guys i have to rename the (unknown) uploaded file extension from .MP3 to .zip please help I have been stuck with this for a few days now. Thanks in advance:)</p>
<pre><code>if (!copy($file, $newfile)) {
echo "failed to copy $file...\n";
}
$filename = "members/$id/music" . "/" . $_FILES["file"]["name"];
function replace_extension($filename, $zip) {
return preg_replace('/\..+$/', '.' . $zip, $filename);
}
</code></pre>
| php | [2] |
2,255,277 | 2,255,278 | Android ActivityOptions class not found in Intellij | <p>I am using Intellij IDE and I'm trying to use the ActivityOptions class from android 4.1, but Intellij keeps giving me the error java: cannot find symbol symbol: class ActivityOptions location: package android.app.</p>
<p>I am trying to use this import:</p>
<pre><code>import android.app.ActivityOptions;
</code></pre>
<p>In my AndroidManifest.xml I use Android 4.1:</p>
<pre><code> <uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="16" />
</code></pre>
<p>I have updated Intellij to the latest version(12.0.2).</p>
<p>Does anyone know how to fix this without switching to Eclipse?</p>
| android | [4] |
3,866,662 | 3,866,663 | Converting numbers into alphabets in c++ | <p>I'm trying to write a code that would convert numbers into alphabets. For example 1 will be 'A', 2 will be 'B', 3 will be 'C' and so on. Im thinking of writing 26 if statements. I'm wondering if there's a better way to do this...</p>
<p>Thank you!</p>
| c++ | [6] |
3,103,361 | 3,103,362 | How to delete a file that exists | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1248292/how-to-delete-a-file-from-sd-card">How to delete a file from SD card?</a> </p>
</blockquote>
<p>This should be simple for most people, I want to know how to delete a file in the SD card (<code>/sdcard/folder</code>) if it exists i.e?</p>
| android | [4] |
1,750,989 | 1,750,990 | How do I use Python to convert a string to a number if it has commas in it as thousands separators? | <p>I have a string that represents a number which uses commas to separate thousands. How can I convert this to a number in python?</p>
<pre><code>>>> int("1,000,000")
</code></pre>
<p>Generates a <code>ValueError</code>.</p>
<p>I could replace the commas with empty strings before I try to convert it, but that feels wrong somehow. Is there a better way?</p>
| python | [7] |
3,258,562 | 3,258,563 | Loading gif when PHP form is processing | <p>I have a PHP form which includes a file being uploaded upon submit.
As I allow pretty big files, the page can often stand there loading for ages.</p>
<p>Is there a way to show the user a loading animation of some sort?</p>
| php | [2] |
1,018,661 | 1,018,662 | jquery - how to change the selector keeping the action same | <p>Suppose I have an array <code>Boxes={"#box5","#box3",#box1"","#box2","#box4"}</code> and I have a jquery statement</p>
<pre><code>$(Boxes[2]).click(--------some code----------)
</code></pre>
<p>my problem is that the statement is always executed as - when box1 is clicked even though I swap the Box array several times in between. So even when <code>Boxes[2] = "box2"</code> the code is still executed when I click box1 and not box2.</p>
<p>Is this some sort of preprocessing?</p>
| jquery | [5] |
4,462,915 | 4,462,916 | delete the images imagejpeg creates | <p>Is it possible to delete the images that <code>imagejpeg</code> creates I have the images uploading to my Amazon S3 server but the files just pop up in the main directory on my server after its ran. </p>
<pre><code> $new_height = 120;
$width = imagesx($originalImage);
$height = imagesy($originalImage);
$new_width = round(($width * $new_height) / $height);
$imageResized = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($imageResized, $originalImage, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
$tmp_loc = 'uploads/thumb/';
$tempfilename = tempnam($tmp_loc, $filename);
imagejpeg($imageResized, $filename,100);
imagedestroy($imageResized);
imagedestroy($originalImage);
unlink($tempfilename);
</code></pre>
<p>I tried <code>imagedestroy</code> and <code>unlink($tempfilename);</code> but the file remains.</p>
| php | [2] |
4,454,043 | 4,454,044 | how to refresh a page using javascript? | <p>how to refresh a page using javascript or html?</p>
| javascript | [3] |
5,372,417 | 5,372,418 | iPhone Beginner Question - Hooking Up Actions | <p>I'm just starting out with iPhone development, and in my hello world application I'm having a hard time hooking up a view to a controller with actions. I followed the instructions in the book I'm reading (I believe), but depending on where I run the application the app behaves differently.</p>
<p>-When i command-r from the code, I see only the single button I have on the view taking up the whole window. When I click the button the action is triggered.</p>
<p>-when I command-r from the interface designer I see the button, label, and textbox lined up correctly. When I click the button nothing happens.</p>
<p>Anyone know why this is happening/how to fix it? Thanks.</p>
| iphone | [8] |
759,128 | 759,129 | Removable module about android | <p>I want to have a removable module which can dynamically add listview.The module can be moved to left or right.How can I achieve this effect?</p>
| android | [4] |
1,908,497 | 1,908,498 | how to download dynamic file name from url | <p>I want to download the file from url link that is always changing in file name like today's date. I tried regex for filename but it is in the url. for example, the real url is <a href="http://www.sunrise.com.au/web/file/item141112_plain.xls" rel="nofollow">http://www.sunrise.com.au/web/file/item141112_plain.xls</a> in "LIVEHTTPHeaders", but the link from the web browser is <a href="http://www.sunrise.com.au/mailout/simple_excel.asp.I" rel="nofollow">http://www.sunrise.com.au/mailout/simple_excel.asp.I</a> am downloading the file from C# console application using Webclient.</p>
| c# | [0] |
5,620,953 | 5,620,954 | logout user when the session time out | <p>Can this is the right way to log user out when the session timeout.
this is the code which i have written in Page_init of master page.
and also,<br>
session state and Form Authentication is like,</p>
<pre><code><sessionState mode="InProc" timeout="1" cookieless="false">
</sessionState>
<authentication mode="Forms">
<forms loginUrl="Default.aspx" timeout="2880"/>
</authentication>
if (userToLogin != null)
{
if (Context.Session != null)
{
if (Session.IsNewSession)
{
HttpCookie newSessionIdCookie = Request.Cookies["ASP.NET_SessionId"];
if (newSessionIdCookie != null)
{
string newSessionIdCookieValue = newSessionIdCookie.Value;
if (newSessionIdCookieValue != string.Empty)
{
**System.Web.Security.FormsAuthentication.SignOut();**
Response.Redirect("SessionTimeOutPage.htm");
}
}
}
}
}
</code></pre>
<p>please suggest me this is right way or something is available as optimal solution.</p>
| asp.net | [9] |
3,199,962 | 3,199,963 | How do i visualize graphs in java ? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1277126/plot-graphs-in-java">Plot Graphs in Java</a> </p>
</blockquote>
<p>I was trying to create graphs for x and y values in my java Application. Unfortunately while using the libraries in <a href="http://www.epic.noaa.gov/java/sgt/index.html" rel="nofollow">http://www.epic.noaa.gov/java/sgt/index.html</a>, i found that most of the classes/ methods are deprecated. Kindly help me find a way out of this. Is there any alternate library that i can use to construct a graph. I have a for loop in which i generate the x and y values. Therefore, a method where i can directly feed data and then at the end of the loop create a graph would be nice.</p>
| java | [1] |
5,227,628 | 5,227,629 | Null Exception array | <p>Hi I am working in string array and It seeming wont add the data in the array keep me getting an error or null exception</p>
<pre><code>public boolean addCategory(String description){
if(numCategories <= maxArrayCategories){
arrayCategories[numCategories] = description;
numCategories++;
return true;}
else {return false;}}
</code></pre>
<p>Is the problem the function?</p>
| java | [1] |
505,009 | 505,010 | Is it possible to create a namespace in jQuery? | <p>YUI has a nice way of creating a namespace for your methods etc. in javascript.</p>
<p>Does jQuery have anything similiar?</p>
| jquery | [5] |
1,817,542 | 1,817,543 | FileSystemWatcher and write completion | <p>I am implementing an event handler that must open and process the content of a file created by a third part application over which I have no control. I am warned by a note in "C# 4.0 in a nutshell" (page 495) about the risk to open a file before it is fully populated; so I am wondering how to manage this occurrence. To keep at minimum the load on the event handler, I am considering to have the handler simply insert in a queue the file names and then to have a different thread to manage the processing, but, anyways, how may I make sure that the write is completed and the file read is safe? The file size could be arbitrary.</p>
<p>Some idea? Thanks</p>
| c# | [0] |
4,904,433 | 4,904,434 | When to use equality ("==") instead of identity ("===")? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/359494/javascript-vs-does-it-matter-which-equal-operator-i-use">Javascript === vs == : Does it matter which “equal” operator I use?</a> </p>
</blockquote>
<p>Many recommend using <code>===</code> for comparison everywhere in your JavaScript instead of <code>==</code>, and it sounds reasonable. </p>
<p>I was wondering are there any situations where using <code>==</code> would be actually beneficial over <code>===</code>?</p>
| javascript | [3] |
4,411,187 | 4,411,188 | iPhone - too sensitive rotation detection | <p>I have a UIActionSheet based class. The ActionSheets created by this class are designed to vanish if a device orientation rotation is detected.</p>
<p>So, when this class begins I have</p>
<pre><code>[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:) name:UIDeviceOrientationDidChangeNotification object:nil];
</code></pre>
<p>and on the didRotate: i have the dismiss, that sends the ActionSheet away.</p>
<p>The only little, tiny problem is this: any vibration makes the actionSheet dismiss. Even tapping with a little bit more strength will make the popoup dismiss. Even if you are typing inside the actionSheet.</p>
<p>I don't have any accelerometer or coremotion enabled.</p>
<p>Any clues?</p>
<p>thanks</p>
<hr>
<p><strong>EDIT</strong> </p>
<p>I have discovered that the problem is that initially the orientation is being reported as UIDeviceOrientationUnknown and the trepidation makes it report the correct orientation. As UIDeviceOrientationUnknown is different from the correct orientation, this is seen as a rotation change... </p>
<p>Now I am doomed.</p>
| iphone | [8] |
3,202,516 | 3,202,517 | Are too many self-invoking funtions in javascript a bad thing? | <p>Is it bad to have too many self-invoking funtions in javascript?</p>
<p>If they all execute right away (page load) aren't you taking more resources than if you had regular functions and call them when you need them? </p>
<p>Or is that a bug that exists in my head?</p>
<p>For example:</p>
<p>Thousands of these:</p>
<pre><code>var DoIT = (function () {
//heavy stuff
} ());
</code></pre>
<p>VS. Thousands of these:</p>
<pre><code>var DoIT = function () {
//heavy stuff
};
</code></pre>
<p>EDIT #1:</p>
<p>I'm talking about things like </p>
<ul>
<li>setting alerts</li>
<li>creating a jquery dialog with a large form</li>
<li>re-sizing things when they need to be resized.</li>
</ul>
| javascript | [3] |
1,688,684 | 1,688,685 | How to convert the sqlite data into xml form? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/8046280/how-to-convert-sqlite-data-into-xml-file-and-xml-file-into-sql-data">How to convert sqlite data into xml file and xml file into sql data?</a> </p>
</blockquote>
<p>iam developing one applciation.In that i need to convert the sqlite data into xml form.SO please tell me how to do this one?</p>
| iphone | [8] |
1,258,298 | 1,258,299 | Is Python set more space efficient than list? | <p><code>list</code> is known to initialize with a big chunk of space to optimize the time needed to expand the list (on average we don't have to keep making new list like an array). </p>
<p>What about <code>set</code>?</p>
<p>The following construction makes it space wasted because of <code>list</code>. I understand <code>tuple</code> is more space saving because it is immutable. Can we do the same to <code>set</code> and still mutable? </p>
<p><code>set( [ 1, 2, 3] )</code> </p>
| python | [7] |
2,027,715 | 2,027,716 | Need to insert href="#" like in <a href="#"> in asp:linkbutton | <p>I need to insert href="#" like in in asp:linkbutton. please let me know how I can do this..
Thanks
Mithilesh</p>
| asp.net | [9] |
5,764,693 | 5,764,694 | jQuery conflict in time picker | <p>I have two js files and having conflict in implementation.
Order of my links is:</p>
<pre><code> <script language="javascript" src="../js/time.js"></script>
<script language="javascript" src="../js/time_picker_min.js"></script>
<script type="text/javascript" src="../js/json.js"></script>
<script type="text/javascript" src="../js/jquery-1.7.2.min.js" ></script>
</code></pre>
<p>order of calling on page is</p>
<pre><code><script type="text/javascript">
$(document).ready(function () {
<?php $check = ronly($_SESSION['num']);?>
var myvar= '<?php echo $check; ?>';
var table = 'prel';
var id = '<?php echo $_SESSION['num'];?>';
loadJson(table, id, myvar);
showhide();
});
</script>
<script language="javascript">
window.addEvent("domready", function (){
var tp1 = new TimePicker('time1_picker', 'preltemph', 'time1_toggler', {imagesPath:"../images"});
});
</script>
<input type="text" name="preltemph" id="preltemph" /> <a href="#" id="time1_toggler">Temp</a>
<div id="time1_picker" class="time_picker_div"></div>
</code></pre>
<p>If I am using time picker on seperate page without any other Jquery it is working fine. But not while using with others. Time picker is mootool. </p>
<p>How to resolve conflict between these two.</p>
<p>Thank you in advance. </p>
| jquery | [5] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.