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,368,069 | 4,368,070 |
What is the best possible way to pass a Mulitline String as function argument?
|
<p>What will be the Best practice to pass Multiline String as a Javascript function's argument.</p>
|
javascript
|
[3]
|
1,877,136 | 1,877,137 |
How to add checkbox array to zip file for download from a form
|
<p>I am trying to get a foreach loop to give me the checkbox values (which have the file names for values) from my form, to be added to a zip file. </p>
<pre><code><input type="checkbox" name="download[0]" value="Fact_Sheet_1.pdf" />
<input type="checkbox" name="download[1]" value="Fact_Sheet_2.pdf" />
<input type="checkbox" name="download[2]" value="Fact_Sheet_3.pdf" />
<input type="checkbox" name="download[3]" value="Fact_Sheet_4.pdf" />
<input type="checkbox" name="download[4]" value="Fact_Sheet_5.pdf" />
</code></pre>
<p>Works fine if I click on one checkbox but when I tick more than one checkbox only one file gets added to the zip file.</p>
<p>My code is below. Any suggestions would be appreciated.</p>
<pre><code>if(isset($_POST['submit']) )
{
foreach ($_POST['download'] as $key => $val) {
$filename = 'Fact_Sheets/' . $val;
}
}
system("zip -r files/zipfile $filename");
</code></pre>
|
php
|
[2]
|
5,254,300 | 5,254,301 |
Dumping a Java program into a file and restarting it
|
<p>I was just wondering if it's possible to dump a running Java program into a file, and later on restart it (same machine)</p>
<p>It's sounds a bit weird, but who knows</p>
<p>--- update -------</p>
<p>Yes, this is the hibernate feature for a process instead of a full system. But google 'hibernate jvm process' and you'll understand my pain. </p>
<p>There is a question for linux on this subject (<a href="http://stackoverflow.com/questions/2134771/hibernate-a-process-in-linux">here</a>). Quickly, it's possible to hibernate a process (far from 100% reliable) with <a href="http://cryopid.berlios.de/" rel="nofollow">CryoPID</a>.</p>
<p>A similar question was raised in <a href="http://stackoverflow.com/questions/424341/are-there-any-java-vms-which-can-save-their-state-to-a-file-and-then-reload-that">stackoverflow</a> some years ago.</p>
<p>With a JVM my educated guess is that hibernating should be a lot easier, not always possible and not reliable at 100% (e.g. UI and files). </p>
<hr>
<p>Serializing a persistent state of the application is an option but it is not an answer to the question.</p>
|
java
|
[1]
|
395,239 | 395,240 |
Problem with Python's is None test?
|
<p>I like using the <em>is None</em> test for empty variables, it's very flexible, easy and useful. It seems to have stopped working now:</p>
<pre><code>>"" is None
False
>[] is None
False
>{} is None
False
</code></pre>
<p>What's going on?</p>
<p>I'm using Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) [GCC 4.4.5], on Debian/Sid i686 GNU/Linux.</p>
<p>Edit: Awesome tip from Sven Marnach of using bool(""). brb, off to edit some code...</p>
|
python
|
[7]
|
3,848,317 | 3,848,318 |
What is the difference between Function.prototype.call() and Function.prototype.bind()?
|
<p>I went throught the MDN documentation, but I didn't really understand the difference between call() and bind(). They both seem to do the same thing - change the context of <code>this</code> inside a function. So what really is the difference between them? And which should be used when?</p>
|
javascript
|
[3]
|
5,681,349 | 5,681,350 |
ASP.NET Encryption HEX Characters
|
<p>What can be done to this code to make the Encryption in HEX rather than ASCII?</p>
<p>Encryption:</p>
<pre><code>Public Function EncryptAES(ByVal sIn As String, ByVal sKey As String) As String
Dim AES As New RijndaelManaged
Dim ahashMD5 As New MD5CryptoServiceProvider()
AES.Key = ahashMD5.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(sKey))
AES.Mode = CipherMode.ECB
Dim AESEncrypt As ICryptoTransform = AES.CreateEncryptor()
Dim aBuffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(sIn)
Return Convert.ToBase64String(AESEncrypt.TransformFinalBlock(aBuffer, 0, aBuffer.Length))
End Function
</code></pre>
<p>Decryption:</p>
<pre><code>Public Function DecryptAES(ByVal sOut As String, ByVal sKey As String) As String
Dim dAES As New RijndaelManaged
Dim dahashMD5 As New MD5CryptoServiceProvider()
dAES.Key = dahashMD5.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(sKey))
dAES.Mode = CipherMode.ECB
Dim dAESDecrypt As ICryptoTransform = dAES.CreateDecryptor()
sOut = Replace(sOut, " ", "+", 1, -1, CompareMethod.Text)
Dim daBuffer As Byte() = Convert.FromBase64String(sOut)
Return System.Text.ASCIIEncoding.ASCII.GetString(dAESDecrypt.TransformFinalBlock(daBuffer, 0, daBuffer.Length))
End Function
</code></pre>
|
asp.net
|
[9]
|
4,777,202 | 4,777,203 |
Error while publishing the web application
|
<p>I am a fresher in <code>vs 2010</code> and developed a web project.
When I hosted directly the project its working fine.
When I am trying to publish it not working and giving an error <strong>403</strong></p>
<pre><code>Error 1 Web deployment task failed.
(The metabase path 'http://localhost/webapp/login.aspx' is not supported.
Paths must be of the format '/lm/w3svc/<siteid>/ROOT/...'.)
The metabase path 'http://localhost/webapp/login.aspx' is not supported.
Paths must be of the format '/lm/w3svc/<siteid>/ROOT/...'.
The metabase key '/lm/w3svc/1964704031' could not be found.
The system cannot find the path specified. (Exception from HRESULT: 0x80070003) 0 0 WebApplication1
</code></pre>
<p>I referred many sites and didn't get any solution for this problem
Please anyone help me to solve this issue.
My <code>OS</code> is windows server 2003 <code>iis 6</code>.</p>
<p>I have given the
<strong>Publish method:WebDeploy
service url:http://localhost/webapp
Site/application:http://localhost/webapp/login.aspx</strong>
Please help me .Thanks in advance.</p>
|
asp.net
|
[9]
|
5,104,535 | 5,104,536 |
How to configure IIS first time for any web app?
|
<p>I have a website made in ASP.NET .Currently is being opened directly with Visual Studio.
Now i want this to be opened with localhost with IIS features enabled.</p>
<p>I need steps to make this website totally IIS enabled</p>
|
asp.net
|
[9]
|
4,500,994 | 4,500,995 |
How to draw numbered text in a table layout?
|
<p>I want to draw a numbered circle inside my table layout like below. I have tried to draw circle with canvas, but unable to get the x,y and radius dynamically.</p>
<p><img src="http://i.stack.imgur.com/4TFMu.jpg" alt="enter image description here"></p>
|
android
|
[4]
|
4,590,832 | 4,590,833 |
Use of Mocking in unit testing for ASP.NET MVC
|
<p>I'm developing a basic webapp and I'm using ASP.NET MVC, MOno and C# and MySQL for my database. I want to create a unit testing and use mocking. But I don't know how to setup or create a mock in unit testing. And what mocking framework should I use?</p>
<p>Please advise.</p>
<p>Many thanks.</p>
|
asp.net
|
[9]
|
642,015 | 642,016 |
How to call a shell script from python code?
|
<p>how to call a shell script from python code?</p>
|
python
|
[7]
|
5,347,224 | 5,347,225 |
iPhone SDK 4: weird compilation error, MPMoviePlayerController
|
<p>I have a viewController containing the following method:</p>
<pre><code>- (IBAction) playMovie {
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"test" ofType:@"m4v"]];
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
moviePlayer.controlStyle = MPMovieControlStyleNone;
moviePlayer.shouldAutoplay = YES;
[self.view addSubview:moviePlayer.view];
[moviePlayer setFullscreen:YES animated:YES];
}
</code></pre>
<p>I can't compile the code because of the error:</p>
<p>Undefined symbols:
"_MPMoviePlayerPlaybackDidFinishNotification", referenced from:
_MPMoviePlayerPlaybackDidFinishNotification$non_lazy_ptr in AnotherViewController.o
(maybe you meant: _MPMoviePlayerPlaybackDidFinishNotification$non_lazy_ptr)
"_OBJC_CLASS_$_MPMoviePlayerController", referenced from:
objc-class-ref-to-MPMoviePlayerController in AnotherViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status</p>
<p>This message doesn't make sense to me.</p>
<p>I was intended to use this method as a part of a view controller. Do I have to create a separate view controller for the player or it's not the case?</p>
<p>I worked with SDK 3.1.2 when I created this project but the playMovie method was completely rewritten according to new API rules. The current SDK version is 4.0.1</p>
|
iphone
|
[8]
|
2,273,161 | 2,273,162 |
Fading from one SPAN to another, ending on last, jQuery
|
<p>Greetings,</p>
<p>I am trying to fade in text spans one after another, fading each out before the next is faded in, using jQuery.</p>
<pre><code><p>IN
<span class="fadeText">spiring</span>
<span class="fadeText">nnovative</span>
<span class="fadeText">genious</span>
</p>
</code></pre>
<p>The spans will be set to hidden in CSS, trying fade from one span to the next and ending with the last still visible. I've tried several combinations using <code>$(".fadeText").each</code> and <code>fadeIn()</code>, <code>fadeOut()</code> but cannot seem to produce this effect.</p>
<p>Any help would be greatly appreciated</p>
<p>Thanks</p>
|
jquery
|
[5]
|
3,678,056 | 3,678,057 |
Choose correct UIButton on dynamiclly created buttons without tags
|
<p>I am loading up a plist file and creating buttons based on this file. These buttons can change at any point during the application running (which will trigger an update of all the buttons etc).</p>
<p>One set of buttons represents a list of categories. So I may have a house button, car button, etc. No matter what button is pressed it will call my categoryButtonPressed:(id) sender function. I need to know what button called it and load a second set of data based on the button (category) that was pressed.</p>
<p>So if I press the house button, the function needs to load the house data, but how can I determine what button was pressed in that function. If I use tags I have to know that the house button is tag 1, car is tag 2 and so forth. BUT I don't know if there will even be a house button until I read that file. Do I need to code the tag into the plist file as well? </p>
<p>OR is there a way to loop through my Array of UIButtons and determine this? Any advice?</p>
<p>And last, if I create my own extended version of UIButton that added a "name" variable, would I would still be out of luck because the action would pass the UIButton base and comparing my extended class to the base would always fail correct?</p>
<p>Thanks for any and all help!</p>
|
iphone
|
[8]
|
1,694,207 | 1,694,208 |
python: is it possible to attach a console into a running process
|
<p>I just want to see the state of the process, is it possible to attach a console into the process, so I can invoke functions inside the process and see some of the global variables.</p>
<p>It's better the process is running without being affected(of course performance can down a little bit)</p>
|
python
|
[7]
|
3,608,652 | 3,608,653 |
Why can't I load my Android 4.1 AVD?
|
<p>I'm a bit new to Android developing. I followed the tutorials to set up Eclipse and created a 4.1 AVD, but when I attempt to launch the emulator it stops working. It simply gives me the shiny "Android" boot screen indefinitely. What should I do? Thanks in advance!</p>
|
android
|
[4]
|
2,137,393 | 2,137,394 |
Use eval() with different local scope
|
<p>I would like to know how it is possible to call eval() with data from a different local scope.</p>
<p>Something like:</p>
<pre><code>function doSomething() {
var y = 1;
print_and_eval('y+1');
}
function print_and_eval(data) {
print(data);
eval(data);
}
</code></pre>
<p><strong>Edit:</strong>
- It is safe to use eval() in my case. Please do not recommend this as a solution.
- The main problem is, that I have local variables in doSomething() which are not defined in print_and_eval(). The evaluation then leads to an 'ReferenceError: y is not defined' error.</p>
<pre><code>js> print_and_eval('var a = {x:1}')
var a = {x:1}
js> print_and_eval('print(a.x)')
print(a.x)
typein:3012: TypeError: a is null
</code></pre>
<p>I would like to receive the output '1' in this case.</p>
|
javascript
|
[3]
|
3,186,757 | 3,186,758 |
jQuery select next closest class
|
<p>I have a simple list of FAQ's </p>
<pre><code><div class='qcontainer'>
<p>Q:</p>
<div class='question'>Question</div>
</div>
<div class='acontainer'>
<p>A:</p>
<div class='answer'><p>Answer</p></div>
</div>
<div class='qcontainer'>
<p>Q:</p>
<div class='question'>Question</div>
</div>
<div class='acontainer'>
<p>A:</p>
<div class='answer'><p>Answer</p></div>
</div>
</code></pre>
<p>All I am trying to do is a toggle the visable state of the next answerr when the question is clicked. </p>
<p>So far I have got </p>
<pre><code> $('.qcontainer').bind("click", function (e) {
$('.qcontainer').next('.acontainer').toggle(400);
});
</code></pre>
<p>But this toggles all the items, what i want to do is just target teh answer for the clicked question. so the next item in the list from the clicked object. </p>
|
jquery
|
[5]
|
310,096 | 310,097 |
Recursive printing of a singly linked list homework
|
<p>I have an assignment in my java class that i need to recursively print out a linked list in reverse. I have looked online and found numerous examples of recursive methods that do this but take a node in as a parameter, and to my understanding i need to take in a linked list because i need to print the entire list out. Below is what code i have written, and it works in the sense that it prints out the list, recursively, but it is still in the same order that i created the list. After it prints out the list it throws a no such element exception as well. my main problem/question is wrapping my head around how best to print this recursively. </p>
<pre><code>public void printRecurse2(LinkedList<String> list2)
{
if(list2 == null)
return;
System.out.println(list2.pop());
printRecurse2(list2);
}
</code></pre>
|
java
|
[1]
|
3,557,323 | 3,557,324 |
how to get Confirmation and form submit or Abort in code behind.. here i used Code below
|
<p>if (chk > 0)
{
ClientScript.RegisterStartupScript(GetType(), "hwa", Confirm('Want to Save?');", true); </p>
<p><strong>// I want Section Below this Line Restricted by Confirmation Ok or Cancel..</strong> </p>
<p>string qry = "insert into userip values('" + TextBox2.Text + "'," + ddluid.Text + ")";
SqlCommand insert = new SqlCommand(qry, con); con.Open(); insert.ExecuteNonQuery(); con.Close(); TabContainer1.ActiveTabIndex = 1;
}</p>
<p>//
//If Yes/OK clicked Segment run Else... Return to Form back.</p>
|
asp.net
|
[9]
|
3,124,962 | 3,124,963 |
Return type vararg?
|
<p>I have a method like:</p>
<pre><code>void foo(int x, Grok... groks);
</code></pre>
<p>There's no way to define a method that returns a type of varargs, right? Ideally I want an additional util method:</p>
<pre><code>foo(25, new Grok(), new Grok(), generateMoreGroks());
public Grok... generateMoreGroks() {
return new Grok[] {
new Grok(), new Grok(), new Grok() };
}
</code></pre>
<p>right?</p>
<p>---- More info --------------</p>
<p>The issue with the above is that we can't mix a few Grok instances allocated there with an array of Groks:</p>
<pre><code> "new Grok(), new Grok(), generateMoreGroks());"
</code></pre>
<p>and I don't think that's legal, unless you could define a method to return a type of vararg (I guess).</p>
<p>Thanks</p>
|
java
|
[1]
|
2,669,850 | 2,669,851 |
How do I center a button between two other buttons?
|
<p>I am trying to get one line with three buttons on it. One far left one in the center and one far right. Ideally I would like the center button to take up all the space between the two side ones. Right now the center(menu) button just overlaps the left side(prev) button. Here is what I have now:</p>
<pre><code><RelativeLayout android:layout_marginTop="-50dip" android:gravity="bottom" android:layout_height="wrap_content" android:layout_width="fill_parent">
<Button
android:id="@+id/previous_button"
android:layout_height="wrap_content"
android:layout_width="110px"
android:layout_alignParentLeft="true"
android:text="@string/previous"
/>
<Button
android:id="@+id/menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center"
android:text="@string/menu"
/>
<Button
android:id="@+id/next_button"
android:layout_height="wrap_content"
android:layout_width="110px"
android:layout_alignParentRight="true"
android:text="@string/next"
/>
</code></pre>
<p></p>
|
android
|
[4]
|
1,397,525 | 1,397,526 |
bytes of a string in java?
|
<p>In java if i have a String <em>x</em> how can i calculate the number of bytes in that string?</p>
|
java
|
[1]
|
1,287,040 | 1,287,041 |
Button color should not change when I release the button in Android
|
<p>
</p>
<pre><code><item android:state_focused="true" >
<shape>
<gradient
android:endColor="#FF9900"
android:startColor="#FF9966"
android:angle="270" />
<stroke
android:width="3dp"
android:color="#CCCCCC" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item>
<shape>
<gradient
android:endColor="#FFFFFF"
android:startColor="#FFFFFF"
android:angle="270" />
<stroke
android:width="1dp"
android:color="#666666" />
<corners
android:radius="1dp" />
<padding
android:left="3dp"
android:top="3dp"
android:right="3dp"
android:bottom="3dp" />
</shape>
</item>
</code></pre>
<p>
The above is the code I have written for filling borders of Button with black color.The same code I was using for 3 buttons by setting as background.Now, when I click button1, red color appears and goes when I releases. But I want Red color to be visible, until I press next button. Though I release Button1 after press, Red color should be visible. But Red color should only disappear when I press any other button.
<br>
Can anyone help me in solving this issue?<br>
Please anyone help me in sorting out this issue? <br>
Thanks in Advance,</p>
|
android
|
[4]
|
2,863,516 | 2,863,517 |
python looking for a specific string pattern
|
<p>I would like to parse a string in python which is the off format</p>
<p>"JXE 2000 This is a bug to fix blah " or of the format</p>
<p>"JXE-2000: This is a bug to fix blah " and check if the string has JXE and a number.</p>
<p>In the above example I will need to check if the string has JXE and 2000. I am new to python.</p>
<p>I tried the following:</p>
<pre><code>textpattern="JXE-5000: This is bug "
text=re.compile("^([A-Z][0-9]+)*$")
text=re.search("JXE (.*)", textpattern)
print (text.groups())
</code></pre>
<p>I seem to be getting only "5000 This is a bug".</p>
|
python
|
[7]
|
5,148,083 | 5,148,084 |
applicationWillTerminate works as long as I don't switch off the iPhone
|
<p>to save some variables of my apps I use:</p>
<p>-(void)applicationWillTerminate:(UIApplication *)application {</p>
<pre><code>NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
[prefs setFloat: self.viewController.sLabel.contentOffset.y forKey:@"floatKey"];
[prefs setObject:self.viewController.newText forKey:@"stringVal"];
[prefs synchronize];
</code></pre>
<p>}</p>
<p>and to retrieve them, via a button, I do the following:</p>
<p>-(IBAction) riprendi:(id) sender {</p>
<pre><code>NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
float myFloat = [prefs floatForKey:@"floatKey"];
</code></pre>
<p>//some actions here</p>
<p>}</p>
<p>Everything is working on the simulator. However, using it on a real iPhone, the variables' saving and retrieving works just if you press the Home button, exiting the app and opening again but NOT if you switch off/on the iPhone. In this case, the variables get simply lost once you re-open the app...</p>
<p>What am I missing?? This is actually driving me crazy :(</p>
<p>Thank you so much ;)
Fabio</p>
|
iphone
|
[8]
|
5,722,625 | 5,722,626 |
implementation of command line arg passing in python, doesn't work
|
<p>I'm very new to python. I wish I could implement the command-line arg passing in python as my first python script. I have written this code:</p>
<pre><code>def main(argv):
try:
opts, args = getopt.getopt(argv, "hb:b:f", ["help", "bucket=", "folder"])
except getopt.GetoptError:
usage()
sys.exit(2)
s3 = get_files()
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
sys.exit()
elif opt in ("-b", "--bucket"):
s3.bucketname = arg
elif opt in ("-f", "--folder"):
s3.foldername = arg
print("Came here" + s3.foldername)
s3.download_files()
</code></pre>
<p>In the <code>-f</code> argument from command is where I'm facing the problem. For debugging I used the <code>print</code> statement. I pass the arguments like this:</p>
<pre><code>./hello -b something -f /path
</code></pre>
<p>but sadly it prints out:</p>
<pre><code>Came here
</code></pre>
<p>But the <code>foldername</code> attribute is not getting assigned any value. Where I'm making the mistake?</p>
<p>Thanks in advance.</p>
|
python
|
[7]
|
5,770,883 | 5,770,884 |
permutations of lists python
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/104420/how-to-generate-all-permutations-of-a-list-in-python">How to generate all permutations of a list in Python</a> </p>
</blockquote>
<p>I want to find all the permutations of a the elements in a list.
but then with some conditions imposed.. umm..
Probably an example will help me explain better.</p>
<p>I have four lists</p>
<pre><code>["1"],["0"],["a","b","c],["d","e","f"]
</code></pre>
<p>Now I want to have the permutations in following way:</p>
<pre><code> "10ad" ,"10bd","10cd","10ae", "10be"
,"10bf"..
</code></pre>
<p>and so on..</p>
<p>So basically every element (with every element)??
Now I know the very naive way to do this.
But what is the pythonic way to do this?
if there is any??
Any suggestions</p>
<p>Thanks</p>
|
python
|
[7]
|
5,559,454 | 5,559,455 |
setTimeout in javascript question
|
<p>I understand that the <code>setTimeout</code> function spawns a separate thread that waits for x milliseconds before executing the JS function</p>
<pre><code>setTimeout(functionName, timeInms);
</code></pre>
<p>My question is if there's a way to tell it to run <em>after the JS on the page has completed executing?</em> Since this depends on how much JS is on the page, this cannot be an absolute number.</p>
<p>This is a part of a bigger problem I have that I had posted here:</p>
<p><a href="http://stackoverflow.com/questions/1435503/registerstartupscript-and-order-of-execution/1435572">link text</a></p>
<p>The gist is that ScriptManager does not guarantee the order of execution and I have to run the <code>EndScript</code> function at the very end. It kinda works with the <code>setTimeOut</code> although it's not very accurate (since the JS on the pages differ)</p>
|
javascript
|
[3]
|
192,212 | 192,213 |
Limit the number of items in an array
|
<p>I have an array that gets processed through a <code>foreach</code> loop.</p>
<pre><code>foreach($images as $imageChoices) {
Do stuff here
}
</code></pre>
<p>How do I limit the loop to only process the first 4 items in the array?</p>
|
php
|
[2]
|
5,908,221 | 5,908,222 |
I am trying a simple Compare 2 text files and print the diff between the 2
|
<pre><code>import java.io.*;
public class CheckingTwoFilesAndComparing implements Serializable {
private static final long serialVersionUID = 1L;
static String FILE_ONE = "/Users/abextra/myText1.txt";
static String FILE_TWO = "/Users/abextra/myText2.txt";
public static void main(String[] args) {
try {
CompareFile(FILE_ONE, FILE_TWO);
} catch (Exception e) {
e.printStackTrace();
}
}
private static void CompareFile(String fILE_ONE2, String fILE_TWO2)
throws Exception {
File f1 = new File("FILE_ONE");
File f2 = new File("FILE_TWO");
FileReader fR1 = new FileReader(f1);
FileReader fR2 = new FileReader(f2);
BufferedReader reader1 = new BufferedReader(fR1);
BufferedReader reader2 = new BufferedReader(fR2);
String line1 = null;
String line2 = null;
while (((line1 = reader1.readLine()) != null)
&&((line2 = reader2.readLine()) != null)) {
if (!line1.equalsIgnoreCase(line2)) {
System.out.println("The files are DIFFERENT");
} else {
System.out.println("The files are identical");
}
}
reader1.close();
reader2.close();
}
}
</code></pre>
<p>Here are contents of the 2 Text files that exist in the path mentioned in the code above </p>
<pre><code>==myText1.txt===
1,This is first line, file
2,This is second line, file
3,This is third line , file
4,This is fourth line, file
==myText2.txt===
1,This is first line, file
2,This is second line, file
3,This is third line, file
4,This is fourth line, file
5,This is fifth line, file
</code></pre>
<p>I am a newbie to java . I used eclipse debugger and I see that I keep getting "FileNot found"exception - can someone please help?
Thanks much!</p>
|
java
|
[1]
|
57,015 | 57,016 |
how to activate section Index Titles For Table View
|
<p>this is my first question here..</p>
<p>I have a tableview setting with numberOfSectionsInTableView=6, which has also custom created cells.
I am trying to use 'section index title' with some predefined titles . I have gone through sample code and following the same.
I'm able to show section index title from my tableview by using function 'sectionIndexTitlesForTableView'.
But to activate that, i don't know how to make it work when i clicked on some title. Let me want to move to the page based on title selection.
For example, same like how built-in Contacts(address book) works.</p>
<p>I'm on MAC OS X 10.7 lion (beta)
using XCode 4.2 iOS SDK 5.0</p>
|
iphone
|
[8]
|
2,754,131 | 2,754,132 |
iteration problem
|
<p>I have to iterate through a list <code>error.getGE.getList</code> returns me a arraylist of type GE a bean,how to iterate over this list ?</p>
|
java
|
[1]
|
744,397 | 744,398 |
whether cookie will maintain same jsessionid when we send different requests from portlet server to remote web application server?
|
<p>whether cookie will maintain same jsessionid when we send different requests from portlet server to remote web application server?</p>
|
java
|
[1]
|
3,093,747 | 3,093,748 |
Can't convert List<KeyValuePair<...,...>> to IEnumerable<object>?
|
<p>Getting an InvalidCastException when trying something like this :</p>
<pre><code>IEnumerable<object> test = (IEnumerable<object>)new List<KeyValuePair<string, int>>();
</code></pre>
<p>However, this did work:</p>
<pre><code>IEnumerable<object> test = (IEnumerable<object>)new List<Dictionary<string, int>>();
</code></pre>
<p>So what's the big difference? Why can a KeyValuePair not be converted to an object?</p>
<p><strong>Update</strong>: I should probably point out that this did work:</p>
<pre><code>object test = (object)KeyValuePair<string,string>;
</code></pre>
|
c#
|
[0]
|
407,259 | 407,260 |
Android ICS 4.0 OS
|
<p>I am a new Android developer starting out.</p>
<p>I hope that someone from the androids developers team can answer this question: if I have a tablet with android ICS 4.0 OS, given that this OS is UNIX-based, can I install the Android Developer Kit and related platform+ packages on it, so that I might study development on the go whilst traveling with my tablet?</p>
<p>I understand that one of the requisite OSes for the android development kit is UNIX - GNU C Library (<code>glibc</code>) 2.7 or later. Is ICS 4.0 compatible with this?</p>
|
android
|
[4]
|
4,979,896 | 4,979,897 |
PHP Assign a value to a var from IF statement variable
|
<p>I have something like this:</p>
<pre><code>$msg = '';
$var1 = 'image';
$var2 = 'class';
$var3 = 'This '.$var1.' has this class assigned:'.$var2;
if($E == 0) {
$msg = $var3;
} else {
$var1 = 'no image';
$var2 = 'no class';
$msg = $var3;
};
echo $msg;
</code></pre>
<p>I want to be able to show $var3 with the modified results but it does not work...
Thank you for your answers but i think i must clarify</p>
<p>Sorry about the confusion.. </p>
<p>The problem is not with the value to test ($E == 0).. My problem is that in both case the result will be the same and $var1 and $var2 will not change...</p>
<p>result in both cases will be the same:
echo $msg; will produce "This image has this class assigned: class "</p>
<p>I think is because of the composing of $var3 outside the if and cannot be changed from inside IF statement..</p>
|
php
|
[2]
|
3,214,984 | 3,214,985 |
Setting select index
|
<p>I know I can select an option in a select box by doing </p>
<pre><code>$('#selectBox :nth-child(4)').attr('selected', 'selected');
</code></pre>
<p>But how can I do this through a returned jQuery object? e.g. something like</p>
<pre><code>var box = $('#selectBox');
$(box :nth-child(4)').attr('selected', 'selected');
</code></pre>
|
jquery
|
[5]
|
9,470 | 9,471 |
Slowing speed of Viewpager controller in android
|
<p>Is there any way to slow the scroll speed with the viewpager adaptor in android?</p>
<hr>
<p>You know, I've been looking at this code. I can't figure out what I'm dong wrong.</p>
<pre><code>try{
Field mScroller = mPager.getClass().getDeclaredField("mScroller");
mScroller.setAccessible(true);
Scroller scroll = new Scroller(cxt);
Field scrollDuration = scroll.getClass().getDeclaredField("mDuration");
scrollDuration.setAccessible(true);
scrollDuration.set(scroll, 1000);
mScroller.set(mPager, scroll);
}catch (Exception e){
Toast.makeText(cxt, "something happened", Toast.LENGTH_LONG).show();
}
</code></pre>
<p>It doesn't change anything yet no exceptions occur?</p>
|
android
|
[4]
|
5,153 | 5,154 |
Is there a limit to how long an item is in an array in javascript?
|
<p>I am trying to figure out if I can store some strings in an array or if I need an object. Is there a limit to the number of characters allowed in an array item?</p>
|
javascript
|
[3]
|
6,020,136 | 6,020,137 |
How to make any Java method static at run time?
|
<p>I am wondering if there is any way to achieve the following.</p>
<ol>
<li>Find a method using reflection (done)</li>
<li>Change the method access modifier to to public and static. (How?)</li>
<li>execute this method without having any existing instance (How?)</li>
</ol>
<p>Does reflection has any option to do this?</p>
|
java
|
[1]
|
533,338 | 533,339 |
Which is fastest in PHP?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1813673/php-string-concatenation-a-b-vs-a-b-performance">PHP String concatenation - “$a $b” vs $a . “ ” . $b - performance</a> </p>
</blockquote>
<pre><code><?php
$url = 'http://www.google.com/';
//case 1
$case1 = 'The URL is '.$url.'.';
//case 2
$case2 = "The URL is $url.";
//case 3
$case3 = 'The URL is {url}.';
$case3 = str_replace('{url}', $url, $case3);
?>
</code></pre>
<p>Thank you!</p>
|
php
|
[2]
|
3,353,955 | 3,353,956 |
Removing decimals from the TextBos while loading
|
<pre><code>obj[i]['Weight'] = parseFloat("0");
obj[i]['Height'] = parseFloat("0");
obj[i]['Temperature'] = parseFloat(0,10);
</code></pre>
<p>// This does not work... </p>
<pre><code>obj[i]['Weight'] = parseInt(0,10);
obj[i]['Height'] = parseInt(0,10);
obj[i]['Temperature'] = parseInt(0,10);
</code></pre>
<p>// This too does not work... </p>
<p>My Input Value is 0, but when i show it... gives me 0.0 {Strange}.. So i did these and yet it shows 0.0</p>
|
javascript
|
[3]
|
3,299,138 | 3,299,139 |
Get the maximum value out of an complex class
|
<p>I have the following class:</p>
<pre><code>class Seller
{
private string sellerName;
private decimal price;
}
~propreties for SellerName and Price goes here~
</code></pre>
<p>I also have a list of sellers:</p>
<pre><code>list<Seller> s = new list<Seller>();
</code></pre>
<p>How can I get the maximum value of <code>price</code> out of all the sellers?</p>
<p>Thank you very much.</p>
|
c#
|
[0]
|
4,818,146 | 4,818,147 |
.apk file upload error
|
<p>When i upload my .apk file it gives this error</p>
<p>The certificate that signed this apk is not valid until the future. Create a new certificate.</p>
<p>Thanks</p>
|
android
|
[4]
|
5,623,849 | 5,623,850 |
Time between client inputs in socket communication
|
<p>I have a simple socket server client communication in java where the clinet introduce a string and the server return the number of spaces from that string. I want to finish the communication if the client does'n introduce nothing for more than 10 seconds but i don't know how. Any idea please?</p>
|
java
|
[1]
|
791,514 | 791,515 |
Can I make a ListView item not selectable?
|
<p>I am implementing an endless ListView (like in the Twitter app). I want to make the last item not selecteble. So that if the penultimate item is selected and I scroll down with my trackball, nothing happens. I tried setting android:focusable="false" and android:cickable="false" but I didn't notice any chnage.</p>
|
android
|
[4]
|
5,509,900 | 5,509,901 |
What does Java compiler interprets by `(byte) + (char) - (int) + (long) - 1`?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/7924961/weird-java-behavior-with-casts-to-primitive-types">Weird java behavior with casts to primitive types</a> </p>
</blockquote>
<p>Why does this code in Java,</p>
<pre><code>int i = (byte) + (char) - (int) + (long) - 1;
System.out.println(i);
</code></pre>
<p>prints 1? Why does it even compile?</p>
<p>Source: <a href="http://www.javacodegeeks.com/2011/10/weird-funny-java.html" rel="nofollow">Java Code Geeks</a></p>
|
java
|
[1]
|
5,209,999 | 5,210,000 |
How to add a scrollbar to jQuery tabs
|
<p><img src="http://i.stack.imgur.com/ehLuw.jpg" alt="alt text">Please visit <a href="http://210.94.200.250/ocw/view.php?id=1" rel="nofollow">my page</a>.</p>
<p>And if you click other tabs, you'll see what my problem is. The tab DIV will go over the line of my wrapper.
I tried to figure out if there's any option to add scroll or not, and there is not!</p>
<p>Also tried to set the height value to DIV of tab. But it didn't work.</p>
<p>What I want is to add a scoll IN the tab DIV.
so no matter how long the content of tab is, the Wrapper DIV stays the same.</p>
<p>Thanks for your help!</p>
|
jquery
|
[5]
|
4,517,830 | 4,517,831 |
Learning Java - importing and packages basics
|
<p>I'm reading every tutorial I can find as well as a book, still trivial concetps leave me asking questions:</p>
<ol>
<li><p><code>CLASSPATH</code> is a variable registered with the JVM that tells java the root directory in which to start looking for classes/jars/etc?</p></li>
<li><p><code>import</code> is similar to include (C/C++) but provides a namespace via package? I just read how without using import you have to explicitly state the package/namespace for every class (using the FQCN) such as java.util.String (possibly invalid excuse) where as using import java.util would allow me everywhere else in the code to simply refer to class as String.</p></li>
</ol>
<p>What confuses me about import is some examples use import like:</p>
<pre><code>import java.util.*; // import all public classes from java.util package
import java.util.Hashtable; // import only Hashtable class (not all classes in java.util package)
</code></pre>
<p>Yes the article also follows up:</p>
<p>Note that we can call public classes stored in the package level we do the import only. We can't use any classes that belong to the subpackage of the package we import. For example, if we import package <code>world</code>, we can use only the <code>HelloWorld</code> class, but not the <code>HelloMoon</code> class.</p>
<p>So which is it, when I use the * in an import is that not recursively importing all sub-packages?</p>
|
java
|
[1]
|
3,021,806 | 3,021,807 |
What is a Class Library in Java?
|
<p>What is a Class library in Java? Is it a collection of classes with in a package, or it is a package that has collection of classes?</p>
<p>I'm bit confused. ^_^</p>
|
java
|
[1]
|
86,228 | 86,229 |
ValueError: invalid literal for int(): Screw plugg (91_10 -> untitled) in python
|
<p>i have</p>
<pre><code>form = self.request.form
partintid = int(form['item_01bom']) # value is 'Screw plugg (91_10 -> untitled)'
print partintid
</code></pre>
<p>i want to convert <code>'Screw plugg (91_10 -> untitled)'</code> to int.</p>
<p>but i get <code>ValueError: invalid literal for int(): Screw plugg (91_10 -> untitled)</code>.</p>
|
python
|
[7]
|
4,786,686 | 4,786,687 |
Displaying MessageBox when disabled menu item is clicked
|
<p>I want to display a message box when any person clicks on the menu item which is not enabled I have tried the following coding but it is not displaying the message box.</p>
<p>Coding:</p>
<pre><code>private void updateFineDetailsToolStripMenuItem_Click(object sender, EventArgs e)
{
if (updateFineDetailsToolStripMenuItem.Enabled == true)
{
frmUpdateFineDetails objUpdateFineDetails = new frmUpdateFineDetails();
objUpdateFineDetails.MdiParent = this;
objUpdateFineDetails.Show();
}
else if (updateFineDetailsToolStripMenuItem.Enabled == false)
{
MessageBox.Show("Unauthorized Person");
}
}
</code></pre>
<p>By default I have set the enabled status to false and when the form loads I am checking whether the user is administrator, if the user is admin then this menu item will be enabled for all other user who logs into the application the above menu item has to be disabled.</p>
<p>Please note that the above coding does not generate any error, but it does not even display the messagebox as unauthorized person.</p>
<p>Can anybody help me out in performing this task?</p>
<p>Thanks in advance!</p>
|
c#
|
[0]
|
2,184,957 | 2,184,958 |
How to record video in iphone
|
<p>HI,</p>
<p>I need to record video using iPhone. To do that i used UIImagePickerController. I have an iPhone 3G, with me. when i run my code to check if source type available it says device not supported. My OS is 3.2.1, where i am wrong, can some one tell me what i need to change. </p>
<p>Also is there some other way to record video. What i need to do is to get the video stream as it is recorded. </p>
<pre><code> UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
NSArray *sourceTypes =
[UIImagePickerController availableMediaTypesForSourceType:picker.sourceType];
if (![sourceTypes containsObject:(NSString *)kUTTypeVideo ]){
NSLog(@"device not supported");
return;
}
//picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeVideo];
picker.videoQuality = UIImagePickerControllerQualityTypeHigh;
[self presentModalViewController:picker animated:YES];
</code></pre>
<p>Thanks,</p>
|
iphone
|
[8]
|
5,051,527 | 5,051,528 |
Jquery sliding display built around moving a vertical stack of images
|
<p>How would I scroll a stack of images, horizontally, through a vertically aligned space? Imagine a layout like this:</p>
<p>I have a viewable area, say a div, with a fixed size (50px wide by 300px tall) and overflow set to none to hide anything outside of it...</p>
<p>That div has three images stacked vertically displayed inside it...</p>
<p>On click of a button I want to move those three images off to the left while moving in another set of three images from the right.</p>
<p>How do you do this? Should I create an unordered list for each set of three images and then move those UL's using javascript? This seems to make layout difficult. How would you approach this?</p>
|
jquery
|
[5]
|
3,479,423 | 3,479,424 |
jquery fadein for all images, should be simples?
|
<p>I thought this would be a simple things to do, but been searching about an hour...</p>
<p>I'm trying to use jquery fadein for all images on a WP site.</p>
<p>I've got as far as loading jquery</p>
<p>but then all the things I find online are really complex, is there a simples .js I can load to apply fadein unilaterally to any image loaded? </p>
<p><em>update: I've worked around the problem: by ditching the WP enqueue and going with the google url. so the problem here is WP specific</em></p>
|
jquery
|
[5]
|
616,426 | 616,427 |
IndexOutOfBoundsException error
|
<pre><code>public void thisisnotworking()
{
Scanner input=new Scanner(System.in);
String cardA;
String cardB;
System.out.print("Enter Card: "); cardA=input.nextLine();
System.out.print("Enter Card "); cardB=input.nextLine();
Card a = game.get(game.indexOf(cardA));
Card b = game.get(game.indexOf(cardB));
</code></pre>
<p>This code is part of a method i've written. Basically the user inputs the card that is one of the cards in an array list and then another card. Currently I'm getting an IndexOutOfBoundsException error when I'm running this part of the code.</p>
<p>Can anyone tell me what is wrong with it?</p>
|
java
|
[1]
|
2,375,972 | 2,375,973 |
Case insensitive string::find
|
<p>Is there exist a case insensitive find() method for std::string?</p>
|
c++
|
[6]
|
5,110,047 | 5,110,048 |
How to upload videos using youtube gdata api in android?
|
<p>I want to upload video from my application into YouTube, and then I want to get the ID of that uploaded video. I have heard that we have to use GDATA (YouTube API) for that, but I don't know how to do that. an anyone help me?</p>
|
android
|
[4]
|
5,838,090 | 5,838,091 |
How to Add and activate PPTP or L2TP VPN connection?
|
<p>i am developing the one SIP based application to make and receive a calls. In which i need to access a PPTP VPN connection because in some countries VOIP and SIP are blocked.If i use VPN connection then calls will not block even VOIP and SIP are blocked in that country. So how do i add a new PPTP VPN connection? </p>
|
android
|
[4]
|
4,973,329 | 4,973,330 |
Url splitting in php
|
<p>I have an url like this:</p>
<blockquote>
<p><a href="http://www.w3schools.com/PHP/func_string_str_split.asp" rel="nofollow">http://www.w3schools.com/PHP/func_string_str_split.asp</a></p>
</blockquote>
<p>I want to split that url to get the host part only. For that I am using </p>
<pre><code>parse_url($url,PHP_URL_HOST);
</code></pre>
<p>it returns www.w3schools.com.
I want to get only 'w3schools.com'.
is there any function for that or do i have to do it manually?</p>
|
php
|
[2]
|
3,484,254 | 3,484,255 |
Strange width issue in Jquery
|
<p>while setting the same contents of the same label box, the width() values returned are different</p>
<pre><code> $("#ArticleUrl").text("demo");
alert($("#ArticleUrl").width());
$("#ArticleUrl").text("demo");
alert($("#ArticleUrl").width());
</code></pre>
<p>How do we avoid this?</p>
|
jquery
|
[5]
|
3,481,463 | 3,481,464 |
multidimensional arrays in javascript
|
<p>Sorry for the submitting the Question.</p>
|
javascript
|
[3]
|
2,331,532 | 2,331,533 |
android applications
|
<p>in my application i want to create a shortcut (a button), to another application but i want the user to be able to select which application he wants...
So how do i access a list of all the installed applications and how do i create an intent to start any one of those applications ?</p>
|
android
|
[4]
|
4,192,059 | 4,192,060 |
How can we temporarily turn off the running website & give a message "This site is Temprorary unavailable"
|
<p>How can we temporary off the running website & gives a message "This site is Temprorary unavailable", actully i want to gives a power to admin he can temporary on/Off the website...
according to my need i dnt want to add web_offline.htm page. I simply do it by button control i.e. Active website & Deactive website(dynamic method)</p>
|
asp.net
|
[9]
|
4,622,061 | 4,622,062 |
Using LoaderManager without SimpleCursorAdapter
|
<p>I'm trying to update an app I wrote a year or so ago and upgrade all calls to deprecated code. In one place, I was using a SimpleCursorAdapter in a ListView, and I'd like to replace that with a proper LoaderManager, for several reasons.</p>
<p>The problem is, that all the examples I've been able to find of using a LoaderManager actually still use SimpleCursorAdapter, even though it's deprecated. This includes the official documentation. Can anyone point me to the correct way to do this? I'm willing to update my ListActivity to a ListFragment if needed, and do whatever else is required. I just can't figure out how to use LoaderManager without falling back on deprecated classes.</p>
|
android
|
[4]
|
1,033,344 | 1,033,345 |
Filetype information
|
<p>I'm in the process of writing a python script, and I want to find out information about a file, such as for example a mime-type (or any useful depiction of what a file contains).</p>
<p>I've heard about python-magic, but I'm really looking for <em>the</em> solution that will allow me to find this information, without requiring the installation of additional packages.</p>
<p>Am I stuck to maintaining a list of file extensions, or does python have something in the standard library? I was not able to find it in the docs.</p>
|
python
|
[7]
|
2,023,143 | 2,023,144 |
Alert firing on ready but action not working
|
<p>On page load I want a div to be hidden. I attached an alert that is appearing but its not hiding the div. </p>
<p>Code:</p>
<pre><code>$(function () {
alert('test');
$('#hide').hide();
});
<div id="hide">
<ul>
<li><a href="#">Facebook</a></li>
<li><a href="#">Twitter</a></li>
<li><a href="#">Diggs</a></li>
</ul>
</div>
</code></pre>
|
jquery
|
[5]
|
1,338,245 | 1,338,246 |
Can't install python modules
|
<p>I have a problem with the following command: </p>
<blockquote>
<p>setup.py install. </p>
</blockquote>
<p>I know it should work, I have tried it on a laptop but I don't have access to it at the moment. I need to complete a homework so I tried the same on my PC. And when I type the same command into cmd it just runs pyscripter as if I would use right click on setup.py and click edit with pyscripter. It does nothing else. I am sure that I am in the right folder in cmd. </p>
<p>My python version is 2.7 and my pyscripter version is v2.5.3. My OS is win7. I have tried to install other modules but I get the same response. </p>
<p>Has anyone encountered the same problem? I have searched the internet but I haven't found any answers to this problem. </p>
|
python
|
[7]
|
1,882,702 | 1,882,703 |
Android Development,Animation
|
<p>I'am trying to draw a cloud animation i have ok class to do all draw work but i can't achive to run it.
here is my code(i'm new in this stuff),</p>
<pre><code>public class SampleAnimationActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ok a= new ok(null);
Canvas cnvs=new Canvas();
a.onDraw(cnvs);
setContentView(R.layout.main);
}
</code></pre>
<p>But when i run this code i have an error like "Unexpectedly stopped"</p>
<p>Clould you help me!(Remember this i'm new)</p>
<p>here is ok class</p>
<pre><code>package sample.animation;
public class ok
extends View{
Bitmap cloud;
int x=0;
int y=0;
Paint paint=new Paint();
public ok(Context context) {
super(context);
// TODO Auto-generated constructor stub
cloud=BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
}
protected void onDraw(Canvas canvas){
super.onDraw(canvas);
try {
Rect cBK=new Rect();
cBK.set(0,0,canvas.getWidth(),canvas.getHeight());
Paint pBlue=new Paint();
pBlue.setStyle(Paint.Style.FILL);
pBlue.setColor(Color.BLUE);
canvas.drawRect(cBK,pBlue);
drawCloud(x,y,canvas);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void drawCloud(int x2, int y2, Canvas canvas) {
// TODO Auto-generated method stub
canvas.drawBitmap(cloud, x2, y2,paint );
}
</code></pre>
<p>}</p>
|
android
|
[4]
|
1,625,729 | 1,625,730 |
Subtract & get difference of two images(touchpaint) and get an integer value in Android
|
<p>I have a requirement where the user needs to draw something on a FingerPaint like application and submits. I need to check to what extent the image matches and take the difference of the user's image with the ACTUAL image. The difference should then return an integer value. Depending on that, the user gets a score. Any suggestions is it possible to take difference of two images just like in MATLAB in Android?</p>
|
android
|
[4]
|
3,198,761 | 3,198,762 |
BufferedReader - read line by line
|
<p>I have created a buffered reader like this:</p>
<pre><code>this.inFile = new BufferedReader(new FileReader(fileName));
</code></pre>
<p>And then, I read from it like this</p>
<pre><code>while(System.currentTimeMillis() - lastRead < someTreshold) {
Thread.sleep(1)
}
lastRead += someTreshold;
String line = inFile.readLine();
//do something with line
</code></pre>
<p>Now I wanted to read a line with 20 entries like that, and display the results line by line. I hoped that I would get something like</p>
<pre><code>0
-someTreshold wait-
1
-someTreshold wait-
...
</code></pre>
<p>Wait I get instead is</p>
<pre><code>-someTreshold wait *20-
0
1
...
</code></pre>
<p>Why is this, and how do I fix this?</p>
|
java
|
[1]
|
1,303,464 | 1,303,465 |
Python defining variable
|
<pre><code> def f(g, x):
return g(x) + g(x-1);
def square(x):
return x*x;
</code></pre>
<p><code>f(square, n)</code> would the output just be <code>n^2+(n^2-1)</code>? Or would it be different? </p>
|
python
|
[7]
|
1,153,785 | 1,153,786 |
DomainName & Developing Time
|
<p>is there any way to develop a website by a domain name in win 7 (or even win2008)?
I mean in develop time (in VS 2010) when I press F5 , I see my application under a real domain name like : [MyDomainName.com] instead of [localhost\ProjectName]</p>
<p>Thank you very much for your feedbacks</p>
|
asp.net
|
[9]
|
3,357,007 | 3,357,008 |
Replacing the variables in a file read by php
|
<p>I have a small app I am working on that generates configuration files. Because it may be used to generate a few different variants of configurations, I gather the variable values from the user, and then read in a template configuration from a file. That file has the names of the variables in it (i.e. $ip_address) at the proper positions. I have set those variables in my php code before reading and the printing out the files. However, the variable names are printed out, not the values of the variables:</p>
<pre><code>$hostname = $_POST['username'] . "_891";
$domain = $_POST['username'] . ".local";
$routerFile = "891.txt";
$file_handle = fopen($routerFile, "r");
while (!feof($file_handle)) {
$line = fgets($file_handle);
print $line . "<br />";
}
</code></pre>
<p>Output example:</p>
<blockquote>
<p><code>hostname $hostname</code><br>
<code>ip domain-name $domain</code></p>
</blockquote>
<p>How do I get php to replace the variables names with their stored values?</p>
|
php
|
[2]
|
4,711,588 | 4,711,589 |
Showing comments on same page, what is best tool to do that?
|
<p>I have a webpage on which people can comment about each topic. Problem is there are lets say 100 topics on the page. Each time user clicks on the topic he is redirected to new page. Where they can comment and start discussion. I want this to happen on same page. I thought about implementing colorbox, boxy and other things but they are too tacky and are just for few things not for lots of comments. Anybody out there have done this? Is there tool or better way to do this? </p>
|
jquery
|
[5]
|
2,919,414 | 2,919,415 |
What's the difference between these two selectors?
|
<pre><code>$(this).parents('table:first > tbody > tr')
</code></pre>
<p>And</p>
<pre><code>$(this).parents('table:first').children('tbody').children('tr')
</code></pre>
|
jquery
|
[5]
|
2,522,123 | 2,522,124 |
How do include a javascript function in the animate queue?
|
<p>How do I include a Javascript function in the middle of the animate queue? For example I would like to call <code>alert()</code> in between these two jQuery functions to animate the height property:</p>
<pre><code> $('#divContainer').animate({ height: "200px" }, 'slow').alert('alert goes here').animate({ height: "50px" }, 'slow');
</code></pre>
|
jquery
|
[5]
|
3,685,644 | 3,685,645 |
Additions of tabbar and navigation bar controllers
|
<p>Hii...</p>
<p>I have added the tabbar and navigation bar controller by using following code. But only on the first tab I have added table view and buttons but it is also displaying on others tab views. What is the problem with this code I am not able to come to know. please help me If anyone know.</p>
<pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
//UITabBarController *tab =[[UITabBarController alloc]init];
vc1 = [[viewcontroller alloc] init];
nc = [[UINavigationController alloc] initWithRootViewController:vc1];
//vc1.tabBarItem.image = [UIImage imageNamed:@"tab.png"];
vc2 = [[viewcontroller1 alloc] init];
nc1 = [[UINavigationController alloc] initWithRootViewController:vc2];
vc3 = [[viewcontroller alloc] init];
nc2 = [[UINavigationController alloc] initWithRootViewController:vc3];
vc4 = [[viewcontroller alloc] init];
nc3 = [[UINavigationController alloc] initWithRootViewController:vc4];
vc5 = [[viewcontroller alloc] init];
nc4 = [[UINavigationController alloc] initWithRootViewController:vc5];
NSArray *navControllers = [NSArray arrayWithObjects:nc, nc1, nc2, nc3, nc4, nil];
[nc release];
[nc1 release];
[nc2 release];
[nc3 release];
[nc4 release];
tab = [[UITabBarController alloc] init];
[tab setViewControllers:navControllers];
[window addSubview:[tab view]];
[window makeKeyAndVisible];
//return YES;
// [window makeKeyAndVisible];
return YES;
}
</code></pre>
<p>Thanks alot.</p>
|
iphone
|
[8]
|
4,365,995 | 4,365,996 |
Unable to download Android 2.3.3 in Android SDK Manager
|
<p>I've tried to install Android 2.3.3 so I can then install OpenSense for HTC phones.</p>
<p>When I start the procedure to download Android 2.3.3 in the Android SDK Manager I get the followin messages:</p>
<blockquote>
<p>Preparing to install archives Downloading SDK Platform Android 2.3.3,
API 10, revision 2 </p>
<p>File not found: C:\Program Files
(x86)\Android\android-sdk\temp\android-2.3.3_r02-linux.zip (Access is
denied) Done. Nothing was installed.</p>
</blockquote>
<p>Any ideas?</p>
|
android
|
[4]
|
3,824,827 | 3,824,828 |
customErrors mode="Off" in web.config but still Server Error in '/' Application
|
<p>I deployed an asp.net website to a shared server..... </p>
<p>I got the error </p>
<p><code>Server Error in '/' Application.</code></p>
<p><strong>Runtime Error</strong></p>
<p><code>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.</code></p>
<p>Here is my page <a href="http://static3.nextgenits.com/Forms/Homepage.aspx" rel="nofollow">http://static3.nextgenits.com/Forms/Homepage.aspx</a></p>
|
asp.net
|
[9]
|
2,962,293 | 2,962,294 |
Read the first and last character of line in txt
|
<p>I wanna take lines that start with capital and end with dot.</p>
<pre><code>function isCapital($string) {
return preg_match('/^\\s*[A-Z]/', $string) > 0;
}
foreach ($url as $file => $files) {
$lines = file($files);
foreach ($lines as $key => $line) {
if (isCapital($line) && (substr($line, -1) == '.')) {
print_r( $line);
}
}
}
</code></pre>
<p>But, it does not work, blank result. What's wrong?</p>
|
php
|
[2]
|
239,702 | 239,703 |
Basic description on how to record video in iOs 4
|
<p>Hey guys i was curious if anybody could give me a very brief description of how to make an app record video in iOs 4. I know how to do all the media and whatnot using the os 3 method of using the UIImagePickerController but I do not know if that is still available in iOs4 and if not, could someone please give me a very brief description on how to do it using the new method? (No code required, but is more than welcome.)</p>
<p>-Thank you!</p>
|
iphone
|
[8]
|
1,569,139 | 1,569,140 |
Folderbrowserdialog browsing a remote pc
|
<p>I have a question regarding folderbrowser when i browse to a remote computer nothing is showing under that object.</p>
<p>But if i use fileopen and browse to the same location it lists all the folders and files, is there some sort of authenication happening with the fileopen?</p>
<p>If so how can i authenicate so that i can browse with the folderbrowser?
Once i use the fileopen i can then use the folderbrowser but this is not ideal</p>
<pre><code> FolderBrowserDialog f = new FolderBrowserDialog();
f.ShowNewFolderButton = false;
DialogResult ropen = f.ShowDialog();
</code></pre>
|
c#
|
[0]
|
1,573,897 | 1,573,898 |
PHP Blank Values Inserted In Database
|
<p>I'm using PHP and Mysql</p>
<p>Here I have used simple form to insert the Name, Email, Phone Number.</p>
<p>I have validated all the data's: (PHP code after submit...)</p>
<pre><code>$error = array();
if(isset($_POST['Name']) && $_POST['Name']=='') {
$error[] = "Please enter the Name";
}
if(isset($_POST['Email']) && $_POST['Email']=='') {
$error[] = "Please enter the Email";
}
if(isset($_POST['Phone']) && $_POST['Phone']=='') {
$error[] = "Please enter the Phone";
}
</code></pre>
<p>Finally Insert the data using the below query..</p>
<pre><code>if(count($error)==0) {
$error= "";
And the query is
insert into mytab ('Name','Email','Phone') Values (mysql_escape_string($_POST['Name']),mysql_escape_string($_POST['Email']),mysql_escape_string($_POST['Phone']));
redircet to success..
}
</code></pre>
<p>It's Works fine, But Some time i am geting Insert $error log like the below..</p>
<p>error Log : </p>
<pre><code> Time File name:myfile.php Insert $error: insert into mytab ('Name','Email','Phone') Values('','','');#~#
</code></pre>
<p>The log i was write using my db wrapper class (using mysql_$error())</p>
|
php
|
[2]
|
2,941,743 | 2,941,744 |
Emoji like Application
|
<p>I want to create Custom Keyboard application like Emoji app.
I know how to enable emoji in the iphone but my question is from were the icons are coming
and how i can add my own icons to emoji keyboard or i have to make my own keyboard separate.</p>
<p>This all should work with all app like email, notes etc...</p>
<p>Please advice some solution.</p>
|
iphone
|
[8]
|
1,846,076 | 1,846,077 |
How To Play Video File Using Asp.net Flash Video Control?
|
<p>Can u pls tell me How To play the Video File Using Flash Video Controller in asp.net.
i'm Getting the Saved Video Path but it didn't play the video.</p>
|
asp.net
|
[9]
|
2,757,674 | 2,757,675 |
Encoding spaces with the javascript encodeURIComponent function
|
<p>Why does the javascript function encodeURIComponent encode spaces to the hex unicode value %20 insteady of +. Should uri parameters not spaces to +?</p>
|
javascript
|
[3]
|
4,935,687 | 4,935,688 |
how to change the UILabel value base don uiwebview action
|
<p>Iam developing one application.In that I want to change the value of <code>UILabel</code> if <code>UIWebview</code> finish loading.</p>
<p>First in webview load the below html file</p>
<pre><code> <html>
<head>
<meta http-equiv=“content-type”content=“text/html;charset=utf-8″ />
<script src=“test-1.js”></script>
</head>
<body>
</body>
</html>
</code></pre>
<p>And below is the .js javascript file</p>
<pre><code> function add(input1,input2)
{
int i = input1 + input2;
return i;
};
</code></pre>
<p>So after finishloading the webview I written the code like this</p>
<pre><code> -(void)webViewDidFinishLoad:(UIWebView *)webView
{
NSString *str=[[NSString alloc]initWithFormat:@"add(%d,%d)",10,5];
NSLog(@"%d",[[web stringByEvaluatingJavaScriptFromString:str] integerValue]);
label.text=[[web stringByEvaluatingJavaScriptFromString:str] integerValue];
}
</code></pre>
<p>But i didn't get any value in console and label value also not changed.So how to change the value of label.</p>
|
iphone
|
[8]
|
2,880,297 | 2,880,298 |
Why does this particular JavaScript code work this way?
|
<pre><code>var my_obj = Object.create({}, {
getFoo: {
value: function() {
return this.foo;
}
}
});
my_obj.foo = 1;
alert(my_obj.getFoo());
</code></pre>
<p>Why is <code>getFoo</code> the function instead of <code>value</code>?</p>
|
javascript
|
[3]
|
2,089,055 | 2,089,056 |
Bluetooth save chat history in android
|
<p>is there any way to store bluetooth chat history device wise.if yes then please guide me.</p>
|
android
|
[4]
|
4,893,099 | 4,893,100 |
Syntax problem when checking for a file
|
<p>This piece of code has previously worked but I have C&P it to a new place and for some reason, it now won't work!</p>
<pre><code> <?
$user_image = '/images/users/' . $_SESSION['id'] . 'a.jpg';
if (file_exists(realpath(dirname(__FILE__) . $user_image)))
{
echo '<img src="'.$user_image.'" alt="" />';
}
else
{
echo '<img src="/images/users/small.jpg" alt="" />';
}
?>
</code></pre>
<p>As you can see, I am checking for a file, if exists, showing it, if not, showing a placeholder. </p>
<p>The $_SESSION['id'] variable does exist and is being used elsewhere within the script.</p>
<p>Any ideas what the problem is?</p>
<p>Thanks</p>
|
php
|
[2]
|
5,744,973 | 5,744,974 |
Transferring variables between two classes
|
<p>I have 2 classes:</p>
<pre><code>public class TouchImageView extends ImageView
public class TouchImageViewActivity extends Activity
</code></pre>
<p>In my <code>TouchImageView</code> class I have touch listener that calculates where you have touched the image. What I need is to transfer the touch point to the <code>TouchImageViewActivity</code> without creating new instance of it. The touch calculated constancy.</p>
<p>Calling <code>TouchImageView</code> from <code>TouchImageViewActivity</code>: </p>
<pre><code>TouchImageView img = (TouchImageView) findViewById(R.id.img);
img.setImageResource(R.drawable.g_map2048);
</code></pre>
|
android
|
[4]
|
5,041,880 | 5,041,881 |
Why does a specific import sees other imports? Python 2.6
|
<p>I have two files. SysDump.py which does <code>from libApi import _SysDump</code> and in the other file libApi.py I have many classes and one of them is </p>
<pre><code>class _SysDump():
import cPickle as _cPickle
import math as _math
from zipfile import ZipFile as _ZipFile
import re as _re
</code></pre>
<p>the problem is the import in SysDump not only sees the _SysDump in libApi.py but other classes too!! How can I prevent it from seeing inside the other classes?</p>
<p>Python 2.6. Yes I do have a <code>__init__.py</code>. Can it in any way help bring the privacy I am hoping for?</p>
|
python
|
[7]
|
5,295,046 | 5,295,047 |
I need to get some device values in Android
|
<p>I need to get the device name, version, display values (high, width, layout). After that, I need to create a <code>JSON</code> result. </p>
|
android
|
[4]
|
5,357,797 | 5,357,798 |
Why am I getting a DefferedDocumentImpl when trying to create a JDOM Document?
|
<p>Im trying to parse the input stream from a zipfile zip entry and trying to create a org.w3c.dom.Document but for some reason im getting a DefferedDocumentImpl back. Im also creating a new org.w3c.dom.Document and this is returning a DocumentImpl. Then using Xpath to select a single node but im getting this error "org.apache.xerces.dom.DocumentImpl incompatible with org.jdom.Element" when Im trying to find my specific node. Ive done some searching but cant seem to find and examples. Anyone know why im not getting my docs created as dom docs? Thanks in advance for the help.</p>
<pre><code> //create a zip file from the crate location
File downloadFile = crate.getLocation();
ZipFile zipFile = new ZipFile(downloadFile);
//put all the contents of the zip file into an enumeration
Enumeration entries = zipFile.entries();
while (entries.hasMoreElements()){
ZipEntry entry = (ZipEntry) entries.nextElement();
String currentEntry = entry.getName();
if (currentEntry.equals("ATTACH 8130-3 XML/signature.xml")){
InputStream zipStream = zipFile.getInputStream(entry);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
org.w3c.dom.Document doc = (org.w3c.dom.Document)dBuilder.parse(zipStream);
doc.getDocumentElement().normalize();
NodeList certNode = doc.getElementsByTagName("ATA_PartCertificationForm");
int testInt = certNode.getLength();
org.w3c.dom.Document doc2 = (org.w3c.dom.Document) dBuilder.newDocument();
Node parentNode = doc.getParentNode();
Element rootElement = doc2.createElement("CurrentCertificate");
doc2.appendChild(rootElement);
for(int i=0; i<certNode.getLength(); i++){
Node childNode = certNode.item(i);
Element childElement;
childElement = (Element)certNode.item(i);
rootElement.appendChild(doc2.importNode(childNode, true));
String nameString = childNode.getNodeName();
Element block13Element = (Element) XPath.selectSingleNode(doc2, "//Block13M");
System.out.println("tester test");
}
System.out.println("Test break");
}
}
</code></pre>
|
java
|
[1]
|
4,568,716 | 4,568,717 |
Javascript - possible to remove element of an associative array
|
<p>Is it possible to remove an element of a Javascript associative array (i.e., set back to native undefined)?</p>
<p>When I tried simply <code>alert(array['knownKey']); array['knownKey']=undefined; alert(array['knownKey']);</code> ... the second alert produced the literal undefined... whereas, the first alert returned nothing.</p>
|
javascript
|
[3]
|
2,103,163 | 2,103,164 |
Jquery cookie + google map api 3 latlng
|
<p>I have this javascript,</p>
<pre><code> if ( $.cookie("latlng") ) {
myLatlng = new google.maps.LatLng( $.cookie("latlng") ); //problem here??
} else {
$.cookie("latlng", "0,0", { path: '/' });
myLatlng = new google.maps.LatLng(0,0);
}
</code></pre>
<p>The cookie function is using <a href="https://github.com/carhartl/jquery-cookie" rel="nofollow">https://github.com/carhartl/jquery-cookie</a>.</p>
<p>My problem is that how do I pass the value of the cookie to google.maps.LatLng??</p>
<p>Thanks in advance!</p>
|
javascript
|
[3]
|
4,855,785 | 4,855,786 |
AIDE Won't Build App Stuck on "Running AADT" Stage
|
<p>I've moved an app to mmy device so that AIDE can build it and so I can install but it is stuck at the AAPT stage. Any suggestions?</p>
|
android
|
[4]
|
3,177,571 | 3,177,572 |
send touch event from ADB to a device
|
<p>I am trying to send touch events to a device using ADB shell command, so that I can do some basic automation for UI tests. I have followed the discussion in some previous threads regarding this. </p>
<p>I confirmed about getting the events and using sendevents,to send out 6 events for each touch ( xcoord, ycoord, 2 for press,2 for release) and it was easy to use this information to sendevents, but a getevent for the touchscreen for a device seems to generate far too many events.</p>
<p>Has somebody managed to send touch event from ADB to a device? Could you please share the solution.</p>
<p>I really appreciate your help.</p>
<p>I am working on recording the touch events on phone. After that i wish to send the same event back to the device as part of UI testing.</p>
<p>Please help</p>
|
android
|
[4]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.