I recently began learning Danish. I'm taking a weekly class, and the
first week's homework involved listening to the conversations we covered
during the lesson. I began by playing the audio files, following along in
the Danish transcripts. I found myself wanting to listen to the difficult
parts over and over, but scrubbing through a timeline is rather awkward.
It occurred to me that I could use iTunes to solve this problem. Normally,
iTunes will play a track from beginning to end. It's possible, though, to
specify a certain portion of the track to be played instead. By adding an
audio file to a playlist many times and specifying consecutive portions
(e.g. 0:00–0:02, 0:02–0:04.8, …), a track can be broken into manageable
clips for more convenient navigation.
Workmates will be quick to confirm that I'm not exactly leet on the
command line. Efforts to advance beyond cd and ls have been hampered by
the fact that many posts and discussion threads assume a level of competency
which as yet I lack.
When I sit down to write a post, oftentimes I write the post I wish I'd
read an hour earlier. As I unravel the mysteries of ack and bash and Emacs
and the like, I'll publish tips and explanations so that others can benefit
from my discoveries (or, as will likely be the case, so that you people can
further enlighten me).
I followed John Gruber's suggestion and removed Flash Player from my Mac.
Like John, I've come to rely upon Google Chrome for viewing the occasional
Flash movie. As a result I've become proficient at the keyboard dance required
to open in Chrome the page I'm currently viewing in Safari:
⌘L (File > Open Location…)
⌘C (Edit > Copy)
⌘Space (invoke Quicksilver/Spotlight)
C-H-R-↩ (open Google Chrome)
⌘L (File > Open Location…)
⌘V (Edit > Paste)
↩ (go, go, go!)
Well, I've performed this dance for the last time. I now do this instead:
⌥⌘G
Credit for this simple but brilliant idea goes to Rob McBroom. Rob's post on
opening pages in Google Chrome lists the (very easy) steps required to
enable this shortcut.
Update —
Chris points out that John himself mentioned this trick in his aforelinked
post.
Next time you do hg commit TextMate will open a temporary file you write
your commit message into. Type your message, save the file and then close
the window to finish the commit. The -w flag on the mate command tells
TextMate not to return control to the command line until the editor window
has been closed.
Update —
To use TextMate as your git editor, run the following command:
git config --global core.editor "mate -w"
This adds editor = mate -w to the [core] section of your ~/.gitconfig
file.
Customizing the appearance of files and folders in OS X is a cinch. ⌘C, ⌘I,
⌘V, punctuated by a few mouse clicks.
Actually, that's total bullshit.
Sure, in the simplest of cases the copy and paste approach gets the job done,
assuming one knows to copy from Preview.app if copying from the original
source fails. As soon as one decides to do something a bit more advanced, such
as providing versions for display at different sizes, one's shit outta luck.
When was the last time you checked out your Utilities folder? Well, if your
answer was “What’s that?” then let me explain. Inside of your Applications
folder is another folder called Utilities that is filled with all sorts of
wondrous things that most people either don’t know or completely forget are
there. Even veteran Mac users are guilty of this. I know I am.
DigitalColor Meter is one example of this. The other day, I wanted to
find out the web safe color of a particular item on the screen of my Mac
for a web design project I was working on. My first step was to go searching
the Internet for such a tool (preferably free). Then, in the midst of said
search, I was reminded that this little tool was not only already on my Mac,
did exactly what I wanted, but also did it better than any of the tools I was
able to find.
The point is that, even the tools we think we know can always reveal
a little something we don’t. The Mac is an incredibly deep and rich OS
and there are few that know it all. I’m going to spend some time every day
for the next little while spending some time getting to know some more of
these built in tools I largely have ignored and see if I have any practical
applications for using them. You will likely see more posts like this in
the coming days.
To take your Digital Color Metering to the next level, you can drag the color
off of the well on the right (next to the R G B labels) into any standard
color picker to bring it over. Sometimes, you can even drop it straight into
an object in another app!
Give it a try: sample a color, press cmd-shift-h to hold it, then drag and
drop from the swatch an object in Pages or Keynote.
I'm going to find this incredibly useful. No more grabbing a portion of the
screen, switching to Photoshop, creating a new document, hitting ⌘V, switching
to the eyedropper tool, double-clicking the foreground colour swatch to invoke
the Color Picker, and then clicking on the appropriate pixel to find its
colour value.
I don't think I'll miss this process, somehow, although my flatmate'll miss the
camera shutter sound that accompanies screen captures on OS X (he really likes
it, for some reason).
class SubdomainMiddleware:
def process_request(self, request):
'''Parse out the subdomain from the request'''
request.subdomain = None
host = request.META.get('HTTP_HOST', '')
host_s = host.replace('www.', '').split('.')
if len(host_s) > 2:
request.subdomain = ''.join(host_s[:-2])
Initially I replaced test.com with the site's domain name, but I decided
that it's useful to be able to access both the live site and the test site
without editing the /etc/hosts file.
At this point I expected everything to work as advertised. Instead, I got
this:
That would depend on one's definition of "works". I wanted my Django site
to appear, which required a very simple tweak…
It's not uncommon to start watching a video online and discover that its
audio is quite quiet. This is not a problem in and of itself, as one can
simply crank up the output volume. What is a problem, however, is a
message then arriving in one's inbox and waking the neighbours!
This situation could be avoided if it were possible adjust the browser's
output volume without affecting the rest of the system. As it is, though,
one is forced to increase the volume of everything. Not ideal.
System Preferences > Sound > Application Volumes
Wouldn't this be nice? Many months ago I did some Googling to find out
whether it's possible to control volume on an application-by-application
basis in OS X. The closest thing to a solution was an X11 (read: ugly) app
that kinda worked.
Apple, I don't bug you often, but here I will. Please build this
into the OS and keep the neighbours happy. It'd be particularly sexy
if applications such as iTunes which do currently grant the user control
of the application's volume synchronized their volume settings with the ones
in System Preferences. That is, adjusting the volume in iTunes would adjust
the iTunes volume setting in System Preferences, and vice versa.
The following conversation took place a couple of days ago in my apartment.
Matt's my flatmate, Doug's one of Matt's friends. I was in the room at the
time.
Matt: So, Doug, do you think you could go the way of Mac?
Doug: I already have, really, but I'd never buy one.
Matt: Why's that?
Doug: Well — no offense, David — if I were to buy one I'd be getting
something a retard could use, and I'm not a retard.
I found this exchange both entertaining and enlightening. Never had I
considered the possibility that certain individuals use Windows because
it's poorly designed and difficult to use!
There's certainly some sound reasoning behind Doug's stance: Doug
is proficient in Windows; gaining proficiency in Windows requires
a certain level of intelligence; Doug's proficiency in Windows is
therefore indicative of his intelligence.
Why, then, does Doug say that he's switched camps? He's using one
of these at school:
Modern browsers can display exciting visual effects such as drop shadows
(without the use of background images). CSS3 makes it possible to turn
submit inputs and even links into rich, Aqua-like buttons in these browsers
(alternative style rules can be provided for older browsers).
Certain things are extremely well documented on the Web; certain other things,
however, seem to appear only deep in the comments of obscure blog entries.
The problem I encountered a few minutes ago fell squarely in the latter
category. I simply wanted to know how to access the MySQL shell from the OS X
Terminal. I expected my Google search for MySQL console Terminal "OS X" to
return several useful results, but this was not the case.
I managed to find the solution in a thread with subject
error 1044 and 1045:
The days of the compact disc are surely numbered. The MacBook Air is
the first computer from Apple to jettison the optical drive; others will
undoubtedly follow, eventually.
Since the vast majority of Mac OS X users currently possess the means to
read and burn CDs, however, I thought this information — lifted straight
from Disk Utility Help — worth sharing. These instructions apply to Snow
Leopard, although I would guess that the process is identical for older
versions of OS X (the more recent ones, at any rate).
Recording on a recordable CD more than once
Normally, you can burn items to a recordable CD, such as a CD-R or CD-RW disc,
only one time. However, if you use Disk Utility to burn the disc, you can burn
items to a disk in more than one session as long as space is available. This is
also called "multisession burning."
To burn a disc, you need an optical drive in your computer or connected
directly to your computer. You can’t burn a disc using a remote optical drive.
To burn to a recordable CD so you can burn to it again:
In Disk Utility, create a disk image that contains the files you want to
burn to the disc.
The files must be from a partition with a Mac OS Extended disk format.
To check a partition’s format, select the disk in Disk Utility, and look
at the information at the bottom of the Disk Utility window.
Select the disk image in the list at the left, and then choose Images >
Burn.
Select the "Leave disc appendable" checkbox. If you don’t see this option,
click the triangle in the upper-right corner.
Insert a blank recordable CD in the optical drive and click Burn.
To add more files to the disc later, follow the steps above. You can continue
this process until all available space on the disc is used.
This is a JavaScript function for Photoshop which saves the active document
as a 24-bit PNG file. It is equivalent to manually selecting File > Save for
Web & Devices… which means that the file size of the resulting PNG will be
smaller than would be the case using PNGSaveOptions().
Photoshop on Mac limits the length of a File object's file name to
31 characters. Credit for the rename workaround should go to Mark Walsh
who posted the solution on the Adobe forums in a thread titled
Save for web filename problems.
I've been using Alex Gorbatchev's SyntaxHighlighter to syntactically
display code of various languages for several months now. When I decided
to post an AppleScript snippet, however, I realised that I was out of luck.
SyntaxHighlighter does not include an AppleScript "brush", and a quick flick
through the SyntaxHighlighter forums did not bring me any joy.
How hard could it be to write a brush for AppleScript?, I wondered. The
handy guide to developing a custom brush got me started, and I was soon
busy trying to encapsulate AppleScript's syntax — along with its keywords and
countless words and phrases with special meanings — into a handful of regular
expressions.
I love Coda. It's just so… sexy, somehow. I've just discovered
Django, with which I'm fast falling in love as well. Naturally, when I
came to write my first Django template I opened Coda.app and started coding.
I've been using OS X almost exclusively for the last three or four years, but
it was only recently that I discovered the system-wide method for changing
keyboard shortcuts. I think the reason that this feature eluded me for so long
is that so many of the hours I've spent on OS X have involved the use of the
Adobe applications Photoshop, Illustrator, and InDesign, which provide their
own means of changing keyboard shortcuts. I assumed that since application
developers sometimes provide their own interfaces for changing keyboard
shortcuts, the operating system must lack this functionality. I was wrong.
If you have ever found yourself command-clicking the title of a Finder
window to find out where you are (/Library/Fonts or ~/Library/Fonts
is one I've double-checked many times), you'll understand how pleased I was
to discover that there is a command which can be entered in Terminal to
show full directory paths in Finder window title bars.