Combine browsing an image and upload

See below code. There are two buttons. One button is to select an image and the second button is to upload the selected image. So first the user browse an image and then secondly the user clicks on the UPLOAD IMAGE button to upload. How can I combine

Multiple CSS selectors with prototype

I'm refactoring some code that currently looks like this: $$('#wrapper > div').each(function(e){ if((e.id!='header') && (e.id!='footer') && (e.id!='content')){ // various other stuff here } }); I want to switch the initial selector and

Specifying Manifest.MF during the test - JAR Fat / Shaded

I have some values that I need to appear in a MANIFEST.MF file to keep JAI happy with ImageIO.read. Where do they need to exist to be available during the test phase of the maven cycle?Wouldn't that be in the test resources src/test/resources/META-IN

How do I have a current user name and other details in servlet?

I have a login page named login.jsp for the customer to login. The checklogin.jsp page where I am checking the user id and password to enter into the customer UI. I want to have user the username and other details in my servlet. How can I get this de

Adding a property to an angular object

I am running an Angular app that pulls its data from a Web API service. The API returns the objects as JSON and the Angular service (via $http.get() ) returns them to the controller as an array of objects. Pretty normal stuff. What I'd like to do is

Using Sed to Delete Lines with Non-Alphabetic Letters

The following Regex works as expected in Notepad++: ^.*[^a-z\r\n].*$ However, when I try to use it with sed, it wont work. sed -r 's/\(^.*[^a-z\r\n].*$\)//g' wordlist.txt You could use: sed -i '/[^a-z]/d' wordlist.txt This will delete each line that

Github clones all branches at once

I'm trying to clone an entire repository onto my machine using linux. I used git clone <url> I then went into the folder where it was downloaded and typed git branch in the terminal. It's only showing me master and not other branches which were in t

How to install the Android 2.1 platform on my Windows 7 machine

i have installed latest SDK Revision 11 as of now and have downloaded and installed Platform 2.3.3, 3 and 3.1 I need to develop an application for my 2.2 Version, and for that when i tried to install 2.2 following error was thrown Downloading SDK Pla

Make a query for uniqueness in MongoDB and insert so unique

I'm totally new to MongoDB. I'm using Morphia to access it from Java. I need to do something along the lines of this: public boolean isUnique(short s){ //OPERATION 1: Check in mongo if object with field "id" = s exists //if so, return false //el

Implement asynchronous method synchronously

I have an interface which forces me to implement an (async) Task: namespace Microsoft.Owin.Security.Infrastructure { public interface IAuthenticationTokenProvider { .. Task CreateAsync(AuthenticationTokenCreateContext context); .. } } I want to imple

How to start the activity on the button click on alertDialog

I have an alert dialog setup within a class called 'ViewBreakout' I have the button setup fine and it creates the button but when I try to add an intent I get an error message that reads "The constructor Intent(new DialogInterface.OnClickListener(){}

The TimeLeft name does not exist in the current context

This question has been closed. This is different from the other questions I've seen related to this. I have two forms in my Mario game, right? I set a public integer in one of them, GameGUI.cs. In TimerStatus.cs I want to display this variable but it

Python TCP stack implementation

Is there a python library which implements a standalone TCP stack? I can't use the usual python socket library because I'm receiving a stream of packets over a socket (they are being tunneled to me over this socket). When I receive a TCP SYN packet a

How to delete the time part of a datetime (SQL Server) value?

Here's what I use: SELECT CAST(FLOOR(CAST(getdate() as FLOAT)) as DATETIME) I'm thinking there may be a better and more elegant way. Requirements: It has to be as fast as possible (the less casting, the better). The final result has to be a datetime

change the color of an echo command

ive searched this question on google and i've found many answers but none of them seem to work in my situation. i need to echo out a command in orange, but everything i do doesn't seem to work. while($row = mysql_fetch_array($result)) { echo $row ['t

How to handle MATLAB and Simulink file names?

I am discovering something that is, quite frankly absurd, about MATLAB. It is not possible in a session of MATLAB to open two files or even reference by link two files with the same name, even if in different folders (as would re required by any file

Why is NPE discarded at the end of the activity?

I have an error that has been driving me crazy for days. Unfortunately, I can not show you the code for two reason, my boss will not appreciate it and the codebase is too large to share. The error occurs whenever the Activity is finishing. Weather it

The rand () function does not work properly in C ++

I am writing a game where the computer chooses a random number that a user has to guess. Then, It is the user to choose a number (he just guesses a number) that the computer has to guess. The problem is that the rand() function that i use in the seco

Initialize strings using New or not?

This question already has an answer here: Java Strings: "String s = new String("silly");" 23 answers I wanted to know if it is the same to do this, in terms of optimization and performance: public class Test { public static void main(S

Access device information with C # or VB

If i open the Device Manager on Windows, then go to "Ports (COM LTP)" i see 7 devices. 1 - Builtin Computer RS323 2-6- USB Serial Port (COM X) if i make a right click -> Properties -> Details, i can see a big list of values. Interesting fo