Working at Home in the Winter

I work a lot at home. There are times during the winter when the house becomes very cold and I really need warming up. But, I am always nervous about using the home heating system as I have this vague feeling that it is expensive and unnecessary. So, I’ve been looking into using an electric space heater to help me. This article provides an insight into some of my thoughts so far.

Electric infrared heaters are not just for warming up bus stops.  They are versatile, energy efficient, and portable heat sources.  Infrared technology is safe, clean, odorless and silent. Since they give off no emissions, they are safe for indoor use.

Most electric infrared heaters can be plugged right into a regular socket in your house though there are some large wall mounted units that will require their own circuit breaker.  Most people associate infrared heaters with either patios, garages or workshops but they are great for chilly finished basements, mud rooms or any room that is chilly. But check out this post here and you will see that their use has extended far beyond this.

Electric Infrared Heaters – Pricing, Size and Features

There a dozens of brands of infrared heaters that range from small table-top ones to large industrial ones.  The wattage of a typical electric infrared heater ranges from about 300w to 1500w.   Even the smaller low watt heaters are very efficient as most infrared heaters emit 90% of the energy they use as heat.

Make sure you do not get one that is too big for where you need it.  Many electric infrared heaters are programmable, have safety switches, and various wattage settings so you can adjust them to accommodate your needs.


One of the great things about them is that they are quiet – no weird crackling noises, pops etc. that many electric heaters make (the sounds that always make you nervous when running something electrical). Also, they are odorless so none of that dry ozone smell that other types of portable heaters create.  Electric infrared heaters create radiant heat that heats rooms evenly and do not reduce humidity or oxygen so no dry sinuses and skin.

One of the great benefits of them is that they work fast – you want the space heater to warm up your “space” quick or else you may as well just turn on the furnace. You walk into a cold room in the morning and flip on your electric infrared heater and you will be warmed up quick.  When looking to buy one always make sure they are “UL listed”.


The price range is about $20 for the small ones and $150-$400 for the larger ones.

Some of the drawbacks of electric infrared heaters are that once you turn them off the heat can quickly dissipate.  Some of the ones that do include a fan can get noisy (not all) and they are not always great for use at bedtime because of the orange glow.  Not all electric infrared heaters are the same and as you buy larger ones to heat larger spaces examine your electric bill to make sure that the heater is actually saving you money as some people have claimed that their bills actually went up.

Leave a Comment

Filed under Other

Interior Design for my Children’s Bedrooms

This is a diversion from the usual topics covered on this site, but I have been looking into decorating the kids bedrooms and as a result I thought I would share some of my thoughts on here too.Children in their early years should be exposed to the many marvelous elements of our world. They should be able to perceive that which is beautiful and respond with eagerness to explore new and exciting things.

Children in their early years should be exposed to the many different elements of our world. They should be able to perceive that which is beautiful and respond with eagerness to explore new and exciting things.

Children tend to be amazed by brilliant spectacles that they encounter in their daily lives. They resonate to the colors of the rainbows which make them appreciate colorful candies and balloons that replicate those vivid shades.

The physical environment that surrounds children should spur their young interest and ceaseless curiosity into the realms of the unknown. It should allow them to have a tight grip on good information and beneficial knowledge. An accent mural in the classroom evokes within them a lively and cheerful mood that translates to vigor and enthusiasm to discover more wonders and eureka moments.

The playground with its colorful obstacle courses, slides and swings challenges not only the physical stamina of the child but also his social skills. These essential facets are the ones that should be looked into when designing the ideal children’s bedroom. It must be an interactive place where they can seek their potentials and nurture them.

It will also be their own personal havens, a territory that they will mark as theirs to protect from invisible enemies and even from well-meaning parents that can sometimes disrupt their creative musings and play times.

Elements in a fun and functional children’s bedroom

Children that are no longer toddlers and yet are still far from the adolescence stage enjoy the best of the past world that they have already emerged from and the future world that is welcoming them soon. They have play and leisure activities but they also have advanced tasks to tackle such as homework and projects. They need a place where they are free to play and enjoy which will also provide them a peaceful ambiance conducive to studying and doing homework.

Children at this stage can choose the colors and the themes they want to have for their bedroom. They have hobbies, interests and ideas that will guide them in their decisions. They are still young however, and their personal tastes are still shifty and fickle. They might change their minds from time to time. What they need is a bedroom design that is not too literal and that will last at least 5-10 years so that it will be easier to redesign and redecorate in the future.

Bedroom Area

Children need to sleep in the most comfortable setting in the house. The interior of the bedroom should be pleasant and serene enough to induce them to sleep and recuperate from their busy days. An accent wall with loud colors and terrifying abstract images can be placed in a room that harbors a teenager who happens to be fond of rock alternative music and haunting poetry, but in a child’s bedroom which promotes peacefulness and a restful and dream filled slumber, this element will be completely out of place.

The walls should be painted in pastel colors to provide a background for other elements that are more attractive in appearance. Light colors should be applied to larger surfaces while striking colors should be limited to the accent pieces. Wallpapers with whimsical prints such as fairies, butterflies, blossoms and the like are a great way to adorn bedroom walls. However, they should only be placed in far corners or unfrequented places so that they will not be damaged easily.

Paint is an inexpensive alternative to wallpaper. They can be applied on walls to create fantasy and sci-fi scenes that the kids will surely love. A small brush and several cans of paint plus a colossal imagination are all you need to create these attractive wall murals and paintings. You can use roller blinds and Venetian blinds for the window treatment.

If you choose to have curtains, then consider the plain, structured ones rather than the lacy and frilly ones that is prone to the accumulation of dust. Children might also be tempted to play with them and write on them. Hardwood floors should be used instead of carpets because of their easy cleaning maintenance.

The bed should be simple and comfortable. The design will vary depending on the gender of the child. The size of the bed can either be single or semi double. The sheets and pillow cases that should be used are still of pale colors or cool colors such as blue and green. The length of the bed can be shorter and they can be designed as cars or boats depending on the theme that you and your child have agreed upon.

However it is still wise to stick to the standard length, and the design need not to be too literal because the child will grow out of it eventually and will be asking for a conventional bed in the future. Double Decker or bunk beds are perfect for the kid’s bedroom because they use a small amount of space and kids like to play in them while dictating their territorial limits.

It is very important to note that these beds should be models of safety. They should be well-constructed. Parents should especially check the upper portion to ensure they are equipped with stable ladders and high rails on the sides. The construction should always be sturdy.

Play and entertainment area

Children want to play games and listen to music. They should be able to explore their talents and potentials through games and other recreational activities, that is why a play area should be designated in a small portion of the room. The kids have to take pride in their rooms and must enjoy the time spent there. A bedroom should be one of the safest places they can be. This should be a space where parents can keep an eye on them and make sure that they are safe and secure.

Children should be trained to take good care of the things that they own and learn to value them. A smaller version of a dining table can be added to the room so that they can have tea with their dolls or have a surface where they can color or play with favorite toys. A window seat or a loveseat can be added so that the child can comfortably listen to music or read a favorite book.

Study Area

The study area can be a separate entity or it can be incorporated into the double deck bed. The desk should be wide enough to accommodate a desktop computer, books and paper, and still have enough surface to write when necessary.

A reclining swivel chair with striking red leather upholstery and stainless steel metal arms and legs will be perfect for a funky study area. Sufficient task lighting in the form of pendant down lights and a table lamp should keep the children awake while studying.

Every room needs storage space, especially the one with lots of toys, books and coloring paraphernalia scattered on the floor. The drawers under the bed and closet are excellent storage places. When they are full however, you can use baskets, boxes, plastic containers, etc.

Innovative ways to maximize children’s space

Place floating shelves and cabinets on top of the study desk area so that provisions for storage space can be added. You can have them painted in different colors so they will serve as functional decor too.

Surf the internet or look for furniture suppliers that can customize children’s bedroom systems that combine the bed and the study desk, the bed and the closets, etc.

Use abstract and sculptural chairs, tables and accessories that will keep the kids guessing about their true forms. Their quest for knowledge should always be challenged by the things they see around them. The geometric patterns on the floor and a framed multiplication table hung at the corner of the desk can help them stretch their minds a bit more.

Make use of casters in the furniture pieces such as the bed, study chair, study desk and tables so that the arrangement of the furniture pieces will be flexible. It will also be easier to clean the bedroom if the furniture pieces are movable.

Leave a Comment

Filed under Personal

Adding Views to Table Views with Core Data

I’ve been working on a new Cocoa app for Scientists for a few months now. It’s brand new software, so I’ve used the opportunity to learn Core Data (CD). Recently, I discovered an interesting use for CD: adding non-control NSViews to an NSTableView.

The view I was working with was a spinning NSProgressIndicator. I basically wanted to reproduce the sort of behavior you would see in the Mail app, where the indicator would spin during a refresh. I figured this must be a pretty standard problem, and that a solution would only be as far away as my Google search field in Safari, but that wasn’t altogether true…

The problem is that NSProgressIndicator is not an NSControl, and does not have an associated NSCell, which is required by NSTableView. I did find solutions to this online, it’s just that they weren’t straightforward. For example, I found a discussion on CocoaDev that was very helpful in understanding the issues, but didn’t provide any elegant or complete solutions. The CocoaDev page did provide me with a link to a more complete example by Joar Wingfors. The code in question worked a charm, but it was far from simple, coming in at several hundred lines. Joar’s code did inspire me though, and I have now come up with a solution using Core Data that puts a spinning indicator in my table view with less than 50 lines. Here’s how.

The trick — and this is the part that doesn’t sit completely right with me — is to add an attribute for the NSView to the Core Data entity represented in the table view. My entity was called Host, and it had an boolean attribute called isRefreshing which was set according to whether data for the entity was in the process of updating. To this entity, I added a second attribute calledrefreshProgressIndictor. Importantly, this attribute was made transient, with undefined type, so that Core Data would not attempt to save the NSProgressIndicator to file.

The refreshProgressIndicator attribute gets initialized to a newly created progress indicator in one of the awake... methods of Host:

-(void)commonAwake {
    NSProgressIndicator *indicator =
        [[[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0,0,16,16)]
    [indicator setStyle:NSProgressIndicatorSpinningStyle];
    [indicator setDisplayedWhenStopped:NO];
    [indicator animate:self];
    [indicator bind:@"animate" toObject:self
        withKeyPath:@"isRefreshing" options:nil];
    [self setValue:indicator forKey:@"refreshProgressIndicator"];
-(void)awakeFromInsert {
    [super awakeFromInsert];
    [self commonAwake];
-(void)awakeFromFetch {
    [super awakeFromFetch];
    [self commonAwake];

Note also that the animate binding of the progress indicator gets bound to the isRefreshing attribute of the Host. That way, whenever the isRefreshing attribute changes value, the progress indicator will immediately be informed by KVO, and start/stop spinning as appropriate.

I don’t feel good about adding a view like NSProgressIndicator to a model class; it messes with MVC, and disturbs me somewhat. But the solution it leads to is elegant, and given that the attribute is transient, I am able to live with it. How about you?

We now have our progress indicators, one for each Host. The next question is: How will they get displayed in the table view? Not surprisingly, we need some sort of cell. The code for this is extremely minimal. Here is the interface

@interface ViewCell : NSCell {
    NSView *view;

and here the implementation

@implementation ViewCell
-(void)setObjectValue:(id )object {
    view = (id)object;
    inView:(NSView *)controlView {
    if( [view superview] != controlView ) {
        [controlView addSubview:view];
    NSSize viewSize = [view frame].size;
    float dx = 0.5f * (cellFrame.size.width - viewSize.width);
    float dy = 0.5f * (cellFrame.size.height - viewSize.height);
    NSRect viewFrame = NSInsetRect(cellFrame, dx, dy);
    [view setFrame:viewFrame];

The ViewCell assumes that the object passed to it will be the view that will appear in the table view. As the name suggests, it is not specialized to progress indicators, but should work with any NSView. When the table view draws a cell, it first calls setObjectValue. The ViewCell stores the object passed in the instance variable view for use later in the drawing methods.

The drawInteriorWithFrame:inView: method is called to actually draw the cells contents. In this case, rather than do that, the view is added as a subview to the control view passed in. That way, when the progress indicator is redrawn, the control view will also redisplay, and we will end up with an animated progress indicator, rather than a static image.

The ViewCell does not resize the view passed in drawInteriorWithFrame:inView:, but does position it in the center of the cell frame. Variations on this approach are possible, of course, and will depend on your objectives.

The ViewCell is typically created and added to the table view in the awakeFromNib method of anNSArrayController class.

-(void)awakeFromNib {
    [super awakeFromNib];
    NSTableColumn *col =
        [hostsTableView tableColumnWithIdentifier:@"refreshProgress"];
    [col setDataCell:[[[ViewCell alloc] init] autorelease]];

All that’s left is to bind the table column in IB to the refreshProgressIndictor attribute of the Hostentity via the arrangedObjects property of the NSArrayController. Once that’s done, theNSProgressIndicator views will be delivered to the setObjectValue: of the ViewCell, and we can conclude that some progress has been made.

Leave a Comment

Filed under Cocoa

Joining the MacResearch Team

I’ve been a regular visitor to the web site pretty much since its inception, so I was very pleased to be able to accept an invitation to join the Executive Committee.

MacResearch is a web site that targets the Mac-using Scientist. It provides a wide range of services, including news feeds, software reviews, how-to articles, forums, a script repository, and — most recently — access to a 4-node Xserve computational cluster.

But one of the more important roles that MacResearch has taken on is that of mediator: Polls are held regularly, and the results summarized in a report which is communicated directly to Apple, and released to the community at large. If you want to know more, either visit the site, or check out the new web cast, in which Ivan Judson and Joel Dudley explain it all much more eloquently than I ever could.

What will my role be at MacResearch? To be honest, it’s a bit too early to say. I will certainly contribute content, most probably related to scientific software development in Cocoa, Python, C++, and Fortran. I also have some ideas for applications of Xgrid, but I can’t say much more than that until I find out what the existing MacResearch team have in mind. Whatever happens, I’m sure it will be an interesting ride…

Leave a Comment

Filed under C++, Cocoa, Fortran, Mac, Personal, Python, Scientific Programming

Dustup on Your Desktop

A while back I blogged here about how you can use launchd to regularly run a script to move old files from your Desktop to the Trash. I’ve been getting by with this solution for a while, but decided that I needed an easy way to enable and disable the garbage collection. The Desktop Dustup Widget was the solution I came up with.

Desktop Dustup does pretty much what the launchd script did, except that you can turn it off and on, and it is a hell of a lot better looking. The scheduling of the garbage collection is now taken care of by Javascript, rather than launchd, but the cleanup itself is still handled by a UNIX findcommand.

The design of the icon is due to Marcello Luppi. Marcello is a scientific colleague of mine, and a talented artist. Lately I’ve been encouraging him to get into software-related design like icons and widgets, and Desktop Dustup is his first public exhibition in that vane. (Look out for more substantial ‘fruits’ in the coming months…)

If you have desktop icons piled two or more layers deep, you need Desktop Dustup. And even if you can still make out the labels on the icons on your desktop, Desktop Dustup could save you a few trips to the Trash. So give it a try, and may your Desktop remain eternally uncluttered.

Leave a Comment

Filed under Mac

The Dashcode Mystery

Last week it became apparent that the rumors of Apple working on a Dashboard widget development tool were right on the money, when Dashcode started shipping with new MacBooks. But Apple itself has not made any mention of the fact, and the tool is not present in the recently released update to the Xcode suite. Did Apple deliberately ship Dashcode, or was it an accident?

Well, curiosity may have killed the cat, but it never did me much harm, so I downloaded Dashcode to see what the fuss was all about. At first sight, it looks like an elegant and polished tool, but after actually trying to create a widget with it, I can say unequivocally that Apple did not intend to release it at this juncture in time. Either that, or Apple’s QA department is in dire straights.

The Dashcode that I tested would have to be the buggiest Apple release in history, even surpassing the already legendary iWeb 1.0! Simple things like changing fonts or resizing buttons leave the UI in an invalid state, with drawing flaws that can only be cured by deleting the afflicted element. Undo/Redo also does not seem to work properly in many cases. I can’t believe that such fundamental flaws would have been left unchecked.

My view is that development on Dashcode 1.0 is nearing completion, but that it was not intended to be released just yet. The overwhelming silence coming from Apple would seem to support this. When was the last time Apple released something and didn’t make a song and dance about it? Even a simple home speaker system gets a ticker tape parade.

It’s more logical to assume Dashcode is destined to be officially released in Leopard. We may well hear the real story from Steve Jobs himself at the WWDC in August. Either way, Dashcode looks like a nice addition to Apple’s development tools, and I look forward to the official 1.0 release.

Leave a Comment

Filed under Mac

launchd and Growl for a Cleaner Desktop

I am one of those people that lets things accumulate on their desktop until there is literally no space left, before resigning to a clean up. (This applies equally to my physical desktop as my virtual one.) I finally decided I needed to do something about it, and resolved to leverage two technologies that are relatively new to me: launchd and Growl.

I have known about launchd since its introduction in Tiger, but haven’t had an excuse to use it yet. My plan was to use launchd in its cron-like mode to run a cleanup script once a day. The cleanup script would search for old files and directories on the desktop, and simply move them to the Trash. As a nice touch, I decided to use Growl to notify me when the script had run, with a message detailing how many files and directories had been moved. If you aren’t familiar with Growl, I have just one piece of advice: get familiar. It is a very cool user notification system.

I began with the script, which I called cleandesktop, and added to my ~/bin directory. This is what it looks like:

numFiles=`find ~/Desktop -fstype local -type f -maxdepth 1 \
  -ctime +3 | wc | awk '{print $1}' 2>&1`
find ~/Desktop -fstype local -type f -maxdepth 1 \
  -ctime +3 -exec mv -- {} ~/.Trash \; >/dev/null 2>&1
numDirs=`find ~/Desktop -fstype local ! -name . -type d -maxdepth 1 \
  -mtime +3 | wc | awk '{print $1}' 2>&1`
find ~/Desktop -fstype local ! -name . -type d -maxdepth 1 -mtime +3 \
  -exec mv -- {} ~/.Trash \;  >/dev/null 2>&1
/usr/local/bin/growlnotify "Desktop Cleanup" <<eor
$numFiles files and $numDirs directories were moved to the trash.

This script is basically a number of find commands. Each command has many options, which I based on commands in Apple’s /etc/daily script that is used to clean the /tmp directory. Two of the commands are there just to count files and directories, and the other two do the actual moving. Files and directories are moved to trash after not being accessed for three days; I figure this gives me enough time to move anything I want to keep to a safe place.

Growl comes into it in the last few lines. The growlnotify command allows you to produce notifications from the command line. The title of the notification is given as an argument, and standard input gives a detailed description. In this case, I have reported the number of files and directories moved in the description.

To make the picture complete, I added the following content to the file~/Library/LaunchAgents/DesktopCleanup:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
<plist version="1.0">

This causes the cleandesktop script to be invoked a 20.15 each day. To load it the first time, without logging out, I used this command:

launchctl load ~/Library/LaunchAgents/DesktopCleanup
launchctl start net.macanics.desktopcleanup

And with that, I may finally be able to make out the Tiger on my desktop … or is it a Panther? Puma? It’s been a while…


After more testing of this approach, it seems that using the -atime option in the find commands leaves a lot of files on the desktop that should be removed. I have now removed these above and in my own scripts, leaving only the -ctime option. This seems to work a lot better.

Leave a Comment

Filed under Cocoa, Mac

Psychic Mac

I just had one of those spooky moments. You know the ones: you are debugging, and find something totally unexpected…something that shouldn’t even be possible.

What I was doing was running a subprocess from within a Cocoa app I am developing. I was usingNSTask to start a script, and retrieving the output with an NSPipe. Nothing complicated about that.

Because I am still in the early stages of development, the script I was using was just a stand-in, to make sure everything was working to plan. It simply wrote a property list to standard output, with a few static values in it. I was planning to rewrite this script later such that it invoked the UNIX command ps, to get information about tasks running on the computer.

To my utter surprise, when I ran the application and examined the script output in the debugger, I saw this:

  711  p1  S+     0:00.20 -bash

Hmm, that looks nothing like my property list, and, what’s more, it looks awfully like the output format of the ps command! A quick search of my project revealed no reference whatsoever to ps. What was going on? Was my Mac psychic? Did it know what I was going to do next?

As with many of these ‘How could it be so?’ debugging moments, the answer turned out to be relatively simple, but it had me spooked for a while. When I initially created the script, I hadinserted a ps command into it, but had quickly forgotten that I had done this, because I then changed the script to print the property list. The script file resides in a directory that is copied into the Resources folder of the application bundle when the app is built. The problem seems to have been that Xcode did not recognize that the script needed to be recopied into the application when it was modified. A clean build fixed the problem.

The moral of the story: when confronted with something you don’t understand, your first instinct is to ascribe it to some supernatural power, when the more likely explanation is just that Xcode is buggy.

Leave a Comment

Filed under Cocoa, Mac, Scientific Programming

More Experiences of “The Life”

Luis de la Rosa is blogging about his first encounter with “The Life”, programming full-time for himself. It is a nice follow-up to my blog on “The Life” from a while back.

Leave a Comment

Filed under Cocoa, Mac

Eclipse and PyDev are Worth the Entrance Fee

I’ve been doing some work on Forpedo the last few days, which is a preprocessor for Fortran written in Python. Forpedo currently enables you to use basic generic programming techniques in Fortran programs; I’m now adding options for run-time polymorphism, as described here.

I didn’t want to talk about Forpedo today though, but the IDE Eclipse, and the PyDev plugin in particular. A friend of mine pointed it out to me, and I thought I would give it a try for Python development. In the past, I have tried developing Fortran with the Photran Eclipse plugin, but found it a bit difficult to configure for my Fortran compiler and build system. In the end, I gave up.

My experience with PyDev was very different though. I came across a few bugs, but in general it works as advertised, and was very easy to configure. The editor and code completion are powerful, and it has an outline view that allows you to easily navigate to any class, method, or function in a file. Best of all, it has a graphical debugger, which sure beats debugging from the command line, or dropping print statements into the code to locate problems. Another time saver are the links in the call stack dump that PyDev adds to allow you to jump to a problem spot when a script crashes.

All of these features are to be found in Xcode too, but Xcode only really works well for a handful of languages, and Python isn’t one of them. Working with Objective-C in Xcode has spoiled me, and I always dread having to go back to vi or TextMate — which is a great text editor, by the way — when I have to develop in Fortran or Python. Eclipse seems to be offering me a way out, at least for Python.

The Eclipse IDE itself is actually a very well written cross-platform application. ‘Cross-Platform’ usually equates to ‘Dodgy as Sh.t’, but you would never guess Eclipse was written in Java, and runs equally well on Linux and Windows as the Mac. The secret seems to be the API used to develop the user interface: The Standard Widget Toolkit (SWT). Unlike Java’s other UI libraries, AWT and Swing, SWT utilizes native widgets on each platform. On the Mac, it wraps around Carbon calls, so the windows and buttons you see on the screen are the real McCoy. It makes a world of difference to the look-and-feel of an App.

So it looks like Eclipse might become a permanent addition to my Dock. If you regularly develop in Python, why not take PyDev for a run — it’s the only Python IDE worth the time of day, in my view.

Leave a Comment

Filed under Fortran, Mac, Python, Scientific Programming