I, Mac?

I am so clever. emoticon

Now, let’s get something straight. I am the last person in the world that would have ever considered buying an I-Book. I hate MAC’s. There silly little buttons confuse me, and I remember getting my disks stuck in the drive. Don’t let me get started on the 1-button mouse. Here’s the story though… My Sharp Mebius (a fantastic slim labtop) broke. It was hurtin’. Now, since I have a desktop (and 2 if you count my Linux/MythTV server!! It’s cool!) I only used my labtop for school work. All I needed was simple:

  1. Internet
  2. Word
  3. Portability

 I was faced with two choices. Pay 150,000 yen for a new Sharp, or pay 100,000 yen for a new I-book. After looking at the costs, and a good talking too from Greg, I decided to go ahead with the Mac. I figure I needed something portable, something that can do simple things, and I had never before used a MAC and wanted to learn. To be honest it is a little heavy (I figured a little weight was worth the $600 in savings) but other than that…

Best Purchase Ever 

Seriously… no joke. The things is amazing. It looks good, is fast, is intuitive and does everything I want it to. The presentation is amazing, sounds is fantastic, even the packaging was cool. Crap… I used to hate listening to MAC people whine… fact is it was (for the most part) deserved.

It’s not going to replace my desktop anytime soon, but considering that it met my criteria for a substantial amount less than other computers would, it was well worth it.

Here is a picture of my new baby, and the cool Japanese Apple Hanko (<- read what a Hanko is about there.)

 

 imac.jpg

 

 

Also, look at this swell picture that my good friend Toru drew up. Anyone remember Popeye? Thanks Tommy!!! emoticon

 

popeye-toru.jpg 

MythTV .nuv -> mpg and DVD

I started this way, but it takes forever time wise on my Mac Mini and
my quality was pretty bad with all the reencoding that went on. Also,
iDVD is not good for controlling the bit rate on the final DVD. iDVD
would record my content at full DVD quality which would just fit a one
hour show on my single layer DVD-R (lame!).


  I am now doing the following with Linux which takes far less CPU time,
but does take a fair amount of I/O time. Which of course assumes you
have a Linux box.

  1. Demux/Cut MPEG2 content from MythTV with Java based ProjectX. You
can download ProjectX from http://www.doom9.org/DigiTV/projectx.htm .
This application not only has the ability to cut the MPEG (only on
keyframes) without reencoding, but it appears to have fixed all of the
audio sync problems for me. I have yet to tackle real long stuff but my
kids two hour shows are fine.

  2. Re-multiplex audio/video streams with mplex

  3. Create DVD structures with dvdauthor

  4. Create DVD ISO with mkisofs (not sure why others are using
growisofs, mkisofs works fine for me).

  5. Copy DVD ISO to my Mac for burning (My Mac has the only DVD burner
in the house.)

  I started using avidemux2 for step 1. but I had audio sync issues that
I could not correct with a static audio skew. ProjectX seems to do some
kind of correction, and in fact it says it is fixing frame ordering
when I use it in the logs. Total time from transfer of the MPEG2 to my
Linux box to a burned DVD is about 45 minutes. I even have a little
content on one single layer DVD-R which plays on every settop DVD
player I have tried so far (including some xboxes) with zero audio sync
issues. This means three one hour episodes minus commercials on each
DVD-R! Excellent! I started with the following HOW-TO and adapted as I
stated above:

http://www.mythtv.info/moin.cgi/ArchiveRecordingsToDvdHowTo . If you
want all the gory tech details, then I will put together an HTML based
HOW-TO and post it someplace.

Regards,
   John P. Mitchell <john@cepros.com>

7/29 – My Bad Day

7/29 – My Bad Day

 I wish I could provide photographic evidence (maybe I will), but after a few days of not visiting the vegetable field, I went to find all 8 of my remaining watermelons have been destroyed / eaten. I don’t just mean like a little messed up, I mean like inside out, completely gone. All 8 of them. Small ones and big ones alike. Kiko thought it was birds, but I am convinced it was dogs. emoticon

 

That wasn’t the worst of it. I have been doing translating on the side and I haven’t been getting much work in the last few weeks after a supervisor change. Anyways, he decides to give me another job without actually getting my confirmation that I will do it. (long story…) well a long story that ends up with him calling me and berating me for not doing it. I point out that I never said I would, and then he accuses me of ignoring the confirmation e-mail he sent … which I didn’t receive.

Alas, I am on my way to Tokyo for the JET Tokyo Orientation. I will be leaving pregnant Kiko alone, I have to do that translation (or I’m in "more" trouble) and I don’t have any watermelons to look forward to.

Woe is me. (is the spelling right?) emoticon 

Recently…

Other than yesterday’s exciting Jet Journal news, here are a few pictures of what we have been up to the past few days.

It has been very hot, and very busy, but our very good friends from California were in Japan, and we got together in Okayama to see them for a few days. Their kids are crazy cute.

One of Kiko’s best friends, Sanae, has some very good news and is up from Tokyo to visit her boyfriends family in Takamatsu. We were really happy to be able to see them (and Kouichi for the first time!)

Finally, a very nice family, the Yamauchis, had Kiko, myself and Greg over for a great BBQ and a magic show. Don’t get me started with the magic show, the kid is amazing. I have some on video and hopefully I will start getting video up on this site.

Anyways, e-mail me and post in the ugly shoutbox already. Don’t say I don’t love you. 

Also, look at the pictures already.

Friends in Japan Picture   Friends in Japan Picture   Friends in Japan Picture   Friends in Japan Picture

Oh yeah… also had a Jamaican cooking class with semi-real Jamaican food and a real Jamaican. It was actually really good. Curry chicken, rice and peas and pepper jelly. nice. I know you’re jealous.

Jamaican cooking picture

 

Jet Journal 2005

Now… if you have been following this site, you may have seen me refer to myself as a Camera Genius, or a Picture Taking Machine (or something like that)…

 Well, it’s true. I submitted some pictures to this year’s Jet Journal (a magazine that goes out to all 6000 JET’s, and three of my pictures have been selected for publication. Take a look at the cover, and click on it to take a look at the pictures themselves. I’m super. emoticon

Jet Journal Cover 

Writing WordPress Plugins and Hooks

Original can be found here

Hooks: why?
————-

When you write a plugin you want to be able to switch it on and off whenever you want. This is not that trivial: say you write a function that does something useful, simply calling the function from your code gives an error when your plugin is deactivated. If you are lucky, it displays nothing, if you are less fortunate it displays all kinds of ugly debug information that people can abuse.

That is why ‘hooks’ were invented. Simply put, a hook is a point somewhere in the generation of your page where you can attach functions. When the hook is reached, all functions attached to it are executed in order of priority. When there are no functions attached to it, it does nothing.

So a plugin should do two tasks:

  • define a useful function
  • attach that function to the right ‘hook’

Many hooks exist already, and most people stick to those hooks. However, hooks are not black magic. Nothing stops you from defining your own hooks, and that is exactly what I’ll do in this page: I’ll create a trivial plugin, put it on my own hook at a place in the page where I like it.

Adding a hook
————–

The first thing I’ll do is the thing many people fear: I’ll create a hook. Using the default theme as an example, the page has a div called "content" which contains the posts in one page. I might want something to happen on the top of the "posts" section, maybe a status message, or a ‘recent comments’ section. That would be the right place to add my own hook.


Now before do that, there is some danger here: many hooks exist already, and before everyone starts defining their own hooks with the same names, let’s set a rule here: if you define your own hook, it should start with your own initials, to let the world know that it works for your plugins and to avoid name collisions. If it is a useful hook, it might become a standard hook for everyone one day.

Ok. Now let’s dive into the "default" theme directory (of course, we work on a backup) and start hacking on "index.php". The spot I had in mind was on line 4, right below the "content" div. I create a hook here called ‘lv_content_head’, because ‘lv’ are my initials, and it is the head of the content. I don’t use any parameters for now.

Below line 3 of "index.php", right below the "content" div, add the following line:

< ?php do_action("lv_content_head"); ?>

That’s all. If you load the page, you’ll see that nothing special happened. That is as it should, because there are no functions attached to it yet.

Now let’s write a "Hello World…" function.

A "Hello World" function
————————-

Now let’s create a real plugin; the file is called "helloworld.php", which will go in the "plugins" directory. The function is plain php; the "Plugin Name" entry in the commented section is is mandatory.

< ?php
/*
Plugin Name: Hello World
*/
function helloworld() {
echo "Hello World…";
}

Now if you would add the closing php-tag, you could see it already in the plugins part of the site administration. Right now, it is not a plugin yet, because it merely defines a function. The next step is to put the function on the hook. Keep the editor open!

Attaching a function to a hook
——————————

Just now we did two things:

  1. we created a hook somewhere in the generation of the page, and
  2. we created a function that is to be called when the hook is reached.

The next step is to attach the function to the hook. This is done by calling the function add_action, where its first parameter is the name of the hook (‘lv_content_head’ in our case), and its second parameter is the name of the function (‘helloworld’ in our case).

Our editor is still waiting for us, so add the function to the hook, and close the php part:

add_action("lv_content_head", "helloworld");
?>

Now the entire plugin looks like this:

< ?php
/*
Plugin Name: Hello World
*/
function helloworld() {
echo "Hello World…";
}

add_action("lv_content_head", "helloworld");

?>

Call it helloworld.php and put it in the wp-content/plugins directory.

From the admin panel it can now be activated, and it should display "Hello World…" on the top of the content area.

A few more pictures from Canada

I finally managed to pry a few more pictures off of my cellphone. This is Kiko, Chris, Franz & I celebrating Chris B’s birthday at a very good restaurant: Banzai sushi. I still owe him a present though… (not that seeing me wasn’t present enough mind you…) ps. Franz was kind of enough to treat Kiko and I to dinner. Thank you!! (my brain was not working, and I apologize, but upon reflection I could have used that as an opportunity to give Chris a birthday present and pay for his dinner. d’oh. chris, forgive me!)

 

chrisfranzdavidcanada2005.jpg   davekikojuly2005.jpg