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
2,053,168
2,053,169
jquery sum values from different divs with same classes
<p>I am loading dynamically divs that have a .totalprice class. At the end, I would like to sum of the values from all of the .totalprice.</p> <p>Thank you. </p>
jquery
[5]
2,899,368
2,899,369
How to read contact name and number from contact list
<p>I'm trying to read contact numbers from users contact list. Here is my code</p> <pre><code>Cursor cursor = getContacts(); if(cursor.getCount()&gt;0){ while (cursor.moveToNext()) { String displayName = cursor.getString(cursor.getColumnIndex(ContactsContract.Data.DISPLAY_NAME)); int numberField = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER); textViewDisplay.append("Name: "); textViewDisplay.append(displayName+"Number :"+numberField); textViewDisplay.append("\n"); } } </code></pre>
android
[4]
3,850,185
3,850,186
Self update application while running in memory
<p>I have a console app that is triggered by a scheduled task. I would like to run this console app permanently in a new thread and anytime a newer version of the console app is placed, it should run the main code. (maybe once the main code is done executing, it should run a monitor thread on the console exe. When the exe is changed, a shell execute could be called to the console app again and the original thread aborted?).</p>
c#
[0]
4,542,137
4,542,138
jquery on input blur show / hide class
<p>I am currently building an html form and using jquery to validate.</p> <p>Each input field is set up like this:</p> <pre><code>&lt;div class="controls"&gt; &lt;input type="text" class="input-xlarge" name="name" id="name"&gt; &lt;div class="info"&gt;&amp;nbsp;&lt;/div&gt; &lt;div class="valid" style="display:none;"&gt;&amp;nbsp;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>Here is my jquery so far:</p> <pre><code>$('.controls input').blur(function() { if( !$(this).val() ) { $(this).css('border-color','red'); $(this).find('.info').css('display','none'); $(this).find('.error').css('display','inline-block'); </code></pre> <p>The idea is when the user view the form, the info div shows. If they proceed with the form tabbing through the inputs without enetering any information, the error class will show and remove the info class.</p> <p>Any ideas on where im going wrong?</p> <p>Cheers, Dan</p>
jquery
[5]
20,649
20,650
How to design a JavaScript class to support callbacks in a clean way?
<p>I've tried to design some classes to support a callback functionality. Classes MyClass1 and MyClass2 didn't work. Class3 worked, but the design is really horrible. It uses a external class reference to call the method. I'd like to implement a design similar to MyClass1, which is a lot clearer and isn't coupled to an external variable. This callback mechanism would really be great to ajax calls too. $j is just an alias to jQuery.</p> <pre><code>function MyClass1() { $j("#myDiv1").click(this.func); this.func = function() { alert("Inside method."); } } var _class2; function MyClass2() { _class2 = this; $j("#myDiv2").click( _class2.func ); this.func = function() { alert("Inside method."); } } function MyClass3() { $j("#myDiv3").click( function() { cls3.func(); } ); this.func = function() { alert("Inside method."); } } var cls1 = new MyClass1(); var cls2 = new MyClass2(); var cls3 = new MyClass3(); </code></pre>
javascript
[3]
2,905,893
2,905,894
PHP Remove URL from string
<p>If I have a string that contains a url (for examples sake, we'll call it $url) such as;</p> <pre><code>$url = "Here is a funny site http://www.tunyurl.com/34934"; </code></pre> <p>How do i remove the URL from the string? Difficulty is, urls might also show up without the http://, such as ;</p> <pre><code>$url = "Here is another funny site www.tinyurl.com/55555"; </code></pre> <p>There is no HTML present. How would i start a search if http or www exists, then remove the text/numbers/symbols until the first space?</p>
php
[2]
5,589,688
5,589,689
How can I create News Android application without having my own server?
<p>I have tried to create a news app that display news from some website.<br> Some friends helped me to write some php so that I can call the php using http request and get the JSON from the response.<br> Then, I can parse the JSON and display the news correctly.<br> However, the server is not mine.<br> Actually, I don't want to have server communication using php.<br> I want to do it just on client side.<br> 1) I know how to parse the html and get the result using python in local machine, is there any way to implement my python code in Android, and after running the python code, it will connect to the news website and display it correctly.<br> 2) If not, what can I do because I do not want to host a server. </p>
android
[4]
2,713,039
2,713,040
issue with using std::copy
<p>I am getting warning when using the std copy function.</p> <p>I have a byte array that I declare. </p> <pre><code>byte *tstArray = new tstArray[length]; </code></pre> <p>Then I have a couple other byte arrays that are declared and initialized with some hex values that i would like to use depending on some initial user input. </p> <p>I have a series of if statements that I use to basically parse out the original input, and based on some string, I choose which byte array to use and in doing so copy the results to the original tstArray.</p> <p>For example:</p> <pre><code>if(substr1 == "15") { std::cout&lt;&lt;"Using byte array rated 15"&lt;&lt;std::endl; std::copy(ratedArray15,ratedArray15+length,tstArray); } </code></pre> <p>The warning i get is warning C4996: 'std::copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct.</p> <p>A possible solution is to to disable this warning is by useing -D_SCL_SECURE_NO_WARNINGS, I think. Well, that is what I am researching.</p> <p>But, I am not sure if this means that my code is really unsafe and I actually needed to do some checking?</p>
c++
[6]
1,628,823
1,628,824
what does "@" means in c#
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1057926/when-to-use-in-c">when to use @ in c# ?</a> </p> </blockquote> <p>F.e. <code>string sqlSelect = @"SELECT * FROM Sales".</code></p>
c#
[0]
4,076,299
4,076,300
receiving warning of uninitialized local variable
<p>I am writing a program and I am trying to overload to &lt;&lt; operator. When I debug my code, i receive an error saying that p is not initialized. I feel as if i am initializing p in the for statement, but i guess i am not. cannot seem to figure out how i would initialize p. this is the code where i am receiving the error message. anyy suggestions?</p> <pre><code>ostream &amp;operator &lt;&lt;( ostream &amp;out, const LList &amp; llist ) { for( LList *p = p; p != 0; p = p -&gt; next ) out &lt;&lt; p; return out; } </code></pre>
c++
[6]
1,402,765
1,402,766
Method to recursively delete any directory that has no files, my solution seems to work but trying to find ways it can break
<p>This method will delete any files and empty directories provided in the fileList. It seems to be working. I use recursion to delete the empty directories and i'm worried about cases that will create an infinite loop. Any thoughts or things to consider with this approach?</p> <pre><code>public static void deleteFilesAndEmptyDirs(List&lt;File&gt; fileList) { boolean result = true; List&lt;File&gt; returnList = new LinkedList&lt;File&gt;(); for (File file : fileList) { result = file.delete(); if(result == false &amp;&amp; file.isDirectory()) { returnList.add(file); } } if(returnList.size() &gt;= 1) { deleteFilesAndEmptyDirs(returnList); } } </code></pre>
java
[1]
2,646,318
2,646,319
How can I store reference to a variable within an array?
<p>I'm trying to create an array that maps strings to variables. It seems that the array stores the current value of the variable instead of storing a reference to the variable.</p> <pre><code>var name = "foo"; var array = []; array["reference"] = name; name = "bar"; // Still returns "foo" when I'd like it to return "bar." array["reference"]; </code></pre> <p>Is there a way to make the array refer to the variable?</p>
javascript
[3]
3,086,579
3,086,580
Add new updates on Android App
<p>I am a beginner on Android as I am working on developing a new Android app. In my project I have some problems when the user click on an icon, it should redirect him to dot net website I did in my code.</p> <ol> <li><p>If I want to update the apk file on customer mobile to update it should prompt to the user to download the new version. How can I achieve this?</p></li> <li><p>Also how can I know this app belong me between many app on customer device?</p></li> <li><p>I want to fetch the bugs and errors that may occurred on the customer device. How can I do it? </p></li> </ol>
android
[4]
756,147
756,148
jQuery softscroll.js works in all browsers in the demo, but doesnt work in safari on my website?
<p>Basically what i say in the title is what goes.. Ill show you some of the code and give an explanation.</p> <p>Here's the website page: <a href="http://eosa.co.cc/themes/osoa/portfolio.html" rel="nofollow">http://eosa.co.cc/themes/osoa/portfolio.html</a></p> <p><strong>As this doesnt let me post more than 1 link due to spam ive put 2 others links in big orange letters at the top so you can see the demo page and the JS for the softscroll</strong></p> <p>the arrows on the right side are what im refering too, they scroll in all browsers fine apart from safari? No idea why it wont work seeing as the demo works fine in safari.</p> <p>and heres some html for the links used:</p> <pre><code>&lt;div class="fullwidthbox"&gt; &lt;div class="portfoliogrouptitle"&gt; &lt;h1&gt;Logo Design&lt;/h1&gt; &lt;/div&gt; &lt;a href="#webdesign" class="scroll portfolionav-up"&gt;&lt;/a&gt; &lt;a href="#prints" class="scroll portfolionav-down"&gt;&lt;/a&gt; &lt;/div&gt; </code></pre> <p>And heres what they would link onto...</p> <pre><code>&lt;hr class="contenthr" style="margin-bottom:30px" id="prints"/&gt; </code></pre> <p>Im not sure what else to say?? but visit the site and the arrows on the right are anchor links to different sections, you'll understand better once you take a look. Also apologies for the speed of the site, its free hosting.</p> <p>I dont have loads of knoledge about jquery so any help at all would be great, im more of a html/css person myself.</p>
jquery
[5]
445,318
445,319
Web frontend for a Python application
<p>I created a nice RSS application in Python. It took a while and most of the code just does heavy work, like formatting XML, downloading feeds, etc. To the application itself requires very little user interaction, just a initial list of RSS feeds and some parameters. </p> <p>What would be really nice, is if I was able to have a web front-end which allowed me to have the user edit their feeds and parameters, then they could click a create button and it runs. </p> <p>I don't really want to have to rewrite the thing in a web framework. Is there anything that will allow me to build a nice front-end allowing it to interact with the normal Python underneath?</p>
python
[7]
2,092,499
2,092,500
Sql calls in code behind page
<p>For now all my sql calls take place in the cs pages and its a lot of code my goal is to set a new class or whatever (i heard it is done right with dll's) that the class will store functions for every scenario i will need. So my question is how to accomplish it .. Suppose in a large scale site how it is supposed to be done?</p>
asp.net
[9]
1,075,308
1,075,309
How to access the web with Python?
<p>I want to access websites without using their API. Would i do this by using something like Mechanize?</p>
python
[7]
1,714,976
1,714,977
what does ? sign in this statement?
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="http://stackoverflow.com/questions/889373/quick-php-syntax-question">quick php syntax question</a><br> <a href="http://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php">Reference - What does this symbol mean in PHP?</a> </p> </blockquote> <p>$row_color = ($row_count % 2) ? $color1 : $color2;</p>
php
[2]
1,872,927
1,872,928
Access mobile inbox online
<p>Is possible to access mobile inbox online using android?</p>
android
[4]
364,854
364,855
How to Zoom in and out an image using seekbar in android?
<p>In my application I have a requirement of Zooming in/out an image using seekbar,I can able to Zoom in/out by using Touch events.</p> <p>I also need to add seek bar for zooming.Is it possible to do this?</p> <p>thanks</p>
android
[4]
2,322,841
2,322,842
Display "Loading" Message While Loading External JavaScript?
<p>So, I know how to use JS or jQuery, etc., to display a "Loading" message while content is loading. I have created a fairly large webapp with a number of JS dependencies and I want to display a "loading" message while all the scripts are loading.</p> <p>My head tag has a number of <code>&lt;script src=…&gt;</code> tags in it and I want to display a loading message <em>instantly</em> when the user visits the page, and then remove it when all the scripts are loaded. </p> <p>What's the best way to do this?</p>
javascript
[3]
3,148,944
3,148,945
Is there a universal way of iterating over a set or values of a dict in Python 2.7?
<p>I expect the collection to be either a set or a dict. Problem is that:</p> <pre><code>for element in collection: print element </code></pre> <p>will give me the elements if collection is a set, but indexes if collection is a dict. What I want is a one-liner that will iterate over dict values.</p> <p>Is that possible?</p>
python
[7]
3,274,102
3,274,103
java condition using strings not working
<p>This is a program when i type "kutty" it should say me "Hello kutty" but this code is not working.</p> <pre><code>import java.util.*; public class Kutty { public static void main(String args[]) { byte a[]={5,2,3}; String c; Scanner scan=new Scanner(System.in); c=scan.next(); if(c=="kutty") { System.out.println("Hello" +c); } else { System.out.println("Invalid"); } } } </code></pre>
java
[1]
1,483,146
1,483,147
Android TrafficStats delivering wrong numbers
<p>I want to measure the data transferred and received for my HTTP request over the mobile network. I found the TrafficStats API in Android 2.2, but the numbers I get from this seem to be too low. I am measuring on a real device (HTC Desire), over 3G network. Immediately before the request a compute the tx/rx data since boot time, then do a GET request, then calculate the rx/tx numbers again:</p> <pre><code>long bytesStart = TrafficStats.getTotalTxBytes() + TrafficStats.getTotalRxBytes(); // execute request (Apache HTTP client) client.execute(get); long totalBytesNow = TrafficStats.getTotalTxBytes() + TrafficStats.getTotalRxBytes(); long bytesDiff = totalBytesNow - bytesStart; </code></pre> <p>For bytesDiff I get numbers around 1.5KB, where it should have been 3.5KB. The totalBytes number is around 5MB, which seems to be a reasonable amount of data for 10 hours that the device is running.</p> <p>I read <a href="http://stackoverflow.com/questions/4029186/can-someone-explain-how-trafficstats-works-its-magic-in-the-android-os">here on stackoverflow</a> that the numbers come from a file, can it be that the data is not flushed to the file immediately? Or why are my numbers always too low (I checked the data size on the server and it is really larger)? Is it a problem of my HTC Desire device (Android 2.2 by HTC), does the TrafficStats API work for anyone?</p> <p>Thanks, Martin</p>
android
[4]
4,694,384
4,694,385
Cannot import namedtuple while using pydoc
<p>OS - Windows XP Python - 2.6.4</p> <p>While trying to generate docs using pydoc, I get the error -</p> <pre><code>Traceback (most recent call last): File "C:\Python26\Lib\pydoc.py", line 55, in &lt;module&gt; import sys, imp, os, re, types, inspect, __builtin__, pkgutil File "C:\Python26\Lib\inspect.py", line 42, in &lt;module&gt; from collections import namedtuple ImportError: cannot import name namedtuple </code></pre> <p>I checked both the files, pydoc.py and inspect.py and this is the erring statement in inspect.py</p> <pre><code>from collections import namedtuple </code></pre> <p>But this works on IDLE - 2.6.4. So is this a bug in pydoc/inspect.py and if so, how can I get a fixed version ? If not, then how can I avoid this issue?</p>
python
[7]
2,159,349
2,159,350
how to change values of a dropdown on key press using jquery
<p>i need to change values of a "Focused" dropdown on keypress using jquery.</p> <p>i need,</p> <ol> <li>how i get a foucsed drop down or how i can check whether the drop down has focus.</li> <li>how to change this drop down values in key press like 1,2,3 etc. using JQUERY.</li> </ol> <p>thanks in advance.</p>
jquery
[5]
195,657
195,658
Use of <%= %> and expression databinding for Write Response
<p>i want write content(summary) with &lt;%= %> and expression databinding in below code but do not success!how i can, do it?</p> <pre><code>&lt;asp:Literal Text='&lt;%# Eval("Summary") %&gt;' ID="SumLitteral" runat="server" /&gt; </code></pre>
asp.net
[9]
47,056
47,057
hide all li elements and show the first 2 and toggle them by button
<p>hay assume i have</p> <pre><code>&lt;ul&gt; &lt;li&gt;2&lt;/li&gt; &lt;li&gt;3&lt;/li&gt; &lt;li&gt;4&lt;/li&gt; &lt;li&gt;5&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>i want jquery code hide all <code>&lt;li&gt;</code> then show the fist and the second one then <code>append()</code> an additional <code>&lt;li&gt;more&lt;/li&gt;</code> that is used to toggle the hidden li.</p>
jquery
[5]
4,797,451
4,797,452
main method in Python
<p>I have the following code, which has the following two problems:</p> <pre><code>Traceback (most recent call last): File "C:\Users\v\workspace\first\src\tests.py", line 1, in &lt;module&gt; class Animal: File "C:\Users\v\workspace\first\src\tests.py", line 39, in Animal File "C:\Users\v\workspace\first\src\tests.py", line 31, in main dog = Animal() NameError: global name 'Animal' is not defined </code></pre> <p>This code is from a tutorial, and in the tutorial it works fine. I have the Python 2.7 and use the PyDev plugin for Eclipse.</p> <pre><code> class Animal: __hungry = "yes" __name = "no name" __owner = "no owner" def __init__(self): pass def set_owner(self,newOwner): self.__owner= newOwner return def get_owner(self): return self.__owner def set_name(self,newName): self.__name= newName return def get_name(self): return self.__name def noise(self): print('errr') return def __hiddenmethod(self): print("hard to find") def main(): dog = Animal() dog.set_owner('Sue') print dog.get_owner() dog.noise() if __name__ =='__main__':main() </code></pre>
python
[7]
3,301,013
3,301,014
connect tableView + tableView
<p>Right now I have an indexed tableview that goes to a detail view but i want it to go to another tableview then a detail view.</p> <p>my code like this:</p> <p>` - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {</p> <pre><code>displyAnnController *anController = [[displyAnnController alloc] initWithNibName:@"AnnView" bundle:[NSBundle mainBundle]]; DetailViewController *dvController = [[DetailViewController alloc] initWithStyle:UITableViewStyleGrouped]; switch (indexPath.row) { case 0: [self.navigationController pushViewController:anController animated:YES]; [anController release]; anController = nil; break; case 1: [self.navigationController pushViewController:dvController animated:YES]; [dvController release]; dvController = nil; break; default: break; }` </code></pre> <p>and when I press the cell with index 0 in the simulator, the program is crash!</p> <p>what's the problem? pleas help me ..</p> <hr> <p>No, I didn't override the <code>-initWithNibName</code>, I just use it as the same way here,but to push to ControlView NOT TableView.Also,no errors in debug console. and I have tried to release the controllers after the switch block, but the program still crash :( anyway, it's work when I write:</p> <pre><code>displyAnnController *anController = [[displyAnnController alloc] initWithStyle:UITableViewStyleGrouped]]; </code></pre> <p>instead of :</p> <pre><code>displyAnnController *anController = [[displyAnnController alloc] initWithNibName:@"AnnView" bundle:[NSBundle mainBundle]] </code></pre> <p>Temporarily, I accept this just to complete my work! but I hope to find any help example because no need to be as group.</p> <p>thanx all for help and recommendations. </p>
iphone
[8]
1,094,049
1,094,050
C++ template specialization question
<p>I'm trying to implement a generic toString() function that would work on all types. All our internal classes derive from Abstract which includes a signature for toString(). In other words, all our internal classes have in some form, a toString method. </p> <p>The problem is, the primitive types (int, char, double..) don't have a native toString function. But we do have a utility function that calls the lexical_cast to give back the string value of the primitive. We don't want a whole bunch of if statements depending So I'm trying to create a templated utility class that would do the job.</p> <p>My first hack at this is the below:</p> <pre><code> template&lt;class T&gt; class ObjectToString { public: string objectToString(T value) { iil::stringUtils::StringSp ret(stringUtils::valueToString&lt;T&gt;(value)); return ret; } }; template&lt;&gt; class ObjectToString &lt;Abstract&lt;T&gt;*&gt; { public: iil::stringUtils::StringSp objectToString(Abstract&lt;T&gt;* value) { return iil::stringUtils::StringSp(new std::string("AAAA")); } }; </code></pre> <p>The problem now is, since Abstract is a templated class, it needs the template value T. I have no idea how to set that. Could anyone advise?</p>
c++
[6]
494,846
494,847
Run a method thats name was passed as a string
<p>I have a C# method that takes a string as an argument, that string contains the name of a static method e.g</p> <pre><code>"MyClass.GetData" </code></pre> <p>Is it possible to run that method from the value passed in the string?</p>
c#
[0]
988,025
988,026
Date and Time string parse
<p>I have a date time string formatted as follows:</p> <p><strong>2012-12-03T02:00:00Z</strong></p> <p>I want to split the date and time up and display it as follows: 03/12/2012 02:00:00</p> <p>How can I do this in python in as few a lines as possible?? (The 'T' and 'Z' will be removed)</p>
python
[7]
3,660,800
3,660,801
Can a service get a reference to the activity during onBind?
<p>I have a service that basically manages a MediaPlayer instance for playing podcasts. Once an activity binds to the service it can do things like play, pause, stop, etc. I used a service because I want the podcast to continue playing even after the activity is destroyed.</p> <p>I'd like the service to be able to send messages back to the activity in case of an error or for normal status updates. Is it possible for the service to get a reference to the activity that's trying to bind to it? Doesn't look like the intent makes this available.</p>
android
[4]
671,229
671,230
Reimport a module in python while interactive
<p>I know it can be done, but I never remember how.</p> <p>How can you reimport a module in python? The scenario is as follows: I import a module interactively and tinker with it, but then I face an error. I fix the error in the .py file and then I want to reimport the fixed module without quitting python. How can I do it ?</p>
python
[7]
5,799,814
5,799,815
Run windows service task at a specific time using C#
<p>i have already design my windows service which include many tasks (same logic run each xxx seconds), but for the new task i have to do :</p> <ul> <li>Download over HTTP a playlist xml file from a CDN repository in a specific time, let see 03:12:12 pm.</li> </ul> <p>i'am looking for profesional code (just thread or timer squeleton) rather than a code which works.</p> <p>I hope i provide you all needed info.</p> <p>Best regards</p> <p>Bratom</p>
c#
[0]
2,633,387
2,633,388
How do I disable jQuery dialog child elements from resizing independently?
<p>I have a dialog box that I open using jQuery 1.7.1. The html for the dialog is:</p> <pre><code>&lt;div id="transactionDialog" title="Transaction Contents"&gt; &lt;textarea&gt;&lt;/textarea&gt; &lt;/div&gt; </code></pre> <p>jQuery Code:</p> <pre><code>$("#transactionDialog").dialog({ autoOpen: false, width: 640, height: 480, show: "highlight", resizable: true }); </code></pre> <p>How do I get rid of the resize icon on the <code>&lt;textarea&gt;</code> tag? </p> <p><img src="http://i.stack.imgur.com/1nyM3.png" alt="dialog resize grippy"></p>
jquery
[5]
4,485,668
4,485,669
ListView QueryString Security
<p>I've a ListView with HyperLink where I pass the orderID. I'm worried that query string is security risk given that end user can modify it.</p> <p>Could you please suggest any other options I can take? It's a ListView and looks like i dont have much options..</p> <p>This is what I'm doing at the moment at ListView:</p> <pre><code>&lt;asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='&lt;%#"~/OrderDetail.aspx?ordid=" + Eval("OrderId")%&gt;'&gt;&lt;%# Eval("OrderID") %&gt;&lt;/asp:HyperLink&gt; </code></pre> <p>Regards</p>
asp.net
[9]
668,418
668,419
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]
811,024
811,025
How to Block outgoing calls and Text SMS
<p>I am developing an App in which I need to block the teenager from using mobile while driving, I need to block the call and sms. please help . any small hints and clues will do. please help me!</p>
android
[4]
3,985,242
3,985,243
Does C++ support variable numbers of parameters to functions?
<p>Like <code>printf</code>?</p> <p>But I remember that C++ does name mangling with function name and parameter types,</p> <p>this can deduce that C++ doesn't support variable length parameters...</p> <p>I just want to make sure, is that the case?</p> <p><strong>UPDATE</strong></p> <p>the discussion should exclude those included by <code>extern "C"</code></p>
c++
[6]
179,742
179,743
Why am I getting only first character in array stored in Session?
<p>I have an array (mysql query result) stored in $_SESSION variable.</p> <p>Now, I try to access a member of that array like:</p> <pre><code>$_SESSION["template"]["key"] </code></pre> <p>Now, the problem is that it gives only first character of the string "key". Strangely, it runs perfectly on localhost and also did on my previous hosting. (I am now on hostgator).</p> <p>What am I doing wrong?</p>
php
[2]
5,760,876
5,760,877
Block a user from a website in ASP.NET
<p>Beside IP blocking and probably using a cookie (if the user changes the IP but doesn't remove the cookie, the new IP is added to the banned list, so the IP has to be changed and the cookie has to be removed together to access the site), is there any tricks one can use to block an annoying user from a website, I know that nothing will work with a savvy user but I'm trying to make it harder for the less savvy ones, any suggestions?</p> <p>Edit: I already have registration in my website, the point is that this is useless to stop determined users (they can simply create other accounts).</p> <p>@rifferte, Actually I'm already building a moderation section where moderators can remove posts and suspend members, also members can report abuse and spam, I'm not trying to make this impossible, simply there's no way to do this, I'm just trying to get rid of the less savvy ones (the majority), and not forever, I'm planning to block them for a certain period of time (probably a couple of days or something like that).</p>
asp.net
[9]
1,569,698
1,569,699
Removing the values using JQuery
<p>I need to remove some values from a hidden and text input box using JQuery, but somehow this is not working</p> <p>Example:</p> <pre><code>&lt;input type="hidden" value="abc" name="ht1" id="ht1" /&gt; &lt;input type="text" name="t1" id="t1" /&gt; </code></pre> <p>I use the following JQuery code to remove the values with an onclick event</p> <pre><code>$('#rt1').click(function() { $('#t1').val(); $('#ht1').val(); }); </code></pre> <p>I can I empty the contents of the input box and clear the value of the hidden field using JQuery?</p>
jquery
[5]
5,139,499
5,139,500
unable to install apk file on AVD Emulator
<p>I have an apk file which have to install on AVD Emulator. But it is showing outofspace dialog with message(app could not be viewed. Free up some space on your and try again).</p> <p>I do uninstall some apps and free memory and install again the app after uninstalling it. but again it is showing same alert msg.</p> <p>Please tell what should i do...</p> <p>Thanks..</p>
android
[4]
4,817,748
4,817,749
Linking with constant variable definition in a header file
<p>Suppose I created a header file constants.h and this file contains:</p> <pre><code>extern const int YEAR = 2011; // definition </code></pre> <p>If I tried in a cpp file (MainCPP.cpp) to use this constant after declaring it without defining it and without including the constants.h file as following:</p> <pre><code>extern const int YEAR; // declaration int main() { cout &lt;&lt; YEAR &lt;&lt; endl; } </code></pre> <p>When I try to do that I get: unresolved external symbol "int const YEAR". On the other hand, if I placed the definition of YEAR within constant.cpp file and done the same in MainCpp.cpp, I will not get the error and the linker will be able to link with YEAR defined within constants.cpp (without including constants.cpp in MainCpp.cpp here too).</p> <p>Does this mean that the linker can link with source file code but not with header file code unless you explicitly included the header file.</p>
c++
[6]
5,171,612
5,171,613
Can we execute multiple commands in the same command prompt launched by python
<p>There is an excel file which contains the paths of multiple scenarios. I am using <code>os.system(command)</code> in a for loop. In each iteration, a path is read from excel file and executes the scenario for that path. </p> <p>My problem is that every time, by using <code>os.system()</code>, a CMD opens, execute one command and close. In next iteration, again second path is read and execute it and CMD close. Here CMD pop-ups again and again. And the system is busy during that period and not able to do other task. I want to execute all the commands(scenario) in one CMD because I would like to minimize it and use the system for other task.</p> <p>In each iteration, there are two main steps:</p> <ol> <li><code>os.chdir(PATH)</code></li> <li><code>os.system(path of exe+" "+name of config file that is present at PATH")</code></li> </ol> <p>Can it be done by using subprocess. If yes please give me some example how it can be implemented?</p>
python
[7]
1,306,895
1,306,896
Sending keys to inactive windows
<p>I've been doing java for a couple months now in a software engineering class and I've recently been working on a program that sends text to an inactive or minimized program. Sending it to the active window is a simple matter of importing jna and using the key press function, ex: <code>r.keyPress(KeyEvent.VK_F6);</code>. However, I can't find out how to set the handler to the minimized window and then send the keys there.</p>
java
[1]
35,313
35,314
How to convert a string to a Guid
<p>I did not find the TryParse method for the Guid. I’m wondering how others handle converting a guid in string format into a guid type.</p> <pre><code>Guid Id; try { Id = new Guid(Request.QueryString["id"]); } catch { Id = Guid.Empty; } </code></pre>
c#
[0]
2,094,708
2,094,709
How to get a random line of a text file in Java?
<p>Say there is a file too big to be put to memory. How can I get a random line from it? Thanks.</p> <p>Update: I want to the probabilities of getting each line to be equal.</p>
java
[1]
3,719,924
3,719,925
ListActivity Intents
<p>I currently have a ListActivity and I am looking to start a new activity based on the selection in the list. Based upon Intents and Extras, how can I make this possible? Here is my code so far:</p> <pre><code>package com.fragile.honbook; import android.app.ListActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; public class GuideSelection extends ListActivity{ private TextView selection; private static final String[] heroes={ "Agility", "Intelligence", "Strength"}; public void onCreate(Bundle icicle){ super.onCreate(icicle); setContentView(R.layout.heroselect); setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.row, R.id.label, heroes)); selection=(TextView)findViewById(R.id.select); } public void onListItemClick(ListView parent, View v, int position, long id){ } } </code></pre>
android
[4]
3,010,531
3,010,532
Is there a way to check if text is in cyrilics or latin using C#?
<p>Is there a way to check if text is in cyrilics or latin using C#?</p>
c#
[0]
63,986
63,987
Cannot Access Protected Function in Derived Class in C#?
<p>How to use protected function of base class in derived class?</p> <pre><code>public class A { protected void Test() { // some code.... } } public class B : A { public void Test2() { A obj = new A(); obj.Test(); // error thrown; } } </code></pre> <p>When i tried to use the Test function of base class. It is throwing error..</p>
c#
[0]
4,855,520
4,855,521
Jquery - use form action including the GET variables?
<p>it it possible to get the form action of a GET form on submit including all of the get variables added on the end?</p> <p>The reason being I want to use AJAX to run the script that the form submits to, and then just display a thank you message.</p>
jquery
[5]
46,808
46,809
how to get only time from date time
<p>suppose i have 6/22/2009 10:00:00 AM.. then how to get only 10:00 Am from this date time</p>
c#
[0]
3,125,891
3,125,892
Can I use file.readline in a blocking manner? Am I doing this right?
<p>I'm trying to write a something that monitors a log file and adds a timestamp when it sees a complete line: </p> <pre><code>import sys f = open(sys.argv[1]) if not f: print 'Failed to open %s' % sys.argv[1] print sys.argv[1] import time try: while True: line = f.readline().replace('\n', '') if not line: continue print time.time(), line except KeyboardInterrupt: pass f.close() </code></pre> <p>The check for line contents is there because, to my surprise, readlines does not block, but rather returns an empty string for the end of file immediately. </p> <p>So then, for monitoring files, I have a few questions: Is there any way I can set this to block? I'm seeing empty strings in this loop, is there any chance they don't actually represent an end of line? Do files that are still opened for writing have end of line characters added to them? </p>
python
[7]
5,854,731
5,854,732
Positioning an image in middle of the screen
<p>Hi can someone please tell me how to position an image in the centre of the screen using javascript?</p> <p>Would I get the screen height and divide by 2? How would I get the screen height?</p> <p>Thanks!</p>
javascript
[3]
601,333
601,334
getting data from combobox to a datagridview
<p>I am using windows forms application. I have two combo boxes , comboA and comboB.I have a datagrid view with two columns. Now I have to populate the datagrid view, with selected item from comboA into first column of datagridview and selected item of comboB into the second column. Please suggest me.</p> <p>To be clear, When I select an item from comboA, it should be displayed in first column of datagridview. And similary when i select an item from comboB , it should be displayed in the second column of the datagridview.</p>
c#
[0]
2,821,629
2,821,630
javascript read variable value from URL
<p>When i post data from one page to another,how do i get that into dom.</p> <p>say URL is www.test.com/?xxx=1234&amp;a=122</p> <p>How to get <strong>xxx</strong> and <strong>a</strong> value inside DOM?</p>
javascript
[3]
2,899,076
2,899,077
Possible to use preprocessor directives in web.config?
<p>I'd like to be able to do this so that I could do something like:</p> <pre><code>#if DEBUG &lt;!--&lt;customErrors mode="On" defaultRedirect="Error.aspx" /&gt;--&gt; #else &lt;customErrors mode="On" defaultRedirect="Error.aspx" /&gt; </code></pre> <p>Possible? Would make life a little easier.</p>
asp.net
[9]
571,999
572,000
jQuery test if element1 is descendant of element2
<p>Does anyone know a good way to test if one element, stored in a var, is the descendant of another, also stored in a var?</p> <p>I don't need <code>element1.isChildOf('selector')</code>, that's easy.<br> I need <code>element1.isChildOf(element2)</code></p> <p><code>element2.find(element1).size() &gt; 0</code> Does not seem to work.</p> <p>I don't want to have to write a plugin the uses <code>.each</code> to test each child if I can avoid it.</p>
jquery
[5]
2,410,733
2,410,734
Want to Integrate Google Calender In my App
<p>I want to develop an android app in which I want to integrate Google Calendar .This is my first app. N nm not getting to start from where please help ... I included calendarview in my xml file but its not working properly n throwing an error of saying "class could not be found "</p>
android
[4]
953,236
953,237
Dictionary with List of Values
<p>I have a file such as:</p> <pre><code>a 1 a 2 b 5 c 8 a 9 </code></pre> <p>I want to add together the second field per key so that I have an aggregate number and therefore a single key:value pair.</p> <p>With a large dataset I am thinking the best way to go about this would be to create a dictionary that contains a list of values per unique key. Is this the best approach?</p> <p>How do I set the lists of values per key accurately (below code seems to overwrite values instead of appending)?</p> <pre><code>dict={} file=open('foo.txt','r') lines=file.readlines() for line in lines: k, v=line.split() dict[k]=[v] </code></pre> <p>now if i want to take the aggregate numbers populated in first dictionary and compare both the keys and the values against keys and values in another dictionary to determine differences between the two, i can only conclude something like the following:</p> <p>for i in res.keys():</p> <pre><code>if res2.get(i): print 'match',i else: print i,'does not match' </code></pre> <p>for i in res2.keys():</p> <pre><code>if res.get(i): print 'match',i else: print i,'does not match' </code></pre> <p>for i in res.values():</p> <pre><code>if res2.get(i): print 'match',i else: print i,'does not match' </code></pre> <p>for i in res2.values():</p> <pre><code>if res.get(i): print 'match',i else: print i,'does not match' </code></pre> <p>cumbersome and buggy...need help!</p>
python
[7]
671,849
671,850
finding multiple ocurrences of a string
<p>How can I find multiple occurrences of a string within a string? And replace the found string with another string in all occurrences? Say, I have the string below:</p> <pre><code>"A cat is going. It is black-white stripped." </code></pre> <p>I want to replace all occurrences of "is" with are.</p>
c++
[6]
4,975,416
4,975,417
how to #define macro only to specific files?
<p>I have a special macro defined in macro.h, but I want it to be valid only in part of my source files (h/cpp), how can I do that?</p> <p>I am afraid that some "bad" user included the macro.h before the source files that must not be familiar with the macro.</p> <p>how can I prevent it?</p>
c++
[6]
2,012,237
2,012,238
How can I catch the event that happens only when the value of a <select> changes through user input?
<p>I have the following code for a normal select list:</p> <pre><code> $('.update-title') .change(function () { var title = $('option:selected', this).prop('title'); $("#modal_Title").val(title); }); </code></pre> <p>This seems to be getting triggered when the select is populated. Is there I can make this happen ONLY when a user goes in and manually reselects a different value?</p>
jquery
[5]
5,165,530
5,165,531
Convert date to month and day python?
<p>if I have an array of dates:</p> <pre><code>["2012-1-1", "2012-1-3","2012-5-3"] </code></pre> <p>I want to be able to get a result list of:</p> <pre><code>["January 2012", "May 2012"] </code></pre> <p>What is the best way to do this?</p>
python
[7]
1,251,984
1,251,985
Casting To The Correct Subclass
<p>I hava a supeclass called Car with 3 subclasses.</p> <pre><code>class Ford extends Car{ } class Chevrolet extends Car{ } class Audi extends Car{ } </code></pre> <p>Now i have a function called <code>printMessge(Car car)</code> which will print a message of a particular car type. In the implementation i use if statements to test the instance of the classes like this.</p> <pre><code>public int printMessge(Car car){ if((Ford)car instanceof Ford){ // print ford }else if((Chevrolet)car instanceof Chevrolet){ // print chevrolet }else if((Audi)car instanceof Audi){ // print Audi } } </code></pre> <p>for instance if i call it for the first time with Ford <code>printMessge(new Ford())</code>, it prints the ford message but when i call it with <code>printMessge(new Chevrolet())</code>, i get <strong>EXCEPTION</strong> from the first if statement that Chevrolet cannot be cast to Ford.</p> <p>What am i doing wrong and what is the best way.</p> <p>thanks</p>
java
[1]
3,998,513
3,998,514
PHP: Get the last weekday of the year
<p>Is it possible in php to get the last weekday of the year, i.e- not a Saturday or Sunday?</p> <p>If so, whats the best way to do this?</p>
php
[2]
3,807,030
3,807,031
Travesing the DOM - Alphabetically
<p>I have a list of links/image pairs in a page. </p> <p>For example, social page below has two links - Twitter, Facebook...the image didn't capture the name. </p> <p>I need to traverse these and do and insert alphabetically.</p> <p>So I grab the page ID as follows:</p> <pre><code>var element_iterator = document.getElementById( 'social_page' ); </code></pre> <p>Now I have the "page' containing the two links Twiiter and Facebook. Say i want to inset Quora, how do I traverse this to find the insert point.</p> <p>How can I traverse the DOM and to and alphaetical insert based on title. </p> <p><strong>Broken Code</strong></p> <pre><code>var page_element = document.getElementById( form_elements.tag.value + '_page' ); var element_iterator = page_element.firstChild; while( !!( element_iterator = element_iterator.nextSibling ) ) { if( typeof element_iterator.tagName === 'undefined' ) { page_element.insertBefore( image_element, element_iterator ); page_element.insertBefore( link_element, element_iterator ); break; } else if( element_iterator.tagName.toLowerCase() === 'a' &amp;&amp; ( link_element.innerHTML&lt;element_iterator.innerHTML ) ) { element_iterator = element_iterator.previousSibling; page_element.insertBefore( image_element, element_iterator ); page_element.insertBefore( link_element, element_iterator ); break; } } </code></pre> <p><img src="http://i.stack.imgur.com/sxKfg.png" alt="DOM"></p>
javascript
[3]
315,586
315,587
Anchor Javascript Window Reloading
<p>all ready link here : <code>site.com/en/#gone_videoid</code></p> <p>new url : </p> <pre><code>var url = 'en/#gone_videoid2'; window.location.href= url; </code></pre> <p>coming url : <code>site.com/en/#gone_videoid2</code></p> <p>but window refeshing when refering location href i want work like this click</p> <pre><code>&lt;a href="en/#gone_videoid2"&gt;video&lt;/a&gt; </code></pre> <p>this clickig not refeshing window </p>
javascript
[3]
1,908,982
1,908,983
Question regarding subprocess in python
<p>I have a question regarding subprocess popen()</p> <p>If suppose the command executed is in a while loop is there any way for the subprocess.popen to detect it and exit after printing the first output?</p> <p>Or is there any other way to do this and print the result</p> <p>As u see the following program executed on a linux machine just keeps on executing</p> <pre><code> &gt;&gt;&gt; import os &gt;&gt;&gt; import subprocess as sp &gt;&gt;&gt; p = sp.Popen("yes", stdout=sp.PIPE) &gt;&gt;&gt; result = p.communicate()[0] </code></pre>
python
[7]
4,185,305
4,185,306
The method replaceVariables(String) is undefined for the type
<p>I get this message for as many times as I have used <code>replaceVariables</code> in my code. I have added the referenced libraries, but I don't know what else to do. Can someone please help me?</p> <p><strong>Update</strong>: This is the code:</p> <pre><code> int k = 0; for(Xml reg_is:fetchsite.child("site").child("regexps").children("reg")) { if(reg_is.string("name").contains("unique")){ if(reg_is.child("start").content()=="") error += "\tNo prefix reg.exp. given.\n"; else prefix = HtmlMethods.removeBreaks(replaceVariables(reg_is.child("start").content())); if(reg_is.child("end").content()=="") error += "\tNo suffix reg.exp. given.\n"; else suffix = HtmlMethods.removeBreaks(replaceVariables(reg_is.child("end").content())); } else{ poleis[k][0]= HtmlMethods.removeBreaks(reg_is.string("name")); poleis[k][1] = HtmlMethods.removeBreaks(replaceVariables(reg_is.child("start").content()));//ιδια δομη για ολες τις πολεις poleis[k][2] = HtmlMethods.removeBreaks(replaceVariables(reg_is.child("end").content())); k++; } } </code></pre> <p>In this part I use my XML in order to find the data from a HTML page that I want.</p>
java
[1]
4,246,972
4,246,973
How to run a video hosted on YouTube or a private server in Android?
<p>I have about 3 videos that i cannot install with my app on DROID due to their huge size. Now we have decided to host them on a private server or YouTube. How can i run these videos in Android? Thank you</p>
android
[4]
2,089,356
2,089,357
Get Google Analytics ID with Javascript
<p>I am trying to extract the Google analytics ID from a html document.</p> <p>I found the following function:</p> <pre><code>function get_UA() { txt = document.getElementById('scripttag').value; var matches = txt.match(/(UA-[\d-]+)/); if (matches[1]) { alert(matches[1]); } } </code></pre> <p>But im getting this error:</p> <blockquote> <p>TypeError: 'null' is not an object (evaluating 'document.getElementById('scripttag').value')</p> </blockquote> <p>Any ideas?</p>
javascript
[3]
3,686,673
3,686,674
Jquery Keyup with Contains to hide Span
<p>I am attempting to hide certain elements using the combination of keyup with contains. What I want to do is hide the span elements that do not equal my input values.</p> <p>For instance, if I input the value 1 the spans containing the values 2 and 3 are hidden, leaving only the span containing the 1 visible. I would also want it to show all of the spans if I then deleted the 1 value from the input</p> <p>Here is what I have so far, <a href="http://jsfiddle.net/8TXDM/36/" rel="nofollow">http://jsfiddle.net/8TXDM/36/</a></p>
jquery
[5]
5,779,443
5,779,444
Destruction of class members when destructor is not called
<p>In the following code, when <code>ptr</code> is deleted, the destructor for <code>Base</code> is called, but not the destructor for <code>Derived</code> (due to destructor of <code>Base</code> not being virtual).</p> <pre><code>class Base { int b; }; class Derived : public Base { int d; }; int main(void) { Base * ptr = new Derived(); delete ptr; return 0; } </code></pre> <p>Valgrind reports that the program contains no memory leaks, which i guess is true in the sense that all newed data is deleted in this particular case. <strong>My question is - given that the (default) destructor of <code>Derived</code> is not called, when and how is the memory for <code>d</code> deallocated or reclaimed?</strong></p>
c++
[6]
5,048,484
5,048,485
How to post sdcard image into facebook wall using graph api
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/13740692/how-to-post-image-to-facebook-wall-using-graph-api">How to post image to facebook wall using graph api</a> </p> </blockquote> <p>I am using Graph API to post on Facebook wall.</p> <pre><code>strpostimageurl=/mnt/sdcard/DCIM/mnt/sdcard/DCIM/Camera1354795516555.jpg String res = UrltoValue.getValuefromUrl("https://graph.facebook.com/"+Login.facebookid+"/feed?access_token="+accesstoken+"&amp;method="+"post"+"&amp;message="+"hi"+"&amp;link="+strpostimageurl); </code></pre> <p>I am getting Bad Request as a response.</p> <p>Is it possible to give SD-Card path for Posting images? I am having only Bitmap of the object, so I created file with that Bitmap and I am using that.</p> <p>And I need to post on multiple friends wall,so I am preferring to use Graph API.</p>
android
[4]
3,897,836
3,897,837
Button subclass with Alpha
<p>I'm trying to set the transparency of a button using the API level 10 (so no view.setAlpha). I wrapped the <code>Button.onDraw</code> calling a <code>Canvas.saveLayerAlpha</code> on a subclass: this works with the text but not with the button background.</p> <p>I want to make it possible to leave the current button's background management, should I draw the button background myself without calling <code>super.onDraw</code>? How to get a consistent reference to the current button background inside the <code>onDraw</code> extent?</p>
android
[4]
2,824,774
2,824,775
Read file and add to database
<p>I want to load a .txt file and loop through this to put data in a database.</p> <p>text file format looks like this:</p> <pre> 1231.24314, 112.341234, 34, text 34.13214234, 3455.1234, 11, text </pre> <p>There are hundreds of rows that I want to read out and save each row into a database in the right column</p> <p>database will look something like this:</p> <pre> id, COLUMN1, COLUMN2, column3 </pre> <p>How can I with the help of PHP loop through text file and save it into a database?</p>
php
[2]
690,736
690,737
Capturing events when my application is minimized
<p>I want to develop an Android application in order to capture events (key press, touch, ...). The problem is that when my application is minimized, it cannot capture events. One solution can be using message sent from OS kernel to processes but I do not know how. I will be appreciated if anybody can help me.</p>
android
[4]
1,584,528
1,584,529
How to create a file using content?
<p>After capturing a photo I'm receiving an <code>Intent data</code> from which I'm retrieving an <code>Uri</code>:</p> <pre><code>Uri contentURI = data.getData(); </code></pre> <p>content Uri is <code>content://media/external/images/media/5576</code></p> <p>Using this <code>contentURI</code> I need to save a File to SD card, please advice how. Thank you very much for assistance.</p>
android
[4]
2,185,923
2,185,924
List Line2D.Double
<p>HI everyone ,</p> <p>these two code statements are part of program (I'm currently trying to develop) whose main purpose is to display a waveform during playback of an audio file (.wav).</p> <p>The list lines , it contains <strong>line coordinates</strong> (values of samples in a diagram) ..is that correct?** </p> <p>How would you represent the values stored in lines? And audioBytes ?</p> <pre><code>List&lt;Byte&gt; audioBytes; List&lt;Line2D.Double&gt; lines; </code></pre> <p>thank you Carlos</p>
java
[1]
4,248,446
4,248,447
How do disable the Alt+Tab,Alt+F4,ctr+Alt+Delete butttons from C# program?
<p>I am Using On application I want disable the Alt+Tab,Alt+F4,ctr+Alt+Delete buttons from C# program.and also to disable the right click if the users go at the top and click right it should not come it should not show that menubar also.how to do in web application.</p>
c#
[0]
3,358,555
3,358,556
asp.net dropdown list selected value
<p>For first time when the page loads we are unable to retrieve selected drop down value which consists of page numbers in dropdown list.Here is my dropdown list</p> <pre><code>&lt;asp:DropDownList ID="ddlpagenubers" runat="server" AppendDataBoundItems="true" onselectedindexchanged="ddlpagenubers_SelectedIndexChanged" AutoPostBack="true"&gt; </code></pre> <p>i did a custom paging in a datalist by placing a dropdown consisting of page number to navigate to particular pages</p>
asp.net
[9]
2,939,266
2,939,267
implementing tabs with fragments instead of TabActivity issue
<p>I have used this <a href="http://developer.android.com/reference/android/app/TabActivity.html" rel="nofollow">tutorial</a> to implement tabs with fragments instead of TabActivity and it worked greate for some time I have two tabs with ListFragment. the problem is that suddenly the realTabContent disappeared from the view now I can see TabWidget and change the tab but nothing displayed with no exception and when close the activity with tabs and open again it worked perfectly as expected. Have any one faced this problem? and what may cause this behaviour?</p>
android
[4]
60,706
60,707
readlines not reading the last line of the file in python
<p>I have a code where I am reading all the lines from the file using readlines function and I am further parsing each line in a list. But when I printed the list I saw that the loop is ignoring the last line in the file. When I inserted a blank line in the file then all the contents are read. can you pls tell me why it is doing that</p> <pre><code>def readFile1(file1): f = file1.readlines() cList1 = [] for line in f: if re.findall('\n',line): v = re.sub('\n','',line) cList1.append(v) print cList1 </code></pre> <p>This is printing all the contents except the last line of the file.</p>
python
[7]
2,903,994
2,903,995
php regex form questions
<p>Is it possible to just use this code alone to do two different regex matches?</p> <p>One reg-ex match for X digits and the other for a given string "CAT" only, or do I need to create two different forms, one for each: X digits and one for the string "CAT"? </p> <p>Furthermore is there a better php method for this or I am headed in the right direction?</p> <p>Thank you in advance. </p> <pre><code>&lt;form action ="callself.php" method = "post"&gt; Enter a numeric value: &lt;br/&gt; &lt;input type = "text" name = "number"/&gt; &lt;br /&gt;&lt;br /&gt; &lt;input type = "submit"/&gt; &lt;br /&gt;&lt;br /&gt; &lt;/form&gt; </code></pre> <p>I am a newb(still in the process of learning, thank you in advance for not flaming)</p>
php
[2]
3,933,953
3,933,954
Android - query if a sync account is checked for syncing
<p>How can I query if a sync account is checked for syncing or not?</p>
android
[4]
5,892,144
5,892,145
Why doesn't Java allow to define two methods with the same signature except the generic type parameters?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1998544/method-has-the-same-erasure-as-another-method-in-type">Method has the same erasure as another method in type</a> </p> </blockquote> <p>In one of my classes I wanted to define these two methods:</p> <pre><code>private void add(List&lt;ChangeSet&gt; changeSetList) { for (ChangeSet changeSet : changeSetList) { add(changeSet); } } private void add(List&lt;Change&gt; changeList) { for (Change change : changeList) { add(change); } } </code></pre> <p>Then I get the following error: </p> <pre><code>Method add(List&lt;Change&gt;) has the same erasure add(List&lt;E&gt;) as another method in type DataRetriever </code></pre> <p>Why isn´t this allowed? What is the problem with method definitions like that? And what should I do to avoid it? I don´t want to rename one of the methods.</p>
java
[1]
4,963,013
4,963,014
Stop uninstallation of application
<p>i create an app and install it on phone. now i want to add a feature that my app should not uninstall from the phone. so i think if one of the following issues could be solved</p> <ol> <li>is there anyway to stop the user from uninstall the app? </li> <li>is it possible , if user try to uninstall the app we get a message? </li> <li>is it possible , if user try to uninstall the app it should prompt for a password ? </li> <li>any other way to know that app got uninstalled?</li> </ol> <p>Please guide me in this regard thanks in advance</p>
android
[4]
2,564,717
2,564,718
color of progress bar
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2020882/how-to-change-progress-bars-progress-color-in-android">How to change progress bar&#39;s progress color in Android</a> </p> </blockquote> <p>Hi, I want to change the color of progress bar from yellow to bleu how to do this?</p>
android
[4]
2,542,909
2,542,910
Internal access modifier
<p>I have a 2 classes in a project like this:</p> <pre><code>namespace ConsoleApplication1 { internal class ClassA { internal int dataMember; } } </code></pre> <p>and</p> <pre><code>namespace ConsoleApplication1 { class ClassB { static void Main(string[] args) { ClassA c = new ClassA(); Console.Write(c.dataMember); //Cannot access?? } } } </code></pre> <p>I have used internal access modifier for the class A and its data member</p> <p>Though class A's object can be created within the main of class b, but why I am not able to access its data member with the internal access specifier within the same assembly?</p> <p>Here's the error that it gives in VS 2010:</p> <blockquote> <p>'ConsoleApplication1.ClassA.dataMember' is inaccessible due to its protection level</p> </blockquote>
c#
[0]
1,407,872
1,407,873
Need help on Bar Chart Plot
<p>I need help on plotting the bar chart to show daily based statistics like below attached image<img src="http://i.stack.imgur.com/Zpkc9.png" alt="enter image description here"> shown on iPhone App to android, can you any suggest the corresponding api for this one.</p>
android
[4]
543,675
543,676
asp.net 301 redirect without ms visual studio
<p>I have a website (asp.net c#), dns for 2 domains are pointed to the same server. For one domain website display correct, but for second one, it shows IIS7 splash page...</p> <p>www.mydomain.com - works fine www.mydomain.co.uk - IIS7 splas page</p> <p>How to make 301 redirect so i could point not working domain to working domain or add second domain to website settings to display website content.</p> <p>I don't have MS Visual Studio, i'm using other editor to edit files, so which file i need to edit?</p>
asp.net
[9]
1,346,398
1,346,399
java standalone app
<p>i am writing a standalone java app. the app's properties should be configurable from a webpage deployed with the app. how do i achieve this ?</p> <p>Thanks in advance</p> <p>note: the app has an embedded HTTP client/server module. it should only run from command prompt</p>
java
[1]
599,869
599,870
What is the difference between the wording of the first and second written
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/9006553/slice-or-array-prototype-slice">[].slice or Array.prototype.slice</a> </p> </blockquote> <p>the first</p> <pre><code>(function() { var slice = Array.prototype.slice, aArguments = slice.apply(arguments); })(10, 20, 30); </code></pre> <p>the second</p> <pre><code>(function() { var aArguments = [].slice.apply(arguments); })(10, 20, 30); </code></pre> <p>what's the difference?</p> <p>only ​​Speed?</p>
javascript
[3]
2,098,132
2,098,133
How to reload img every 5 second using javascript?
<p>How to reload img every 5 second using javascript ?</p> <pre><code>&lt;img src="screen.jpg" alt="" /&gt; </code></pre>
javascript
[3]
773,144
773,145
Python: Extracting numbers from result
<p>I was working on a python script to automatically extract ratings from imdb, only I am unable to extract the numbers from my result.</p> <pre><code>from pattern.web import URL from pattern.web import plaintext from pattern.web import decode_utf8 import re def scrape_imdb(film): url = URL (film) s=url.download() decode_utf8(url.download(s)) regels=re.compile(('"ratingValue"&gt;[0-9].[0-9]')) rating= regels.findall(s) rating2= rating[0:1] rating3= rating2.findall("[0-9"]) regels2=re.compile ("&lt;title&gt;.*&lt;/title&gt;") titel=regels2.findall(s) print titel, rating2 </code></pre> <p>But this gives me an error. Anyone know what I'm doing wrong?</p>
python
[7]
164,064
164,065
save user settings
<p>Why do not you want to keep the camera zoom after leaving aktivity?</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.menu_old); SharedPreferences preferences = getSharedPreferences("goodnight", MODE_PRIVATE); yourCheckBox = (CheckBox) findViewById( R.id.fonarb ); yourCheckBox.setChecked(preferences.getBoolean("lol", false)); yourCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton yourCheckBox, boolean isChecked) { if (isChecked){ Parameters params = camera.getParameters(); params.setZoom(5); camera.setParameters(params); } else { Parameters params = camera.getParameters(); params.setZoom(0); camera.setParameters(params); } } }); public void onStop() { super.onStop(); SharedPreferences settings = getSharedPreferences("goodnight", MODE_PRIVATE); SharedPreferences.Editor editor = settings.edit(); editor.putBoolean("lol", yourCheckBox.isChecked()); editor.commit(); } </code></pre>
android
[4]