Hollywood Security BS

GameDev,Java,Processing — squarism @ 10:36 pm

I had watched Alicia Silverstone ‘hack’ a system recently and decided to make a mostly functional mock up like they do in the movies. I’m getting pretty comfortable in Processing and even though I really can’t stand Java anymore, I wanted to get this thing done and out of my head. I was just going to skip over this idea but inspiration just started flowing and I was idly solving it while getting coffee etc and I just had to get it on paper/code.

So here are the things it does:

  • Switches between two GameState objects login and success
  • Separate the view and the state (more on this)
  • Has a super cool blinking cursor
  • Handles shift, ctrl and meta (windows key) gracefully
  • Handles backspace
  • When you type muffin, it takes you to the super secret database … or whatever
  • Goes fullscreen (which you can’t see in this shot)

This could get out of hand real quick. First, I reused a ton of code from Tatris. But in Tatris, the game state was tied to a view. I had pictured this project having different views. Like instead of a password prompt, maybe there’d be a keypad with a combo. Same state object (authorized vs unauthorized) so I didn’t need to recreate the wheel. The problem is, I don’t really have a controller so I’m kinda breaking MVC. But I didn’t want this thing to bloat up so I just went with it.

Next, UI layer. Not great. I’m drawing text boxes and blinking cursors. It’s really pretty messy. I’d be better off picking some UI components or something and using those. It’s tough. Even in games, there’s so many UI differences. Different scrollbars, different OK type buttons. What a usability nightmare. But I’m trying to create an old school terminal so all the weirdness is actually good.

Anyway, it was a fun little diversion. There’s more on the github page.

Data Structures Book

Java — squarism @ 10:29 am

On a slashdot thread I was discussing whether I should roll my own data structure or try to use one of the many, many Sun data structures.

Someone recommended this book.

Spring Framework

Java — squarism @ 1:09 pm

Researching this Spring Framework. Most interesting so far is it’s touting of being modular. As in, you might only use it for a single feature and it wouldn’t be bloated.

swt, eclipse and OS X problems

Java — squarism @ 6:37 pm

Following a hello world tutorial, I got stuck on this error:

Couldn’t find anything so I thought I’d post the fix for someone like me out there:

Found it from an unusual source. Seems I couldn’t get the VM parameters to work so I have to do SWT’s not recommended suggestion of copying the file to the jre bin path. Although they never gave the file or the path! (I’m going to send them an email.)

Just do this:

Note that libswt-carbon-3034.jnilib is version dependant. It could be named libswt-carbon “anything” .jnilib. I found in [ECLIPSE HOME] /plugins/org.eclipse.swt.carbon_3.0.0/os/macosx/ppc

Validation Action

Java — squarism @ 7:46 pm

Finished coding a validation action that parses a word followed by an array of words. For example, “ABC” would validate if “Another Bad Creation” was passed with it. This is going to be used in the ever complicated Acronym project that has been taking me forever to finish.

It’s case insensitive, you can see the usage example in the ‘main’ class.
(more…)

Mathematical constant e generator in Java

Java — squarism @ 11:59 pm

A small class to generate the mathematical constant “e”. Complete with timer and digits per second clock. Unpolished. Here’s a quick benchmark and you can see that it doesn’t scale.

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;

/**
* calculate mathmatical constant e
*/

public class ECalculator {
private static final int numberOfDigits = 1000;
public static void main(String[] args) {
ECalculator myEClass = new ECalculator();
System.out.println("Calculating e to " + numberOfDigits + " digits ...\n");
Date start = new Date();
BigDecimal e = myEClass.doCalculation();
Date stop = new Date();
long elapsedSeconds = (stop.getTime()-start.getTime()) / 1000;
System.out.println("e is: \n" + e);
if (elapsedSeconds

Made useful build.xml file for use with Ant

Java — squarism @ 12:30 am

The following build.xml file has a few targets that make compiling a project much simplier. Read on for more details.

I have the following directory structure:

In Eclipse, I set the project preference to make [project root]/src the only folder on the source path. Lastly, I set bin to be the output folder. The ant script grabs any jars out of include (mostly useless to me).

When I want to create a jar, I just run the jar target. I removes the java source files before creating the jar archive. You can also increment the version number to create ‘releases’. This is the best I can come up with right now.

(more…)

Acronym Project – Ant and Eclipse

Java — squarism @ 12:21 pm

Having some problems getting Ant running the way I want to. It’s another question of whether the IDE (Eclipse) is being too inflexible or if I’m not doing something right. Eclipse doesn’t ship with functionality that allows ant build options. Here’s a log of what I’ve been trying.
(more…)

Acronym Controller – cookies

Java — squarism @ 11:44 pm

Update on new functionality.

Received my XP programming book in the mail. It is fabulous. I spent all day reading it. Wonderfully written. Great advice. Real world examples and overviews.

With XP advice in belt, I cleaned up many things in the Voting actions and I have cookies working to prevent people from voting twice on an acronym response. I’ll post an updated version soon.

Acronym Challenge Demo

Java — squarism @ 10:15 pm

Update: This is incredibly not accurate anymore. Posterity

I’ve deployed the 1st version of the Acronym Challenge webapp to the server at this location.

The controller passes off the request to an Action class. The URL is preserved because it forwards the whole request object along to the action object. See the code below:

The action object above is an interface. Action objects have to have this perform method in it. ‘this’ refers to the servlet itself so the hand off is transparent (by design). The user is handed off to an Action servlet based on the URL (hover over the plus and minus signs to see the href) and then forwarded back to the controller in one motion.

Next Page »
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2013 SQUARISM | powered by WordPress with Barecity