Parsing csv/tsv with Laravel 4

We needed to parse tsv files in one of our projects, and I found some nice code to achieve that – https://github.com/goodby/csv

Getting this to work with Laravel is actually quite easy, although undocumented.

1. Add goodby/csv to your composer file

{
    "require": {
        "goodby/csv": "*"
    }
}

2. Update composer

composer update

3. Add the following lines to the aliases array in the app/config/app.php file

'Lexer' => 'GoodbyCSVImportStandardLexer',
'Interpreter' => 'GoodbyCSVImportStandardInterpreter',
'LexerConfig' => 'GoodbyCSVImportStandardLexerConfig',

4. Run your code

$lexer = new Lexer(new LexerConfig());
$interpreter = new Interpreter();
$interpreter->addObserver(function(array $row) {
    // do something here.
    // for example, insert $row to database.
});
$lexer->parse('data.csv', $interpreter);

Full docs can be found at https://github.com/goodby/csv

Laravel 4 SSL on single instance AWS Elastic Beanstalk

Setting up SSL on Laravel 4 on an Elastic Beanstalk server is tricky, there are a couple of land mines to avoid, which took me a day of coding to find and resolve.

This guide will help you through the process, and will remind me when I next have the problem and am searching for the solution – you’re welcome future me!

  1. Apply for your secure certificate
  2. Create singlessl.config file in your .ebextensions folder
  3. Copy in your certificates
  4. Teach Laravel how to identify a secure connection (It’s not as simple as it sounds)
  5. Update all internal links to https
  6. Deploy

Read More

Starting a Hackspace part 2

When I moved from the UK I brought with me 2 small boxes of electronics, they weren’t a lot, but they had the basics, and they turned out to be enough to start a hackspace.

I teamed up with a colleague, and meeting in her living room we had our first hackspace meeting.

Knowing that another of our colleagues *loves* the song ‘baby I love your way’ we decided to build a speaker that would play the first 20 seconds of the song – connected to a motion sensor. It was to be installed in a hidden location next to said colleague’s desk, so whenever he moved the song would play. We got our device working, we were ready with our prank, the hacking night had been a success!

Prank

It was that night that we made a plan to hold a proper event, we created an event online, made a Facebook page, and signed up for a twitter account, we had the basics – we were going to be a hackspace.

Having a hackspace usually involves having space, and we didn’t have any. We decided that we would hold a hacking event at our office, we had a room, and it had a dining room table in it. The point of the event was to get people together, get them making, and get them talking. We wanted to see if people were interested in a hackspace, and if they would find value in it.

We held our first proper meeting in April, 13 people turned up, and we ran out of chairs – a mark of success in anyones book. We met some great people, and heard so many interesting ideas. Most importantly we’d had a lot of fun.

First Meeting

We decided that without a dedicated space we were instead going to hold regular events, bootstrap the operation, and see if there was enough interest within the community.

Our weekly Tuesday meetings brought in a steady flow of new hackers, all keen to share their ideas. People wanted to work on projects together, they brought their ideas, and they were interested in the future of the hackspace.

A couple of moves, a 3D printer, and nearly 40 meetings later and we have our regulars, we have new visitors each week, and we are now looking for dedicated space. We’re going to move from a weekly social/hacking night to becoming an actual hackspace. The word ‘space’ in our name will no longer be technically incorrect.

I still use those 2 boxes of components in my projects, only now we have a large group of people all with their own boxes of parts to work and collaborate with.

Community in maker spaces

When you think of a maker space, your mind automatically goes to a physical space, tools, equipment, and what you can build there. The space and the tools are obviously very important, and provide a place, and a means for members to build their projects. This is especially true when you start looking at larger, messier or more expensive tools, like band saws, laser cutters, and CNC machines. Having these tools really expands the capability of the members, and lets them work without limiting their creativity.

However, there is something within a maker space that is even more valuable, the community.

The benefits of the community are many, and not always realised. People are often drawn into maker spaces by the tools, but their real benefit can often be from their fellow makers.

You get to work alongside other people who have similar interests to your own, you can share ideas, get feedback, and receive validation for your ideas. Having others there to demo your work to inspires you to keep working, a friendly sense of competition can promote you to work more on your project, or to make it better, something you may not have done if you were working on your own. Plus, celebrating a successful project is much more fun when it’s done with people that appreciate your accomplishment (and beer).

Collaborating on projects with other people is also a massive benefit, you can embark on a build that goes way further than your skill set, knowing that there others with complementary skills that will fill the gaps. Working with other people keeps you motivated, and gives a sense of accountability, improving your chances of finishing.

Some people find that a hackspace is a great place to meet and make friends with like minded people. Not everyone is lucky enough to live or work with people as the same hobbies and interests as them, so they rely on a community, or social events to meet them. A maker space for some can be purely social, and some great friends can be made.

There are usually a wide variety of events held at maker spaces, there can be interesting speakers, hackathons, parties, and evenings where members share the projects they are working on.

Education through the community should not be underestimated, in some maker spaces courses are run every week or evening covering topics from microprocessor programming, screen printing, welding, or training on one of the various tools. In other spaces people get together informally and share what they know with each other. Even if learning is not formally mentioned, whenever you talk to a fellow member, or come to an event, you are always learning.

There is always something to discover, to learn, and to try, and it’s the community within the maker space that connects it all together.

Starting a Hackspace part 1

I moved to the Boston area almost a year ago for work, I brought my wife over, and we settled down in Somerville, a place with a great community feeling. I had been part of a different type of community back in London and was actively participating in the London hackspace, a maker space in east London that caters for people designing, making and building things.

Although my work involves expressing myself in code, designing websites, it does not give me a creative outlet that lets me work with my hands, other than clicking on the keys on my keyboard. Being part of a hackspace is my creative outlet, and I find it extremely rewarding.

The London hackspace is a community run hackspace, the community decides what big tools should be purchased, where the physical space should be, and what events should be put on. To be a member you pay what you want, and you have full access to the tools, workshops, and space. Training is done on a regular schedule, costs nothing, and allows you to use the laser cutter, welding tools and lathe. The space is run for and by the members, and that setup works amazingly, it’s a great place to be a part of.

So I found myself in the US, I had to rent an apartment, work out where the baked beans were in the supermarket (they don’t sell them here) and most importantly, find an outlet for my creative side.

I needed to find myself a maker space.

I looked around at the options, but none of them seemed suitable. There was the Artisan’s Asylum in Somerville, a massive space with awesome tools, but a bit expensive for my tastes. There were several university based maker spaces, and fab labs, but with access only for students, so, I was left out.

I wanted to find a maker space with a community feeling like the London hackspace, some internet searching showed a few maker spaces that had come and gone, and a couple that were too far away, which didn’t leave many options.

That left me with a decision to make, do try and fit myself into another hackspace, do I give up on the idea and just work on my projects at home on my own, or should I start my own.

I decided to create my own.

Framework

Back when we started Libboo we coded everything ourselves, we wrote the entire backend, all the interface, and every line of css.  We were learning as we built, so it seemed like the logical thing to do, it was only later that we realised that there were frameworks for everything, and that we needn’t have built it all ourselves.

The css for Libboo a year ago was all handed coded, all of it (over 10,000 lines), and had become a bit of a beast.  The trouble was that file was created back in 2007, and we’d added to it over the next 4 years, I knew where everything was, but to anyone else it was a disaster (i.e. when we hired RM).

We had decided to re-work the front end code, and so I started looking around for possible frameworks, some looked promising, some looked over complicated, but none really filled the gap we had.  That was until a fellow Techstar colleague mentioned bootstrap.  I had used it before on small projects, but hand’t considered it for a larger project like this.

Bootstrap

Bootstrap features

Bootstrap contains several massively helpful tools to start you off:

  • 12 Column Grid system
  • Responsive design (adjusts to desktop, large desktop, tablet, mobile)
  • Styling for forms, in all shapes and sizes
  • Icon set for use with buttons, errors, etc
  • Styling for alerts, error, progress bars, labels
  • Extensive support for dropdowns and menus
  • Javascript plugins for modals, tooltips, carousels
  • Plenty more to be playing around with

When we started using it we realised that bootstrap did more than we expected, so many tasks that would have involved a large chunk of code were already built in, so it made the process of building the new site a pleasure.  We didn’t need to build a framework ourselves, and that became obvious fairly early on as we started using bootstrap.

Simple modal popup

Simple modal popup

You can get bootstrap from github, you can also get it as part of a package from Initializr, which bundles in an html5 boilerplate, as well as some other useful tools.

Using it saved us a huge amount of time in creating a framework, it does all the hard stuff for us, and it reduced our css by 80%.  However you get it, and whatever size  project you end up working on, bootstrap is a simple way for you to get up and running (with pleasing results) very quickly.

 

Committing

I’ve lived in London for 6 years, and I love it, there’s so much going on, and my friends are all nearby.  However, in a month I will be leaving it, I’ll be taking a leap and moving to the US.

Libboo has been expanding for the last year, which makes working remotely that bit harder.  I’ve been over a few times, mainly for techstars and mass challenge, but it’s hard working with people some of which you haven’t even met in person.

Moving to Boston will get me closer into the action, which means I can have a more involved role in how the company is shaped, and in what direction we take it.  I could have stayed in London, but that would have been the easy option, and I like challenges.

I’m technically ready to come over, in that after a summer of paperwork (and a trip to the embassy) I now have my visa, so I just need to make sure the rest of me is ready.  I’ll be moving over on my own to start with, then heading back to London to collect Anna, pack up the house, and get everything shipped over.  During that time I’ll have the chance to find us a place to live, get to know the area a bit better, maybe even make some friends.

I’m looking forward to the challenge!

Full time

I find it easy to adapt to putting every waking minute I have into my work, possibly too easily, especially when I am working to deploy a new product with a fixed deadline.

After the deadline has passed, and you’ve delivered your work, it’s nice to re-discover your spare time, and realise that you don’t have to work ALL the time.

Having said that, working for Libboo doesn’t feel like work, I spend my spare time designing/coding/developing anyway, so Libboo is just on a much larger scale, with a bigger team, and financial backing.

Re-building

We new we had some serious changes to make to the site, we cranked our brains over several weeks to come up with a suitable solution, it was big, and was going to require a lot of work.

The changes meant that we would be starting from scratch in various areas; we could no-longer rely on the same interface, the code that had been written over more than four years, or the aging database, and we were going to have to do something drastic.  We started with a sparkling white php file, and began the lengthy process of updating and migrating all the required backend code to our new codebase. The database was stripped back to the core of what we required, emptied of data, and re-built to meet the requirements of the new site.

The front end was no different: we imported our new framework, then built up every page by hand, making sure we cleared away the years of re-writes that we had applied to the old site. My job involved co-ordinating the development, as well as re-writing the front end, which took up all of my time and spare brain cycles for the full four months.

Initially we knew what features we were going to be building in, but as we didn’t have a designer working for us at the time, we didn’t know how it was going to look.  I was building to a rough wireframe that I threw together for each page until we could get a full design drawn up.  Halfway through the build process we hired Nicki, and then we had designs which really helped to pull it all together.  The two weeks before we deployed is where the pressure mounted, and were the hardest I’ve ever had to work.  We were working 16-hour RedBull-fueled days getting it all finished, built and tested on time, despite significant last minute changes to design and functionality days before we went live.

We’re very happy with the way it has come out, and hope to prove ourselves with the results.

Direction

A lot has changed since we first started Libboo back in 2007; for a start we’ve gone from Chris and I working in our spare time to a team of 8 people. We’ve been through the MassChallenge and Techstars accelerator programs, both of which have significantly improved us as a team, the focus of the company, and the reach of our network.  Then there is the more than $1M that we have raised to keep us working, developing, and refining what we have.

So now we’ve released our pilot, the result of a pivot, where we fundamentally changed what we were doing, and how we were doing it. We realized that although some people had trouble writing books, it wasn’t the main issue they were facing. The main issue is they had trouble getting discovered, and that’s a problem that nobody has been able to solve yet.