Archive for the ‘Apple’ Category

Fantastic Safari Extension – Resizer

Wednesday, July 18th, 2012

Safari.jpg

Today I was updating a few Safari Extensions on my work laptop and I saw an extension: Resizer that would allow the user to define a series of window sizes and positions and then make those available in the contextual menu as well as a secondary menu in the title bar/strip. This is exactly what I had those Apple Scripts for! Except this is doing all that and more. How nice!

Out with my old Apple Scripts, and in with Resizer. Very nice!

AppleScript to Resize Safari Windows

Wednesday, June 27th, 2012

Safari.jpg

I have taken to using Safari for my GitHub views, and the problem there is that I'm typically looking at landscape pages in Safari, and not wide screen pages. But for GitHub, it's much nicer to look at things wide screen so that we get the entire width. What I'm left with is two different preferred sizes, and Safari will remember the last size you had, so it make sense to look into a way to make things a little easier for setting these sizes. Enter AppleScript.

It's actually pretty simple, once you know the things you can ask for, and get. The script to put the front-most Safari window into landscape mode is:

  tell application "Safari"
    activate
    set myPos to bounds of front window
    set x to item 1 of myPos
    set y to item 2 of myPos
    set bounds of front window to {x, y, x + 601, y + 629}
  end tell

placed into your ~/Library/Scripts/Applications/Safari/ directory.

To set the front-most Safari window to wide screen mode, I simply used a different geometry:

  tell application "Safari"
    activate
    set myPos to bounds of front window
    set x to item 1 of myPos
    set y to item 2 of myPos
    set bounds of front window to {x, y, x + 678, y + 468}
  end tell

With these in the aforementioned directory, I can use them to resize the front Safari windows very nicely. Sweet.

I'm not sure if I'm going to be doing a lot of AppleScript, but it's nice to have when you need to throw simple things like this together.

Java 1.6.0_33 Update from Apple

Wednesday, June 13th, 2012

Software Update

This morning I saw that Apple had updated Java to 1.6.0_33 for OS X Lion (10.7), and while I know in the back of my mind that Java is now in the hands of Oracle, and for Mountain Lion (10.8), I'm going to have to be at the complete mercy of Oracle for Java, I'm secretly hoping that some folks at Apple see that it's in their best interests to keep Java in Apple's hands.

To me, Oracle is a database company, and a very specialized one at that. Sun was desperate to sell out to them, and in that I wish they hadn't. I'm not at all sure about the Java coming out of Oracle. Maybe it's OK, maybe it's only part of the JVM/JRE - hard to say. I just wish Apple hadn't passed on Java for OS X like they did. Makes me nervous.

iPhoto, iMovie, Thunderbolt – Lots of Updates from Apple

Tuesday, June 12th, 2012

Software Update

This morning I saw that there were updates to iPhoto, iMovie, Thunderbolt drivers, and even the AirPort stuff… so of course I had to update all that. This is nice, but I'm not really using iPhoto all that much, and I haven't had the time or material to really get into iMovie, so the updates are really just so-so to me. But what wasn't so-so was the reboot.

For the first time ever, when I logged back in, BBEdit was back in the right place on Spaces. Xcode was too. The only exception was MacVim. Everything else was back in place and just where I left it. This was awesome!

The updates in OS X Lion that started this "clean reboot" were really nice, but a few apps never really worked with it, and BBEdit was one of them. It'd restart, but it wouldn't put the windows back where they "came from". It wasn't a horrible issue, but there were just a few apps that didn't do it right. Well… no more.

Now BBEdit and Xcode are back where they were, and the only thing I have to do is get back into the directories I was in with my Terminal.app sessions. Too bad they don't save that, but who knows? Maybe they will in 10.8?

Apple Released Mac OS X 10.7.4 on Software Updates

Wednesday, May 9th, 2012

Software Update

Just saw on Twitter that 10.7.4 was released and includes a few bug fixes that even effect Acorn, my favorite image editing application. I'm not sure now much it'll effect me, as I'm not loading Photoshop images with more than 200 layers, but it's nice to see that it's getting fixed, and all these fixes will be going into 10.8 Mountain Lion this Summer.

I'm glad that it's all coming together today - a few updates, a building of boost, and then I'm starting to feel like the day hasn't been a waste.

Building Boost 1.49.0 on Mac OS X 10.7

Wednesday, May 9th, 2012

Boost C++ Libraries

I wanted to add in threading to DKit, but in order to do that I needed a threading model, and I had no desire to use straight pthreads, nor to include all I needed to encapsulate pthreads into a decent threading library. So I decided to give boost on OS X a try. I didn't want to use the Homebrew stuff as it's an entire package maintenance system, and I didn't want to even go near MacPorts. So I decided to do a simple boost install myself.

Turns out, it's exceptionally easy.

First, simply get the latest package from the Boost web site. Then put it in a directory - any directory, and then run the following:

  $ cd path/to/boost
  $ ./bootstrap.sh
  … some config output …
  $ sudo ./b2 architecture=x86 address-model=32_64 install

And what you'll get is everything built as 32- and 64-bit universal binary libraries and deposited in /usr/local/include/boost and /usr/local/lib. It's all there, and it's trivial to uninstall:

  $ cd /usr/local/include
  $ sudo rm -rf boost
  $ cd /usr/local/lib
  $ sudo rm -rf libboost_*

What could be more simple?

At this point, you can write simple little apps that use boost:

  #include <string>
  #include <boost/unordered_map.hpp>
 
  int main(int argc, char *argv[]) {
    boost::unordered_map<int, std::string>   a;
    a[4] = "yoyo";
    return 0;
  }

and then simply compile them without any unusual flags:

  $ g++ boost.cpp

Because it's all in /usr/local/include and /usr/lib - GCC automatically finds them. Sweet!

Now I can get to adding those threading ideas to DKit.

[5/23] UPDATE: if you plan to do any debugging, you need to make sure that the built shared, debug, versions of the libraries are available to you. This is easily done with the following after you build:

  $ cd path/to/boost
  $ sudo chown -R your_login:staff bin.v2

When the build is done as 'sudo', the directories created are all owned by root. You just need to revert them to you, and then gdb works wonderfully.

WWDC Sells Out in 2 Hours

Wednesday, April 25th, 2012

It's shocking, but I'm not really surprised. As John Gruber put it:

Three years ago it sold out in a month. Two years ago it took a week. Last year it took 12 hours. So, if you want to go, I wouldn’t fuck around.

And indeed he was right. It sold out in two hours. Amazing.

I'm not sure what they'll be doing a year from now - it's likely to get even worse as time goes on. I'm guessing they are just going to have a shorter and shorter sell-out time and let people stay up all night to try and anticipate when they will go on sale.

After all, what else can they do? Raise the price? They'd have to make it 10x to impact the demand in any really significant way, and then the people you really want coming will probably stay away. You want the indie Mac developers that have made it - at least a little, and the soon-to-be indie Mac developers to intermingle and share ideas. This gets the ecosystem going and makes sure that you have great ideas passed around.

I think it's an interesting note that if you were in a long meeting, or might have been sleeping in, you'd have totally missed it. Amazing.

Interesting Bug in OS X Lion – and Great Service

Tuesday, March 27th, 2012

Mac OS X Lion

Today I had a crash in MarsEdit, and it had to do with looking up a word in a post I was generating, and I sent the data to the author. Amazingly, Daniel got back to me that there's a known bug with Mac OS X Lion when it comes to the window animations - and specifically turning them off, as I had. This was one of those hidden preferences that I found and used, and, as Daniel said, many have used as well.

The bug is that it's not really working right without it, and so the right thing to do is to turn it back on:

  $ defaults delete -g NSAutomaticWindowAnimationsEnabled

And things will go back to normal.

The real kicker for me is not that there's a bug in OS X Lion - it's that Daniel was on top of this support issue that wasn't even emailed from me to him. It was a crash report that I sent in, and he responded to it. That's amazing customer service. I'm certainly going to remember this as I (hopefully) move towards indie Mac developer. It's something to respond to emails, it's another thing entirely to respond to crash dumps.

Amazing.

Numbers is an Amazing Tool

Thursday, February 23rd, 2012

Today I've been tracking the disk space used by my feed recorders with the mis-configured drive arrays. It's important that I don't blow out the drives before I move the software into production because this data is very important to the high-frequency trading operations, and we have to have at least one reliable copy of the data.

So I tracked the disk usage for the three boxes: prod, dev, and backup prod. The first, prod, was running the old code that had no issues, the other two were running the new code that had issues with the disk space. But, after the reconfiguration, it appears to have been solved. I then set up crontabs on each box to send me the output of df -k, and then I started tracking it.

I put it all in Numbers, and here you have it:

ArcSvr Disk Usage

It's just an amazing tool. Sure, you can do all this in Excel, but that's not with the Mac style and that's just as big a part of this as the data. It's just plain fun!

Xcode 4.3 is Out!

Friday, February 17th, 2012

xcode.jpg

This morning I found out that Xcode 4.3 was released, and this time, it was a regular app on the Mac App Store! No more "installer app" that you download and then install from - this places all the files and directories right where you need them. I was a little surprised to see everything fall right into place, but the apps weren't in /Developer any longer. Maybe this is part of the plan to clean things up, but it's OK with me. I've moved all the docs I had out of that directory with my new laptop, so it's simple for me to use the new Xcode location.

Plus, it's just getting nicer and nicer. The tools and the OS for this Mac are the most amazing things I can imagine. Had I had tools like this in grad school, I'd have made my simulator run on distributed Macs and the graphics would be so nice, it'd make your eyes tear up.

Not to mention the thesis would not have been vtroff and tape for figures.

Everything gets better, and this update is no exception. I'm really glad they are pushing forward.