- Strength to Increase Rep
- +5
- Strength to Decrease Rep
- -1
- Upvotes Received
- 7
- Posts with Upvotes
- 5
- Upvoting Members
- 6
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
I'm trying to get my android app to talk to my java server using a secure socket (where I'm going to exchange the person's username and password and verify it, in non plain text). How do I go about doing something like this? Source code example on the android (client) … | |
For whatever reason, no speech recognizer is installed in the default android emulator for 2.2 (its the only one I've tried). I would like to be able to test my android app which uses the google speech api in an android emulator. Does anyone have any suggestions for this? There … | |
[CODE] import java.util.regex.Matcher; import java.util.regex.Pattern; public class test_regex { public static void main(String[] args) { String text = "(asdf) (123) (zxcv)"; Pattern p = Pattern.compile("^\\((\\S+)\\) \\((\\S+)\\) \\((\\S+)\\)$"); Matcher m = p.matcher(text); if (m.matches()) for (int i=0; i<m.groupCount(); i++) System.out.println(i+".) "+m.group(i)); else System.out.println("no match"); } } [/CODE] [QUOTE] Output: 0.) (asdf) … | |
I tried everything could possibly think of to do this and have spent hours trying to figure it out.. I'm trying to take this timestamp: 2011-03-23 00:43:07 which is in GMT zimezone and convert it to a Date that is in my timezone which is 4 hours later. 1. It … | |
"ps aux" outputs the following as the first line: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND how can I preserve this line if I do a "ps aux | grep <someuser>" so that I can still see the header for each column? In essence, I want … | |
Is there a way, using java's standard library to replace characters like: " with '"' and &# 39; (i put a space so the site doesn't change it) with ''' in a string? For example, change from: [CODE] String message = ""This &# 39;is&# 39; a test"e"; [/CODE] to: [CODE]message … | |
Right now, with the manifest file, I am able to create my runnable jar to work with: folder structure: [CODE]libs/thirdpartylib1.jar libs/thirdpartylib2.jar myJar.jar[/CODE] using this manifest: [CODE]Class-Path: libs/thirdpartylib1.jar libs/thirdpartylib2.jar Main-Class: myPackage.myClass[/CODE] Is there any way I can package these jar files into my runnable jar so that I do not need … | |
I have never used javascript before, but I know most other programming languages. [CODE] <div id="test"> <p class="location">New Jersey</p> </div> [/CODE] Is there a way to take out "New Jersey" and save it in a variable using javascript and then to remove the <div> who contains the class="location" (its parent?) | |
So I just started using C# and am looking into creating a WPF program. I was able to create the window and add in a TextBox of variable name console. How can I make console static such that I can access it statically across all my classes? I tried to … | |
[code] public class TEST extends JFrame{ ... blah, blah..... private void launch(){ setBounds(200, 200, 100, 100); setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel greenPanel = new JPanel(); greenPanel.setSize(70, 70); //<---- xNot resize the greenPanel greenPanel.setBackground(Color.green); JPanel yellowPanel = new JPanel(); yellowPanel.setSize(50, 50); //<-- xNot resize yellowPanel in greenPanel yellowPanel.setBackground(Color.yellow); greenPanel.add(yellowPanel); JPanel bluePanel = new JPanel(); … | |
so, lets say I have a thread that looks like this: [CODE=java] public run() { boolean active = true; while (active) { //do some action that takes a really long time } } [/CODE] Is there any way I can directly stop and destroy this thread in the middle of … | |
Re: What you want is an executable .jar file... All it is, is all your already compiled .class files Zipped in one icon, which executes the .class which contains your main method... Basically, it's like an .exe file but with a .jar extension, for java... | |
I tried everything... I cant find a suitable JSomething to be able to add words to a pane that are different sizes and fonts. I tried JTextAreas but they only allow plain text. JEditorPanes allow HTML but don't seem to let me append single words for some reason. I'm also … | |
I needed a way to have words with different sized fonts in my JTextArea, but apparently only plane text is supported for it. I turned to JEditorPanes which apparently support html which allows different sized fonts, which is great. Now, I need a way to traverse back into the lines … | |
Re: what about using a stringstream and the getline() function with an obvious delimiter? | |
I know how to create a UDP socket and bind it to an ip/port and how to read a stream of data from the socket using recvfrom(), but how can I get the data of a single UDP packet at a time? For example if "data of one packet" was … | |
When I want to load images, locally, I use use: [CODE=Java]ImageIcon qmarkIcon = new ImageIcon("images/mark.gif");[/CODE] When I run the program through eclipse, everything works fine--all the images load like normal, but when I package the executable .jar and run it in a folder without images/*.gif's, none of the images load..... … | |
One of my programs work with MySQL (Connector/J Driver). The issue is, some of the contents I'm passing into the query string are read from a file that contains several escapable characters. When I try to commit the query (such as an INSERT) with a value that has unescaped characters … | |
[CODE]new File("config.ini");[/CODE] 1. When used via eclipse, the correct file is found in the root of the project. 2. When used via a runnable jar, it looks in C:\users\ME\config.ini How do I make it look at the file outside of the jar? New Folder: - program.jar - config.ini | |
If I have 2 synchronized methods and 1 calls the other, what exactly happens? If those 2 synchronized methods are in a class, and 2 of those classes are created, each of them calling one of their synchronized methods, what would happen? If those 2 classes extended Thread and were … | |
so I have 2 methods, 1 with an argument the other without command_hello(String sender); command_hello(); I am trying to invoke the method using just their name: command_hello I can do this by using the following for the method with no arguments: getClass().getMethod("command_hello").invoke(this); Works! Great! But the moment I try getClass().getMethod(cmds.get(cmd)).invoke(this, … | |
I have a class which extends LinkedList and implements Runnable. I also have a main class which modifies the extended LinkedList. So, the issue is, the LinkedList is being modified by 2 threads: main() in the main thread and run() in the thread which is created from implementing Runnable An … | |
I want to parse a string into something like an array: [url]ftp://user:pass@host:portpath[/url] [url]ftp://anon:1234@111.222.333.444:9999/path1/path2/[/url] I read the java docs about using Pattern and Matcher but I keep getting an "IllegalStateException: No match found" error. [CODE=java] import java.util.regex.Matcher; import java.util.regex.Pattern; public class test { public static void main(String[] args) { String s … | |
Theres a functionality that I need that is not built into the PHP source code. I would like to modify a .c file in the code, recompile, and then be able to execute the php function with the same name as the one I added to the .c in my … | |
I'm still fairly new to C, so I was wondering what would be the fastest way to get a char pointer pointing and ending between 2 different char delimiters? For example: text text (text I need) I need a char * to "text I need" | |
I have 1 package that manages the main JFrame of my application. This JFrame needs to access an image (which is a resource) of another package. I was able to get it to work using: [CODE=JAVA]new ImageIcon(getClass().getResource("../"+packageName+"/icon.jpg"));[/CODE] But this does not work when using a runnable jar (getClass().getResource("../"+packageName+"/icon.jpg")) returns null). … | |
| Re: Threads were a real tease for me cause I learned of them on my own too. 1 thing that will help you understand is that a Thread need only contain 1 function and an optional constructor. [CODE=JAVA] public class MyThread extends Thread { String text; public MyThread(String text) { this.text … |
Re: You want to open an applet using another applet? It would make sense for an Applet to open a JFrame or a JFrame to open another JFrame, but not for an Applet which opens another Applet.... Applets are for web applications that you can open in your browser. They shouldn't … | |
Re: Every player has a Hand which could be: A rock, A paper, or A scissor Every player could have: A name, A hand, A number of Wins, A number of Losses, and a choice that will affect his hand/number wins/or number losses. Every game could have: A bunch of players, … | |
I'm making an app that, when executed will continue to do something in an infinite loop, forever (or until the process is manually stopped). My goal is to create a process with a unique name which will run this application (right now java uses javaw.exe as the same name for … |