Monday, October 15, 2012

Fast Forward

Fast Forward is a initiative/project that I cooked up & named while reading Startup Communities by Brad Feld. I'm still reading through it by the way.
With Fast Forward, the local talent from Oklahoma City's tech community will be invited to participate in a three-week program where aspiring founders will pitch their ideas to these skilled individuals. Folks will be free to join any team, as they see fit to invest their time.
  • What's in it for the aspiring founders? How do you qualify as one?
    • The What
      1. Team Building - Every good startup needs a great set of people behind it. Contacts made at Fast Forward should serve to provide direct access and future leads to talented people.
    • The Who - Pitching directly to folks that have the skills needed to help you make your startup ideas into a reality is good enough to qualify as an aspiring founder.
  • What's in it for the talent? Who exactly are the participants?
    • The What (updated: Oct 30, 2012)
      1. Job Opportunities - Fast Forward should serve as proving grounds where your work speaks for your skills.
      2. Wet Feet - Its tough to understand the nuances of the startup scene. Even more so, for folks that have gained experience with the status-quo workforce and aren't quite sure if they have the kind of high-risk, high-reward appetite required for staying motivated through a startup. Worse still, most people undersell themselves and are convinced that they wouldn't be able to make the cut or learn new thing fast enough. Participating in the 3-week cohorts, should help talented people get acclimated.
    • The Who - Designers, developers, students & anyone willing to work and provide meaningful leverage to those pitching their ideas.
  • When do the investors march in? (updated: Oct 30, 2012)
    • I hope to network and actively bring in other Entrepreneurs as leaders to help run Fast Forward and with them should (no doubt) come their extensive network of backers to tap into. B U T keep in mind that Fast Forward has the goal of NOT taking a cut out of anyone's pocket. So there should be a clear separation between what the program does and the leads that aspiring founders follow up on.
    • Oklahoma City is fortunate to have accelerators like Blueprint for Business (BP4B) and VentureSpur in place. Fast Forward graduates should be able to carry their momentum forward by applying to such great programs. (DISCLAIMER: There is no affiliation between the accelerators and Fast Forward as of now. I'm just mentioning them because they exist.)

Thursday, August 30, 2012

Prioritize ethernet over wifi in macbook air

  1. System Preferences > Network
  2. Simply drag & drop to reorder

Monday, August 20, 2012

Recovering Git Projects from Time Machine

  • Recently I lost my development machine due to an upgrade to Mountain Lion. Sadly I had not backed up before performing the upgrade but I did backup before taking the machine to have its OS fixed. Even after three trips to the Apple Store's "Genius Bar" ... it continued to be an epic failure because recovering from the time machine backups yielded the same unusable experience once again.
  • I decided to recover the data piece by piece starting with my Git projects. I loaded the time machine file as a hard drive and copied the projects whole by dragging & dropping them into a similar file system location.
  • But when I performed a simple integrity check such as "git status" it led to messages like: "fatal: Not a git repository git repository"
  • Some basic searches led me to realize that I had to take a closer look at the .git directory in question:
  • First thing I realized was that my submodule that was causing trouble did not have a .git directory but had a .git file instead! Inside this file was a gitdir key and a path which redirected to a location in the parent git project.
    gitdir: /Users/olduser/gitProjects/myParentProject/.git/modules/myChildProjectModule
  • Afterwards, the solution was simple. The path for gitdir had an old username in it, which did not represent the current folder structure. Simply correcting the username in the path of the recovered file to the current one, fixed the issue.
    gitdir: /Users/currentUser/gitProjects/myParentProject/.git/modules/myChildProjectModule

Tuesday, August 14, 2012

Replacing X11 with XQuartz on Mountain Lion

  1. It is a bit of a surprise to realize that X11 is missing from your system after an upgrade to Mountain Lion. Apple does a good job of pointing the user to XQuartz but something critical is lacking!
  2. Apparently the installation (X11 2.7.2 - 2012.06.01 - First release supported on Mountain Lion) needs to be run twice in order for it to be successful.
  3. The first time it asks for a system restart after which the programs which are supposed to pick-up on and start using it are still asking dumb question like "Where is X11?"
  4. If you run the installation a second time though, it will now place an app called XQuartz in your system and you can launch it from Spotlight.
  5. Afterwards, you are no longer asked the question: "Where is X11?" ... the dependent applications simply work :)

Thursday, August 9, 2012

Upgrade mountain lion, macports, xcode (4.3 to 4.4)

Upgrade Eclipse to WTP

  • Upgrading eclipse to its WTP (Web Tools Platform) counterpart can often be quite a painful process as you can run into compatibility issues when Eclipse is done calculating the dependencies. Often when this happens its an indication that you need to figure out the exact release of your Eclipse installation and then add the corresponding WTP url that will allow for downloads matching that version.
  • I went to look in the About section of Eclipse but that only told me Eclipse SDK Version: 3.7.2 and I didn't find that very helpful for Google searches. But then I noticed that on the splash page, which launches before Eclipse comes up, it said Indigo.
  • This quickly led me to perform a Google search and add the appropriate URL http://download.eclipse.org/webtools/repository/indigo/ for downloading and installing WTP platform. Afterwards with only that URL selected as the repository for the upgrade, there were no dependency errors at all :)

Wednesday, July 18, 2012

Scan line indicator for ZBar overlays

Zbar is a great tool but I often struggle with adding intuitive graphics to the overlay screens in order to clue-in the users to the fact that scanning has already begun in video mode and they just need to point their camera at a barcode. To that end, I've decided that a red colored line dragging up and down on the screen is a great way to get the point across. And the code applies to any scanning framework that lets you mixin an overlay, not just ZBar.

Friday, June 15, 2012

How to use named functions with Async waterfall in node.js

Lets start with a real world example where you want to create a user in CouchDB. This is a two step process that involves asking for a unique uuid and then creating a user based on that.
  • The following code (+/-) abstracts out each individual step:
  • But once you have the abstracted methods, how do you chain their results? This is where the waterfall approach from the Async NPM package comes in.
  • Since you've already abstracted your methods, you may try something like this (+/-) to make them a little more waterfall friendly:
  • And then you may try the simplest way you can think of asking waterfall to run:
  • But that will fail to run because the syntax of the sentence has ended up being written in a manner where callback must be a variable that is already defined and ready to be used. Making an anonymous method here and bringing up the entire code bodies of the abstracted named-methods would defeat the readability and reuseability that we have been trying to achieve. Here's a tweak that will make it happen:

Sunday, April 29, 2012

Life after rm -rf

You just ran rm -rf ... for the ump...zillion...th time in your life and guess what, today you mistyped!!! What to do?
  • Identify your OS and see if there are proper recovery tools
  • Linux?
    • You're fudge'd! but there is hope ...
    • Do NOT quit your session (bash session, terminal window or remote ssh session), do NOT quit/exit it.
    • Use the history command and recreate your .bash_history file:
      history | cut -c 8- > ~/.bash_history
    • Use your wisdom of the ages to go through the compacted version of your history and recreate whatever you can.
      cp ~/.bash_history ~/.bash_history_backup
      awk ' !x[$0]++' ~/.bash_history > ~/noDuplicates
      mv ~/noDuplicates ~/.bash_history
    • If you were on an AWS image, rejoice! It will at least partially recover the basics of your home (~/) directory.
    • Set up daily snapshots and backup processes into place.
  • Mac?
    • There are some decent recovery tools like MacKeeper but chances are that by the time you download it, you'll end up overwriting disk sections that you wanted to recover.
    • Know when to give up on a lost cause, get out your blanky, assume the fetal position, suck on your thumb and cry to momma.

Tuesday, April 24, 2012

Securing ElasticSearch for direct access via a Jetty plugin

  1. The elasticsearch-jetty plugin can be used to secure an ES instance for direct access.
  2. If the first wall you hit, happens to be a "gap" in Jetty know-how then refer to the following to get up to speed:
  3. Next, you may struggle with your wish for Jetty to be super-secure vs. how to make it happen:
  4. Getting a CA-signed cert is always such a pain so if you can re-purpose an existing one ... great!
    • Need to perform some transformations on the available keys & certs? You may refer to http://www.sslshopper.com/article-most-common-openssl-commands.html ... I found the following instructions provided there to be particularly useful:
      Convert a PKCS#12 file (.pfx .p12) containing a private key and certificates to PEM
      openssl pkcs12 -in keyStore.pfx -out keyStore.pem -nodes
      You can add -nocerts to only output the private key or add -nokeys to only output the certificates.
    • Using Portecle (wrapped with Jar Bundler) or KeyStore Explorer works well too.

Wednesday, March 28, 2012

Wrong Archive - "ios app archive" vs "generic xcode archive"

  • Everything in your life was fine and then one day when you decided to Archive your Xcode build as usual ... BAM! ... out of the blue, the end result turned out to be weird / different one than usual.
  • It almost seems wrong and on closer inspection you can surely tell that what used to work
    • had the archive type "ios app archive"
    • whereas the newer strange build results has the archive type "generic xcode archive"
  • The reason this is happening is because you've added a new framework(s) for which you need to edit the Target > Build Settings and set the Skip Install setting to Yes. Afterwards the "Archive" process will start producing normal end results again.

Monday, March 26, 2012

How to combine: IrisCouch to CouchCocoa to RestKit to CoreData to TouchDB?

  1. MagicalRecord has good reputation as a framework that further abstracts CoreData goodness. So when thinking about the "RestKit to CoreData" piece, it is only natural to get excited about news like: RestKit is built, in part, on top of MagicalRecord !!!
  2. CoreData is desirable because of classes like NSFetchedResultsController.h which help to efficiently manage the results returned from a Core Data fetch request. Have a look at the comments for that class and it makes its own usefulness painfully apparent.
    • Now CoreData is built upon DataSources such as SQL-lite so I feel that there is an inherent difference in the query language of CoreData which has been written for relational databases versus nosql DBs like CouchDB … but I could be wrong about this and need to collect the opinions of others in the dev community on this matter.
    • If all I'm worried about is the smoothness with which a UITableView updates when used solely against an embedded CouchMobile/TouchDB/SyncPoint instance then I should get and see what it the user experience for the GrocerySync app feels like.
      • Look at CouchUITableSource
      • Based on https://github.com/couchbaselabs/TouchDB-iOS/wiki/FAQ:
        • Couchbase Mobile 2.0 is implemented in an interpreted language (Erlang) whose runtime library needs to be bundled in. This make me think that IF CouchCocoa is the client interfacing with it then CouchUITableSource ends up helping out the same way as NSFetchedResultsController.
        • TouchDB is inherently different because it’s using SQL for storage, rather than a custom append-only B-tree implementation. Does this mean that it far better suited for a head on CoreData integration + optimization? *Shrug* ... anyway CouchUITableSource is still there to help for now.

Upgrade from Xcode 4.2 to 4.3

  1. After installing Xcode 4.3 via the App Store you may feel like you're finished.
  2. But the process is not yet complete and you'll be surprised if you keep using the Xcode icon in your dock to launch, as there will be no apparent changes to Xcode.
  3. As pointed out in this blog, the key is to continue the installation process by opening the newer Xcode via Spotlight. Once the additional components installation is finished, you will have the option to uninstall old Xcode installations like 4.2, which you should most definitely make use of!
  4. Afterwards if you make use of the agvtool, and you run into some problems because of cornercases that the installer does not address ... you could have used instructions from http://doronkatz.com/upgrading-to-xcode-43-and-solving-the-develop ... but they seem to have been taken down :(
  5. If you are facing problems with MacPorts, then that may be because:

Saturday, March 24, 2012

AuthNet iOS Integration Part 2

There are quite a few gaps in the sample code provided by AuthNet, we will discuss the logs indicating the problem and what chunk of code needs to be added/removed to get to a complete sample that works. This blog entry assumes that you've cleared the challenges of adding AuthNet binaries to your Xcode project. If not then have a peek at AuthNet iOS Integration Part 1 before continuing.
  1. Create a header & an implementation class containing the sample code
  2. If you happen to be using PayPal as well as AuthNet in your code then you may run into some syntactical problems. To resolve any such issues, please have a look at this post on stackoverflow.
  3. When substituting values in the code, if you provide the "API Login ID" and "Transaction Key" as the name / password values in your call to AuthNet then you will run into the following error as seen in the logs:
  4. This fails as password and transactionKey are distinctly different variables in the header files.
  5. So make sure to substitute the sample code with the username and password used with https://developer.authorize.net/ or https://test.authorize.net/
  6. If you run the code at this point and end up calling loginToGateway, you will run into the following error logs:
  7. This is not the same as being at the point where you simply need to login to the sandbox (https://test.authorize.net/) and enable the new device. No, this is very different and you need to get past this to get to the next point. So you need to add some additional code which is talked about on the forums as well:
  8. Now you should be at a point where running the code results in the following error logs:
  9. This is more like it! So head over to https://test.authorize.net/ and enable your new device. Here are some screenshots: screenshot_1 and screenshot_2
  10. Sadly we aren't done yet, we see a message about the mobile device being ready for use but we also notice that the sessionToken has come back as null and therefore the next call's response displays an error ... claiming that the request content was incomplete:
  11. Even I don't have a solution past this point, feel free to follow this forum thread for any progress on the matter.

AuthNet iOS Integration Part 1

  1. You can start with the official instructions to get an account with Authorize.Net and download their iOS SDK. Afterwards the instructions are bit out of date, so you can follow along below.
  2. After you download and unzip the SDK, you can move the files around to have them structured in this manner:
  3. The structure above has the following pros:
    • Clarity around which version has been downloaded and in use at any point of time: anet_ios_sdk-X.X.X
    • If you work long enough to have multiple versions, then having them in your repository (assumption - GIT repo) helps figure out any migration issues
      • $(SRCROOT)/anet_ios_sdk-1.0.0/ANMobilePaymentLib/
      • $(SRCROOT)/anet_ios_sdk-1.0.1/ANMobilePaymentLib/
      • $(SRCROOT)/anet_ios_sdk-1.0.2/ANMobilePaymentLib/
      • ...
      • $(SRCROOT)/anet_ios_sdk-X.X.X/ANMobilePaymentLib/
  4. Goto MyProject > Targets > Build Settings in Xcode and set:
    1. Header Search Paths
      1. "${SDK_DIR}"/usr/include/libxml2
        • Mark the Recursive checkbox as checked
      2. "$(SRCROOT)/anet_ios_sdk-1.0.0/ANMobilePaymentLib"
    2. Library Search Paths
      1. "$(SRCROOT)/anet_ios_sdk-1.0.0/ANMobilePaymentLib"
    3. Other Linker Flags
      1. -lxml2
  5. Drag & Drop the ANMobilePaymentLib.xcodeproj file from a Finder window into Xcode under MyProject.
    • If you don't follow this step then you will face compilation issues like:
  6. Goto MyProject > Targets > Build Phases in Xcode and set:
    1. Link Binary With Libraries
      1. libANMobilePaymentLib.a
  7. For a discussion on the fixes to the sample code, head over to AuthNet iOS Integration Part 2

Wednesday, March 21, 2012

Bamboo Pen Tablet + Mac + InkScape

  • First of all this video made all the difference in the world in terms of getting the bamboo tablet device to do what I wanted it to do once I to understand the pen (absolute) mode versus the mouse mode.

Friday, March 9, 2012

Tweeking Lion OSX for Inkscape

  • In order to use the keyboard and move around the canvas, you will need to disable the default mapping for the 'ctrl' + 'arrow' keys.
  • PageUp and PageDown for bring to front or send to back will be:
    • 'fn' + 'up arrow'
    • 'fn' + 'down arrow'

Tuesday, February 28, 2012

IrisCouch and CouchCocoa

  • Here's some sample code that can be thrown directly into your iPhone application's application:didFinishLaunchingWithOptions: method, in order to perform a basic connectivity test for your IrisCouch domain.
    • You may refer to this post to get CouchCocoa into your iOS project.
  • If you see error messages such as the following in your Xcode console then you are well on your way:
  • As mentioned by in this thread, simply make the following changes to your IrisCouch domain:
    • Go to http://mydomain.iriscouch.com/_utils/
    • Log into your account
    • Click “Configuration” in the sidebar
    • Click “Add a new section” at the bottom
    • Fill in
      • section: httpd
      • option: WWW-Authenticate
      • value: Basic realm="administrator"
  • It should work well now and after you spot the following logs, you can go confirm that a new database has actually been created on IrisCouch via your /_utils/ web console.

How to use the ElasticSearch Query DSL

I'm also in the process of developing an ElasticSearch Client based in Objective-C using RestKit, feel free to have a look & use it ... and shoot me an email if you want to contribute: https://github.com/pulkitsinghal/ElasticSearchClient

Wednesday, February 22, 2012

CouchCocoa - An iOS client for working with CouchDB

CouchCocoa is a framework / library for iPhone use that abstracts out the work needed to talk to CouchDB instances running on the web or on the device itself. If you want to jump right into the setup for a simple project, then simply follow these steps:
  1. Add CouchCocoa as a submodule to your project:
    • cd ~/dev/myProject/
    • git submodule add git://github.com/couchbaselabs/CouchCocoa.git
  2. Get all the dependencies of this submodule itself:
    • cd ~/dev/myProject/CouchCocoa/
    • git submodule update --init --recursive
  3. Drag & drop CouchCocoa's .xcodeproj file under your own project in Xcode
  4. Add the following as your target's dependencies so that they will get built:
    • iOS Framework (CouchCocoa)
    • iOS Library (CouchCocoa)
  5. Add the following in "Link Binary With Libraries" for your target:
    • libCouchCocoa.a
  6. Add the following in "Header Search Paths" for your target:
    • "$(SRCROOT)/CouchCocoa/Model"
    • "$(SRCROOT)/CouchCocoa/REST"
    • "$(SRCROOT)/CouchCocoa/Couch"
    • "$(SRCROOT)/CouchCocoa/UI/iOS"
  7. In Xcode, select CouchCocoa.xcodeproj in the Project Navigator and edit the Target > Build Settings and set the Skip Install setting to Yes.
  8. If at a later point of time you realize that you want to work with TouchDB as well then you *may* need to update your CouchCocoa submodule and bring it up to speed:
    • cd ~/dev/myProject/CouchCocoa/
    • git checkout touchdb
    • git pull origin touchdb
If you have any problems, post your questions on the google group for mobile couchbase.

Aside from the process there are some "big picture" points to consider:
  • CouchCocoa can talk directly to CouchDB (or CouchBase - a more performant variant). For example, if you use the hosting services provided by IrisCouch, you can configure CouchCocoa to work directly with that Couch server.
  • CouchCocoa can work with an embedded version of CouchDB on mobile devices.
    • TouchDB is one such implementation which is lightweight and exists for iOS and Android mobile devices.
      • For iOS however, I do find it a bit confusing when I think about how to structure my project, there are two ways to do it:
        • Build and soft-link the TouchDB framework. And use CouchCocoa as a submodule as outlined earlier in the blog.
          • If you choose to use TouchDB-iOS as a submodule as well then don't forget that TouchDB's itself also needs a soft-link to CouchCocoa.framework:
            cd ~/dev/superProject
            ln -s ./DerivedData/superProject/Build/Products/Debug-ios-universal/CouchCocoa.framework ./TouchDB-iOS/Demo-iOS/Frameworks/CouchCocoa.framework
        • Syncpoint-iOS which bundles TouchDB and CouchCocoa together but lags behind the individual projects in terms of stability and features. To experiment with it, you can follow a this discussion thread where it was introduced to the community.
      • Another huge pain-point is the fact that for all of GitHub's glory it doesn't let me search for content in wiki pages so when it comes time to try out the infamous Grocery-Sync example, I'm left wondering where to look! This relative path should shed some light I hope: TouchDB-iOS/Demo-iOS/DemoAppDelegate.m
    • Couchbase Mobile is another implementation. Recently it has seen some serious progress in terms of tutorials (one & two) and example-code covering its usage.