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,284,549
2,284,550
Android Transitions between Activities in Activity Group
<p>I am trying to animate between Activities within an Activity Group.</p> <p>I know the purists will tell me I shouldn't use multiple activities and should be using a View Flipper, but I didn't start the project and don't have the option to completely re-implement the solution.</p> <p>The problem is instead of the new activity sliding over the top of the previous, the previous is cleared and the new activity slides over a blank background.</p> <p>Is there anyway to keep the previous activity in view until the new activity has animated?</p> <pre><code>public void startChildActivity(String Id, Intent intent, AnimationType animationType){ Window window = getLocalActivityManager().startActivity(Id, intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); final View view = window != null ? window.getDecorView() : null; if (view != null) { Animation animation = AnimationUtils.loadAnimation(this, android.R.anim.slideup); view.startAnimation(animation); this.setContentView(view); } } </code></pre>
android
[4]
4,230,267
4,230,268
C++ operation overload, crash
<p>Why does this code crash the program when I run it</p> <pre><code>ostream&amp; operator&lt;&lt;(ostream&amp; cout, Array&lt;int&gt; a) { return cout; } </code></pre> <p>and this doesn't</p> <pre><code>ostream&amp; operator&lt;&lt;(ostream&amp; cout, Array&lt;int&gt;&amp; a) { return cout; } </code></pre>
c++
[6]
408,688
408,689
trigger function on click
<p>i am trying to launch my function by click and keep failing... :( this is my function:</p> <pre><code>ntd.refresh_meatlist= function(){ var $tasks = $('#meating_list'),i; $tasks.empty(); if (ntd.list.length) { $tasks.append('&lt;li data-role="list-divider"&gt;Meating&amp;#39;s&lt;/li&gt;'); for (var i=0;i&lt;ntd.list.length;i++){ var li = '&lt;li&gt;&lt;a data-rel="dialog" href="#confirm" data-transition="flip"&gt;' + ntd.list[i].meating + '&lt;/a&gt;&lt;/li&gt;' $tasks.append(li); } } $tasks.append('&lt;li data-role="list-divider"&gt;Add Meating&lt;/li&gt;'); $tasks.listview('refresh'); localStorage.ntd_list = JSON.stringify(ntd.list || []); }; </code></pre> <p>this is how i try to trigger it:</p> <pre><code>$("#addmeatingBtn").click(function() { ntd.refresh_meatlist(); }); </code></pre> <p>what is missing?? thanks :)</p>
jquery
[5]
3,164,437
3,164,438
iterating through all items in listA that don't appear in listB
<p>How can I fix this statement:</p> <pre><code>for i in LISTA and i not in LISTB: print i </code></pre>
python
[7]
1,743,527
1,743,528
Is it safe to use os.environ.setdefault?
<p>From my ipython shell, I see a method setdefault in os.environ but it is not documented. <a href="http://docs.python.org/library/os.html#os.environ" rel="nofollow">http://docs.python.org/library/os.html#os.environ</a>. Is it documented somewhere else?</p> <pre><code>def setdefault(self, key, failobj=None): if key not in self: self[key] = failobj return self[key] </code></pre> <p>Can I use this function or write a wrapper for those lines?</p>
python
[7]
36,222
36,223
Split a string with a lot of dividers
<p>i have a issue with programming for android.</p> <p>i have a string like this:</p> <blockquote> <p>[["Km"],["Portagens"],["Refeições - Almoço"],["Refeições - Jantar"],["Refeições - Lanche"],["Estacionamento"],["Estadia Hotel"],["Gasóleo"],["Gasolina"],["Taxi"],["Combóio"],["Avião"],["Viatura de Aluguer"],["Viaturas BIQ"],["Economato"],["Correio"],["Outros"],["Refeições - Pequeno almoço"]]</p> </blockquote> <p>I want to split this, to save the content into a array, like this:</p> <pre><code>Km Portagens Refeições-Almoço Refeições-Jantar Refeições-Lanche Estacionamento </code></pre> <p>. . . .</p> <p>So the dividers are: </p> <pre><code>1- [ 2- ] 3 - " 4 - , </code></pre> <p>How can i split the string with this chars?</p> <p>If i use <code>[\\W]</code>, i get some blank strings.</p> <p>Can you help me?</p> <p>Regards.</p>
java
[1]
1,658,964
1,658,965
Android calculate scrollTo position in HorizontalScrollView
<p>I have HorizontalScrollView with few TextViews. Each TextView might contain text of different length.</p> <p>How should I calculate correct offset to scroll to using "scrollTo(x, y)"? </p> <p>Scrolling works, but different than expected. I've tried various things (getLocationOnScreen(), getMeasuredWidth(), getWidth() on each child element and them adding them togetehr) but I still can't get result I like. View is scrolled a bit too far or not enough.</p> <p><strong>Solution</strong></p> <p>When HSV has multiple elements with different width you can center on each of them like this:</p> <pre><code>for (TextView el : requiresFocus) { if (el.getText().equals(requiresFocus)) { offsetX = ((el.getLeft() + el.getRight()) / 2) - (myHSV.this.getWidth() / 2); scrollTo(offsetX, 0); break; } } </code></pre> <p>with <code>((el.getLeft() + el.getRight()) / 2)</code> you will get center of the element and with <code>(myHSV.this.getWidth() / 2)</code> you will get center of the screen.</p>
android
[4]
5,197,180
5,197,181
how to get next four month with year in php?
<p>i want to get the current month and next three months with year in a dropdown box, the proble is when November2012 comes then the last month would be January2013, if the current month is december2012 then the nest three months would be</p> <p>january2013 february2013 march2013</p> <p>in the drop down it should look like</p> <pre><code>December2012 january2013 february2013 march2013 </code></pre>
php
[2]
5,768,844
5,768,845
ImportError: cannot import module - Only one module can not be imported from package
<p>I created a package, for the ease of use I call it packageA.</p> <p>In this package I have 4 submodules in (separate files) and an init file, so the package contains the following files:</p> <ul> <li><code>__init__.py</code></li> <li>moduleA.py</li> <li>moduleB.py</li> <li>moduleC.py</li> <li>moduleD.py</li> </ul> <p>Module B-D stand alone, they don't import any other local module. Module A imports module B-D. </p> <p>Now I have a script that wants to import <code>packageA</code>, the init.py is empty so far.</p> <pre><code>import packageA </code></pre> <p>works without problems. But moduleA is not available from this import. If I want to use it via packageA.moduleA it raises this error:</p> <pre><code>AttributeError: 'module' object has no attribute </code></pre> <p>The following also works without problems:</p> <pre><code>from packageA import moduleB from packageA import moduleC from packageA import moduleD </code></pre> <p>And the next import causes the ImportError:</p> <pre><code>from packageA import moduleA </code></pre> <p>raises this Error:</p> <pre><code>Traceback (most recent call last): File "run.py", line 19, in &lt;module&gt; from packageA import moduleA ImportError: cannot import name moduleA </code></pre> <p>I thought that maybe I'm doing sth wrong in moduleA, but even if moduleA is empty the import raises the same error. It seems like that this module can't be imported somehow. How is this possible?</p> <p>I have separete unit test files for all python modules, and yes, moduleA is working correctly without any errors.</p>
python
[7]
1,652,259
1,652,260
passing url to another page using jquery
<p>I am going to create two pages.</p> <p>The first page will be home.html On this page I am going to have a link which moved to page 2 layout.html and from there the url should be fired is this possible please?</p>
jquery
[5]
2,466,649
2,466,650
Android Image Store
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3442462/how-to-capture-an-image-and-store-it-with-the-native-android-camera">How to capture an image and store it with the native Android Camera</a> </p> </blockquote> <p>How can i store captured image from camera into DCIM/Camera folder...By default</p>
android
[4]
2,311,722
2,311,723
File Manager access in iphone for custom application
<p>How can i get to File manager access in iphone for my application which have downloads option </p> <p>Thank you.</p>
iphone
[8]
4,409,446
4,409,447
Append web application with different file types
<p>I have to append my web application with different file types in my android application.</p> <p>I have one web application having with various files types like script, css and some swf files this is basically one web application it is working.</p> <p>But, the problem is that I need to use all this code in my android application with the same functionality. I don't know how to append all these different files and folders make to work in android application.</p> <p>Can any one help me please.</p>
android
[4]
2,654,761
2,654,762
How big is an Object, without making use of a profiler
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/52353/in-java-what-is-the-best-way-to-determine-the-size-of-an-object">In Java, what is the best way to determine the size of an object?</a> </p> </blockquote> <p>I found this piece of code on the net:</p> <pre><code>static Runtime runtime = Runtime.getRuntime(); ... long start, end; Object obj; runtime.gc(); start = runtime.freememory(); obj = new Object(); // Or whatever you want to look at end = runtime.freememory(); System.out.println("That took " + (start-end) + " bytes."); </code></pre> <p>But it is not very reliable, any idea on how to do it better?</p>
java
[1]
5,820,871
5,820,872
How to calculate two different values from two different row in mysql database by php
<p>Actually I am creating database on wamp server with the help of php. There is some calculation among some fields.This database for is for lab procurement in which every entry is for new file.Every thing is done but the problem is come when I try to insert a new values for a new file but one value is depend on a value of a previous file. like A(FILE NO) B C D 1 2 3 4 2 5 5 9(D1+C2)</p> <p>So how does is it possible? I am new to this language so if there is another way to do this then please tell me.</p>
php
[2]
3,568,648
3,568,649
overloaded stream extraction operator error
<p>how do you assign extraction operator to a linked list class.</p> <pre><code>struct Node{ int x; Node *next; }*p; </code></pre> <p>and here is my function</p> <pre><code>istream&amp; operator&gt;&gt;(std::istream &amp;is, list &amp;l){ is&gt;&gt;l; return is; } </code></pre> <p>and this doesn't work, it gives me a segmentation error Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff5f3ffff8 0x000000010000127b in operator>> ()</p>
c++
[6]
5,158,972
5,158,973
How to stop any functionality of jquery if the browser is smaller than 900px
<p>There is a Jquery slider that I need to disable when my browser gets to a certain width, which I can do, however I don't know how to disable the slider/jquery so it stops its functionality of sliding and instead will just show the html and css which im changing with media queries. </p> <p>I'm going to use a if else statement for this but don't know what to put inside the if else statement for it to do nothing.</p> <p>Thanks</p>
jquery
[5]
5,661,411
5,661,412
python script not working
<p>I have a script I'm working on for a python course however my script does not work and I can not figure out why. Here is what I have: </p> <pre><code>#!/usr/bin/python import time def createDictionary(): startTime = time.clock() dict = {'Dog': 'der Hund', 'Cat': 'die Katze', 'Bird': 'der Vogel'} dict[ 'Spider' ] = 'die Spinne' key = 'blabla' if key in dict: print dict[key] else: print "not vaild" endTime = time.clock() print "Time taken for programe (in seconds): ", endTime - startTime </code></pre> <p>Fundamentally I have two problems my dictionary part does not work and neither does the time component. </p> <p>Any advice on why this is failing would be great. Thanks</p>
python
[7]
520,276
520,277
padding issue while setting a image as background in android
<p>Hello In my android application i am using a image as background initially. Then on top of that i need to place small images and on top of the small images i would like to place a textview with some text on it.</p> <p>I am using below code for that.With this am able to place the small images but the textview if i am trying to place it place in the next row and not over the image. I also tried with adding the image as the background and then placing textview but at that case the padding and size of the image is not getting decreased.</p> <pre><code> TableLayout table = (TableLayout)findViewById(R.id.FirstTable); TableRow tr = new TableRow(this); tr.setId(i); tr.setPadding(0, 25, 0, 10); ImageView imageView = new ImageView(this); imageView.setLayoutParams(new TableRow.LayoutParams(60, 60)); imageView.setImageResource(R.drawable.bookicon); tr.addView(imageView); table.addView(tr); </code></pre> <p>Is there any way that i can have the images of size 60 by 60 and place a textview on top of these images.</p> <p>Please share your valuable suggestions.</p> <p>Thanks in advance:)</p>
android
[4]
5,924,238
5,924,239
Remove repeated elements from list and HTML Tag
<p>I have list like this:</p> <pre><code> [' name = Badmash Gujjar\n', ' image = \n', ' image =\n', ' caption =\n', ' director = Sameer Butt\n', ' producer =\n', ' writer = Nasir Adeeb\n', ' starring = Saima&lt;br&gt;Shaan (actor)Shaan&lt;br&gt;', ' music = Robin Ghosh\n', ' cinematography =\n', ' editing =\n', ' distributor = \n', ' released = Film date2001'] </code></pre> <p>I want to remove repeated elements from list. I tried following code, but not found any luck. <code>list(set(l))</code>.</p> <p>Also is there any way to remove HTML tag? thanks</p>
python
[7]
4,529,959
4,529,960
Creating closures in a loop in JavaScript
<p>I have this scenario:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="jquery-1.4.4.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var actions = { 'view' : function(){alert("view");}, 'history': function(){alert("history");}, 'renewal': function(){alert("renewal");} } for(var action in actions){ $('.' + action).live('click', function(e){ e.preventDefault(); if(actions[action]) actions[action](); }); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;a class="view" href="#"&gt;view&lt;/a&gt; &lt;a class="history" href="#"&gt;history&lt;/a&gt; &lt;a class="renewal" href="#"&gt;renewal&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I think a closure is created, since clicking a link always alerts "renewal" and I am not able to fix it.</p>
javascript
[3]
236,301
236,302
Implementing Some Basic Array Operations Using Class.?
<p>First Of All Please Forgive Me About My Dumbness in Classes. I'm very new in classes. Sir, I will update my progress ASAP. I want to declare an array of 10 integers, but by using a variable called size. i know that not too hard .. but i read the book and listen my instructor .. but didn't get it .. </p> <pre><code>// Object Oriented Design.cpp : Defines the entry point for the console application. #include "stdafx.h" #include &lt;iostream&gt; using namespace std; class test { private: int size = 10; int array[]; public: void set(int, int) const; void print(int, int) const; int search(int, int, int); }; int main() { int size = 10; // So What,, ?! Private members not accessed outside the class. ?? } </code></pre>
c++
[6]
108,528
108,529
One liner to determine if dictionary values are all empty lists or not
<p>I have a dict as follows:</p> <pre><code>someDict = {'a':[], 'b':[]} </code></pre> <p>I want to determine if this dictionary has any values which are not empty lists. If so, I want to return True. If not, I want to return False. Any way to make this a one liner?</p>
python
[7]
1,005,078
1,005,079
Change text input name based on radio button selected
<p>I have a form with 3 inputs:</p> <ul> <li>name</li> <li>email</li> <li>company</li> </ul> <p>I also have two radio buttons a user must select from:</p> <ul> <li>A</li> <li>B</li> </ul> <p>If the user selects A, leave the form fields as they are. If the user selects B then change the descriptions of the input fields.</p> <p>By default the form loads as A.</p> <p>name = we want your (name), company = we want your (company), email = we want your (email)</p> <p>How do I get the changed radio button value to update the text input fields?</p>
jquery
[5]
3,679,575
3,679,576
How to send a hyperlink using query string method like `www.something.aspx?uniqueid=google+com`?
<p>I want to send <code>hyperlink</code> by attach it with <code>URL</code> with the help of query string method. For instance in a web page containing three links like</p> <pre><code>google.com yahoo.com facbook.com </code></pre> <p>now suppose user click on yahoo.com at this point i want to send it by attaching with url like <code>www.something.aspx?uniqueid=google+com</code> ..........some thing like that </p>
asp.net
[9]
3,981,684
3,981,685
Different results for the floating point operations
<p>I'm having a small issue, I have some code that calculates a mean value from a given set of data, I do this from several different computers (some with linux, some with windows, some 32bits and others 64bits), but when I watch the database results the some values that should be equal are slightly different.</p> <p>This makes no difference for my program but I was wondering why it was this way, I was under the impression that floating point operations with the same word lenght should yield the same result (I was obviously wrong).</p> <p>This is a small sample code that I wrote to check:</p> <pre><code>public class Test{ public static void main(String... args){ double counter = 0, value = 1./10; for (int i = 0; i &lt; 1000000; i++){ counter += value; } System.out.println(counter); } } </code></pre> <p>It basically calculates 1000000 / 10, I know that the result won't be exact but in some pcs it prints a number that is slightly less than 100000 and in other cases it prints a number slightly greater.</p>
java
[1]
5,276,789
5,276,790
jQuery scroll a div up and down using two buttons
<p>I have a simple set of two buttons that when hovered should make a div move up and down to simulate a scrolling effect:</p> <pre><code>$("#down").hover(function () { $('.scroll').animate({ "marginTop": "-=50px" }, "fast"); }); $("#up").hover(function () { $('.scroll').animate({ "marginTop": "+=50px" }, "fast"); }); </code></pre> <p>However I have two issues:</p> <p>1.) I need it to stop when it gets to the end and then hide the button so they know they've reached the end</p> <p>2.) It needs to scroll continually when the user has their mouse over, currently it does it just once on mouse over and then runs it again on mouse leave.</p> <p>3.) If the content does not exceed the parent element height then hide both buttons as we don't need to scroll it.</p> <p>Can anyone help?</p> <p>I was thinking that perhaps 1 could be solved by finding out the height of the scroll panel and judging its offset to its parent element that holds it and creates the framed view?</p> <p>Thanks</p>
jquery
[5]
1,786,878
1,786,879
android how to draw graphics in existing layout
<p>I have an existing xml layout and i am loading this layout in my activity class. Now i want to draw a rectangle in this at bottom.Which on clicking would call new intent.How do i add this rectangle to my existing layout.</p> <pre><code>public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.chart); </code></pre> <p>this the code to draw the graphics.. How do i achieve this?</p> <pre><code>drawView = new DrawView(this); drawView.setBackgroundColor(Color.WHITE); setContentView(drawView); </code></pre>
android
[4]
1,029,866
1,029,867
edit the first option name
<p>I have the following code which I do not have access to. </p> <p>What I want to do is add some text into the first option which is now empty. Text such as "Select Address"</p> <pre><code>&lt;select name="My_Saved_Billing" onChange="Choose_My_Saved_Billing(this.selectedIndex)" style="background-color:#EEEEEE"&gt; &lt;option&gt;&lt;/option&gt; &lt;option value="1394"&gt;text&lt;/option&gt; &lt;/select&gt; </code></pre>
jquery
[5]
5,767,674
5,767,675
improve this very-simple dictionary generator in python
<p>I'm trying to make a simple dict generator. It works but it isn't very functional yet. </p> <p>I'd like to improve it by being able to change the max size of the output without touching the code.</p> <pre><code>letr='abcdefghijklmnopqrstuvwxyz' for i in range(len(letr)): t=letr[i] print t for t2 in letr: print t+t2 for t3 in letr: print t+t2+t3 for t4 in letr: print t+t2+t3+t4 for t5 in letr: print t+t2+t3+t4+t5 </code></pre>
python
[7]
2,132,612
2,132,613
How to add text to a C# datagrid from a textbox using a button click
<p>How to add text to a C# datagrid from a textbox using a button click</p>
c#
[0]
5,739,147
5,739,148
Unresponsive script - is it possible to avoid it?
<p>I have a listing with 150 rows and for each row there are three skinned select items. </p> <p>Because there's heavy processing to be done before displaying each result I get an error saying "A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete." and it refers to jquery.js file. </p> <p>Is it possible to avoid this error by doing some jQuery work?</p> <p>Thank you.</p>
jquery
[5]
5,648,976
5,648,977
Problems with pinch zoom on Android
<p>I recently discovered a bit of code to keep the backgrounds stable, when pinch zooming on iphone/ipad. However I am running test on my website on my Android, and when I pinch zoom, the background image, which covers the whole site in the body tag, jumps all over the place. So is there any code that can counteract this on Android devices, so my website can behave at an acceptable standard?</p>
android
[4]
5,087,901
5,087,902
ASP.NET permissions issues
<p>Im using Windows Server 2008, IIS7, .NET 4 and when I use the FileUpload control to save a file to a directory I get :</p> <p>Access to the path 'C:\xxx\Websites\CMS\Admin\test' is denied.</p> <p>I have given the test folder full control permissions for NETWORK SERVICE but it makes no difference.</p> <p>I have given full control to the Everyone user but makes no difference.</p> <p>It might have something to do with the fact that up in the CMS folder there is a MVC web application and in the CMS\Admin folder there is a web forms web application. It is the web forms web application that is trying to upload the file and getting the permissions error.</p> <p>Can anyone offer a suggestion.</p>
asp.net
[9]
4,680,934
4,680,935
Is there anyway to print out all strings interned?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6180006/which-debugging-tool-can-list-strings-internalized">Which debugging tool can list strings internalized?</a> </p> </blockquote> <p>I would like to find all interned strings, any methods to do that?</p>
java
[1]
2,942,105
2,942,106
billboard.js is not working in safari
<p>I have a billboard.js script running on a simple php file and for some reason it works fine in FF and IE but not Safari. I checked source code it and is pulling the content but the scrolling feature does not work when you click. Can someone please help me. Here is the link to try: <a href="http://www.luc.edu/test/cabplan/soc/test.php" rel="nofollow">www.luc.edu/test/cabplan/soc/test.php</a></p>
javascript
[3]
985,037
985,038
Getting a Color from a String input
<p>I am making an application where at some point i need the user to select a color, but as to not just have 50 radioButtons, I was wondering if it is possible to actually get the color they want from a textfield or something.</p>
java
[1]
2,143,246
2,143,247
Optimizing declaring repeat variables?
<p>Is there anyway in which to avoid doing something like this:</p> <pre><code>std::queue&lt;myStruct&gt; part1, part2, part3, part4, part5, part6, part7, part8, part9, part10; void setup(){ myVector.push_back(part1); myVector.push_back(part2); myVector.push_back(part3); myVector.push_back(part4); myVector.push_back(part5); myVector.push_back(part6); myVector.push_back(part7); myVector.push_back(part8); myVector.push_back(part9); myVector.push_back(part10); } </code></pre> <p>Although this only goes up to part10 I may be going up towards 50 or more. Is it just a part of coding that somewhere it has to be declared or is there a dynamic way I can declare and assign these to the myVector these queues without writing it like this?</p> <p>TIA</p>
c++
[6]
5,573,365
5,573,366
What is Document Object Model describe indepth?
<p><strong>I sought in the internet about Document Object Model, i didn't get. Explain indepth</strong></p>
java
[1]
5,742,346
5,742,347
how to read and write multiple files
<p>I want to write a program for this: in a folder I have <em>n</em> number of files; first read one file and perform some operation then store result in a separate file and the read 2nd file again perform operation and save result in new 2nd file, even same procedure <em>n</em> number of files. The program read all files one by one and stores results of each file separately in python. Please give examples how I will do it. Thanks.</p>
python
[7]
2,280,601
2,280,602
read file using nio and write to servlet
<p>Dear all, I wan to read a file and then write using java.nio and return it to servlet.i also want to check whether file has been downloaded or not.plz suggest.</p>
java
[1]
4,343,011
4,343,012
Disabling Task manager using c# in OS Hardened machine
<p>I am using the below code to disable the task manager for a kiosk application which works perfectly </p> <pre><code> public void DisableTaskManager() { RegistryKey regkey; string keyValueInt = "1"; string subKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"; try { regkey = Registry.CurrentUser.CreateSubKey(subKey); regkey.SetValue("DisableTaskMgr", keyValueInt); regkey.Close(); } catch (Exception ex) { MessageBox.Show("DisableTaskManager" + ex.ToString()); } } </code></pre> <p>But when i run this in OS hardened machine i get the following error,</p> <pre><code>DisableTaskManagerSystem.UnauthorizedAccessException: Access to the registry key 'HKey_Current_User\Software\Mictrosoft\Windows\CurrentVersion\Policies\System' is denied. at Microsoft.win32.RegistryKey.win32Error(int32 errorcode, String str) </code></pre> <p>How can i overcome this ? I need to do this for a Kiosk application.</p>
c#
[0]
690,015
690,016
Android minSdkVersion and using classes introduced in higher level SDK
<p>I was testing android minSDKVersion property and find a strange behavior-</p> <p>I put minSDKVersion=3 (1.5) and targetSDKVersion=4 (1.6) in androidManifest.xml file.</p> <p>For testing, I put following lines in onCreate method of launching activity -</p> <pre><code> android.telephony.SmsManager sm = android.telephony.SmsManager.getDefault(); ArrayList&lt;String&gt; stringArray = sm.divideMessage("this is message"); Toast.makeText(this, stringArray.get(0), Toast.LENGTH_LONG).show(); </code></pre> <p>android.telephony.SmsManager class is being introduced in android 1.6.</p> <p>After adding these lines, on 1.6 emulator it was showing toast, but on 1.5 emulator it did not show toast and did not crashed either.</p> <p>I was expecting that the application will crash on 1.5 emulator but this did not happen. Can anyone explain this?</p> <p>Thanks</p>
android
[4]
2,743,977
2,743,978
Detecting horizontal swipe in ListView
<p>I need to detect a horizontal swipe within a list view. Should I use a gesture detector or onTouch event. I need to support Android 2.1+</p> <p>One post indicated the need to override onInterceptTouchEvent in the ListView like below:</p> <pre><code> @Override public boolean onInterceptTouchEvent(MotionEvent ev) { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: // reset difference values mDiffX = 0; mDiffY = 0; mLastX = ev.getX(); mLastY = ev.getY(); break; case MotionEvent.ACTION_MOVE: final float curX = ev.getX(); final float curY = ev.getY(); mDiffX += Math.abs(curX - mLastX); mDiffY += Math.abs(curY - mLastY); mLastX = curX; mLastY = curY; // don't intercept event, when user tries to scroll vertically if (mDiffX &gt; mDiffY) { return false; // do not react to horizontal touch events, these events will be passed to your list item view } } return super.onInterceptTouchEvent(ev); } </code></pre> <p>Not sure if this works or is the best way however. It did not help that the question was mindlessly closed 8 days ago: <a href="http://stackoverflow.com/questions/11647276/swipe-gesture-inside-listview-android?rq=1">Swipe Gesture inside ListView - Android</a></p>
android
[4]
804,081
804,082
JavaScript: Make first hidden element visible
<p>How can I find the first element in a document which has style="display:none;" set and make it visible?</p> <p>I want to attach this function to a button to display several hidden elements, one by one.</p>
javascript
[3]
2,412,177
2,412,178
Assigning values to associative array with dynamic keys
<p>I have <code>$options</code> as an associative array with each value as mixed(can be strings, or other arrays). I won't have any objects there.<br> <code>$keys</code> is a numeric array &amp; the number of keys is determined at runtime.</p> <p>I want to have a result similar to this expression<br> <code>$options[$keys[0]][$keys[1]].......[$keys[count($keys)-1]] = $value;</code></p> <p>For example, if <code>$keys = array('key1')</code>, i want to do<br> <code>$options['key1'] = $value;</code><br> &amp; if <code>$keys = array('key1', 'key2')</code>, i want to do<br> <code>$options['key1']['key2'] = $value;</code> &amp; so on</p> <p>The problem with array_replace_recursive is that $value may itself be an array. Someway to constrain the depth to which array_replace_recursive can go? or maybe some other way?</p>
php
[2]
1,116,289
1,116,290
How to call an instance of a class defined inside a method of an outer class
<p>class Outer{</p> <p>public void Method(){</p> <p>int i=10; System.out.println(i); Class InsideMethod{ //</p> <p>} }</p> <p>Question : How can I call InsideMethod object outside of the method</p>
java
[1]
4,621,092
4,621,093
Dynamic Resource Loading Android
<p>how can I do this:</p> <p>I'm trying to find a way to open resources which name is determined at runtime only.</p> <p>Let me explain in more details</p> <p>I want to have a XML that references a bunch of other XML files in the application apk.</p> <p>for the purpose of explaining lets say the main XML is main.xml and the other XML are file1.xml file2.xml...fileX.xml...</p> <p>what i want is to read main.xml, extract the name of the xml I want (fileX.xml) for example. and then read fileX.XML.</p> <p>the problem I face is that what I extract form main.xml is a string and I can't find a way to change that to R.raw.nameOfTheFile</p> <p>Anybody has an idea?</p> <p>ps: I don't want to: - regroup everything in one huge XML file - hardcode main.xml in a huge switch case that links a number/string to the resource id</p> <p>Best Regards</p> <p>Jason Rogers</p>
android
[4]
3,142,603
3,142,604
Android - inconsistent ringtone behavior
<p>I am trying to add ringtones to the media/ringtones folder from my application. If the phone is connected via USB to a computer or mounted on my Mac, the ringtones do not show up in the SD Card, nor in the Ringtone settings.</p> <p>But if I run the application with the USB unplugged, the ringtones appear ok. This is not a problem with Ringdroid which does the same thing.</p> <p>Can someone please tell me what could be wrong.</p>
android
[4]
4,793,452
4,793,453
custom Php Function Needed which takes the date in the Format of MMDDYYYY as a variable and it should return YYYYMMDD
<p>custom Php Function Needed which takes the date in the Format of MMDDYYYY as a variable and it should return YYYYMMDD</p>
php
[2]
1,453,695
1,453,696
Does an Intent's extras still get flattened into a Parcel even if the new activity is being started within the same task?
<p>I was wondering...</p> <p>So if you start a new activity via an intent, the intent has to be serialized and deserialized because you may have to send the intent to a separate VM instance via IPC. But what if the PackageManager <em>knows</em> that your new activity will be created on the current task? It seems like a reasonably Googly optimization would be not to serialize the intent at all, since it's all happening inside the same VM. But then again, you can't just allow the new activity to use the same instance of each parcelable, because any changes made by the new activity would show up in the old activity and the programmer might not be expecting this.</p> <p>So, is this optimization being done? Or do the extras always get marshalled and unmarshalled, no matter what?</p>
android
[4]
2,445,615
2,445,616
Why is 'false' used after this simple addEventListener function?
<p>What is the false for at the end? Thanks.</p> <pre><code>window.addEventListener("load", function() { alert("All done"); }, false); </code></pre>
javascript
[3]
3,890,260
3,890,261
C# Do While looping problems
<p>I'm new to coding and I'm really stuck on this C# do while loop business. After a long time of messing with it I finally got it to loop a statement, but now it just repeats whatever statement was made first. For example, if it generates the number 6 and you guess 7 it'll say "too high..." but then when you guess again whether you're too low or equal to 6, it will still say "too high..."</p> <p>Thanks </p> <pre><code> static void Main(string[] args) { Random r = new Random(); int intRandomNum; // ask the random num gen for num between 1 and 12 intRandomNum = r.Next(10) + 1; //ask user for their first guess Console.WriteLine("I'm going to generate a random number, can you guess what it is? " + intRandomNum); int intUserNum = int.Parse(Console.ReadLine()); do { if (intUserNum == intRandomNum) { Console.WriteLine("You got it! Great job!"); } if (intUserNum &lt; intRandomNum) { Console.WriteLine("Too low! Try Again."); Console.ReadLine(); } if (intUserNum &gt; intRandomNum) { Console.WriteLine("Too high! Try again."); Console.ReadLine(); } } while (intUserNum != intRandomNum); Console.ReadKey(); } } </code></pre> <p>}</p> <p><strong>Thanks everyone for the help! I got it! Finally!</strong></p>
c#
[0]
4,698,390
4,698,391
How do I achieve this jQuery effect?
<p>When I click on <a href="http://www.asus.com/Motherboards/#AMD_AM3Plus" rel="nofollow"> ASUS Products page's </a> Intel socket bla2.., the page doesn't have to reload, after I clicked for example Intel Socket 2011, Intel C602 &amp; Intel X79 showed up, how do I achieve it using jQuery?</p>
jquery
[5]
1,739,052
1,739,053
tabs in javascript resetting
<p>Sorry this is probably stupid wood for trees stuff but:</p> <p>All I want is a <code>div</code> with a couple of links - you click on the links and you switch to another <code>div</code>. Standard tab stuff. That's it. But when I run the code below, it switches to the <code>div</code> I want then resets straight back to the original div. Why?</p> <p>the Javascript:</p> <pre><code>number_of_pages = 4; function cyber(page) { for(i = 1; i &lt;= number_of_pages; i++) { off = 'monitor' + i; document.getElementById(off).style.display = 'none'; } on = 'monitor' + page; document.getElementById(on).style.display = 'block'; alert(on); //debug } </code></pre> <p>the CSS:</p> <pre><code>.monitor{width: 400px; border: 1px solid #333; padding: 10px 10px 10px 10px} </code></pre> <p>the HTML:</p> <pre><code>&lt;div class="monitor" id="monitor1" style="display: block"&gt; &lt;a href="" onclick="cyber(2)"&gt;foo&lt;/a&gt;&lt;br /&gt; &lt;a href="" onclick="cyber(3)"&gt;bah&lt;/a&gt;&lt;br /&gt; &lt;/div&gt; &lt;div class="monitor" id="monitor2" style="display: none"&gt; &lt;a href="" onclick="cyber(1)"&gt;homepage&lt;/a&gt; &lt;/div&gt; </code></pre> <p>etc...</p> <p>Many thanks in advance.</p>
javascript
[3]
3,223,505
3,223,506
Pattern for activity that starts another activity (for result)
<p>I have an activity where the first thing it does is start another activity for result. when the result comes back, it should process it, then finish. I have the <code>startActivityForResult()</code> call in <code>onCreate()</code>.</p> <p>What I see is that <em>sometimes</em> when I return from the target activity i started, <code>onCreate()</code> in my activity is called again. this of course re-starts the target activity a second time.</p> <p>This makes sense and I understand why this is the case, but I don't understand the correct pattern for what I'm trying to achieve. When I return from the activity i started, i don't want to re-start the target activity again obviously ... I just want to run <code>onActivityResult()</code> and finish.</p> <p>I read where someone suggested setting a state preference, but that seems like a good source for bugs, for example, if it got stuck in the wrong state.</p> <p>Any thoughts?</p>
android
[4]
2,655,179
2,655,180
with JQUERY, How to pass a dynamic series of data to the server
<p>What is the recommended way in JQUERY to send a dynamic set of data to the server, the set contains items like:</p> <p>ID: 13 Copy: <p>hello world....hello world....hello world....hello world....</p></p> <p>ID: 122 Copy: <p>Ding dong ...Ding dong ...<b>Ding dong</b> ...Ding dong ...Ding dong ...</p></p> <p>ID: 11233 Copy: <p>mre moremore ajkdkjdksjkjdskjdskjdskjds</p></p> <p>This could range from 1, to 10 items. What's the best way to structure that data to post to the server with JQUERY?</p> <p>Thanks</p>
jquery
[5]
3,520,025
3,520,026
What kind of of java.lang.Error can be thrown during compile time?
<p>What kind of java.lang.Error can be thrown during compile time ?<br> I know one error: <code>ClassFormatError</code>. What are the others error?<br> I'm writing an application that acts as a server. The server can compile a java program. During compilation I don't want to bring it down with any error, ensuring compilation. I have taken the necessarry steps that can prevent a compilation error.<br> I'm not sure with java.lang.Error, I can catch Throwable object and prevent it, but I need to know what are the error objects that can be thrown during compile time. </p>
java
[1]
92,280
92,281
HTC Incredible not showing Ime Options on soft keyboard
<p>I have set the IME options for my <code>AutoCompleteTextView</code> object like this: </p> <pre><code>inputSearch.setImeOptions(EditorInfo.IME_ACTION_NEXT); </code></pre> <p>and also in another area, at a certain point i set the IME Options to:</p> <pre><code>inputSearch.setImeOptions(EditorInfo.IME_ACTION_GO); </code></pre> <p>why is it that on the HTC Incredible, there is no action <code>next</code> or <code>go</code> showing up on my soft keyboard? it works as expected on the <code>g1</code> and <code>Samsung Galaxy S</code></p> <p>HTC Incredible running Android 2.2<br> G1 running Android 1.6<br> Samsung Galaxy S running Android 2.1 update-1</p>
android
[4]
3,075,371
3,075,372
while loop with number of days in a month
<p>I'm trying to get this piece of script to work, but it keeps dying</p> <pre><code>$currentdays = intval(date("t")); echo $currentdays; //echoes 30 as we're in April $i = 1; while ($i &lt;= $currentdays){ echo $day; } </code></pre> <p>It keeps dying with no error. I feel like it's timing out, but it's certainly taking its time.</p>
php
[2]
3,330,545
3,330,546
jquery radio group toggle on click
<pre><code>$("input[name=sample]").click(function(){ $("#"+$(this).val()).show(); $("#"+$("input[name=sample]:not(:checked)").val()).hide(); }); }); </code></pre> <p>I was using this for switching between two divs. But when i added a third div and radio button, this didn't work for third one. It shows on click but doesn't hide others. What can cause this?</p>
jquery
[5]
2,066,245
2,066,246
find first occurance of class in div
<p>I have the below html structure, i want to find the inner html of first div with class as "popcontent" using JQUERY</p> <pre><code>&lt;div&gt; &lt;div class="popContent"&gt;1&lt;/div&gt; &lt;div class="popContent"&gt;2&lt;/div&gt; &lt;/div&gt; </code></pre> <p>thanks</p>
jquery
[5]
2,306,086
2,306,087
PHP angled single quote vs stright single quote
<p>I had a developer create some code for me and he has used angled single quotes throughout the SQL statements. I have never used these before and was hoping someone could explain the difference between angled and straight?</p> <p>If I replace all angled with straight quotes the queries dont work.</p>
php
[2]
5,051,148
5,051,149
PHP calculating the intersect of arrays
<p>Array declaration: <code>$uids = array();</code></p> <p>Next these arrays may or may not be created:</p> <pre><code>$uids['locations']; $uids['ages']; $uids['genders']; </code></pre> <p>If at least 2 of them are created I want to calculate the intersect. If all 3 are created I want the intersect of all 3.</p> <p>So, I may want to calculate the intersect of <code>$uids['locations']</code> and <code>$uids['ages']</code> or the intersect of <code>$uids['ages']</code> and <code>$uids['genders']</code>, etc.</p> <p>If put all 3 arrays in array_intersect then I get errors if one of them is not an array. I'm not sure how to handle this without an awful lot of if:else statements and think there is a better way.</p>
php
[2]
3,445,155
3,445,156
jquery, jqplot change option value
<p>im using jquery: <a href="http://www.jqplot.com/" rel="nofollow">http://www.jqplot.com/</a> and i made a nice chart. the only problem i got is this: when im over 300 pixels of the chart, i want the highlighter tooltiplocation go's to 'nw' if its smaller its 'ne'.</p> <p>current options: </p> <pre><code> highlighter: { tooltipLocation: 'ne', useAxesFormatters: true, }, </code></pre> <p>does anybody know how to change te location after its rendered?</p>
jquery
[5]
4,613,828
4,613,829
how to change android webview context menu(open, open inOpen in new window, bookmark link ...)?
<p>When, I used long press on any web link(URL) on web page, Android will display the Context menu with actions (Open, Open in new window, bookmark link, save link, share link, …. ). As per my under stand these options are provided by the Android. </p> <p>How can I customize the above context menu and add one more action to the Context menu?</p>
android
[4]
4,601,871
4,601,872
Leaked IntentReceiver from sharing menu
<p>I'm opening the send menu from a button click in a particular activity:</p> <pre><code>Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_TEXT, "meh"); try { startActivity(Intent.createChooser(i, "pfft")); } ... </code></pre> <p>Works fine, but when hitting "Back" to close it, logcat says</p> <p><code>Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1@405ab288 that was originally registered here. Are you missing a call to unregisterReceiver()?</code></p> <p>Nothing else happens - the app continues to run without a problem.</p> <p>Searching says that apparently the above code has registered a BroadcaseReceiver and it needs to be unregistered (via unregisterReceiver), probably during onResume (or onPause). The signature for unregister receiver says the single argument should be a BroadcastReceiver instance (makes sense).</p> <p>My question is - where is the reference to the BroadcastReceiver? AFAICT the methods used to open the menu don't return a BroadcastReceiver - how do I find and reference the appropriate one to unregister it?</p> <p>TYIA</p> <p>(should note that I'm debuging on a Samsung Galaxy SII, and <a href="http://stackoverflow.com/questions/7526136/sprint-samsung-galaxy-s2-activity-has-leaked-intentreceiver-are-you-missing">this thread</a> indicates it might be a device-specific bug?)</p>
android
[4]
1,082,674
1,082,675
htaccess in php
<p>I am using htaccess in my projec.there is login section i want to show the my account page as <a href="http:///www/domain.com/username" rel="nofollow">http:///www/domain.com/username</a> . But there is a problem because i have also made a cms which is open as <a href="http:///www/domain.com/cms" rel="nofollow">http:///www/domain.com/cms</a> . Although i have validate the user name But there is same page open when i open the cms or user profile page. I have pass the regular expression in htaccess but stil not required result is come </p>
php
[2]
5,036,682
5,036,683
Disable img Tag
<p>I need to disable img tag using javascript. what is the javascript code?</p> <p>Example :</p> <pre><code>&lt;img id='hrefId' src="/proteus/images/button_find.gif" alt="" /&gt; </code></pre> <p>Please help me </p>
javascript
[3]
5,838,398
5,838,399
Remove tags that created after page load with jQuery
<p>I have small application: <a href="http://jsfiddle.net/Bwdf6/4/" rel="nofollow">http://jsfiddle.net/Bwdf6/4/</a></p> <p>But with click on delete, tags that created after page load doesnt remove. Is there any way to remove tags that created after page load?</p> <p>Thanks in advance</p>
jquery
[5]
3,161,179
3,161,180
Find the "nextes" div having a specific class
<p>Hi i want to select the next div in the dom having a specific class.</p> <p>with this :</p> <pre><code>&lt;div class="comW"&gt;&lt;/div&gt; ..... Some divs ..... &lt;div class="comWF"&gt;&lt;/div&gt; </code></pre> <p>i want to select the div.comWF after the comW div but it may have some other div before comWF and after comW</p> <p>Any idea?</p> <p>Thanks</p>
jquery
[5]
3,451,635
3,451,636
Create function which parse an Enum in C#
<p>I know that to parse a string to specific <code>enum</code> like:</p> <pre><code>enum AnEnumType { TEST_, OTHER_TEST_, OTHERS_ } enum OtherEnumType { TEST1_, OTHER_TEST1_, OTHERS1_ } string aValueString = "TEST_"; AnEnumType result = (AnEnumType)Enum.Parse(typeof(AnEnumType), aValueString); </code></pre> <p>So, I want to create a function, a generic one which use parser for my <code>enum</code>(s) like:</p> <pre><code>public Type ConvertStringToAnEnum(string value, Type anyType){ return (anyType)Enum.Parse(typeof(anyType), aValueString); } </code></pre> <p>But I guess that is not OK...</p> <p>How to make the function which parse any enumeration type specified as argument in function? </p> <p>like I want to call <code>OtherEnumType result = ConvertStringToAnEnum("TEST1_", OtherEnumType)</code></p>
c#
[0]
6,027,214
6,027,215
Get partial HTML with AJAX
<p>I am trying to get a content of a another page using AJAX call. I am able to get the entire document but is it possible to get a better precision and get only a section that is within a target div?</p> <pre><code>&lt;div class="myTarget"&gt;content that I need&lt;/div&gt; </code></pre> <p>Here's how I get it now:</p> <pre><code>$.ajax({ type: "GET", url: "/dir/targetPage", dataType: "html", success: function(data) { $('#dropHere').html(data); } }); </code></pre>
jquery
[5]
3,683,645
3,683,646
Way to check redundant code in C#
<p>Is there any tool or way I can check how can I optimize my code? removing redundancy? I am using VS 2010</p> <p>Thanx </p>
c#
[0]
3,348,744
3,348,745
time or timing in C#, and another question
<p>the question is: how can i for example every two seconds without user intervention make a label flashes. like every 2 seconds label.text="". and the next two seconds i do this label1.text="visible" or changing another property like color or anything.</p> <h1>i give up</h1> <p>could you help me with a basic code, thank you. </p>
c#
[0]
4,847,507
4,847,508
HTTP Connection in Iphone
<p>since m new in iphone i need you guys to help me in learning about http Connections in Iphone.. guys please guide me to some tutorials so that i could learn some http connections tricks in iphone and coudl communicate with WebSites</p> <p>also please guide me through some Sample code for the following problem: i want to send some "Hello world" text to the site and got a reply back from the Web the same word with adiition of s i.e. "Hello World*<em>s</em>*".. please brothers guide me through any sample code.. its a part of my application that m developing in iphone</p> <p>Thanks alot guys Regards</p>
iphone
[8]
2,422,091
2,422,092
How can we display progress icon in button
<p>I need to display progress icon in button so that user can interact other GUI elements while background task is processing.</p> <p>I have searched in Android developer site and found that we can use animated drawables but don't know how to use them. Please advise on the same.</p>
android
[4]
5,802,426
5,802,427
Error faced in doPost in this servlet
<p>Assuming the data return type from MyServlet is html, and doPost is overridden in this servlet. Correct all errors in the code below.</p> <pre><code>1. &lt;script type=”xxxx/xxxxxxxxxx&gt; 2. $(document).ready(function() { 3. $('.books').click(function() { 4. $.ajax({ 5. url: 'MyServlet', 6. type: 'GET', 7. dataType: 'xml', 8. timeout: 1000, 9. error: function(){ 10. alert('Unable to get book list'); 11. }, 12. success: function(html){ 13. $('#main').html(html); 14. } 15. }); 16. }) 17. }); 18. &lt;/script&gt; 19. &lt;body&gt; 20. &lt;input type='button' value='Get' id='books'&gt; 21. &lt;div id="main" /&gt; 22. &lt;/body&gt; </code></pre>
java
[1]
3,554,718
3,554,719
Using foreach to create grid
<p>I am creating a grid in GD and was wondering if this is the right way to do it.</p> <p>I have 2 arrays. One contains all X values, the other contains all Y values.</p> <pre><code>foreach ($xpointsArray as $xvalue) { foreach ($ypointsArray as $yvalue) { // Draw point at coordinates $xvalue, $yvalue } } </code></pre> <p>I just think there must be a more elegant way to set this up, and I would like to further access the points values without doing this every time.</p>
php
[2]
3,438,781
3,438,782
$.extend documentation clarification
<p>Following jQuery does not change the value of defaults or options. The returned value is same as empty. empty has been changed and populated with merged data. All is good.</p> <pre><code>var empty = {} var defaults = { validate: false, limit: 5, name: "foo" }; var options = { validate: true, name: "bar" }; $.extend(empty, defaults, options); </code></pre> <p>However I saw someone passing true as the first option.</p> <pre><code>var defaults = { validate: false, limit: 5, name: "foo" }; var options = { validate: true, name: "bar" }; var output = $.extend(true, defaults, options); </code></pre> <p>In this case defaults has been changed.options is same and the returned value is same as defaults.</p> <p>Now try passing false.</p> <pre><code>var defaults = { validate: false, limit: 5, name: "foo" }; var options = { validate: true, name: "bar" }; var output = $.extend(false, defaults, options); </code></pre> <p>In this case defaults and options are not changed. So passing true is same as</p> <pre><code>var defaults = { validate: false, limit: 5, name: "foo" }; var options = { validate: true, name: "bar" }; var output = $.extend(defaults, options); </code></pre>
jquery
[5]
574,230
574,231
Appending a html tag to php variable
<p>I am newbie to php, just starting learning it, while working with wordpress.</p> <p>I want to add html code to a php variable, a anchor tag link actually. First i splitted the text using <code>substr()</code>, and now i want to append a anchor tag at the end of post.</p> <pre><code>$json['timeline']['date'][$i]['text'] = substr(strip_tags($post-&gt;post_content), 0, 400)+"&lt;a href='#'&gt;Read more..&lt;/"; </code></pre> <p>Well, I believe this is not the right way. Can anyone please guide me?</p>
php
[2]
1,355,186
1,355,187
how to enable focus in the main frame, when a new window was opened
<p>C# how to enable focus in the main frame, when a new window was opened and there is no way to activate actions in the main frame. Thanks,</p>
c#
[0]
4,803,185
4,803,186
Auto rotate custom drawn view on iPhone
<p>I have a UITableView full of custom draw cells. When the view rotates, it just stretches all my custom drawing. How can I get my views to redraw themselves when the view rotates?</p>
iphone
[8]
195,050
195,051
display ['name'] inside of a foreach loop coming from another loop
<p>is it possible to use the indexes values inside of a foreach loop that is contained inside a partent for each. Look at the script below and observe that in the child for each I use <code>echo'&lt;div&gt;' .$product['name'] . '&lt;/div&gt;';</code> When <code>$product[' name '];</code> belongs to the parent for each. is that possible? I am looking to use the index <code>['name ']</code> in the child <code>foreach()</code>.</p> <pre><code>foreach($tree as $product){ echo '&lt;div&gt;' . $product['name']. '&lt;/div&gt;'; foreach($product['variery'] as $variety) { echo'&lt;div&gt;'. $variery['image'] . '&lt;/div&gt;'; echo'&lt;div&gt;' .$product['name'] . '&lt;/div&gt;'; } // end of child for each } //end of parent for each </code></pre>
php
[2]
423,737
423,738
jQuery - Selecting table column?
<p>I am looking for a selector for all cells in a particular table column. I would like to add html to some existing text inside the cell. </p> <p>Thanks!</p>
jquery
[5]
2,687,100
2,687,101
Facing problem with serialization
<p>HI Here is my scenario where i have to serialize an object to a file.</p> <p>I am using binaryformatter to serialize an object as,</p> <pre><code> IFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream1, object); </code></pre> <p>I am writting GetObjectData() as follows,</p> <pre><code> serinfo.AddValue("string1",objecta); serinfo.AddValue("string2",objectb); serinfo.AddValue("string3",objectc); </code></pre> <p>I am serializing 2 lists list1, list2 in objectb. sizeof the lists vary time to time.(each list may also have 100000 elements.. means number of elements in list influence the size of the stream).so, when i serialize the object, my stream size should not exceed 10mb and If it exceeds i should write in another stream. simply to say, if size exceeds 10mb, i should have one more stream and each stream should be in following format</p> <pre><code>stream1 --&gt; objecta,(objectb)some n values in list,objectc stream2 --&gt; objecta,(objectb)values in list from n+1 to some m,objectc .. streamn --&gt; ........ </code></pre> <p>each stream size should be limited to 10mb..</p> <p>Please provide me some clues to do this.. thanks in advance.. (first of all thanks for reading this large qn..:P)</p>
c#
[0]
4,635,382
4,635,383
Try-surrounded imports and catching KeyboardInterrupt
<p>I'm seeing a lot of the following pattern in a codebase I'm checking out at the moment:</p> <pre><code>try: import moduleA import moduleB from custom.module.A import AX from custom.module.A import AY except KeyboardInterrupt: sys.exit() </code></pre> <p>Haven't seen it before. What's this guarding against?</p>
python
[7]
2,538,739
2,538,740
Getting error: "Validation of viewState MAC failed."
<p>I get the error: "Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster ensure that <code>&lt;machineKey&gt;</code> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster."</p> <p>I don't use this error if I do not go through Load Balancer. If I go through Load Balancer, I get this error about 50% of the time. Load Balancer has sticky sessions.</p> <p>My config file is like this: validationKey='2EEA416CEFC6D6BE856ED57B97FB9CA7DFACE17C073125949A1D682C80A44BB2AD887DDDC13DBFB0954F1000FEE5757E99693F222F8E28CAA2E6DAB8C4F99E0C' decryptionKey='877478B2F33A74226ABEF55FDCC1A76E43F1BBEA6241A592' validation='SHA1' /></p> <pre><code>&lt;pages enableViewStateMac="false"&gt; </code></pre> <p>so, I already have enableViewStateMac="false". How can I make the sporadic errors to go away?</p>
c#
[0]
2,887,906
2,887,907
Modify the order array when using sortable() (jqueryUI)
<p>I have a list I would sort thanks to the sortable fonction of jQueryUI:</p> <pre><code> &lt;ul id="list-cat"&gt; &lt;li id="cat_0" &gt;Coach&lt;/li&gt; &lt;li id="cat_1" &gt;Victory&lt;/li&gt; &lt;li id="cat_2" &gt;Defeat&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>My script:</p> <pre><code> $("#list-cat").sortable({ placeholder: 'highlight', update: function() { var order = $('#list-cat').sortable('serialize'); $.post("my url...",order); alert(order); // displays for example "cat[]=1&amp;cat[]=0&amp;cat[]=2" } }); </code></pre> <p>My url receives a $_POST['cat'] array with the $order as key and the $id_cat as value. I need to have the li value (Coach, Victory, etc) as array value instead of the $id_cat, is it possible ?</p>
jquery
[5]
2,310,465
2,310,466
Matching a variable to a list and save the match
<p>newbie question,I have the following code where I need to match the data in variable gerrit with the list gerrit_refs and get the corresponding match and save in a variable,how can I do that?</p> <pre><code>''' gerrit_refs: refs/changes/89/202089/4 refs/changes/39/205739/2 refs/changes/94/195594/6 refs/changes/90/202090/4 refs/changes/92/202092/4 ''' def main (): gerrit=205739 with open('gerrit_refs.txt', 'r') as f: # Here we make a list of refs based on the file gerrit_refs = [line.strip() for line in f] match = None for ref in gerrit_refs: if gerrit in ref: match = ref print match break if __name__ == '__main__': main() </code></pre> <p>Error:-</p> <p>TypeError: 'in ' requires string as left operand, not in</p>
python
[7]
687,280
687,281
$(function(){});, (function($)(){}(JQuery); and $(document).ready(function(){}); any difference?
<p>I have a very strange issue with JQuery, its about a starting of JQuery code when document is ready, as I know there is no difference to use one of methods <code>$(function(){//CODE});</code>, <code>(function($)(){//CODE}(JQuery)</code> or <code>$(document).ready(function(){//CODE});</code>.</p> <p>Like what said on <a href="http://stackoverflow.com/questions/593292/what-is-the-difference-between-document-readyfunction-and-function">What is the difference between $(document).ready(function() and $(function() ?</a></p> <p>So I like always to use <code>$(function(){//CODE});</code> method, but when I using this method in some pages working well, but in another I got errors like If I use <code>$.fn.extend</code> or <code>$.browser.msie</code> , I'll get '$.fn is undefined' issue, tried to use <code>(function($)(){//CODE}(JQuery)</code> and that error disappeared, I just want to know why this happening and really if there is and difference between each method !</p>
jquery
[5]
1,644,936
1,644,937
expression evaluation with boolean values
<p>In Java or other similar languages I can't do:</p> <pre><code>a &lt; b &gt; c </code></pre> <p>where a,b,c are boolean types.</p> <p>In Javascript I can do that and also with other data types values:</p> <pre><code>var t = 3; var z = true; t &gt; z // will be true </code></pre> <p>Now why the results is true???</p>
javascript
[3]
2,881,258
2,881,259
get current visible part of page displayed in IE
<p>I'm working on a screen reader and till now I was successful to get the whole text of a page in IE. But I have no idea how to get the current visible part of page or to get the current paragraph that is under the cursor in IE.</p> <p>I don't mean to give me the code, but just to recommend me if there is a way to do it using APIs or similar things.</p> <p>from what I found I think it’s not doable using Accessibility APIs.</p> <p>I GREATLY appreciate any ideas and helps.</p>
c#
[0]
4,356,565
4,356,566
How to compile and run lower version java to higher version?
<p>I am currently working in jdk 1.5 version. I want to compile and execute code in jdk 1.6 version.</p> <p>How can i do this?</p>
java
[1]
5,982,719
5,982,720
PHP not retaining Javascript changes
<p>I have this simple javascript function which changes the body zoom of the web page. The function runs properly when I am having it on a HTML page as a normal javascript. When I embed it in PHP, it is not retaining the body zoom change. The javascript embedded in PHP can be shown as follows:</p> <pre><code>&lt;?php ?&gt; &lt;html&gt; &lt;head&gt; &lt;script language="javascript"&gt; function zoomout() { document.body.style.zoom = screen.width/1024; document.body.style.zoom = screen.height/1024; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name="test"&gt; &lt;center&gt; &lt;br&gt; &lt;br&gt; &lt;button onclick="zoomout()"&gt;1024&lt;/button&gt; &lt;/form&gt; &lt;/center&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>What am I doing wrong here. Thanks</p>
php
[2]
3,442,917
3,442,918
Android get thing clicked in listview to setText
<p>I have two classes, a listview class with many strings and a class with a text view .. I want when I click on a string on the listview the second class starts and the textView in it is setText to the item clicked ..</p> <p>I tried:</p> <pre><code> @Override protected void onListItemClick(android.widget.ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); String item = (String) getListAdapter().getItem(position); Intent select = new Intent(LV.this, Main.class); startActivity(select); } </code></pre> <p>and on the second class its </p> <pre><code>S.setText(LV.item); </code></pre> <p>S is the textview </p> <p>now it appears null ..</p>
android
[4]
1,876,605
1,876,606
NameError: global name 'AlreadyExists' is not defined when using try/except within a function
<p>I know many of these questions exist but I can't seem to find one that works for the problem I am having.</p> <p>I have the following:</p> <pre><code>def function(): try: # function to create a table on hbase except AlreadyExists, ae: print "WARN: " + ae.message </code></pre> <p>when I call it from another python script it gives me </p> <pre><code>NameError: global name 'AlreadyExists' is not defined </code></pre> <p>...but if I remove the <code>def function()</code> and run it on its own, it works and doesn't complain about the global name.</p> <p>I tried putting <code>global AlreadyExists</code> and that didn't work. I also looked at this <a href="http://stackoverflow.com/questions/6060865/nameerror-global-not-defined-when-using-try-except">similar problem</a> but I'm not sure how to apply it because it works on its own (without me having to import anything specific, but as soon as I wrap it in a function it fails).</p> <p>Any suggestions?</p>
python
[7]
663,594
663,595
how to use onlocationchanged method in locationlistener
<p>hello i'm pretty new to android.. i'm making an application which needs exact(approx 50m accuracy acceptable) user location.. i'm using locationmanager and locationlistener.. whenever i start the application i need user location returned. problem is that onlocationchanged method in locationlistener returns the latitude longitude only when they change.. how do i get user location ?</p> <p><code>locmgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, loclist_netwk);</code> this is how i'm calling the class where i've implemented locationlistener.</p> <p>`</p> <pre><code>package com.example.gpsmanager; import android.app.Activity; import android.content.Context; import android.location.Location; import android.location.LocationListener; import android.os.Bundle; import android.widget.TextView; import android.widget.Toast; public class MyLocationListener extends Activity implements LocationListener { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mylocation_layout); } @Override public void onLocationChanged(Location loc) { // TODO Auto-generated method stub loc.getLatitude(); loc.getLongitude(); String text="my current location is"+"lat: "+loc.getLatitude()+"long: "+loc.getLongitude(); //TextView text1=(TextView) findViewById(R.id.textView1); //text1.setText(text+""); Toast.makeText(MyLocationListener.this, text, Toast.LENGTH_LONG).show(); } @Override public void onProviderDisabled(String arg0) { // TODO Auto-generated method stub String text="GPS Provider not availabe"; } @Override public void onProviderEnabled(String arg0) { // TODO Auto-generated method stub String text="GPS Provider availabe"; } @Override public void onStatusChanged(String arg0, int arg1, Bundle arg2) { // TODO Auto-generated method stub } } </code></pre> <p>` pllzz plzz help guys... thankss..</p>
android
[4]
4,011,502
4,011,503
How to get nicer TimeSpan object output?
<p>If I got such an output - <code>TimeSpan</code> object - how can I get it nicely without extra zeros and so many decimal places?</p>
c#
[0]
729,974
729,975
how to open the url from a .pdf file through xcode programming
<p>i'm trying to get the url from a pdf files so that if a user double taps the url on the pdf file, it opens in a new web page.... how can i do it ? any suggestions ? i'm using Xcode 3.2 version.</p>
iphone
[8]