• Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

About this blog

Archived content

Entries in this blog

Every time I see the name "Ruby on Rails" it reminds me of this coke-whore who lived in my college dorm...

I have been messing around w/ Rails again. Never a good thing, but I've got a conherent project in mind with a very simple feature set. Basically looking to make an effective inventory management system for small businesses. Something that I have not currently planned through on the system is users and ACLs, as this is something I'd like to solve in a manner that it can be either interfaced to a centeral user system that future projects I make can be interfaced too.

Anyways, I have been working on my db schema. The basics are in place, each object to be tracked has a location, owner, and identifing information. Each location has an address. A location can be moved and mapped to a new address, such that location "Washu's Secret Lab" and all objects that are in that location, can be easily moved to a new address when Washu opens a new door down the lane. Conversly, multiple locations can point to the same address id, and that address can be updated, having wider effecting changes. Of course for instances where more then one location is being effected by a changed address I plan to notify the user of that fact, and provide easy access to splitting the locations into two or more groups pointing to specific addresses. Each object, also has a model, which in turn has a make. Each model also has a category (another user definable list for things such as hardware/software/soft serve ice cream/misplaced tentacles) as such making reporting easy, to pull together a complete inventory report based on category, make and model etc.

I'm also planning to include a method to link objects to external repositiores of knowledge like wikis, such that additional notes can be applied, like linking to resources and documentation (101 ways to clean your tentacles).

Rails makes this all damn easy, I don't have to touch a line of SQL to establish this beautiful and complex relational database. Even provides convient database server abstract migration scripting.
class CreateLocations < ActiveRecord::Migration
def self.up
create_table :locations do |t|
# t.column :name, :string
t.column :address_id, :int
t.column :name, :string
t.column :noteurl, :string

def self.down
drop_table :locations

Also, with Capistrano I can type "rake deploy" to execute a complete deployment from my win32 command line to my remote server box, including database migration, and managing the Mongrel sessions.

On the backend I have Apache 2.0 mod_proxy forwarding to a Mongrel cluster, which in turns serves up the dynamic content. Best of all, this solution is scalable to the moon should it need to be. To add more capacity, we end up w/ multiple Mongrel clusters, forwarded too by multiple Apache servers, all backed by a clustered databse. You can read about this configuration Here and a few other places by now. The great thing is that Mongrel is "fast", ruby is still slow, and there is yet to be a compiled bytecode formate for ruby, but this configuration is production deployable for most people. While not "enterprise", you can survive a fark/slashdot/digg/etc flood.

I'll post a link once I have a more complete application running on my server, but as it stands right now, the only thing that is mostly complete is the schema, alot of work now has to go into providing a simple and consistent user interface to accomplishing their "scenario/workflow/throwing floor caek at Promit".

Side note,
I have given up on a COM tutorial. I just can't consider myself qualified on the that subject, nor do I have sufficent resources to tap to teach myself and then teach you poppets. So I have to ask forgiveness. I may attempt to revisit it in the future. Especially with the concept of calling COM+ directly from ruby. (god knows the abmoninations I could pull with rails and dcom)

#ifndef CLAMP
#define CLAMP(v,c) if (abs(v) > abs(c)){if (v < 0){v = c;if (v > 0)v = 0 - v;}else{v = c;if (v < 0)v = 0 - v;}}

Hmmm. This is hanging around, and is something I wrote over a year ago, possibly more. I have not real context, except that it had some purpose in controlling a velocity. it has no point at all...

Remember kids, don't code at 2am. Or look at old code at 2am, or smoke pot. There is a time and a place for everything, and it's called college.

Edit: Ok looking at it again. I see purpose, but poorly designed purpose. It seems to be designed to handle casues where v and c are signed different (or pivoted around 0). As such, iirc, if I am trying to bring a velocity to 0, the idea that the increment would clamp to zero (and a very very poorly calculated zero at that), instead of going over.

xvelocity = -3f;
CLAMP(xvelocity,0.004f * timeinfo.elapsedTime);

The funny thing is I have a generic form of that idea in the same header called MOVETOPIVOT providing an abitrary pivot point. So it can be used for stopping, and hitting a max velocity.

Conversly, why am I doing crazy calculations instead of something simple. like >


Edit+1:not so much just poorly designed, but full of boogs :P

Edit+2:Ok, to give an idea of how the player the 2d player (Dev), again old code, and looking at it I see lots of room for improvemnet. Things like movement through space depend on the final state of user input at the start of a game loop. I *should* track time of keypress to give finer control of things like jumping, but since a game loop is "short" most users would never be able to press and release the jump key in a single frame unless intentionally doing so, conversly this sucks when you do it on accident. Hmm.

One more thing about the below code, getState and setState are primed at runtime with animations, timing and state, so a state change indicates a new sprite on screen. Dev had a few animations, walk, to run, flying, coasting, jumping etc. Swimming too iirc.

void DevController::run(TimeInfo &timeinfo)
int xdir=0;
int ydir=0;
bool sprint=false;
int jump=0;

case moveLeft:
case moveRight:
case sprintOn:
sprint = true;
case sprintOff:
sprint = false;
case jumpOn:
case jumpOff:


case -1:
if (sprint)
myObject->velocity.setX(MOVETOPIVOT(myObject->velocity.getX(),JS_DEV_HORZ_RUN_ACCL * timeinfo.elapsedTime,0-JS_DEV_HORZ_SPRINT_VEL_MAX));
myObject->velocity.setX(MOVETOPIVOT(myObject->velocity.getX(),JS_DEV_HORZ_ACCL * timeinfo.elapsedTime,0-JS_DEV_HORZ_VEL_MAX));
case 0:
myObject->velocity.setX(MOVETOPIVOT(myObject->velocity.getX(),JS_DEV_HORZ_DECEL * timeinfo.elapsedTime,0));
case 1:
if (sprint)
myObject->velocity.setX(MOVETOPIVOT(myObject->velocity.getX(),JS_DEV_HORZ_RUN_ACCL * timeinfo.elapsedTime,JS_DEV_HORZ_SPRINT_VEL_MAX));
myObject->velocity.setX(MOVETOPIVOT(myObject->velocity.getX(),JS_DEV_HORZ_ACCL * timeinfo.elapsedTime,JS_DEV_HORZ_VEL_MAX));

if (xdir > 0)
else if (xdir < 0)
if (myObject->velocity.getX() > 0)
else if (abs(myObject->velocity.getX()) > JS_DEV_HORZ_VEL_MAX)
if (abs(myObject->velocity.getX()) > JS_DEV_HORZ_RUN_VEL_MAX)
else if (myObject->velocity.getX() == 0)
if (myObject->velocity.getX() < 0)
else if (myObject->velocity.getX() > JS_DEV_HORZ_VEL_MAX)
if (myObject->velocity.getX() > JS_DEV_HORZ_RUN_VEL_MAX)
else if (myObject->velocity.getX() == 0)
if (abs(myObject->velocity.getX()) < JS_DEV_HORZ_VEL_MAX)
if (abs(myObject->velocity.getX()) < JS_DEV_HORZ_VEL_MAX)

myObject->position += myObject->velocity.scale(timeinfo.elapsedTime);

lastUpdate = timeinfo.currentTime;

ADD *drool*

I am a spaz apparently. Still no COM tutorial. Upshot I've been gaining steady ground in that department, covered in depth registry entries, ATL commands to support and automate those registry creations, pretty complete understanding of MIDL, how to compile in the typelib description into the right resource location and what needs to be dropped into the registry if you feel like getting crazy. I'm still a bit hazy on what officially sepeartes COM, COM+, and ActiveX. As I thought I had crossed partially into COM+ territory, yet all my .NET interop stuff refers to ActiveX stuff.

Oh yeah, also I've got plenty of information on how to make a COM dll .NET compatible. Being able to deploy a single .DLL for a 3rd party to reference agaist in MSVS, which will automatically build a .NET interop layer dll based on the embedded tlb (typelib info). It works pretty well, but in theory all that "thunking" will be a small performance hit.

Anyways, I'm still a spaz. I can't work tommorow (work work) because the test system will be offline so the office mgmn can replace a transformer that has been blacking out the office park. In theory this gives me plenty of time finish up the COM tutorial and any assoicated research. In reality I need to clean my car, get it down to the DMV to finally get my oregon license plates, go shopping for things like bread and ketchup (current bottle is congealing or something), and start deep cleaning my apt for company in 2 weeks.

In assoication w/ my spaz nature, I've been eyeing ruby again. It's something I want to love, but have little reason to do much with it. Lots of toys, like Webrick, Mousehole, Camping etc. The language is "neat", but find my mind blown a bit at programming something of complexity in it. Toys are toys, not wmd's. Then again I'm a sucker for pain (BREW, Symbian, J2ME, COM, VB, J2SE <-> Linux Serial. And that's just in the past 1 year)

Don't expect a tutorial sunday afternoon. sorry, rate me down accordingly

Wink and a nod
I've been working w/ more modular designs in Wings3D. The cargo containers and engine pods (ugly things coming out the sides) and seperate files and would be an upgrade point for players.

General idea for this design is to create a cargo hauler that can vary its size. All connecting together via interlocks like a train. The bridge isn't in the first 5 shots, but is in place as another section in the last few snaps. I think the engine pods and bridge could use some changes, but that would be the nice ability of an upgradable content system. As new content is added, player's ships can be changed and upgraded w/ new modules.

I took some time and cleaned up the engines and "wings" which are really just the engines :) on the previous model.

Sorry to the 56k users :D (not really)

Oh one other things before the pictures.
I'm very tempted by this.
Intel Game Contest. While I never like the idea of loosing ownership of a product, the wording means that only if you win you loose you IP, and $30k would do well for me to be able to take a year off and explore the idea of opening a business.

Also, model is now 394 triangles after tessilation.

Seeing Sir Sappo's current project got me thinking about space ships again, so I hopped into wings and whipped this up real quick (less then 20min).

428 faces. Still don't like the engines.

Conversly I've gotten enough understanding about COM and found some decent resources that still exists to link agaist. The COM article is about 1/3's complete. I have a project selected which is dead simple, and COM <-> .NET interop has been resolved. (Embedding a Type Library into a binary is horribly underdocumented, but I finally understand the hidden magic ATL performs behind your back if you go that route.)


A lesson in bad design.


As a kid, I used to have a love/hate relation with this game. It was impressive, you got to kick ass, giant mutant reptile things were cool, and you beat shit up.

Problem was, never ever, never ever got past the race on level 3.

As such, I hadn't seen the other 90% of the game until I watched the above "speed run". The game is constantly throwing new things are you, where most of the stuff is trial and error. You only have a fighting chance w/ a Nintendo Power map and a month of practice.
Even with a guide, you are destined to get to each level, and fail completely learing how that level functions, but by that time, your out of lives w/o a save system. (Game Genie for the win).

Alternatly, the graphics were very impressive for the NES, to bad not many people ever got to see it. Compare BattleToads to Bubble Bobble and it's no contest. The minial graphics, fun gameplay, a dual player mode that doesn't punish you (BattleToads is one of the few games where a second player makes the game harder, if not impossible.) and very simple story. Bubble Bobble and Duck Hunt were great games to break out, even in college on those slow days.


If someone did this w/ a pinto, I'd be all over a pinto.
Watch Gemini dancing
Sorry for the slowness in this, and lack of notification last monday. I have not given up on the COM article, but going from creating a simple COM object to understanding the variations in COM, ATL/OLE Automation, the division between COM and DCOM, attempting to create something that works back all the way to win95 (w/o DCOM) etc etc. Basically I don't feel comfortable creating a tutorial on a subject I don't understand fully.

I've wrapped my head around most of Essential COM by Don Box, but it is a tad outdated and full source that is supposed to exist is quite awol. (No included CD, linked to a website, which of course 8 years later doesn't have the files)

There is also a general gap on things I've been reading and my own understanding about what divides OLE, COM, DCOM, and COM+. Let alone when ever I go looking for information about IDL I mostly end up w/ information about Cobra's IDL and not MIDL.

I'll be cramming again this weekend on it, and hopefully have some results soon. I apologize again. So far sucking pretty hard at this article voting system. :P

Article Vote #2

Ok time for another vote. Even though the Washu article came out like a seizure w/ MS Paint it is "done". As such, time to actually do a "real" article. I removed the Neurosurgery article as I would rather do a real piece this time that is useful. As such I present the old options, with two new comers. I must admit that the last 3 are much more sysadmin then I should probably do here, but if you feel like running your Hockey MMORPG properly you will need to pickup a few basic skills... ...in running the servers.

  1. Java Serial IO
  2. COM (No ATL, No MFC, pure COM "goodness")
  3. Ruby and Ruby on Rails (Introduction, Tutorial to make a site, Deployment Issues)
  4. Nagios
  5. AV-Stat
  6. Using Public Key Auth for SSH

Voting will be the same as last time.
  1. AP's votes do not count.
  2. You get votes equal to your rating at the close of the poll.
  3. Please only vote once.
  4. Only vote for one thing.
  5. If something gets 0 votes 2 times in a row, it'll be removed.
  6. Just because I don't get to it now, doesn't mean I won't cover it in the future.

Voting will end Monday 2/6/06 Midnight EST
Current Standings as of 2/6/06 Midnight EST
  • COM - 5238
  • Ruby - 1751
  • Nagios - 1300
  • Java - 1065
  • AV Stat - 0
  • SSH Key Auth - 0

I will get you the COM article on Sunday Night, with some random updates in the middle :)
You've probably always had this odd thought in the back of your head that your not the best. That someone else was better then you, then vauge thoughts about .NET, labs underneath staircases, and being hit up side the head with things you can't understand. Well, I'm here to tell you that you are not insane, well, not insane for those specific things. Your probably insane from reading too much of evolutional's journal, but that really can't be helped.

Article Prerequisites
  • Love of Washu
  • Introductory Use of a Banhammer
  • Hatered of Java

Today we will try to drive home not only how much better Washu is but also how Washu is better.

Washu has tentacles

As seen here in this never* before seen before photo (where never == 1-4 times) we see Washu demonstrating his mighty tentacles and inate pathfinding abilites.

Note that Washu is never seen with his tentacles. The secret behind these massive outburts of squishy appendages involves temporal distrubances and Squidward. In reality Washu opens a temporal rift, and makes use of Squidward's tentacles to do the dirty work. As displayed in figure A.
Figure A
Which brings me to the next way in which Washu is better. (Better then what is defined later on)

Washu can make you do things

Washu is so great (or the world is programmed in .NET) that he can kick Chuck Norris' ass. Now Chuck Norris is powerful as he has ultimate power (of ultimate destiny), sorta like god. Washu has brains on his side (and .NET), so instead Washu makes Chuck Norris kick his own ass.

using System;
using Chuck_Norris;
public class WashuPower
unsafe public void KickAss()

I bet you don't like Java. Neither does Washu. Coincidence? That's right, it's not a coincidence because Washu says it isn't.

Washu is better then most countries

  • Washu has a higher GDP then Tokelau.
  • Washu's primary export is tentacle rape and .NET love. (The similarty between the two displayed in Figure B)

Figure B

As a side humanitarian aid project, Washu dedicates his spare time in ridding the world of Java. This means fighting the one true body of pure evil in the universe, Duke!

Everyone Loves Washu - How Washu is Better

Washu kicks ass at not only .NET, metaprogramming, making my head explode, C++, C#, and LaTeX (tentacles need protection), but also being able to withstand the inept unwashed GuestXXXX users.

Thus, we must conclude that Washu is better then the Beatles!

Go Go Washu
I'm really sorry, I'm about 1/8th into the article, but I've been on the phone for the past 3 hrs so I haven't gotten a chance to finish it up yet. I'll finish the article tommorow night. No time to finish it at work (or during lunch at work).

Well Washu won in a landslide, offically and unoffically.

XLS Results

  1. Java Serial IO- 1065
  2. Nagios - 0
  3. COM - 2759
  4. Ruby and Rails - 4521
  5. Neurosurgery - 12644
  6. How Washu is better - 28476

I'll have the Washu article up Sunday night, around 11PM PST. So catch it Monday morning at work ;)

As for the rest of the articles, I'll run this again, w/ a new topic to fill Washu's slot on the board for the next article. Although I'm not sure I can really do Neurosurgery justice :P
Ok, I'm itching to do another article/tutorial, but I've got a few topics in mind and not much time to do all of them. So I want you to select a topic you'd like to see covered.
  1. Java Linux Serial I/O
  2. Nagios on FreeBSD
  3. Creating a COM DLL In-proc server using C++
  4. Ruby and Ruby on Rails
  5. Neurosurgery for Dummies (asked for by vx.n)
  6. How much better Washu is.

To vote leave a comment to this post. Your rating matters for this :) So if 1 person with 2000 votes Nagios and 2 people with 900 each vote Ruby, then Nagios wins.

Offical Results are in!!!

Results HERE

Edit2: Clarification: Changed Win COM text to be more accurate to what I mean.

Edit3: New Rule about AP's. Since I cannot tell who the AP is, how ever the AP votes at the close of ballot will be where the 950 points will be placed.

Edit4: Shifting user ratings, I will be loading this page at midnight EST (not PST) on Friday. From that snapshot I'll build user ratings for the final offical standings.
Things I have learned recently.

-Serial I/O is more arcane then PPP.
-It is a bad idea to program a Java Serial I/O application that runs inside SUSE running inside VMWare running on Windows, then making use of USB<->Serial adapters, that connect to external serial modems.
-Java Serial Communications API could be vastly improved.

Oh yah, still no word from Sun. Guess since I don't smell like a Forturne 1000 company I won't get any notice.
Since it is Wed afternoon, and I have not recieved a response to my request for a License from Sun, I doubt I'll be getting it tommorow or friday. Since I was dedicating Thursday and Friday to basically reviewing Solaris and polishing up a review on Sunday, this schedule just doesn't work any more.

So it looks like I'll be holding off on Solaris 10 for a few weeks, instead I'll try to bring in on Sunday a Ruby/Ruby on Rails synopis. (If I can get MySQL to be more cooperative on my windows boxen, although worst case is I'll just have to do alot of transfering to my FreeBSD box for testing instead of working and testing on the same machine.)

In non dev news.
Serenity DVD is coming out Dec 20th 2005. Amazon has a nice bundle deal of the TV series DVD's AND the Movie for $50.

Also, I like the new theme for Gamedev.net


Doing a quick tally, it looks like I will be doing a Solaris install. Probably as a mini-project over Thanksgiving vacation.
(1765 < 1767, sorry Hylix, should get your rating up)
I'll be doing a nice photo shoot w/ stuff about the install and other various things, and do up a review. Expect it sometime this coming Sunday.

Also, wanted to drop this in really quick. Insurance needs of independent developers.

Other then that, I've been very busy, and didn't have time to get any programming done this weekend in my own intrest, I'll try to get something w/ a bit more juice up here on Tuesday. I'll be going to bed when I get home.
Ok, so I see a news article showing that Sun has released their C/C++ IDE package Sun Studio 11 for free. Since Solaris 10 is also free, this begs the question...

Should I install Solaris 10?

Please leave a comment and I'll tally the results in a few days

I want to see what Sun Studio is like, and I have a second box I've been trying to get Linux to play nice on, but that has kinda stalled with my other projects. So I ask YOU, the person who accidently clicked into this maddness, if I, should install Solaris and Sun Studio and mess around a bit. If I do it, I'll do a write up, post screenshots, examples, and do a mini-review.

Edit: floor caek > solaris
Argh, GD.net be chewing my html code.
Hmm time to petition to get table code into jorunal posts.

Quick Update before sleep.

Finished my upgrade from FreeBSD 5.4 to 6.0, also updated ports, and performed a port upgrade.

Installed and cofigured mod_ruby for Apache2. Setup some databases for Ruby on Rails, using Webmin. (phpMyAdmin is for suckers :) j/k)

Ruby web development is off to a slow and brief start. I'm using webrick while I explore Rails, and currently have it running in screen as my local user instead of root. Same screen session running my irc client allowing me to idle for maximun idling xp.

Also, did my first build using Eclipse/ANT/Java today. I must say that ANT kicks nmake's ass. It would be a beautiful day when Visual Studio includes ANT (maybe there's a plugin already, anyone care to enlighten?).

So in a future posts I've got a few quick tutorials now planned.
  • Creating ANT makefiles
  • Setting up Apache2 for Ruby
  • Run down on Ruby
  • FreeBSD and YOU how I learned to love floor caek
  • Smack Washu for his for loops
  • Start work on intro level tutorials for various dev things

Anyways, till next time, keep your stick on the ice.
Sign in to follow this  
  • Advertisement