Keyboard Maestro Snippet Video
I’m gonna have to blog about how I did this (later). I’m giving a live-coding talk on Tuesday. I was gonna use Snippety but it lacks a minor feature and I didn’t wanna bug the author Marin Todorov this week of all weeks. So I hacked up a pretty workable facsimile using KeyboardMaestro.
I have became that person who takes tons of pictures of his cat.
© 2022 Aijaz Ansari, and is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License ↩
Flask, Celery and Docker
I’ve been working on an app that requires users to upload data to a server, where the data is used to create machine learning models. The process to create a model takes a lot of time (as much as 3 minutes). I don’t want to have an HTTP request open for 3 minutes while the model is being created. I would rather the server accept the request, send back a response immediately, and queue the task for processing. Then the user can poll the server to see if their model is ready. I realized that Celery is the perfect tool for this. In this post I write about how I set up Celery and Flask and share sample code.
After exactly two long months of development, and just in time for Ramadan, I’m pleased to announce the public release of my latest app, QuranReflect
Finding gaps in time intervals in SQL
I have a table in a relational database (PostgreSQL) that contains time intervals. In this post I’ll show you how to find gaps in those intervals.
Sometimes the train called Opportunity slows down just enough to let you hop on—if you want—before speeding away. I hopped on.
Goodbye, Twitter (Updated)
After more than nine years on Twitter, I finally deactivated my account. I refuse to contribute to the success of any platform that promotes the hatred of the villainous Donald Trump. I hope Twitter CEO Jack Dorsey never has to face the persecution that the vile Trump is trying to inflict on people like me. However, if anyone deserves it for enabling hatred, it is him.
You can find me here, and on micro.blog.
Update 1/8/2018: After two weeks away from Twitter I came back when I learned that Twitter suspended the hateful account that was retweeted by Trump. There is a story about that here.
It was this action that prompted me to re-enable my account.
Those two weeks I wondered if I made the right decision. There are people I care about that I can only contact on Twitter. When I saw the news above, it was enough to change my mind. I would have been happier, of course, if they had removed Trump’s account.
CocoaConf: How I Prepared, & What I Learned
Last week I attended CocoaConf Chicago for the 6th year in a row. In this post I would like to share with you how I prepared as a speaker, and what I learned as an attendee.
What Happens to your Passwords when you Die
This is a guest article I wrote for the newsletter of a friend of mine who’s an Estate Planner.
Almost every digital or monetary asset you own is protected by a password. Some service providers, like investment brokers require multiple pieces of information, like your social security number, account number, date of birth, etc. These are all things that a provider assumes only you know. Once these secrets are known to others your asset is compromised. So in order to keep these secrets safe, you need to do two things: prevent others from being able to view these secrets, and prevent others from being able to guess them.
Running External Commands in LLDB via Python
Many iOS apps today are clients of some sort. They request data from a remote server. Typically this data is served over HTTP (with SSL) and formatted as JSON. At FastModel Sports our iOS app is constantly requesting large amounts of JSON data. While debugging the app I inevitably have to compare what I’m displaying in my views to what the server sent me.
This meant saving the server response into an NSString, printing it out to the console with NSLog, copying that output, switching to Terminal, pasting that output into a file and then running
jq on that file. That’s a lot of steps. In this post I’ll show you how to do all of that directly from the LLDB command prompt.
Rotation and Adaptive Layouts
Another in a series of posts documenting my process of updating an aging app.
For this rewrite of Qur’an Memorizer I’m using Auto Layout. This is the first time I’ve used Auto Layout for this app. You know when the Apple Engineers said Auto Layout makes things easy? They weren’t kidding. Even though Qur’an Memorizer has some unique behaviors for autorotation, I was able to implement this in a few hours with Auto Layout and about 25 lines of code. Read on to see what I did.
Code Coverage Without Pod Files
Another in a series of posts documenting my process of updating an aging app.
I noticed that the code coverage reports from XCode 8 recently started showing me coverage for
.m files that were in the CocoaPods that I’m using. In this post I document how I fixed that.
Updating an Aging App
It’s been more than three years, but I’m finally updating my most popular app, Qur’an Memorizer. This is the first in a series of blog posts tagged with QMUpgrade, where I’ll write about the issues I faced updating an aging app.
Examining JSON Data With jq
Earlier tonight I spoke at NSCoder Chicago about how to use jq to examine JSON data. This post contains links and information that I would like to share with the attendees.
A Very Chicago Picture
Michigan Avenue, Chicago
If you walk too fast, you might miss them. Two gardens flank the Art Institute of Chicago, on Michigan Avenue. Now, we all know Michigan Avenue as a busy, bustling street, but these gardens are great places to stop. And think. Or just clear your head before merging back into the fast pace of the sidewalk. This is the South Garden, looking back out towards Michigan Ave.
This is the first in a series of posts where I share the final screen of Letterpress games. When I was showing my daughter this game, she mentioned that she liked it when games ended in pleasing patterns. So then I started to try to win (or lose) games with a symmetric pattern, if possible.
Most of the patterns are symmetric about an axis (reflection). Some display rotational symmetry. Where possible, I will also include a link to the replay URL of the game. Here’s my first one.
Moving to Pelican
Several times in the past few months I have tried to add a post to this blog. But I couldn’t because of some obscure Ruby error whenever I tried to generate the blog using Octopress. There was so much friction in the simple act of adding a new post, that I finally decided enough was enough and moved the blog to Pelican.
My Tiny Challenge
Well, it’s happened. I decided to join @jaimeejaimee and @bradheintz in another 30 days challenge. This month’s challenge isn’t about writing. It’s about playing the long game and changing my body. A little background, first:
Shapeshifting DIY Robots
Last night, right before going to bed, I decided to play The Room 3. It’s a beautiful game with elaborate puzzles. I was completely lost in the world of intricate models and mind-bending transformations. Later that night I had the most awesome dream:
30 Days Later
Well, that was fun. For the first time ever I wrote a blog post every day for a month. Here’s what I learned:
Don’t Give Up
Mastering something can take time. In my case, it took me about 18 months to get to the point where I could do a set of 10 Lever Pull-ups.
Learn These Things Before You Need To Know Them
A few weeks ago, when my older two boys were getting ready to go off to college I was reminded of something I read online: Buy a toilet plunger before you need a toilet plunger. In today’s post I would like to list four things that you should know how to do, before you have to do them.
Examining a Picture
A few minutes ago I zoomed in on a photograph that I had taken in April. I saw details that fundamentally changed my understanding of what’s going on in the picture. It’s funny how often that happens.
You Can Learn A Lot If You Listen
My family visited the city of Medina in Saudi Arabia last year. One night, while we were out, everyone was tired and hungry. They found a comfortable spot and decided to sit down for a while. They asked my older sons and I to go pick up some food from any local restaurant and bring it back, so we could all eat together.
Tools I Use in Class
I’d like to share with you the various tools that I’ve found work well for my iOS class. I’ll show you what I use for video, displaying keyboard shortcuts, slides, and class notes.
Who’s Your Child?
If you’re a parent, you’ve either been through this, or will soon: At some point you stop being known by the neighbors by your own name, and start being identified by your kids’ names. You become “Adam’s Dad” or “Sarah’s Mom.”
Backing Up your iPhone to an External Drive
Some of you may not have room on your hard drive to back up your iPhone. This short post shows you how I backed up my iPhone to an external drive (on a Mac).
Tipu Sultan and James Joyce
Every Monday, Wednesday, and Friday I have been posting different pictures of doors that I saw in Dublin. When researching one of the buildings I was surprised to learn of the connection between a house that James Joyce visited (and wrote about) and Tipu Sultan, the ruler of Mysore.
The Most Relevant Story
As I child I read a lot of European stories like those from the Brothers Grimm or Hans Christian Andersen. As I’ve grown older I’ve come to realize that if there were one story I would want to make sure I share with my children it would be “The Emperor’s New Clothes.”
All This For One Shot
Optionals In Swift
I’d like to share with you the way I teach optionals in Swift. I’m pretty sure I’m not the first person who thought of this method, but since I haven’t seen anyone else write this up, I’ve taken it upon myself to do so.
Who Wrote This?
Different people have different gifts. Some excel at their profession, others are talented at various arts, while yet others are blessed with strength or wealth. Once you know what your gift is, it’s time to consider using it to help others.
One of the most beautiful places I visited during my recent trip to Dublin, Ireland was the Trinity College Library. The long, two-storey high grand hall with stacks on each side was breathtaking. The smell of old books filled the air.
A Change of Scenery
I had been taking the same path to work for the past ten years. Sure, there were minor variations - I could turn this way a block earlier, go that way a block later - but essentially the walk was the same. I started recognizing the people I’d see on the street (and secretly naming them in my head), the doors on buildings, and even the various imperfections on walls and on sidewalks. I am an amateur photographer and, in a word, I was bored. On a typical walk to and from work, I could look at anything and feel I knew every visual facet of it. Leisurely photo walks were always different, but were few and far between. And then, I moved to a new job.
Lessons Learned While Hiking
Today’s post is a quick story. In 2009 I took my kids hiking in Wisconsin. It was the first time the kids had gone on a long hike. I assured my wife that we’d be fine and we left after their regular Saturday activities. It was a character builder for all of us.
The Best Time to Die
The only certainty in life is that it has an end. I’ve been trained to think of death as a sad, morbid topic. But lately I’ve come to realize that embracing the inevitable can have a markedly positive effect on my life.
This is one of my favorite things about the Workout App on the Apple Watch: the ability to start a workout without having any specific goal in mind.
I love that I can just start and see where the workout takes me. There’s no pressure reach a certain time or calorie count. I can just play it by ear.
See you tomorrow.
This is the 13th of my 30 days posts.
Level Up In Photography
Remember what I said a few days ago about fitness? “Just show up”? Today is such a day with this blog for me. I’m tired, I have a headache and I would rather not write. But I’ve shown up, with the idea that a small, helpful blog post is better than nothing. So, here goes. I’m gonna talk about taking better pictures.
This has been eating at me for the last 28 years. I’d like to start talking about it today. It’s what I call the American mantra of “I have no regrets.” In this post I’ll lay out my initial thoughts so that I can, over time, flesh them out and come up with a well-written essay.
Exercising Your Brain
We’ve all heard or seen the ads making claims like, “Download our scientific app and play our brain games! They’ll improve your memory and actually improve your brain power over time.” I’d often thought about downloading one of those apps and trying it out. Wouldn’t hurt right? Wrong. It would hurt your pocketbook, but wouldn’t help your brain at all, according to Johns Hopkins Professor of Neuroscience David Linden. What would help is exercise, he tells Terry Gross, of NPR’s “Fresh Air”.
It’s Never Too Late to Learn
I was pre-teen in the early 1980s. The 1980s was the decade of the Rubik’s Cube. It was everywhere. I was in India at the time, and people over there were as nuts about it as people in Europe and the US. Kids all over the world were experiencing the thrill of solving it. But not I. I had a book that described how to solve the cube, but it did a really poor job of describing the seemingly arbitrary algorithms required. Even though I could solve a single side by myself, I couldn’t solve the entire cube without having the book open in front of me, following its complex directions.
Learning About Your Product
Today’s post will be short and sweet. I want to share something that worked for me really well when I recently started my new job. There are a few existing iOS products for which I will have to become the primary developer. I needed to come up to speed on these products quickly. I started of the way we developers normally do: read internal documentation, examine the
Main.storyboard file, look at the
AppDelegate.m file. But then I got a good idea. I asked the salespeople to demo the product to me, as if I were a prospective customer.
Walking and Running to Explore New Places
I’ve hated running for ever. I first tried running for exercise by the shore of the Indian Ocean when I was fourteen. Didn’t get very far. Did get a bad case of shin splints. Over the next couple of decades I tried again a few times, but never really got into it. Every time I tried the result was the same: it was painful, frustrating, and just not fun. I tried focusing on mechanics, but it was making running just that: mechanical.
The Mighty Bowline Knot
Humans have been using rope as a tool for thousands of years, even before we started recording history. Knots and rope-tying is one of the few technologies that have persisted essentially unchanged in all of the known human history. This is the second in a series of posts about the most important knots. The bowline knot is certainly in the top two or three.
What I’ve Learned About Fitness
I’ve been working out regularly since I was 16 years old. But it’s only in the last ten years that I’ve really learned how to do it right (for me).
How Not to Recruit
Someone asked me if I wanted to work for them this morning. But they did a really poor job doing it.
It’s time to boycott the NFL
We can watch football players literally kill each other for our entertainment. Or we can choose not to. It’s time to boycott the NFL.
Changing Jobs and Keeping Friends
It can be difficult to leave a job and start working at a new place, especially if you like where you work right now.
30 Days to Life
As I started planning what to write about for my 30 days posts, I realized that this isn’t the first time I’ve been exhorted to try something for 30 days. In fact, I’ve been doing this every year for about 30 years.
Inspired by @jaimeejaimee and reminded by @bradheintz, I too will start a #30days writing experiment tomorrow. Let’s give it a shot.
Performance Improvement with FMDB
When you have to execute SQL statements inside large loops, you may find that your app slows down considerably. In this post I show you one way of improving the performance of your app when database access is the bottleneck.
Diary of Apple Watch Energy Consumption
These are notes that I took while trying to find the optimal Apple Watch settings that maximize my battery life.
Thanks for the memories, CocoaConf
Last week at Yosemite by CocoaConf was one of the most memorable weeks of my life. I would like to thank all the people who helped make it such a wonderful event.
The layout of my Apple Watch Apps
Switching from being a consumer to a creator
Three talks at the Yosemite by CocoaConf conference made me think about my relationship with Twitter and convinced me to switch from being a consumer of social media to a creator and a writer.
Viewing OmniGraffle Files in XCode
When I work on complex iOS apps, I like to diagram the complex relationships between classes and subsystems in OmniGraffle. In this post I’ll show you how to add OmniGraffle files to XCode, view them from within XCode and keep them updated automatically.
About That Antelope Canyon Shot
One of the best portraits I’ve taken is a picture that I took quite by accident as I was calibrating my camera for a future shot. This is the story behind that picture. If you know the subjects, please have them get in touch with me, so that I may give them this photograph.
The Difference Between a Good Picture and a Great Picture
Travelling often gives you the opportunity to take unusual pictures of street scenes. In this post I describe three pictures I took of the same scene, and how a small change in the third (completely out of my control) changed the picture from a good one to a great one.
The Auto Rickshaw
The Importance of Having a Good Spotter
When working with something dangerous, you must always ask yourself, “If the forces that are maintaining the current equilibrium give way, what’s the worst that can happen?”
Unit Testing Private Methods with XCode
Now that I’m starting a new iOS development project, I’m trying to have close-to-complete test coverage of critical parts of my code. I’m using XCTest pretty extensively, and found that I needed to test a rather complicated private method that is critical to my app’s user experience. This post shows you how I did it.
Asking for Allah’s help for the people of Gaza
Was-salaatu was-salaam ala Rasoolillah.
People of conscience all over the world have been watching with horror as Israel continues its bombing and shelling of civilians in Gaza, seemingly intentionally targeting children and defenseless civilians. Despite feeling powerless we want to do something to help the people there, and not merely watch them being massacred. As Muslims we know we’re supposed to materially help those in need as well as pray (make du’aa) for them (as well as other places like Syria and Burma), but sometimes it gets difficult to find a balance between action and prayer. This article, based on notes from various lectures I attended during Ramadan, attempts to help people like me find that balance.
Recreating David Hobby’s Profile Picture
When you’re a beginner learning a new skill, it’s okay to try to recreate the Masters’ works as practice (in private). With that in mind, when I was learning to use external flashes with the Fuji X100S I gave myself the task of recreating David Hobby‘s iconic profile picture. I asked David for his permission to blog about it and he graciously granted it. There are serious ethical issues involved with publishing this sort of practice work. To jump directly to that discussion, go here.
External Flashes with the Fuji X100S
As an amateur photographer I’ve found it hard to find information on how to use external flashes with the Fuji X100S camera. In this post I’ll show what I did to get it to work and how I used a Fuji with two external Nikon SB-800 flashes.
PostgreSQL Advisory Locks
A recent post by
Derek Parker introduced me to
advisory locks in PostgreSQL.
Advisory locks are a very straightforward way to prevent multiple instances of a program from running at the same time. However, there are some cases when you shouldn’t use the database to enforce this constraint.
LinkedIn Can Read Your Emails
The stupidity of this is mind-boggling. Essentially, LinkedIn is asking you to insert a man-in-the-middle IMAP server that parses ALL your email and modifies the body so as to ‘enhance mobile email, giving professionals the information they need to be brilliant with people.’ The following tweet from Justin Miller first brought this to my attention:
Leaving Glen Ellyn
I like how the rays of the sun reflected off the train. I only had a second to take this picture as there was a crowd of commuters right behind me.
The Case of the Leaking Space Suit
Imagine, for a minute, that you’re an astronaut. On the ISS. Conducting a space walk. There you are, outside your vehicle, and you realize your spacesuit is leaking. You could drown. In outer space.
Links from my Sublime Text Talk
At today’s CocoaHeads meeting I gave a little demo of
Sublime Text 3.
I’ll write a more detailed blog post about why I chose Sublime Text in the near future. In the meantime, here are the links:
Dropping a Napalm Bomb on a School
A Syrian fighter jet apparently dropped a napalm bomb on a school playground. Tragically, just another day in Syria. It’s images and scenes like this that anger me all the more when people tell me their opinions on foreign policy using statements like “Syrians are stupid.”
A List of iOS URL Schemes
A handy wiki page that lists URL schemes being used by iOS apps is no longer being mantained. I copied the page over to this site in an effort to preserve the data and continue accepting submissions.
How to Delete Multiple Versions of an App in HockeyApp
I recently needed to issue several dozen HTTP DELETE REST API calls of the form http://www.example.com/blah/n where n was a sequential version number. In this post I’ll show how to do this easily from the command line.
Pulling into the Station
This photo was taken in ‘stealth’ mode: shooting from the hip, no audio, no display on the rear LCD. I had no idea what the composition would look like.
Evolution of Objective C Database Code
One of the features of Qur’an Memorizer, my first iOS app, is the ability to highlight a verse (ayah) when it’s tapped. To do this I access a database of verse x and y locations and retrieve the 4 coordinates I need to draw the resulting polygon.
The first version of the code released to the App Store looked a little bit like this:
When Autumn Leaves Start to Fall
This is an Oak tree that I planted in my front yard about five years ago. I’m glad it’s survived all the storms we’ve had since then. I hope to see it grow into a Mighty Oak.
Using Octopress as a Photo Blog
As an amateur photographer I like displaying my photos on my blog, especially when there are particularly interesting stories behind them. In this post I’ll show you how to modify the default Octopress theme and add a type of layout that highlights a single photograph. You can see an example of this in this sample blog.
More on Passwords
After my recent Blitz Talk at SecondConf I had some great conversations with fellow attendees in the meal lines and around the beverage table. I’m presenting them here for further discussion.
Protecting Your Users’ Privacy
Here are the slides and links from my recent Blitz Talk on password security at SecondConf.
Update: I have just posted some followup discussions in a new blog post.
This is why I love my 11-inch MacBook Air
The 2011 MacBook Air is my primary machine now. The SSD and CPU are fast and the machine seldom slows down when I have many apps open.
The Lower Antelope Canyon in Page, Arizona is a place of breathtaking beauty. Located in Navajo country, it’s best viewed at around noon when the angle of the sun’s rays makes for very dramatic lighting.
This is a bend of the Colorado River located near Page, Arizona. In Page you can find the famous Antelope Canyons.
“Cloud Gate” - fondly known as The Bean. Millennium Park, Chicago. Looking East, half an hour before a sunrise that was hidden behind clouds.
How to Make a Pinboard Search Engine Shortcut
Now that I’ve been using Pinboard for a while, I find myself having to search for one bookmark or another quite often. I grew weary of going to my Pinboard page, clicking on the search box and entering my query. Here’s how I streamlined it in Chrome.
How to Customize your Octopress Theme
As you’ve probably noticed I’ve modified my Octopress installation so the color theme is light and minimalistic. Since some of you wanted to know, here’s how I did it.
What follows was originally posted by me on my Facebook wall. Since the message resonated with many people I’m moving it here so it can live on the public Internet.
Emotional Changes To The User Interface
I love word games. I’ve played Scrabble on my iPhone more than 1200 times. Then, a couple of weeks ago they changed their user interface. Now I’m afraid I’ll never play it again. In this post I’ll tell you what I don’t like about the changes, and how I plan to avoid similarly alienating users of my own apps.
I attended the Glendale Heights SummerFest fireworks display last night. As the fireworks started I tried to take a video of them on my iPhone. I must have placed my finger in front of the lens because the focus locked on a short distance (as opposed to the infinity needed in such situations). The resulting bokeh was unexpected but very beautiful.
Making a Kung Fu Wooden Dummy
In 2010 I made my own Wing Chun Kung Fu Wooden Dummy. The Wooden Dummy is a training tool that helps you practice the fighting techniques of Kung Fu. This post explains how and why I built it.
Installing mod_perl 2.0
I recently needed to upgrade one of my machines to mod_perl 2.0. I encountered many problems on the way, and would like to share with you what I did to finally get it to work.
Not as expected
Over the past year I have written about moving over to Google+ and switching away from emacs. Both of those experiments didn’t achieve the intended results. I told you I’d keep you updated, and now I’ve added some updates to each of those articles.
Running Out Of Power At The Grand Canyon
I’m currently in the last 48 hours of my first ever visit to the Grand Canyon in Arizona. Just hours before setting out to see the Canyon for the first time, I realized that I couldn’t recharge my camera’s battery. I had 80% of a full charge, and four more days of vacation to go. Time to panic?
Stopping by the Streets on a Snowy Evening
One-legged Medicine Ball Burpees
After only being able to do a single one-legged medicine ball burpee last week, I was able to do 12 last night. Here’s the trick:
Tag Clouds With Octopress
Shell Tricks - Extracting A Column From A Text File
There have been times when I’ve had to extract a particular column from a
tab-separated or comma-separated file. The best way to do this is to use the
cut. Let’s say I have a file named
input.txt that looks like this:
Excluding Yourself From Google Analytics
Switching To Octopress
Over this past weekend I switched my blog over from WordPress to Octopress. In this post I write about why I did it, what exactly I did to get the blog just the way I wanted, and what I plan to do in the future.
How To Wrap Text In Vim
[Another in my series of posts on Vim]
If you’re writing natural language text you may wish to format your paragraph so that the text wraps before lines get too long. Here’s how you do it:
To set the maximum width of a line of text, go to Normal mode and enter
Understanding Your Camera’s Histogram
In a previous blog post we learned what a histogram is. In today’s post we’ll see how to use histograms to help take properly-exposed photographs. If you haven’t read the previous post, or are not familiar with histograms, I would recommend you read that post before continuing with this one.
Inspiration vs. Imitation
Jessica Hische has just published a very well written article on “why it’s ok to copy people to learn, but never ok to publish that work.” I love the tone of her writing. Even though I’m not a designer and won’t ever be as good a letterer as she is, I hope to be able to write as well as her.
How To Quickly Delete Words While In Insert Mode In Vim
[Another in my series of posts on Vim]
Sometimes when you’re typing natural language text, you find yourself wanting to rephrase the sentence you’ve written so far. You could hit backspace many times to delete the characters to the left of the cursor, or you could type Ctrl-W. When you’re in Insert mode, Ctrl-W will delete from the cursor to the beginning of the previous word.
What Is A Histogram?
A key aspect of good photography is exposure - the amount of light that enters the lens. One of the most useful tools a digital cameras has to help you measure a photograph’s exposure is the histogram. In order to learn how to use it, you must first learn understand what a histogram is.
Let’s pretend I teach a class of 20 students. One day I decide to give the students a test in which they can score anywhere from 0 to 100 points. After grading the tests I want to see how the population of students did. So I graph the scores in a histogram. A histogram displays the distribution of measured values across a population. Let’s make one now.
How To Insert A Line Of Dashes In Vim
[Another in my series of posts on Vim]
If you’re a developer, you will often find yourself having to insert a line of dashes or hashes (#) or asterisks into your comments. In this post I’ll show you how to do this quickly. Memorize this because you’ll wind up doing this often. Position the cursor to the beginning of a blank like (in command mode) and enter the following:
How To Subtract One File From Another
Let’s say you have two text files, FileA and FileB. You want a file that has all the lines of FileA that are_ not_ in FileB. How do you do that?
The simple answer is
-v option inverts the search, and only prints
lines that do not match. The
-f option is used to specify a file that
contains a list of all the patterns for which to look - one pattern per line.
A Different Kind Of Running
I don’t like running unless I’m running towards something or away from something. But I do run often because of the health benefits. I’ve always thought the right way to run was to land on my heel and then transfer the weight to the ball of my foot, and finally the toes. Now according to this article and this site I may have been doing it wrong.
There and Back Again - A Hacker’s Switch from Emacs Back to Vi
When I first learned how to exist on UNIX, in 1988, I used vi as my primary editor. During the next nine years I taught myself how to become a power user - migrating from the simple motion and copy and paste to more complex skills like marks and named registers. When I started graduate school I saw many of the professors and grad students using emacs. I tried it out a couple of times, but it was not until 1997 that I decided to take the time to stick with emacs and take the time to learn the right way to do things even when I could get the job done faster in vi.
Taking Back My Relationships
I’m trying to formulate a sensible strategy to overhaul my net presence. The rough plan so far:
- Change my 12-year-old email address that is on every spammer’s short list
- Extract friends’ contact info from Facebook
- Delete Facebook account.
- Import FB contacts into Google & Mac
- Redirect facebook friends to current tech blog (aijazansari.com) and new personal blog.
- Find out if FB friends can subscribe to an RSS feed of my blog somehow (doesn’t seem possible any more)
- Pick up the phone and actually talk to friends more often.
The goal’s pretty obvious - I want to reclaim my data. I think I own my relationships, not FB, not Twitter, and not Google+. So far, G+ may be the most accommodating network out there - if I can export my G+ presence as easily as I can export my G+ contacts, we might have a good candidate here.
If you have any ideas or comments or experience with this, please let me know.
I’ll keep you posted.
Like so many of you, I’ve given up on Google+. Most of the people I wanted to communicate with never made the switch. In the end, having those lines of communication open with my friends was more important than the platform. G+ has been dismissively called a “Ghost Town,” and in my case, at least, that wasn’t too far from the truth.
Glen Ellyn Volunteer Fire Company
Fire marks were used in the 1700s to designate homes or buildings protected by the fire insurance companies. They were generally oval plates placed on the outside of a structure to let volunteer fire brigades know which buildings carried a “reward” if saved.
You can read more on this here.
Implementing Inertial Scrolling in iOS
I hadn’t really given much thought to how the iPhone handles scrolling until I recently had to implement it myself. I needed to add vertical scrolling to a UIView that models a real-life metaphor. In my particular case I feel using a UIScrollView would break the metaphor - the user would “snap out” of the immersive app and realize they’re merely using an iPhone app with a pretty skin. So the natural solution was to implement scrolling myself. This is how it went from simple, unnatural scrolling to its current state of acceptable inertial scrolling.
‘Hello, World on the iPhone’
Yesterday I started learning how to write applications for the iPad and the iPhone. There are so many books that promise to teach you everything you need to know that picking one or two (or three) can be very difficult. While I normally like to learn new skills by reading a good book, I think for iOS development a more dynamic source would be a better choice.
In Search Of A Good Alarm Clock App
When I recently switched from the iPhone to HTC Evo running Android, I found the Evo’s Alarm Clock app surprisingly primitive. When I had multiple alarms set, it wouldn’t sort them by the time of day. Predictably, I started looking for alarm clock apps online, but the others were even more primitive. One was so bad that once the alarm went off, there was no way to turn it off other than rebooting the phone.
Processing A List Of Files In bash
When you’re working in Unix or Linux or even Mac OS X, there are often times when you need to apply the same command to a list of files. In this post I’ll show you a couple of quick ways to do this using the bash shell.
Backing Up Data With rsync
In a earlier post I wrote about how important it is to have your data backed up. On my Macs, my main backup utility is Time Machine, which comes pre-installed with the Mac OS. Time Machine can also back up external hard drives, even though it may not be obvious how to do it. This article shows you how to change the default settings to do this.
Google Now Considers Website Speed In Its Ranking
Google reported yesterday that their search engine will now include a website’s speed in the list of factors it uses to decide how high to rank the site in its search results. In this post I consider what this means for web developers and what steps you can take to make your site faster.
Firefox Search Shortcut
Wow. This cool Firefox feature has been around since 2005, but I just found out about it a few months ago! I swear I haven’t been living in a cave all this time. So if you’re like me and don’t know about this yet, listen up: In Firefox, you can bookmark a search with a keyword, and then use that keyword in your URL entry field. As this article shows, you right-click on the input field and select “Add a Keyword for this Search.” This will allow you to bookmark the search and add a keyword. I usually use two letter keywords like ‘we’ for weather.com and ‘im’ for imdb.com.
TaskForest Write-up at SourceForge
SourceForge.net has a blog in which they feature a different hosted project every day. Today’s blog entry features my open-source job scheduler, TaskForest. I’d like to take this opportunity to thank SourceForge for their support of open source software.
Communicating During A Crisis
A few day ago the data center where I used to host my name servers lost its connection to the Internet for a very long time (almost 36 hours). Whatever the cause, the web, mail and application servers of customers big and small were dead in the water. There was no way to reach them via the Internet. The data center’s owner, who’s a friend of mine, was on the phone with his service providers, getting the issue sorted out. In the first 24 hours I sent him around five text messages and was able to speak with him a couple of times. However, many of his other clients couldn’t reach him, and some of them even called me asking if I knew what was going on.
The Performance Cost of Using WordPress
Happy with my experience with a custom WordPress installation for this blog, I decided to try using the blogging platform for the TaskForest website. The two main reasons were the ease of creating RSS feeds and the ability for users to comment on posts or articles. After a few days of tinkering around, I’ve come to the conclusion that, at least for TaskForest, WordPress would cause more problems than it would solve. Here’s how I came to that conclusion:
Don’t Submit Photos To Frommer’s Contests
I’m not a professional photographer. I’m merely an student of the art and science of photography. Sometimes I think of submitting my pictures to contests or for use by others - not for the money, but for the personal satisfaction. Now after reading this post by Bob Krist, I’ll make sure to pay attention to photographers’ rights when I submit my pictures anywhere. I will also refuse to buy any product from Frommer’s Travel Guides, and urge you to do the same.
David duChemin On Being A Professional Photographer
I recently discovered David duChemin’s blog. I’d like to share a couple of his posts with you. In ‘Just?’ he offers advice to people who consider themselves ‘just an amateur photographer.’ In his follow-up piece ‘Confessions of a So-Called PRO’ he serves up an ‘anti-pep-talk’ that demonstrates that professional photographers aren’t necessarily that different from amateurs like you and me.
Sometimes Text Files Are Better Than Databases
I remember in my first Computer Programming class in college, the instructors wanted to make sure we understood the concept of persistence by saving application data to disk. To keep things simple we would serialize data and save it to text files. Once we learned advanced concepts we migrated to using relational databases. As a professional, most of the apps I see use an RDBMS like DB2, PostgreSQL, Sybase or Oracle. Text files have been relegated to the simple homework assignments of Programming 101.
There are, however, many classes of applications for which text files are the preferred means of storing data. One of the main reasons is that when data is stored in a relational database, editing it is not a trivial task. A well-normalized database is not easily updated via an SQL command line. More often than not, a dedicated, graphical editor is needed to model the complex relationships.
Adding A Grid To Your Websites
The #grid website has a great tool for web designers -it “inserts a layout grid in web pages, allows you to hold it in place, and toggle between displaying it in the foreground or background.” Go to their website and have a look. It’s pretty impressive. Simple, but impressive. I think I’m gonna give this a shot for the next web site I design. I think it would be really useful in development, not as much in a production environment.
Willis Tower (Sears Tower)
The Most Dangerous Programming Errors
The Common Weakness Enumeration (CWE) has released their list of Top 25 Most Dangerous Programming Errors. This list and the explanations of the errors are very instructive and should help both novice and expert programmers. If you’re a developer, I strongly urge you to read this document and make sure you understand the concepts it covers.
The Tautline Hitch Knot
Humans have been using rope as a tool for thousands of years, even before we started recording history. Knots and rope-tying is one of the few technologies that have persisted essentially unchanged in all of the known human history. As you can imagine, there are different knots for different applications, and in this series of posts, I would like to share with you the knots that I’ve found most useful both at home and outdoors.
Navigating the Directory Stack in ‘bash’
If you’re like me, you spend a lot of time jumping from project to project in a Linux shell. I find that I have to switch back and forth between directories. The bash shell has commands to maintain a stack of directories. I’ve written some functions that use these utilities to make directory navigation easier. I’ve found these functions very useful, and perhaps you will too. Let’s see them in action first with some examples, and then look at the code:
‘Follow up: Google Admits Buzz Was Only Tested Internally’
In yesterday’s article about Google Buzz, I guessed that “the problem was that the population for whom the system was designed wasn’t necessarily the only population actually using the system.” I gave Google the benefit of the doubt:
I am certain Google tested their application thoroughly. They’ve been known to do extensive usability tests for the seemingly tiniest of changes to their web site. But even the most well-implemented tests are incomplete if they’re not performed on a statistically representative sample of the audience.
But today, the BBC reported that Google has admitted that they only tested Buzz internally, and bypassed their regular rigorous testing procedures — possibly in an attempt to get it out the door as soon as possible. I’ll let the pundits decide if it did more harm than good to the firm, but it’s a warning to other software developers: skipping testing can lead to embarrassing failures.
Sometimes Testing Isn’t Enough
In the first few days after the release of Google Buzz many people (including myself) criticized Google for exposing their users’ private information. This was a couple of weeks after Apple got a lot flak for their unfortunately-named iPad, and the same week that we heard reports of a woman who broke up with her boyfriend after finding some suggestive text messages on his cell phone - messages that came pre-loaded on the phone. I think that all these cases were not caused by a lack testing, but by testing the wrong audience. Let’s examine these three cases and see what we can learn from them:
Why Should I Use CPAN?
I came across some comments made about an open source program that I had written in perl. The user was complaining about how he couldn’t get it to install. The reason was that the program relies on other modules from the archive of open source perl software known as CPAN (Comprehensive Perl Archive Network), and one of them failed to install.
Camera Clock Correction After The Fact
I had this dilemma a few days ago: I had taken almost 4,000 pictures during a vacation 12 months ago. The vacation was in Asia (two continents over), and the time on my camera was wrong. I was importing the pictures into Adobe’s Lightroom, and wanted them to have the correct time just in case I wanted to know when in the day certain pictures were taken. I thought of looking for pictures taken during sunset, and then using solar calendars to figure out when sunset was at a certain landmark on a certain day of the year. But then I had a better idea:
What Is An F-Stop?
In a previous article we looked at how lenses work. We learned about the focal length. Today we’ll focus on camera lenses and what the term f-stop means.
The term f-stop is a ratio. It has no dimensions. You don’t measure an f-stop in meters, inches, kilograms or even degrees Fahrenheit. An f-stop is the ratio of two distances. It’s the ratio of the focal length of a lens to its diameter. In figure 1, the f-stop is f/d _where _f is the focal length and _d _is the diameter.
Dryer Lint Fire Starters
One of my favorite activities in spring, summer and even early autumn is sitting outdoors by a campfire. For safety reasons, outside my home I can’t make a campfire on the ground, so I use a standalone fire pit. The older children, as well as my nephews and nieces like learning how to start a campfire without matches. I usually use metal and flint.
Japanese Pull Saws
When I first started dabbling in woodworking at the age of 15, the only tool I used to cut wood was an old, rusted woodsaw. Every cut would start straight and true, but as I’d push the saw deeper into the wood, it would buckle and warp, my arms would get tired, and the cut would stray from the line. A few years ago I learned about pull saws and once I started using them I have stuck with pull saws for all my manual wood-cutting tasks.
Why Text Editors Matter
As of this past weekend it’s been fifteen years since I started my career as a software developer. With the exception of a few months here and there, I’ve spent all these years working on Linux or Unix-like operating systems. I’ve noticed that despite the wide variety of tools and applications I have used and continue to use, some key skills are always in demand in this field. One of these is mastery of a text editor.
Digitally Blending Photos With Adobe Photoshop
I’m interested in tinkering with High Dynamic Range photography, but before I get Photomatix, the software that’s recommended most often, I thought I’d try out a technique that’s a very crude approximation of HDR. It involves taking one image that’s underexposed, and one that’s overexposed, and merging them in Photoshop. The technique is described in this article at luminous-landscape.com. Essentially, you put the underexposed image in a layer above the overexposed one. Create a layer mask on the darker layer, and copy the brighter image to the layer mask. Apply a Gaussian blur to the layer mask, and you have your blended image.
How Camera Lenses Work
This is the first in a series of blog entries on photography. Today we look at one of the most critical parts of any camera - the lens.
Have you ever noticed that people can run faster on flat ground than on sand or water? It’s the same way with light. Light travels faster in air than in glass.
‘Are You With A Newspaper?’
Cleaning Up After Others
This boat looked out of place on the Khalid Lagoon by the Al Buhaira Corniche in Sharjah. It was too small to be a water taxi, and too drab to be for tourists. As I approached it, I realized that its purpose was to pick up all the garbage floating in the lagoon. It was full of soggy plastic bags and other detritus. I’m glad I wasn’t close enough to smell it.
A Lucky Shot
This picture was taken on my walk along the Sharjah Corniche on January 6th 2010, shortly after dawn. I framed my shot carefully, right in front of the minbar, to exploit the symmetry of the building. As I clicked, I noticed a blur as a cyclist strayed into my shot. I had just enough time for one more shot before he left, and this second shot is what you see here. I think the lucky addition of this man into the frame makes this a better shot than the one I was planning.
1/50 sec at f/4.5 :: 22mm focal length :: ISO 400
What To Do When Your Mac Is Temporarily Disabled
Last night my Macbook Pro would not wake up from sleep. After jiggling the mouse and hitting the space bar a few times I powered it down. I powered it back up, and I could hear it booting up, and could feel the hard disk move, but there was nothing on the screen. After a little Googling I suspected the video driver was dead.