The computer of the next 6 years

I bought a new "main" computer today.  It will replace two old "main" computers.  I got an MSI GE60. This is significant.

My previous main laptop was a MacBook Pro which I purchased in November 2006. It lasted a long time, but it doesn't like heat and I'm moving on. It was Core 2 Duo, 2.2 ghz or something, 2 gb of ram. I had all manner of drives connected to it, so it quit being a laptop and was permanently a desktop.

My gaming machine was also Core 2 Duo, 2 GB ram, ran XP and all my games, with its Nvidia 260 GTS I think.

One laptop to replace two machines. The GE60 is Intel Core i7 Quad Core, 2.3 GHz, can boost to 3.3 GHz. It comes with 6GB of RAM upgradeable to 16. I can order that off of newegg right now for $90. It has an NVidia GTX 650M or however you designate that. It comes with 2GB of video memory.

1080p resolution, USB 3 and USB 2, so all my old stuff will still work, and I can still have access to my data. 7200 RPM Hard drive, but I bought a 256 GB SSD to swap in.

Back in 2006, the technology wasn't that great. You couldn't really get a laptop comparable to a MacBook Pro. Or I might not have trusted the quality of other laptops. The parts were much better in the MBP. Today, though, and for $1000 roughly, you can get an all powerful machine that can run that old MBP virtually! I shall be doing that.

And if I want to do gaming, it's there too. I can run the latest games on that thing, at high settings. Awesome.

Model View Controller Pattern - Brainstorm

I wanted to implement an MVC solution in my Node.js webserver. Let me describe my webserver first...

I don't typically know the names of everything I create, even if I copy the concept from another technology. But here's what it has:

Server side tags (foreach, if/else, include, combine, layout, placeholder)
Page content rendering inline through ${ style } syntax. For instance ${page.title}
Servlet style "handle get" and "handle post" interface.
URL Rewriting (e.g. /item/12345/name-of-item will load (but not redirect to) /item?itemID=12345&itemKey=name-of-item
Content caching via the "If-Modified-Since" and "Date" headers
JS and CSS combining
GZIP compression on anything
Multipart and urlencoded form handling
Sessions, to store current user, etc (very extremely low very low overhead :)
Built in mobile site redirect (detect mobile and redirect to m.HOSTNAME.com)
Content sharing between full site and mobile.  So it will use the same content unless otherwise specified.  Keeps content/functionality duplication to a minimum
Application scope. Want to keep track of all the users currently online?  Simple. Cache a list from the database that will never be updated? That's a good spot for that.
HTML templates (layouts).  So you can code your overall structure once, and have pages put different pieces in "placeholders" in the layout.
.NET Style "code behind"... They aren't really, like I said in the 2nd point, they are more like Java servlets. But the front end would be /index.html and it would automatically load up /index.js and call "load" on it, unless it's a POST, then it'll call "handlePost".  I like taking the best bits from technologies with which I am familiar.

This all works amazingly well, especially considering I wrote every piece except for the stuff node.js provided, and the multipart form parser.  So I wanted to do an MVC as I've said.  One other aspect of my webserver is content handlers. For binary files, there's a binary handler, with mime types. "JSN" is my "Jason's Server in Node" files, which are HTML with those JS "code-behind/servlet" files. I could add an "MVC" handler with it's own extension, or a setting "useMVC" that gets checked when the server loads up content. If this setting is set, load up the MVC handler instead.

Model:  This part is already taken care of, as mongoDB provides an excellent data store.
View These are already implemented in JSN/HTML files.
Controller: This is the part that's tricky.  I'm thinking something like this:

function Controller(modelType){

}

HIGH LEVEL OVERVIEW (I'm getting tired)....  So a resource at /pianos/12345/view    will say "Load up the pianos controller, give me the one with ID 12345, and show it to me." Typically MVC's main distinct characteristic is the URLs.  /pianos/jason/search  will search pianos with "jason".  The actions will be defined as methods on the Controller, each customizeable of course. The controller will point the server to the correct view, passing the model along. For updates, it'll be /pianos/12345/update.  Also, typically, MVC uses REST style requests, which means to delete a piano, you would use the DELETE HTTP method, on the URL /pianos/12345/

I am too tired for this right now, hopefully I can make sense of this post in the morning.

JsViews and JsRender Use Case...

I came across JsRender a few weeks ago, looking for an updated javascript template rendering system. I was in need for a side-project at work (yes, we have side projects sometimes, although honestly, I did most of it at home).  The basic gist of this side project is this: we have many clients, with many servers that we have to maintain, and each of those has different passwords. This would replace an Excel spreadsheet that sits on a shared drive, that when a password changes, we have to go in and update it, and it might be locked because someone else is viewing it.

The technological philosophy behind the creation of this application is this:  Users can log in, add clients, environments, credentials at will. The updates are seen almost immediately to other users logged in, through ajax polling. And an extensive history is kept so we can keep track of who updated what, and what it was before. Passwords are encrypted and viewable upon request.

Some definitions... environments are like, production, staging, dev. Credentials can be username / password for remote desktop access, database, the CMS admin, FTP, etc.

Also listed for each client is their subversion URL if they have one, the version of the development environment to use, which database and version, and what CMS and version they are using, if any.\

Here is a picture of it:


So here, the client is Delphic Sage (for our website, etc), none of these pieces of data are real.  There are four environments.

Data structure is as follows:

Client: Active, Name, Host (Rackspace, Self hosted, etc), Software list, comments, Environment list, History list
Software: version, DB reference to software (type (cms, devenv, database), name, versions list)
Environment: type (free text, usually production, staging, dev), url, credentials list
Credential: username, password, server or url (could be localhost, server name, url to admin login etc), comment

The whole thing is really cool. Maybe I'll put up a sample of it somewhere, but our app will be run internally of course.  I'll post another screenshot when the styles have been updated! The data structure I created in MongoDB is pretty much literally what you see on screen, and it taught me a lot about MongoDB. I also wrote a lot of helper methods to shorten the code a lot when dealing with MongoDB. The back end is my Node.js web server (what is running this website).  I can't think of anything else to add at the moment, so that means it might go into production very soon.

I'll make follow up posts with some code.

A Cool, Dark Room

Walking into a bedroom late at night, with the lights out and the air conditioning going, always reminds me of growing up on Shadeland. I would go into the bedroom on the far side of the house, there would be no light, with the loud drone of an 80s era air conditioning window unit blaring away, with 3-5 Connell brothers, on any given night, lying around the room in various places, in various states of sleep. I'm almost conditioned to turn on a light real quick... not long enough to wake anyone and get cursed at, but long enough to mark my path through the room without steppin on any heads.

Ahh those are good memories :)