Blog Stats
  • Posts - 5
  • Articles - 0
  • Comments - 5
  • Trackbacks - 7

 

Friday, June 20, 2008

It's not Active Desktop Calendar, but it'll work (Mac)

I bought a MacBook Pro a few months ago because I needed a new laptop for work and was intrigued by the Apple line, after reading a bunch of great reviews from .NET developers who had made the jump.  After a few months of use, I really began to the love thing and considering it has more computing power than my current home desktop setup, I decided I wanted to shift my use to the MacBook Pro completely and ditch the desktop altogether.

So I've been spending the past few weeks making sure any program I use regularly on Windows has a Mac counterpart and I've managed to get pretty much everything I needed.  However, one little Windows application that I use all the time, Active Desktop Calendar, did not have any Mac equivalent that I could find.

It's such a simple application - you put events in a calendar that sits in your system tray and it displays them down the right side of your screen.  But it became so indispensible to me - I entered all the Flyers games in there (I'm an avid fan), all the upcoming concerts in the area I wanted to go, birthdays, parties, family events, etc.  It got to the point where I had to look at the thing before giving someone a "yes" or "no" about whether I could make an event to see what else was scheduled.  And I loved that I could just see it - I didn't have to open a program or anything.  It was just always floating there.

I wanted similar functionality on my Mac.  And I couldn't find anything out of the box that took care of it.  Until one day, I saw this post about this post on Lifehacker.  Now the ball was rolling.  I liked that it displayed freely on your desktop, but wasn't a fan of the calendar-like format.  It seemed a bit excessive and took up a little too much screen real estate for my liking.  So I downloaded the script and decided to take a look.

I had never worked with AppleScript before, but I figured now was a good time to dive in.  The syntax is pretty easy to pick up, especially if you have some programming background.  And I spent some time cleaning up the code to do what I wanted it to do - instead of creating files to be read into the Remind program, I just created text files formatted the way I wanted to display on desktop using GeekTool alone.  I also found a few ways to speed up the script - it grabbed all the events in a calendar, whereas I made it grab only events with a date that was either today or in the future.  And I made a few other tweaks to my liking.  My script can be downloaded here.  WARNING:  It's a work in progress and I actually have a bunch of additions/changes planned for it now.

The one major problem with this script is that it doesn't run automatically.  Every time you updated your iCal, you'd have to go run this script to get the changes to show up.  Not my idea of user-friendly.  So I set about trying to figure out get this thing to run on a schedule and came across launchd.  You use configurable plist files to schedule pretty much anything on our Mac.  It took me a bit to figure out how to get this thing working (where do I put the plist files? can I use relative pathing or must it be absolute) but I finally did and now I have it running where the script runs once every hour.  There are some advanced features where you can set WatchPaths and have launchd run your commands based on whether or not a folder, or any files in that folder, have changed.  I'm putting that on my TODO list for this application - I'd love to have it run after I enter a new item into iCal, instead of on a timed basis.  That would be beautiful.

Anyway, here is the plist file I created (turns out - absolute paths are necessary):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Debug</key>
    <false/>
    <key>Label</key>
    <string>com.apple.iCalToDesktop</string>
    <key>OnDemand</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>osascript</string>
<string>/Users/*myusername*/Documents/Calendars/iCalToDesktop.scpt</string>
</array>
<key>StartInterval</key>
<integer>3600</integer>
</dict>
</plist>


I think it's pretty self-explanatory (now that I have it working - I was ready to pull my hair out for a day or two haha), but if you have any questions, please don't hesitate to get in touch.

You put that file in your User/*username*/Library/LaunchAgents folder. Then open a terminal and run:

launchctl load *path to that plist file*

You have to log out of your account and log back on before the schedule starts running though.

So once you have that going and you want to display your text files on your desktop using GeekTool, it's pretty elementary. Just open GeekTool, create a new entry of type "Shell" and enter this:
cat *path to text file you want to display*

If it worked, you should see the contents of the file display on the desktop with a rectangle around them. You can position this rectangle by dragging it to wherever you want on the screen, and make it whatever size you want.

So now I have my precious events showing up on the desktop like I had with Active Desktop Calendar and it's even more of a benefit because it uses iCal which will also sync with my iPhone and whatnot. Pretty sweet.

I know this post lacks a lot of detail about the code itself, but if you open it, you'll see that the syntax is pretty easy to follow. Of course, if you have questions/comments/suggestions/improvements, please don't hesitate to get in touch. And I want to stress that the base of my code was taken from this blog post so this guy deserves a bulk of the credit. I sorta just took his framework and updated it for my own personal needs.

A few improvements I'm planning for when I get some more time:
  • Adding the TODO list items from iCal
  • Further formatting of each individual calendar (I have different calendars for concerts, Flyers games, birthdays, etc.)
  • Adding the ability to read the repeat type of an event (daily, weekly, monthly) and displaying them accordingly
I'm sure more stuff will come to mind once I start seeing what I like and don't like about my current setup.


Friday, February 29, 2008

What Music Do You Code To?

My CD collectionA post earlier tonight by Max Pool over at codesqueeze.com caught my eye moreso than the average post on a programming blog.  It asked What Music Do You Code To?  Great question.

Music is the most important thing in my life - yes, even moreso than programming.  We all need passions other than what we do for a living (right, RIGHT?) and since all I knew of computers was King's Quest and AOL, I've been going to concerts, buying CDs (or cassettes... and yes, I still buy them as showcased by the picture in this post - each of those racks behind me holds 1000 CDs and that's not even all of them - yikes!) and generally pouring a vast majority of my attention into the music scene.  Heck - my first foray into database-driven web development came in the form of an online music magazine that I ran for quite a few years.  It was a way for me to both indulge my constant craving for new music, while also having a sandbox to try out new things I learned about programming.  Sorry kiddies - no links... the site is still in classic ASP as it died a slow, painful death when I got to college and started doing internships and homework.

Anyway, back to the point, the music that comes out of my laptop at work is truly off-the-wall.  Just ask my brother who sits about 10ft away from me in our office - I can easily go from death metal to gangster rap without a second thought.  I blame that on being a Gemini.  But if I had to peg myself into a musical role, I'd say I was a hardcore/punk/indie kid and recovering metalhead.

Lately, the bands that have been getting the most spins (do mp3s spin?) include:

  • Joy Division / New Order
  • Alkaline Trio
  • The Loved Ones
  • Nirvana
  • David Bowie
  • The Cars
  • The Clash
  • Cursive / The Good Life
  • Social Distortion
  • Minor Threat
  • Ink & Dagger
  • The Misfits
  • Wolf Parade / Sunset Rubdown
(I've also placed a link to my Last.fm profile on the side of my blog - so if anyone has any interest in what I'm listening to, or is just really bored, you can check that out)

I've noticed that the best stuff to listen to while working is something you're very familiar with.  When I listen to new albums, I like to immerse myself in them to truly hear and enjoy them.  However, when I can sing the lyrics of a song without a second thought, it just seems like everything is in order and my code seems to flow as smoothly as the music.

Well, in order to keep this thread running through the developer community, I guess it's time to tag a few more people to fill this out.  So I'm going to throw the onus on the few bloggers I deal with on a somewhat regular basis:

Friday, December 21, 2007

Risky Business: Using EAP/CTP Software In Client Work.

This post began as a discussion between my brother and I after the preview release of the new MS MVC Framework. Both of us were chomping at the bit to get our hands dirty with this new piece of Microsft technology. One of us suggested using it for a new project that we were about to start for a client. The other one had his reservations with such a forward-thinking and proactive approach, suggesting rather that use on an internal application would be a better idea. Which one of us felt which way? Well - unless you were at Philly Alt.Net's December meeting you'll never know - better to leave sibling rivalry remain between siblings ;)

Getting into the nitty gritty of a new piece of software is a noble trait. You can't fault someone for being proactive. And in this particular case, the MS MVC isn't all that different from previous work we've done with Castle MonoRail. And obviously, the sooner you start working with something, the faster you'll learn how to leverage the tool to your needs. It may even give us the ability to provide feedback to the MS MVC team for bug fixes and enhancements to the RTM (Released To Manufacture) version.

But sometimes, when you play on the bleeding edge, you run out of band-aids. The risk involved in building software on top of a framework that hasn't been RTM seems pretty straightforward. There may be bugs. Features may be incomplete, missing or cleaned up before RTM. This isn't such a big deal when you have the time and resources to roll with these punches, but when you're under the pressure of a deadline and a budget, the amount of refactoring might be too great.  Not to mention, client buy-in could be tough on a product they can't rely on and a lack of support from the manufacturer as part of the license.

Again - there is no question that getting the jump on a new technology has its benefits. But there are also some pain points when being the first one on the bandwagon - those horses may be too much for you to control. The question is whether or not the benefit of the new framework outweighs the possible problems.

What does everyone else think? Not just about MS MVC, but about EAP/CTP software in general? Would you take the plunge or play it safe?

Wednesday, December 05, 2007

How will MS MVC affect the greater developer community?

5 months to make my first post?  Yikes!  I need to get on the ball.

But now seems like the perfect time to jump into things with the release of the ASP.NET 3.5 Extensions Preview coming soon (supposedly this week, but I haven't been able to find it yet) which features the MS MVC Framework that the Alt.Net community has been so excited for.

WIth the release imminent, I've been thinking about a few things.  Not things like predicting syntax, interoperability or how MS MVC will ease TDD.

I'm wondering how this release will affect the community.  Not just the Alt.Net community - those whom have already bought into the idea of reaching outside of the mainstream.  I'm wondering if the backing of Microsoft will lead those developers whom are perfectly content with doing things the "Microsoft way" with giving MVC a shot, now that it, in a way, is the Microsoft way.  Or at least it could be.

Furthermore, will Microsoft promote their MVC architecture as the new way to do things?  With Ruby On Rails getting a lot of attention lately, Microsoft may make a big deal about their implementation of a similar framework.  Can we expect to see code samples and tutorials in MSDN, featured prominently?

As someone who has taken a strong interest in MVC through working with MonoRail, I'd be overjoyed if Microsoft would push this framework as the new standard.  Imagine removing the pressure points of trying to sell this technique to management and other team members?  No more fighting the uphill battle trying to explain that this separation of concerns simplifies code, makes things more testable, maintainable, etc.  No more hitting walls of resistance because developers would rather not leave their comfort zone.  Instead of trying to sell MVC as a better way, we'll be able to say "this is the Microsoft way!"

I obviously don't have the answers, only the questions.  So what does everyone else think?  Will MS make a big deal out of this release?  And what would you LIKE to see them do, and why?  (I bet you didn't expect a pop quiz from my first blog post!)

Friday, July 13, 2007

This is my blog. There are many like it, but this one is mine.

I've been programming for a few years now and decided it was time to join the gang and start up a blog.  I've spent more than my fair share of time getting tips from others' blogs, so hopefully this one will effectively share a few of things I've picked up, as well as create an environment for me to continue learning.  It'll focus on .NET and web development for now.  Hope you enjoy!
 

 

Copyright © Dan Donahue