New Alarm, Part II

I just came back from my last “mock orals” meeting (for my PhD general exams) today and it will all be over with the main event next Thursday afternoon. After the oral exam, all I have to do in order to get my PhD is write a book about something, right?

Instead of plunging back into my books and notes when I got home today, I really needed something to relieve my stress. I wanted to program something, anything really. I decided to bring my new alarm to the next level. It has been working wonderfully. However, to “set my alarm” each day I have to create an iCal event that triggers the elaborate process described in my previous posting. That is still not streamlined enough for me. If I woke up at the same time everyday like normal people I could just create a repeating event but my unhealthy sleeping schedule varies wildly.

Today I wanted to create something such that when I click it, it 1) asks me what time I want to wake up 2) Unless it is after midnight, it creates an alarm event in iCal for the next day (otherwise it creates one for today) which triggers my elaborate alarm at the time I told it. 3) It adjusts the computer’s wake up time to be 5 minutes before the alarm (The way I had it before, the computer’s scheduled wake up time did not fluctuate with the vast changes in my sleeping schedule). I’m not very experienced with applescript, which I used to accomplish my aim (I especially miss the great date and time functions of a language like PHP for example) but I got it to work. The resulting script is here, with the full text of the script below.
Continue reading New Alarm, Part II

My New Alarm

I created a new (Macintosh) computer automated alarm to get me up and about in the morning. Here is what the alarm does:

1. My computer wakes itself up in the morning. At the appropriate time it opens up iTunes and turns the volume all the way down.
2. It randomly chooses one song from a playlist containing very soft and soothing wake up music. While this is happening it downloads the most recent 7 AM summary of the news from NPR.
3. iTunes starts to play the soft song and over the next 30 seconds or so it slowly turns the volume up to full.
4. After the song is finished playing iTunes then plays the 5 minute summary of NPR news for this morning.
5. After the news is finished, it randomly chooses one song from a playlist containing much louder and more lively wake up music which it plays at full volume.
6. The computer then extends a large metal arm and proceeds to beat me really hard with a pillow until I get out of bed. (Ok, maybe I’m still working on this feature).

In case you want to create something similar, read on.
Continue reading My New Alarm

Footnotes for Weblogs Revisited

Early last year I tried to work out a convenient and simple way to incorporate footnotes into blog entries. The solution I settled on didn’t work well and I quite using it. I looked into it again today and found an excellent piece of coding over at Brandspankingnew for Footnotes with CSS which I think works well. The code there shows you how to get some embedded footnote information in a “Span” tag to get put together with all other footnotes at the bottom of your article, complete with anchor links back and forth.

All I had to do to make this work with a weblog is incorporate this code into the WordPress theme. For my own reference and for anyone else who wants to try here is how I did this with my WordPress installation:

1) Upload this Javascript file (on my server here if the link dies) to your server and remember where you put it.

2) Add this css code to your WordPress theme’s styles.css file. Modify it to your liking, this will change the appearance of the footnotes themselves.

3) In your theme’s post.php file, change <div class=”post-content”> to <div id=”post<?php the_ID(); ?>” class=”post-content”>

4) In the same post.php file, add the code <div id=”post<?php the_ID(); ?>notes” class=”footnoteholder”></div> after the div tag labelled class=”post-content” which we changed in (3).

5) In your theme’s index.php file, just before the body tag is closed at the bottom of the file (before the ), add:

<script type=”text/javascript”>
//< ![CDATA[
<?php rewind_posts(); ?>
< ?php while (have_posts()) : the_post(); ?>
formatFootnotes(“post< ?php the_ID(); ?>”,”post< ?php the_ID(); ?>notes”);
< ?php endwhile; ?>

//]]>
</script>

6) Also the same index.php file, add the line

<script type=”text/javascript” src=”http://the-address-to-the-javascript-file/formatFootnotes.js”></script>

just before the closing of the head tag (). (remember to change the address to point to wherever you uploaded the javascript)

7) Now we have to steps (5) and (6) for the single.php file and the category.php as well, which controls how your blog entries look like when they are viewed as a single posting or when a series of postings are viewed from the same category. Add the script just above the closing of the body tag () and add the call to the javascript from step (6) just above the closing of the header tag in both the single.php and category.php theme files.

That should be all there is to it. To create a footnote, simply embed it into a span tag with the class “footnote” like this: <span class=”footnote”>Lawson, Konrad Mitchell<em>My great book</em></span> and then it should come out looking like this.Lawson, Konrad Mitchell My great book

I figured this out by basically studying the great example provided by Brandspankingnew.net here and then going to the WordPress website and learning about template tags and template loops, with the most important information on this page under the category of multiple loops. Good luck to anyone else who tries! Here are a fewMy second footnote footnotesMy third footnote. to show how it works.My fourth footnote!

After writing this up, I found via a quick search that someone else has been working on footnotes for wordpress at Elvery.net. It looks very similar, may use the same footnote code, but comes in the form of a wordpress plugin which may be much easier. Also, Alex King has something which also looks really wonderful for this, called JS QuickTags but I haven’t tried it on my own server (if it ain’t broke…).

NOTES & UPDATES: I need to work more on this, for example, there is the question of what to do with RSS/atom feeds, in which the spans don’t get converted to footnotes…

iTunes Tagging

My playlists in iTunes are a complete mess. I don’t have time to sort them out. Recently there are have been a variety of postings at various places online suggesting ways to incorporate tagging for songs of the sort used at places like the wonderful link management site del.icio.us (My tags are here by the way). Briefly here is how it works: 1) You assign certain tags or key words to identify your songs (for example “vocal” “folk” “dark” etc.) separated by spaces. 2) You then use this data later to find songs matching the particular combination of characteristics you want for any given listening session.

I have decided to use the “Grouping” field which each iTunes song has (it was originally meant for identifying groups of songs in classical music). I modified a wonderful open source Applescript written by Chris Brown called TuneTag which allows you to add tags to the Comment field of a song so that it instead adds tags to the Grouping field instead. You can download my modified version of his tag.scpt script here.

I use a great and very unique free program called Quicksilver which lets you use various short cuts to common functions on your computer. If you don’t have it, and want to try this iTunes tagging, install Quicksilver. Then put the modified tag.scpt into ~/Library/Application Support/Quicksilver/Actions/ (where ~ is your user folder, you may have to create the Actions folder). Restart Quicksilver.

Then when you are listening to a song you want to tag just: 1) activate Quicksilver (Command-Shift-Space in my clase), 2) press “.”, 3) type the tags you want to save for the song, 4) press “tab” to go to the “Commands”, 5) press “t” and it will show the tag script as an option, 6) press return. Trust me, this is a piece of cake after the first time as it is just a few keystrokes and you never really leave the application in which your working (Quicksilver “floats above” what you are doing and disappears when you are done issuing the command).

It is also much faster than going into iTunes finding the song that is being played, opening its get info window, going to the info pane, and typing the tags in the “Grouping” field and exiting the dialog box and itunes to go back to whatever you are doing.

What can I do with this? Well, once you have lots of tagged music, you can create “Smart Playlists” in iTunes which includes only songs that have certain tags (add the condition that “Grouping” “contains” [whatever tag you want it to have]).

Linklog Added

I have added a “linklog” to this webpage. Except for those who are reading this blog through their RSS readers, you will notice a list of “Recent Links” with comments on them located at the right, above the blogroll. This is a place I can slap up recent blog articles or web pages I have visited and found interesting. You can view all the link archives here and subscribe to a feed of these links here.

The wonderful WordPress hack/plugin I used for this can be found here at Rebelpixel. Installation was a bit complicated though so I don’t recommend it for complete beginners to the programming world.

WordPress 1.5

I just upgraded to 1.5 of WordPress, which is the blogging software I use to run this site. Not sure when I will get the “theme” more personalized. As those of you visiting the site may notice, I’m currently using the default “theme” that came with the upgrade. I’m hoping this new version will handle comment/trackback spam better and already I like some of its small changes.

Comment Spam

After installing multiple anti-spam methods (I may try to add a “are you human?” feature again) I got bombarded by a massive onslaught of commant spam. However, I can’t even call it spam, it was just a malicious attack since all the URLs and emails were just random characters stringed together, making it impossible to show anything they had in common (IPs were all different too)…

I’m turning off comments until I get an even strong anti-spam mechanism in place…this is so sad…

UPDATE: I was hit again today. Looks like I don’t even know how to turn all comments off so I have turned on moderation for all comments, so your submitted comment will have to be approved. No need to resubmit, I’ll approve it when I get it…sorry for the inconvenience.

Switched to WordPress

Some of you may already know that on November 1st, many the web sites belonging to my family and friends disappeared and over the next few weeks have only slowly begun to reappear. My own Muninn site was one of them, and there were various files missing from my backup (fortunately, all blog entries and the database was intact). Until today, I only partially restored the Muninn blog and decided that when I had the time I would go through with a switch to WordPress, something I have been wanting to do every since Movable Type abandoned the free software movement.

The short version of the story behind this saga of website downtime is that the horrible host we were using lost all their files, including backups (if they ever had them). You can read more about my horrible experiences with Blutekhosting if you like, but suffice to say that I have switched hosts for all the projects and continue to try to get the various projects I hosted up and running while not letting my studies suffer as a result.

I’m still in the process, however, so expect fewer postings, and a few glitches here and there at Muninn while I put a few hours aside every few days to restore a feature or fix a few bugs. In the meantime I’m also borrowing a site design (made by Alex King) that I’m also using at Frog In a Well until I can get some time to work on the design for the site.

UPDATE: I’m slowly working on the design. I have switched to another design, this time by Michael Heilemann and modifying it. I’m going to change the colors to a dark green eventually, but one thing at a time…

Frog in a Well – Japan History Group Weblog

Today I want to officially “launch” a new Japan History Group Weblog at Froginawell.net. The title is 井の中の蛙, the Japanese version of an old Chinese proverb. You can read a detailed introduction to this new project at the site, including an explanation for the site’s title, but essentially the site is a multi-lingual (Japanese and English) weblog with a focus on the history of or related to Japan. Its target audience is primarily those studying Japanese history, either as undergraduate or graduate students, or scholars in the field. Some of the postings include Japanese or are written entirely in Japanese, and some background in Japanese history is assumed, but I think there is something to offer anyone with a love for history or Japan.

So far this group blog is made up of a small group consisting of two professors of Japanese history and a collection of graduate students. I hope over time to slowly increase the number of participants, until we have a fairly consistent flow of postings on a variety of topics. I especially hope to increase participation from Japanese students and scholars, or at least those studying the field outside of the United States. A primary goal I have for this project, also mentioned in the site’s initial posting, is to increase interaction and discussion between students and scholars in places like Japan and the United States. While we have only one participant studying in Japan to start, I’m going to be aggressively looking for more members for our team amongst my contacts in the Japanese academic world.

I think I will be keeping a heavy academic focus for this site that may unfortunately limit our readership. My reason for this is that I want to appeal to an audience of students and scholars who have little patience or appreciation for the world of blogs. There are no other group blogs related to the history of Japan, that I know of, and I hope this will help some people working in this field gain an appreciation for this medium of communication and writing.

The Japan history group blog is only the first of the “Frog In A Well” projects. I’m in the process of building a team of scholars and students for a China history blog (井底之蛙), a Korea history blog (우물 안 개구리), and one closest to my own heart: a fourth blog dedicated to transnational historical study of East Asia and/or its place in a broader global context. This last blog will also include duplicate postings from the other three which didn’t fit neatly within national boundaries.

Korean on a Macintosh

I made a little How-to website for people wanting to input Korean on a Macintosh (OS X). I was motivated to create this after our Korean teacher gave us a handout on how to add support for Korean input on Windows XP and I noticed a few mac users in my class feeling left out.

Korean on a Macintosh – Adding Korean input support, tips on input, and how to add hanja.