Jan 25 2007

Productivity++

Tag: Apple and Web DesignAlex @ 9:22 pm

This afternoon, Tom got me to check out a SIMBL plug-in named megazoomer. After upgrading my version of SIMBL and dropping the megazoomer bundle into its place in my Library folder, each Cocoa program I started from then on had fullscreen capability.

With the default key combination that seems borrowed from Windows ( + - similar to Alt + Enter which is full-screen/window mode toggle for apps on Windows) it sends the Application full screen.

The big deal for me was that it worked multi-monitor flawlessly even allowing 2 windows to be full screen on different monitors creating an uninterrupted workflow between the two. Now I can set up a text editor on one screen and Safari on the other at work and not have any distractions.


Jan 15 2007

PHP4, Constructors, $this and Output Buffering

Tag: Web DesignAlex @ 1:56 pm

Just spent half an hour trying to figure out a very random bug in a PHP4 application I'm developing at the moment. I'm using an MVC design pattern and in the constructor for the View object I wanted the class to set itself up to capture all output using output buffering. I've used this style in a couple of sites now and once it was all figured out, it worked fine but this time I was doing one subtle thing differently.

This time around I was using the following code:

PHP:
  1. class viewXHTML
  2. {
  3.         function viewXHTML($model)
  4.         {
  5.             if ($model === null)
  6.                 return;
  7.  
  8.             $this->model = $model;
  9.  
  10.             ob_start(array(&$this, 'output'));
  11.         }
  12.  
  13.         function output($text)
  14.         {
  15.             []
  16.         }
  17. []

Which sets the model to an instance variable and provides the output buffering function a callback to the output function of this object. This works fine and dandy, when the page is done, the output function gets called with the parameter being all output that was sent using echo and print statements. The problem is only visible when you want to access instance variables of your object within that function.

Theory One:

The output function was being called on a copy of the original object. Problem was that some of the instance variables were set but the ones set after the constructor weren't. Turns out that the $this variable you get given in the constructor is a special object which you can't pass by reference, only by value.

This was all fixed by calling a bind method after the constructor returned so the code is now similar to:

PHP:
  1. class viewXHTML
  2. {
  3.         function viewXHTML($model)
  4.         {
  5.             if ($model === null)
  6.                 return;
  7.  
  8.             $this->model = $model;
  9.         }
  10.  
  11.         function bindOutput()
  12.         {
  13.             ob_start(array(&$this, 'output'));
  14.         }
  15.  
  16.         function output($text)
  17.         {
  18.             []
  19.         }
  20. []

The bindOutput function is now called straight after the constructor in my bootstrap code.

Anyway, this mildly reiterates to me that I really shouldn't be pushing PHP4 to do things that I should be using Ruby, maybe Python or at very least PHP5 to do.

This was in PHP v4.4.1.

edit: typos for the win
edit2: added syntax highlight plugin


Jan 10 2007

OMFG Kernel Panic!

Tag: Apple, Computers and LifeAlex @ 9:21 pm

I rocked around to Tom's place this evening to find his flatmate Jo's iMac G5 Kernel Panicing on boot. So, putting on the tech hat we tried Target Disk mode (successful at accessing the drive) and resetting the NVRAM didn't do anything so we tried to figure out what was causing it all, anyway, so we ended up in Single User Mode, force fsck'd the hard-drive which was showing tons of journal problems. Fixed a ton of those, it wasn't able to fix everything though, booted and bingo.

Long story short it was possibly the combination of transferring 40GB of files to the harddrive over Samba filling the HDD to 1GB free and then playing a movie over said Samba connection. These are the dying words in one of the coolest Crash Logs from the Kernel I've seen:

Jan 10 20:29:31 localhost kernel: netsmb_dev: loaded
Jan 10 20:42:16 localhost kernel: smb_iod_sendrq: TRAN_SEND returned fatal error 57
Jan 10 20:43:06 localhost crashdump: Unable to determine CPSProcessSerNum pid: 413 name: mplayer
Jan 10 20:43:06 localhost crashdump: Started writing crash report to: /Users/Jo/Library/Logs/CrashReporter/mplayer.crash.log
Jan 10 20:43:06 localhost crashdump: Finished writing crash report to: /Users/Jo/Library/Logs/CrashReporter/mplayer.crash.log
Jan 10 20:44:39 localhost diskarbitrationd[85]: disk1s2    hfs      651C7F29-1350-3F82-A747-FFEE52A28818 MPlayer                 [not mounted]
Jan 10 20:44:39 localhost diskarbitrationd[85]: disk1s2    hfs      651C7F29-1350-3F82-A747-FFEE52A28818 MPlayer                 /Volumes/MPlayer
Jan 10 20:44:43 localhost diskarbitrationd[85]: disk2s2    hfs      C5BA4CED-7491-32B0-A79A-5C8D9F4FC679 MPlayerOSX_8r5          [not mounted]
Jan 10 20:44:44 localhost diskarbitrationd[85]: disk2s2    hfs      C5BA4CED-7491-32B0-A79A-5C8D9F4FC679 MPlayerOSX_8r5          /Volumes/MPlayerOSX_8r5
Jan 10 20:44:53 localhost kernel: jnl: flushing fs disk buffer returned 0xd
Jan 10 20:44:53 localhost kernel: disk1s2: device is write locked.
Jan 10 20:44:53 localhost kernel: jnl: do_jnl_io: strategy err 0xd
Jan 10 20:44:53 localhost kernel: jnl: write_journal_header: error writing the journal header!
Jan 10 20:46:27 localhost kernel: hfs: WARNING - blocks on volume Macintosh HD not allocated!

Dec 05 2006

Oh Blog

Tag: LifeAlex @ 8:45 am

Oh blog, how lonesome you must have felt. >_>

Anyway, life got crazy and as seems to be the norm, my blog was one of the first things to get neglected. Amazing, everything is finally starting to settle again. Yes, I did just imply that the christmas period was "settled" compared to whats been happening.

Another year has almost past, another year of Uni completed, not far to go now.

Still working for evos webdesign, making them websites. We move into an office from Monday which should be interesting, I don't think it'll really bother me whether I work at home or in the office, in the office I'll basically be admin-ing the LAN/file-storage system and developing so it'll be fun.

Aside from the 25 hours I do for evos, I've also got a related side-job from one my bosses' parents. Developing an innovative new website thing which a bit of paper with my signature on says I'm not allowed to talk much about. Either way, it'll bump me to 45 hours a week at my same payrate so that makes me happy.

It'll probably be in January now but I'm finally getting a decent sound system fitted to my car, I already have the head unit (with a remote and ipod dock connector cable for my nano and cd player) and I'm looking at getting 2 x 10" subwoofers for the boot to go with the 4 component speakers, and 2 x 6"x9" speakers in the back. It'll be totally rocking again, this time around a few steps up from what I'd put in my Escort.

Also, I tried to upgrade my Powerbook from 512MB to 2GB DDR2 RAM this week, deciding to try my luck with some from Dick Smith Electronics. Well, I tried two lots, both worked fine to start with and passed various RAM tests and Apple Hardware tests about 7 times but still froze after a few hours running. I don't know if it was getting too hot and wasn't very heat tolerant or just Mac OS X showing exactly how touchy it is about RAM but alas, the RAM has been returned and I'll have to save up a bit more for some big name RAM like Crucial or Kingston.

Alright, I think thats a long enough catch-up for now. I'll have more time after christmas once 'So-nique.com' finally gets rolled out. It's only been 2 and a bit years since Tom and I were asked to create it. I'll have it up for christmas which will be great for them!


Oct 11 2006

Life totally happened

Tag: LifeAlex @ 10:19 am

So I've just activated what must be most spammers greatest annoyance, Askimet. 12 spam messages in a month to my blog (when I haven't even posted) was annoying, now it just doesn't even arrive. How great.

This here blog is likely to get posted to en-masse after Uni finishes for the year (mid-November). Until then, life happens.


Aug 02 2006

Panic! At The Disco

Tag: Life and MusicAlex @ 10:46 am

I am incredibly and hopelessly addicted to the Panic! At The Disco album A Fever You Can't Sweat Out.

I've had the album for a good month or so now and have been listening to it constantly. Apart from the totally upbeat dance rhythms, I like the fact that words like "yeah", "nigga" and "my bitches" aren't all that common in their lyrics unlike the great majority of songs on C4 (New Zealand free-to-air music television channel).

One thing that I like that gives Panic! an edge over Fall Out Boy for me is the vocal talent and dynamics of the songs. Damn he can actually sing; does anyone know if he was singing broadway style before joining the band?

My only [minor] gripe is that the lyrics are sometimes hard to distinguish from simply listening to the songs. This comes about as the use of not-so-frequently used words and puns in their lyrics make some word choices not so obvious. Alas, the lyrics are included in the cover of the album. Since I compared to Fall Out Boy up there, I'll also say that Fall Out Boy's lyrics don't seem to have the same vocal clarity that Panic!'s do.

Anyway, I don't really have a favourite or worst song, I love them all, they don't seem to be getting old yet either. My most-played playlist at the moment is sitting with 28 songs, Panic!'s album, Broken Dreams compilation and the Fall Out Boy album From Under the Cork Tree.

Hi everyone, my name is Alex and… I am emo.
Y'all knew it, now I've said it.

Panic! At The Disco on the web:


Jul 20 2006

Click

Tag: LifeAlex @ 1:04 pm

I have yet to see the movie "Click" but either way, I want his remote. Now. kthx.
I do believe I am almost at saturation point as to hours per day vs hours of work to be done in said day.

I'm also dreading the size of the power bill for next month, I have this feeling it will be at least double our normal. Damn cold weather and stupid crawling bugs.

Grain mites increased power-usage in three ways:
* Vacuuming the pantry 5 times
* More lights on in the kitchen looking for them
* Dehumidifier on to get humidity levels down too low for them to breeeeeeeeed.

Ooooo, also, I got my new uniform for work yesterday. It is all bright and fresh and has random vertical yellow lines on the sides. The fleece jacket we were given looks warm, we shall see if it is so on Sunday, when I work next.


Jul 17 2006

Laser Printer

Tag: Gadgets and LifeAlex @ 6:54 pm

It does appear that yesterday I purchased a small laser printer. They retail for about $178 so we're talking small, low-end laser printer. Its the Brother HL-2040. According to the reviews, photo printing quality is sketchy at best (even for a black and white laser). I just printed a high resolution photo on it and the only thing I noticed was the shadows just out of focus are blotchy, the actual foreground quality I thought was pretty damn awesome. This is of course from someone who has never printed a high resolution photo on a black and white laser before.

Either way though, I didn't buy it for photo printing, that's what my Epson Photo R210 is for. It is really nice to be able to print text faster than I can get up and walk to the printer (save warm-up time if it is in standby mode), I pumps out pages at about 22ppm and damn the text is crisp.

Aimee's Canon which we've used for printed text up until now has some blocked nozzle which the printer can't clean by itself and if it is the heads that need replacing it may not be worth it considering new printer prices at the moment, anyway, the laser was affordable and it is mine and fits on a desk and is better at printing text than my Photo printer by a long shot.

I'm happy with my purchase. Setting it up was a breeze as well, unplugged Aimee's Canon from the Airport Express, plugged in the Brother, installed the MacOS X drivers from the supplied CD and that was it, Bonjour really is that great, up pops the printer under Bonjour printers in seconds.

As an aside, I pumped up the resolution to print the photo and maxed out the RAM on the beast, unlike other lasers I've seen (albeit much older) instead of failing to print and flashing random lights it printed the document fine and then printed a page telling me the printer had run out of memory on the job and had to downgrade the resolution to get it out, I thought it still looked ok so I can't wait to print something at 1200dpi instead of having it pushed back down to 600dpi.


Jul 15 2006

Bugs

Tag: LifeAlex @ 12:13 pm

Recently Aimee and I have had a bug problem, or 'mite' problem. Grain Mites is seems. The problem with these things is their size. They are infinitesimally small, like a piece of moving dust.

They were only detected when the dust I thought was on a porridge box in the pantry appeared to be moving on second look. I decided to set up my digital camera and take a few frames to see if I was just going batty or if the dust was actually moving. It was. Anyway, after much intarnetting, I decided to clean out everything, I vacuumed the pantry and all items in the pantry 4 times and the 5th time I decided to go the whole hog and use soapy water as well, getting all the crevices and everything. Meh, anyway, long story short, they're still around (that was 3 weeks ago) and our pantry is in two piles of boxes in the lounge [one possibly still infested pile and one 'newly purchased goods' pile].

They grow best in high humidity so I bought a dehumidifier and have been using it a lot lately, 'tis good for other reasons including easier to heat rooms and no condensation on the windows in the morning.

bugs

Anyway, I finally got around to compiling a few pictures of the buggers using macro-mode on my camera. These particular ones were on a wine bottle, I don't exactly what they like about the wine bottle but whatever.

I also made 3 gif animations of the buggers, here is the first. Unfortunately it is only a few frames long:
animated picture of bugs

The others are larger in file size:
* bugs2.gif [249kB]
* bugs1.gif [979kB]

This is an ongoing saga. 


Jul 12 2006

Thunderstorm

Tag: LifeAlex @ 12:46 pm

Wow, massive thunderstorm this morning, had rolling thunder crashes which lasted for about 15 seconds a time. 'Twas awesome, lots of rain too. I'm finally back in the black after being in the red for 2 years, which is always good, now I just have to keep it that way >_>.

Haven't listened to it yet but the cover of the new Nelly Furtardo album looks pretty striking, it arrived a couple of days ago at work and it caught my eye straight away, we'll see if it hits number one next week.

Aimee and I decided to catch up on films so we rented out 6 movies from the video store. So far we've watched "The World's Fastest Indian", "Chicken Little" and "Walk the Line", still have "Flight Plan" and "Corpse Bride" to watch. We some how managed to miss all of the above at the movies, too many good ones in too short of a time with too many other things going on I guess. Anyway, I still need to see "Poseidon", I was gutted when it disappeared from the movies faster than I could find time to go and see it, I shall wait for the DVD instead :'(.

Anyway, food time! Then lecture, then work. Meh, at least one of those will be fun.


« Previous PageNext Page »