Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
4,010,978
4,010,979
Scan or read text to initiate a video clip
<p>I need help in playing video by scanning a text message. I have been googling however, the only thing which I am getting is through QR codes. Please let me know if its possible or not. If possible can you please share examples of the same or sites to refer. I am working on iOS to develop this program.</p> <p>Regards,</p> <p>Mike </p>
iphone
[8]
4,229,443
4,229,444
where is the file when use getCacheDir
<p>As I debugged, I found that the GetCacheDir return <code>/data/data/yourapp/cache/</code></p> <p>But as I store files, I found nothing in that path(with shell), but in <code>/sdcard/Android/data/yourapp/cache/</code> I found the cache file? who can tell me why?</p>
android
[4]
12,779
12,780
mysql any array sorting problem
<p>I have some users listed below in an order:</p> <p>user1 user2 user3 user4 user5</p> <p>This is just a simple list, sorted according to age.</p> <p>Now a new user (user6) comes in, and according to the sorting, he fits after user 2, so the order becomes like:</p> <p>user1 user2 <strong>user6</strong> user3 user4 user5</p> <p>Now I want to know at which position it is. For example it is on place3. How can i find its position when a new user comes in the list?? Please tell any general way? there is no any database etc, just a logic question. </p>
php
[2]
4,416,433
4,416,434
Non related activities
<p>Is there any way to suppress or kill all activities and non crucial applications and background processes not related to a current activity?</p> <p>I have an app that runs in real time and there are occasional intermittent timing hiccups which I am attributing to this.</p>
android
[4]
3,894,942
3,894,943
sending data from script to .cs page
<p>i am getting values from .cs to script but i want to send data from script to .cs page i have tried this,but it is not working.</p> <pre><code> &lt;script type="text/javascript"&gt; $(document).ready(function() { $("hfServerValue").val("From ClientSide!"); }); &lt;/script&gt; &lt;asp:HiddenField ID="hfServerValue" runat="server" /&gt; protected void Page_Load(object sender, EventArgs e) { Response.Write(hfServerValue.Value.ToString ()); } </code></pre>
asp.net
[9]
1,155,353
1,155,354
How do I hide a adjacent div when I mouseout of a menu item, using JQuery?
<p>I was wondering how I could reverse the click triggered in this function on 'mouseout' of 'a.menu-arrow'? See code below:</p> <pre><code>$(".menu-arrow").hover(function() { $.data(this, "timer", setTimeout($.proxy(function() { $(this).click(); }, this), 500)); }, function() { clearTimeout($.data(this, "timer")); }); </code></pre> <p>What happens is after 0.5 of a second of hovering over a.menu-arrow...a click is triggered showing a adjacent div containing the submenu. This is how the HTML is structured unfortunately.</p> <p>Any help would be greatly aprreciated. </p> <p>Sorry I'm a novice at JavaScript &amp; JQuery</p>
jquery
[5]
5,599,613
5,599,614
Can failing javascript on a web page cause all other scripts to fail?
<p>I suspect that a 3rd party analytics script on our page is causing our Google Adwords conversion script (later in the page) not to run where the a fore mentioned analytics fails to load external resources.</p> <p>What is the standard behavior for a web browser in this scenario? Can subsequent scripts fail to run even if in separate tags?</p>
javascript
[3]
1,014,915
1,014,916
When and how to exit file uploader service
<ol> <li><p>I have a class that implements fileuploader service. Activites bind to it and supply it a list of files to be uploaded, and then unbind immediately. The files are then uploaded one-by-one by the service in a background thread(asynctask).</p></li> <li><p>I start this service in my dashboard actvity using startService(), so that it keeps running until specifically stopService() is called.</p></li> <li><p>Now, my question is when do I stop this service?</p></li> </ol> <p>Basically I need to check two conditions: 1: all files are uploaded; 2: app has exited. Also, to exit the App, user has to press back button on dashboard activity.</p> <p>I could have overrided back button press and queriesd the service whether any files are left, but I dont want to use that method.</p> <p>Any suggestions?</p>
android
[4]
834,712
834,713
Quickie regular expression stuck
<p>I have a line of stringy goodness:</p> <pre><code>"B8&amp;amp;soundFile=http%3A%2F%2Fwww.example.com%2Faeero%2Fj34d1.mp3%2Chttp%3A%2F%2Fwww.example.com%2Faudfgo%2set4.mp3" </code></pre> <p>Can I use regular expressions to just extract the http up to mp3 for all times it exists?</p> <p>I have tried reading the documents for regular expressions but none mention how to go FROM http to mp3. Can anyone help?</p>
java
[1]
1,734,772
1,734,773
Retrieve Barcode Images one by one from PDF
<p>I have created one pdf in which there is list of barcode images.I have to select one by one barcode image from it and have to send it to printer.So that I can take print out of each barcode image and use it as a sticker.How should I do that?</p>
java
[1]
3,528,075
3,528,076
meta tag for compatibility view removed
<p>I have developed aspx page. Everything works fine in standard mode. However the page looks ugly in the compatibility mode. I researched and added the below meta tag in head section :</p> <pre><code>&lt;meta http-equiv="X-UA-Compatible" content="IE=8" /&gt; </code></pre> <p>which corrected the problem. However the meta tag is removed automatically after hosting. Not sure what is the problem. Please help.</p>
asp.net
[9]
4,224,517
4,224,518
Unable to permanently change selector with jquery due to page refresh
<p>I have a list of links to pages on my site. I want the links to change how they look (become bold) when the user clicks on them. I have set a default value for the "Home" link so when a user first goes to the website the "home" link is bold. The problem is, whenever another link is clicked I can see that it changes very briefly to bold, but then defaults back to the "Home" link being bold, since that is the default value that is hard-coded in to the website. How can I change this so that the link that is made bold is the link of the page the user is currently on (not always defaulting back to the "Home" link being bold)? Thanks so much for any assistance!</p> <p>Here is the html:</p> <pre><code>&lt;table class="sidebar_table"&gt; &lt;tr class="option"&gt; &lt;td class="select selected"&gt;image&lt;/td&gt; &lt;td&gt;&lt;a href="my_website_link"&gt;A Link&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>Here is the jquery code I'm using:</p> <pre><code>$('tr.option').click(function () { $('tr.option td.select').removeClass('selected'); $(this).find('td.select').addClass('selected'); }); </code></pre>
jquery
[5]
5,797,993
5,797,994
how to get context in to other class
<p>i have <code>public class ExperimentAllInOneActivity extends Activity implements OnClickListener</code> on each button click listener i want to go some other class like <code>public class TemperatureStrategy</code> and perform all logic calculation in this class but main thing is that i have class like <code>public class DialogDisplay extends Dialog implements OnItemSelectedListener</code> in this class a custom dialog is created. Now I have question is that on each button onclick listener I want to call(display) this custom dialog class in, spinner class and like that type of element, and all logic performed with class TemperatureStrategy. How to build constor and pass context of all class?</p>
android
[4]
999,325
999,326
Access Post and Get variables in a server control class
<p>I need to access post and get variables inside a server control class, there is no access to Request object in server control class...</p>
asp.net
[9]
1,374,073
1,374,074
Loking for some good and simple jquery tutorials
<p>I want something that's simple, in-depth and explains from basics. </p>
jquery
[5]
5,524,801
5,524,802
include typedef inside a class header
<p>I'm a cpp newbie and i have a little question:</p> <p>this is my header:</p> <pre><code>#ifndef TIMING_H #define TIMING_H #define MAX_MESSAGES 1000 typedef Message* MessageP; //inside the class? class Timing { public: Timing(); private: struct Message { Agent *_agent; double _val; }; MessageP* _msgArr; int _waitingMsgs; }; </code></pre> <p>my question is do i have to place the typedef inside the class block right above MessageP* _msgArr or is it ok to place it near all the #define..<br> it doesn't output compilation errors so i'm not sure about it..</p> <p>Thanks</p>
c++
[6]
381,032
381,033
how to add numarical values to javascript variable?
<p>I'm trying to add <code>1</code> to my JavaScript variable, but the following code is giving me an error:</p> <pre><code>var val1 = document.getElementById('&lt;%= rng1.ClientID %&gt;'); var val2 = val1.value + "1"; alert(val2.value); </code></pre> <p>How can I do this?</p>
javascript
[3]
5,473,367
5,473,368
Phone Call On TextView Click
<p>How to make a phone call in android when user Click on textView then automatically dail a number in textView ?</p> <pre><code> TextView tv=(TextView) findViewById(R.id.tv_contact); String url = tv.getText().toString(); Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(url)); tv.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub startActivity(intent); } });' </code></pre>
android
[4]
3,235,502
3,235,503
Best way to store an image from a url in php?
<p>I would like to know the best way to save an image from a URL in php.</p> <p>At the moment I am using </p> <pre><code>file_put_contents($pk, file_get_contents($PIC_URL)); </code></pre> <p>which is not ideal. I am unable to use curl. Is there a method specifically for this?</p>
php
[2]
1,506,691
1,506,692
what to do with BufferedWriter object when writing to a file in external storage
<p>i am writing a string to a file in android using :</p> <pre><code>BufferedWriter writer = new BufferedWriter(new FileWriter(order)); writer.append(placedOrder); </code></pre> <p>whether i use </p> <pre><code>writer.write(placedOrder); // or writer.append(placedOrder); </code></pre> <p>the data of the file is erased every time i run this code. I want to add the data to the end of file.</p> <p>Ex: When i run first time :</p> <pre><code>file output My </code></pre> <p>Ex: When i run second time :</p> <pre><code>file output becomes My Name </code></pre> <p>Ex: When i run third time :</p> <pre><code>file output My Name is </code></pre> <p>Ex: When i run fourth time :</p> <pre><code>file output My Name is Hisham. </code></pre> <p>and so on. Like having a record of all previous outputs.</p>
android
[4]
1,548,393
1,548,394
RFC 2246 PRF function in PHP
<p>I've been looking all over for an implementation of the PRF function from RFC 2246. I've found three. One <a href="http://stackoverflow.com/questions/13324785/openssl-prf-function">here</a>, one from the openSSL library, and one from wpa_supplicant. They all return different results. So my first question is: is there sample PRF input and sample PRF output somewhere?</p> <p>That function is part of connecting to a .NET web service (protected with WS-Security) from PHP.</p> <p>What I've found so far is this. My client sends a request for a token first with a username/password and a nonce -- that's an RST. The server, in its RSTR, responds with another nonce and a security token. The next request from my client should come with a signature whose key is derived from the two nonces and a "master secret". That derived key is computed according to RFC 2246. And that's why I need a reliable implementation of it.</p> <p>Even if I have a reliable implementation of it, what would constitute the parameters to that function in the context of WS-Security? The PRF function should take three parameters, i.e.:</p> <p><strong>secret, label, seed.</strong></p> <p>I've read <a href="http://www.codeproject.com/Articles/16427/Digging-into-SecureConversation-Part-I" rel="nofollow">here</a>, that the label Microsoft uses is "WS-SecureConversationWS-SecureConversation", but that article was written in 2006... Now, what would be the secret? Is it the original password? The security token? A combination of those? Finally, what would be the seed? I have two nonce's -- do I concatenate them, OR them, XOR them?</p> <p>I'm seriously stuck. Any help greatly appreciated.</p>
php
[2]
2,308,715
2,308,716
Best way to share data between classes in Java
<p>Here is the scenario: I generate Random Data in one class and use it as an argument in a method in the same class. How can i use the exact same value in another class ?</p> <p>Here is a simplified version of my classes:</p> <pre><code>public class A { @Test public void aMethod() { RandomStringUUID ruuid = new RandomStringUUID(); } } </code></pre> <p>Then:</p> <pre><code>public class B { @Test public void bMethod() { // Want to use ruuid , without instantiating RandomStringUUID // as i dont want new values, i want the one from class A } } </code></pre>
java
[1]
5,022,881
5,022,882
Make a regex upto the end of the string?
<p>I have:</p> <pre><code>$string='#229: Tomato Soup Menu'; preg_match_all('/: (.+?)*/', $string , $arr); </code></pre> <p>I'm trying to make the return just "Tomato Soup Menu". That is everything after the colon space, until the end of the string.</p> <p>Any ideas?</p>
php
[2]
1,874,688
1,874,689
Is Dive Into Python outdated?
<p>I am learning Python, and I saw Dive Into Python and it looks cool and all, but it was released in 2004. So, what I am wondering is if Python 2.x has changed enough since 2004 that Dive Into Python has become so obsolete. And are there any more recent online textbooks like that for Python that can get me to become an awesome programmer?</p>
python
[7]
3,361,825
3,361,826
My Java Program is not working
<p>I'm not so good at programming and can't tell why this isn't working. Whatever I input, it always go straight to the else statement.</p> <pre><code> public void pizzaIntro() { Scanner user_input = new Scanner(System.in); String user_command = "null"; String apology = "I'm sorry it appears there has been some kind of mistake in your order."; System.out.println("Welcome to " + cM + " here we strive to deliver excellent services to all our customers!"); System.out.println("The current prize for pizza is $" + bP + " and an extra $" + tP + " per topping."); System.out.println(); System.out.println(); while(user_command != "exit") { System.out.print("Would you like toppings?(yes/no):"); user_command = user_input.next(); if(user_command.toLowerCase() == "yes") { System.out.println("Good Eat Your Pizza."); } else if (user_command.toLowerCase() == "no") { System.out.println("Well Ok Then!"); } else { System.out.println(apology); System.exit(1); } } pic1.show(); } </code></pre>
java
[1]
4,693,327
4,693,328
Object is same but the output is different ? please help
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/594604/string-equality-vs-equality-of-location">String equality vs equality of location</a> </p> </blockquote> <pre><code>public class AboutStrings{ public static void main(String args[]){ String s1="hello"; String s2="hel"; String s3="lo"; String s4=s2+s3; //to know the hash codes of s1,s4. System.out.println(s1.hashCode()); System.out.println(s4.hashCode()); // these two s1 and s4 are having same hashcodes. if(s1==s4){ System.out.println("s1 and s4 are same."); }else System.out.println("s1 and s4 are not same."); } } </code></pre> <p>In the above example even though s1 and s4 are refering to same object(having same hash codes),</p> <p>it is printing s1 and s4 are not same.</p> <p>Can anybody explain in detail why it is behaving like this?</p>
java
[1]
5,354,085
5,354,086
Why do I get error can't multiply sequence by non-int of type 'float' PYTHON
<p>I wrote a simple program to calculate tax for some electrical parts, it goes like this:</p> <pre><code>print "How much does it cost?", price = raw_input() print "Tax: %s" % (price * 0.25) print "Price including tax: %s" % (price * 1.25) raw_input ("Press ENTER to exit") </code></pre> <p>And I keep getting this error:</p> <pre><code>Traceback (most recent call last): File "moms.py", line 3, in &lt;module&gt; print "Tax: %s" % (price * 0.25) TypeError: can't multiply sequence by non-int of type 'float' </code></pre>
python
[7]
2,789,366
2,789,367
eval python after read file
<p>I have a problem with eval. My code read a file and then eval file's content. In Python 2.7 this operation is ok, but in python 2.5 is not ok. Is it a problem of encoding? This is my code, where self._file_dates is my file:</p> <pre><code>import string import datetime col_file = open(self._file_dates,"r") columns_file = col_file.read() col = eval(columns_file) col_file.close() </code></pre> <p>The message error is: <code>invalid syntax (&lt;string&gt;, line 1)</code></p> <p><code>self._file_dates</code> looks like this:</p> <pre><code>[[datetime.date(2009, 2, 5), datetime.date(2009, 2, 6), datetime.date(2009, 2, 9)], [datetime.date(2009, 3, 5), datetime.date(2009, 3, 6), datetime.date(2009, 3, 9)]] </code></pre>
python
[7]
1,446,851
1,446,852
PHP script for upload
<p>I have written a script in PHP which is supposed to enable yuo to upload files. However, it can't seem to move the file to the right folder after it has uploaded it. Can anyone see what the problem is?</p> <p>Here is the code:</p> <pre> <code> echo 'This is upload.php'; $target_path = 'wwwroot/rsfleet.co.uk/ipad_test/sub/'; echo 'Size of file: '; echo $_FILES['userfile']['size']; $target_path = $target_path . basename($_FILES['userfile']['name']); echo $target_path; if (is_uploaded_file($_FILES['userfile']['tmp_name'])) { echo 'File uploaded OK.'; } else { echo 'Problem with file upload.'; } if (move_uploaded_file(basename($_FILES['userfile']['tmp_name']), $target_path)) { echo 'The file ' . basename($_FILES['userfile']['name']) . ' has been moved'; } else { echo 'Error moving file. Please try again.'; } echo 'End of page.'; </code> </pre>
php
[2]
830,795
830,796
Resource for C++
<p>It has been a long time since I've used C++. I want to start programming in C++ again but I am looking for a particular resource and wondering if anyone here has any good references. I am looking for a book, web tutorial, video...whatever that teaches you C++ while you're building an application. So, for example, a book might start the book by starting the application.. and so on. Does anyone have a good reference? Thanks</p>
c++
[6]
3,662,263
3,662,264
Refresh a ListView if I change the content of the ListItem
<p>I have a ListView in my android activity. And I populate the ListView by sub-class the BaseAdaptor (which returns a View in getView() method).</p> <p>What if in my click listener of a button in a list item view, I </p> <ul> <li>change the text of the TextView in the List item view or</li> <li>change the dimension of the list item view by adding/removing children of the list item view</li> </ul> <p>What is an efficient to refresh my listView? I don't want the listView to re-trigger a query since there is no data change.</p> <p>Thank you.</p>
android
[4]
2,467,171
2,467,172
How do i create an email this page form for my website?
<p>I was looking on how to create a recommend this page form that sends the given pages URL address and where the user can enter their email address and a message however long and a single email address or multiple addresses where the user wants to send the recommend this page to.</p> <p>I was wondering if anyone knew what code I could use. I am currently using PHP as my server side language.</p> <p>I wanna know how to code my own form?</p>
php
[2]
4,247,053
4,247,054
C++ exercises for beginners
<p>I have just come across this collection of programs for beginners:</p> <p><a href="http://www.cplusplus.com/forum/articles/12974/" rel="nofollow">http://www.cplusplus.com/forum/articles/12974/</a></p> <p>Does anyone know of a similar source of practice but with some sample answers previously-written? To make sure you have got it right, so you can move on confidently...</p> <p>Thanks, </p>
c++
[6]
5,480,361
5,480,362
Hover over parent element shows href of child a element
<p>I've created a list item element that contains a child anchor element.</p> <pre><code>&lt;ul id="machine-list"&gt; &lt;li&gt; &lt;a href="gosomewhere"&gt;Somewhere&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Using jQuery I'm binding a <code>click</code> event to the list item. When the user clicks I'm grabbing the first anchor tag's href attribute and moving the user to that page.</p> <p>While this works nicely I'd like to simulate the same hover effect that hovering over a link usually has: showing the referenced link in the status bar. Unfortunately <code>window.status</code> is not getting it done.</p> <pre><code>$(document).ready(function () { $('#machine-list &gt; li') .css('cursor', 'pointer') .click( function (e) { window.location = $(e.target).find('a').attr('href'); }) .mouseover( function (e) { window.status = $(e.target).find('a').attr('href'); }); }); </code></pre> <p>What should the function in <code>.mouseover</code> look like to get the desired effect? The above code is down and dirty so any general feedback would also be appreciated.</p>
javascript
[3]
721,050
721,051
Keyboard screen is not coming while typing in iphone
<p>I am integrating facebook api in my application. It was working fine. I just import code in my other class. When I am trying to logged in I am not able to press keys on textbox and also keyboard screen is not coming. </p> <p>But when I am clicking to alternative login link. I am able to typed there but after clicking on "Login" button I am seeing an error "Safari can't open ... ".</p> <p>What about the above 2 reason ? Thanks in advance</p>
iphone
[8]
3,423,699
3,423,700
JQuery: using delay with html or text setting doesnt work
<p>i have strange problem with the delay function here using the html function with it.</p> <p>I set a html text by using <code>$( '#element').html( 'Hello World');</code></p> <p>After setting the text i want to get this text disappear in 3 seconds.</p> <p>So next line i wrote:</p> <pre><code>$('#element').delay( 3000).html( '&amp;nbsp'); </code></pre> <p>This one doesnt work, it sets the html to <code>&amp;nbsp</code> without waiting the 3 seconds, it looks like jquery is skipping the delay function. Using this with fadeOut for example works fine. I guess this has something to do with this queue thing in delay.</p> <p>But why doesnt this work. Its a pretty simple, wait 3 seconds then run the html function.</p> <p>Could anybody advise? Thanks.</p> <p>PS: For your info, i use jQuery 1.4.2</p>
jquery
[5]
4,873,066
4,873,067
Android project as Jar Library
<p>I am currently working on a Android Project where we are expected to merge our App with 2 more apps from vendors who wouldn't be sharing their code.So just wanted to know Is there any way we could just include there Source code as JAR Files in our project and then include their resources and point to them(I did do it using getResources().getIdentifier("splash", "layout", getPackageName()) But Its still not working ?? I think I have tried all possible methods so hoping you guys could help me with this.</p>
android
[4]
2,272,693
2,272,694
Error: "an object reference is required for the non-static field, method or property..."
<p>Im creating an application on C#. Its function is to evualuate if a given is prime and if the same swapped number is prime as well. When I build my solution on Visual Studio, it says that "an object reference is required for the non-static field, method or property...". Im having this problem with the "volteado" and "siprimo" methods. Can you tell me where is the problem and how i can fix it? thank you! </p> <pre><code>namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.Write("Write a number: "); long a= Convert.ToInt64(Console.ReadLine()); // a is the number given by the user long av = volteado(a); // av is "a" but swapped if (siprimo(a) == false &amp;&amp; siprimo(av) == false) Console.WriteLine("Both original and swapped numbers are prime."); else Console.WriteLine("One of the numbers isnt prime."); Console.ReadLine(); } private bool siprimo(long a) {// evaluate if the received number is prime bool sp = true; for (long k = 2; k &lt;= a / 2; k++) if (a % k == 0) sp = false; return sp; } private long volteado(long a) {// swap the received number long v = 0; while (a &gt; 0) { v = 10 * v + a % 10; a /= 10; } return v; } } } </code></pre>
c#
[0]
4,308,662
4,308,663
Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive
<p>I'm trying to up load my site and I'm getting this error message:</p> <blockquote> <p>Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.</p> </blockquote> <pre><code>&lt;compilation debug="true" targetFramework="4.0"&gt; </code></pre> <p>The site works fine on my local pc but won't open when I loaded it to my host at tried to view it on line. </p>
asp.net
[9]
4,026,549
4,026,550
didFinishLaunchingWithOptions not being called
<p>the method didFinishLaunchingWithOptions is not being called when i launch via push notification on a multitasking OS4.1 3GS device. I just get AppdidEnterForeground called. Is this the way it is on a multitasking device. The docs don't say this. If it is not called how do i access the launchOptions dict.</p> <p>Thanks</p>
iphone
[8]
4,147,109
4,147,110
Changing the color of a pixel
<p>i am able to read a particular pixel at given CGPoint but i have been looking to change the color of a pixel and it would be highly appreciated if anyone can help me out with a code snippet.</p> <p>My Code is:</p> <pre><code>unsigned char* data = CGBitmapContextGetData (cgctx); if (data != NULL) { offset = 4*((w*round(point.y))+round(point.x)); alpha = data[offset]; red = data[offset+1]; green = data[offset+2]; blue = data[offset+3]; color = [UIColor colorWithRed:(red/255.0f) green:(green/255.0f) blue:(blue/255.0f) alpha:(alpha/255.0f)]; } </code></pre>
iphone
[8]
1,095,012
1,095,013
PHP specifying a fixed include source for scripts in different directories
<p>I am currently doing unit testing, and use folders to organize my test cases. All cases pertaining to managing of user accounts, for example, go under \tests\accounts. Over time, there are more test cases, and I begin to seperate the cases by types, such as \tests\accounts\create, \tests\account\update and etc.</p> <p>However, one annoying problem is I have to specify the path to a set of common includes. I have to use includes like this:</p> <pre><code>include_once ("../../../../autoload.php"); include_once ("../../../../init.php"); </code></pre> <p>A test case in tests\accounts\ would require change to the include (one less directory level down). Is there anyway to have them somehow locating my two common includes? I understand I could set include paths within my PHP's configurations, or use server environment variables, but I would like to avoid such solutions as they make the application less portable and coupled with another layer which the programmer can't control (some web-host doesn't allow configuration of PHP's configuration settings, for example)</p>
php
[2]
3,888,891
3,888,892
JavaScript - passing string as an object property
<p>Just FYI this code is part of ExtJS 4 script. I have a global setting which I use to show the path to the dir where my icons are. I'm making some modifications so before was:</p> <blockquote> <p>g_settings.iconUrl</p> </blockquote> <p>but now I need to pass a third argument property like this:</p> <blockquote> <p>g_settings.iconUrl.docIcon</p> </blockquote> <p>The problem I met is where I have an <code>if</code> statement where I check for different values:</p> <blockquote> <p>if (extensions == 'doc'||extensions == 'docx'||extensions == 'xlsx'||extensions == 'xls)</p> </blockquote> <p>and then I do:</p> <blockquote> <p>extensions += 'Icon';</p> </blockquote> <p>and I need to use:</p> <blockquote> <p>g_settings.iconUrl.extension</p> </blockquote> <p>when I use <code>console.log(extensions)</code> it's value is as expected (for example <code>docIcon</code>) but when I try to use it as a property it doesn't work. If I use console.log on:</p> <blockquote> <p>console.log(g_settings.iconUrl+ '.' +extensions)</p> </blockquote> <p>the output is <code>[object Object].docIcon</code> so I think I have to convert somehow <code>extensions</code> to object too. I'm not sure that this will solve the problem but that's what I have for now.</p> <p>Any suggestions?</p> <p>Thanks</p> <p>Leron</p>
javascript
[3]
4,479,370
4,479,371
Generating a characterized unique id in Python
<p>am planning to create a unique ID from characters and numbers as well. The ID should look something like this</p> <p>XXXX-XXXX-XXXX-XXXX</p> <p>where X is a combination of numbers, small and cap letters. This Id will be stored in a mysql database and will be incremented to maintain consistency of data. </p> <p>Any advice on how to start?</p>
python
[7]
1,541,429
1,541,430
ASP.net problem with changing table row visibility
<p>i have a table array dynamically generated from a data query and stored in a session variable. Now i wanna add a textbox to limit how many rows at a time i will display. To test this, i wrote two button methods, one will set some rows to be visible = false, and the second button method will set the same rows back to visible = true.</p> <pre><code>protected void limit_btn_Click(object sender, EventArgs e) { for (int i = 0; i &lt; traceTables.Length; i++) for (int j = 2; j &lt; traceTables[i].Rows.Count; j++) traceTables[i].Rows[j].Visible = false; Session["Tables"] = traceTables; table_C(); }//end limit_btn_Click() protected void obo_btn_Click(object sender, EventArgs e) { for (int i = 0; i &lt; traceTables.Length; i++) for (int j = 2; j &lt; traceTables[i].Rows.Count; j++) traceTables[i].Rows[j].Visible = true; Session["Tables"] = traceTables; table_C(); }//end obo_btn_Click() protected void table_C() { String changeTo = log_locations.SelectedValue; for (int i = 0; i &lt; sshLoc.Length; i++) { if (sshLoc[i].CompareTo(changeTo) == 0) { table_panel.ContentTemplateContainer.Controls.Remove(traceTables[currentTable]); System.Diagnostics.Debug.WriteLine("Removing " + sshLoc[currentTable]); table_panel.ContentTemplateContainer.Controls.Add(traceTables[i]); System.Diagnostics.Debug.WriteLine("Adding " + sshLoc[i]); currentTable = i; Session["CurrentTable"] = currentTable; break; }//end if }//end for }//end table_C() </code></pre> <p>table_C() basically removes and adds the table from the panel - i use it when i want to switch between tables from a dropdown list (which works) and in this case it simply removes and adds the same table from the panel content container.</p> <p>The problem is that setting the rows to be not visible works fine. Setting the rows back to visible never does, and i'm not sure why</p>
asp.net
[9]
1,946,367
1,946,368
JQuery not sliding folder
<p>I am trying to get a iPhone looking folder menu bar. When i click each item (info tab_(number), it should open the appropriate "infotab_(number)_s" div. _s standing for "show". When one is open and the user click another item on the menu bar, it should close and open the one they clicked. My script doesn't open them, maybe I wrote something wrong.</p> <p>Here is my fiddle: <a href="http://jsfiddle.net/7FkqH/" rel="nofollow">http://jsfiddle.net/7FkqH/</a></p> <p>So basically if I click the first li with id of infotab_one, It should slide down, info tab_one_s. If I click info tab_two, it should close infotab_one_s and open infotab_two_s.</p> <p>If that doesn't make sense I will clarify if needed.</p>
jquery
[5]
5,978,247
5,978,248
Using another one application in one Iphone Application?
<p>anytutorial to use good reader application in iphone sdk? can I use Good reader application in my Iphone APplication?</p>
iphone
[8]
2,557,755
2,557,756
OCUnitTest Cases documentation
<p>i googled for OCUnitTestCase Documentation but dint find too much about it ... i am planning to create test case for my project. so can any one tell me rough estimation of how much time it will take for whole project</p>
iphone
[8]
5,083,474
5,083,475
Always return a value from a snippet of javascript
<p>The problem: taking an arbitrary string of javascript code and consistently returning a value from it and assigning it to a variable. I need to build up a string of javascript that, when evaled, will consistently set a variable to whatever the return value of the original arbitrary string of javascript would return. Example, this string of javascript:</p> <pre><code>if(typeof(something) !== "undefined"){ hello() } </code></pre> <p>This is how I'm trying to do it now (and yes, I know the above snippet would not return anything)</p> <pre><code>var result = (function(){ if(typeof(something) !== "undefined"){ hello() } }.call(this) </code></pre> <p>And thus result is undefined. How, in the above case and in all (or most) others, can I get a result that is not undefined?</p>
javascript
[3]
4,335,483
4,335,484
Android Orentation Changes
<p>I have a simple activity to make since of screen touches. What is strange is that the activity starts in whatever orientation i'm in but rotating the device does nothing at all.</p> <p>I am on an Acer A100 running Android 4.0.3</p> <p><a href="http://pastebin.com/A4KDH2e7" rel="nofollow">AndroidManifest.xml</a></p> <p><a href="http://pastebin.com/cFx4rqQa" rel="nofollow">SingleTouchTest.java</a></p> <p>The main activity is a listview that loads my separate system tests. I can run the SingleTouchTest activity without problems except rotation. I have tried every combination of:</p> <p><code>android:configChanges="keyboard|keyboardHidden|orientation" android:screenOrientation="unspecified"</code> </p> <p>and it does not auto rotate. I even removed the:</p> <p><code>public void onConfigurationChanged</code> function and nothing happens.</p>
android
[4]
1,872,625
1,872,626
IE - specific message
<p>I user SVG charts on my site. All but IE browsers have no problems with it. I would like to add a snippet of PHP code with message for IE users.</p> <p>I think I can get the agent info with PHP, but I'm not sure how to detect version. I believe IE 9 supports it now, so I need only for versions below 9.</p>
php
[2]
2,826,253
2,826,254
How I can convert my json data to html?
<p><strong>I have get</strong></p> <pre><code>$.getJSON('ajax/ajax-test.php', function( data ) { .... }); </code></pre> <p><strong>json data I am trying view</strong>:</p> <pre><code>{ "1": { "section":"painting", "category": { "1":"african", "2":"modern art" } }, "2": { "section":"antiques", "category": { "3":"ikons" } } } </code></pre> <p>How I can convert my json data to html to look like:</p> <p><strong>painting</strong><br> african<br> modern art</p> <p><strong>antiques</strong><br> ikons</p> <p>I tried</p> <pre><code>$.each(data, function(i, section_obj){ $.each(section_obj, function(section, category_arr){ content += category_arr+'&lt;br /&gt;'; }); </code></pre> <p>and</p> <pre><code>$.getJSON('ajax/ajax-test.php, function( data ) { var content = ''; $.each(data, function(i, section_obj) { $.each(section_obj, function(section, section_name) { content += section_name+'&lt;br /&gt;'; $.each(section_obj.category, function(category, category_arr){ content += category_arr+'&lt;br /&gt;'; }); }); }); $('#content-test').empty().append(content).css({ 'display':'block' }).show('slow'); }); </code></pre> <p>but it not working!</p>
jquery
[5]
3,321,806
3,321,807
How can I declare a 5x5 grid of numbers in Python?
<p>How would I declare this? I'm thinking something along the lines of:</p> <pre><code>boardPieces = ["A","O","A" "A", "A", "O" ] </code></pre>
python
[7]
2,612,293
2,612,294
How to insert a new line after a text in javascript
<p>i m appending text values in a string and on each iteration i want to move to a new line. my code is :</p> <pre><code>$lblEmployee.html($lblEmployee.html()+" "+ dataEmployees[i]["FirstName"] +" " + criteriaTestedEmployees[i]["LastName"]); </code></pre> <p>I tried putting <code>\n</code> at the end like :</p> <pre><code>$lblEmployee.html($lblEmployee.html()+" "+ dataEmployees[i]["FirstName"] +" " + criteriaTestedEmployees[i]["LastName"] + "\n"); </code></pre> <p>But it doesn't work.</p> <p>May someone pls suggest a way..Thanks in advance..</p>
javascript
[3]
3,551,449
3,551,450
Using an array as a hashmap key
<p>I am trying to use an Array as the keys in a HashMap. The arrays are of length two, so are essentially acting as a 2-tuple. Implementing a custom 2-tuple class is a very last resort. The problem is, I want arrays with the same contents map to different location in the HashMap if they have different memory locations. I know there are hashCode functions in Arrays.hashCode and Arrays.deepHashCode, but is there any way I can use these for a HashMap. As I already said, I really don't want to implement my own tuple class. </p>
java
[1]
1,992,023
1,992,024
Android sample app Radar, all the PNG files are bad?...no get the raw file
<p>not sure if others are experiencing this issue in the apps-for-android Sample Applications, but the Radar sample app PNG files are all bad...the Eclipse editor says: "libpng error: Not a PNG file"</p> <p>I've also checked these PNG files on a couple of different PC's and none of the graphic programs can open or render the PNG files:</p> <p>blip.png</p> <p>ic_menu_metric.png</p> <p>ic_menu_standar.png</p> <p>icon.png</p> <p>Here's the link to the sample app source for Radar, on the Google web site: <a href="http://code.google.com/p/apps-for-android/source/browse/#svn%2Ftrunk%2FRadar%2Fres%2Fdrawable" rel="nofollow">http://code.google.com/p/apps-for-android/source/browse/#svn%2Ftrunk%2FRadar%2Fres%2Fdrawable</a></p> <p><strong>Update:</strong> rummaging around on the web, it appears that perhaps my Google Chrome browser is downloading/transfer everything in ASCII mode, rather than binary format...hmmmm...I'll try FireFox. </p> <p>Well, it wasn't a browser thing...it appears that right-clicking on the PNG file on the Google app source folders, and doing a file-save-as is the wrong way to get these particular files. What I found that worked is to click the png file so could see the change-log screen, then there is a 'file info' section that shows a raw file link, and that file link download would finally render properly.</p>
android
[4]
1,888,886
1,888,887
Moving Functionality to a class library project - what to do with the related resources?
<p>I have a .net project whose part of the functionality is xls transformation.</p> <p>I now want to move that functionality away from the main project to a separate class library project.</p> <p>I have no problems moving classes and accessing them, but part of the resources that I wanted to move were xslt files that define the transformations. Those files were originally located in the special asp.net folder: <code>App_Data</code> and then accessed using <code>Server.MapPath(~/App_Data/XSLT/anXsltFile.xslt)</code></p> <p>I wanted to move those files to that separate library as well, but not sure how to approach it, and how to access those files within the class library.</p>
asp.net
[9]
716,157
716,158
Reading open processes/App list in Java?
<p>i was wondering is there any java system class or something that can read open running processes or least say the running applications on the OS. </p> <p>Like in a windows platform, we have CTRL+Alt+DEL to view the list. Can we have this info acquired in a java program? </p> <p>Thanks,</p>
java
[1]
3,267,697
3,267,698
ValidationEngine - Validation is bypassed when spaces are inserted
<p>When only spaces are entered in required field, the validation is bypassed, it assumes that data has been entered in the field, wherein reality it is blank.</p> <p>Any suggestions/solutions to this??</p> <p>Thanks in advance.</p>
jquery
[5]
3,649,696
3,649,697
checkbox in theme options page
<p>This is the code I have to display the checkbox in the theme options page:</p> <pre><code>$options[] = array( "name" =&gt; "Enable/Disable Slider", "desc" =&gt; "If you don´t want to see the slider on your homepage you can disable it here.", "id" =&gt; $shortname."_onoffslider", "std" =&gt; "", "type" =&gt; "checkbox", "class" =&gt; ""); </code></pre> <p>The checkbox now is there. And also I have this bit of code to echo the value true or false in my template. like this:</p> <pre><code> &lt;p&gt; &lt;?php if( get_option('_onoffslider') != '') { ?&gt; &lt;?php echo get_option('_onoffslider'); ?&gt; &lt;?php } else { ?&gt; It is ON! &lt;?php } ?&gt; &lt;/p&gt; </code></pre> <p>In the template page the text "It is ON!" always shows, no matter the checkbox is on or off. I know the code is wrong but i can´t fix it. </p> <p>Any help? thanks =)</p>
php
[2]
4,373,293
4,373,294
How to pass parameters with `include`?
<p>I have a PHP script called customers.php that is passed a parameter via the URL, e.g.:</p> <p><a href="http://www.mysite,com/customers.php?employeeId=1" rel="nofollow">http://www.mysite,com/customers.php?employeeId=1</a></p> <p>Inside my customers.php script, I pick up the parameter thus:</p> <pre><code>$employeeId = $_GET['employeeId']; </code></pre> <p>That works just fine. I also have an HTML file with a form that inputs the parameter, and runs another php script, viz:</p> <pre><code>&lt;form method="post" action="listcustomers.php"&gt; Employee ID:&amp;nbsp; &lt;input name="employeeId" type="text"&gt;&lt;br&gt; &lt;input type="submit" value="Show"&gt; &lt;/form&gt; </code></pre> <p>Then in my listcustomers.php script, I pick up the parameter so:</p> <pre><code>$employeeId = $_POST['employeeId']; </code></pre> <p>So far so good. But his is where I am stuck. I want to run my customers.php script, and pass it the parameter that I pave picked up in the form. I am sure this is really simple, but just cannot get it to work. I have tried:</p> <pre><code>include "customers.php?employeeId=$employeeId&amp;password=password"; </code></pre> <p>But that does not work. Nor does anything else that I have tried. Please help me.</p>
php
[2]
2,740,348
2,740,349
How Do I combine these functions?
<p>These both work but not at the same time. I have to disable one for the other to work. Is there a way to combine the two? All I want to do is on the same click, fire the modal windows and apply some CSS to a few elements.</p> <p><a href="http://jsfiddle.net/fDP5X/4/" rel="nofollow">http://jsfiddle.net/fDP5X/4/</a></p> <pre><code>&lt;script type="text/javascript"&gt;//Product Popup $(document).ready(function() { $(".various").fancybox({ padding : 0, fitToView : false, width : '500', height : '380', autoSize : false, closeClick : true, openEffect : 'elastic', closeEffect : 'elastic', closeBtn : true, scrolling : 'no', preload : false, helpers : { overlay : { closeClick : true, css : {'background' : 'rgba(0, 0, 0, 0)'}, } } }); }); &lt;/script&gt; </code></pre> <hr> <pre><code>&lt;script type="text/javascript"&gt;//Product Details popup and darken $(function() { $( ".various" ).toggle( function() { $( "#tabDetails,.active h2,.active" ).animate({ backgroundColor: "#c9c9c9", }, 250 ); }, function() { $( "#tabDetails,.active h2,.active" ).animate({ backgroundColor: "#fff", }, 750 ); } ); $( ".turnwhite" ).click( function() { $( "#tabDetails,.active" ).animate({ backgroundColor: "#fff", }, 750 ); $( "#tabContaier ul li a h2" ).addClass("tabheaderbackground"); $( "#tabContaier ul li a" ).css("background-color", "#FFF"); $( "#tabContaier ul li a h2" ).css("background-color", "#FFF"); } ); }); &lt;/script&gt; </code></pre>
jquery
[5]
3,617,857
3,617,858
Create a variable from array of bytes
<p>In PHP I have an array of bytes that I want to turn into a single variable.</p> <pre><code>$bytes = array(0x12, 0x8D, 0x9D, 0x40, 0x09, 0x64, 0x5A, 0x6E); </code></pre> <p>I figured I could create a string like so:</p> <pre><code>$string = chr(0x12).chr(0x8D)......; </code></pre> <p>but that seems hacky.</p> <p>Any suggestions?</p>
php
[2]
3,377,663
3,377,664
ASP.NET HttpRequest Validation Exceptions
<p>I've read the ASP.NET security principles</p> <p><a href="http://msdn.microsoft.com/en-us/library/ff647397.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ff647397.aspx</a></p> <p>While not a security problem, when a user enters an HTML code then it displays an error page. What are the design patterns/ways around them getting the custom error page? Is it required I HTML encode everything? </p> <p>I have, for example, a password field where I've not been encoding that field. Is there a way to check for any HTML code and return an error? Or just to catch this exception. </p> <p>Somehow throwing up an error page doesn't seem like the best solution but not sure what would be.</p>
asp.net
[9]
1,317,415
1,317,416
Python imports from crossreferencing packages
<p>Currently I'm trying to write my first Python library and I've encountered the following problem:</p> <p>I have the following import in my package myapp.factories:</p> <pre><code>from myapp.models import * </code></pre> <p>And the following in my package myapp.models:</p> <pre><code>from myapp.factories import * </code></pre> <p>I need the models in my factories package but inside one model I also need one of the factories. If I now call the code that needs the factory I get the following error:</p> <pre><code>NameError: global name 'MyModelFactory' is not defined </code></pre> <p>I'm pretty sure it has something to do with the order in which the scripts are loaded but I can't seem to figure out how to get these crossreferences to work.</p>
python
[7]
3,612,987
3,612,988
JavaScript "return false" from onkeypress handler
<p>I used code in the below method to block my keyboard and it worked for me.</p> <pre><code>&lt;asp:textbox id="t1" onkeypress="return false;" /&gt; </code></pre> <p>Now I want to add some more for for it and I tired to do the same using extra code as</p> <pre><code>&lt;script type="text/javascript"&gt; fuction disablekeys() { return false; } &lt;/script&gt; &lt;asp:textbox id="t1" onkeypress="disablekeys();" /&gt; </code></pre> <p>But this code is not working. Why?</p>
javascript
[3]
4,271,038
4,271,039
Same names of enum and variable
<p>I've got following code (I know its not nice ;) ):</p> <pre><code>public class Clazz1 { public int test = 10; public enum test {a, s, d, f } void sth() { // ... } } </code></pre> <p>Is there any way to acces this enum? When I type 'test' it always means that int variable. What are rules connected with this situation - why even compiler allows to have enum and int with the same names?</p>
java
[1]
3,400,983
3,400,984
Sleep() Timeout
<p>I have an issue with my host setting in terms of timeout but actually i don't know which one exactly is responsible for that. When i run this code in php page:</p> <p><code>&lt;?PHP sleep(30); echo "Done"; ?&gt;</code></p> <p>It gives me <code>"tcp error operation timeout"</code>.</p> <p>But when i change it to be <code>sleep(20)</code> it runs successfully. So please help me to find out which item in my php ini file is responsible for this timeout. However i tried to google it and already tried a lot of suggestions but with no luck, and finally i am stuck at this point to let my php script go live.</p>
php
[2]
4,464,273
4,464,274
"Android library projects cannot be launched"?
<p>Now I am totally confused by this error message: <code>Android library projects cannot be launched.</code> </p> <p>I carefully checked the build path and library, everything is <code>OK</code>. And there is no error in Problems view. However, when I tried to run my application as an Android project, it failed and showed this message.</p> <p>What really happened in my code? Any ideas? Thank you in advance! </p> <p>Regards, Kariya</p>
android
[4]
277,063
277,064
what is "public new virtual void Method()" mean?
<p>when use new virtual key words to decorate the method? what is the affection? Like define an interface, and add a class to inherit the interface. but use the new virtual to realize the interface method.</p> <pre><code> interface IPrinter { void Print(); } public class PrinterOne : IPrinter { public void Print() { Console.WriteLine("PrinterOne."); } } public class PrinterTwo : PrinterOne { public new virtual void Print() { Console.WriteLine("PrinterTwo."); } } public class PrinterThree : PrinterTwo { public override void Print() { Console.WriteLine("PrinterThree."); } } public class PrinterFour : PrinterThree { public override void Print() { Console.WriteLine("PrinterFour."); } } static void Main(string[] args) { IPrinter iprinter = new PrinterFour(); iprinter.Print();//the output is PrinterOne? why??? Console.ReadLine(); } </code></pre>
c#
[0]
1,920,211
1,920,212
Linear search through a file with data and a file with words (for example, like a spell check)
<p>I am unsure of why my code is not working. This is a function from a program I have to implement.</p> <pre><code>def spellcheck_list(document, dictionary): """ Checks the spelling of each word in 'document' (a list of words) against the dictionary (another list of words). """ pos = 0 found = False stop = False for word in document: while pos &lt; len(dictionary) and found: if document[pos] in dictionary: found = True else: pos = pos+1 print word </code></pre>
python
[7]
4,600,669
4,600,670
remove element from vector of vectors
<p>I try to remove an element from vector of verctors in Java, and set this vector to the correct location.</p> <p>So I try this, and of course it didn't work because line (2) return Integer:</p> <p>Definition: </p> <pre><code>Vector&lt;Vector&lt;Integer&gt;&gt; current_domain; Vector&lt;Integer&gt; t = current_domain.get(k).remove(0); current_domain.set(k, t); </code></pre>
java
[1]
5,107,833
5,107,834
How a developer from countries not listed in the "android app selling countries list" sell their apps?
<p>I am from Pakistan and my country is not included in the "Android App selling Countries list". I want to sell the apps on Android Market. </p> <p>Is there any way I can sell my apps. </p>
android
[4]
89,309
89,310
Are notices harm to a website and its performance
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/929996/should-php-notices-be-reported-and-fixed">Should PHP &#39;Notices&#39; be reported and fixed?</a> </p> </blockquote> <p>Till date i was ignoring the php notices, thinking that we will disable it when website is live. Now a scenario has occurred where in clients have enabled logging of the notices also to the log and because of this the log size was growing enormously. I was always thinking that production environment will come with notices logging disabled. So we had to sit and remove each of these notices. So wanted to know will these notices cause any harm to website. Or should we take it as developers buggy code ? </p>
php
[2]
2,332,687
2,332,688
Interactive drawings in webapp
<p><br> For a web app I am designing, looking for a graphics library (java script based or not) to display in the browser. The application requires to map a production layout, so may only need to draw shapes (rectangles, cubes etc) and interactively modify the size of them. Any suggestion would be helpful. I am aware of widget libraries (jquerUI etc), and some graphing packages (protovis), but hope for something more suitable. thanks.</p>
javascript
[3]
4,386,257
4,386,258
How do I know if a variable is private?
<p>I've never understood private variables. I know how to make them, (using the Module Pattern, right) but I don't see what's so private about them. I illustrated an explanation on jsFiddle -- <a href="http://jsfiddle.net/fufWX/" rel="nofollow">http://jsfiddle.net/fufWX/</a></p> <p>Can you explain how that <code>_private</code> variable really is private when it is still accessible from the outerscope? And what are the use for private variables in the first place!? Thanks.</p> <pre><code>var Module = (function() { var _private = "My private variable"; return { get: function() { return _private; }, set: function(e) { _private = e; } }; })(); var obj = {}; // How is that variable private when I can simply obtain it like this: obj.get = Module.get; // ?? obj.set = Module.set; // ?? obj.get(); // "My private variable" </code></pre>
javascript
[3]
4,300,952
4,300,953
Instance of Array returning error
<p>I have a simple check to see if a particular set of keys is an array and if not create it but for some reason the if statement returns an error, this is what I am trying to do:</p> <pre><code>//test data var i = 0; var map = new Array(); var Data[i]['x'] = 6; var Data[i]['y'] = 7; if(!map[Data[i]['x']] instanceof Array){ map[Data[i]['x']] = new Array(); } if(!map[Data[i]['x']][Data[i]['y']] instanceof Array){ //error on this line map[Data[i]['x']][Data[i]['y']] = new Array(); } </code></pre> <p>The error is:</p> <p><code>Uncaught TypeError: Cannot read property '6' of undefined</code></p> <p>This error is occuring on the second IF statement. What is the mistake I am making here?</p>
javascript
[3]
1,138,537
1,138,538
jar files are not being detected
<p>I have a class called <strong>SnmpGet.java</strong> in default package. it needs a jar called <strong>example.jar</strong>. the structure of <strong>example.jar</strong> is <code>-&gt; degault package-&gt; snmp.class</code>. now <strong>SnmpGet.java</strong> makes use of this <strong>snmp.class</strong>. So now it works fine because <strong>SnmpGet.java</strong> and <strong>snmp.class</strong> are in default package. But if i move the SnmpGet.java in user defined package like com.test.Work it is not able to detect jar file. what can i do? </p> <p>I need to use SnmpGet.java in user defined package only. And the jar is the downloaded one. I can not make changes to it.</p>
java
[1]
1,175,723
1,175,724
how to spin CALayer
<p>How to spinning the CALayer on current location?</p> <p>thanks in advance</p>
iphone
[8]
1,549,159
1,549,160
JavaScript redirect in if statement that prevents code execution without yielding errors
<p>Can I do a JavaScript redirect in an if statement that prevents code execution past that if, without having to throw or generate errors, nor putting the undesired code in an else block?</p> <p><strong>Example of desired outcome that yields an error before redirect</strong></p> <pre><code>if (true) { window.location.href = window.location.toString(); throw ""; // Yields error, but stops execution. return; also yields error. } alert("Undesired code has been executed"); </code></pre>
javascript
[3]
5,812,393
5,812,394
how to root access in android emulator
<p>When I write su in terminal emualator. I have su:uid 10032 not allowed to su. What Can I do to root the emulator to have access?</p>
android
[4]
3,873,134
3,873,135
Is Java not installed correctly? Exception in thread "main" java.lang.NoSuchMethodError
<p>Recently when I write any code and compile it, then try to run it I get this exception:</p> <blockquote> <p>Exception in thread "main" java.lang.NoSuchMethodError</p> </blockquote> <p>At first I thought there is something wrong in my code, but I couldn't find anything wrong with it. When trying to run a <code>HelloWorld</code> example that had worked before, if works, but if I copy the exact same code into a file <code>HelloWorld2</code> I get this exception again.</p> <p>The code is identical but when I used <code>javap</code> to decompile both class files I found a difference. In <code>HelloWorld</code> (the original file)</p> <pre><code>"public static void main(java.lang.String[])"; </code></pre> <p>and in <code>HelloWorld2</code> (the new one)</p> <pre><code>"public static void main(String[])"; </code></pre> <p>without <code>java.lang.</code>.</p> <p>I recompiled the old <code>HelloWorld</code> with <code>javac</code> and now when I try to run it it doesn't work and I get the same exception. None of my old code now works if I recompile it.</p> <p>I've searched everywhere but can't find a solution to this problem - any idea what is going on here?</p>
java
[1]
5,991,655
5,991,656
How to download a file from server using ftp and how to save that file in my local folder
<p>this is my code but this is not working whats a problem in this code.u have any another code.give me idea to download a file from server using ftp.i am trying this code in my localhost also in my own server.</p> <pre><code>$curl = curl_init(); $file = fopen("ftpfile/file.csv", 'w'); curl_setopt($curl, CURLOPT_URL, "ftp:http://www.address.com/file.csv"); #input curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FILE, $file); #output curl_setopt($curl, CURLOPT_USERPWD, "myusername:mypassword"); curl_exec($curl); </code></pre>
php
[2]
5,812,551
5,812,552
Can I run Wine on an Android slate?
<p>I would like to run a small Windows program on an Android slate. It runs just fine under Wine in Ubuntu, but I am unsure how to install &amp; run Wine on the Android slate. </p> <p>Sorry if it's not strictly a programming question. If you want it to be so, I could rephrase it as "will I have to write my Delphi code again Java in order to run it on an Android slate?" </p>
android
[4]
227,963
227,964
hide all div's (except first one) having same class
<p>I have 10 &lt;div&gt;'s with a same class</p> <pre><code> &lt;div class="c1"&gt;&lt;/div&gt; &lt;div class="c1"&gt;&lt;/div&gt; &lt;div class="c1"&gt;&lt;/div&gt; &lt;div class="c1"&gt;&lt;/div&gt; &lt;div class="c1"&gt;&lt;/div&gt; &lt;div class="c1"&gt;&lt;/div&gt; &lt;div class="c1"&gt;&lt;/div&gt; &lt;div class="c1"&gt;&lt;/div&gt; &lt;div class="c1"&gt;&lt;/div&gt; &lt;div class="c1"&gt;&lt;/div&gt; </code></pre> <p>Now I need to hide all the &lt;div&gt; leaving first out. </p>
jquery
[5]
2,944,818
2,944,819
How to create Executable file in Java
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/147181/how-can-i-convert-my-java-program-to-an-exe-file">How can I convert my Java program to an .exe file?</a> </p> </blockquote> <p>How can i create Exe file for java program. Do i need to install any software for it, And how to add Icon to that exe file.</p>
java
[1]
2,502,851
2,502,852
Dynamic allocation of nested vectors
<p>I did something like:</p> <pre><code>Grid(int row, int col):num_of_row_(row), num_of_col_(col) { grid_ = new vector&lt;vector&lt;bool&gt; &gt; (row, col); } </code></pre> <p>which dynamically allocates nested vector. Is this correct? I mean using this syntax:</p> <pre><code>new vector&lt;vector&lt;type&gt; &gt; (outersize, innersize) </code></pre> <p>where ** outersize, innersize are both "int" variables.**</p> <p>update: I actually used this code, and it works. I just want to find out why.</p>
c++
[6]
5,177,316
5,177,317
Which tool can show various threads and stack info in the already running java code?
<p>I would like to know tools to check thread/stack information in both windows platform, Linux platform and Mac platform which jvm is running. </p>
java
[1]
4,434,022
4,434,023
Runtime Error in asp.net?(online )
<p>I develop a web application it is working fine in local. When i upload the site in online through CuteFTP it is showing the error like this...</p> <blockquote> <p>Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".</p> </blockquote> <pre><code>&lt;!-- Web.Config Configuration File --&gt; &lt;configuration&gt; &lt;system.web&gt; &lt;customErrors mode="Off"/&gt; &lt;/system.web&gt; &lt;/configuration&gt; Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's &lt;customErrors&gt; configuration tag to point to a custom error page URL. &lt;!-- Web.Config Configuration File --&gt; &lt;configuration&gt; &lt;system.web&gt; &lt;customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/&gt; &lt;/system.web&gt; &lt;/configuration&gt; </code></pre> <p>please help me i place the but even though it is not working it is giving same error. Thank you</p>
asp.net
[9]
3,232,235
3,232,236
Call a function after every n loops in foreach?
<p>There's a foreach loop in my code, on which the progress of a task depends. Right now, there's no way I could find which loop is ongoing in the foreach loop. Ultimately, I cannot track the progress.</p> <p>Is there any better way than including an incrementing variable and checking if it has crossed n loops?</p> <p>In short: Anyway to improve the following function?</p> <p>Example:</p> <pre><code>&lt;?php $counter = 1; $theN = 100; foreach( $allLoops as $thisLoop ) { /* The code to perform the "task" */ if( $counter%$theN == 0 ) { theFunction(); } $counter++; } </code></pre>
php
[2]
3,045,980
3,045,981
Using foreach statement
<p>I was trying to see if I could use the foreach statement to try and get the program I made to search through an entire array since I don't have a preset size for it and I don't want to play a guessing game for it. I tried this block of code but it tells me, "cannot implicitly convert type 'string' to 'int' and it points to the line 'if (query == search[k])</p> <p>I'm not sure exactly what it is talking about but can someone please assist? Thank you.</p> <pre><code> private void findLast_Click(object sender, EventArgs e) { query = textBox2.Text; search = File.ReadAllText(fileName).Split(new string[] { "\n", "\r\n", ":" }, StringSplitOptions.RemoveEmptyEntries); foreach (string k in search) { if (query == search[k]) { MessageBox.Show("Match"); } else MessageBox.Show("No Match"); } } </code></pre>
c#
[0]
3,984,173
3,984,174
Set a select value with jQuery not working
<p>All, I have the following bit of HTML code for a select box:</p> <pre><code>&lt;select name="display_dj_entries" id="display_dj_entries"&gt; &lt;option value="original"&gt;Select a DJ&lt;/option&gt; &lt;option value="1"&gt;1&lt;/option&gt; &lt;/select&gt; </code></pre> <p>I'm trying to set this value back to the original value when another select box is changed on my page. I have the following jQuery to do this:</p> <pre><code>jQuery(document).on('change','#display_gear_entries',function(event){ var selected_value = jQuery(this).val(); jQuery("#display_dj_entries option[value='original']").attr("selected", "selected"); }); </code></pre> <p>It isn't setting the value back to the original value but instead leaving it set to the value of 1. What am I doing wrong on this?</p> <p>Thanks!</p>
jquery
[5]
303,798
303,799
Getting derived class objects out of a vector<Parent*>
<p>I know that you can store a bunch of Parent* objects in a vector. However, if the functions you need to call on the objects cannot be defined in the parent class (they depend on a template parameter of the subclass) then how are you supposed to retrieve the objects from the container?</p> <p>In this example:</p> <pre><code>#include &lt;iostream&gt; class ImageBase{}; template &lt;typename TPixel&gt; class Image : public ImageBase { public: TPixel GetPixel() const {TPixel a; return a;} }; template&lt;typename TImage&gt; void Output(const TImage* image) { std::cout &lt;&lt; image-&gt;GetPixel(); } int main(int, char *[]) { // Works correctly { Image&lt;float&gt;* image = new Image&lt;float&gt;; image-&gt;GetPixel(); Output(image); } { ImageBase* image = new Image&lt;float&gt;; Output(image); } return 0; } </code></pre> <p>The Output(image); where 'image' is a ImageBase* fails (of course) because GetPixel is not defined in ImageBase. I know you can dynamic_cast&lt;> to a bunch of types to figure out if the subclass matches any of them, but this list could very quickly get very long. The long list would be fine if it could reside in one place, but how would you make a function to do this? The function would take an ImageBase*, but what would it return?</p> <pre><code>returnType? GetSubclass(ImageBase* input) { if(dynamic_cast&lt;Image&lt;float&gt;*&gt;(input)) { return Image&lt;float&gt;*; } else if(dynamic_cast&lt;Image&lt;int&gt;*&gt;(input)) { return Image&lt;int&gt;*; } } </code></pre> <p>It seems reasonable to me to want to be able to call some template functions on subclasses that only vary in signature by their template parameter (as setup in this example), does it not?</p> <p>In my real case, both Image and ImageBase are part of a library, so I cannot change them.</p>
c++
[6]
3,416,094
3,416,095
End thread by ID
<p>I am trying to handle some threads. I saw it is possible to get a unique ID from the thread or to set an thread-name. But how it is possible to end / abort a thread by his ID? I don't belive .NET has his own ability to do this right? Maybe Win32-API?</p>
c#
[0]
2,765,439
2,765,440
How to remove "¼" and "½" from a string
<p>I need to remove the characters '¼' and '½' from a string in Java. How can I do that?</p> <p>I do not have control over the request, I have to accept what the input comes as. Basically the request string has the characters '¼' and '½', and I need to replace these with the empty string.</p> <p>I tried putting it in a list and it did not work:</p> <p>invalidChars.add('½');</p> <p>and then search through this. Jenkins complains: unmappable character for encoding UTF-8 [INFO] 2 errors</p>
java
[1]
4,802,346
4,802,347
how to reposition an element inside a jquery html method?
<p>For example, I have the following jquery code below:</p> <pre><code>$("#AddToList").html(&lt;p&gt;Testing Internals&lt;/p&gt;); </code></pre> <p>How can I reposition the element inside the <code>html(&lt;p&gt;Testing Internals&lt;/p&gt;)</code> above using the following property and value of:</p> <pre><code>margin-left = 20px </code></pre>
jquery
[5]
1,892,649
1,892,650
How to log and view the messages cought by try-catch block in Servlets?
<p>Here is my try-catch block:</p> <pre><code>try { return dbConnection.createStatement(); } catch(SQLException sqle) { // TODO SQL Exception System.out.println(sqle.getMessage()); } </code></pre> <p>Is it correct to use <code>System.out</code> object in Servlets?</p> <p>What is the easiest way for debugging purposes?</p> <p>I wanted the message to be printed in the error page generated by the server, eg: <code>HTTP Status 500</code>.</p>
java
[1]
2,949,840
2,949,841
Unusal Error during Java EE SDK Install
<p>I have installed jdk 7, installed netbeans which supports the new version. After that, i tried to installed java ee 6, with jdk 7 and it says, <code>Could not find required version of Java(TM) 2 Runtime</code>. Despite with the availability of jre 7. why does java ee 6 with jdk 7, needs jre6 to install simply beats me. </p> <p>How to overcome this? Will I get a problem, if i install two versions of jdk, jdk6 and jdk7?</p>
java
[1]
4,623,466
4,623,467
List of lists and "Too many values to unpack"
<p>I'm trying to use the following code on a list of lists to create a new list of lists, whose new elements are a certain combination of elements from the lists inside the old list...if that makes any sense! Here is the code:</p> <pre><code> for index, item in outputList1: outputList2 = outputList2.append(item[6:].extend(outputList1[index+1][6:])) </code></pre> <p>However, I get a "Too many values to unpack" error. I seem to even get the error with the following code:</p> <pre><code> for index, item in outputList1: pass </code></pre> <p>What could I be doing wrong?</p>
python
[7]
2,264,662
2,264,663
how to get my script to display the calculation with two decimal places
<p>I am having a very hard time figuring out how to display my calculation to .00 decimal places. It always rounds it down/up.</p> <p>Here is the code:</p> <pre><code>$(function() { var $priceHolder = $('#creditsPrice'); if ($priceHolder.size() === 1) { $('#creditsNeeded').keyup(function(e) { var $this = $(this), url = $this.attr('rel'), credits = parseInt($this.val(), 10); if (credits &lt;= 0) { if ($priceHolder.is(':visible')) { $priceHolder.hide(); } $priceHolder.hide(); return; } if (!$priceHolder.is(':visible')) { $priceHolder.show(); } url += '/' + credits; $.ajax({ method: 'get', url: url, dataType: 'json', success: function(data) { $('#js-price', $priceHolder).text(data); } }); }); } }); </code></pre>
javascript
[3]