Category Archives: Computing

MacBook Pro – Detects Orientation Change

I was working on my new book: Learn HTML5 and JavaScript for iOS, and I noticed something rather strange, my MacBook Pro was providing orientation data to my Chrome browser via the beta and gamma channels. I could move my MacBook and the numbers changed. Wow!

window.ondeviceorientation = function(e) {
    var heading = e.webkitCompassHeading;
    var accuracy = e.webkitCompassAccuracy;
    var alpha = e.alpha;
    var beta = e.beta;
    var gamma = e.gamma;
}

 

 

 

FreeNAS, RAID and ESXi

I thought I would try to upgrade my Ubuntu Server farm with a few other options. My the first thing to replace was my NAS. It was just an Ubuntu server with Samba and it also functioned as a backup for my systems via rsync.

My thought was that if I upgraded to FreeNAS I would be able to add iSCSI support and other things in such an easy to use manner it would really make my life a little easier. Short Answer: No.

Ubuntu server was much easier to install iSCSI and get working the first time. With the addition of WebMin management of this server over FreeNAS was much easier.

Then I thought about RAID. For FreeNAS I was thinking Raid5 over ZFS. In theory this was good, it actually worked as advertised, until I started rsync. Then over a 1GBP connection I was averaging 15MB/s, whereas before over Ubuntu I was getting 50+ MB/s.

So then I thought, well, at least I’m getting RAID, but then practically I thought, if I get a card, it’s expensive (more than 2-3TB disk) and it’s still a single point of failure. So rather than go this route, I’d rather just have a great back-up plan and mother board to support more SATA connections.

As to ESXi, the first problem was the network card. It required I purchase a $40 Intel 1GPs network card. Servers installed great, though cloning was a pain. Then when I went to install an XP virtual, guess what? No drivers for my sound card, not in Windows but there was nothing found in ESXi to pass on. Then I needed a windows Machine to mange this server through vSphere which meant that I needed to keep a separate machine on just to support a machine with multiple VMs.

Conclusion

NAS – Stuck with Ubuntu Server 10.04 LTS, I could use WebMin and Samba to do what I needed for a file storage and I could use iSCSI, NFS, and SCP/RSYNC with high transfer rates.

VM Server – Stuck with Ubuntu Server 10.04 LTS using VirtualBox. The nice thing is here I can just clone drives and with a simple shell script I can start/stop the machines at boot or halt.

Photoshop Fonts Too Big?

I was struggling with this for a week. My 12px fonts were stuck at a DPI of 300 and I had no way to adjust them.

I also had an older copy of Photoshop Elements 6, so my options I thought were limited. I even re-installed Photoshop but that did not succeed, how did I finally fix this problem?

I went to my Library/Preferences and deleted all things Adobe Photoshop Elements. I restarted Photoshop and the fonts went back to normal size. I’m not sure what file in the preferences were corrupt, but that should fix your problem.

MacBook – Part 2

I knew I wasn’t going to be happy with my 17″ MacBook Pro, so I went online and purchased a 15″ antiglare refurbished one. The problem was that I needed it before I was going to return my 17″ to MicroCenter, so that I could transfer everything over. But then this happened.

  1. MBP was placed on hold, for no reason. I got no phone call, no notification whatsoever, so my next day shipment never arrived so I called to find out what was up.
  2. I was transferred to voice mail.
  3. I was hung-up on, twice.

I decided to just cancel the order and not to get another MacBook. Lenovo Anyone???

My Dell e6400 Woes

About 8 months ago I started having problems with my e6400. The problem was with the video display. Had bad colors, bad response to drivers and intermittent Blue Screens. So I sent it to the Depot to get fixed, the video worked out but then I started having other strange problems. I did not work on it much for the past 6 months but when I tried to switch from Desktop to Laptop w/dock here’s what happened.

  1. Machine Locked up with external mouse/keyboard.
  2. DVI Display started blinking on dock.
  3. Memory Failure

After the memory failure I took off the back cover to discover my 800MHZ DDR2 memory had been replaced with two different generic knock-off memory chips. Yes, I sent them good memory, they kept it for themselves and gave me 667Mhz crap memory in exchange.

So I sent it to Dell again to get repaired, let’s see what I get in exchange.

Switched Back to PC

I had the MacBook Pro for about 5 days total before I returned it. Here’s the reasons:

  1. 17″ was too big. It was awkward and a little heavy.
  2. The Glossy Screen. I did not like the glossy laptop screen, Anti-Glare/Matte is the way to go.
  3. UI/Metaphor. Not so much here. I could get use to it, but I did not like the way Office looked on it.
  4. VMWare Impossible w/4GB of Ram. I actually had the computer lock up once and I got locks/swirling wheel of death a few times while trying to run my VMs under VMWare Fusion 3.01.

I’ll get another PC, just not a Dell, see in my next post.

Made The Switch to Mac

This morning I was all excited about installing new software on my new PC set-up and while installing / downloading something from iTunes, CRASH! The memory on my Dell e6400 stopped responding and just crashed. The Dell would not boot, it would not do anything.

I was not certain as to what I was going to do but I had to travel a little today to go see family and during the trip I just decided how exasperated I was in dealing with this issue, I did not know it, but when I walked into MicroCenter, I walked straight to the Apple section and looked at a few of the Mac Book Pros. The one I saw which really caught my eye was a 17″ model from earlier this year, it’s got the Core 2 Duo, not the i5 or i7, but for a rock bottom price of just $400 more than another crappy Dell, I decided then and there to walk out with it and stop fighting my PC/Dell.

I still have my PC for games and some development, but things are changing….

Desktop Retirement

I’ve gotten to the point where having a desktop in my home office is not as practical as it once was. A few things have made me switch to laptop + a monitor.

  1. SSD Drives – This has made the performance of my laptop just as fast as my desktop (gaming withstanding). I’ve purchased my 2nd OCZ Agility 2 60GB Drive.
  2. Cable Madness – While I still have a few cables at my desk there’s none on the floor.
  3. Zero Power Cables On Floor – Since Lilu started crawling around it’s been increasingly difficult to keep here away from the desk.
  4. 3 Monitors – Not as useful as it once was. I am finding that I’m just moving everything over to my large monitor anyway and the extra monitors are more distractions than help.
  5. More Room for my iMac – With the 3 monitors I had very little room for my Mac, since I’m doing iPhone development, having the extra desk space is nice, I can just hope over and do some work.
  6. eSata – This allowed me to put a 1TB drive next to my laptop and store all the goodies I needed.
  7. Less Clutter / Distraction – This simple system is allowing me to be a little more organize and when I take the laptop with me, I’ve got my work with me for the most part. Though I might be finding myself moving to a portable 1TB drive in a month or two based on convenience and portability.

Big thanks to MicroCenter for helping me out.

Some of the issues I’ve had:

  1. eSata Eclosure/Dock – MicroCenter (Trip 1) The first one was labeled in correctly (Thanks China) and it was USB2.0. MicroCenter (Trip 2), after returning this I found an older enclosure, but without an eSata cable, so I returned the USB2.o one, and purchased a cable, up installation the SATA connector to the HDD broke. MicroCenter (Trip 3), after returning the cable, I decided to get a dual eSata Dock, but there was a small piece of paper saying that your computer must have a “port multiplier”, my Dell e6400 does not have one, so back to MicroCenter. MicroCenter (Trip 4), after returning the dual eSata Dock, I just got a single eSata Dock. Success!!!
  2. Old PC refused to boot. It hung on an automatic update and never turn off, so I killed it, and no reboot. So I had to copy everything over manually…
  3. Old 1TB Drive did not work in new eSata Dock, WTF!!! So I had top copy over via my Ethernet while it was in a USB2.0 dock… Going on now and through the night.
  4. 24″ Monitor DVI blinks on my e6400. I’ve narrowed this down to either a crappy monitor, or my e6400 can not drive 1920×1200, fortunately I have a 1920×1080 that seems to be working OK on the DVI port.

In conclusion it’s been a long day, about 14 hours in all, minus about 3 hours playing with Lilu. I’m glad it’s done and I hope there are no surprises tomorrow!

8/22 Update – Two More Reasons

  1. Power – My old PC and 3 Monitors used on average about 260 Watts, this laptop and single monitor uses about 100 Watts. The cost savings is around $12/month.
  2. Noise – I am surprised at how frigging quiet my office is. Even with an insulated case the lack of hum is really noticeable.

StarCraft 2 Install Error – Solved

I just purchased StartCraft2 and started to install it only to get this error:

“The file “&^%$*\StarCraft II” could not be found. If this problem persists, please contact Blizzard Technical Support. (IsAbsolutePath/path is not absolute)”

StarCraft2 Failure

Updated Fix:

  1. Open Command Prompt As Administrator
  2. Enter: >net user administrator /active:yes
  3. Start > Switch User
  4. You can now login as administrator
  5. Run install from this account normally
  6. Logout as administrator
  7. Login to your normal account
  8. Go back to the command prompt and enter: >net user administrator /active:no
  9. Play your game!

Creating Your Own PHP Framework?

I spent the past few days fighting over the following battle, do I either use an existing PHP Framework or Build One.

I’ve currently been using my Model 1.5 Framework (ScottWork) for sometime, but have been using CodeIgniter on a few client projects and dabbling with some of the leading PHP Frameworks like Zend, Symfony, DooPHP, Yii and CakePHP.

All of this MVC stuff of course got me thinking, what if I want to get other developers to code for me? What if I want to get other developers to maintain my apps/code? What if…?

So I write my own MVC framework here’s a summary if it’s main components:

  • mod_rewrite and routing of request – This is basically the nice thing like removing ? and & from your URL so it looks pretty AND automatic routing of URLs to controllers->methods().
  • Controllers - This is basically taking your request, and channeling it into some OO paradigm that allows you to “act” on your request in an object oriented way, then route your way to a “view”. It also contains all your logic and calls to your Model.
  • Models - This allows you to talk to a database and controls your interaction with that database.
  • Views - This presents your data combined/calculated/manipulated/read or otherwise transacted in your Controller.
  • Helpers - This is a bunch of pre-built functionality designed to make the framework easier to use and code less.

Here’s my opinion of those main components after comparing them to my Model 1.5 framework (scottwork).

  • mod_rewrite and routing of request – I see a lot of uses for mod_rewrite but the routing of request to some kind of controller/object oriented thingy is really a waste of time. Why have one huge controller with a bunch of methods in it, when you can just write a simple script designed to process the input of a page? It’s small, modular which means easy to maintain, there’s no object to create, or routes to manage. The easiest thing about not using some kind of route manager is that you can create a new page that reads data, by just adding the page, no controller/route/setting data to be read by the page later, it’s all right there, one php page. Vertict: mod_rewrite (yes), routing (no).
  • Controllers - You don’t need an object to call other pages, most frameworks just use the good-old include() statement, or they wrap it inside some output buffering, but essentially it’s an include. What I do in my framework “scottwork” is to create a processing page (it does not have any HTML) which is essentially the same contents of a controller method, but it’s in one file that’s only job is to process the data from the one page. Vertict: controllers (no)
  • Models - I use ADODB and a generated model based on that library. The model is good-old-fashion prepared statements with CRUD operations and basic validation to so that you can insert/update/delete and read-by certain fields. I extends the generated file with a child DAO that allows me to override CRUD operations or do new operations specific to my app. Vertict: models (yes)
  • Views - This is completely ridiculous in MVC, the bindings and coupling between Controllers and Views is much worse than just having separate files with single methods. Plus for read-only pages, you just need to create your view, no controller->render_view() non-sense. Vertict: views (no)
  • Helpers - This is a bunch of pre-built functionality designed to make the framework easier to use and code less. Vertict: helpers (yes)

In Summary:

You could use a framework or spend time writing your own MVC framework as I have done. Some people like OO, some people like the order/structure a framework provides. Personally I don’t like spending lots of time coding, so I generate most of my stuff. I also don’t like spending time figuring out a framework’s shortcomings or finding bugs in a framework. I believe in writing small testable, programs/scripts (web pages) that do one thing and do them well.

Some interesting reading:

  • Second System Effect – The tendency to take something small and elegant, and make an elephant out of it.
  • Unix Philosophy – Write programs that do one thing, and do it well.
  • Neal Ford – Essence vs. Ceremony Talk (no link to presentation)