Yesterday I was working on a problem with an Emacs wizard, and I saw him do a couple things in Emacs that made me squirm. You see, I badger and belittle him at every opportunity for not embracing The One True Editor, but I saw him perform two actions in Emacs that I didn’t know how to do in Vim. And no way was I going to admit that, at least not to him.
Here are the two items:
When he ran a command from a shell with a lot of output, he piped the output directly to Emacs like this:
$ some_command | ecbuffer
I’m on a Mac, so I typically do this:
$ some_command | pbcopy
And then I open a new MacVim window and hit Shift+P to paste (I use the system clipboard in Vim). Inelegant in comparison. So, while his back was turned, I googled and discovered that passing – to vim causes vim to read from stdin, so I can just do this:
$ some_command | mvim -
Works great! I breathed one sigh of relief, but still had a second item to tackle: we were trying to solve a build issue in which a required jar file was not being included in the 1.2GB deployment file (that’s not a typo — we really roll that large). I noticed that when he opened a zip file in Emacs, it churned for awhile (hey — 1.2GB is a lot of data!), and then showed the zip file’s table of contents. Cool! My best thought for how to do that in Vim, using what I’d just discovered, was this:
$ jar tf foo.zip | mvim -
Not bad, but not as cool as what my coworker was doing in Emacs. So, before getting too worked up, I tried opening the zip file in Vim to see what would happen. Immediately, the table of contents for the zip file appeared in Vim. No churning. No wait. And then I could press Enter on one of the file names to view the file contents.
So, my Emacs-loving coworker made me learn two cool things about Vim. I need to work with him more often!
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:
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:
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:
Be sure to read the README for more information. Check it out and give me feedback!
I love that I can run Chrome on my work MacBook Pro, my personal MacBook Pro, and my iPhone 6 Plus and keep my browsing history in sync. I love that I can install a plugin on one Mac and have it available on the other. I love that my logins are available whichever device I use. I love that I can bring up my open tabs from any device. My web experience transparently moves with me, and it makes life so much easier.
I just launched Firefox, as I do periodically to keep it up to date, and noticed the message on the home page:
Choosing Firefox isn’t just choosing a browser. It’s a vote for personal freedom online.
Ouch. I’m not really clear on Firefox’s business model, but I know Google’s: to sell me to retailers, advertisers, or anyone else that aims to profit from me by knowing more about my habits, my data, my income, my purchases, et al. I can’t pretend that I’m outraged at the arrangement — I generally have nothing to hide, and I’d rather see advertisements for things I’m interested in than for things I care nothing about. Lately, however, I’m getting more creeped out about privacy invasion, and I’m tentatively deciding to cloak myself a bit better.
Like most web developers, I leverage Chrome’s Developer Tools in my work, and would sorely miss their absence. The release of Firefox Developer Edition might be able to fill that void. I’ve just downloaded it and will try to use it for my web development. I have high hopes.
I work with one of those functional language kooks who end every thought with “Haskell,” use xmonad or Ratpoison while scoffing at GUIs, and edit everything, even selfies, in Emacs. Serendipitously, he just walked by, read my opening sentence, and said, “Actually, Emacs DOES support graphics editing. Haskell.”
Also at work, a group of us are learning Clojure, evidenced by our once-a-week Clojure Club meetings. Progress has been slow but steady and we’ve found a lot to like about Clojure.
One uncomfortable truth has emerged in these meetings, however: most of us are Vim users, and Clojure Cool Kids clearly prefer Emacs. We’ve been trumpeting that Vim + Fireplace >= Emacs, but I see resolve crumbling. It’s not just us, of course — other Vim users chasing Clojure are wrestling with the same editor conflict: do we really have to forsake our beloved modal editor and familiar key bindings to achieve Clojure zen?
This morning a club member displayed his weakening resolve via email with this gem:
Have you ever tried evil mode for Emacs? Maybe it could provide a robust Clojure environment without having to type meta-control-bucky-O shift-N to delete a line
“Evil” is collapsed from “extensible vi layer”, and grants you some form of vi emulation in Emacs. You can find it here, and apparently many Vim users adopting Clojure are finding it as well. I emailed back:
Not sure how I feel about Evil mode. Somehow, it feels like you’re marrying Emacs but having an affair with Vim. If you’re going to commit, you’ve got to commit!
His response, which actually made me LOL, was:
Don’t think of it like an affair. Think of it like asking Emacs to wear a nice dress. It’s installing a nice text editor into the Emacs operating system!
Haskell man refused to see the levity and frumpily chimed in:
I’ve gotten as far as installing Emacs and Projectile, but haven’t embraced Evil yet. And I’ve made any edits to ~/.emacs.d/personal/config.el in Vim. But I’ve been eyeing my unread copy of Gnu Emacs Manual and thinking how deeply I want to commit to Clojure. Haskell.
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?
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:
I wish more software developers used the software they create on a regular basis, so they’d fix the annoyances. *ahem Oracle SQL Developer*
— Rob Warner (@hoop33) March 21, 2014
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:
@hoop33 our team uses it on a daily basis, I live in it. What annoyances can I help you with?
— Jeff Smith (@thatjeffsmith) March 23, 2014
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:
@hoop33 we spent a lot of time between 3.1 and 3.2 on connection stability/robustness – and handling timeouts properly.
— Jeff Smith (@thatjeffsmith) March 24, 2014
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.
- 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:
- ~/.bashrc -> ~/Dropbox/config/.bashrc
- ~/.bashrc.local -> ~/Dropbox/config/.bashrc.local
- ~/.vim -> ~/Dropbox/config/.vim
- ~/.vimrc -> ~/Dropbox/config/.vimrc
- ~/.vimrc.local -> ~/Dropbox/config/.vimrc.local
- ~/.vimbundles -> ~/Dropbox/config/.vimbundles
- ~/.gitconfig -> ~/Dropbox/config/.gitconfig
- ~/bin -> ~/Dropbox/config/bin
- ~/.atom -> ~/Dropbox/config/.atom
- ~/.lighttable -> ~/Dropbox/config/.lighttable
- ~/Library/Application Support/Sublime Text 3/Installed Packages -> ~/Dropbox/config/st3/Installed Packages
- ~/Library/Application Support/Sublime Text 3/Packages -> ~/Dropbox/config/st3/Packages
- ~/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:
- macvim (editor)
- git (source control)
- hub (source control for working with Github)
- leiningen (Clojure project manager)
- wry (App.net command-line client)
- mongodb (NoSQL database)
- tig (text-mode git interface)
- mysql (RDBMS)
- tmux (terminal multiplexer)
- elixir (Erlang-based language)
- ctags (tag generator)
- markdown (markup language)
- Install Homebrew Cask (thanks, @pittman!) and apps:
- tower (source control)
- evernote (note taker/junk drawer)
- appcode (Objective-C IDE)
- rubymine (Ruby/Rails IDE)
- marked (markdown viewer)
- path-finder (finder alternative)
- iterm2 (terminal alternative)
- kaleidoscope (diff viewer)
- codekit (less/sass/coffeescript autocompiler)
- fluid (make apps from websites)
- firefox (web browser)
- brackets (editor geared toward Web development)
- kiwi (App.net client)
- copy (cloud storage)
- hazel (automation utility)
- bbedit (editor that can edit plist files)
- calibre (ebook reader)
- balsamiq-mockups (interface mockup application)
- sizeup (window manager)
- alfred (launcher)
- lighttable (Clojure IDE)
- Install others:
- Java 7 & 8 (language)
- Ubuntu Mono font (my current favorite programming font)
- rvm (Ruby version manager) and latest ruby
- safe (password management utility — gem install safe)
- Atom (editor)
- Sublime Text 3 (editor)
- Eclipse (Java IDE)
- viPlugin (Eclipse vi plugin)
- Macaw (Web development tool)
- Photoshop (graphics editor)
- MS Office (productivity suite)
- Google Drive (cloud storage)
- Box Sync (cloud storage)
- Snapz Pro X (screenshots)
- Install App Store apps:
- Caffeine (prevent mac from sleeping)
- Archy (Google Docs management)
- Oyster (regex IDE)
- Paprika (recipe manager)
- Dash (documentation viewer)
- Unclutter (scratchpad/clipboard viewer)
- Glui (screenshots)
- Skitch (screenshots)
- Pixelmator (graphics editor)
- Sketch (vector graphics editor)
- CodeRunner (run code)
- Patterns (regex editor)
- Twitterrific (Twitter client)
- Requester (HTTP client)
- Todo (task manager)
- MarsEdit (blog editor)
- Base (SQLite client)
- OneDrive (cloud storage)
- OneNote (note manager)
- 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.
Various Node.js gurus explain and explore the power of this server-side framework in this collection of videos. Two years later, the videos age pretty well, considering they cover Node.js 0.4.x and 0.5.x, and today’s current version is 0.10.x. The speakers range from Node committers to heavy Node users, and you gain insight into not only how Node works but why it works that way. Some highlights:
- Real Projects Built in Node and Developing Cloud9 in Cloud9 speak to the what works and what doesn’t in real-world use. Advice includes to use libraries like Puppet for configuration and Log Magic for logging. Cloud9 continues to grow and is an excellent way to get started with Node.
- Using jQuery with node.js introduces jsdom and how you can use this powerful framework on the server side. It implements the DOM as if it were a browser so jQuery selectors et al work fine.
- Running Node.js in Production and Node at Scale tells you how to make sure your Node app scales in real-world use. It covers how to choose meaningful benchmarks, how to structure your code, how to deploy, and how to keep your dependencies stable using package.json
- Programming a Chat Server does some live coding to show what you can do with sockets.io and Node. You can see the result at https://github.com/guille/oscon-chat.
- Network Programming with Node.js talks about the challenges of porting Node to Windows.
I wish the speakers had repeated the questions before answering them–you’re left guessing what question the answer matches. Talks mostly finished ahead of schedule, reflecting perhaps speakers new to speaking. The information is prime (albeit dated), though, and the whole offers a good introduction to the world of Node.js.
Find the videos here: http://shop.oreilly.com/product/0636920022183.do
Steps to Lock Up Linux Using Sublime Text 3:
- Log in to your Mac OS X machine.
- Install VirtualBox.
- Install a Linux virtual machine.
- Boot that Linux virtual machine.
- Install Sublime Text 3 on that Linux virtual machine.
- Launch Sublime Text 3 and open some files for editing.
- 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:
- Hit Cmd+P to uncheck the Machine > Pause (Host+P) menu item.
- Hit Ctrl+P to Goto Anything….
Don’t ask me how I know this; maybe I read it somewhere.
Enter /etc/apache2 as your Apache Server Config Directory Path
copy the generated line from httpd.conf to apache2.conf
I’m no sysadmin, as will become clear rapidly in this post. I develop software, including Web software, so I have some knowledge of Apache and how to set it up and configure it, but for anything tough I scurry to real sysadmins.
I’m currently on a project at work to replace our Sun/Oracle OpenSSO installation with ForgeRock OpenAM, so I plopped a Linux VM on my MacBook Pro and worked my way through installing OpenAM using the ForgeRock’s Getting Started with OpenAM document, which is easy to follow and works well. When I got to the OpenAM Web Policy Agent installation, however, I stumbled. I ran the commands:
$ cd /path/to/web_agents/apache22_agent/bin
$ ./agentadmin --install
I was prompted for the Apache configuration directory:
Enter the Apache Server Config Directory Path [/opt/apache24/conf]:
I had installed Apache 2.4 through apt-get, so I knew /opt/apache24/conf wasn’t correct. I poked around a bit and found /etc/apache2, which looked like a configuration directory to me, so I entered that. I got this error message:
ERROR: Invalid Apache Server Config directory . Please try again.
After trying all kinds of directories that had “apache2” in the path (see? I told you I’m no sysadmin) and getting the same error each time, and after prying open the shell script and seeing that all work was being done in Java, so I’d need a decompiler to crack this open, I paused a moment to think: What would this script be looking for to validate that the directory I entered was indeed an Apache Server Config directory? I figured it was probably looking for httpd.conf, which is the configuration file I’m (slightly) familiar with and which didn’t exist anywhere on my system. So, I typed:
I re-ran the OpenAM Web Policy Agent installation, and everything worked. The installation wrote this line to httpd.conf:
When I tested my newly-protected page, however, OpenAM did nothing to prevent access. After a bit of thought, I figured that httpd.conf was being ignored, so I copied that line into apache2.conf, and then OpenAM blocked the page appropriately. Success!
Hope this helps someone.
- September 2015 (1)
- April 2015 (1)
- January 2015 (1)
- December 2014 (1)
- November 2014 (2)
- October 2014 (1)
- April 2014 (1)
- March 2014 (2)
- January 2014 (3)
- August 2013 (2)
- July 2013 (2)
- May 2013 (3)
- April 2013 (6)
- February 2013 (1)
- January 2013 (1)
- November 2012 (6)
- September 2012 (1)
- August 2012 (6)
- July 2012 (10)
- June 2012 (4)
- May 2012 (7)
- April 2012 (4)
- March 2012 (8)
- February 2012 (7)
- January 2012 (7)
- December 2011 (1)
- November 2011 (1)
- September 2011 (4)
- August 2011 (2)
- July 2011 (2)
- June 2011 (2)
- May 2011 (4)
- April 2011 (2)
- February 2011 (1)
- January 2011 (1)
- December 2010 (3)
- November 2010 (3)
- October 2010 (4)
- September 2010 (6)
- August 2010 (96)