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
431,610
431,611
Where can I find Java API code
<p>I heard that Java is a opensource code. so, Can I get Java API coding methodology? If so, please let me know where can I get the source code for Java APIs.</p>
java
[1]
1,833,913
1,833,914
Android: Unexpected recent apps behavior
<p>Our app has 2 Activities- A <code>MainActivity</code> (associated with Launcher icon) and an <code>AuxActivity</code> for handling URI events.</p> <p>I'm seeing an issue with this scenario, with my app initially exited:</p> <ol> <li><p>Open Browser, click on a URI to launch the <code>AuxActivity</code>.</p></li> <...
android
[4]
4,671,888
4,671,889
Dynamic User Controls in asp.net
<p>Hello I am trying to lear how to create Dynamic User Controls in asp.net.</p> <p>I just know that this type of controls are created or loaded at run time.</p> <p>Someone knows a good tutorial about this topic?</p> <p>thanks in advance,</p>
asp.net
[9]
5,487,742
5,487,743
Looking for python module to help "neaten" up a server console window
<p>I'm looking for a Python module/framework/package that will assist me in making a sort of "better" console for my application. As it stands now, STDIN can be "pushed" to new lines by other messages being logged out to the console, therefore making it difficult to read what you are trying to type into a server consol...
python
[7]
4,815,547
4,815,548
Contoling powepoint presentation through IPHONE
<p>Hi all I have to develop one Iphone app in which I need two major functionality. First functionality should be to control the whole power-point presentation from iphone and simultaneously I want to refer to my short hand notes which I would make with this application itself. so in a nutshell with one button click ev...
iphone
[8]
2,493,899
2,493,900
alarm sound in android application
<p>I want to know that how to set my own sound in setting alarm in android </p>
android
[4]
3,078,728
3,078,729
Longtail video php API integration issue
<p>Looking to integrate the longtail php(bits on the run) video API into an application ,i want to be able to retrieve all the keys from the content server and associate them with a column in my mysql database song_id, and use an anchor tag with a query string to be able to retrieve the correct video when click on . Pr...
javascript
[3]
4,725,063
4,725,064
How set Alternate Cell Color in a Grid
<p>How set alternate cell Color in a grid ? I've found a lot of questions/tutorials about how to set row colors but nothing about cells' color. Thanks in advance</p>
android
[4]
3,749,310
3,749,311
Simple generic collection to add elements
<p>What collection should I use from C# that suports generic only for adding elements ? I tried using <code>ArrayList</code>, but I see that it's a non-generic type.</p> <p>Sorry if this is a duplicate. Thanks.</p>
c#
[0]
1,239,432
1,239,433
how to replace a string in php
<p>i want to replace '&lt;' and '>' sign in string. e.g</p> <pre>$str = 'if x&lty and y&gtz'; echo str_replace( '&lt', 'something', $str ) . "\n";</pre> <p>this give the following result</p> <pre>if xsomethingy and y>z</pre> <p>my question is how can i replace '>' to text 'something'</p>
php
[2]
1,879,293
1,879,294
Android's RelativeLayout Unit Test setup
<p>i'm trying to write an unit test for my Android's RelativeLayout. Currently, my testcode setup is as follow:</p> <pre><code>public class SampleRelativeLayoutTest extends AndroidTestCase { private ViewGroup testView; private ImageView icon; private TextView title; @Override protected void setUp() throws Excepti...
android
[4]
2,475,387
2,475,388
Package.Open() exception: Access to path is denied
<p>I been trying to fix this problem for the whole day, but no matter what I do I keep on getting the same exception: UnauthorizedAccessException was unhandled at line using (Package package = Package.Open(d.FullName, FileMode.Create, FileAccess.ReadWrite))</p> <p>The full code is:</p> <pre><code>NTAccount act = ne...
c#
[0]
3,008,940
3,008,941
Does service gets restarted automatically after an application is manually force closed from settings screen
<p>I am testing one scenario where i have to test whether the application service gets restarted after an application is manually force closed from settings screen.</p> <p>When i force close the app in logs it shows:-</p> <p>06-30 11:26:30.283: WARN/ActivityManager(116): Scheduling restart of crashed service com.test...
android
[4]
4,619,959
4,619,960
Does NSDictionary always give output surrounded by double quotes?
<p>This is my code:</p> <pre><code>//elementsValues is type of NSDictionary. currentElementValue is type of NSString. //resultArray is type of NSArray. //elementName = [[NSString stringWithFormat:@"SignOnResult"]; [self.elementsValues setObject:self.currentElementValue forKey:elementName]; [self.resultArray addObject...
iphone
[8]
886,569
886,570
Python int to binary?
<p>Are there any canned Python methods to convert an Integer (or Long) into a binary string in Python?</p> <p>There are a myriad of dec2bin() functions out on Google... But I was hoping I could use a built-in function / library.</p>
python
[7]
4,587,190
4,587,191
Getting specific days in a month
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5421972/how-to-find-the-3rd-friday-in-a-month-with-c">How to find the 3rd Friday in a month with C#?</a> </p> </blockquote> <p>There's a condition that a specific event will occur only on <strong>first</strong> ...
asp.net
[9]
5,103,633
5,103,634
Type error in python code
<p>When I try to execute the following:</p> <pre><code> def breadthFirstSearch(initialState, goalTest, actions, successor): agenda = Queue() if goalTest(initialState): return [(None, initialState)] agenda.push(SearchNode(None, initialState, None,2)) while not agenda.empty(): parent=agen...
python
[7]
1,179,734
1,179,735
How to increment a value with leading zeroes?
<p>What would be the best way to increment a value that contains leading zeroes? For example, I'd like to increment "00000001". However, it should be noted that the number of leading zeroes will not exceed 30. So there may be cases like "0000012", "00000000000000099", or "000000000000045".</p> <p>I can think of a c...
python
[7]
4,539,300
4,539,301
What means syntax like the following: @var=("","")
<p>I'm using eclipse and I put a script into my project. In a config-file there are php-statements like the following:</p> <pre><code>@ftp_mode=(0,0,0); @ftp_user=("","",""); </code></pre> <p>Eclipse marks them as syntax errors but everything works. So I want to know if this is an error and if not what means it? It l...
php
[2]
5,224,167
5,224,168
Read default browser's cookie in Android
<p>I am building an App which can be downloaded from my web server using the default browser. While the user is getting to download the App, I am actually creating a cookie and saving it on their device.</p> <p>For some reason, I need to read the cookie which I did set for them after they install the App at first laun...
android
[4]
3,655,657
3,655,658
Why does sometimes DateTime.TryParse work and other time only DateTime.ParseExact work?
<p>I have two laptops both with windows xp sp3, vs 2010 and target framework .Net 3.5. When processing DateTime variable, I found that with laptop1 </p> <pre><code>DateTime oldOrderDate; string strnewdate = string.Empty; CultureInfo provider = CultureInfo.InvariantCulture; if (DateTime.TryParse(items[1], out oldOrder...
c#
[0]
4,210,497
4,210,498
How to connect with camera by IP?
<p>I have got a task to make application which can to connect to camera by IP and show video from it. But I'm a new developer and I don't know it is possible or not. Please, give me an advice. </p>
android
[4]
1,869,242
1,869,243
Compile time vs Run time Dependency - Java
<p>I was wondering difference between compile time and run time dependencies in Java. It is related to class path, but how do they differ? I googled but didn't find a satisfying answer.</p> <p>Thanks Kunal</p>
java
[1]
316,375
316,376
How to exhaust the heap
<p>What is an easy way to cause a heap overflow in Java? I need to test how some external code responds when memory goes away.</p>
java
[1]
509,922
509,923
How to check if a string matches an IP adress pattern in python?
<p>What is the fastest way to check if a string matches a certain pattern? Is regex the best way?</p> <p>For example, I have a bunch of strings and want to check each one to see if they are a valid IP address (valid in this case meaning correct format), is the fastest way to do this using regex? Or is there something ...
python
[7]
1,804,398
1,804,399
Enum to String?
<p>I've got an enum defined like this</p> <pre><code>enum Tile { Empty, White, Black }; </code></pre> <p>But let's suppose when written to the console, </p> <pre><code>Console.Write(Tile.White); </code></pre> <p>I want it to print</p> <pre><code>W </code></pre> <p><em>Or any other value</em>, I could use a <code>...
c#
[0]
5,827,354
5,827,355
newly added row does not display in an asp.net repeater
<p>I am using the code highlighted below: I have to refresh the browser window to see the newly added row to a table shown in a repeater on the web page. Is there anyway I can just auto refresh the repeater control to see the newly added row. The updtemode attribute on the asp:UpdatePanel is set conditional. On the con...
asp.net
[9]
4,764,623
4,764,624
Is there any way to detect if video can be played on a device?
<p>I've done a deep research on playing videos Android devices and I came to a conclusion that there are some Android devices that can't play videos that were recorded on other Android devices.</p> <p>Right now I'm firing an intent to play video, but the player says "Sorry, the video cannot be played".</p> <p>I've be...
android
[4]
2,981,327
2,981,328
About Limiting Rss Feed
<p>I want only the latest 5 feeds to be shown on my website.<br> I am using the following code to fetch rss feed... Can any one help to limited feeds to be shown... Thank You In ADVANCE :)</p> <p>CODE THAT AM USING</p> <pre><code>&lt;?php require_once('rss_fetch.inc'); $url = 'http://news.google.com/news?ned=us&am...
php
[2]
4,944,284
4,944,285
sendTextMessage(phoneNumber, null, message, null, null); always returns success even when message not sent
<p>I tried sms activity using <a href="http://www.mkyong.com/android/how-to-send-sms-message-in-android/" rel="nofollow">this link</a> but the problem is that it always gives "message sent" how to know if the message is really sent!</p> <p>here is code</p> <pre><code>try { SmsManager smsManager = SmsManager.getDefa...
android
[4]
2,652,838
2,652,839
Unrecognized configuration section log4net. web.config website
<p>I use log4net to log the errors in my web application and it works fine. However if I place the same code in website I get error "Unrecognized configuration section log4net"</p> <p>here is my web.config section </p> <p></p> <pre><code>&lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHand...
asp.net
[9]
5,156,065
5,156,066
How to call in android?
<p>How do I call international mobile programmatically when clicking textview in android?</p>
android
[4]
1,942,191
1,942,192
How to unregister a specific hotkey using c#
<p>I am using the below code to register a HotKey :</p> <pre><code>RegisterGlobalHotKey(Keys.F4, USE_ALT); private void RegisterGlobalHotKey(Keys hotkey, int modifiers) { try { // increment the hot key value - we are just identifying // them with a sequ...
c#
[0]
653,379
653,380
Web Services For Mobile Application Olympics London 2012
<p>Are there any web service for London Olympics 2012, which anyone can make use of , in either our own website or mobile app? I'm trying to build an app which should fetch and populate the games updates - event schedule, player details, rankings, etc. I'm aware that there is a way to populate the London2012 website wi...
android
[4]
2,949,531
2,949,532
Why can you read, but not modify, global values?
<pre><code>&gt;&gt;&gt; import sys &gt;&gt;&gt; print(sys.version) 2.4.4 &gt;&gt;&gt; b = 11 &gt;&gt;&gt; def foo2(): ... a = b ... print a, b ... &gt;&gt;&gt; foo2() 11 11 &gt;&gt;&gt; def foo3(): ... a = b ... b = 12 ... print a, b ... &gt;&gt;&gt; foo3() Traceback (most recent call last): File "&lt...
python
[7]
2,183,677
2,183,678
Sorting a SortedDictionary based on value, not key
<p>I have a SortedDictionary, the key is a int value and the matching value to each key is a class object. The class contains a int and a two datetime variable.</p> <p>I need to sort my SortedDictionary based on the InTime datetime in my class. So that when I do a foreach to loop through my SortedDictionary I will hav...
c#
[0]
5,880,831
5,880,832
Why am I getting this error with my for loop?
<pre><code>public boolean isNumber(String t) { for (int i = 0, i&lt;= 9, i++) { if t.equals(i) { return true; } } return false; } </code></pre> <p>Copypastad the wrong method originally -<em>_</em>- I have this inside a class compiling with this error: </p> <p>data_structu...
java
[1]
4,897,503
4,897,504
Retrieving multiple selection of a ListBox
<p>I have a ListBox that contains some names from a database query.</p> <p>How can I retrieve these names when selecting multiple items?</p>
c#
[0]
776,427
776,428
Reading a tag from a textview
<p>I am setting a tag on a textview using the following code</p> <pre><code> TextView tv = (TextView) findViewById(R.id.textView1); tv.setText("New Item"); tv.setTag("1"); </code></pre> <p>How can I read the tag value I have set for this?</p>
android
[4]
1,999,326
1,999,327
Print value of number (int) spelled out
<p>is there an out-of-box way to spell out an int in C#? For example if I have:</p> <pre><code>int a = 53; </code></pre> <p>I want to print:</p> <pre><code>"fifty three" </code></pre> <p>not</p> <pre><code>"53" </code></pre> <p>If not, does anybody have any examples on how to accomplis this?</p> <p>Thanks!</p>
c#
[0]
4,724,591
4,724,592
How can I share data (which is updated every minute) accoss modules in Python?
<p>I have read in many posts that global variables are bad, but I need them!</p> <p>My situation:</p> <p>I have few variables defined in a dedicated module which are updated every minute and are used by other modules in the application. (Implemented after reading <a href="http://effbot.org/pyfaq/how-do-i-share-global...
python
[7]
5,084,854
5,084,855
Flipping a picture across the vertical axis in python
<p>I am trying to flip a picture across its vertical axis in python but have no idea how to start. any suggestion would be appreciated. Thanks.</p>
python
[7]
1,391,165
1,391,166
convert byte to binary
<p>I have FLY file I stored it to byte array and I can read it byte by byte. I want to convert each byte to binary 0s and 1s </p> <p>I want to convert variable b to binary 1s 0s. for example if b = 70 how to convert it to binary</p> <p>what function I can use in C# to do this??</p> <p>here is my code to read FLY fil...
c#
[0]
5,229,688
5,229,689
getting rid of characters in an output in python
<p>If someone writes 'james', I want my program to style their name as j*a*m*e*s I thought it would be simple:</p> <pre><code>for letter in name: print letter+' *', </code></pre> <p>but I don't know how to get rid of the last asterix at the end.</p> <p>I had a friend show me in C though...so I understand the underl...
python
[7]
855,069
855,070
Insert text generated in php in the html
<p>We can do</p> <pre><code>&lt;img src="page.php" /&gt; </code></pre> <p>to display an image generated in php.</p> <p>How can I do something like <code>&lt;div src="page.php" &gt;&lt;/div&gt;</code> to display a text generated in php?</p> <p>P.S: I know we can do <code>&lt;?php echo ""; ?&gt;</code> but my goal is...
php
[2]
1,088,552
1,088,553
How do I apply a sequence of insert/delete-character operations on a string?
<p>I have a text like this:</p> <blockquote> <p>My name is Bob and I live in America.</p> </blockquote> <p>I have some reference to the characters of this string, for example:</p> <pre><code>from 3 to 7 chars, deleted at 3 char, added "surname" from 20 to 25, deleted at 25 char .... </code></pre> <p>but these sta...
java
[1]
4,932,477
4,932,478
Custom EditText not showing up in an alert dialog
<p>Good day, following the NotePad sample in the SDK, i wanted to have a custom EditText view show inside an alert dialog. My problem is, i can't seem to get any focus on the editText.. clicking in the EditText Area is not doing anything. </p> <p>here is the code:</p> <pre><code> LayoutInflater my_inflater = (LayoutI...
android
[4]
5,502,166
5,502,167
php fetchpage() function help, identifying image sizes from a url in php
<p>hey guys so im building an application and one of teh features it will have is the ability to show photo links from twitter inline sort of like what tweetdeck has done in their chrome browser version and sites like crowdreel have been able to do, i spent some time researching how to grab image tags from urls on goog...
php
[2]
3,198,362
3,198,363
C++ .exe ignores classes, only running main (beginner)
<p>It's only running main, the output "Enter a word" but completely ignores the objects/class</p> <p>I'm a newb, sorry if this is an inappropriately easy question. This happens on both release and debug mode</p> <pre><code>#include &lt;iostream&gt; using namespace std; class WordGame { public: void setWord( st...
c++
[6]
5,008,752
5,008,753
Best way to effectively disconnect a test device from eclipse
<p>I am new to android development and I have been having problems with disconnecting my smartphone from my ubuntu development platform running Eclipse. When I initially plug my phone in with the usb, the system sees it and all is well. However, if I disconnect it from the system and then plug it back in, the system ...
android
[4]
6,030,046
6,030,047
How to disable show() in jquery on page load?
<p>I want to <code>show()</code> <code>"&lt;div id="test"&gt;write text here&lt;/div"</code> on click and not on page load.</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ $("#click_test").stop(function(event){ event.preventDefault(); $("#test").slideup(); })...
jquery
[5]
4,097,010
4,097,011
Split a text file using the header
<p>I have an input text file which I am reading and storing everything in a list. After that I'm splitting the list according to the specific text occurence in the list. </p> <p>Here is the function.</p> <pre><code>import re def readFile1(file1): f = file1.read().split('\n') #print f ctrlList1 = [] mf...
python
[7]
5,149,769
5,149,770
iphone xcode Landscape mode by default
<p>how can I set an iphone app to start in Landscape mode? and stays that way</p>
iphone
[8]
2,487,357
2,487,358
Convert String to Decimal - leave digits
<p>I've got a form which allows a user to enter a price, for example, <code>10.00</code>. </p> <p>However as the form is purley text a user could enter <code>$10.00</code> or <code>10.00 for book</code>. I cannot change the UI, this has to be done under the hood. So basically what ever the use types I just want a de...
c#
[0]
3,987,526
3,987,527
Write to file in android from input stream?
<p>Im getting an input stream, which is an mp3 in my raw folder, and then I am trying to write it back to the raw folder (I know this sounds stupid but I want to do it), but I get an error - file not found, myFile.mp3. Any ideas where I am going wrong?</p> <pre><code>try { File f=new File("android.re...
android
[4]
3,276,748
3,276,749
Validate image type using javascript
<p>i have a form like this: </p> <pre><code>&lt;form method=post src=upload enctype="multipart/form-data"&gt; &lt;input name="img1" id="img1" type="file"&gt; &lt;input type="submit" value="Upload"&gt; &lt;/form &gt; </code></pre> <p>Please how can I valid this form using javascript so that only jpg files are ...
javascript
[3]
3,316,656
3,316,657
Javascript: find closest number
<p>i would like to find rounded nearest number in javascript e.g.</p> <p>10 --> 10</p> <p>11 --> 10</p> <p>12 --> 10</p> <p>13 --> 15</p> <p>16 --> 15</p> <p>17 --> 15</p> <p>18 --> 20</p> <p>19 --> 20</p> <p>20 --> 20</p>
javascript
[3]
116,173
116,174
assigning a priority to processes before they are launched
<p>I have a specific number of process(C# .exe) that should be launched. how do i launch them according to their priority.</p> <p>I know the Process.PriorityClass thing but it's not really useful because it only assigns the priority after the process is launched.</p> <p>I have this code here (doesn't compares priori...
c#
[0]
224,709
224,710
Question about bool in C++
<p>I was wondering why the code below only returns "Test" four times, instead of five?</p> <pre><code> #include &lt;iostream&gt; #include &lt;cassert&gt; using namespace std; class CountDown { public: //Application Programmer Interface CountDown(int start); // it is set to start ...
c++
[6]
4,097,577
4,097,578
Migrating to OSGi?
<p>We're currently running server-side java apps on windows using JavaServiceWrapper and this has been a good solution for us. We have a small number of Spring-based lightweight applications.</p> <p>But now we need to look at introducing some modularity into our services. To that end I have been thinking about OSGi.</...
java
[1]
995,238
995,239
private & protected constructor
<p>I am quite confused with the difference with private and protected constructor in java regarding the accessibility of the subclasses and creating instance. Some code example is even better. Thanks in advance. </p>
java
[1]
4,836,868
4,836,869
DecForms to Java
<p>Can some one help me in approaches / Strategies in converting DecForms to Java? We have about 24 IFDL files which we need to convert to Java based technologies</p>
java
[1]
4,621,745
4,621,746
when we need to provide template parameters to define a class?
<pre><code>template&lt;typename T&gt; class A // template parameterization { private: T t; A(const T&amp; v) : t(v) {} }; class B { template&lt;typename T&gt; B(const T&amp; v) { std::cout &lt;&lt; v &lt;&lt; std::endl; } }; // usage of A and B A&lt;int&gt; a; B b(10); </code>...
c++
[6]
3,433,192
3,433,193
Javascript - Function call will not enter function body
<p>I have a function acting as a constructor that, when called, gets as far as the function definition in the debugger, but never to the function body. Is there a common reason this may happen that I am overlooking? Example code below:</p> <p>myconstructor.js</p> <pre><code>function MyConstructor(optionalParam) { /...
javascript
[3]
390,072
390,073
COnvert date from Thu Jun 09 2011 00:00:00 GMT+0530 (India Standard Time) to YYYY-MM-DD in javascript
<p>How can I convert the time from the format "Thu Jun 09 2011 00:00:00 GMT+0530 (India Standard Time)" to YYYY-MM-DD.</p> <p>When I try to alert() the date then this will show the date like the following - Thu Jun 09 2011 00:00:00 GMT+0530 (India Standard Time)</p> <p>But I need the time in YYYY-MM-DD format.</p> <...
javascript
[3]
5,083,689
5,083,690
PHP php.ini file in the web public root directory ? is it safe enough
<p>I heard when you want to change the php.ini settings when you don't have access to the php.ini in the root level that you can upload a php.ini to the web-root, is this correct ?</p> <blockquote> <p>Another way to customize your PHP settings is to create a file named <code>php.ini</code> and to upload it to your w...
php
[2]
1,719,990
1,719,991
will any change to the member of class observed set off the observer to the member?
<p>Let me make a example to show this:</p> <p>I have a class <strong>ClassA</strong>, it contains a public member <strong>memberA</strong>. it also contains a public method <strong>methodA</strong>, which will change the value of memberA.</p> <p>now I have a instant of ClassA: </p> <pre><code>instantA </code></pre> ...
iphone
[8]
3,811,818
3,811,819
Custom function shared by many aspx pages
<p>I have a few aspx pages which displays GridView controls. In each control I use custom functions to format displayed data. I want to put those functions in one static class. I did like this:</p> <pre><code>namespace MyNS { public static class FormatFunctions { public static string Format1(string tex...
asp.net
[9]
4,888,761
4,888,762
Make dots between numbers in php
<p>I would like to make dots between my total value.</p> <p>If i have 425000 i would like it to show as 425.000</p> <p>Is there a function in php that implodes dots for numbers or how can i do this then?</p>
php
[2]
4,222,967
4,222,968
php string comparison considering spaces in between
<p>in php i need to compare 2 strings.</p> <pre>str1="this is a string"</pre> <pre>str2=" this is a string "</pre> <p>I want to consider str1 and str2 to be the same string.</p> <p>The way I can think is:</p> <p>trim the strings first. extract the words of each string first, compare the words an...
php
[2]
3,169,547
3,169,548
download URL works when pasted/entered in browser address bar, but not in href or window.open or Location
<p>why download URL works when pasted/entered in browser address bar, but not in href or window.open or Location if i have a html file with this code</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" language="JavaScript"&gt; function clickedButton() { window.locati...
javascript
[3]
560,964
560,965
jquery set value of div
<p>I have this div:</p> <pre><code> &lt;div style="height:100px; width:100px" class="total-title"&gt; first text &lt;/div&gt; </code></pre> <p>and I have a jquery statement to change its value:</p> <pre><code> $('div.total-title').html('test'); </code></pre> <p>But it doesn't work.</p>
jquery
[5]
1,709,256
1,709,257
Jquery Exit Popup
<p>I'm trying to use this tweak for my blog: <a href="http://www.tonylea.com/2011/creating-a-jquery-exit-popup/#comment-909" rel="nofollow">http://www.tonylea.com/2011/creating-a-jquery-exit-popup/#comment-909</a></p> <p>Basically what it does is the popup should be showing up only when your mouse is moving upward out...
jquery
[5]
1,183,640
1,183,641
Problem using Conditional Operation with Nullable Int
<p>A small problem. Any idea guys why this does not work?</p> <pre><code>int? nullableIntVal = (this.Policy == null) ? null : 1; </code></pre> <p>I am trying to return 'null' if the left hand expression is True, else 1. Seems simple but gives compilation error - </p> <p>Type of conditional expression cannot be deter...
c#
[0]
639,817
639,818
How to manage AI actions based on percentages
<p>I am looking now for some time about how can a programmer simulate a AI decision based on percentages of actions for the final fantasy tactic-like games (strategy game).</p> <p>Say for example that the AI character has the following actions:</p> <p>Attack 1: 10%<br /> Attack 2: 9%<br /> Magic : 4%<br /> Move : 1%<...
c#
[0]
2,753,714
2,753,715
Get image width and height without downloading in PYTHON
<p>Is there anyway to get image width and height without downloading from original location in PYTHON. I have an idea how to get image info when it is in our server. Buy no idea this can do with online resource image in PYTHON. </p> <p>Finally done this as follow in python. Anyway have to download and get image info</...
python
[7]
1,745,770
1,745,771
Generate GUID with random length
<p>I need to generate random string for my automated tests. I use the following <em>Chinese</em> custom class to do it.</p> <pre><code>public class UniqueIdGenerator { static public string GenerateUniqueId(int idLength) // generates uniqueID for all fields (0-175 characters) { string uniqueID = ""; ...
c#
[0]
2,964,614
2,964,615
Java, comparing singlecharacter string to character
<p>Is there an easy way of comparing a string (which you know to contain only a single character) to a character? The method I am currently using feels a bit "clunky". </p> <pre><code>c == "x".charAt(0) </code></pre> <p>Where c is a character. The reason I am using "x" (string) is because I don't know how to write x ...
java
[1]
5,549,031
5,549,032
Show/Hide divs using Jquery
<p>I am having issues showing one div then hiding the previous div. </p> <pre><code>var newElem = '#ID' + numVariable; $('.elemPropGlobal').hide(); $(newElem).click(function (){ $('.elemPropGlobal').hide(); $($(this).attr('id') + 'Properties').show(); } </code></pre> <p>Divs that I click on</p> <pre><code...
jquery
[5]
829,531
829,532
add items to list via button click in jquery
<p>I have a select list and need to append each selected value/text to a list on a button click. Here is some pseudo code</p> <pre><code> $("#addButton").click(function () { var selectedValue = "..." var selectedText = "..." //todo append each selected value &amp; tex...
jquery
[5]
4,877,022
4,877,023
How can I listen when my view is scroll out of visible region
<p>In my android application, I have a scroll view which has a lot of children view. How can I listen for an event when a view is switching from visible to 'non visible to user' due to user's scroll action? </p>
android
[4]
512,318
512,319
activity does not close after taking picture Android
<p>Hi i have used SurfaceView and taking picture by below code</p> <p>First i am starting activity by this code</p> <pre><code> startActivityForResult(new Intent(PictureEditor.this, CustomCamera.class), CAMERA_REQUEST3); </code></pre> <p>and then getting result from this code </p> <pre><code> @Override publi...
android
[4]
4,279,681
4,279,682
Javascript : problem in html page rendering
<p>when i am rendering a page I have a confirm button that pops up before the page is fully rendered . now if i delay in choosing an option from the confirm box my page is left half rendered and if i select an option from the confirm box quickly the page is fully rendered. Why is this happening?</p>
javascript
[3]
5,572,432
5,572,433
When should I use non-member operator overloading?
<p>Should I be using non-member overload or member overload? How do I tell which I should use?</p>
c++
[6]
2,630,006
2,630,007
Trigger facebook send button on click of button
<p>I want to trigger facebook send button on click of another button. For more clarification- "I want to trigger send button on click of test button" on "59.144.174.74/test1.html" which is test link</p>
javascript
[3]
1,545,941
1,545,942
I want to form a m x n matrix by giving some numbers as input in c#
<p>HI,</p> <p>suppose i have given input numbers like this 1,2,3,4,5,6,7,8,9,0</p> <p>i should form it as 3 x 3 matrix but my input has 10 elements how to form a matrix for such input in c#</p>
c#
[0]
4,372,301
4,372,302
Python: Find out what method on derived class called base class method
<p>Hope the title isn't to confusing wasn't sure how I should put it. I wonder if it's possible for the base class to know which method of the derived class called one of it's methods. </p> <p>Example:</p> <pre><code>class Controller(object): def __init__(self): self.output = {} def output(self, s): ...
python
[7]
5,598,856
5,598,857
Android handler skip/jump a second
<p>I am trying to implement a simple digital clock with second and two colons changing every second. I have thought about using DigitalClock but I want the colons to flash as well as the second and don't want to show am/pm. So I read the "Updating the UI from a Timer" and it suggests us to use Handler. So i use Handler...
android
[4]
1,965,020
1,965,021
selecting a char in jquery
<p>I got a question,</p> <pre><code>&lt;a id="shoppingLink1" href="?page=bestellen&amp;amp;action=add&amp;amp;id=2"&gt; &lt;img src="images/shoppingcartButton.png" class="shoppingButton" alt="shoppingcartButton" title="shoppingcartButton"/&gt; &lt;/a&gt;&lt;br/&gt; </code></pre> <p>in jquery, when i click on the s...
jquery
[5]
467,919
467,920
Access member of class from a constructor of another class
<p>My code looks something like this:</p> <p>main.cpp</p> <pre><code>#include &lt;iostream&gt; #include "A.h" #include "B.h" using namespace std; int main(){ int d,f; A c(); d = c.GetStuff(); B *d = new C(); f = d-&gt;Get(); return 0; } </code></pre> <p>A.h</p> <pre><code>#ifndef A_H #define A_H class A { int a...
c++
[6]
4,948,914
4,948,915
Calling a function from another javascript file
<p>I have javascript file in following directory </p> <pre><code>/static /handler.js /evercookie.js /jquery.js </code></pre> <p>All I want to do from handler.js function call a function in evercookie.js. for example<br> in <code>handler.js</code> </p> <pre><code> var ec = new evercookie(); ...
javascript
[3]
3,503,052
3,503,053
Is there a way to enter text into a website with python?
<p>Basically, I need to make a python program that can go to a website and enter text. <br> For example, going to google and entering text into the search box and then pressing enter.<br> Is that even possible?</p>
python
[7]
2,560,008
2,560,009
Comparing two arraylists with multiple set fields
<p>I am trying to compare two ArrayLists, but I can't seem to get it work.</p> <p>Suppose:</p> <p>My main arrayList called List 1 gets its value through:</p> <pre><code> ArrayList&lt;xTypeClass&gt; List1 = new ArrayList&lt;xTypeClass&gt;(); xTypeClass tmp = new xTypeCLass(); tmp.setName(name); tmp.setaddress(a...
java
[1]
5,754,473
5,754,474
Android HTTP Post,Get Delete
<p>My application uses a HTTP Connection to send requests and read responses from the server. I used </p> <pre><code> conn = (HttpURLConnection) new URL(strUrl).openConnection(); conn.setConnectTimeout(Constants.CONNECTION_TIMEOUT); conn.setReadTimeout(Constants.SOCKET_TIMEOUT); conn.setRequestProperty...
android
[4]
1,154,603
1,154,604
jQuery error: Status: 'error'. Error code: 500 while performing an edit in jqgrid
<pre><code>navGrid('#pager',{view:false,del:true}, { afterComplete: function(response){ alert(response.responseText); } }, { afterComplete: function(response){ alert(response.r...
jquery
[5]
5,176,246
5,176,247
Extracting last two characters from a numeric string
<p>Okay. Say I have string</p> <pre><code>'193' </code></pre> <p>And I want to remove the last numbers and store them in an array so I can do operations with them. I know substr can delete the 2 characters, but I'm not sure how to store them after they've been removed..</p>
php
[2]
2,278,084
2,278,085
Stich Images to Video without NDK
<p>Is there a way in the Java Android SDK to take a series of images and "stitch" them into a video? For example, if there are 50 different images how can you take them and make a video (any format mpg, ogg, etc) out of it. I saw a couple of posts here about doing it with the NDK, but I know nothing about it and would ...
android
[4]
2,475,844
2,475,845
converting str to int and vice versa
<p>I have a need to convert a string to an int and back after doing some processing. And the string has to be in words like below:</p> <p>45 - forty five<br> 99 - ninety nine</p> <p>I searched everywhere for a hint but couldn't find any. I know the obvious switch-case logic but I am curious if theres a more intellige...
python
[7]
3,041,710
3,041,711
How to start manage application screen in android
<p>I want to start manage application(Settings->Application->manage application) screen programatically. I am unable to do it. Can anyone please help me?</p> <p>Thanks in advance.</p>
android
[4]
519,841
519,842
jQuery .animate
<p>I have the following issue: a list item that once clicked, a div slides up and changes opacity to 1. My goal is that on second click, the same div will get opacity 0.</p> <p>I tried removing the original class and adding a new one, "selected" and then apply a click event on that. For some reason, the second part is...
jquery
[5]