Cognitive Mileage

Archive for the ‘Technology’ Category

Being an avid Keynote user with a desire to mesh my carefully constructed Keynote presentations (with audio narration) on YouTube, I have spent a lot of time trying to figure out the conundrum of incorporating Keynote presentations into iMovie projects.

I’ve done many Internet searches on the subject over the past couple of years and most answers are patchwork, incomplete, or just plain wrong.

Let’s hope my blog post floats to the top of the (once) painful Google query “import keynote presentations into imovie”. The biggest and most untreated problem is that, though Keynote can generate quicktime files, these files cannot be automatically imported into iMovie. It takes some converting both in Keynote and in the Finder first.

Here is the straightforward procedure for anyone looking:

First, in Keynote:
0. I am assuming you already have a finished presentation that you would like to narrate. Open it.

1. Go to File > Record Slideshow
2. Navigate through your slideshow at any speed you want saying anything you would like as narration. Keynote will record everything.

3. Once you are finished, go to File > Export…; This part is a bit tricky.
3 (a). Click the submenu under Formats and go to Custom…
3 (b). In the Video subsection, click Settings…
3 (c). Change the compression type to MPEG-4 Video.
3 (d). Click Okays and Nexts until you get to the dialogue to save your file; save it somewhere
3 (e). Wait for it to compress…
3 (f). Go to the place where you saved the file and rename it to have “.avi” as its extension. If the OS bugs you, tell it to, yes, use the .avi extension.

Now, in iMovie:
4. Go to File > Import Movies…
5. Viola. Your presentation, complete with narration, should import and you can edit the video however you want.


This algorithm returns a list that is a power set of the inputted list. The code for int2bin is from DaniWeb‘s Python community.

So the module would give the following output:

>>> PowerSet([1,2,3])
[[3], [2], [2, 3], [1], [1, 3], [1, 2], [1, 2, 3]]

This was recently a problem for me when I wanted to use Python 2.5’s string Templates and random number generation with Iron Python Studio but couldn’t. Here’s how you enable the libraries in Iron Python Studio (IPS):

1. Install the version of Python (CPython) you want to use.
2. Direct IPS to the Python directory you are using by inserting the following lines into the beginning of the .py file you wish to use the modules in:

import sys

For your own work, just change “”C:\\Python25\\Lib” to point to the Lib folder of whatever version of Python (in whatever location) you want to use.

So my girlfriend’s daughter accidently spills water all over my Macbook screen leaving huge bright white splotches in the lower right and left corners of my screen. I freak out and take my MB to an Apple technician and he tells me it will be $750 to replace the screen but that I can probably just evaporate the water myself by running an intensive process that heats up my MB. Obviously, I opt for the latter.

The following Python program did the job.

i = 0
while True:
    i = i + 1

It got my CPU A up to a consistent ~80c with the fans obviously kicking on high. I put some pillows behind the screen to increase the heat.

I’ve been running it for about 3 hours now and the splotches are almost cleared up. It will probably take 4-5 hours total to complete the evaporation. But it beats paying $750 for a replacement..

There seems to be no permanent damage to the screen.

Well, it has been about 15 hours total now of drying, some with the program on, most with it off and the splotches are almost all gone. All that is left is a little pea-sized dot for the right splotch. I’ve no reason to think it won’t disappear by the end of the day.

24 hours later: screen is as good as new. You wouldn’t be able to tell the difference if you tried.

Dvorak Right-Handed Layout

I give plasma every Tuesday and Thursday and when doing so, I can only use my right hand to type because I am pumping with my left since it has better veins. I wanted to use the Dvorak Right-Handed Layout but it doesn’t come with Mac OS X. So I had to create it myself using Ukelele.

Here it is: Dvorak Right-Handed Layout (the file is named “Dvorak-Righty.keylayout”)

You need to place it in ‘/Library/Keyboard Layouts/’ then check it in the International preferences to use it. I typically ‘Show Keyboard Viewer’ from the International menu when using it so I know which keys are which.

One of the number one problems for someone trying to implement syntax highlighting on a .NET platform is that when updating the RichTextBox to have the updated highlights, there is flickering. You have to highlight and change every keyword every time the user enters a new character (the TextChanged event).

There are two common methods. The first is to simply repaste all of the code into the RichTextBox and change the text formatting as you paste. The second is to highlight all the pieces of code and color or uncolor them as needed. Both cause undesirable flicker.

Stopping the RichTextBox Window Update without Win32
The flicker comes because the RichTextBox is updating every time you highlight a new word. The only solutions I’ve seen people offer to stop this is to DllImport Win32 libraries and do a LockWindowUpdate on the RichTextBox or send it a WM_SETREDRAW message.

Most people, upon discovering it and being given no alternative, find that solution disappointing. There should be a purely .NET solution, they say.

I’ve found one. I had to: I’m using IronPython Studio and, AFIAK, it can’t do DllImport.

The Solution
This is written in Python but can easily be translated to C# or VB.

def _rTextBox_TextChanged(self, sender, e):
    # Create new (invisible) RichTextBox for processing
    rt = RichTextBox()
    # Make sure the font is the same
    rt.Font = self._rTextBox.Font
    # But only paste unformatted Text
    # to erase formatting on non-keywords
    rt.Text = self._rTextBox.Text
    # Save cursor position
    user_pos = self._rTextBox.SelectionStart

    # Do text highlighting on invisible RichTextBox

    # Now paste formatted text back into original (visible) RichTextBox
    self._rTextBox.Rtf = rt.Rtf
    # Reset cursor position
    self._rTextBox.SelectionStart = user_pos

The basic idea is that you create your own (invisible) RichTextBox within the code, copy the Text (unformatted text) from the visible RichTextBox into it, highlight the keywords, then paste the Rtf (formatted text) back into the visible RichTextBox. That way there is no flickering while you are doing the highlighting.

There is still some minor flickering when the text gets large enough to consume more than a page. Also, the scroll bar position is reset when you edit text above the bottom line of the text.