Flaviu's Blog - Read'n'Code

Prufrock’s Startup Observations

Let us go then, me and I,
When the seed stage stretches out against the sky
Like a student etherized
By college education;
Let us go through certain half-deserted meetups,
Twitterring retweets
Of restless nights in one night cheap hotels
For sapless conferences we pay to pitch
The uninformed bravado comments
Of insidious intent
To lead you to an overwhelming question…
Oh, do not ask, “Is it on Android?”
Let us go and build our product.

In the room, associates come and go
Talking of startup deal flow

And indeed there will be time
To wonder “do I dare?” and “do I dare?”
Will I make your partners billionaires?
With a three to five year plan that scales—
(They will say “His distribution channel’s thin!”)
My user base, my cost to bring them in
Retention rich and modest, but engagement like LinkedIn.
(They will say, “How his team is very green!”)
Do I dare
Disturb the universe?
In a minute there is time
For the pivots and re-pivots that a board room will reverse.

In the room, associates come and go
Talking of startup deal flow

For I have emailed them already, boomeranged them all:
Jigsawed sales in evenings, mornings, afternoons,
Burn rate measured out in coffee spoons.
I know the startups dying with a dying fall
Beneath the Entrepreneurship Thought Leaders
and the Calacanis from a farther room.

And would it have been worth it, after all,
Would it have been worth the opportunity cost,
After the Series A round, and the B
After preparing the report, after the board room scuffle
And this, and so much more? —
It is impossible to sell just what we have!

But as if a magic CFO threw revenues in patterns in Excel:
Would it have been worth the license
If one, boarding Virgin Airlines, or checking in the W,
And turning towards the black car, should say:
“That is not it all,
That does not scale, at all.”

No! I am not Mark Suster, nor was meant to be;
Am an un-blogging soul, one that will do
To send a term sheet, book a flight or two,
Advise the founder; no doubt, an easy tool,
Deferential, glad to make an intro,
Visionary, skeptic, and meticulous;
Full of disruptive revolution
At times, indeed, almost ridiculous
Almost, at times, the Foo.

A Viewpoint on Startup Accelerators or the New MBA

The stats above are from Seed-Db.

A year go, my startup (iMedicare) joined RevTech Labs, a tech startup accelerator in Charlotte, North Carolina. We still hadn’t launched the product and we knew a handful of people in the industry, through the Python Meetup I organized, and where I met .

Packard Place and RevTech Labs gave us free space for 3+ months and introduced us to our current lawyer, , , a business development expert that helped us (introverted tech guys) generate our first sales, and many other great advisors. We met 100+ people in 3 months.

These advisors offered us the chance to exhibit at the Huffington Post event around startups at the Democratic National Convention. There, we met one of the leading healthcare accelerators: Blueprint Health. After applying on a whim with a video done during a break from coding at 3:40AM, we got in.

So, in January, we moved to SoHo, New York City to participate in the third class of Blueprint Health. The 3 months of the program were the least amount of sleep I have ever gotten in any 6 month stretch of my life. We met 500+ healthcare industry advisors, entrepreneurs, and investors in 3 months.

Every program mentor introduced us to someone relevant for our business or gave us very useful advice going forward. Some questioned the business’ entire premise and some thought we should go in 10 other directions. We learned how to focus on our business and eliminate all distractions. This has been the most valuable lesson of all.

Preparation for demo day taught us how to present in front of 500 investors with diction, persuasiveness, and pizzazz. Without any control over the slides!

Now, we just finished raising a round of seed financing,hired a full-time Director of Business Development and are growing the company to the next level. But I wanted to take the time and recognize that we could not have done what we’ve done so far without all the help we’ve gotten along the way from both the Charlotte and New York City startup communities.

For me personally, each accelerator was a 3-month MBA program, that made me a better entrepreneur and more likely to succeed. Time will tell.

RestKit 0.20 : No Response Descriptors Match the Response Loaded

Well, as the error message in XCode and as Blake Water explains in this github issue the paths don’t match.

It’s especially subtle when you have a get parameter, like I did:

1
2
NSString *resourcePath = [NSString stringWithFormat:@"/counties_by_zip/?zipcode=%@", zipCode];
RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:[MappingProvider zipMapping] pathPattern:resourcePath keyPath:nil statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];

It turns out that if you have a parameter like that, your path needs to NOT include it, like so:

1
RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:[MappingProvider zipMapping] pathPattern:@"/counties_by_zip/" keyPath:nil statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];

That’s it folks. 2 hours of my time. It’s yours.

Paragraph Tags in HTML Email From iOS Makes PDF Attachment Not Show Up Outside of iOS

Here’s a standard way to send an HTML email with a PDF attachment from iOS:

1
2
3
4
5
6
7
8
9
10
11
12
// add the attachment
[mailComposer addAttachmentData:myData mimeType:@"application/pdf" fileName:@"comparison.pdf"];

// Fill out the email body text
NSString *emailBody = @" \

Bla bla bla.

\
\

See comparison attached.

\
"; [mailComposer setMessageBody:emailBody isHTML:YES]; [self presentModalViewController:mailComposer animated:YES];

You will be happy when checking the result of this on your iOS device. However, when you check it in Gmail, it looks like this:

What? Why? I don’t know!! What I do know is that it works if you put br tags instead:

1
2
3
4
5
6
// Fill out the email body text
NSString *emailBody = @" \
Bla bla bla.

\
\ See comparison attached. \ ";

Now it looks as it should:

So, the lesson is: WTF?!

Architecture Saturday Part 6: Industrial and Mechanical Age

The Crystal Palace above is the pantheon of the Industrial Revolution. Built in 3 days without a scaffold by unskilled workers, it was scorned by architects for invalidating their existence.

But come on, as Wayne says in Wayne’s World, “we fear change.” Just look at Paris’ Bibliotheque Nationale:

It has 9 graceful (Pantheon-like) domes inside of it. Who wouldn’t want to read day and night in there?

I won’t even mention Grand Central Station, since we’ll cover the US a tad later in the post.

Of course, for every action there is a reaction (Newton’s 3rd law of motion). So, some architects tried to bring about a Gothic Revival:

And then there was the decadence from the obscenely wealthy, like Ludwig II, the crazy Bavarian King that built himself a copy of the Versailles and this little Summer house:

My favorite designer of this period is William Morris, who mostly made wallpaper and interior decoration, and said wise things:

Have nothing in your house that you do not know to be useful, or believe to be beautiful.

The US began leading the charge with Chicago’s Reliance Building (1895):

The reason Chicago became an architectural center was in part due to the 1873 fire that burnt many buildings in Chicago and allowed architects to innovate in the rebuilding process.

Also, you know those designs you see in every bank and skyscraper building? Like this one:

That, sir, is called Art Deco. An even more famous example of Art Deco inside and outside of a building is the Chrysler Building:

Richard Wright also lived in the same time period and everyone now loves him because of that house on the waterfall. Well, you know what? Richard Wright also designed this prison look-alike:

Oh, and this:

Ok, he was a genius, but come on, what is that thing?

To end on a positive note, Antoni Gaudí is awesome. Barcelona claims him as a Saint, but the Pope won’t recognize him as such until there are two miracles to his name. I propose these two:

One day, Antoni stepped back to look at a tower in the Sagrada Familia, and got hit by a tram, where authorities mistook him for a tramp.

Three days later, Barcelona came to a halt for his funeral procession.

How to Write a Multi-line NSString in Objective-C

Say you have some HTML you need to cram into a WebView in iOS. You can create a .html file but then you can’t pass variables from your code.

So, you try inlining it. Except you find out that Objective-C does not have like a triple quote or some other multi-line escaping.

You need to end every line with a backslash. So, this code:

1
2
3
4
5
6
7
8
9
10
11
12


  
    </span>U.S. Population<span class="nt">
    
     type="text/css" rel="stylesheet" href="population.css"/>
  
  
     id="chart">
    
  

needs to become this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
@" \
 \
 \
 \
U.S. Population \
 \
\"text/css\" rel=\"stylesheet\" href=\"population.css\"/> \
 \
 \
\"chart\">
\
\ \ \ "

You don’t want to do that manually. So I made a little tool that converts one to the other. Check it out at MultiLineObjC.herokuapp.com.

Hope this saves you some time.

Architecture Saturday Part 5: Neoclassical

Sometime in the 18th century, architects reacted against the Rococo (previous blog post) and turned towards the classic Greek and Roman styles with a touch of Renaissance (Andrea Palladio).

Andrea Palladio is the most influential architect ever, with an architects fanclub started long after his death called “The Palladians.”

Actually, one could say that the official architecture style of the United States is “Andrea Palladio”. Thomas Jefferson got a crush on it when he was an ambassador in France. Snobs call it “Classicism.”

Here’s Palladio’s “Villa Rotunda”:

Here’s Jefferson’s home (Monticello) near Charlottesville, VA, which he architected:

Jefferson also designed University of Virginia’s Library after the Roman Pantheon:

Hell, even the White House, Lincoln Memorial, and the Capitol were greatly influenced by Andrea Palladio (not to mention every upscale neighborhood).

Neoclassical also made some advances in garden design, from the stodgy, perfect-looking Versailles garden, to the English Garden designed by Charles Bridgeman:

Bridgeman invented the “ha-ha” which, besides being the coolest Architectural term ever, serves as a trench that you do not notice from a distance, but that keeps neighbors’ animals from wandering in your really expensive garden:

The Neoclassical era was also a time of Napoleonic grandeur and aspirations of taking over the world. No wonder Etienne Louis Boulle designed this thing:

St. Pancras in London even made caryatids as columns coppying the Caryatid Porch of the Erechtheion on the Acropolis at Athens:

Of course, no one really knows what purpose these maidens served in the original architecture. But they look cool.

The Germans stepped up their game during the Neoclassical period by building things such as the Brandenburg Gate in Berlin, built originally as a sign of peace, but came in handy during Berlin’s devided political struggles:

Karl Friedrich Shinkel designed the gate and many other museums in Berlin that look like the Parthenon.

Perhaps the most innovation in the Neoclassical period came from Russia, where Catherine the Great began the Hermitage as her personal art collection:

Despite “hosting” Napoleon in Moscow for a little while, the Russian elite spoke French and their imperial architecture was greatly influenced by the French gentleness:

The Value of a College Education

A few weeks ago 60 minutes did a segment on Peter Thiel, the Paypal/Facebook billionaire that gives $100,000 to kids under 20 to quit college and build startups.

Thiel, I should mention, is a graduate of Stanford Undergrad and Stanford Law School.

Glenn Beck, the eternally hallucinating talk show host, provides a simple solution for the $1 trillion of student debt in this country: Kids who can’t afford college shouldn’t go. Instead, they should “go to the free public library.” He gives himself as an example.

Also, student loans are a big presidential campaign issue that, oddly enough, the two candidates agree on a solution to: “we must do something to lower the cost of going to college.”

Meanwhile, NPR publishes the infogram below showing that the Net Cost of College (sticker price - grants and scholarships) has remained more or less the same over the years.

Ok, I get it. The cost of college is what we’re willing to pay for it. As long as people pay $62k to go to Harvard, Harvard will keep increasing its tuition. Basic Supply & Demand.

But what about Peter Thiel’s claim that education is a bubble and we are greatly overestimating the value of a college degree?

I know several people in their 60s that had a successful career without a college degree. Yet they all wished they had gone to college.

Take T. Banks, a friend who worked for BellSouth his entire life. He is a stellar electrician and had security clearance to work in the White House. However, when he is around “people with college degrees”, he feels inferior, and refuses to voice his opinions on anything, as though they were somehow less valuable that his Bachelors-holding friends’.

My point is that going to college is a decision that will haunt you for the rest of your life.

It’s not just a certificate or a piece of paper in order to get a job. For many, college provides the confidence and social skills to succeed in building relationships with others and pursue success in any profession.

While college may not have been greatly beenficial to Bill Gates and Mark Zuckerberg, think twice before you recommend that no one should go to college.

It’s often the ones who have gone to college (like Peter Thiel) or that were accepted in the top institutions and left to pursue their dreams (like Bill Gates or Mark Zuckerberg) that inspire kids to skip college.

The vast majority of 18-year-olds are not like Peter Thiel, Bill Gates, nor Mark Zuckerberg. They have much more in common with T. Banks.

Architecture Saturday Part IV: Asia

Everyone is special. The Mayans were the only literate people in Mesoamerica. They had the wheel, but did not use it to pull stuff. Instead, they literally broke their backs building this:

The Chinese had access to stone and the ability to build arches. However, they chose to use timber and perfect the carpenter’s art (part of the reason why “The Great Plains” are not “The Great Forest”).

Interestingly, they invented the Modular System, which specifies exactly how to space columns in Chinese Architecture.

Mean time, the Dalai Lama was chilling in this little home:

I think it’s really interesting the Japan shuts itself in for a century, and comes out with Noh Theatre (which is not related to NoSQL) and some of the most pristine architecture of all time. Meet the Himeji Castle:

It’s easy to judge China for their lukewarm support of human rights. It’s much harder to understand the isolationism and culture their beliefs are grounded in. However, architecture can provide a bathroom window into their collective psyche.

For instance, while the Romans protected their empire by building a top-knotch army and patrolling distant lands, China surrounded its empire with a wall you can see from space:

The good news is while we all have our bad apples, most people are like the Fonzie. Cool.

Take the Indian emperor Shah Jahan, who built the Taj Mahal in the memory of his dead wife:

I’ll end this spiritual blog post with a quote by Ashoka the Great:

It is forbidden to descry other sects; the true believer gives honor to
whatever in them is worthy of honor.

Create New Records With Bootstrap Modal and Rails Unobtrusive Javascript

I wanted the quickest way to get a nice looking modal popover, in which to create a new record, and after the modal dismisses, the new record to show up. All without the page refreshing.

And let’s throw in validations in the modal as well.

Say you have a simple model (Post) with some fields.

1
2
3
rails new flapp
cd flapp
rails g scaffold Post title content

Add client_side_validations to take care of validations for us (only gem we’re going to use, I promise…except haml-rails so you can actually read HTML)

Gemfile
1
gem 'client_side_validations'

Run the install generator for client_side_validations

1
rails g client_side_validations:install

Add the rails.validations.js to your layout

app/assets/javascripts/application.js
1
//= require rails.validations

Now, we need to download Bootstrap. I recommend customizing it with the cool things you want on this page. If that fails, the minified full version is only 48k. Make sure you copy the javascripts, css, and images into your assets directory accordingly.

We’ll just edit ‘app/views/posts/index.html.haml’ for this example so that it’s all in one file. However, it’s good practice to render each modal in a different file.

Change your ‘Add Post’ button to this:

posts/index.html.haml
1
%a{'href' => '#new-post-modal', 'data-toggle' => 'modal'}

The data-toggle tells Bootstrap this link toggles the modal. The href tells it the ID of the modal element it toggles.

Here’s our modal:

app/views/posts/index.html.haml
1
2
3
4
5
6
7
8
9
10
11
12
#new-post-modal{'class' => 'modal hide fade'}
  = form_for(Post.new, validate: true, remote: true, html: {"data-type" => :json}) do |f|
    %ul.errors
      %li
    .field
      = f.label :title
      = f.text_field :title
    .field
      = f.label :content
      = f.text_field :content
    .actions
      = f.submit 'Save'

The validate: true makes sure we use the client_side_validations we added earlier. remote: true tells it to use Rails’ Unobtrusive Javascript.

The html: {"data-type" => :json}) specifies that we want the controller to return JSON back to the view.

The classes (modal, hide, fade) declare it as a modal that is hidden at first, and then fades in.

With the latest Rails, we don’t need to change anything in the controller. Here’s what my create action looks like:

app/controllers/posts_controller.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
def create
  @post = Post.new(params[:post])

  respond_to do |format|
    if @post.save
      format.html { redirect_to @post, notice: 'Post was successfully created.' }
      format.json { render json: @post, status: :created, location: @post }
    else
      format.html { render action: "new" }
      format.json { render json: @post.errors, status: :unprocessable_entity }
    end
  end
end

The only thing we need to do is to make sure we are listening for when the JSON comes back, so that we can dismiss the modal, and show the new data.

app/assets/javascripts/posts.js.coffee
')
1
2
3
4
$ ()->
  $("form.new_post").on "ajax:success", (event, data, status, xhr) ->
    $('#new-post-modal').modal('hide')
    $('table tbody').append('
' + data.title + '' + data.content + '

In the case above, we dismiss the modal and then insert a new row in a table with the title and content of the post we just added.

I tried to keep this as simple as possible. Hope it helps.

Fork Flaviu on GitHub