Browsing articles in "Mac"
Dec
17

hc: Hex Color Command-Line Tool for OS X

By Rob Warner  //  Development, Mac, Software  //  No Comments

I’ve been working a lot lately with LESS and Bootstrap, and wanted an easier and quicker way to visualize colors and what the various LESS operations do to them. So, I built hc — Hex Colors on the Command Line. It’s written in Objective-C and works on Mac OS X 10.9+.

It’s still in its infancy, of course, but it lets you do things like show, lighten, or darken colors. To show the color red, for example, type:

hc show f00

That will display, in your console, the text:

hex: #ff0000
rgb: 255, 0, 0
hsl: 0°, 100%, 50%

You can pass 3- or 6-character hex codes. You can also change the output format using the -o/–output option. To write the color to an image file, for example, type:

hc show f00 --output file

This will create a 256×256 PNG file in your current directory called ff0000.png that looks like this:

Ff0000

You can also write the textual results to the clipboard using -o clip, or to a user notification (thanks for the idea, Rob!) using -o note. The notification looks like this:

ITermScreenSnapz002

Be sure to read the README for more information. Check it out and give me feedback!

 

Oct
8

Recovering My MacVim

By Rob Warner  //  Development, Mac, Ruby, Software  //  No Comments

Although I usually edit files with (graphical) MacVim, I occasionally launch terminal vim. When I do, I see this:

github-issues.vim requires Python support, sorry :c

I always smile a bit at my nephew’s use of an extra-frowny mouth, but I also wince a bit to know that I’m letting this issue linger, rather than fix it.

The simplest fix is to use terminal macvim as my system vim, so last Friday I opted for what I expected to be the easy route and typed:

brew uninstall macvim
brew install macvim --override-system-vim

My system churned a bit while I watched the github-issues.vim animated GIFs, and then reported:

if_ruby.c:677: error: 'rb_encoding' undeclared (first use in this function)

Years of raising children has taught me that I can’t expect proper results without diligent monitoring, so I ran the install command again, but this time I watched it like a hawk, and actually expected different results. After the same system churn, of course, I got the same result. Then my stomach began to churn a bit, and I downloaded the MacVim source from GitHub, followed the build instructions, and got the same result. 

I’m nursing this work laptop, a 2010 MacBook Pro with Snow Leopard, along until I come due for one of the shiny new retina MacBook Pros with Mavericks. I may not get one until they sport Yosemite, though, and I don’t think they plan to upgrade the OS on this laptop. You never really want to get on IT’s radar anyway, because them looking closer at your work-issued gear tends to go in directions you didn’t anticipate (“Is that the approved wallpaper? Is Homebrew even approved? Are you running a web server on here???”). What this means, though, is that I can’t use any of the latest editors (Sublime Text 3, Atom) because they’re not supported on Snow Leopard. Which means I can run Sublime Text 2 (Vintage mode, of course), but for some reason its display goes wonky on my laptop, and I really didn’t feel like investigating display glitches in a dead-ended editor. Besides, I’ve got my vim set up perfectly with settings and plugins, and anything else is a step backwards.

So, I opened the source code referenced in the error message. Line 677 of if_ruby.c was housed in this block:

673: #ifdef RUBY19_OR_LATER
674:   int isnum;
675:   long lval;
676:   char_u *sval;
677:   rb_encoding *enc;

Hmm . . . I remembered that last week I’d installed Ruby 2.1.3 via rvm. Before that, though, I was definitely using at least Ruby 1.9, so I was a bit confused, but really all I wanted to do was get MacVim working and go home. It was Friday evening, after all. So I typed:

rvm use system

This took me to ruby 1.8.7. Then I typed:

brew install macvim --override-system-vim

This time, after the churn, I got a successful completion, and now MacVim runs and vim uses terminal macvim and github-issues.vim no longer gives me the turbo frown.

And if you’re from my IT department and are reading this, I have only the company-issued wallpaper, I’m totally joking about Homebrew, and I don’t know what a web server is. And can I get a shiny new rMBP with Yosemite?

Mar
24

The Internet Is Too Small to Be Snarky

By Rob Warner  //  Development, Mac, Software  //  No Comments

Last week, I was frustrated with Oracle SQL Developer (on Mac OS X) for two reasons:

  • When a connection times out (after being left idle too long), the application hangs and I have to Force Quit and restart it.
  • Every 90 days, the passwords for our databases change, so an updated connection XML file is put into source control (passwords are encrypted, and we aren’t allowed to know the passwords) and we have to import the new connections. You can’t delete multiple connections at a time from the SQL Developer interface, and importing over an existing connection pops up a Yes/No dialog box asking you if you want to overwrite the existing connection. Since the file contains about 30 connections, this means clicking Yes to the same dialog box 30 times.

I decided to vent, and tweeted this:

The first part of the tweet contains sage advice: developers should indeed use their own software regularly, and that will encourage them to build better software. Then, however, I took a snarky swipe at the developers who work on Oracle SQL Developer. Oracle is a soulless corporation after all, right? And it’s not as if real people work on that software, right? My tweet is in no way offensive, right?

Then I got this tweet:

Wow. Not so soulless after all: a real person who not only cares enough to respond to my tweet, but also chooses to ignore my snark and answer with an attitude of helpfulness and class. Properly chagrined, I explained the two issues I was having, and he asked which version of Oracle SQL Developer I was using. Um . . . it turns out that the version I have is pretty old, so he encouraged me to upgrade, and even told me the latest version that would work on my (work) Snow Leopard machine. I downloaded it, connected to a database, and then let it sit for hours. Then I ran another query. In the past, this would cause SQL Developer to hang, and I’d have to Force Quit it. With this new version, however, it automatically reconnected to the database and ran the query. Success!

Let’s look at what I did wrong:

  • When I had a problem, I just felt victimized and did nothing about it. For years.
  • I never bothered to look for any updates to this piece of software.
  • When I got frustrated enough, I took a public swipe at the developers.

I’m a developer. I should know better. I ship buggy code. I release updates all the time that fix bugs and add new features. I don’t enjoy criticism, especially snarky criticism, and especially about something I’ve already fixed!

So, Jeff, I apologize, and I thank you for your help. And for the unspoken reminder to stay classy. I’m still hoping for a smoother, less-interactive import of updated connections, but this time I’ll ask nicely. 

And, since Jeff deserves the last word on this far more than I, here’s his response when I told him the new version corrected the application’s hanging:

Mar
19

Setting Up My New MacBook Pro

By Rob Warner  //  Development, Mac, Software  //  1 Comment

I just bought a new MacBook Pro to replace my mid-2010 MBP. This is my first retina laptop, and it’s beautiful. I’d been waffling for awhile, but I’m glad I took the plunge.

I briefly considered transferring all my stuff over from the old MBP, but I figured it was time to start clean. I use my laptop primarily for development (Objective-C, Java, Ruby, Clojure, JavaScript, Web, . . .), writing, and a little bit of graphics work. Here’s what I did after walking through the setup wizard:

  • Go to the App Store and install all updates
  • Set the hostname (System Preferences > Sharing > Computer Name) to “Truth” — homage to Paul Pierce
  • Install Chrome Dev Channel
  • Install Xcode from App Store
  • Install Dropbox and let it sync
  • Set up links to config files:
    1. ~/.bashrc -> ~/Dropbox/config/.bashrc
    2. ~/.bashrc.local -> ~/Dropbox/config/.bashrc.local
    3. ~/.vim -> ~/Dropbox/config/.vim
    4. ~/.vimrc -> ~/Dropbox/config/.vimrc
    5. ~/.vimrc.local -> ~/Dropbox/config/.vimrc.local
    6. ~/.vimbundles -> ~/Dropbox/config/.vimbundles
    7. ~/.gitconfig -> ~/Dropbox/config/.gitconfig
    8. ~/bin -> ~/Dropbox/config/bin
    9. ~/.atom -> ~/Dropbox/config/.atom
    10. ~/.lighttable -> ~/Dropbox/config/.lighttable
    11. ~/Library/Application Support/Sublime Text 3/Installed Packages -> ~/Dropbox/config/st3/Installed Packages
    12. ~/Library/Application Support/Sublime Text 3/Packages -> ~/Dropbox/config/st3/Packages
    13. ~/Library/Application Support/Brackets -> ~/Dropbox/config/Brackets
  • From command line: echo ‘. “$HOME/.bashrc”‘ > ~/.bash_profile
  • From command line: defaults write -g ApplePressAndHoldEnabled -bool false
  • Change Caps Lock to Control
  • Set Key Repeat Rate to Fast (slider all the way to right) and Delay Until Repeat to Short (slider all the way to right)
  • Turn on display of ~/Library (open home in Finder, Cmd+J, check Show Library Folder)
  • Install Homebrew and packages:
    1. macvim (editor)
    2. git (source control)
    3. hub (source control for working with Github)
    4. leiningen (Clojure project manager)
    5. node (JavaScript development framework)
    6. wry (App.net command-line client)
    7. mongodb (NoSQL database)
    8. tig (text-mode git interface)
    9. mysql (RDBMS)
    10. tmux (terminal multiplexer)
    11. elixir (Erlang-based language)
    12. ctags (tag generator)
    13. markdown (markup language)
  • Install Homebrew Cask (thanks, @pittman!) and apps:
    1. tower (source control)
    2. evernote (note taker/junk drawer)
    3. appcode (Objective-C IDE)
    4. webstorm (JavaScript IDE)
    5. rubymine (Ruby/Rails IDE)
    6. marked (markdown viewer)
    7. path-finder (finder alternative)
    8. iterm2 (terminal alternative)
    9. kaleidoscope (diff viewer)
    10. codekit (less/sass/coffeescript autocompiler)
    11. fluid (make apps from websites)
    12. firefox (web browser)
    13. brackets (editor geared toward Web development)
    14. kiwi (App.net client)
    15. copy (cloud storage)
    16. hazel (automation utility)
    17. bbedit (editor that can edit plist files)
    18. calibre (ebook reader)
    19. balsamiq-mockups (interface mockup application)
    20. sizeup (window manager)
    21. alfred (launcher)
    22. lighttable (Clojure IDE)
  • Install others:
    1. Java 7 & 8 (language)
    2. Ubuntu Mono font (my current favorite programming font)
    3. rvm (Ruby version manager) and latest ruby
    4. safe (password management utility — gem install safe)
    5. Atom (editor)
    6. Sublime Text 3 (editor)
    7. Eclipse (Java IDE)
    8. viPlugin (Eclipse vi plugin)
    9. meteor (JavaScript framework)
    10. Macaw (Web development tool)
    11. Photoshop (graphics editor)
    12. MS Office (productivity suite)
    13. Google Drive (cloud storage)
    14. Box Sync (cloud storage)
    15. Snapz Pro X (screenshots)
  • Install App Store apps:
    1. Caffeine (prevent mac from sleeping)
    2. Archy (Google Docs management)
    3. Oyster (regex IDE)
    4. Paprika (recipe manager)
    5. Dash (documentation viewer)
    6. Unclutter (scratchpad/clipboard viewer)
    7. Glui (screenshots)
    8. Skitch (screenshots)
    9. Pixelmator (graphics editor)
    10. Sketch (vector graphics editor)
    11. CodeRunner (run code)
    12. Patterns (regex editor)
    13. Twitterrific (Twitter client)
    14. Requester (HTTP client)
    15. Todo (task manager)
    16. MarsEdit (blog editor)
    17. Base (SQLite client)
    18. OneDrive (cloud storage)
    19. OneNote (note manager)
    20. xScope (screen measurement utility)

Whew! That’s a lot of stuff, but I installed only the stuff I use (well, except for OneNote—I’m going to give that a whirl). That’s an awful lot of text editors, I know, but I hate to miss out. I left a lot of stuff out, too. Let’s see how long I go before I install something else!

EDIT: OK, so the nested lists look terrible, so I changed the nested ones to ordered. I also added xScope, which I had already installed but somehow missed on the list. I also noted that I had changed Caps Lock to Control and changed Key Repeat Rate and Delay Until Repeat.

Jan
10

How to Lock Up Linux Using Sublime Text 3

By Rob Warner  //  Development, Linux, Mac, Software  //  No Comments

Steps to Lock Up Linux Using Sublime Text 3:

  1. Log in to your Mac OS X machine.
  2. Install VirtualBox.
  3. Install a Linux virtual machine.
  4. Boot that Linux virtual machine.
  5. Install Sublime Text 3 on that Linux virtual machine.
  6. Launch Sublime Text 3 and open some files for editing.
  7. Hit Cmd+P to Goto Anything….

There you go. As we say in The Deep South, you’re locked up tighter’n a tick. You can click around, mash keys, yell, and curse, even for a long time, and you’re completely stuck.

Steps to Unlock Linux After Sublime Text 3 Has Locked It Up:

  1. Hit Cmd+P to uncheck the Machine > Pause (Host+P) menu item.
  2. Hit Ctrl+P to Goto Anything….

Don’t ask me how I know this; maybe I read it somewhere.

Apr
5

A $5 app isn’t expensive: Customers need to help fix the App Store economy | Macworld

By Rob Warner  //  Development, iOS, Mac, Software  //  No Comments

A $5 app isn’t expensive: Customers need to help fix the App Store economy | Macworld: “You don’t buy a Kindle just to enjoy the dictionary and manual that come pre-installed on the device. You shouldn’t buy an iPhone to enjoy only free apps, either. You’re cheating yourself, all because we’ve become conditioned to feeling that $5 is a lot to spend on an app. It’s okay to pay for good products.”

That’s the best line in a great article.

I’m astonished at how little people value software these days. “Didn’t have feature X! Complete waste of a dollar!” Yet they waste dollars willy-nilly by leaving lights on when they walk out of rooms. Great software can only be produced by great skill and great effort. Use great software, pay for it, and you’ll be happier.

Apr
4

Introducing Wry: A Command-line App.net Client

By Rob Warner  //  Development, Mac, Software  //  No Comments

I’ve released a command-line App.net client for Mac OS X: Wry. Its home page is http://grailbox.com/wry. It’s released under the MIT License, and is hosted on github at https://github.com/hoop33/wry. Check it out, and let me know what you think!

Jan
4

Application Idea: Virtualize Cloud Storage

By Rob Warner  //  Mac, Software  //  2 Comments

I have a Dropbox Pro account with 107.5GB of storage, an iCloud account with 15GB of storage, and free accounts with Box (50GB), SpiderOak (2GB), GDrive (5GB), SkyDrive (7GB), ASUS WebStorage (8.5GB), Cubby (5GB), and UbuntuOne (5GB). I have plenty of cloud storage space. What I don’t have is a good way to manage that space.

Each of those cloud storage options operates as an island. Most create a directory in my home folder that its daemon syncs to the cloud. I can set preferences on my various devices for what gets synced inside that folder, but that folder is its own beast. If I want to save something to the cloud, I have to decide which cloud service to sync to and either save to that directory or otherwise upload to that service.

I got to thinking: what about an app that virtualized all that storage into a single virtual drive? This app would take care of managing which service to save files to, depending on file sizes and free space, and could even replicate files across services for my peace of mind. Sounds fun to build and definitely useful.

As I thought about it, though, I realized this app would have two issues:

  1. It doesn’t seem very sporting. These cloud services need paid customers to stay afloat. My proposed app could entice people to never pay for any cloud services, mooch the free services, and let the app take care of never running out of space.
  2. The primary target audience would be the people mentioned in objection #1, and they’re cheapskates. Not only wouldn’t they pay for cloud storage, they also wouldn’t pay me for the app, either.
Those two objections have dissuaded me from building Virtual Cloud, or whatever I’d call it.
 
Since I’m not typically brimming with revolutionary ideas, I’m sure plenty of other people have thought of creating a similar app. I’m curious, though, why no one has built it–and what cloud storage companies like Dropbox are doing to thwart such an app if it ever gets built.
 
Worth Mentioning: I use an app called Found (https://www.foundapp.com/) that searches my various cloud storage services. It doesn’t yet support all the cloud storage services I use, but it’s pretty slick. Check it out.
Nov
20

GeekTool Won’t Let Me Drag an Icon to the Desktop

By Rob Warner  //  Mac, Software  //  No Comments

TL;DR — Turn off Path Finder desktop to use GeekTool.

I’ve been meaning to install GeekTool on my new Mac that I bought, um, over two years ago. Time flies. Anyway, I installed it from the App Store, ran it, and tried to drag an icon to my desktop as the instructions say. I kept experiencing these symptoms:

When opening GeekTool, I am welcomed to a blank Properties box with just “Geeklet Settings”. Many tutorials have told me to drag either “file” “Images or “Shel” onto the desktop. I do this and nothing happens. The little black box that appears when you click and drag bounces back up to the GeekTool 3 preference box.

http://forums.macrumors.com/showthread.php?t=1199533

The remedy most often listed was to uninstall and reinstall, but before I did that, I realized: I wasn’t actually dropping the icon on my desktop. I was dropping it on my Path Finder desktop, which I enable in Path Finder’s settings (Features > Show Path Finder desktop). That  makes a difference! I turned off the Path Finder desktop (admittedly, I don’t know what it offers, so I don’t know what I’ve lost), and BOOYAH! Dropping GeekTool icons now works.

Aug
30

Fixing Wireless in Linux, and Why This Should Matter to Apple

By Rob Warner  //  Linux, Mac  //  No Comments

In this post, I talked about my travails getting my son’s USB wireless adapter working in Linux. A few weeks later, it stopped working. Puzzling. I opened a terminal and ran:

lsusb

The computer duly reported that it saw the USB wireless adapter. Then, I ran:

ndiswrapper -l

Yup, the driver was loaded. I checked /etc/modules and verified that ndiswrapper was listed. At that point, I had dangerously stretched my sysadmin abilities. Frustration descended, I set the computer aside, bought my son a MacBook Air, and sent him to college.

Last night, I finally got around to looking into the problem again. The device was still present, and ndiswrapper still had the driver loaded. I then tried:

sudo modprobe ndiswrapper

I got an error message: something about no such module existed. Hmm. I decided to rebuild and reinstall ndiswrapper. As I ran:

make && sudo make install

I realized that I’d probably updated his Ubuntu installation, and it probably included a kernel update, so the new kernel didn’t have that module. Duh. By chance I’d hit upon the solution. When I than ran:

sudo modprobe ndiswrapper

it worked fine and survived a reboot. Total rookie mistake.

Things like this, though, are IMHO why so many developers have moved to Mac OS X. We want the power of Unix without its headaches. We want to write code, not administer our machines. We don’t want to download and compile wireless drivers and figure out why we can’t get on the ‘Net. We don’t want to follow the politics of Gnome 3 or decide whether to switch to KDE or Xfce. Don’t get me wrong: Linux has come a long way and requires far less care and feeding than it used to, and there’s a whole lot to love about it. But the lower-maintenance Mac OS X is far too alluring for many developers, including myself.

After I wrote this, I came across Miguel de Icaza’s “What Killed the Linux Desktop.” And now I see it made Slashdot. Take the time to read this, keeping in mind that this guy is no Linux lightweight. He started the GNOME project, after all. Take that, Linux! You’re over! Apple won!

Yes, Apple has claimed a ton of developers that used to run Linux as their primary OS. They’ve also converted scads of developers from Windows to Mac OS X. And they’ve gotten a little too smug about that. See, the Linux expatriates can always go back to Linux. Even klutzes like me can administer our own Linux machines, keep things running, and get lots of development done. What’s more intriguing, though, is that former Windows users have now been trained, thanks to Apple, in all kinds of Unix-y things, and would now be far more comfortable in Linux than they would have been before. Apple might have won, but the game isn’t over.

When people talk about Apple’s overwhelming recent success, they point to the iPod, the iPhone, the iPad, and Mac OS X. Certainly all those are key, but that list ignores an essential ingredient that bedevils BlackBerry, Windows Phone Whatever, and even to an extent Android: the developers. People don’t generally buy an iPhone or an iPad or a Mac; they buy what an iPhone or an iPad or a Mac can do for them, which depends on apps. And a healthy app ecosystem. And app developers. Developers are almost invariably a leading indicator of a platform’s eventual success.

Apple has recently gone some directions that, while perhaps consumer-friendly, could be interpreted as developer-hostile. If Apple’s trajectory continues toward iOS-ifying Mac OS X and the App Store, developers may sour on Apple. If the Mac App Store becomes the only fount for installing Mac OS X apps, the developers are gone.

Where will we go? While Ballmer is betting on Windows 8, and certainly Windows 8 will claim some number of developers, most will go where bash (OK, or zsh) is a first-class citizen, Rails runs hiccup-less, and you can develop applications without Visual Studio (OK, hyperbole, but c’mon–it’s not far off). I see a Linux laptop in my future–assuming I can get it to connect to the Internet.

Recent Tweets

  • The RSS feed for this twitter account is not loadable for the moment.

Follow @hoop33 on twitter.

What I’m Writing

Pro Core Data for iOS — co-authored with Michael Privat. Click the "Buy from Amazon" button to order!
 
Beginning Mac OS X Lion Apps Development — co-authoring with Michael Privat. Click the "Buy from Amazon" button to pre-order!