Tuesday, April 17, 2012

How to create a hover intent function with Google Maps

Last week I wanted to fire a piece of code (div scrolling) when the user's mouse was hovering over a Google maps polygon. I got that working pretty easily with a simple Google Maps listener with the 'mouseover' event. Unfortunately, that created a different problem - if the user moved the mouse quickly over the map and crossed over many polygons, the div scrolling code I had within the listener was fired too much.

I ended up finding a jQuery plugin, hoverintent,  that only makes the call when the user's mouse is hovering over the element for a specific amount of time. This would have certainly done the trick on a DOM element but it wasn't going to work on my map when the polygon wasn't a DOM element, it was an overlay on the Google maps object. An even easier solution (no plugin required) emerged.

Javascript has a setTimeout() method that you can use to execute code in the future. So, in  my case, I set a variable, timer, to the setTimeout() method and the code I wanted called; I checked for timer when the user had the mouse over an element, if the timer existed, I set it to null and used the clearTimeout method and then reset timer to the a new SetTimeout. I added another Google Maps listener for the event 'mouseout' of the polygon and set timer to null while using the clearTimeout(). In this way, the div scrolling only happened when the timer reached a certain time, in other words, when the user's mouse was hovering over a polygon for  a certain amount of time.

google.maps.event.addListener(polygon, 'mouseover', function(event) {

            if (timer) {
              clearTimeout(timer);
              timer = null;
            }
//set timer so animation of scrollbar only happens when mouse is within polygon for longer than 500 milliseconds
        timer = setTimeout(function() {
            $('#side_content').animate({ top: -$('#div').top }, 300);
        }, 500);
});

google.maps.event.addListener(polygon, 'mouseout', function(event) {
          if (timer) {
            clearTimeout(timer);
            timer = null;
          }
});

Wednesday, April 11, 2012

Valley to Detroit

Detroit luring Silicon Valley professionals. What?!



The leaders behind the Detroit movement released this website on Monday, luring recently laid off Yahoo employees to Detroit where there are currently hundreds of technology jobs.
"Detroit is quickly emerging as one of the nation's best kept secrets when it comes to technology, Internet and mobile-related jobs," said Josh Linkner, CEO and Managing Partner of Detroit Venture Partners, a Detroit-based high-tech venture capital fund.  "We know that there is a great deal of talent inside of Yahoo – especially in marketing and web development, and we're encouraging those who have been impacted by job cuts to consider Detroit as the next stop in their career."
But it's not only about the jobs. As Bill Emerson correctly points out, taking a job in Detroit means seizing a unique opportunity that exists no where else in the country. The opportunity to play a pivotal part in reinventing an entire city.
"We are creating an exciting urban core for young, energetic and creative professionals who want to affect the outcome of an entire region," said Bill Emerson, CEO of Quicken Loans, who has consistently ranked in the top-10 of Computerworld's 'Best Places to Work in Technology' over the past decade.  "Not only does Detroit make for a great place to start or grow a business, but it's also a great option for those who want to be on the ground-floor of rebuilding and reinventing a great American city."
The Detroit conversation is changing from one of death to that of rebirth. Speramus Meliora; Resurget Cineribus (we hope for better things; it shall rise from the ashes)

http://techcrunch.com/2012/04/09/valley-to-detroit-motor-city-woos-laid-off-yahoo-employees/


Changing redirect after Devise signin

We use Devise to manage user sign authorization and authentication. This solution offers a lot of stuff for free, such as password resets and account confirmations, but it's also a little hard to navigate at first since most of the functionality seems hidden from view. Read up a little bit though and you'll find just about every customization you desire is written about on the Devise wiki, with instructions on implementation.

Yesterday, I customized the redirect after a user signs in. Initially, devise is set up to redirect to the root_url after sign in, but it's easy enough to override it by adding a after_sign_in_path_for(resource) method in the application controller. Because our signin "page" is actually a small menu that sits on every page, I wanted the user to stay on the current page after signin rather than be redirected to a specific page. For example, if a user is using our map and decides to sign in, I want that user to stay on the map after signin, not be redirected to a different page. Seems easy enough, and although it took me a little while to figure out a solution, the implementation for this functionality isn't all that hard.

The key for me was learning about Rails' request.fullpath, which will return path the user is on. (There is also request.uri, request.url, request.path, request.host and a few others). So, on my sign in form, I added a variable that I set to the fullpath returned from request.fullpath, and passed that variable to the user sign in path as a params. With that, I have the current page the user is on and can redirect them there after successful sign in.

<% current_path = request.fullpath %>
 <%= form_for("user", :url => user_session_path(:current_page => current_url), :html => { :id => "signin_form" }) do |f| %>


application_controller

def after_sign_in_path_for(resource)
 params[:current_page] || super
end


Sunday, April 08, 2012

Code Academy Interview

Check out a short profile of me on Code Academy's blog. Code Academy continues to grow and thrive, just completing their second class last week and pulling off a demo day with 500+ in attendance. Congratulations to the newest graduates and to the Code Academy program.

Learning Javascript

Though we're using Rails as our framework, Picket Report's code base is only 45% Ruby and 55% Javascript. I didn't have much experience with Javascript until the past month or so, and though the syntax is a little cumbersome at first, I've started to enjoy using the language, particularly creating and handling Javascript objects.

Most APIs that I've dealt with so far respond with JSON objects, but it wasn't until the last two or three weeks that I got more comfortable understanding how get to what I wanted within a response. Part of it was learning how to use console.debug() and thus being able to actually see the object and how it was structured, but most of my improvement can be chalked up to learning some basic Javascript - looping, if/then statements, creating objects for later use, etc.

A basic example from this past week. I created a marker ID object that kept track of each google maps marker on my map as well as a string of html content I wanted to appear in a map popup/infowindow when the user clicked on a marker. I organized the object by marker ID so that I could easily find that marker at a later point. I couldn't have done this a couple of weeks ago, and when it came together it was a nice reminder of how much I've learned and a big aha moment that seemed to open up a sense of possibility...


 markerIDObject[marker.__gm_id] = {};
 markerIDObject[marker.__gm_id].marker = marker;
 markerIDObject[marker.__gm_id].content = contentString;


 this.neighborhoodShowInfoWindowBounce = function(marker_id) {
    showInfoWindow(markerIDObject[marker_id].marker, markerIDObject[marker_id].content);
    markerBounce(markerIDObject[marker_id].marker);
  }


Friday, March 16, 2012

Coding!

While in Code Academy, we were really encouraged to blog at least once weekly about what we were learning. It was a nice marketing tool for them but it also served as a great way to track my progress and improve my understanding of general concepts. It was a worthwhile exercise and something I intend to try to keep up with now that I'm working on this stuff full time, improving my skill set and expanding my toolbox. The first 6 weeks have been awesome; I'm learning a lot.

Javascript - Though we use Ruby on Rails as our framework, the mapping feature is largely built in Javascript. Besides a few jQuery effects I managed to get working during Code Academy, I didn't have much experience with Javascript and even trying to read through our .js files was difficult at first. But over the last two weeks, I really feel like I've been starting to pick it up.

I'm updating our map using the Google Maps API which I've found to be a great way to start to learn. They have a ton of examples on how to build your requests and handle the responses, and if you can start to follow those, you're half way there. It's been fun figuring this out - I'm looking forward to using CoffeeScript next.

Chargify - It wasn't planned but I've ended up getting a lot of experience with different payment processors. I've used PayPal, Stripe, and now Chargify. We use Chargify to handle our subscription service to the Picket Report widget, and I found the API pretty easy to handle. It took me a while to handle the errors that Chargify sends back (turns out to just be an Active Record resource if you're working with the Chargify gem...you can use the .errors method and print them easily). Stripe is still the easiest and most elegant solution I've found, but it's nice to get some experience with a number of them. My main takeaway - avoid PayPal.

CSS - I spent the first month developing the front end of our site. I've picked up a lot of awesome tricks on styling and can handle the jQuery effects pretty easily at this point. It's this CSS/front end area that I think I've improved upon the most and feel pretty comfortable now saying that I can do just about anything I'd like to do in terms of making something look a certain way. This is a pretty sweet improvement over the Rails scaffolding CSS!

Thursday, March 08, 2012

Building While Driving

Last night I went to the GrowDetroit and DNewTech sponsored meetup at Ann Arbor's TechBrewery to hear Dug Song talk about his current company, Duo Security, and startups in general. When I first started talking to people about moving to the Detroit area, Dug's name came up in just about every conversation as a suggestion for someone to try to talk to. He's a driving force behind Ann Arbor's tech community, a serial entrepreneur with a very successful track record, and someone willing to share insight and advice to anyone looking. A couple of points that came up in his talk last night that I liked:

  • Working at a startup is like driving a car while you're building it. He mentioned this kind of casually during his talk, but it struck me as a perfect way to describe my short experience at PicketReport. We're pursuing several different opportunities and avenues for our products, and because most of them are unproven there's a constant feeling of and a repeated office refrain of "we'll just have to figure it out." And yet despite the unknowns you just continue to push ahead in a direction that, at the time, seems appropriate. You've got three tires and two less spark plugs than you need, but you figure out a way to keep driving, while building and improving as you go.
  • The westside of Michigan's history and track record in design. I tend to not think too much about the west side of Michigan, but Dug brought up a cool point last night while suggesting that Michigan has all the components of talent that you'd look for when starting most types of companies. Ann Arbor = software/tech, metro Detroit = manufacturing/advertising, and West Michigan = design. He reminded me of Herman Miller, the design company you can thank for cubicles (or blame them for your sterile office environment) and one of the most notable designers of modern style furniture (he also mentioned Steelcase). That history of design talent still exists in West Michigan and there's a deep bench of top notch digital designers to draw from.
Anyone looking to get involved with the area's tech community (or more generally, entrepreneurial community), should definitely pay a visit to the TechBrewery. They have a weekly open happy hour every Friday at their office. Also check out A2NewTech, DNewTech, GrowDetroit, and A2Geeks.

Wednesday, March 07, 2012

Inc. Magazine - Detroit!

Inc. magazine has a great spread of articles on Detroit and what is happening here within the startup community. I like the attitude of those featured in the articles as well as the attitude I've experienced throughout the region over the last month. We're here, we're not apologizing for anything, we have a very unique and exciting opportunity, we're confident we're creating something great. But they say this much better in the articles. Read up, come visit, get involved.


--------------------------------
"It's not 'What are we going to do?'" Tatoris says. "It's 'wow, I can't wait to see what Detroit is like in five years." For the folks who have seen Detroit rise and fall over the decades, the view from Webward Avenue is one a city on the move once again. "I just don't know where the tail end of that is going to be," Smith says. "But I'm going to like the ride."  
---------------------------------
"I'm going to be telling my grandkids about this five-year stretch when Detroit got back its mojo."
---------------------------------
Something Bigger: It's rare to be in the right place at the right time, but when you are, the sparks just seem to ignite out of thin air. At this moment, Detroit seems to be "right," as it's experiencing a truly fresh start through revitalization. It's not just an up-and-coming downtown center that's drawing talent; it's the chance to help change the landscape of a region that is in dire need of it and the opportunity to make a long-lasting impact.
---------------------------------
 "When there are doubters, you work a little harder," says Jake Cohen, Detroit Venture Partners' Vice President. "Just the other day, I was on the phone with someone from Sequoia Capital and he was telling me which industries were attracting money on the West Coast--like somehow I wouldn't already know. I think a lot of us have a chip on our shoulder here. People think that our start-ups aren't real, and that we don't know what it's like anywhere else--they think we just got stuck here. But there are a lot of people here who could be anywhere else. It's a choice."
----------------------------------

And though this isn't from any of the articles, it's one of my favorites and seems appropriate for this post (feel free to substitute Chicago with your city).
"Do you want to be another yuppie in Chicago, or do you want to make a difference in Detroit?" - Michigan Governor, Rick Snyder

Friday, March 02, 2012

PicketReport.com relaunched!

Check out our new look and design. It's much improved from the previous version, and we're excited to start a big marketing/pr push in the next week or two. More news to come from that.

We also just moved into some sweet new digs on the ninth floor of the Compuware building with views of the Detroit River, Ford Field, Greektown Casino, and Comerica Park. We even have an outdoor terrace just past our desks. Not a bad place to spend a day.



What is PicketReport? Besides one of the top startups in Detroit and where I've worked for the past month, we're a neighborhood research tool for folks who are relocating. Play around with our map, particularly the Lifestyle information to learn more about the neighborhood you live in. Send me any feedback!

Thursday, January 26, 2012

Detroit, here I come!

While in Detroit the first week of January, I checked out Astro Coffee. At the time, I was meeting with folks in metro Detroit and trying to decide if I wanted to make Detroit my next move. Right inside the front door, Astro has a small shelf of coffees for sale, including the two below.


I don't think I believe in signs but this one was hard to ignore. Nicaragua and Kenya, two defining places I've lived in over the past few years, sitting next to each other in a Detroit shop, reminding me where I've been and where I haven't. Detroit's gotta be the next stop. Here I come.

Tuesday, December 20, 2011

Code Academy: Week 12

Code Academy Demo Day practice:


We're presenting in front of 200 movers and shakers from the Chicago tech scene tonight, and I'm about to get up there and tell 'em to connect me with Detroit's biggest mover and shaker - Dan Gilbert.

Code Academy Demo Day 
TechNexus 200 S Wacker
Chicago, IL
5pm

Friday, December 16, 2011

Code Academy: Week 11


Until this week, I haven't felt comfortable saying this:
I'm a software developer.
Despite being a part of Code Academy and learning the skills of a developer, to call myself one always felt wrong, like I was a poser faking it in a field I knew very little about. And though I'm no where close to where I want to be in terms of my ability as a developer, a couple of things happened this past week that gave me enough confidence where it finally feels natural to call myself what I've become over the last 11 weeks: a developer.
  • On Wednesday I went to a Chicago meetup put on by a company called Heroku. I've been using Heroku to deploy the applications I'm building and they organized an evening session to talk more about their product and to show off some demonstrations on how to use it. About 30 developers were in attendance (maybe half of them Rubyists) and there wasn't any moment that I felt out of place or in over my head. In fact, they had a live coding demonstration of an email/signup app that they deployed to Heroku and as a few of the audience members watched in amazement at the speed with which he was able to code and deploy, my thoughts were generally something like - "that's easy." I could have gotten up in front of a room full of Chicago developers and offered some of them new skills related to the software craft. A poser developer couldn't do that.
  • A fellow Code Academy student sent me an email this week about stripe.com, a payment processing service similar to Paypal. He had just implemented it on his site, found it to be very easy and seamless, and knew I had been struggling with Paypal. He recommended I check it out. If you go to the homepage the first thing you'll see is "Payments for Developers." 11 weeks ago this service wouldn't have been for me, I wasn't a developer, but I'm happy to report that after spending about 2 hours this week working on implementation, I got Stripe hooked up to my site without too much trouble. I was able to follow along with their code tutorials, make a few customizations needed for my site, and perhaps most tellingly, appreciate their product from a developer's point of view. Their homepage headline made sense...because I'm a developer.

Learn how to code!

This internet thing might be around for a while.

The Rise of Developer Economics
The one absolutely solid place to store your capital today — if you know how to do it –  is in software developers’ wallets. 

Sunday, December 11, 2011

Code Academy: Week 10

I've found a lot of success in failure this week. I've spent the better part of 3 days struggling to get PayPal integrated to a site I'm working on and still haven't managed to get it set up properly. Digging through PayPal's endless and poorly organized API docs, researching how to handle the params I'm receiving from PayPal, understanding that redirect_to is a HTTP GET request while I need a POST, and reading production log files to troubleshoot hasn't solve my problem. I'm still forced to disable auto-return (forcing the user to click on a link after payment to get back to my site) in order to finish the transaction. Frustrating but not a completely lost battle.

API, params, GET, POST, production logs. What?!!? Exactly. There was a moment yesterday while knee deep in my investigation where I took a quick step back and realized how far I've come in the past ten weeks. I've picked up a whole new skill set (and the vocabulary to go with it!) and am writing code to handle a custom PayPal integration to accept credit card payments on a site built from scratch. Awesome!

I'm close to solving this PayPal riddle and after talking to a lot of folks this week about what I was working on, the general consensus was that PayPal is terrible and that its API and documentation is some of the most confusing out there. I'm hoping they're right because if I get this hooked up, everything else I tackle should be easier.

Saturday, December 10, 2011

Make a Gift to KickStart

As most of you know, I spent the majority of the year in Kenya working for KickStart International. My project was related to the foot powered irrigation pumps we sell throughout Africa, and I spent more than a month in Zambia and Malawi getting a first hand look at how our MoneyMaker pumps are used and the impact they are making on the lives of African farmers and their families.

There are plenty of positive statistics I could share as a result of our Malawi/Zambia survey where we interviewed over 500 farmers using our pumps, but I'd rather share one simple quote we captured while interviewing Dancen Kazimbi, a Malawian farmer using our MoneyMaker pump:
I'm planning on getting more land because what I currently have is not enough. With the MoneyMaker, anything is possible.
Anything is possible. Beyond providing extra income that helps feed their families, pay for their children's education, and improve their living situations, the MoneyMaker pump allows farmers and their families to think about the future. For the first time in their lives, these farmers can look past today's concerns. They no longer have to worry about what their family will eat today and how they'll pay for their daughter's school fees this semester. They can finally look to and plan for the future with a sense of dignity that everyone deserves and yet so few in the developing world experience. They can finally look to the future and dream. Anything is possible.

This past week, I got an email from my former boss asking me to pass along to anyone who might be interested in KickStart's annual appeal for donations. I didn't have a chance to meet Mama Edna, the farmer featured in KickStart's email (below), but I met plenty of farmers just like her and know first hand that KickStart's work makes sense. The organization has the tools, the passion, the talent, and the model to rapidly scale this solution to reach the millions of African farmers that are in need. These farmers don't want a handout, they want a way to make money and a means by which they can plan for the their and their family's futures. KickStart provides just that and you should help them achieve this by donating.

If you're interested in donating visit KickStart's donate page. And feel free to send me any questions about  the organization, their work, or my specific project. Would love to help.

-----------------------------------------------------------------------------------------------------

Meet Mama Edna



Mama Edna sells her fruits and vegetables from a kiosk in Sotik town, 125 miles from Nairobi. She says that buying a MoneyMaker pump changed everything for her family in a very short time – she proudly describes herself as a prosperous, serious farmer with a hired farmhand.

The year before, Edna was dependent on rainfall and a bucket for irrigation. Her crops often failed in the drought. Even when she could bring something to market, everyone else was selling the same produce and much of her harvest went to waste because there was little demand.

Mama Edna knew about the MoneyMaker pump but didn’t think she could buy it outright because she had to pay school fees for three children. She bought her pump with KickStart’s unique mobile phone layaway program “Tone kwa Tone” or “Drop by Drop.” Edna’s farmhand generates even more income from the pump with a car wash business next to the river.

The first thing Mama Edna says when asked about her pump is, “Kama siyo hii ningekwama” or “If it weren’t for this, I’d be stuck.” She sees a future where she will be a model farmer who supplies her produce to rural schools and hospitals. She says, “I am now the envy of the village, thanks to this amazing pump!”

KickStart uses your funds to build awareness of the value of pump ownership through radio advertising, Farmer Field Days and other events. KickStart also tracks the impact of pump ownership to measure nutrition, education, electrification, and other lifestyle improvements.

Your funds help Mama Edna and hundreds of thousands of farmers like her provide better nutrition, better education and a better future for their families, as well as provide additional jobs for dealers, distributors and farmhands.

Los Angeles Thanksgiving

A view from atop Runyon Canyon, Los Angeles:


A view from inside Galco's, featuring Detroit's own:



Monday, December 05, 2011

Thursday, November 24, 2011

Code Academy: Week 7


A couple of weeks ago I came across a site out of Detroit that allowed anyone to enter in an idea for the redevelopment of Michigan Central Station. I liked the idea and decided it'd be a good exercise to try to build a similar site as practice for what I've been learning in class. Detroit Pays Off was born (more on the idea at some other point).

The actual rails coding was really easy. There isn't much to the site, just a model for the posts that includes the idea, the posted on date, and the number of votes, but because I wanted to share the site here, I spent a lot of time last week taking my first stab at the frontend coding of a site - mainly CSS and a few cool effects written with javascript/jquery.

I basically just stole Tumblr's colors and layout as a model for the CSS coding and messed around with different divs and options until I managed to get things where I wanted them. Much easier said than done but it was a worthwhile endeavor. I have a much greater grasp of what CSS is and how to hack something together that looks somewhat presentable. As for the javascript/jquery, I spent just about all weekend working on getting three very small effects working. You'll notice the first one when you click on "Submit Your Idea". Oh yeah! You saw that animation slide? Took me all day Sunday to figure that out. The other two were somewhat less difficult, you can click on the hand and it counts a vote without refreshing the page, and when you enter in a new idea it fades in as the newest idea submitted. You'll have to submit an idea to see that last one so don't be shy...submit!

I'm pretty critical of how things have turned out and what still needs to be done on the site (for starters, I hate how the submitted ideas section is laid out in a table, and I'd like to add comments and the ability to sign in with Facebook), but being able to do this on my own has been awesome. Just a few weeks ago I would have seen the Talk to The Station site and been frustrated that I couldn't build a similar site without resorting to a pre-built WordPress theme. Now when I come across any site or idea, I can just create it myself.

Have any ideas for a website/web app? Send 'em over...I'll build it.

Monday, November 14, 2011

Code Academy: Week 6

We're half way through the very first Code Academy program. It's surprising how quickly the weeks are passing and even more surprising how far we've all come along since that first week. Our progress has never been clearer than last night at 5pm when we presented the result of our work during the Startup Weekend we had just completed.

There are startup weekend events throughout the country and they all function pretty much the same. You start on Friday at 6pm. Those who are interested, pitch various ideas for businesses or web applications and after all the pitches, the attendees vote on their favorites. Through either one or two rounds of voting and questions, the list of ideas is whittled down to the winners and then teams are formed around each idea. At that point, once the teams are created, you have until Sunday at 5pm to work on the idea and try to get it launched over the course of the weekend. Our Code Academy startup weekend worked in this fashion, and since we're all at least novice developers at this point, our projects were very much functioning web applications by Sunday.

A Code Academy startup weekend in week one of the program would have looked something like this - 
  • Powerpoint presentations with slides on the market potential, a SWAT analysis on the idea, and a summary of competition.
  • Wireframes of the web application
There's certainly nothing wrong with this work and, in fact, it'd be smart to do that for any idea, but a Code Academy startup weekend after week six looks a lot different. It looks real. We can build shit. Real, functioning applications. To see the ideas that were decided upon on Friday come to life through the weekend and result in fully featured websites by Sunday was really special. Very motivating for the next half of the program and a very good reminder of how far we've come in the first half.  See for yourself at two of the sites that were built in just 46 hours: