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’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.
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.
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.
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.
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.
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.
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.
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:
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:
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.
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.
[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.
[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:
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.
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.
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.
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.
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 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.
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.
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.
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:
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.
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.
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.
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:
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.
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:
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.
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.
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.