|
Hey guys I have a question about GlassFish that I can't really find the answer to. I just want to clarify if it's necessary to use a load balancer with a cluster. What happens when I try to just access the cluster without a load balancer? Or is that not even possible, I would have to specify a specific server? In the case that it is required, what software load balancer would you recommend?
|
# ? Feb 15, 2010 17:35 |
|
|
# ? May 9, 2024 10:19 |
|
I'm working in netbeans at the moment trying to build a gui for a simple higher lower guessing game. I can't for the life of me find any resources on how to bind the gui I've designed to the code. I understand how to put code in when an event is performed (like clicking a button), but how do I then get values from drop down boxes, check to see whether a box is checked etc... There's plenty of examples of how to do it all manually, but none for using netbeans. Edit: actually this is probably a stupid question and I'm just being lazy. Java gets a little overwhelming at times and it'd just be nice to have a list of common useful functions. Riff fucked around with this message at 19:03 on Feb 15, 2010 |
# ? Feb 15, 2010 18:33 |
|
Riff posted:I'm working in netbeans at the moment trying to build a gui for a simple higher lower guessing game. I can't for the life of me find any resources on how to bind the gui I've designed to the code. I understand how to put code in when an event is performed (like clicking a button), but how do I then get values from drop down boxes, check to see whether a box is checked etc... I literally just assigned that to a class earlier this morning, are you in Chicago? You must do it manually if you're learning basic Java, if you rely on a fancy IDE tool to learn you will be burned when you have to do something it's not capable of or is really annoying to do with it.
|
# ? Feb 15, 2010 20:36 |
|
I have a question that deals with Hibernate + Spring. I am working on a project that has two types of users. One is a parent, one is a child. A parent can register and create a new account and log in. Then, a parent can also create child users, which it has control to add and delete. These users can then log in. How can I safely protect the user accounts from the client but still allow for this relationship in the ORM? The main issue is that I'd be serializing this collection to the client, which would then expose all these Account classes. EDIT: I guess I should have clarified this, but my biggest concern is returning the password field to the client, which I would like to avoid doing. CRIP EATIN BREAD fucked around with this message at 22:39 on Feb 15, 2010 |
# ? Feb 15, 2010 22:16 |
|
yatagan posted:I literally just assigned that to a class earlier this morning, are you in Chicago? Nope, all the way over in England. I guess it's a popular teaching method. You're probably right, the thing is it's a pretty poor course and netbeans is all I know. The class is on software design rather than straight programming, so they're more interested in how we structure it rather than the end result.
|
# ? Feb 15, 2010 23:44 |
|
CRIP EATIN BREAD posted:I have a question that deals with Hibernate + Spring. I am working on a project that has two types of users. One is a parent, one is a child. A parent can register and create a new account and log in. Then, a parent can also create child users, which it has control to add and delete. These users can then log in. Use a one-way hash on the passwords? Edit: You should always hash your passwords. never store them in cleartext anywhere.
|
# ? Feb 16, 2010 01:06 |
|
Mill Town posted:Use a one-way hash on the passwords? I'm currently hashing with a salted MD5, but I still would prefer to not even send that back to the user. However, I think I figured out what I needed to do, it turns out that my externalizer/serializer has an ability to ignore fields in an entity bean, so I am ignoring the password field and setting and creating a separate service call for updating the password.
|
# ? Feb 16, 2010 13:18 |
|
CRIP EATIN BREAD posted:I'm currently hashing with a salted MD5, but I still would prefer to not even send that back to the user. Can't you just mark the field transient (or @Transient) and it won't be sent with the bean data?
|
# ? Feb 16, 2010 13:44 |
|
I'm trying to learn Java RMI by implementing a basic Bank + Accounts system. I just can't get the most basic part of this poo poo to work.code:
code:
code:
code:
code:
What am I doing wrong/missing, how do I get this to work?
|
# ? Feb 16, 2010 15:44 |
|
I remember getting a lot of mileage out of the Cajo Project (wikipedia link) when writing an internal client/server app. I suppose if your goal is to learn RMI, you should continue without the aid of such a framework, but as I recall Cajo made RMI much easier to deal with.
|
# ? Feb 16, 2010 17:56 |
|
I haven't done anything with RMI but at a glance it looks like its trying to resolve the Bank interface in the RMIserver package. Try switching to explicit imports from there and see if it can't pick up on Bank being in the same package then.
|
# ? Feb 16, 2010 18:02 |
|
Yeah, my instructor has asked me to use RMI so I guess there's no way around that. I've gotten the server up and running, though. Now it's the client that's giving me poo poo:code:
code:
code:
|
# ? Feb 17, 2010 11:23 |
|
I'm trying to design a Swing form with auto-resizing components in the Netbeans GUI Designer. My current version works fine if I enlarge the form (i.e. all the components nicely resize with it), but if I make it smaller beyond a certain threshold, the components stay at a fixed size and the right side is just clipped. It seems like something is preventing the components from getting smaller, but I cannot for the life of me figure out what. All components and (as far as I can see) all components inside them have horizontal Auto-Resize enabled, but they still seem to get stuck at some point. Any ideas what might be happening here and what else I could try?
|
# ? Feb 17, 2010 16:36 |
|
NeerWas fucked around with this message at 21:42 on Aug 9, 2023 |
# ? Feb 18, 2010 09:43 |
|
jDeveloper, as much as I hated using it, had excellent intellisense. I really don't recommend using it though until it sees about four more updates worth of bug fixes and performance tweaks.
|
# ? Feb 18, 2010 13:00 |
Fly posted:I'll check out JFreeChart when it comes time to redo our current charts. I ended up buying the JFreeChart developer guide. They really put a lot of work into it, and you can do pretty much whatever you want with the charts. I'm really liking using it so far.
|
|
# ? Feb 19, 2010 00:37 |
|
Does anyone know if it's possible to make Eclipse store the .metadata folder in its executable folder, rather than the workspace folder? It's really annoying having to copy that folder every time I change workspace locations.
|
# ? Feb 19, 2010 06:38 |
|
TRex EaterofCars posted:Can't you just mark the field transient (or @Transient) and it won't be sent with the bean data? This will cause it to not be persisted into the database. But as I mentioned above, I had to do it through the externalizer that was serializing the data over an AMF channel.
|
# ? Feb 19, 2010 17:11 |
|
Regarding java/tomcat web development, is the workflow still the same? Make changes, deploy/reload, refresh browser, repeat...until OutOfMemoryError: PermGen space, in which case shutdown (or even kill -9, if necessary), startup, repeat. I can hardly believe this issue, which affects everyone in the world who develops for the tomcat container, hasn't been solved yet. Edit: or has it? I heard tomcat 6.0.24 fixes this (by actively reaching into other libs and nulling references, killing off threads, etc), c/d? epswing fucked around with this message at 18:48 on Feb 19, 2010 |
# ? Feb 19, 2010 18:42 |
I'm trying to log some database queries that are generated using a custom class, QueryBuilder. I want to log some information about the user logged into my app executing the query as well as how long the query took etc. Essentially I'm doing this: code:
edit: How about adding a getResultSet() to my QueryBuilder class? Is there a way to automatically have it call resultSet.close() and statement.close() when the QueryBuilder gets garbage collected? Do I even need to do that? fletcher fucked around with this message at 20:27 on Feb 19, 2010 |
|
# ? Feb 19, 2010 20:11 |
|
fletcher posted:I'm trying to log some database queries that are generated using a custom class, QueryBuilder. I want to log some information about the user logged into my app executing the query as well as how long the query took etc. If you're dynamically creating all of the SQL, it's probably not a good idea to prepare the statement as that adds no safety and incurs overhead.
|
# ? Feb 19, 2010 21:56 |
|
Quick noob sorta question: Is there a way to compare strings that is case AND space insensitive? Like something that would say "ooga booga" == "OOGA BOOGA" == "oogaBooga" is true?
|
# ? Feb 19, 2010 23:48 |
|
HondaCivet posted:Quick noob sorta question: Is there a way to compare strings that is case AND space insensitive? Like something that would say "ooga booga" == "OOGA BOOGA" == "oogaBooga" is true? I don't know what you are doing but maybe strip all the whitespace characters from the string and convert to lower case.
|
# ? Feb 20, 2010 00:10 |
|
MEAT TREAT posted:I don't know what you are doing but maybe strip all the whitespace characters from the string and convert to lower case. It's really simple, I am just taking input from a text file and making strings out of it, so your suggestion should work I think. Thanks!
|
# ? Feb 20, 2010 00:24 |
|
I need to program a gaussian elimination algorithm. My instructor has specified that the algorithm in main should be: declarations & initializations while theres still data in file do input data echo print data do Gaussian elimination print solution end while I'm supposed to read the file name from the command line. The file could be like this: 3 5 -1 -1 11 -1 5 -2 0 -2 -2 4 0 3 0 1 1 1 0 -2 -2 -8 0 0 -6 2 4 2 1 1 -6 -1 -3 6 -1 8 -20 1 1.0 1 -3 0 4 -2 8 -3 43 Where the first integers are the number of unknowns. So there are three gaussian elimination problems, two with 3 unknowns, and the last with 4. Keep in mind he can add up to 10 problems, all with varying unknowns. I'm not sure how to separate the problems when I read from the file. I'm not supposed to have one huge array with all the numbers in it. I'm supposed to do one problem at a time and then loop to the next problem, using the scanner class.
|
# ? Feb 20, 2010 03:23 |
|
stephpwnz: The solution here involves declaring your storage in the scope of your main loop, rather than as "globals". Here's a program fragment that follows a similar pattern- study it, and see if you can figure out how to adapt it to what you're doing.code:
|
# ? Feb 20, 2010 04:03 |
|
Alright, thanks, I figured out that part. Now I'm having a hell of a time with the algorithm I'm supposed to perform. It goes like this: To solve the nX n linear system E1 : a11 x1 +a12 x2 + +a1n xn = a1,n+1 E2 : a21 x1 +a22 x2 + +a2n xn = a2,n+1 . . . ... ... ... ... En : an1 x1 +an2 x2 + +ann xn = an,n+1 INPUT number of unknowns and equations n; augmented matrix A = (aij ) where 1 ≤ i ≤ n and 1 ≤ j ≤ n + 1. OUTPUT solution x1 , x2 , . . . , xn or message that linear system has no unique solution Step 1 For i = 1, . . . , n − 1 do Steps 2 4. (Elimination Process) Step 2 Let p be the smallest integer with i ≤ p ≤ n and ap,i ̸= 0. If no integer p can be found then OUTPUT(singular matrix - no unique solution); STOP. Step 3 If p = i then perform (Ep ) ↔ (Ei ). Step 4 For j = i + 1, . . . , n do Steps 5 and 6. Step 5 Set m = aji /aii . Step 6 Perform (Ej − mEi ) → (Ej ). Step 7 If ann = 0 then OUTPUT(no unique solution exists); STOP. Step 8 Set xn = an,n+1 /ann . (Start backward substitution) Step 9 For i = n − 1, . . . , 1 set xi = [ai,n-1 - ∑aij*xj]/aii (above the epsilon is n, below is j=i+1) Step 10 OUTPUT(x1 , . . . , xn ); (Procedure completed successfully) STOP. No idea how to structure the nested for loops, what p is supposed to be, and what the swapping of Ep to Ei is. I haven't taken linear algebra yet so forgive me.
|
# ? Feb 20, 2010 20:20 |
|
^^^^ If you have a matrix A Ai,j refers to the element in the ith row and jth column. For example the A2,3 would be the third element in the second row. Are you sure you wrote down step 2 correctly? I think it should be Ap,i != 0. Assuming I am correct this step is to just make sure that there is not a zero in the pivot position.(The algorithm would fail on step 6 with a division by zero) Should the equals signs in step 3 be not equal signs? I believe (Ep) ↔ (Ei) means to swap the row p with row i but that does not make sense unless step 3 is "If p != i" or something similar. (Ej − mEi ) → (Ej ) is effectively saying to take m times the ith row from the jth row. The loops may look something like this: code:
RichardA fucked around with this message at 03:36 on Feb 21, 2010 |
# ? Feb 21, 2010 03:27 |
|
code:
|
# ? Feb 22, 2010 20:55 |
|
I'm bored and want to try something a little different. I want to code some people objects, and more importantly try to code their thought process as close as possible to the real thing, which I might expand into a game at a later point but is really just a POC at this point. I'd like to have a virtual room full of them and basically watch them interact. This is far from what I normally code so my question is how to best architect this. The first things that come to mind are should each person run in their own thread, should I be looking into the Executor class for that? Can anyone give a high level overview or any resources so I can start with the implementation?
|
# ? Feb 23, 2010 14:42 |
|
First things first, forget "as close as possible to the real thing". Nobody has much idea how the high-level processes of the mind operate. These might be good places to read about AI for games: http://aigamedev.com/ http://www-cs-students.stanford.edu/~amitp/gameprog.html#ai http://www.aiwisdom.com/ In terms of implementation, no, you don't want each person running in their own thread. That will be a concurrency nightmare with no benefits. You most likely want a simulated world that ticks/updates at regular intervals. If you double-buffer the state of each person, holding the state from the previous frame while you build the state for the current frame, you can easily split up the work of updating persons across multiple threads.
|
# ? Feb 23, 2010 15:25 |
|
I opened a window using window.open. I pass in the argument scrollbars and set the value to either yes or no. I am now in the child window. My javascript is running. I want to know if the window has scrollbars enabled or not. How do I do this? - I am in IE so window.scrollbars/this.scrollbars won't return anything - The windows scrollbars exist outside the body. - Looking at the document's width will tell me about the document. I can even figure out if there are scrollbars in the document. This will not tell me anything about the window itself. - The width of the scrollbar in question changes Dependant on what the currently selected Windows Desktop Theme is, for ascetic reasons. edit: This belongs in the javascript thread diadem fucked around with this message at 19:00 on Feb 23, 2010 |
# ? Feb 23, 2010 16:33 |
|
i don't think those functions exist in Swing but i could be wrong
|
# ? Feb 23, 2010 17:37 |
I'm looking at different ways of making objects persistent in Java. I'm not sure if I want to go the RDBMS route and just use MySQL again and write my on SQL. JDO sounds interesting but I think MemcacheDB might be the way to go. What do you guys think? The idea of not having to write any SQL sounds nice, but I feel like I will run into limitations down the road.
|
|
# ? Feb 25, 2010 22:26 |
|
fletcher posted:I'm looking at different ways of making objects persistent in Java. I'm not sure if I want to go the RDBMS route and just use MySQL again and write my on SQL. JDO sounds interesting but I think MemcacheDB might be the way to go. What do you guys think? The idea of not having to write any SQL sounds nice, but I feel like I will run into limitations down the road. javax.persistence package: http://java.sun.com/javaee/5/docs/api/index.html?javax/persistence/package-summary.html You will need to find an implementation of it. I think Hibernate may implement that latest JPA spec as well as its own API. The API itself is quite sensible and useful. Here is a comparison of some implementations that came up on a quick search: http://terrazadearavaca.blogspot.com/2008/12/jpa-implementations-comparison.html
|
# ? Feb 25, 2010 23:05 |
|
Fly posted:The Java Persistence Architecture (JPA) looks pretty nice. It appears to be a Java standard similar to Hibernate. You can specify the O-R mapping with Annotations, so you don't need a horrid XML file for configuration. You can use annotations with Hibernate as well. https://www.hibernate.org/397.html
|
# ? Feb 25, 2010 23:27 |
|
crazyfish posted:You can use annotations with Hibernate as well. https://www.hibernate.org/397.html
|
# ? Feb 26, 2010 00:17 |
|
I'm trying to implement a basic message passing system for a class project. I have a bit of it set up, but it's not quite doing what I want it to do. In a nutshell, the system involves an interface code:
A message registry which passes messages and keeps a map of recipient IDs and their objects Some of the relevant functions: code:
I thought a good way to go about this would be to use an overridden receiveMessage method for each message type - i.e. code:
So, I spent a good amount of time trying different things, most notably fighting with the generic syntax until I settled on putting the receiver in a single-element list. Basically, I think I need to make the message passer aware of the receiver's full type, but I don't want to add a function for every type of receiver. The only other thing I can think of would be testing the Message's type on the receiving end, which I know is possible, but would be nowhere near as nice as using a bunch of overridden functions. Does anyone know a way for that to be possible in this scenario? I hope that's clear enough. I'm pretty tired from dealing with this.
|
# ? Feb 26, 2010 09:07 |
|
crazyfish posted:You can use annotations with Hibernate as well. https://www.hibernate.org/397.html
|
# ? Feb 26, 2010 09:41 |
|
|
# ? May 9, 2024 10:19 |
|
SintaxError posted:The only other thing I can think of would be testing the Message's type on the receiving end, which I know is possible, but would be nowhere near as nice as using a bunch of overridden functions. Does anyone know a way for that to be possible in this scenario? Why do you think this? It's perfectly acceptable to check the types in a switch, and your interface pretty much demands it if you can't change that interface.
|
# ? Feb 26, 2010 12:06 |