- 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
69 Posted Topics
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 … | |
I'm trying to make an app that will memorize 1 point on the screen and continuously click that point (running on a timer) until it is manually stopped. I've noticed that the mouse functions require you to be "inside" a component for it to recognize the mouse position or do … | |
Re: Why not use the windows shortcut hotkey to run your java program? All you have to do is create a shortcut and define it a hotkey which will cause it to start. You can have your app automatically close when its finished doing whatever it has to do. To run … ![]() | |
Ok, this one is a little tough for me to explain. I have a runnable jar file that contains a .exe that I'm trying to exec in my program like a command line function. Usually to execute a .exe in a command line I would do: C:\"path to .exe" -option … | |
[CODE=JAVA] String line = "Extracting from E:\\Junk\\morejunk\\file.txt"; System.out.println(line); //prints: Extracting from E:\Junk\morejunk\file.txt String[] splitPath = line.split("\\"); //exception thrown here String folder = splitPath[splitPath.length-2]; System.out.println(folder); [/CODE] [QUOTE]Exception in thread "AWT-EventQueue-0" java.util.regex.PatternSyntaxException: Unexpected internal error near index 1[/QUOTE] My objective is to always print the folder containing the file being extracted (morejunk … | |
Re: You are not really telling us what is happening exactly that makes it look messed up.... Additionally, you can use a null layout in your JPanel, but you will have to use setLocation(int x, int y) and setSize(int x, int y) on everything you add to that JPanel, otherwise they … | |
Re: If you are trying to make some kind of encryption or possibly a random password maker u can use random ascii decimal values between 32-126. (look at [url]http://www.asciitable.com/[/url]) all you would have to do is generate random integers between that range and type cast them into chars, saving them into … | |
Re: You want changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) [B]* toggle: false, extend: false. Clear the previous selection and ensure the new cell is selected.[/B] * toggle: false, extend: true. Extend the previous selection from the anchor to the specified cell, clearing all other selections. * toggle: true, extend: … | |
Re: I only skimmed over your code. I sometimes use a class called Global which contains a list of functions defined statically. Any class can then call Global.function(arg0) on any of the Global functions. Not sure if this helps :) | |
Re: I would really urge you to simplify your code for your self and for everyone else. Programming your way would never work for a large application/program because it makes it look way too complex and annoying to read.... Your project shows 3 pictures, one for each option, so automatically you … | |
Re: Did you get anywhere with this ChangBroot? I'm trying to do a similar thing, but by placing a smiley in place of some text. Here's my thread: [url]http://www.daniweb.com/forums/thread210843.html[/url] | |
Well, I'm doing pretty good with my WebChat application, but I was thinking to add some smileys! At first, I would like the app to auto detect the smileys in standard form from a given string and place the image in its place, but I came across the problem: how … | |
Re: Mnemonics uses the mouseless modifier which is alt by default. instead, u can use a KeyListener and get the keycode inside keypressed and match it to KeyEvent.VK_RIGHT. from there, u can do button.doClick() to do the action. [CODE=JAVA] JButton b = new JButton("test"); b.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent ke) … | |
Re: [QUOTE]i have just created a very simple diesign of something that is static but should play mp3 files.[/QUOTE] This is very hard to follow.... I don't see where your simplicity kicks in :) | |
Re: I'm working on a webchat application myself, kinda like mIRC. I was curious at one point to make a downloader application which can stop/resume/show stats/etc and watch the clipboard for relevant extensions. How about a browser? An IDE? your own personal command line app with built in tools. an ftp … | |
Re: You can't have a main functions in both classes if you intend to make a single program. I would change the main function in your bust class into a constructor: public bust() { ... } and create an instance of bust in bustGUI's and define it in its constructor: bust … | |
Re: here's how i would do it: [CODE=JAVA] for (int pos=0; ;pos++) { if (pos == 8) { //too many entries break; } /* make this into a function */ //ask for month String month = //get month from input; ...... ...... if (name.length() == 0) break; else { //print it … | |
I'm writing a WebChat application using the socket functions in java. I'm able to listen for incoming sockets on the server side and connect from the client side just fine, but I'm having a problem communicating from the client to the server to ALL the clients. Right now, I have … | |
I'm looking for a way to detect when a JFrame is moving (maybe there is some kind of listener). I have a primary JFrame that loads a 2nd JFrame next to it. I want this 2nd JFrame to move simultaneously with the primary JFrame as though it were attached. I … | |
This is the snippit im having a problem with. I've tried playing with the preferred size of both the JList and the JScrollPane with no luck/mixed results. I want to be able to size it to exactly 1 size so it never changes. [CODE=JAVA] import java.awt.BorderLayout; import javax.swing.DefaultListModel; import javax.swing.JFrame; … |
The End.