Friday, December 21, 2012
Mini Rant: Merry Christmas to you too Frontier Airlines
Long story short, Frontier Airlines cancelled my flight out of Akron on me today, making me miss my son's first birthday. They insisted there was just nothing they could do because of the weather.
Here's a thought Frontier: do what all the other airlines seem to be doing.
Needless to say, Frontier isn't exactly on my good list this year.
Here's a thought Frontier: do what all the other airlines seem to be doing.
One of these things is not like the other... |
Needless to say, Frontier isn't exactly on my good list this year.
Wednesday, November 21, 2012
After a good meal of barley and sprouts
After a good meal of barley and sprouts
On the stone's end at the water's edge, I rest as long as I like.
Of all other things, what could I envy?
-Yun Seondo (윤선도, 1587-1671)
Yun Seondo was a Choseon scholar, official, musician, and poet. He is one of my favorite sijo authors because his works always seem to have a very reflective, personal tone to them.
No matter your situation in life, all of us seem to be stressed about something. We always seem to think that happiness could be ours if we could just do this or have that. What I love about this poem is that it is not overtly didactic, only directly addressing envy at its close, yet it so powerfully persuades us to reassess priorities and contemplate what we really need to be at peace. In this calm vignette, the simple beauty of our lives so fully crowds out envy that by the end it seems entirely absurd.
*Image from www.heybrian.com. Taken at the Korean Folk Village. The guy has some pretty awesome pictures up on his website.
*Image from www.heybrian.com. Taken at the Korean Folk Village. The guy has some pretty awesome pictures up on his website.
They say Mount Tae is high
They say Mount Tae is high, but it is just one hill under heaven.
Climb and climb again, there is no reason it cannot be climbed.
Only people do not climb, saying "Mount Tae is high."
-Yang Saeon (양사언, 1517-1584)
Yang Saeon was a Choseon official, scholar, and poet. This is one of my favorite poems because the message is so simple: just because something is difficult does not mean it is impossible. Whether math, science, painting, exercise, or anything else, most great things in life just take time and effort. Yet, for some reason we seem all too quick to pass excuses off as legitimate reasons for not accomplishing the things that would make our lives more fulfilling, robbing ourselves of meaningful achievements and experiences in exchange for a bit of momentary comfort.
So next time you find yourself thinking something like, 'I could never understand physics' or 'I'm just not good at sports' I hope you hear a voice inside you saying "They say Mount Tai is high..."
*Mount Tai (태산, 泰山, Taishan) is a mountain of great historical significance in China's Shandong province. In Korean, it would be pronounced "Taesan".
Image: Path to a gate atop Mount Tai, by Charlie Fong
What's a Sijo?
Starting today, I'll be posting some translations I've done of old Korean poetry. Many poetry forms have come and gone in Korea, but the form I am most interested in is called the "sijo". So, what is a sijo?
The Korean sijo is, first and foremost, a vehicle for expression. Similar to many Chinese and Japanese forms of poetry, the Korean sijo has a unique line and syllabic structure. A sijo typically has three lines, and each line has about 15±2 syllables in a 3/4/4/4-ish pattern. The three-line convention is invariably observed, but the syllables and structure within each line are not strictly observed, leaving the author freedom to expand or trim as he or she sees necessary. Below is an example of a typical sijo, in this case from the 14th century.
In a sijo, each line, like each movement in a classical symphony, has a certain expectation. The traditional usage of each of the three lines is as follows: theme, development, and twist+resolution. The first line sets the scene, and the second develops this theme. The third line is what makes the sijo so fun to read: the first half of the third line invariably has some type of change. This can take the form of a change in plot, the revealing of a metaphor, counterpoint to the author's previous assertion, and so on. Finally, the second half of the third line brings conclusion.
As for time period, the sijo has been around for nearly a millenia! There are excellent examples from as early as the mid-1200s and the form was in common use through the 19th century.
There are two major groups of sijo authors: scholar-officials and gisaeng. To qualify for a government position in Korean society men needed to pass government examinations. These examinations included, among other topics, poetry, so every significant government official had some command of the poetic language. Though many scholars flitted in and out of government service, often due to warring factions or frustration with the constant disputes, most served in some government position at one time or another. Korea's greatest Confucian scholar (Yi Hwang), greatest military leader (Yi Sunsin), and even many of Korea's kings were avid composers of sijo. The other great group, the gisaeng, were entertaining women. These women were unique in that they were in the lowest class of Korean society, yet their education was second only to the scholar-officials. Given the diversity of authors, sijo topics cover a broad range from political commentary to wartime reflection to love and longing.
In my translations, I have chosen to mostly shy away from the traditional syllable pattern of the sijo. I maintain the three-line pattern, but given the reversed order of Korean (subject-object-verb) and English (subject-verb-object) have had to take significant liberties to maintain the order of presentation that breathes life into the sijo. In short, my goal with my translations is not to render a perfect mapping of the Korean poem into the English language, but rather to interpret and retell these sijo to best represent their original meaning.
Please don't be shy about leaving feedback as you read!
The Korean sijo is, first and foremost, a vehicle for expression. Similar to many Chinese and Japanese forms of poetry, the Korean sijo has a unique line and syllabic structure. A sijo typically has three lines, and each line has about 15±2 syllables in a 3/4/4/4-ish pattern. The three-line convention is invariably observed, but the syllables and structure within each line are not strictly observed, leaving the author freedom to expand or trim as he or she sees necessary. Below is an example of a typical sijo, in this case from the 14th century.
이몸이 죽고 죽어 일백번 고쳐죽어
백골이 진토되어 넋이라도 있고 없고
임향한 일편단심이야 가실 줄이 있으랴
In a sijo, each line, like each movement in a classical symphony, has a certain expectation. The traditional usage of each of the three lines is as follows: theme, development, and twist+resolution. The first line sets the scene, and the second develops this theme. The third line is what makes the sijo so fun to read: the first half of the third line invariably has some type of change. This can take the form of a change in plot, the revealing of a metaphor, counterpoint to the author's previous assertion, and so on. Finally, the second half of the third line brings conclusion.
As for time period, the sijo has been around for nearly a millenia! There are excellent examples from as early as the mid-1200s and the form was in common use through the 19th century.
There are two major groups of sijo authors: scholar-officials and gisaeng. To qualify for a government position in Korean society men needed to pass government examinations. These examinations included, among other topics, poetry, so every significant government official had some command of the poetic language. Though many scholars flitted in and out of government service, often due to warring factions or frustration with the constant disputes, most served in some government position at one time or another. Korea's greatest Confucian scholar (Yi Hwang), greatest military leader (Yi Sunsin), and even many of Korea's kings were avid composers of sijo. The other great group, the gisaeng, were entertaining women. These women were unique in that they were in the lowest class of Korean society, yet their education was second only to the scholar-officials. Given the diversity of authors, sijo topics cover a broad range from political commentary to wartime reflection to love and longing.
In my translations, I have chosen to mostly shy away from the traditional syllable pattern of the sijo. I maintain the three-line pattern, but given the reversed order of Korean (subject-object-verb) and English (subject-verb-object) have had to take significant liberties to maintain the order of presentation that breathes life into the sijo. In short, my goal with my translations is not to render a perfect mapping of the Korean poem into the English language, but rather to interpret and retell these sijo to best represent their original meaning.
Please don't be shy about leaving feedback as you read!
Thursday, October 25, 2012
How Dropbox Found My Stolen Laptop
Are memes still cool? Anyway, thought this guy would fit. |
I was away at a conference when I got the call from my wife.
It was about 6pm, and my wife and 6-month-old son had just gotten back
from a 2-hour play date. Our apartment door was hanging off its hinges,
and our electronics, including my wife’s MacBook, were gone.
Being the average Americans we are, we hadn’t written down any
serial numbers. Being the average 20-somethings we are, we had our lives
on our laptops, including all our son’s baby pictures other than the handful
we’d put online (and unlike most parents you may know on Facebook, that wasn’t
a whole ton). There were no fingerprints, no witnesses, and no leads. Basically, there was no hope, and the police
weren’t bashful about saying it. If
only, we lamented, we had installed some kind of tracking software on the
laptop! We had renter’s insurance for our stuff, but it wouldn’t replace the
pictures or the frustrating lack of justice.
After the painful process of hunting down serial numbers and
filing police and insurance reports, we turned to sanitizing our digital
lives. Her laptop auto-signed her in to
just about everything, so e-mail and website passwords had to go. She had Dropbox installed, so we figured we’d
clear out the files and deauthorize her old laptop (though I did toy with the
idea of planting some honeypot-esque security program in it for a while. If only I had more free time!) We got on my computer, Chromed over to
dropbox.com, and headed to Dropbox’s security settings. By now, it was about 4 days post-theft. Sure enough there in the list of devices was
“White MacBook”, most recent activity… 3 hours ago?! Her laptop was still signed in!
Now, in case you didn’t know this yet, here’s a tip: Dropbox not
only tracks the devices that have accessed your account, but shows you the IP address they accessed it
from. Not only had our thief not
wiped the hard drive, he/she hadn’t bothered to turn off Dropbox. (I suppose if they were tech-savvy sorts they
probably wouldn’t spend their afternoons bashing in apartment doors). Dropbox
was now our secret laptop-tracking software.
A few minutes on Google told me the IP was a local address held by
Time Warner Cable. I called them and
asked if they could link their IP addresses to street addresses,
and they said they could, at least for a police officer with a subpoena. Fortunately, I had watched enough Law and
Order to know what that was, so I hung up and called the police. The first guy I talked to didn’t sound too
enthused, but we wrote it all down nonetheless.
Then we waited.
Monday we got a call from a detective who sounded a bit more
tech-savvy; he had asked to be assigned to our case. By this time, the IP address had changed, so
we gave him both IP addresses and the number to call at Time Warner. He called us again to say he’d filed the
appropriate subpoenas. Then we waited.
About a week later, our detective told us the subpoena had been
served and he’d investigated the address.
It was some auto shop that “didn’t even have internet.” (How that makes
any sense I don’t know. It’d be like
getting a call from a number and the phone company tracing it to a barn with no
phone. But hey, I’m no detective). He was still waiting to hear about the other
address, so we waited. And waited. And waited.
We checked Dropbox about once a week to make sure the IP address hadn’t
changed, and we waited. Finally, months
after we’d given up, we got another call.
The subpoena for the second address had been served, and this time it
was residential. They got a search
warrant, and told us they would be going in soon.
Two days later, they had our laptop, some other gadgets, and an
arrest.
A few signatures in a book
downtown, and we were headed home with our stuff. Our pictures and video on the laptop? All still there. Our insurance had already payed out and we
had already replaced our stuff, so the recovered items are all headed to our insurer. But not before we
save the 10 months of pictures and video we just got back.
Now you might be thinking right now, ‘Wait, what if it was some
poor college kid who bought the stuff on craigslist not knowing it was stolen?
Poor kid…' Well, the guy had not just my wife’s laptop, but some of our other
stuff as well, and more or less confessed to knowing it was stolen. Given the cost of our stuff, that’s a felony offense of receiving stolen property. On
the other hand, he seems to be keeping quiet about who he bought it all from,
so we’ll see where that investigation goes. The detective tells me he also had
a very lengthy criminal record and a half-million dollar house, so you can save
your sympathy. Was this the guy who
bashed in our door? Maybe, or maybe
not. But whether we caught the burglar
or just a partner in crime, it feels good to have a little justice in the
morning.
Monday, September 10, 2012
Fix Cisco AnyConnect VPN Client and Mac Lion (10.7) and Mountain Lion (10.8) Connection Problems
After upgrading my Macbook Pro to Mountain Lion and setting it up, I noticed I suddenly couldn't connect to my school's VPN server. This meant no online textbooks, journal articles, etc. After searching far too many message boards, I finally found an answer.
I finally found the answer in a blog post from an Indian news site. Apparently, Cisco AnyConnect VPN Client and Apple's "Back to My Mac" feature don't play nice with each other, so fixing it requires turning off Back to My Mac if you have it set up. Score one for Indian tech support!
To fix it, open System Preferences, click iCloud, and deselect Back to My Mac. It's that easy!
Unfortunately, until Cisco and Apple work with one another it looks like an either/or situation with the two services.
I finally found the answer in a blog post from an Indian news site. Apparently, Cisco AnyConnect VPN Client and Apple's "Back to My Mac" feature don't play nice with each other, so fixing it requires turning off Back to My Mac if you have it set up. Score one for Indian tech support!
To fix it, open System Preferences, click iCloud, and deselect Back to My Mac. It's that easy!
Unfortunately, until Cisco and Apple work with one another it looks like an either/or situation with the two services.
Labels:
10.8,
AnyConnect,
Case VPN,
Cisco,
Lion,
Mac OS X,
Mountain Lion,
tech,
VPN,
vpn.case.edu
Sunday, September 2, 2012
DIY Doors on Coffee-Table TV Stand
The completed project! Opens and closes like a charm!!
Keep your electronics safe from infant hands, and give them one less shelf to bonk their head on! |
Why?
This project had a simple motive: I had been using an Ikea coffee table with a few side tables as a DIY TVstand (see previous post). This was going great until my
7-month-old son finally figured out how to pull himself up high enough to reach
the electronics underneath. Long story
short, I needed a TV stand with some kind of doors in front.
Solution 1: Buy a new TV stand with doors in front.
Boring, surprisingly
expensive, and my furniture-buying budget is approximately nothing, so on to…
Solution 2: Install my own door!
Parts
3 – 3” Utility/DoorHinges (about $1.50 each, comes with screws but they were a bit long and would have stuck out the back.
You would be fine using just 2 hinges)
6 – Shorter screws. I don't remember the diameter, but they need to fit the hinge holes and not be longer than about 3/4" or they'll stick out the back of the shelf.
1 – 10” x 36” BlackShelf ($7) for the door.
1 – Babyproofing
Drawer Latch ($1, this style)
Total: $12
Instructions
More pictures are included below for clarification.
1) Cut the shelf down
to 10” by 31-1/8”
2) Attach the hinges
to the door. Be very careful that they are on straight and that you’re on the
correct side of the hinge. For the hinge
to open out, the shelf needs to be attached on the inside of the hinge so it can be flush with the front of the
coffee table but not hit the top when it swings out. Before you screw anything in, hold up the
shelf and hinges and move it through the full range of motion to make sure
you’re right! Also, being so close to
the edge of the shelf you should really drill pilot holes before you put in the
screws.
3) Screw the hinges to the underside of the topmost piece of
wood of the coffee table. Make sure the
hinge is recessed in a bit. The front
surface needs to be flush with no hinge edges, shelf corners, or anything else
a falling toddler would hit their head on.
Your kids should at least stay as safe as your PS3.
4) Attach the base of the latch (not the hook part) to the
underside of the bottom piece of wood in the TV stand.
5) Attach the hook part of the latch to the shelf/door. It should be lined up so it closes easily but
won’t slip open on its own. I had to
attach a thin piece of plywood between the shelf and the latch to make the
latch reach the base.
6) If you want, tape off the wood and spray paint the front
of the hinges. My wife liked the metal
look.
Note: One seeming problem here is that the sides of the coffee table are still open for little fingers to enter. In our case, both sides face side tables with blankets under them, so it hasn't been a problem. You could use mesh, more wood, etc. to permanently wall off the sides if you need to, as you shouldn't need to open and close them.
Steps 2–3: Attach the hinges and door |
Step 4: Attach the latch |
So much space for things! |
1 Coffee Table + 2 Side Tables = Awesomely Wide TV Stand for $40
|
Backstory
Back when I was in college playing Wii on a 27” CRT TV in my one bedroom apartment, I got a $20 coffee table from Ikea and used it as a TV stand. Fast forward a few years, a couple of bucks, and one 8 month old, and I needed a solution for my 47” flat screen. The coffee table wasn’t long enough, so the TV stuck out over both sides.The Fix
1) Buy two $10 side tables (the nearest Ikea is 7 hours away
from me now, so I had to buy some from Walmart that were close) and put one on
either side of the coffee table.
2) Kids pulling them apart? Use some scrap wood and a few screws to hold
them together. I put 3 screws into each
side and it’s sturdy and invisible unless you're underneath.
A few screws and a 5"x10" piece of plywood make it toddler tough. |
Bottom Line
1 $20 coffee table + 2 $10 side tables = $40 for a 76” x 22” x 18” TV
stand.
The door on the front was another baby-proofing step, and the topic of my next post!
Friday, June 29, 2012
Find iPod's Serial Number (no iTunes backup required!)
After a recent break-in/theft, I had an iPod Touch stolen from my apartment. Unfortunately, it was locked with a passcode, making trying to find it with Apple's "Find My iPhone" app nearly impossible as it needs WiFi to find itself. Anyhow, I thought it would be nice to at least be able to tell the police a serial number in the astronomically low chance they find the scumbag culprit. Problem: I did not know the serial number, and as it was my wife's, I did not have a backup on my computer (it was on hers, which was also stolen). BUT!!! I had connected it to my computer before for charging and such, and despite iTunes's lim ited memory, the information lives on in your computer.
Finding the Serial Number Without iTunes
Your Mac keeps a record of all iPods it connects to. I mean, it must to remember which ones to automatically sync and which ones not to, right? The file can be found at:
< key > SomeKey < /key >
< string > Cool Technical Jargony Thing < /string >
< string > [your serial number here] < /string >
Finding the Serial Number Without iTunes
Your Mac keeps a record of all iPods it connects to. I mean, it must to remember which ones to automatically sync and which ones not to, right? The file can be found at:
Macintosh HD > Users -> [your user name] -> Library -> Preferences -> com.apple.iPod.plist
If you open the file in TextEdit or something it might get messy. Just do the quick view by pressing spacebar and you should see lots of stuff that looks like this:
Look for the line after "< key > Serial Number < /key > ", and it should look like this:
example: < string > G8312CO150D4 < /string >
And that, my friends, is your serial number. There will be a separate entry for every iPod you've connected so if you own more than one, keep looking until you find the one that doesn't match the ones you have.
Not sure if this will ever actually help anyone recover a lost device, but happy hunting!
Saturday, June 23, 2012
Wednesday, May 30, 2012
Tuesday, May 29, 2012
Monday, April 30, 2012
DIY $7 Night Vision Baby Monitor
Checking the kid on my iPod Touch. See sample video at bottom! |
The Problem
This project had simple motivation: I wanted a video baby
monitor, and I didn’t have a lot of money.
I didn’t need sound, as the baby’s room is right next to ours, but I
didn’t want to have to get up every time I heard him cry to see if he’s okay. There are great products out there if you’re
willing to throw down $100, but I’m a grad student with a budget.
Thinking of a solution
My first thought was just to train a webcam on him, but I
didn’t want to have to shine lights in his face all night. So, I needed a way to see in the dark. In my brief research, I found two basic ways
people do night vision. One is to use
photomultipliers, which basically just shine 10 photons of light at you for
every one its sensors see. Good for
military night vision, bad for us. The
other is to flood the area with IR light and use an IR sensitive camera to
detect it. This is easy enough, but
where do you find an IR sensitive camera?
Well, between your phone, webcams, etc. you already have a lot of
them.
The IR Webcam You
Already Own
The light sensors on digital cameras are sensitive to a huge
range of light, ranging from the IR spectrum through the visible and a bit into
UV. To achieve their goal of only
capturing visible light, digital cameras put IR filters somewhere between the
lens and detector. These aren’t perfect
(you can test your remote control by pointing it at a webcam and you should see
a faint white light), but they block out most of the IR. Basically, to make an IR-sensitive camera
you can just take an average webcam and remove the IR filter.
The Big Picture
So what we’re going to do here is remove the IR filter from
our webcam, make some USB-powered IR lights, and broadcast the webcam feed over
our local network. By the end, you should be
able to view your night-vision webcam on any computer, smartphone, iPad, iPod
Touch, PS3, or anything else on your network with a web browser.
Parts List
3 IR LEDs ($0.60, 20 pcs for $4)
1 25 ohm (or greater) resistor ($0.01, 1000 for $7.50 on
eBay)
1 USB Cord ($1 at any dollar store. Get an A/A (Male/Male) one and you can use it
twice!)
1 old useless CD (come on, you know you have one)
OPTION A:
1 Super Cheap Webcam ($5, I used a Creative Live! Cam Vista
Webcam. Works fine, easy to remove
filter, does NOT work with Mac OS).
1 Old computer (Everyone has an old laptop around, right? If
not, you could just not use your laptop when baby is sleeping.)
OPTION B:
1 Wireless Wifi IP Webcam ($50ish on eBay. I haven’t used them, so good luck.)
--------------------------------------------------------------------------
Total Cost = about $7 with an old computer.
= about $50 with an IP webcam
Step-By-Step
Step 1: Remove your
webcam’s IR filter. There are a few good
sites describing how to do this. For the
webcam I used the hardest part was opening the case, and that wasn’t bad. After that, I just unscrewed the lens until
it came off and the IR filter popped right out.
Try here for help, or just google it!
http://www.hoagieshouse.com/IR/
Step 2: Weld together the IR lights. As with my flashing alarm clock demo, I like
to set LEDs in old CDs because they are rigid, easy to work with, and you
probably have a bunch lying around. They
also have a hole in the middle convenient for putting the lens of a webcam
through. For the power, just take
scissors and cut your USB cord in half.
There should be 4 wires inside.
Red is +5V and black is 0V/ground. The white and green wires are for data: we won’t be using these.
The CD happens to have a convenient lens-sized hole right in the middle! |
View from the back. I used electrical tape to hold it together before I bought a glue gun, so forgive the black junk. |
(Note: I really like using USB power supply for all sorts of
electronics projects. One is because
years of cameras, cell phones, etc. have left me with a handful of ACàUSB converters. The other is that if I utterly destroy the USB
cord, they’re cheap and easy to replace.)
Step 3: (Note: If you’re using the Wifi IP Webcam approach,
you don’t need this). Get some software that lets you broadcast your webcam on
your local network. I found Yawcam to be
super convenient and easy to use. In Yawcam,
it’s the “Stream” option that you’re looking for.
Step 4: Fire up your Kindle, iPhone, Laptop, or whatever and
point it to whatever address Yawcam tells you. For sanity’s sake, try not to be too
compulsive checking it!
Video feed during an afternoon nap
Video taken at night. The blanket at the bottom is actually
blue with white dots, but in the IR it all looks the same.
Sunday, April 22, 2012
$5 Flashing LED Light Alarm Clock
Don't mind the crying kid in the background
I had two basic problems that led me to this project:
1. I needed something to wake me up without waking up my
wife. (Headphones fall out of my ears
overnight. I thought of that.)
2. I hate the sound
of alarm clocks.
My answer: the LED light alarm clock! LEDs are problematic for normal lighting
because the light is only bright within a narrow range. For us, this is perfect as it lets us focus
the light on just one person, letting the co-sleeper snooze on.
Parts and Cost:
1 Cheap Alarm Clock ($1.99, eBay)
5 White LEDs ($0.35, 50 for $3.29, eBay)
1 2N3904 (or other NPN) Transistor ($0.20, 15 for $2.99,
RadioShack)
1 8 ohm Resistor ($0.01, 1000 for $7.50, eBay)
1 2 x AA Battery Holder ($1.99, RadioShack. abt. $0.50 on eBay)
2 AA Batteries (You probably have some around)
–––––––––––––––––––––
Total = About 4 or 5 bucks
Warning: Some of this
goes against good electronics practice.
Just so you know (see step 3).
The basic concept here is that somewhere in your average alarm
clock is something that makes sound. For
it to make sound, it needs pulses of current.
Using a transistor, you can use that current to switch on current for
whatever you want!
Step-By-Step:
Step 1: Open your alarm clock, find something that looks it
makes sound. Use your multimeter to
figure out which side is giving it positive current and which side is
negative. Cut out the sound part
Step 2: Connect the positive side to the base of the
transistor. Connect the negative side to
the emitter.
Step 3: Connect the LED circuit as shown in the
diagram. The positive end goes to the
collector, and the negative to the emitter. I use old CDs to set the LEDs because they're rigid, easy to put holes in, and I have a stack of 50 CD-Rs that I'll probably never use in the thumb drive/MP3 age.
(Note: Using just one current-limiting resistor for the whole LED array isn’t really a great idea. Here, the 8
ohm resistor limits the current to (3 V – 2.2 V) / 8 ohms = 100 milliamps. We just assume that the current will divide
evenly giving us 20 milliamps per LED.
With variation among LEDs, it might not be evenly split. Also, a bigger problem is that if one of the
LEDs goes out we still have 100 milliamps, but only divided 4 ways. This gives us 25
milliamps each, which is more than the LEDs are rated for. It would be better to use a resistor in
series with every single LED. I just
didn’t feel like it at the time.)
Step 4: Enjoy!
Just a normal everyday alarm clock |
The LEDs. Get some use out of that stack of CD-Rs you'll never use! |
Don't try to take this on a plane, it might look awfully suspicious. |
Saturday, February 25, 2012
Tutorial: Make your desktop picture match the current weather
It changes with the weather! |
Solution: By throwing together a little Unix code, AppleScript, and a free program called GeekTool, I make my desktop picture change to reflect the weather outside. I use GeekTool to automate running the script at hourly intervals. You could do this a lot of different ways with plists or other programs, but since I use GeekTool anyway it was the easiest.
What happens is that once an hour, GeekTool executes a Unix shell command that opens an AppleScript script. The script (using a shell command) gets your current weather from an NOAA website, and sets a JPEG on your computer with a name that matches the weather as the desktop.
End result: your desktop picture matches the weather outside.
The How-To Part:
1. Make a folder in your Pictures folder called "Weather"
2. Open the "AppleScript Editor" application, make a new script, and copy and paste the code below into it:
It should look like this by the end.---- DesktopWeatherman.scpt-- 2011.2.25-- Mark Sawyer-- bioquizzical.blogspot.com--#Find your weather region by going to www.weather.gov and clicking where you live. The 3 letter code at the end of the new URL should be your region (ex: FOO)#Change all instances of "CLE" to the weather region you're in (ex: /data/FOO/RWRFOO)#Change "HOPKINS" to the city you're in (look at www.srh.noaa.gov/data/FOO/RWRFOO to find out what it calls your city)#For example, if your region is FOO and you live in YUBA, the URL in the code should say "http://www.srh.noaa.gov/data/CLE/RWRCLE | grep YUBA"#NOTE! Your region might not have a RWR file. If so... good luck!# Also, your region might use slightly different weather codes. Look at www.srh.noaa.gov/data/FOO/RWRFOO to find out what codes it uses.set current_weather to do shell script "curl -s http://www.srh.noaa.gov/data/CLE/RWRCLE | grep HOPKINS | awk '{ print $2 }'"if current_weather is equal to "LGT" then set current_weather to do shell script "curl -s http://www.srh.noaa.gov/data/CLE/RWRCLE | grep HOPKINS | awk '{ print $2,$3 }'"set localFile to "~/Pictures/Weather/" & current_weather & ".jpg"tell application "System Events"tell desktop 1set picture rotation to 1set picture rotation to "never"set picture to POSIX file localFileend tellend tell
3. Save the script in your "Weather" folder as "DesktopWeatherman.scpt". You'll need to edit it to match your region and city. Everything in the code immediately after a "#" is a comment. Follow the instructions in the comments.
4. Download and install GeekTool. Make sure to click the "Enable" box when you install it!
5. Make a new Geeklet by dragging the "Shell" icon onto your desktop. It doesn't matter where you put it.
6. In the "Properties" window in GeekTool, in the "Command" box type
osascript ~/Pictures/Weather/DesktopWeatherman.scpt7. Still in the "Properties" window, in the "Refresh every" box, type 1800 (the weather site only updates every hour, so checking more frequently doesn't really make a difference).
8. Fill your Weather folder with pictures to match each possible weather status. The name of each picture should be the weather status followed by ".jpg". The status names might vary by region. Follow the comments in the code to see what your region uses. In most regions, the possible weather codes (I've seen) are:
SUNNY, FAIR, MOSUNNY, PTSUNNY, MOCLDY, PTCLDY, CLEAR, DRIZZLE, LGT RAIN, RAIN, FLURRIES, LGT SNOW, SNOW, FOG, MIX PCPN.I'm not clear on exactly what some of these mean either, but this might help.
The directory should now look something like this:
I don't have files for every weather condition quite yet... |
If it loads some default Mac picture instead of one of your weather pictures, it means you don't have a picture to match the current weather status.
9. To make it show the weather status in words on your desktop, make another Shell geeklet and in the "Command" box type:
curl -s http://www.srh.noaa.gov/data/CLE/RWRCLE | grep HOPKINS | awk '{ print $2 }'Of course, you need to change "CLE" and "HOPKINS" just like you did in the AppleScript. The font I use is called "Trade Winds" and from Google Webfonts.
And that's it! For obvious reasons this will only work in the USA, and you might have to tweak things to get it to work in your weather region. I guess outside of the USA you could still have it match the weather for a US city, I just have no idea who you would do that.
Anyway, enjoy your window to the world!
Attribution: The picture I used for my backgroup in the title was on so many scores of websites that I could not find the original owner. Please let me know if you can!
Subscribe to:
Posts (Atom)