|
I have a general question about databases and Java. I'm doing something that now looks like I could do better with a database. I know of things like JDBC that provide some abstraction to a database, and I generally know of persistence frameworks that add a layer on top of that for things like retrieving information for beans. I am wondering if those frameworks would interfere with what I'm try to do, or if it's worth looking into them. I'm iterating through daily stock data from files right now, with each symbol in a file. Every line has the symbol, date, closing price, opening price, high, low, and volume. So it's pretty much just big tables. I'd want to be able to look up spans of data for each symbol as a basic thing, but then also be able to query based on extra numeric data I'm going to provide. I suck at SQL (since I never use it after taking the tutorials) but it seems like these are pretty basic queries. So would a persistence framework on top of that be more of a burden?
|
# ? Dec 15, 2008 15:57 |
|
|
# ? Apr 28, 2024 02:38 |
|
Rocko Bonaparte posted:That's too bad. For this case it isn't a huge issue, but if I'm crunching a bunch of stuff, then I could see it being hellish trying to cram it into a single, atomic statement. In other words, it is easy to express what you really want, so it's not really a problem.
|
# ? Dec 15, 2008 19:03 |
|
Rocko Bonaparte posted:I have a general question about databases and Java. I'm doing something that now looks like I could do better with a database. I know of things like JDBC that provide some abstraction to a database, and I generally know of persistence frameworks that add a layer on top of that for things like retrieving information for beans. I am wondering if those frameworks would interfere with what I'm try to do, or if it's worth looking into them. Fly fucked around with this message at 19:39 on Dec 15, 2008 |
# ? Dec 15, 2008 19:23 |
|
Thanks Fly for both responses. I think I'll figure out how my queries might look in SQL and then start thinking about what that would mean in Java. I should have some minimal comfort editing a database before I start trying to work it with a framework. When I saw hibernate in action, I saw it being used to tie objects (beans, I guess) to things in a database. It would take care of manipulating the database under the hood. Maybe that would work for me, but I'd need to shift to J2EE to start using bean components. And generally the nature of the work I'm doing, it would probably be easy enough to generate the queries by stating "give me all data for symbol XYZ from 2006/01/01 to 2007/01/01."
|
# ? Dec 15, 2008 20:56 |
|
Rocko Bonaparte posted:Maybe that would work for me, but I'd need to shift to J2EE to start using bean components.
|
# ? Dec 15, 2008 22:27 |
|
Fly posted:I would stay far away from J2EE. The JPA stuff in the EJB 3.0 specification is nice though. It's basically a simplified version of the Hibernate APIs. You do not need to use J2EE bean stuff (session beans, entity beans, hillo beans) for anything, ever.
|
# ? Dec 15, 2008 23:12 |
|
Rocko Bonaparte posted:Can one use Hibernate without a J2EE framework? I've only ever seen it used in J2EE. I am more familiar with the JPA's terminology and API, so I cannot name the Hibernate APIs from memory.
|
# ? Dec 15, 2008 23:44 |
|
Just quickly looking around, it seems like JDBC should work for the kind of data mining queries I'm doing. It would be hideous if I was doing session logic of some kind, but I'm not.
|
# ? Dec 16, 2008 01:41 |
|
Fly posted:You should be able to make some private static methods to generate any of the data that you really need. The chained constructor call must be the first thing there because there is no valid instance state to reference, and the code might try to reference instance state if any instance methods or properties were accessible before the invocation of the other constructor. This is usually true, but it breaks down when you want to simultaneously generate multiple values to pass to a different constructor. For that you'll have to either 1) build some sort of temporary tuple object (the construction of which probably won't be optimized out, if you're performance-obsessed) or 2) use a static builder method (which of course can't be used by subclass constructors). Java is unnecessarily restrictive here; the JVM itself is more permissive but still does not allow loops before delegate constructor calls.
|
# ? Dec 16, 2008 02:25 |
|
rjmccall posted:This is usually true, but it breaks down when you want to simultaneously generate multiple values to pass to a different constructor. For that you'll have to either 1) build some sort of temporary tuple object (the construction of which probably won't be optimized out, if you're performance-obsessed) or 2) use a static builder method (which of course can't be used by subclass constructors). Java is unnecessarily restrictive here; the JVM itself is more permissive but still does not allow loops before delegate constructor calls.
|
# ? Dec 16, 2008 03:34 |
|
...
maskenfreiheit fucked around with this message at 03:55 on Sep 29, 2010 |
# ? Dec 16, 2008 20:46 |
|
GregNorc posted:This is probably as basic as it gets, but I can't figure out this error. How are you trying to run it. I get the impression you're using the command line with javac/java? Save the code below as file HelloWorld.java code:
Now run it using the java launcher, command: java HelloWorld Note that it's java HelloWorld, NOT java HelloWorld.class
|
# ? Dec 16, 2008 20:53 |
|
...
maskenfreiheit fucked around with this message at 03:55 on Sep 29, 2010 |
# ? Dec 16, 2008 21:00 |
|
This is a question in my homework and I don't know what's going on. True or False, the argument to the method named "substring" is the actual substring that is being searched for. This is another question, which I answered II and III are true. Can someone confirm or deny and explain? Which of the following three Java features accurately determine if two String objects are identitical? I. == operator II. equals method III. compareTo method
|
# ? Dec 16, 2008 22:21 |
|
Sour Fish posted:This is a question in my homework and I don't know what's going on. False. Usually substring takes starting index and length. It is usually a member method of a String class and returns part of that string. Otherwise it would just take some string as argument and start and length integers, and return part of that string. I think this is what you are talking about : http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html#substring(int) For your second question its both II and III. equals returns true or false, but compareTo is more powerful. It returns 0 if they are equal, -1 if one string is lexicographically before the other, and 1 otherwise. You should probably get into the habit of using official Javadocs pages that I already linked to. They usually answer such questions right away. hexadecimal fucked around with this message at 22:25 on Dec 16, 2008 |
# ? Dec 16, 2008 22:23 |
|
hexadecimal posted:Thank you. Could you explain in a little more detail what the first question is asking me? I honestly do not understand the question or the answer.
|
# ? Dec 16, 2008 22:31 |
|
Lets look at the Java API for the String class.code:
In order to call this method you have to have an existing String object like so: code:
If the statement in the question were true then in the API there would be a static method in the String class that received a String like so: code:
code:
Janitor Prime fucked around with this message at 23:19 on Dec 16, 2008 |
# ? Dec 16, 2008 23:16 |
|
^^ I thought that what the question was referring to was something more like this: public boolean substring(String sub) - Determines whether the given substring can be found in this string. Or perhaps: public int substring(String sub) - returns the starting index where the substring can be found in this string, or else -1; Thus, this would return true or 8, depending on which function existed: code:
|
# ? Dec 17, 2008 00:48 |
|
Has anybody taken a look yet at JavaFX? Any opinions so far?
|
# ? Dec 17, 2008 23:26 |
|
Is there a way to convert the RGB value of a BufferedImage pixel into hex? Alternatively, can the value of a pixel be gotten and set using hex?
|
# ? Dec 19, 2008 05:56 |
|
Ensign Expendable posted:Is there a way to convert the RGB value of a BufferedImage pixel into hex? Alternatively, can the value of a pixel be gotten and set using hex? There are methods getRGB and setRGB to access individual pixels using the standard ARGB color space. There are, however, exactly zero methods to access the value of a pixel in "hex", because that is meaningless.
|
# ? Dec 19, 2008 06:19 |
|
RGB is already hex. FF = 255 F0 = 240 If it is really important extend the class or something and make a function to take a string or hex number, parse to separate the color pairs, make them ints, and pass to the real setColor (or whatever it is).
|
# ? Dec 19, 2008 06:21 |
|
Oh, ok. I just wanted to know if there was an easier way of doing it that dvinnen said.
|
# ? Dec 19, 2008 06:30 |
|
Ensign Expendable posted:Oh, ok. I just wanted to know if there was an easier way of doing it that dvinnen said. It's fairly straightforward. BufferedImage im = whatever; String hexString = Integer.toHexString( im.getRGB(x, y) ).toUpper();
|
# ? Dec 19, 2008 08:31 |
|
...
maskenfreiheit fucked around with this message at 03:55 on Sep 29, 2010 |
# ? Dec 20, 2008 17:25 |
|
GregNorc posted:
What's that semicolon doing there?
|
# ? Dec 20, 2008 17:37 |
|
Edit: Double Post
maskenfreiheit fucked around with this message at 21:31 on Mar 13, 2017 |
# ? Dec 20, 2008 17:40 |
|
Don't know if it's kosher here, but I've been involved in a work project using Scala And coming from a C/C++ and Python background, I'm liking it alright. Was just wondering if anyone's writing with scala, and if so, what IDEs and environments are you developing with. We're a very Emacs shop, but I guess I'm more used to a "traditional" IDE.
|
# ? Dec 24, 2008 16:59 |
|
Lurchington posted:Was just wondering if anyone's writing with scala, and if so, what IDEs and environments are you developing with. We're a very Emacs shop, but I guess I'm more used to a "traditional" IDE.
|
# ? Dec 24, 2008 17:08 |
|
So I've been working on this applet/servlet combo for a while now. The applet communicates with a servlet that collects data and sends it back to the applet via HttpsURLConnection. I'm using an unsigned cert for now as everything is on my dev machine. Everything was running good till I updated the Java version today and the applet started throwing "java.security.AccessControlException: access denied (java.net.SocketPermission localhost:8443 connect,resolve) So far I've tried editing my java.policies file, disabling my firewall (though everything is local). I don't think it has to do with my cert as I can reach https://localhost:8443/, everything is encrypted. Also, when I first started using SSL with the applet I was getting different, more descriptive errors till I fixed it. The code where it gets thrown is basically this: code:
edit: does the applet have to be signed or something? I'm not modifying anytihng on the client's system but I am connecting to something out of it's domain I guess. Like I said, it worked fine with 1.5 so I guess security is tighter in 1.6 lamentable dustman fucked around with this message at 23:03 on Dec 29, 2008 |
# ? Dec 29, 2008 22:57 |
|
Bastard posted:Has anybody taken a look yet at JavaFX? Any opinions so far? Still, I wont be surprised if there is a FlickrFX or FacebookFX prototype a few years down the line.
|
# ? Dec 29, 2008 23:55 |
|
dvinnen posted:So I've been working on this applet/servlet combo for a while now. The applet communicates with a servlet that collects data and sends it back to the applet via HttpsURLConnection. I'm using an unsigned cert for now as everything is on my dev machine. You're missing a variable name. Shouldn't it be code:
|
# ? Dec 30, 2008 00:48 |
|
Ensign Expendable posted:You're missing a variable name. Shouldn't it be whoops, it is there in the real code. The code is on a secure system that can't reach the internet so I couldn't c/p it. Eclipse would of caught that pretty fast anyways.
|
# ? Dec 30, 2008 00:59 |
|
I figured it out, it was an issue with java versions. I've been using the Eclipse plugin 'Web Tools Platform' which had a section called 'facets' that needed the compiler level changed in. I was getting an error from it apparently but didn't notice, it looked like it was compiling anyways.
|
# ? Dec 30, 2008 16:10 |
|
I need to work in java fulltime so I won't forget some of these basics. I appreciate any feedback you may have. I'm trying to run a class, which is not UI based at all. If a certain situation occurs, however, I want to serve a popup from a different class. I'm not quite grasping why it won't work. code:
code:
|
# ? Dec 30, 2008 17:57 |
|
The outside code is creating a new instance of ProblemUI, but that instance is never made visible. Meanwhile, you have a main method in ProblemUI which creates an instance and makes it visible, but that method presumably never gets called. Where are you getting confused?
|
# ? Dec 30, 2008 19:31 |
|
Does anybody know where I could find sample code for comparing two WAV audio streams in Java? I need a function that returns some kind of "score" telling me how well the two streams match. From what I found on Google it looks like I need to do a Fourier Transformation, but I'm not really sure how to implement that and how to use it.
|
# ? Dec 30, 2008 22:50 |
|
Fehler posted:Does anybody know where I could find sample code for comparing two WAV audio streams in Java? I need a function that returns some kind of "score" telling me how well the two streams match. From what I found on Google it looks like I need to do a Fourier Transformation, but I'm not really sure how to implement that and how to use it. Once you transform the WAV, you can compare the frequencies present over time, probably vaguely similarly to the way you would compare strings in a string search algorithm that allowed for some inexactness. There's an iPhone and Android app that does this and tells you what song you are sampling with the phone's microphone.
|
# ? Dec 31, 2008 03:20 |
|
mister_gosh posted:I need to work in java fulltime so I won't forget some of these basics. I appreciate any feedback you may have. In addition to what rjmccall said, you have to declare all of your UI elements at the level of the class to access them from other methods. I don't use NetBeans (plus you cut up your code), but it looks like all of the UI components (i.e. jLabel1 and jLabel2) are being declared at the level of the initComponents() method. Google 'variable scope' if you need more information. Also, you might just want to bag all of that code and replace it with this method: code:
QUESTION: I'm using Gregory Guerin's AuthKit to 'authenticate' (a.k.a. run with elevated privileges) my new java application in Mac OS X. I cannot figure out how to authenticate the currently running app though. All I can do is launch another jar file with elevated privs. Is there a way to privilege the currently running java app? firetech fucked around with this message at 08:09 on Dec 31, 2008 |
# ? Dec 31, 2008 07:48 |
|
|
# ? Apr 28, 2024 02:38 |
|
firetech posted:QUESTION: edit: Probably nevermind what I wrote. Authkit seems to have little to do with Java security but instead with Mac OS X security, i.e., running with root privileges. Fly fucked around with this message at 05:16 on Jan 1, 2009 |
# ? Jan 1, 2009 05:13 |