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,006,316
4,006,317
Calling a class and returning data?
<p>I'm a bit of a newbie, so some help here would greatly be appreciated. I have a class called Device which gets a devices screen size:</p> <pre><code>int Device::GetDisplay() { DisplayInfo display; int displayArray [2]; displayArray[0] = display.pixelSize().width(); displayHeight[1] = display.pixelSize().height(); return displayArray; } </code></pre> <p>It returns an array, is there a better way to return the data?</p> <p>Also is there a better way to call the class, It's currently called via:</p> <pre><code>Device *device = new Device(); device.GetDisplay(); </code></pre> <p>Could I call it without using Device <code>*device = new Device();</code></p> <p>Thanks!</p>
c++
[6]
8,137
8,138
Android chromium disk_cache error : Corrupt Index file
<p>I am just trying to do a -</p> <pre><code>webView.loadUrl("http://www.google.com"); </code></pre> <p>But I get blank page with the following error in the log-</p> <blockquote> <p>07-05 17:20:30.623: E/chromium(1243): external/chromium/net/disk_cache/backend_impl.cc:2022: [0705/172030:ERROR:backend_impl.cc(2022)] Corrupt Index file</p> </blockquote>
android
[4]
4,820,313
4,820,314
when I use global scope variable without 'var', its showing me Error. why?
<p>See my example code below</p> <pre><code>&lt;script&gt; alert(a); // undefined alert(b); // It is Error, b is not defined. var a=1; b=10; &lt;/script&gt; </code></pre> <p>When both variable a and b are in global scope, why I am getting error message for b. But there is no error message for variable a ? what is the reason ?</p> <p>can anyone please explain me ?</p>
javascript
[3]
720,515
720,516
hiding a div when the mouse is a certain distance away from that div
<p>I have a div on a page which is toggled by an item in a navigation bar. What I'd like to do is have that div hide when the user's mouse gets a certain distance away from the div's outer boundry.</p> <p>Here's some example code:</p> <pre><code>&lt;ul&gt; &lt;li&gt;This is link A&lt;/li&gt; &lt;li&gt;This is link C&lt;/li&gt; &lt;li id="trigger"&gt;This is link D&lt;/li&gt; &lt;/ul&gt; &lt;div id="megaMenu"&gt;This is where the menu content goes&lt;/div&gt; </code></pre> <p>So, when the user mouses over the li#trigger, the mega menu slides down. What I'd like to do is have the #megaMenu slide up when the user's mouse is 50px outside the bounds of the div. Any suggestions?? </p> <p>Here's the core jQuery I was using:</p> <pre><code>$(document).ready(function(){ $('li#locations a').hover(function(){ $('#locationsSuperNav').slideDown(); }); $('.superNavClose').hover(function(){ $('#locationsSuperNav').slideUp('fast').removeClass("open"); }); }); </code></pre> <p>The second piece of the code (.superNavClose) was an attempt at putting a hot spot around the menu to close it when the user's mouse hits it. There are a bunch of links inside the mega menu so I need to keep it open while the user is working with it. I was thinking that closing the div when the mouse is a certain distance away would work pretty good. Thanks in advance for any suggestions!</p>
jquery
[5]
5,399,267
5,399,268
Difference between "==" and "===" in java script
<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 &ldquo;equal&rdquo; operator I use?</a> </p> </blockquote> <p>Hi I am not clear why there are two <code>==</code> and <code>===</code> comparator operators in java script.</p>
javascript
[3]
144,942
144,943
Getting list element's Attribute
<p>I have two list. List1 contain objects and each object has node1 property. List2 contain lists of node which are the properties of objects stored in list1.</p> <p>I want to create separate list which contain list of objects whose node present in list2. I want to create this list without using for loop because my object list is large so code takes long time to run if I use for loop.</p> <p>How can I achieve this in python? </p>
python
[7]
3,715,154
3,715,155
Filtering or sorting causes page to reload
<p>Applying sorting or filters on the ASPXGridview causes the page to refresh. How can I prevent this? This is kind of annoying to the users. The enablecallback property for the ASPXGrid is set to false.(I want it to be false). Also that causes all the user selection to go away(checkboxes,radiobutton defaults to the original)</p>
asp.net
[9]
1,371,246
1,371,247
$_SERVER['REQUEST_URI'] doesn't work when #text at the end of url
<p>I know $_SERVER['REQUEST_URI'] works in getting the current page's url, but it leaves out the #post at the end of the url. I like to use the #blah at the end to make the page scroll to a certain point. Example:</p> <pre><code>index.php#answer </code></pre> <p>using $_SERVER['REQUEST_URI'] just returns:</p> <pre><code>index.php </code></pre> <p>How can I make it read the #answer at the end as well?</p>
php
[2]
1,192,145
1,192,146
Retrieve action layout from ActionBar, inside fragment
<p>How do I retrieve a action layout for an item inside the ActionBar, from a Fragment. I have tried to access the layout directly via getActivity().findViewById, and via getActivity().findViewById(MenuItem).findViewById(ActionLayout).</p> <pre><code>@Override public void onViewCreated(View view, Bundle savedInstanceState) { MenuItem commentMenuItem = (MenuItem) getActivity().findViewById(R.id.menu_item_comment); View actionView = commentMenuItem.getActionView(); TextView commentTextView = (TextView) actionView.findViewById(R.id.action_bar_comment_item_textview); commentTextView.setText(article.getArticle_comment_count()); } </code></pre>
android
[4]
1,187,152
1,187,153
utilities of AdWhirl over other ads Network
<p>Can anyone tell me what are the advantages of using Adwhirl in comparism to AdMob,Millenial,Google AdSense for Mobile Applications,ZestADZ.Is there any disadvantage if i use AdMob or ZestADZ instead of AdWhirl...</p> <p>with regards Anshuman</p>
android
[4]
3,709,360
3,709,361
Click Event not working in windows mobile 6.0 application
<p>I am currently doing a project on windows mobile application 6.0 all the application was working fill till i add a .dll file now it shows the error as shown below <img src="http://i.stack.imgur.com/izy4x.png" alt="enter image description here"></p> <p>The events are not working after adding that dll</p>
c#
[0]
2,753,132
2,753,133
making vars for elements not yet created
<p>I am trying to create a var for a dom element to clean things up but it doesn't give me expected results. The reason I think it's doing this is because the element isn't yet created when I run the function. I could move the var after the .prepend() is called but what if I'd like to keep all my vars at the top?</p> <p>Would adding .on() somewhere in this script fix my problem or should I just move the var down a few lines after .prepend is run, and forget about keeping vars up top?</p> <pre><code> (function () { var cp = $(".call-out p") $('li').eq(2).prepend('hi'); $('div.call-out').prepend("&lt;p&gt;MY UL&lt;/p&gt;"); cp.css({ 'font-size': '3em', 'background': 'orange' }); cp.animate({ width: "1000px", height: "1250px" }); cp.click(function (e) { $(this).animate({ width: "125px", height: "90px" }); }); })(); </code></pre>
jquery
[5]
3,991,231
3,991,232
How to implement a Required Property in Python
<p>If I have a class such as below (only with many more properties), is there are clean way to note which fields are required before calling a particular method?</p> <pre><code>class Example(): def __init__(self): pass @property """Have to use property methods to have docstrings...""" def prop1(self): return self._prop1 @prop1.setter def task(self, value): # validation logic.. self._prop1 = value def method(self): # check all required properties have been added </code></pre> <p>I could write an array by hand of all required propeties and loop through them in a method, but I was wondering if there is a cleaner way for example by implementing a @requiredProperty descriptor. </p> <p>The class is used to generate a POST request for a web API. The request has 25+ parameters, some of which are required and some optional. </p> <p>Rather than on the method calling the request having to loop through an array such as:</p> <pre><code>required_props = ['prop1','prop2',....] </code></pre> <p>I was hoping there was a way in Python of adding a required decorator to properties so I wouldn't have to keep track by hand. E.g.</p> <pre><code> @property, @required def prop1(self): return self._prop1 </code></pre>
python
[7]
1,386,473
1,386,474
Why is main() in java void?
<p>In the case of languages with a C-like syntax, we declare the main() method to return an int or float value (or void). Is it possible to declare a non-void return type from main() in Java? If not, then why not? Does this mean that a Java program doesn't return any value to the OS?</p>
java
[1]
3,550,355
3,550,356
A property exists in the parent class, but can't be used from the child class
<p>EDIT: SOLVED!</p> <p>I have been working on my own framework lately. I have a controller class like this:</p> <pre><code>class Controller { private $model; public function __construct() { global $bean_db, $mv_name; if (file_exists(APP_PATH . 'models/' . $mv_name . '.php')) { require APP_PATH . 'models/' . $mv_name . '.php'; $model_name = $mv_name . '_Model'; $model = new $model_name; $this-&gt;model = $model; } } } </code></pre> <p>Now, in a specific controller file, I have code like this:</p> <pre><code>class Start_Controller extends Controller { function execute() { $this-&gt;model-&gt;exec("SET NAMES 'utf8'"); } } </code></pre> <p>As you may or may not expect, that did not work. I get an error message that the property named "model" does not exist. Can anyone help me solve this?</p>
php
[2]
2,464,017
2,464,018
How to read "Builder Number" from "About Phone" settings in android?
<p>I'm trying to read which ROM the user is using from my app.</p> <p>It seems that this info can be seen in the phone's settings, in the About Phone setting under "Build Number".</p> <p>How can I read this info with code?</p> <p>Couldn't see it with <code>android.os.Build class</code>..</p> <p>Thanks.</p>
android
[4]
2,943,564
2,943,565
URLEncoder.encode() and a whitespace?
<p>I've got a resource on my server named:</p> <pre><code>some image.png </code></pre> <p>There's a space in the name. When I type the url into the browser (chrome), it's transforming the space into %20:</p> <pre><code>some%20.png </code></pre> <p>WHen I use URLEncoder.encode("some image.png") from my application, I'm getting:</p> <pre><code>some+image.png </code></pre> <p>which causes a 404. What's the right way to encode?</p> <p>Thanks</p>
java
[1]
3,965,645
3,965,646
Encryption message in java
<p>i am a project about using java's bouncycastle to do the encryption.</p> <p>However, when I encrypt the message, it throws an exception for me.</p> <p>javax.crypto.IllegalBlockSizeException: data not block size aligned</p> <p>I am using Blowfish/ECB/NoPadding, and the message is an xml.</p> <pre><code>public static void main(String args[]){ String message = "&lt;abc&gt;ABCDEFG&lt;/abc&gt;"; String key = "key"; byte[] b = encrypt(message.getBytes(), key.getBytes()); } public byte[] encrypt(byte encrypt[], byte en_key[]) { try { SecretKeySpec key = new SecretKeySpec(en_key, "Blowfish"); Cipher cipher = Cipher.getInstance("Blowfish/ECB/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, en_key); return cipher.doFinal(encrypt); } catch (Exception e) { e.printStackTrace(); return null; } } </code></pre> <p>Could anyone can help me?</p> <p>Thank you</p>
java
[1]
1,474,657
1,474,658
Check If Word Is In A String errors
<p>Using the following from <a href="http://stackoverflow.com/questions/5319922/python-check-if-word-is-in-a-string">Python - Check If Word Is In A String</a></p> <pre><code>&gt;&gt;&gt; def findWholeWord(w): ... return re.compile(r'\b({0})\b'.format(w), flags=re.IGNORECASE).search ... &gt;&gt;&gt; findWholeWord('seek')('those who seek shall find') &lt;_sre.SRE_Match object at 0x22c1828&gt; &gt;&gt;&gt; findWholeWord('seek') &lt;built-in method search of _sre.SRE_Pattern object at 0x22b8190&gt; &gt;&gt;&gt; findWholeWord('seek')('those who seek shall find') &lt;_sre.SRE_Match object at 0x22c1828&gt; &gt;&gt;&gt; findWholeWord('seek')('those who shall find') </code></pre> <p>Is this an error or this should be the result?</p> <pre><code>&lt;_sre.SRE_Match object at 0x22c1828&gt; </code></pre>
python
[7]
5,868,583
5,868,584
where we get the source of K9 email client for android?
<p>K9 mail client is open source android application. Where can we get the source files ?</p>
android
[4]
2,239,425
2,239,426
page.response - can't set it in asp.net
<p>I generate a PDF document inside a helper method. the helper method returns a HttpResponse object, which is the response containing the generated PDF. But I can't change the page.response to the one the method returned. How shuld I solve this?</p>
asp.net
[9]
3,059,156
3,059,157
how do i obtain system info from my app?
<p>Im making an app for my website, I need to know the system info of whoever installs my app,</p> <p>I have an email.java Activity class, i am wondering if its possible to add the system info as an attachment or on the bottom of whatever's typed,</p> <p>I also have a text.java Activity which id like to do same if possible (not attachment)</p> <p>or someway of me "viewing" the system info when they contact me by email or sms.</p> <p>Long winded question but any pointer would be very helpful.</p> <p>Im learning android everyday at the minute as im wanting to get into programming. so bare this is mind when answering.</p> <p>Thanks</p>
android
[4]
3,625,709
3,625,710
Class extending Application in Android project library?
<p>I have a project (in Eclipse) which I've turned into an Android Project Library so as to re-use some of the code in another similar project. I think I've shot myself in the foot however as I'm getting the error:</p> <pre><code>Unable to start activity ComponentInfo{com.test.scroller1/com.lib.scrolltest.ScrollTestActivity}: java.lang.ClassCastException: android.app.Application cannot be cast to com.lib.scrolltest.resAppVars </code></pre> <p>com.lib.scrolltest is my Project Library which instantiates a class extending Application (resAppVars). In the onCreate() method I call:</p> <pre><code>mRav = (resAppVars) getApplicationContext (); </code></pre> <p>This way, I can use methods in the mRav object which would otherwise be a lot of duplicated code in other classes (such as passing a query to a generic select statement which returns an ArrayList of results).</p> <p>What's the problem here? It seems I've hit a limitation in the way I've implemented the Application class. </p>
android
[4]
4,592,706
4,592,707
Appending data in UITextField programmatically
<p>I am creating a report &amp; printing the same on a UITextView.My report has some titles and there respective subtitles. I am printing 1st title then its subtitle &amp; then second title and its subtitle and so on. I want different font and font sizes for the titles and subtitles. But the problem is the text field always prints the last subtitle.If any one know solution to this problem,let me know.</p> <p>Here is what i have dome in my .m file</p> <pre><code> - (void) printData { // data is UITextView object [data setFont:[UIFont fontWithName:@"Helvetica" size:15]]; NSString *title = @"TITLE" ; data.text = title; [data setFont:[UIFont fontWithName:@"Arial" size:15]]; NSString *subtitle = @"SUBTITLE" ; data.text = subtitle; } </code></pre>
iphone
[8]
4,655,934
4,655,935
how to open new IE window on click of hyperlink
<pre><code>&lt;asp:HyperLink id="hyperlink1" NavigateUrl="&lt;%#Eval('name')%&gt;" Text="&lt;%#Eval('name')%&gt;" Target="_blank" runat="server" /&gt; </code></pre> <p>here the text that i have binded to navigate url can be any url (eg:asp.net,google.com)</p> <p>this is my code when i try to open a new iE window</p> <p><strong>as my file is under an directory admin/abc.aspx</strong></p> <p>now in the url it opens like this: <a href="http://localhost:5655/admin/www.asp.net" rel="nofollow">http://localhost:5655/admin/www.asp.net</a></p> <p><strong>but in the url should be like this www.asp.net so that this website opens</strong></p> <p>any help would be great</p> <p>thank you </p>
asp.net
[9]
3,173,286
3,173,287
Understanding Python Numerology
<p>We can not declare an integer which start with 0.</p> <pre><code>&gt;&gt;&gt; n = 08 SyntaxError: invalid token </code></pre> <p>But we do declare a variable that contains all zeros.</p> <pre><code>&gt;&gt;&gt; n = 00000 &gt;&gt;&gt; print n &gt;&gt;&gt; 0 </code></pre> <p>So the question is in first case why python just not consider value of variable to <code>n = 8</code> by ignoring the zero on left side instead of raising an exception. As in second case it is still considering all zeros to a valid value.</p> <p>Consider another case.</p> <pre><code>&gt;&gt;&gt; n = '0008' &gt;&gt;&gt; print int(n) &gt;&gt;&gt; 8 </code></pre> <p>Now in third case it is still considering it a valid numeric value, why an exception is not raised here??</p>
python
[7]
4,298,089
4,298,090
Python Global File
<p>How can I write to a global file inside of a function?</p> <p>Example:</p> <pre><code>output_file=open("output_file_name.txt", "w") def write_to_file: global output_file output_file.write('something') write_to_file() output_file.close() </code></pre> <p>The code above is not working. It says "ValueError: I/O operation on closed file" Any ideas?</p>
python
[7]
2,202,018
2,202,019
how to control mediaplayer volume
<p>I created a simple application. In my main activity class i use this to play a sound when a button is clicked</p> <pre><code>MediaPlayer buttonSound = MediaPlayer.create(this, R.drawable.button_sound); public void onClick(View arg0){ buttonSound.start(); } </code></pre> <p>In my main activity class i have a service that start a background music</p> <pre><code> Intent svc=new Intent(this, BackgroundSoundService.class); startService(svc); </code></pre> <p>The problem is that I can't handle them (my background music and my button sound) with the volume buttons of my mobile. If i decrease the volume of my mobile, my application volume doesn't change! what should I do?</p>
android
[4]
5,104,938
5,104,939
How can I implement this javascript "Superfast Blur" in my website?
<p>I was looking for a JavaScript code to make my images blurred till I found this good looking script "Superfast Blur"</p> <p><a href="http://www.quasimondo.com/BoxBlurForCanvas/FastBlurDemo.html" rel="nofollow">http://www.quasimondo.com/BoxBlurForCanvas/FastBlurDemo.html</a></p> <p>the problem is I know nothing about JavaScript and the developer didn't say much, he just said</p> <blockquote> <p>Usage: <code>boxBlurImage( sourceImageID, targetCanvasID, radius, blurAlphaChannel, iterations );</code></p> </blockquote> <p>where can I use this code ? I want to target a specific image and change it's blur &amp; iterations.</p> <p>thanks.</p>
javascript
[3]
5,368,972
5,368,973
Character.valueOf
<p>I run this method: </p> <pre><code>String str=Character.valueOf(char).toString() </code></pre> <p>The output comes like a small square at console and just like a bar code in the file. What the actual format of the output is, also the output is not able to copy.</p>
java
[1]
3,911,704
3,911,705
check string for youtube link or image
<p>I have a small piece of code that checks a string for a url and adds the &lt; a href> tag to create a link. I also have it check the string for a youtube link and then add rel="youtube" to the &lt; a> tag. </p> <p>How can I get the code to only add rel to the youtube links?</p> <p>How can I get it to add a different rel to any type of image link?</p> <pre><code>$text = "http://site.com a site www.anothersite.com/ http://www.youtube.com/watch?v=UyxqmghxS6M here is another site"; $linkstring = preg_replace( '/(http|ftp)+(s)?:(\/\/)((\w|\.)+)(\/)?(\S+)?/i', '&lt;a href="\0"&gt;\4&lt;/a&gt;', $text ); if(preg_match('/http:\/\/www\.youtube\.com\/watch\?v=[^&amp;]+/', $linkstring, $vresult)) { $linkstring = preg_replace( '/(http|ftp)+(s)?:(\/\/)((\w|\.)+)(\/)?(\S+)?/i', '&lt;a rel="youtube" href="\0"&gt;\4&lt;/a&gt;', $text ); $type= 'youtube'; } else { $type = 'none'; } echo $text; echo $linkstring, "&lt;br /&gt;"; echo $type, "&lt;br /&gt;"; </code></pre>
php
[2]
1,057,788
1,057,789
how to connect sqlite to an android application?
<p>I am trying to connect my android application to sqlite, i dont knw how to configure SD card in emulator to have a database... can anyone help me please?</p>
android
[4]
5,321,831
5,321,832
Scrolling up and down with HTML page in android
<p>I had put an question in StackOverflow yesterday but could not get the answer. I am attaching the url for the same <a href="http://stackoverflow.com/questions/8790080/scrolling-with-static-html-page-not-working-saved-in-assets-folder-in-android">Question link</a> looking for the answer. I am using WebView to render the page and cannot scroll up and down with the html saved in asset folder. Runs perfectly in emulator but in device I cannot scroll.</p> <p>Looking forward to your reply. thanks.</p>
android
[4]
1,820,168
1,820,169
How to use readlines to read from file and return the abbreviation of item
<p>file looks like this:</p> <pre><code>BURGER KING BRG MCDONALDS MCDNLDS WENDYS WNDY </code></pre> <p>Example:</p> <pre><code>food('abbreviations.txt') Enter a fast food place: McDonalds Abbreviation: MCDNLDS Enter a fast food place: Thank you! </code></pre> <p>so far:</p> <pre><code>infile = open(filename, 'r') l = infile.readlines() infile.close() </code></pre> <p>but I don't know what to do after readlines</p>
python
[7]
2,339,481
2,339,482
How to refactor the C++ code to support the dynamic array size
<p>I need to get rid of fixed array size in C++/ODBC apps. Instead the hardcoded array size (ROWS =10 below) I want to pass the ROWS as the command-line argument. I know how to parse the command line. But how to adjust the following code?</p> <pre> #define ROWS 10 SQLINTEGER idata[ROWS] SQLCHAR cdata1[ROWS][256] SQLFLOAT fdata[ROWS] SQL_TIMESTAMP_STRUCT ts[ROWS] SQLSetStmtAttr(SQL_ATTR_ROW_ARRAY_SIZE, ROWS) SQLBindCol(1, &idata) SQLBindCol(2, cdata1) SQLBindCol(3, fdata) SQLBindCol(4, &ts) SQLExecDirect("query producing a result-set") </pre> <p>Update: I cannot modify the signature of SQLBindCol(..) </p> <p>Let say I will create std::vector instead of SQLFLOAT fdata[ROWS] but how to pass it into SQLBindCol() which does not expect std::vector? </p>
c++
[6]
969,942
969,943
Any good freeware advanced ASP.NET grid control available on the web?
<p>Was just wondering if there were any good free advanced asp.net grid controls that are available for use on the web? I know a few but they are payable and only have free trial versions e.g Telerik Radgrid controls or obout suite. </p>
asp.net
[9]
1,544,818
1,544,819
Could a service bind another service
<p>I just want to know could I bind a service from another service. For example, currently I have an <code>activity A</code> starting a <code>service B</code> and now I just want <code>service B</code> to bind and start another <code>service C</code>. So does anybody know how to do that? That means could I use the same method for <code>activity A</code> to start a service on a service to start another service?</p>
android
[4]
2,456,328
2,456,329
malloc: *** error for object 0x1001002e0: pointer being freed was not allocated
<p>please help me I am running the code of api microtik, but I have this error</p> <pre><code> malloc: *** error for object 0x1001002e0: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug </code></pre> <p>any body could help me?</p>
c++
[6]
745,033
745,034
Only top corners rounded in <shape>
<p>I am trying to have the top corners of a shape rounded and the bottom just straight, but I'm having a problem with my shape it's saving </p> <blockquote> <p>error! UnsupportedOperationException: null</p> </blockquote> <p>When I have </p> <pre><code>&lt;corners android:radius="10dp" android:bottomRightRadius="0dp" android:bottomLeftRadius="0dp" android:topRightRadius="10dp" android:topLeftRadius="10dp" /&gt; </code></pre> <p></p> <p>I have tried putting 1dp in the bottom corners and taking out the android:radius="10dp", but still gives me an error.</p> <p>Android 2.2 with Eclipse</p> <p>Can any one help me?</p>
android
[4]
1,253,228
1,253,229
Is it possible to chain multiple events with one function in jQuery
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/451795/jquery-event-chaining">Jquery event chaining</a> </p> </blockquote> <p>Traditionally we may write:</p> <pre><code> $("selector").click(function () { }); </code></pre> <p>but is it possible to chain events, something like so:</p> <pre><code> $("selector").click,keyup,keydown(function () { }); </code></pre> <p>I'm aware of the fact that I could write a function and reference that function in three seperate handlers, but this would be cleaner.</p>
jquery
[5]
5,197,880
5,197,881
Align include images to base when using to Html.fromText
<p>I have a code like this.</p> <pre><code>Button b = findViewById(R.id.button); mImgGetter = new MiniImageGetter(this); b.setText(Html.fromText("&lt;img src=\"foo\"&gt; FOO!"),mImgGetter,null) </code></pre> <p>where MiniImageGetter is a class like:</p> <pre><code>class MiniImageGetter implements ImageGetter { private Context mContext; public MiniImageGetter(Context c) { mContext =c; } @Override public Drawable getDrawable(String source) { Drawable d = mContext.getResources().getDrawableR.drawable.foo); d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); return d; } } </code></pre> <p>But the images are all aligned to the bottom of the Button text and not to baseline of the text.</p>
android
[4]
916,990
916,991
Error starting executable, no provisioned ios device is connected
<p>Why am I seeing this error? Is it looking for my real iphone device to be connected to install it on their?</p> <p>I just downloaded the views sample code from: <a href="http://www.sunsetlakesoftware.com/sites/default/files/Fall2010CourseNotes/views%20and%20controllers.html" rel="nofollow">http://www.sunsetlakesoftware.com/sites/default/files/Fall2010CourseNotes/views%20and%20controllers.html</a></p>
iphone
[8]
4,432,090
4,432,091
page expired message in php script
<p>i am working on an e-commerce website using php. i have tried post/get and now session but problem is persisting. when i hit back button it display message page has expired. i thought may be i am not handlling session variables proparly but i dont know what to do ? what could be cause ans what could be solution .</p>
php
[2]
947,358
947,359
what is the problem with android while downloading? can any one figure out?
<p>The following link downloads a file from a site.it works fine in desktop browser. but it is not working in android default browser and in webview code(i used download listener too but not working).</p>
android
[4]
2,515,499
2,515,500
Create top ten list of items in php
<p>I would like to create an app where my users can create their top ten movies assigning values from 1 to 10. Each user will be able to choose from my movies data table. For examle my data contains 100 movies and each user can give values (1 to 10) to 10 of them.</p>
php
[2]
805,352
805,353
What is the best method to retrieve the value of "Sum = ####" from List View using jQuery?
<p>Here's a little challenge for you SharePoint and jQuery experts. I have an out of the box list view in MOSS where I total one of the columns as a "Sum" so that at the very top of my list I have "Sum = #####". </p> <p>What I want to know is the most efficient script that would be to pull the text "Sum = ###,###" out of this list view so I can do something else with the value. </p> <p>I wrote a script that works, and works well, but I have a feeling there is a cleaner approach. What I do is:</p> <p>1) use the web part ID to get the HTML of the web part containing the sum 2) use JavaScript substring method to find and pull out "Sum = ###,###". </p> <p>Like I said, it works, but it's not elegant. </p> <p>Other ideas?</p>
jquery
[5]
2,486,474
2,486,475
jQuery on() method not working for appended elements
<p>I know I should use on() method for triggering appended elements and not use click(), so:</p> <pre><code>$('#change_profile_img').on('click', function(){ alert(1); }); </code></pre> <p>so the above code is working fine on any elements unless the appended elements, for example, I'm appending:</p> <pre><code>$('.companylogo:first').append('&lt;a id="change_profile_img" class="ic_change"&gt;CHANGE IMAGE&lt;/a&gt;'); </code></pre> <p>after it's appended, it's not working, but after a page refresh it works just fine. Another thing that I should mention, I'm doing the append from a modal page, it appends the button and everything but I could not trigger it anymore...</p> <p>I would appreciate any kind of help. Thanks</p>
jquery
[5]
1,945,612
1,945,613
accessing serverside code from client program
<p>How can I access server side functions from the HTML code? See the following code:</p> <pre><code>&lt;a id="Taggloud" runat="server" class="lblTagCloud" onClick="TagOnCloud_Click"&gt;click&lt;/a&gt; </code></pre> <p>Here I'm calling the <code>tagonCloud_click</code> function that's defined in server side(code behind). How can i call that function?</p>
asp.net
[9]
318,809
318,810
How to load images from server properly?
<p>I have a code below, this code works perfectly fine when you are trying to load one or two images. However, the problem is, when you have a lot of images in one Activity, all images must load first before you can get in. My question is, what is the best way to handle this images? I want the images to load one by one and not simultaneously. I want it to load just like the ListView made by Fedor "http://stackoverflow.com/questions/541966/android-how-do-i-do-a-lazy-load-of-images-in-listview" (Note: I'm not using a ListView, I just want my images to load like that). Please help me, I would really appreciate it a lot. Thanks in advance!</p> <pre><code> class ImageDownlaodThread extends Thread { ImageDownloadMessageHandler imageDownloadMessageHandler; String imageUrl; @Override public void run() { Drawable drawable = LoadImageFromWebOperations(imageUrl); Message message = imageDownloadMessageHandler.obtainMessage(1, drawable); System.out.println("Message sent"); } } class ImageDownloadMessageHandler extends Handler { View imageTextView; } @Override public void handleMessage(Message message) { progressBar.setVisibility(View.GONE); imageTextView.setVisibility(View.VISIBLE); } } Drawable LoadImageFromWebOperations(String url) { Drawable d = null; InputStream is = null; try { } catch (IOException e) { e.printStackTrace(); } return d; } </code></pre>
android
[4]
4,606,358
4,606,359
Android imagebutton does not flash on click
<p>I've implemented an ImageButton. All works well except when I press on it, it doesn't "flash" before moving on (to another activity). Does Android has intrinsic "flash" for ImageButton or I have to write/animate that explicitly inside onClickEvent? or use Selector? </p> <p>Thanks in advance for all your help.</p>
android
[4]
5,060,085
5,060,086
Function that takes a string as input and counts the number of times the vowel occurs in the string
<p>So I am very new to python and am in the process of learning the basics. I am trying to create a function the counts the number of vowels in a string and returns how many times each vowel occurs in the string. For example if I gave it this input, this is what it would print out.</p> <pre><code> &gt;&gt;&gt;countVowels('Le Tour de France') a, e, i, o, and u appear, respectively, 1,3,0,1,1 times. </code></pre> <p>I made this helper function to use, but then I'm not exactly sure how to use it.</p> <pre><code>def find_vowels(sentence): count = 0 vowels = "aeiuoAEIOU" for letter in sentence: if letter in vowels: count += 1 print count </code></pre> <p>And then I thought that maybe I could use formatting to get them in the write places, but I am not sure the notation that would be used for example, one of the lines for the function could be: </p> <pre><code> 'a, , i, o, and u appear, respectively, {(count1)}, {(count2)}, {(count3)}, {(count4)}, {(count5)} times' </code></pre> <p>I am not sure how I would be able to fit the above in the function.</p>
python
[7]
5,095,525
5,095,526
Python - Getting all links from a div having a class
<p>I am using BeautifulSoup to get all links of mobile phones from this url <a href="http://www.gsmarena.com/samsung-phones-f-9-0-p2.php" rel="nofollow">http://www.gsmarena.com/samsung-phones-f-9-0-p2.php</a></p> <p>My code for the following is :</p> <pre><code>import urllib2 from BeautifulSoup import BeautifulSoup url = "http://www.gsmarena.com/samsung-phones-f-9-0-p2.php" text = urllib2.urlopen(url).read(); soup = BeautifulSoup(text); data = soup.findAll('div',attrs={'class':'makers'}); for i in data: print "http://www.gsmarena.com/" + i.ul.li.a['href']; </code></pre> <p>But the returned list of urls is shorter than the expected output when i checked, this code outputs 3 values but the result should show much over 10 values</p>
python
[7]
2,928,099
2,928,100
Android equivalent to applicationDidBecomeActive and applicationWillResignActive(from iOS)
<p>I hope it exists.</p> <p>I would like to store the time when the application loses focus and then check if it has lost focus for more than n-minutes to bring up a lock.</p> <p>Seeing how an application is composed of activities, I think there will not be a direct equivalent. How would I be able to achieve similar results?</p> <p>EDIT<br> I tried to extend the Application class to <code>registerActivityLifecycleCallbacks()</code> and realized I will not be able to use this approach because it is only available in API Level 14+</p>
android
[4]
1,745,726
1,745,727
How can extract images from pdf file using itext library in my android application
<p>I want to extract images from pdf file using itext library where i put my pdf files in asset folder on android application and display these images in android using itext library.</p>
android
[4]
2,170,753
2,170,754
Can The Application Icon in the Built In Search Dialog Be Clickable?
<p>Is there anyway to capture when the user clicks on the application icon in the built in search dialog? Please note I am NOT referring to a custom dialog but to android built in search dialog.</p>
android
[4]
4,248,065
4,248,066
Assign a hidden field value on default.aspx using BasePage Class methods
<p>Is that possible? The reason why am doing this is because I need to parse that variable into a an JQuery function so I wanted JQuery to read that field. Can I Assign that value in base class or I have to do it within default.aspx pageload method?</p>
asp.net
[9]
2,908,801
2,908,802
PHP: still work even if not isset
<p>HTML new_password:</p> <pre><code> &lt;input name="new_password" type="password" maxlength="25" id="new_password" class="ModuleTextbox" onkeyup="var regex = new RegExp(/^.*(?=.{6,})(?=.*\d)(?=.*[aA-zZ@!¤&amp;amp;/()_?,.-]).*$/m); if(regex.test(this.value)) { pwok.style.visibility = 'visible'; } else { pwok.style.visibility = 'hidden'; }" style="width:200px;" /&gt;&amp;nbsp;&lt;img id="pwok" src="ok.png" alt="R" style="visibility: hidden;" /&gt; </code></pre> <p>php after submit form:</p> <pre><code>foreach($_POST as $key =&gt; $value) { $data[$key] = filter($value); } $pw_new = $data["new_password"]; if(isset($pw_new)) { echo "LOL"; } </code></pre> <p>even if i didnt write anything in the field, it echo's LOL, why's that?</p>
php
[2]
2,417,390
2,417,391
What attributes are not stored in __dict__ and why are they not?
<p>In Python, a lot of the "special" attributes of objects are stored in the <code>__dict__</code> dictionary, like <code>__doc__</code>, <code>__module__</code> (from what I could see in my experiments).</p> <p>However some are not, like <code>__class__</code>. My question is exactly which attributes are not stored in <code>__dict__</code> (is that even documented somewhere?), and why are they not?</p>
python
[7]
2,960,367
2,960,368
Should displaying an unsigned char* & an signed char* output exactly the same result
<p>I am unsure if I am correctly translating/converting a unsigned char* to a regular signed char*?</p> <p>The unsigned char* is a string that has been hashed. Does the following code correctly convert an unsigned char* to signed char*?</p> <pre><code>std::string message = "to be encrypted"; unsigned char hashMessage[SHA256_DIGEST_SIZE]; SHA256::getInstance()-&gt;digest( message, hashMessage ); // is this conversion correct char* hashMessageSigned = reinterpret_cast&lt;char*&gt;(hashMessage); printf("Unsigned Char Hash: %s\n", hashMessageSigned); // The 2 printf's print out exactly the same strings is that correct? printf("Signed Char Hash: %s\n", hashMessage); </code></pre>
c++
[6]
2,520,979
2,520,980
Remove one option from dropdown based on the option selected in the before dropdown list
<p>Here is my HTML Code. </p> <pre><code> &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;select class="dropdown"&gt; &lt;option value=""&gt;Select answer&lt;/option&gt; &lt;option value="1" selected="selected"&gt;A&lt;/option&gt; &lt;option value="2"&gt;B&lt;/option&gt; &lt;option value="3"&gt;C&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;td&gt; &lt;select class="dropdown"&gt; &lt;option value=""&gt;Select answer&lt;/option&gt; &lt;option value="1" &gt;Yes&lt;/option&gt; &lt;option value="2"&gt;No&lt;/option&gt; &lt;option value="3"&gt;N.A.&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;/tr&gt; &lt;td&gt; &lt;select class="dropdown"&gt; &lt;option value=""&gt;Select answer&lt;/option&gt; &lt;option value="1" &gt;Yes&lt;/option&gt; &lt;option value="2"&gt;No&lt;/option&gt; &lt;option value="3"&gt;N.A.&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;/table&gt; </code></pre> <p>Here is my jquery code. </p> <pre><code> $('TABLE TR').find('select:first').each(function() { if($(this).find("option:selected").text()=="A") { $(this).next("select").find("option[value='Yes']").remove(); } }); </code></pre> <p>I want to remove the immediate next drop down value based on the value of first dropdown box. Please someone help..</p>
jquery
[5]
1,589,189
1,589,190
Parsing plain text that contains custom conditionals
<p>I presume this is a weird sort of thing that I'm looking for.</p> <p>I have the following text string:</p> <pre><code>$string = "The compass is pointing &lt;north|south|east|west&gt; towards &lt;London|Paris|Rome&gt;"; </code></pre> <p>Somehow I want to parse this to obtain any of the following outputs:</p> <ul> <li>The compass is pointing north towards Paris</li> <li>The compass is pointing south towards London</li> <li>The compass is pointing east towards Rome</li> <li>The compass is pointing east towards London</li> <li>Etc.</li> </ul> <p>For each set of &lt; > in the text string I need to convert the contents into an array (using <code>explode("|",$string)</code>?), then run <code>array_rand</code> on that array to get the key for the option we will display, then just read the array and return that value.</p> <p>The problem is, I have very next to no experience with text parsing, but I'd guess you'd use <code>preg_replace</code> in this type of problem.</p> <p>I'd appreciate if anyone could help me get started.</p>
php
[2]
5,379,629
5,379,630
getElementsByTagName: How to select more than one type of tag?
<p>I have a for loop inside which I check to see if the current element being iterated has any <code>a</code> tags or <code>form</code> tags inside of it and if so I do some stuff to them. Anyway I can check either or like so:</p> <pre><code>var form_or_a_tag = elem[i].getElementsByTagName('a'); var form_or_a_tag = elem[i].getElementsByTagName('form'); </code></pre> <p>But how can I combine them?</p> <p>these all fail:</p> <pre><code>var form_or_a_tag = elem[i].getElementsByTagName('a form'); var form_or_a_tag = elem[i].getElementsByTagName('a, form'); var form_or_a_tag = elem[i].getElementsByTagName('a') || elem[i].getElementsByTagName('form'); </code></pre> <p>Basically I would like to store in the variable <code>form_or_a_tag</code> all <code>form</code> or <code>a</code> tags that reside in the element currently being iterated.</p>
javascript
[3]
2,260,006
2,260,007
Creating blurring effect on both sides of ViewPagerIndicator
<p>I realize, for Google Play market, they have "blurring" effect on left right (See "Paid" on left, and "Trend" on right, as in attachment)</p> <p>I was wondering, is it possible to achieve such effect using <a href="https://github.com/JakeWharton/Android-ViewPagerIndicator/" rel="nofollow">ViewPagerIndicator</a>? As from the demo I saw, we can customize various indicators (from line to triangle). But I haven't seen an example, which create "blurring" effect on left right side.</p> <p><img src="http://i.stack.imgur.com/bzQKr.png" alt="enter image description here"></p>
android
[4]
5,772,037
5,772,038
Why does C# Math.Floor() return Double instead of Int
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1348892/why-does-math-floordouble-return-a-value-of-type-double">Why does Math.Floor(Double) return a value of type Double?</a> </p> </blockquote> <p>Why does C# <code>Math.Floor()</code> return <code>double</code> instead of <code>int</code></p> <p>From the MSDN Docs:</p> <blockquote> <p>Returns the largest <strong><em>integer</em></strong> less than or equal to the specified double-precision floating-point number</p> </blockquote> <p>it says it returns an integer. Its ok to return a <code>double</code>, I can always cast it to an <code>int</code> but its just quite strange, isn't it? </p>
c#
[0]
3,896,995
3,896,996
Is it safe to change application properties?
<p>I see that my application has the wrong name.</p> <p>When I go to:</p> <p>Project -> Application properties...</p> <p>I see an <code>Assembly name</code> and a <code>default namespace</code>.</p> <p>Is it safe to just change these two to the values which would better represent my app or will it break something?</p>
c#
[0]
231,380
231,381
Frontcontroller help
<pre><code>RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ /index.php [NC,L] </code></pre> <p>php</p> <pre><code>&lt;?php $pagesDir = "pages"; // Get the request $page = $_SERVER['REQUEST_URI']; // Strip the first slash $page = substr($page, 1); // Prevent access to higher level folders $page = str_replace('..', '', $page); // Do some mapping to actual files in a subfolder $page = "$pagesDir/$page"; // Serve an error page if not found if (!file_exists($page)) { $page = "$pagesDir/error.html"; } // Prevent anything from being output until it is ready ob_start(); include($page); $contents = ob_get_clean(); // Use a template with the variable $contents where you want the page's content to go ob_start(); include($template); $output = ob_get_clean(); echo $output; ?&gt; </code></pre> <p><i>Warning: include() [function.include]: Failed opening '' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\index.php on line 29</i></p>
php
[2]
2,664,345
2,664,346
Get the Key pressed on an editText
<p>I want to know which key has been pressed in the edittext. For eg: if 'a' is pressed I want to get it as 'a'. Please help me.</p>
android
[4]
2,407,688
2,407,689
Reverse substring for double extension files
<p>How can i add reverse substring for "<strong>test.csv.txt</strong>" this type of files using javascript? </p>
javascript
[3]
452,831
452,832
Is it possible to set up an open URI for Android application?
<p>From this article: <a href="http://developer.android.com/guide/publishing/publishing.html#marketintent" rel="nofollow">http://developer.android.com/guide/publishing/publishing.html#marketintent</a></p> <p>Android Market could be invoked by an ACTION_VIEW intent with URI like </p> <pre><code>http://market.android.com/details?id=&lt;packagename&gt; </code></pre> <p>How does it work? Is the market.android.com return some info to browser to help it open the Android Market application? or just the browser locally does the trick?</p> <p>Is it possible to set up an open URI who could do the same thing?</p> <p>For example, I have an app called MyBooks(com.mybooks.app) and a site like:</p> <pre><code>http://www.mybooks.com </code></pre> <p>an url could be</p> <pre><code>http://www.myboos.com/details?id=0001 </code></pre> <p>and when Browser opens this url, the site will return some kind of pre-defined response, which might contains an Intent action string, like "com.myboos.app.action.VIEW" and the queried id 0001.</p> <p>Browser could then try to start an Activity using that action "com.mybooks.app.action.View", if there is an Activity for that, start it and pass the id in. If not, it tries to connect another URL like</p> <pre><code>http://www.myboos.com/details?id=0001&amp;installed=false </code></pre> <p>Is this possible to work on any version of the Android?</p>
android
[4]
1,028,381
1,028,382
How to give the progress value morethan hundred to progressview
<p>I am developing one application.In that iam using the progress view.In this i need to give the progress value more than hundred.If i give more than hundred then that fill the total bar.So please tell me how to do this one.</p>
iphone
[8]
1,675,951
1,675,952
php constant case-insensitive issue
<p>I'm overriding a constant with case in-sensitive parameter. But php doesn't give me "constant already defined" error. I've enabled E_ALL,E_STRICT errors. Example:1</p> <pre><code>define('ONE',1000); define('one',2000,true); echo ONE; // prints 1000 echo one; // prints 2000 </code></pre> <p>In the second line, i'm making 'one' as another constant with case in-sensitive, which means redefining 'ONE'. But PHP gives no error/warning.</p> <p>Example:2</p> <pre><code>define('ONE',1000,true); define('one',2000); echo ONE; // prints 1000 with constant already defined notice echo one; // prints 1000 </code></pre> <p>Here i can get error notice.</p> <p>What's the difference between these two code blocks.?</p>
php
[2]
2,084,009
2,084,010
How can I stop an ASP.NET website from loading depending on a certain condition?
<p>How can i stop asp.net website?<br> I want check some condition and after that if something's wrong then stop website from loading.</p>
asp.net
[9]
3,056,022
3,056,023
c# return concatenation of properties
<p>i have a class:</p> <pre><code>public class LabOccurrenceForm { public DateTime Occurrence_Date { get; set; } public string Cup_Type { get; set; } public string Analytical_Testing_Phase { get; set; } public string Area { get; set; } public string Preanalytical_Before_Testing { get; set; } public string Postanalytical_After_Testing { get; set; } public string Other { get; set; } public string Practice_Code { get; set; } public string Comments { get; set; } } </code></pre> <p>i would like to add a method in the class that will concatonate all the variables like this:</p> <pre><code>public string AllData { return Occurrence_Date.ToString() + " " + Cup_Type + " " + Analytical_Testing_Phase + " " + Area + " " + Preanalytical_Before_Testing + " " + Postanalytical_After_Testing + " " + Other + " " + Practice_Code + " " + Comments; } </code></pre> <p>this did not work because it wants a get or set. what am i doing wrong? how can i fix this?</p>
c#
[0]
3,616,405
3,616,406
Get Activity object from Custom Preferences
<p>I am trying to integrate facebook-connect to my android application. All the examples i am seeing over the internet are creating the connection from an Android activity. I am doing something a bit different, the user can configure its connection to facebook from a custom preference. I was successfull when doing it for twitter and foursquare. However, the method Facebook.authorize requires an Activity as parameter, and since i am inside a preference, i am not able to find any reference to an activity object.</p> <p>So my question here is, how to get a reference for an activity inside a preference?</p> <p>Thank you all T</p>
android
[4]
1,393,633
1,393,634
Sorting files with the same first 3 letters, than deleting the older files?
<p>I had a question last week, and you quickly alleviated any concern that it would roadblock me, hoping that you can help a beginner program once more!</p> <p>I'm trying to automate one of my daily mundane tasks and it's being quite a bugger, I think mainly because I'm not taking the correct approach.</p> <p>Each morning I go through a system directory that houses many files with the same prefix, and a generated number following it. I have to sort alphabetically first, then remove the oldest versions of that file.</p> <p>Here's an example pic of my directory: <a href="http://i.imgur.com/5l2Am.png" rel="nofollow">http://i.imgur.com/5l2Am.png</a></p> <p>I was going to approach this situation by just sorting the files by name and comparing the first 3 letters to the following file, and if they were identical I would delete (or move to a backup folder) the second file, until they didn't match any longer, and I would move onto the next prefix as the comparator.</p> <p>The problem with this though I found, is that they aren't always sorted correctly, and I risk deleting the wrong files.</p> <p>Has anyone had experience with something of this nature? In my head and on VS I can put the pieces all there, but just can't seem to link it together, mainly because I've never ventured into the system.IO class before, but I want to learn!</p> <p>Any advice is appreciated, and if you want to see my futile attempts I'll gladly share them :P.</p> <p>Thanks, Nick</p>
c#
[0]
3,692,685
3,692,686
Set specific background color of image to transparent using JS
<p>I'm using the following code to modify the transparency on an image. What I would like to do however is only modify the background color of the image and set its alpha channel to 0 instead of the entire image.</p> <p>Following code sets the alpha transparency to 0 for the entire image:</p> <pre><code>var ctx = this.data.getContext("2d"); var imgData = ctx.getImageData(0, 0, this.data.width, this.data.height); ctx.putImageData(this.adjustImage(imgData), 0, 0); adjustImage: function(iArray) { var imageData = iArray.data; for (var i = 0; i &lt; imageData.length; i+= 4) { imageData[i+3] = 0; } return iArray; } </code></pre> <p>I'm after some help modifying only one color <code>rgb(255,0,255)</code> in the image to transparent.</p>
javascript
[3]
1,365,702
1,365,703
can help me to solve ListView?
<p>I am new in android. I dont know to list items in android? Can anyone help me with this?</p>
android
[4]
46,224
46,225
How to switch the server in apk
<p>I have one test apk which is pointing 3 different environments.</p> <p>Is there any way to switch from one to another environment or Is there any app to switch between one server to another?</p> <p>Thanks Chandra</p>
android
[4]
4,400,693
4,400,694
which is the use of position and name in putextra?
<p>How do I use <code>.get[position]</code> and <code>name</code> in <code>.putextra</code> in Android, and how can I use <code>position</code> in <code>putextra</code> using an array?</p> <pre><code>ainListView = (ListView) findViewById( R.id.mainListView ); mainListView.setOnItemClickListener(new OnItemClickListener() { int[] myImageList = new int[]{R.drawable.koala_copy, R.drawable.lighthouse_copy}; public void onItemClick(AdapterView&lt;?&gt; parent, View view, int pos, long id) { Intent b = new Intent(SimpleListViewActivity.this, Nextclass.class); b.putExtra("Name", myImageList.get[position]); b.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); finish(); startActivity(b); } private ArrayAdapter&lt;String&gt; getListAdapter() { // TODO Auto-generated method stub return null; } }); </code></pre>
android
[4]
5,541,540
5,541,541
Python out params?
<p>Is it possible to do something like this:</p> <pre><code>def foo(bar, success) success = True # ... &gt;&gt;&gt; success = False &gt;&gt;&gt; foo(bar1, success) &gt;&gt;&gt; success True </code></pre> <p>Does Python have out params, or an easy way to simulate them? (Aside from messing with parent's stack frames.)</p>
python
[7]
4,537,742
4,537,743
How can i set theme at run time?
<p>Please Anyone know how to set theme using runtime? getApplication().setTheme() not set theme?</p> <p>How can i set theme when user select the button and it will set the theme in my application?</p>
android
[4]
2,597,432
2,597,433
Center a formatted row of integers in Python?
<p>I am a bit new to Python, having dabbled in VB.NET, C, and a few other odd languages, so I am finding the approaches used before don't always apply to Python. In this case, I want to print out a series of integer values into columns and center them in as small amount of code as possible.</p> <p>With plain strings, this is easy as:</p> <pre><code>print "%s|%s|%s|%s" \ % (s1.center(w), s2.center(x), s3.center(y), s4.center(z)) </code></pre> <p>Where <code>w</code> through <code>z</code> is some integer value specifying the width of the field that the strings, <code>s1</code> through <code>s4</code>, should be center in.</p> <p><br />Doing the same with numbers when I want to use format specifiers like <code>%0.2x</code> or <code>%4d</code> won't work because integers don't have a <code>center</code> function.</p> <p>Using a more C-oriented approach, I could convert each integer independently:</p> <pre><code>s1 = str("%0.4x" % (i)).center(w) s2 = str("%0.2x" % (i)).center(x) s3 = str("%0.2x" % (i)).center(y) s4 = str("%0.8x" % (i)).center(z) print "%s|%s|%s|%s" % (s1, s2, s3, s4) </code></pre> <p><br />But that seems to be "unpythonic", if I am picking up the lingo correctly. What would be a good "pythonic" way to do this? It needs to be something that works with Python 2.4 and 2.7 (I am working in both environments).</p> <p>Thanks!</p>
python
[7]
3,454,496
3,454,497
Android ACTION_SEND different texts for each application
<p>I'm using an Intent with ACTION_SEND and I need to share different texts. I need to send a text for Gmail and I need to send other text for twitter. depends on the application. Can I get the application selected by the user before the application sends the text shared?</p>
android
[4]
3,214,032
3,214,033
rss feed android example
<p>I am working on Nasa image of the day example from head first android. In the last step below code is showing error.</p> <pre><code> public void resetDisplay(String title, String date, String imageUrl, String desc){ TextView titleView = (TextView) findViewById(R.id.ImageTitle); titleView.setText(title); TextView dateView = (TextView) findViewById(R.id.ImageDate); dateView.setText(date); ImageView imgv = (ImageView) findViewById(R.id.ImageDisplay); imgv.setImageBitmap(image); TextView descView = (TextView) findViewById(R.id.ImageDesc); descView.setText(desc); } </code></pre> <p>Problem is with ImageView setter method. What is that image variable? Anyone who succeeded with this example please guide</p> <p>Any link where i could find this example's code would be of great help !</p>
android
[4]
2,039,426
2,039,427
GridView Inital Editing mode?
<p>I am writing a web application that is used for tracking and entering some everyday user data... Every day I need to enter some data for multiple users manually...</p> <p>I will choose the date with the calendar, and for that date I will get DB values assigned for all users on chosen date...If there are some entries in database for that date i will display it in gridview...</p> <p>Here is the look of gridview for chosen date...</p> <pre> USERS DATA ------------ User1 Data1 User2 Data2 User3 Data3 </pre> <p>But, if I choose the date for which there are no entries in DB, I would like to display the gridview containg User names in each row, but I want the second column (DATA field) to be initially editable for ALL rows (the whole second column should contain textboxes for inserting values, not only selected row as in standard editable gridview mode) allowing inserting of wanted values...</p> <p>I want it to look something like this</p> <pre> USERS DATA ---------------- User1 TextBox User2 TextBox User3 TextBox </pre> <p>My idea is to get Users list from DB and create a datatable with first column containg returned user names, and second column empty... This datatable will be datasource for gridview in which I am going to disable editing mode, and in normal (displaying) mode I am going to have TemplateField containg of textboxes bound to that datatable in second column, and labels displaying usernames in first column... When entering all values there will be SAVE button who is calling a method that will read entered values from datatable and save it to database... </p> <p>Is there a better way to implement this functionality? If Templatefield textboxes are bound to datatable (as gridview datasource) textboxes entered values are going to be accessible from datable object, but Save button click causes postback, and I don't know how to preserve datatable state? Is there a better way to get wanted gridview with whole second column availibe for inserting new values?</p> <p>Thank you in advance for your help &amp; time!</p>
asp.net
[9]
5,531,202
5,531,203
Comparing two list
<p>I have two string list -</p> <pre><code> List&lt;string&gt; ObjList1; List&lt;string&gt; ObjList2; </code></pre> <p>How can I compare these two list efficiently, such a way that these should have exact match of parameter regardless of their order in the list? (count as well as exact match of string regardless of order) </p>
c#
[0]
5,184,826
5,184,827
Php syntax problem
<pre><code>&lt;input type="radio" name="ques1" value="op4"&gt;Jingles&lt;br&gt; </code></pre> <p>just a part of the code..... when i am checking this... iam doing this as </p> <pre><code>$selected=$_POST['ques1']; </code></pre> <p>now when i am doing this with for loop....</p> <pre><code>for($i=0;$i&lt;...;$i++) $selected=$_POST['ques'.{$i+1}]; </code></pre> <p>NEW SYSNTAX ADDED...............................</p> <pre><code>$sql='UPDATE Reg_Stud SET Result=$perc WHERE RegID="$_SESSION['id']"'; </code></pre> <p>//Whats wrong with this one???</p> <p>....//whts the correct syntax??</p>
php
[2]
1,958,459
1,958,460
What tricks did Fabrice Bellard use to make his PC emulator in Javascript so fast?
<p>Fabrice Bellard's <a href="http://bellard.org/jslinux/" rel="nofollow">PC emulator implemented in Javascript</a> is impressively fast--it boots a small Linux image <em>in the browser</em> within a few seconds.</p> <p>What techniques were used to get this performance?</p>
javascript
[3]
2,950,902
2,950,903
Using static methods in objects PHP - is it advantage?
<p>I was reading some articles and discussions on the use of <code>static methods</code> on objects and it struck me how much the views differ.</p> <p>Someone say that using static methods is an <strong>advantage</strong>. Someone says that use is a big <strong>mistake</strong>.</p> <p>I wonder how is it? My question is <strong>when</strong> to use static methods and when not?</p> <p>I would like to hear answers from <strong>experts in this field</strong> (PHP OOP). This is because I know how it really is.</p> <p>The following code should be analogous. Just call the static method is <strong>simpler</strong> (my opinion):</p> <pre><code>&lt;?php class A { public function write($a) { echo $a; } } class B { public static function write($a) { echo $a; } } $a = new A; $a-&gt;write(5); // 5 B::write(5); // 5 ?&gt; </code></pre> <p>Thank you.</p>
php
[2]
4,498,174
4,498,175
How to find character appearence in text
<p>How can i find with jquery how many times a character appear in text, for example i have the character <strong>1</strong> and the text <strong>143443143241</strong> so here the character 1 appear 3 times, how can i check that.</p>
javascript
[3]
2,169,142
2,169,143
JavaScript IF with AND/OR.. not working
<p>Can someone who is a master at JS tell me what's wrong with this?</p> <pre><code>if ( $.trim($("#add-box-text").val()).length &lt; 2 &amp;&amp; $.trim($("#add-box-text").val()) != "Click here to add an item" ) { // If it's LT than 1 Character, don't submit $("#add-box-text").effect('highlight', {color: '#BDC1C7'}, 500); // Refocus $("#add-box-text").focus(); } </code></pre>
javascript
[3]
5,899,113
5,899,114
Android ScrollView, scroll before visible
<p>how can I set scroll of scrollview to x pixels, before it's even shown? </p> <p>In ScrollView I have some Views and i know that it will fill screen. Can I scroll to let say second View, so that first View is not visible when activity is started?</p> <p>Now I have sth like this, but I think it's not perfect, sometimes, I see first View, and then it's scrolled to the second one</p> <pre><code>@Override public void onGlobalLayout() { if (mHorizontalScrollView.getChildCount() &gt; 0 &amp;&amp; mHorizontalScrollView.getChildAt(0).getWidth() &gt; mScreenWidth) { hsv.scrollTo(100, 0); } } </code></pre> <p>EDIT!!</p> <p>Second attempt was to use <a href="http://developer.android.com/reference/android/view/ViewTreeObserver.OnPreDrawListener.html" rel="nofollow">http://developer.android.com/reference/android/view/ViewTreeObserver.OnPreDrawListener.html</a> instead of <a href="http://developer.android.com/reference/android/view/ViewTreeObserver.OnGlobalLayoutListener.html" rel="nofollow">http://developer.android.com/reference/android/view/ViewTreeObserver.OnGlobalLayoutListener.html</a> In <code>OnPreDrawListener</code> we can read that <code>At this point, all views in the tree have been measured and given a frame. Clients can use this to adjust their scroll bounds or even to request a new layout before drawing occurs.</code> so basically at this point we should adjust scrolling. So I created:</p> <pre><code>@Override public boolean onPreDraw() { if (hsv.getChildCount() &gt; 0 &amp;&amp; hsv.getChildAt(0).getWidth() &gt; mScreenWidth) { hsv.scrollTo(100, 0); return false; } return true; } </code></pre> <p>but now it's never working for me.</p>
android
[4]
2,051,871
2,051,872
How do I delete all the nodes in my custom linked list?
<p>Is is possible for me to delete all nodes of my linkedlist to delete by my this code piece? If no then how is it possible to delete all the node at once! </p> <p>my code is</p> <pre><code>EditNode mynode=start; while(mynode!=null){ mynode.editnext=null; mynode=mynode.editnext; } </code></pre> <p>Help needed! Thanks in advance...</p>
java
[1]
4,412,095
4,412,096
How to send array by post method
<p>Following is my sample form.</p> <pre><code>&lt;form METHOD="post" METHOD="post" ACTION="index.php" METHOD="post" METHOD="post" METHOD="post"&gt; &lt;input TYPE="text" NAME="array[]" /&gt; &lt;input TYPE="text" NAME="array[]" /&gt; &lt;input TYPE="text" NAME="array[]" /&gt; &lt;input TYPE="text" NAME="array[]" /&gt; &lt;input TYPE="text" NAME="array[]" /&gt; &lt;input TYPE="text" NAME="array[]" /&gt; &lt;input TYPE="text" NAME="array[]" /&gt; &lt;input TYPE="text" NAME="array[]" /&gt; &lt;input TYPE="text" NAME="array[]" /&gt; &lt;input TYPE="text" NAME="array[]" /&gt; &lt;input TYPE="submit" NAME="submit" VALUE="Submit" /&gt; &lt;/form&gt; </code></pre> <p>Basically I have 10 inputs of array. Assume my domain is <a href="http://domain.com" rel="nofollow">http://domain.com</a> and the file above is index.php. I am trying to fill the form automatically by using the following method.</p> <p>http://domain.com/index.php?array[]=John&amp;array[]=Kelly ... &amp; array[]=Steven</p> <p>Unfortunately, it is not working. :(</p>
php
[2]
4,131,838
4,131,839
Page_init and Page_prerender methods - performance issues
<p>We were running a simple aspx page on IIS7.5 and we observed that it is taking long time to exit Page_Init method and call Page_PreRender method. There is nothing getting executed between these methods. See trace for the page calls.</p> <pre> [INFO ] 2011-07-15 18:30:24,783 [6] Customer.Ektron.Web END - Page_Init() [INFO ] 2011-07-15 18:30:27,486 [6] Customer.Ektron.Web START - Page_PreRender </pre> <p>Wondering if anyone has experienced this before.. This is simply killing our application performance.. </p>
asp.net
[9]
1,188,742
1,188,743
support for multiple resolution android
<p>My app has 2 different resolution support, 480x800 and 320x240, i have created folder for them for instance layout-normal-hdpi and layout-normal-mdpi. But somehow emulotor is not picking up the ui for hdpi. I have created different layout aswell.</p>
android
[4]
5,762,125
5,762,126
Indicate the user that data is being loading
<p>I want to show a progress bar or anything else when particular peice of code will execute. How can i do this? </p>
android
[4]
4,118,229
4,118,230
IE error when trying for( var i in window.external )
<p>I am building an object/property dump using JavaScript. This code breaks under Internet Explorer 8 (assuming subject = window.external)</p> <pre><code>// Gather the property names into the keys array. var keys = Array(); for( var i in subject ){ keys.push(i); } /* After this I sort the keys, then loop through to get the property values in subject */ </code></pre> <p>If you try printing subject to the console (or alert) it comes up blank. However, other objects will print [object SomethingMeaningful].</p> <p>Microsoft's documentation suggests that the object definitely has properties. It would be nice to be able to show them instead of just skipping over them. Any Ideas?</p>
javascript
[3]
2,089,302
2,089,303
C# return string array from static string
<p>Here's the code i'm using, I want to be able to feed it a single string, the character i want to convert with, and then return the array, Here's what I have but i'm not sure how to get the array to return.</p> <pre><code> public static string SplitSingleCharecter(string splitCharecter,string inString, out string[] outString) { string[] returnString = inString.Split(Convert.ToChar(splitCharecter));; // this is what i'm missing } outString = inString.Split(Convert.ToChar(splitCharecter)); return outString[]; </code></pre> <p>also tried that</p> <p>but i'm sure thats not it.</p>
c#
[0]
572,306
572,307
PHP - Links: From Thumbs to page.php
<p>I need to link 9 thumbs called: <code>project1.jpg, project2.jpg, project3.jpg</code>... to php pages with the same name: <code>project1.php, project2.php, project3.php</code>.</p> <p>It's my code so far:</p> <pre><code>&lt;?php $dir = 'portfolio/print/img/thumbs/'; $main_page ='portfolio/print/project1'; // How can I make $main_page to show the right project each time? $scan = scandir($dir); for ($i = 0; $i&lt;count($scan); $i++) { if ($scan[$i] != '.' &amp;&amp; $scan[$i] != '..') { if (strpos($scan[$i], '.png') !== false) { $curr = substr($images[$i], 0, strlen($images[$i]) -4) . ".php"; echo '&lt;li&gt; &lt;a href="'. *** $main_page *** . $curr . '"&gt; &lt;img src="' . $dir . $scan[$i] . '" alt="' . $scan[$i] . '" /&gt; &lt;strong&gt;'. $scan[$i] .'&lt;/strong&gt; &lt;/a&gt; &lt;/li&gt;'; } } }; ?&gt; </code></pre> <p><em>*</em> Do I need to create loop to find out the right link to each page? I am not really sure how to do it. </p> <p>Thank you!! </p>
php
[2]