Jimmy Ho

Ranch Hand
+ Follow
since Jul 31, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jimmy Ho


Yeah, there's a State Pattern that manages states, but all the toy examples I can find are for states where the possible inputs are the same, regardless of the state. There are some semi-ugly modifications to the pattern when each state has different actions possible.

Example:
State1: Can mouse click in the drawing canvas
State2: Can mouse click, but results in different behavior
State3: Can mouse click, but results in different behavior

But in my game:
State1: Actions to recruit more players to the game via Facebook (or something)
State2: Repeating rounds of playing cards, and each player plays a card (or something)
State3: Game shutdown, with buttons to post results to Facebook (or something)

Each "state" has a different set of methods/actions associated with it, and the State pattern, as written, doesn't seem to accommodate it well.



I'm doing a small card-playing website, more to update my Java skills than making money, etc., but it will be used as a portfolio item to show employers, so I want to do best practices.

I wanted to ask what people use these days to communicate between the front end and back end? Years ago, I used JSPs, so Struts/Spring/JSF naturally had that communication going. However, the jQuery and AJAX/javascript stuff that lets me communicate with the server without refreshing the page has me confused. Does it use JSON? If so, is there a library in JEE or open-source library I should be installing to make that happen? By the way, I've never used jQuery or JSON, so only read about it on Wikipedia, etc. What's the best practice here, or at least, the set of mainstream practices currently used in the industry?

Lastly, I want to integrate possibly an iOS app to the same Java app server back end so a user can play with a native iOS app and another user could play in the same game on the website, and it would be seamless.

For context, my tentative tech stack will be:

Front-end HTML/CSS, maybe JSPs, JSF, or some such thing (TBD)
JBOSS App Server
Hibernate
MySQL or similarly simple-yet-robust, open DB


Thanks!
8 years ago

Hi, all, I'm architecting a small game engine using Java/JBOSS/Hibernate, and just wanted to ask if there are any known patterns for handling the state of the game? It's a simple card game I'm doing more as a portfolio item to show employers, so it has some simple states like, Waiting for More Players, Round in Progress, Waiting for Player X to Play Card, or whatever. It'll keep track of player scores, manage a small chat room, have a couple of card decks as data, etc.

Thanks!

I'm not sure the original poster ever clarified what platform was preferred? (I could be wrong; a lot of posts here.)

If we're talking about Xbox, Playstation, etc., then I doubt they're running a Java Virtual Machine and are doing low-level system stuff to optimize their games, which lends to C++ (or whatever system programming language they're using--raw assembly for all I know, though I'd be surprised if that).

If Internet games where you go to a website and do stuff, then server side stuff could be Java because a lot of servers use Java, and there isn't the intense graphics/physics calculations that pushes people towards C++.

Then again, the games could be done in Python, or whatever use the Internet uses (Ruby on Rails, etc.)

If iPhone/iPad games, then it must be Objective-C, because, well, Apple....

If Android games, then it's back to Java, since Java is the Android programming language.

If iPhone or Android game that talks to a central server that the game company has deployed, then the language on the server could Java, Python, Ruby on Rails, etc.?

8 years ago
Also, just to show the error log excerpt:



And the jboss.xml excerpt:





Thanks!
11 years ago
We're migrating applications and EJBs from WAS 5.0 to JBOSS 5.1. We don't need security on these EJB's, but when we deploy the EJBs on JBOSS, our application code in our servlets are getting a Security (Authentication) exception for the EJB. Are we missing something simple? Is there a line somewhere we forgot to insert in a config setting, or something special to JBOSS EJB security that we don't know about?

(Also, before people start lecturing us on the need for security, this is just our dev server, and we're doing proof-of-concept work. We'd like to get the EJB's actually working first before figuring out the security situation. Plus, the prior EJB setup on WAS didn't seem to have security, and there's no business/technical requirements for it either).

Here's an excerpt from our ejb-jar.xml:

<display-name>gcsejb</display-name>
<enterprise-beans>
<session id="GcsCache">
<ejb-name>GcsCache</ejb-name>
<local-home>com.gap.cs.cache.GcsCacheHome</local-home>
<local>com.gap.cs.cache.GcsCache</local>
<ejb-class>com.gap.cs.cache.GcsCacheEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref id="ResourceRef_1054339999999">
<description></description>
<res-ref-name>GcsOracleDSRef</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</session>

Thanks!
11 years ago

My team just got notified that a server is getting a new SSL certificate on short notice. The service is a straight up SSL TCP/IP socket connection, custom format for request/response. They got the certificate from GeoTrust.

They forwarded us a list of instructions from GeoTrust, and one item includes instructions to install the Intermediate Certificate, or this won't work.

Question: Who needs to install the Intermediate Certificate? Client, server, or both?

Our client program runs on a JVM that opens a socket connection (IBM JVM 1.4.2). In checking our trust store, the fingerprints seem to match at least one of the certs that we found on GeoTrust's root certificate page. We're getting an error relating to the certificate chain being wrong. (Actually, we also ran this on IBM JVM 1.6.0, which had more verbose logging, which specified that it was a chaining issue).

I wonder if it's even feasible to install an intermediate cert into our trust store. Even if it works, I wonder if that's best practice, or if I should insist that the other team check the installation of its certs and intermediate certs?

(Just to clarify, this is just unilateral authentication. That is, there is no client-side SSL certificate. Only the server, as with most applications on the Internet).


11 years ago
I haven't played in the Java web application space in a couple of years and wanted to get an opinions on best framework for the following application we're planning to write:

1. Porting from old DOS-like menu-based application to web app hosted on a J2EE app server.
2. Very simple interface for internal users. No fancy graphic design required. No complicated, multi-screen workflows
3. Print some reports to web browser in simple tabular format.
4. Execute simple actions, like looking up the price and stats, given an item number, or voiding a transaction given transaction number, etc.
5. ***Should have good security because application will be hosted on server with some sensitive data. That is, the framework should not have fundamental security flaws that are hard to work around.

I've used both Struts and JSF, and I'm inclined towards JSF because I think it does a clean job of producing a simple interfaces, but have two questions:

1. Are there any security issues I should be aware of? I.e. Is JSF to web apps as 'telnet' is to UNIX? Or whatever?
2. Are there any other Java-based technologies for MVC web-apps that have arisen since my last foray into this field, that I should be aware of and investigate?

11 years ago

I'm looking to put in a simple web application on JBoss, and the JBoss instance sits on a server with PCI information (credit cards, etc) and possibly PII (SSN's, etc.). This can't be helped. It's unclear at this point if any of the applications we will be writing will directly access this sensitive data, or if we're merely trying to protect the overall server.

Does JBoss have an known issues with security or PCI compliance? Is there an app server that lends itself better to PCI? Anyone have any links to prior discussions in this forum or some whitepapers somewhere?

Architecturally, we want to stick with JBoss because we've already purchased it for other uses, but if the reasons are compelling, it may be worth investigating an alternative.

Thanks!
11 years ago

Looking for some help writing some technical requirements document for some vendors to port some applications from Windows 2000 to SLES 11 (SUSE Linux Enterprise Server 11). These are either stand-alone Java applications (i.e. no app server) or C/C++ applications. We're new to porting from Windows to Linux here in our shop.

If anyone has any sample docs or big pitfalls or lessons learned to mention, it would be greatly appreciated. I think I can take care of the basics, like, don't use too much memory, or don't violate company IT Security policy, and stuff like that. Looking for those seemingly obscure things that I need to let my vendors know up front so they don't bite us in the behind later in the process.
12 years ago


The threads that are dangling are really just spread out seemingly randomly across different parts of code.

No deadlock possible because there are no shared resources except files and those are accessed in the same order by all threads. I'm good about not using static class variables in the code.

Project constraints prevent me from using a real server or server software. I had to do the multi-threading myself, but it's not like I did anything special. I used the sample code from the Sun Java Tutorials on how to open a socket connection. It's a very simple run() method that runs, does some stuff, and finishes, that's it! I just don't get what's wrong here, and I'm catching all exceptions and writing them to logs, but nothing there, either.
Occasionally, my stand-alone Java application will just go nuts and drag down the entire server. It's just a Java app running as a Windows Service (using jsl.exe), running on Win 2000, using Sun JRE 1.5.0_17.

So I have this application that listens on a couple of ports with a ServerSocket and SSLServerSocket. Those listening threads, in turn, fork a thread for each socket request that comes in. There's also a couple of threads that go to sleep and wake up periodically to do logging or back-end MQ integration.

So anyway, out of 1000+ of these servers, every once in a while, this will happen (2-5 in a month). In our QA Lab, we haven't been able to reproduce this problem, but I noticed that there seem to be 'dangling threads' that never seem to away, even after a few hours. I'm trying to figure out if this is a quirk of the Sun Java JRE or if I'm doing something wrong? There's no sense to these threads. That is, the dangling threads are striped across different pieces of code, so it doesn't seem like an infinite loop in a specific place. Furthermore, memory doesn't seem to appreciate greatly either.

So I'm implementing a Windows Scheduled Task to restart the Java app every 24 hours, as a safeguard. The theory is that eventually, these dangling threads add up, and after several weeks or months, they eventually start to drag down the JVM, just in terms the bookkeeping cost of keeping them around. Not the greatest theory, but the best I've got right now.

Does anyone know of the JRE 1.5 having a known issue close to this, or have any other theories? Can I blame this on the thread-handling of the JVM, or should I keep hunting for a flaw in my code?

BTW, I don't know the thread state at this time, but I'm going the thing where I get the list of threads and print out their CPU time for each thread. I'm noticing that there are threads that are still on the list several hours after the thread should have been expired and garbage-collected, despite a fair amount of server activity.

Example log output: (Threads 2-11 are my server/JVM threads)
Thread ID=1809, CPU Time=0
Thread ID=1787, CPU Time=0
Thread ID=1758, CPU Time=0
Thread ID=1752, CPU Time=0
Thread ID=738, CPU Time=0
Thread ID=734, CPU Time=0
Thread ID=724, CPU Time=0
Thread ID=11, CPU Time=578125000
Thread ID=10, CPU Time=0
Thread ID=9, CPU Time=0
Thread ID=8, CPU Time=2109375000
Thread ID=7, CPU Time=171875000
Thread ID=4, CPU Time=0
Thread ID=3, CPU Time=156250000
Thread ID=2, CPU Time=46875000

I've noticed that if I go onto my Windows machine and change the time zone, the time zone returned by my Java application (which has been running this whole time) returns the prior time zone. I have to restart the Java application for the change to take effect.

Is there any way to have the JRE/Java re-load the time zone information from the Windows operating system without having to restart my JRE?

FYI, I'm on JDK 1.5_17, and the servers I run it on use mostly Windows 2000, though I've noticed this happens on Windows XP as well.

Thanks,
Jimmy
13 years ago