April 14, 2008

Textmate and high level ASCII characters

Filed under: Uncategorized — Ryan Wilcox @ 7:32 pm

Here’s a fun gotcha when creating commands for TextMate: if your command’s output is set to Create New Document on output, then that output must be either free of high level (extended) ASCII characters, or UTF-8.

If your output doesn’t conform to this rule, the new document populated by TextMate will be blank. Nada, nothing, just blank.

Try this test:

  1. Create a file in TextMate with an extended character in it (umlauts are good, or say option-y). And something afterwards, to prove my point that nothing else comes through.
  2. Save, and set the file encoding to UTF8
  3. Create a new command: set its Input to None, Output to Create New Document, and Command(s) to cat path/to/your/saved/file
  4. Run command
  5. Notice your output: just like you expected
  6. Now Save your document as another encoding. Say MacRoman. (Make sure to replace your old file: we want the command to open this file now!)
  7. Run the command
  8. Notice there’s no output

This might not seem like a big deal, but remember that any Unix command you run could return high ASCII text. Grepping through a source tree of MacRoman files, let’s say.

In cases where those extended characters can be discarded, there’s a great tool from University of California at San Diego: a Perl script called fix. Fix replaces extended ASCII characters (and other craziness) to spaces. (I like to put scripts like this in a bin folder in my home directory.)

So, if extended ASCII characters don’t matter to you, use fix like this:
cat path/to/your/saved/file | perl ~/bin/fix.pl -

If you really do care about those characters, and you can assume the source encoding, you can use iconv.
cat path/to/your/saved/file | iconv -f 'macroman' -t 'utf-8'

After all that, it should be noted that the Output: Show as HTML setting can accept extended ASCII characters. But if your output isn’t HTML…

February 24, 2008

appscript’s get syntax (advanced concepts)

Filed under: Uncategorized — Ryan Wilcox @ 12:22 am

So if you read my previous article on appscript’s get syntax, you might now be wondering how to do more advanced things with getters. For example, in the Finder with Applescript you can say:

tell app "Finder" to get selection

if you want the alias (and not a reference to the finder item you’re dealing with):

tell app "Finder" to get selection as alias

So how do you do this in appscript? Read on…

(more…)

November 20, 2007

PyObjC (2.0) + FSEvents

Filed under: Uncategorized — Ryan Wilcox @ 11:59 am

For the adventurous: there’s a sample on how to integrate PyObjC with FSEvents at /Developer/Examples/Python/PyObjC/FSEvents/watcher.py

Neato.

May 21, 2007

About Ryan

Filed under: Uncategorized — Ryan Wilcox @ 12:24 pm

On a topic that may be interesting to both potential employees, employers, and clients, let me detail my personality (which reflects in my work, goals, and in general how I interact with members of a team).

While there are lots of stupid “What is your personality?” surveys, the Myer-Briggs personality type indicator is often given as a work-place HR tool. So it’s somewhat appropriate here.

Now while I haven’t been professionally typed, and there is (legitimate) reasons why random paper and Internet surveys aren’t a good way to get a concrete idea of your Myer-Briggs type, the shoe seems to fit, so I’ll wear it.

This entire article is based off this (good) analysis of my Myer-Briggs personality type (INTJ):

However, their primary interest is not understanding a concept, but
rather applying that concept in a useful way. Unlike the INTP, they
do not follow an idea as far as they possibly can, seeking only to
understand it fully. INTJs are driven to come to conclusions about
ideas. Their need for closure and organization usually requires
that they take some action

Hmm. That second sentence is… poor. I _think_ an accurate re-
phrasing would be: “Unlike the INTP, who follows an ideal as far as
they possibly can in an effort to understand it fully…”. I believe
this is correct, given this statement later in the article:

Unless their Sensing side is developed, they [INTJs] may have a
tendency to ignore details which are necessary for implementing
their ideas.

It’s also an interesting point to take into account independently.

Next point:

However, the INTJ is driven to translate their ideas into a plan or
system that is usually readily explainable, rather than to do a
direct translation of their thoughts. They usually don’t see the
value of a direct transaction, and will also have difficulty
expressing their ideas, which are non-linear.

Often they have very evolved intuitions, and are convinced that
they are right about things. Unless they complement their intuitive
understanding with a well-developed ability to express their
insights, they may find themselves frequently misunderstood….

I send more than my share of “Hmm, what I meant to say was…” emails, this is true.

… In these cases, INTJs tend to blame misunderstandings on the
limitations of the other party, rather than on their own difficulty
in expressing themselves. This tendency may cause the INTJ to
dismiss others input too quickly, and to become generally arrogant
and elitist.

I consciously tackle the issue I have in expressing myself. Although,
too often, not until later when the other party either has the wrong
idea or just gives me a blank stare.

This next one is interesting, but you’d have to ask people who have
worked “under” me about the truth of this statement:

Indeed, the INTJ is not overly demonstrative of their affections,
and is likely to not give as much praise or positive support as
others may need or desire.

(I’ve been working on this)

> Others may falsely perceive the INTJ as being rigid and set in
> their ways. Nothing could be further from the truth, because the
> INTJ is committed to always finding the objective best strategy to
> implement their ideas. The INTJ is usually quite open to hearing an
> alternative way of doing something.

A pretty important point: although when I’ve figured out what’s the “right way to do something” in my mind, I’m (usually) open to suggestions (but it doesn’t mean I won’t reject the – possibly logical in your mind – solution because of whatever reason).

Also explaining some things (but perhaps you’d have to work with me a bit to appreciate it):

When under a great deal of stress.. may also tend to become
absorbed with minutia and details that they would not normally
consider important to their overall goal

When it comes to their own areas of expertise — and INTJs can have
several — they will be able to tell you almost immediately whether
or not they can help you, and if so, how. INTJs know what they
know, and perhaps still more importantly, they know what they don’t
know.

I don’t know what to think about this next one. It _does_ explain
quite a bit, but I’m also afraid that the word “perfect” means
different things to the different kinds of people. That could be the
point, but if it is I’m not certain about the purposeful decision to
use a vague word here. Then again, with those 2 sentences I could
have just proven the point. The additional “Does It Work?”
characteristic feels very familiar to me: after I point I say “Come
on, who cares, let’s just GO!”. Which I acknowledge may or may not
get me into trouble.

INTJs are perfectionists, with a seemingly endless capacity for
improving upon anything that takes their interest.
What prevents them from becoming chronically bogged down in this
pursuit of perfection is the pragmatism so characteristic of the
type: INTJs apply (often ruthlessly) the criterion “Does it work?”
to everything from their own research efforts to the prevailing
social norms.

This next one is another Right On The Money quote from the article:

Whatever system an INTJ happens to be working on is for them the
equivalent of a moral cause to an INFJ; both perfectionism and
disregard for authority may come into play, as INTJs can be
unsparing of both themselves and the others on the project. …
INTJs have also been known to take it upon themselves to implement
critical decisions without consulting their supervisors or co-workers

If you haven’t seen me in a Group Of My Peers That Maybe I Don’t
Consider Close Close Friends, you may not know this next one. But I
can tell you that it is right on the money too. The “private person”
thing is much more obvious I’m afraid.

… because many INTJs do not readily grasp the social rituals; for
instance, they tend to have little patience and less understanding
of such things as small talk and flirtation (which most types
consider half the fun of a relationship). To complicate matters,
INTJs are usually extremely private people

Probably the strongest INTJ assets in the interpersonal area are
their intuitive abilities and their willingness to “work at” a
relationship…

Hopefully someone finds that useful (and informative)

October 13, 2006

Migrating from Sakana to MoinMoin

Filed under: Uncategorized — Ryan Wilcox @ 12:37 pm

For our wiki system we used to use sakana. In the process of migrating to a new server machine I also wanted to take the time to change wiki systems (as Sakana is no longer in active development).

I picked MoinMoin, because I saw it had a Sakana Converter.

Well, great, I thought. I’ll just use that and everything will be fine. In theory. In theory.

Here are my steps to importing sakana into Moin.

  1. Install MoinMoin
  2. Run sakana2moin.py. Do Not just put the output into the /data/text folder. Just keep it in some temp folder.
  3. In your Python site-packages folder is a script/import folder. cd into it
  4. In here is irclog.py. Meant to import IRC logs (whodathunkit?) it works OK for our purposes too. Open this file in your favorite text editor
  5. irclog.py will import all but the last file into Moin (thinking that the last file is the one still recording IRC logs). Not so in our case, so modify line 59 (for filename in files[:-1]:) to just for filename in files:. Now we’re importing all the files.
  6. irclog.py also assumes we’re pouring in plain text format into Moin. Except the Sakana converter is smarter than that, and gives us markup in Moin style wiki format. Line 67 tells Moin what kind of data we have. Change #format text to #format wiki
    Run irclog.py (instructions are at the top of the file). This might take a while (my smallish wiki took 2-3 minutes).
  7. The only bad thing about this method is that the page names get confused. Any page name that would need to be URL encoded gets mangled. “A Pretty Page” gets turned into “A(20)Pretty(20)Page”. Ok, except Moin expects it in “A%20Pretty%20Page” format. I haven’t taken the effort to dive into the sakana2moin.py script to fix this issue (my wiki is small enough that it’s possible to do it by hand).

That’s it. It took a long while to figure out, but we finally got it done. Hope this helps someone else.

August 29, 2006

Back To Blogging (Kinda)

Filed under: Uncategorized — Ryan Wilcox @ 9:48 pm

I’ve reset up my blog, now running on a machine destined to become my main webserver. Eventually.

I’ve also moved from Movable-Type to WordPress. I need to redo the theme to match the look of the rest of my site, but this will work for now.

It also could be that some images are broken. I tried to do this with as little pain as possible (everything should Just Work)… but sometimes (like images) I just didn’t have the data. You see, my old server’s hard drive crashed, and I got what I thought was everything… everything except the pictures I believe. So… so sorry.

October 6, 2003

SiteOutage

Filed under: Uncategorized — Ryan Wilcox @ 3:50 pm

Oh yeah, sorry for the outage today. This machine has been liking to crash lately. I’m not sure if it’s the old 10.2.8 update I installed (I installed it before it got yanked, and just had the latest 10.2.8 installed today.), or something else. I’m hoping 10.2.8 will solve the problem.

If not, then I’ll have some fun crash-debugging to do.. gah.

« Previous Page