Rocking the blogosphere

Archive for the 'Computers' Category

Python ternary operator

Today’s Python discovery:

Python doesn’t have the C style ?: ternary operator (e.g.: cond ? valueIfTrue : valueIfFalse).

But as of Python 2.5 it has a ternary operator with its own syntax: value_when_true if condition else value_when_false

For example:

>>> 'a' if 1 == 1 else 'b'
'a'
>>> 'a' if 1 == 0 else 'b'
'b'

This is actually clearer and more Pythonic than that ?:

Unfortunately, for Python versions < 2.5, you don’t have this. I’ve seen people use: (condition and [value_when_true] or [value_when_false])[0]

IMHO, this is clever - in a bad way. Yuck. Personally, I think I’d rather just do:


def if_cond_val1_else_val2(cond, val1, val2):
   if cond: return val1
   else: return val2

This adds 3 lines to your program (or 1 if you stick it in a module that you import from your programs) and won’t cause your colleagues to hate you.

Popularity: 23% [?]

New MacBook Pro Firmware

MacBook Pro EFI Firmware Update 1.5.1 just popped up in Software Update:

MacBook Pro EFI Firmware Update 1.5.1

After installing and rebooting:

MacBook Pro EFI Firmware Update 1.5.1

Popularity: 21% [?]

WordPress 2.5

This blog is now running WordPress 2.5. Haven’t played with it too much. First impression, the new look of the admin screen is pretty ugly to me.

Popularity: 30% [?]

Frequent Quicksilver crashes?

Lately, Quicksilver has been quietly dying very often and I’m constantly restarting it. I suppose I should try reinstalling and/or deleting my preferences, but before I do that, I was wondering if anyone else was seeing this.

Interestingly, I’ve also noticed that the “check for updates” functionality always fails to connect to the server. I’ve wondered if this and the crash are related (e.g.: Quicksilver dying when it attempts to do an automatic check), but that’s just pure speculation.

Here’s a snippet from the last crash log that got dumpd in ~/Library/Logs/CrashReporter

Process:         Quicksilver [1566]
Path:            /Applications/Quicksilver.app/Contents/MacOS/Quicksilver
Identifier:      com.blacktree.Quicksilver
Version:         β53 (3814)
Code Type:       X86 (Native)
Parent Process:  launchd [87]

Date/Time:       2008-04-01 11:27:29.302 -0700
OS Version:      Mac OS X 10.5.2 (9C7010)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0×0000000000000000
Crashed Thread:  4

Popularity: 28% [?]

Thoughts on the Apogee Duet

Apogee Duet FireWire Interface

My Apogee Duet Firewire audio interface arrived.

Thoughts:

  • It looks great. It’s bigger than I thought it would be, but still a nice size. With it’s simple controls and silver, rounded body, it looks right at home with my MacBook Pro.
  • Ease of set up. No problems. Downloaded the latest software package from Apogee’s site, installed it, rebooted, and then plugged in the Duet. A dialog came right up asking whether to use it as the default audio device and Logic Express found it with no problems either.
  • Ease of use. I worried about it only having one knob, but it seems like that’s all I need. Pressing the knob toggle between the two inputs and the outputs which is quick and easy. Having meters and clip indicators on the unit is really nice when adjusting levels. Another nice feature is that adjustments on the unit are mirrored in a transparent popup on the Mac display, which is a nice touch.
  • Sound. Very pleased. Being the pessimist that I am and not being a person with “golden ears”, I wasn’t expecting to hear anything really noticeable, but I was pleasantly surprised. The most noticeable thing was the lack of apparent noise when there’s no signal and listening with headphones. It’s so dead quiet that I wondered several times if it was still in the signal path. And music played through it sounds great too.
  • Crashes. Unfortunately, OS X did crash once when I plugged it in, but in fairness, this is almost certainly Apple’s fault, since it also happened with a PreSonus Firebox (see this post) (and I’ve seen reports of it happening with the Inspire 1394 as well). C’mon Apple - fix this. This is OS X; not Windows. This reminds me of Windows 98 crashing on Bill Gates when he plugged in a scanner at Comdex 1998.

Popularity: 66% [?]

Logic bug: Creating Apple Loops from a region

While following the exercise “Creating Blue Apple Loops” on page 262 of “Logic Pro 8 and Logic Express 8″ by David Nahmani, I was running into some trouble.

1. Open Logic project file: “07 New Day”.
2. Drag the Marquee tool (Command-click tool) over the High Arpeggio region from bar 5 to bar 7. Verify that before releasing the mouse button, the help tag reads “5 1 1 1 7 1 1 1″, indicating that Marquee selection goes from bar 5 to bar 7 and is thus 2 bars in length.
3. Click the Marquee selection with the Pointer tool to create a new region that should be exactly 2 bars in length.
4. In the Arrange area’s local menu bar, choose Region > Add to Apple Loops Library.

Expected Results:
The dialog should offer the choice of “Loop” or “One-shot”.

Actual Results:
The choice of “Loop” or “One-shot” is grayed out.

According to the book and http://docs.info.apple.com/article.html?artnum=301036, this graying out is a symptom of having a region that is not a whole number of bars in length, but this region seems to be exactly 2 bars in length as far as I can tell.

I posted about this on the Logic Pro Help forums (run by Mr. Nahmani; not Apple) and Mr. Nahmani kindly pointed me to an earlier thread that explains the problem and how to work around it. Basically, the bug is that the help tag is indicating that the region is 2 bars in length, when in fact, it’s actually a bit shorter. The remedy is to tweak the region a bit to make it shorter and then to make it exactly 2 bars in length.

I hope this helps other folks who run into this problem. And I hope Apple fixes this bug.

Popularity: 74% [?]

Finished “Logic Pro 8 and Logic Express 8″ book

I had been working through the exercises in “Logic Pro 8 and Logic Express 8″ by David Nahmani lately, mostly while on the shuttle bus to and from work (and yesterday on the VTA light rail on the way to SD West). I completed the last lesson last night, which involved adding music and sound effects to a video.

The book is excellent and I learned a lot about using Logic from it. Now that I’m done with this book, I’m going to buy “Logic Pro 8: Beyond the Basics” by David Dvorin and work through that.

While on the topic of Logic, I should mention that the author of the book, David Nahmani, has some nice Logic forums at http://www.logicprohelp.com/

Popularity: 81% [?]

Next Page »