Toby's Ramblings http://tosbourn.com The personal blog of Toby Osbourn Wed, 12 Jun 2013 09:12:21 +0000 en-US hourly 1 http://wordpress.org/?v= Killing all instances of Ruby on Rails running on a certain port. http://tosbourn.com/2013/06/ruby/killing-all-instances-of-ruby-on-rails-running-on-a-certain-port/ http://tosbourn.com/2013/06/ruby/killing-all-instances-of-ruby-on-rails-running-on-a-certain-port/#comments Wed, 12 Jun 2013 09:12:21 +0000 Toby http://tosbourn.com/?p=1565 I was having a hard time getting my Rails webserver to restart after it having a bit of a hissy fit. The process to handle most apps when this happens is to locate the PID (Process ID) of the thing that is broken and kill it. An easy way to do this with Rails is [...]

The post Killing all instances of Ruby on Rails running on a certain port. appeared first on Toby's Ramblings.

]]>
I was having a hard time getting my Rails webserver to restart after it having a bit of a hissy fit. The process to handle most apps when this happens is to locate the PID (Process ID) of the thing that is broken and kill it.

An easy way to do this with Rails is to type the following into your Terminal;

lsof -wni tcp:3000

Which looks for all processes running on port 3000 (the most common port for things like Webrick and Thin to run on) and returns them all as a table.

One of the columns of the table will be the PID for the process, copy it and paste it into the following line which will go into your Terminal;

kill -9 PID

Replacing ‘PID’ with the PID you just copied.

This will kill all processes relating to that PID, once this is done you should be good to go ahead and restart your rails server.

The post Killing all instances of Ruby on Rails running on a certain port. appeared first on Toby's Ramblings.

]]>
http://tosbourn.com/2013/06/ruby/killing-all-instances-of-ruby-on-rails-running-on-a-certain-port/feed/ 0
Bad example of how to do unsubscribe pages. http://tosbourn.com/2013/06/design/bad-example-of-how-to-do-unsubscribe-pages/ http://tosbourn.com/2013/06/design/bad-example-of-how-to-do-unsubscribe-pages/#comments Sun, 09 Jun 2013 09:49:43 +0000 Toby http://tosbourn.com/?p=1562 Today I received an email from Game. If you don’t know who Game are they are a video game shop here in the UK, not really that important for the blog post but I like my readers to be informed. I have little interest in what Game have to say anymore so I figured I [...]

The post Bad example of how to do unsubscribe pages. appeared first on Toby's Ramblings.

]]>
Today I received an email from Game. If you don’t know who Game are they are a video game shop here in the UK, not really that important for the blog post but I like my readers to be informed.

I have little interest in what Game have to say anymore so I figured I would unsubscribe from their list, which has actually made me think I should write up a blog post someday on reasons why you should unsubscribe rather than just deleting or putting in filters.

As normal I scrolled to the bottom of the email and scanned for the unsubscribe link, all credit to them I found this with no bother at all. This next screen kind of took away from the experience though;

Game's Unsubscribe Email Page

 

How the heck do I know if I am sure I want to remove t***********@g*********.com?

This stinks of some sort of speculative security measure without any actual use cases being thought out, a horrible user experience and one that left me clicking ‘Remove Me’ because if t***********@g*********.com didn’t pertain to my email address then I was probably doing some other bugger a favour by removing them.

If there is some way for someone to get to that page without clicking on a link that was originally sent to the correct persons email address then Game need to fix that, not obscure the email address in case some non-genuine person is looking at it.

Whilst I am ragging on this page, it also feels a little weird that they didn’t try and subtly sell me something, even a small banner below the form that had the latest releases or something. I don’t want there to be one big advert or for it to take away from my core goal (confirming my subscription status) but having every page as a sales tool seems like e-commerce 101?

The post Bad example of how to do unsubscribe pages. appeared first on Toby's Ramblings.

]]>
http://tosbourn.com/2013/06/design/bad-example-of-how-to-do-unsubscribe-pages/feed/ 0
Using Loops in Jasmine http://tosbourn.com/2013/06/javascript/using-loops-in-jasmine/ http://tosbourn.com/2013/06/javascript/using-loops-in-jasmine/#comments Fri, 07 Jun 2013 15:52:19 +0000 Toby http://tosbourn.com/?p=1560 If you want to test your code against 10 different inputs you don’t want to have to write 10 different tests. You want to write one test you can call 10 times. The cleanest way to achieve this is to have your inputs and outputs stored in an array or object (In the example below [...]

The post Using Loops in Jasmine appeared first on Toby's Ramblings.

]]>
If you want to test your code against 10 different inputs you don’t want to have to write 10 different tests. You want to write one test you can call 10 times.

The cleanest way to achieve this is to have your inputs and outputs stored in an array or object (In the example below I have chosen an array).

Intuitively (especially if you are familiar with how to write Rspec tests) it might feel like all you need to do is wrap your it block in a for loop and have your arrays feed into it, unfortunately due to the nature of how Jasmine executes this will not work.

What you need to do is wrap your it block inside a function, which you can then call from inside a loop. For example;

describe('this is my looping test!', function() {
  var input = [1,2,3];
  var output = [10, 20, 30];

  function test_my_times_ten(input, output) {
    it('should multiply ' + input + ' by 10 to give ' + output, function() {
      expect(input * 10).toEqual(output)
    });
  }

  for(var x = 0; x < input.size; x++) {
    test_my_times_ten(input[x], output[x]);
  }
});

With this technique you can see how you could quickly build up a very large and comprehensive test suite without writing a large amount of tests, things start to get really interesting if you start having nested loops passing in input. Just be aware of the performance implications of nested loops though!

The post Using Loops in Jasmine appeared first on Toby's Ramblings.

]]>
http://tosbourn.com/2013/06/javascript/using-loops-in-jasmine/feed/ 0
Useful Chrome Extension for Backbone.js Debugging http://tosbourn.com/2013/06/javascript/useful-chrome-extension-for-backbone-js-debugging/ http://tosbourn.com/2013/06/javascript/useful-chrome-extension-for-backbone-js-debugging/#comments Fri, 07 Jun 2013 15:18:35 +0000 Toby http://tosbourn.com/?p=1558 If you do much work with Backbone.js inevitably you are going to have to end up debugging some silly mistake you have made, I know I have been making about 5000 a second over the past few days. Luckily I read today that there is a Google Chrome extension out that can help debug Backbone.js [...]

The post Useful Chrome Extension for Backbone.js Debugging appeared first on Toby's Ramblings.

]]>
If you do much work with Backbone.js inevitably you are going to have to end up debugging some silly mistake you have made, I know I have been making about 5000 a second over the past few days.

Luckily I read today that there is a Google Chrome extension out that can help debug Backbone.js issues. The code can be found here along with an easy to follow installation guide.

One thing the guide does not mention is that you will more than likely need to restart Chrome to get this to work, I know I did.

Whilst it is clearly still in early development, I have already been putting it to use and getting good stuff back from it

The post Useful Chrome Extension for Backbone.js Debugging appeared first on Toby's Ramblings.

]]>
http://tosbourn.com/2013/06/javascript/useful-chrome-extension-for-backbone-js-debugging/feed/ 0
Insane Chown Posse http://tosbourn.com/2013/06/web-stuff/insane-chown-posse/ http://tosbourn.com/2013/06/web-stuff/insane-chown-posse/#comments Wed, 05 Jun 2013 21:09:54 +0000 Toby http://tosbourn.com/?p=1554 I seen this posted on Twitter tonight, wanted to save it for posterity because it made me chuckle. I give you the Insane Chown Posse. Here is the original tweet

The post Insane Chown Posse appeared first on Toby's Ramblings.

]]>
I seen this posted on Twitter tonight, wanted to save it for posterity because it made me chuckle.

I give you the Insane Chown Posse.

insane-chown-posse

Here is the original tweet :-)

The post Insane Chown Posse appeared first on Toby's Ramblings.

]]>
http://tosbourn.com/2013/06/web-stuff/insane-chown-posse/feed/ 0
Stacking the founder chips in your favour. http://tosbourn.com/2013/05/web-stuff/stacking-the-founder-chips-in-your-favour/ http://tosbourn.com/2013/05/web-stuff/stacking-the-founder-chips-in-your-favour/#comments Sat, 25 May 2013 09:07:35 +0000 Toby http://tosbourn.com/?p=1541 I am a regular listener to the startups for the rest of us podcast and often find I have a slew of actionable tips at the end of an episode. Their most recent episode, entitled The Founder Test: 11 Founder Attributes that will determine the success of your product really struct a chord with me. [...]

The post Stacking the founder chips in your favour. appeared first on Toby's Ramblings.

]]>
I am a regular listener to the startups for the rest of us podcast and often find I have a slew of actionable tips at the end of an episode. Their most recent episode, entitled The Founder Test: 11 Founder Attributes that will determine the success of your product really struct a chord with me.

Essentially the episode was talking about if you wanted to gauge how successful a product might be you need to look at 11 of your attributes regarding the product. Basically put it might not matter if your domain knowledge isn’t great so long as you were doing well in the other areas.

It really highlighted for me the point that things like this aren’t binary, they have a tonne of variables and grey areas to consider.

I am sure most people’s takeaway was that this would maybe be a nice tool to help track an idea you have as a very quick success metric, and to a point I did too but my main takeaway was that I took it as a personal attack every time I thought I would be scoring low in one area of this 11 point test.

This blog post is taking each point in turn and answering the question “How could I score better in this”, some answers are going to be more obvious that others but hopefully it will help in increasing the potential success of your software product.

Your knowledge of the niche or the problem to be solved

This point obviously refers to your domain knowledge, the more you know about the problem to be solved the better you are going to be at solving it for people. This is probably one of the easier items to change – We have this thing called the internet now and it is pretty good at researching stuff!

These are the things I would consider doing;

  • Hit up Wikipedia to get some high level domain knowledge.
  • Search for communities around the issue, sign up or even just lurk for a while and absorb the community. Possible places would be Stack Exchange sites, Sub-Reddits or online forums.
  • Reach out to your network and see if it is maybe a hobby or interest of someone you know.
  • Subscribe to the top 5 blogs on the subject.

Your technical and programming knowledge

This shouldn’t be an issue for any of my readers, we are all a pretty technical bunch, but certainly when dealing with software even if you aren’t the one writing the code, the more technical knowledge you have the better. Luckily there are a load of places you can learn to code these days and once you do learn even more places to get help.

If you need to learn or improve, these are the things I could consider doing;

  • Sign up for a course or two at one or more of these CodeSchool, TreeHouse, Codecademy.
  • Don’t be afraid to ask questions on Stackoverflow.
  • Just build stuff, the more things the better, build stupid apps, build one pager websites for your pets, anything, just build!
  • Think about anything specific technical knowledge you may need in your problem space, is there a reason why all competitors are making .net applications?

Your skill as a project manager

Regular listeners to the podcast will know that Rob and Mike are big fans of outsourcing work which they feel would take away from their time adding real value to the business and of course if that is the case you are going to need decent project management skills, even if you are planning on doing everything yourself, keeping tabs on how the project is going and planning ahead are going to be core to the success of the project.

If you need to learn more about managing projects better I would do the following;

  • Read up on what Project Management is, I think a lot of us think of project management in terms of some of the project managers we know, and not with a high level view of the subject.
  • Learn about Agile (I cannot personally recommend any links or books as my reading hasn’t been that thourough)
  • Start managing projects – Start with your life, pick something and manage it, practice makes perfect and all that!
  • Are there going to be any third parties involved in what you are building? If so learn how they work and what is going to be the best way to work with them on the project.

Your skill with outsourcing or delegating

This builds on what I was saying in the previous point, outsourcing or delegating work out means that you can concentrate on providing some of the core value that will be required in the product.

This is something I am terrible at, so I would welcome any comments from people on ways to improve, but here is my advice;

  • Start delegating! If there is some task at work or at home you think could be better served by someone else, just ask them, the more you delegate the better you will get.
  • Learn how places like oDesk work for outsourcing work.
  • Make sure you know if any of your friends or network are freelancers or do remote working.
  • Maybe you could even look within your family. Do you have an out of work cousin who would appreciate some extra money for doing some basic admin work?
  • If you need to delegate out a specific role based on the problem domain, be sure you properly understand the task that will need to be accomplished, if you don’t know how to do it well it will be hard for you to explain it to the outsourcer.

Your passion for the problem to be solved

This point could maybe be reworded to include your passion for what the solved problem could potentially do for you, but essentially we are talking about how excited the project makes you. On the podcast they mentioned that some people have different opinions on how much this matters, for me it matters a lot, if I don’t have a real itch to work on something, I will find something from my massive todo list to do instead (case in point, this blog post is bumping so much other stuff, but I am itching to write it!).

Passion is a very hard thing to get more of, but here is what I would do;

  • Speak to people who are passionate about that problem, let their passion rub off on you.
  • Speak to the people who you are trying to solve the problem for, realise how much better you would make their day.
  • Write out a for and against list, include things like the potential financial reward you will get, the kudos from peers, things like that.

Your ability to build something that people want

It stands to reason that people who have built something awesome in the past are likely to build something awesome in the future, they have already made the mistakes and cut their teeth on other projects.

This is a pretty massive task, it doesn’t just mean making something functional, it means making something people want to use, which incorporates design, copy writing and all the other skills that go into making great software products.

There are a few things I think you can do here to help stack the chips in your favour;

  • Learn good design – I would recommend Design for Hackers and taking the Hack Design course.
  • Fake it until you make it – Don’t try and reinvent the wheel, draw inspiration and patterns from known things you know work.
  • Look at the competitors in the domain, are there things that can be improved upon?
  • Start making stuff – If you have only ever worked on personal stuff before then bite the bullet and make something for someone else, 10 minutes searching twitter will find you thousands of ideas people want made, most will suck but some won’t. Build, build, build!

Your skills as a marketer

Without good marketing a great product could sit in obscurity until the domain name runs out, and with good marketing an average product can out perform a great one.

Marketing is a huge industry, but here is what I would suggest you do to improve your skills;

  • Read this post by State of Search on Learning Digital Marketing.
  • Read and absorb work by Seth Godin (the man knows his marketing, and this was actually mentioned in the podcast as well).
  • Market youself more, get into the habbit of bigging up yourself and the things you are working on, practice on your personal social networks.
  • Find out how your competitors are marketing themselves, have they ignored online? have they ignored offline? Try and find out why.

Who you know

I had to re-listen to this point when writing because I was in a shop buying some breakfast during this part of the podcast(!!) but essentially this point is talking about your network of contacts, obviously the more quality people you know (related to the problem domain) the better.

Here are some things I would do to try and expand this;

  • Do searches on Social Networks relating to the problem domain and connect with people talking about it (and don’t just follow them, speak to them, introduce yourself).
  • Ask your current network if anyone has any contacts in your desired area and ask for introductions, the more personal the better.
  • Find out if there are any related meetups happening, get involved in the scene.
  • Start talking about the problem domain within your network and people will find you.

Available time

This area tackles how much time you could spend working on the problem, obviously the more free time you have the better.

Nobody ever has any free time ever, I get that, but here are some things you might want to consider;

  • Delegate some of your current time sinks (see the section on delegation above if you want to improve upon it!).
  • Kill off something else – Maybe you have something you put a lot of time into but you don’t really enjoy it or it isn’t really going anywhere, perhaps you need to chop it.
  • Learn to say no to things – A lot of your time is probably like mine, spent doing things you agreed to with people, sometimes you just need to say no in order to make time for things you want to get done.
  • Read and follow the advice laid out by Getting Things Done, you will find you have more time to focus on what you find important if you are effective at getting stuff done!
  • Learn to plan your work properly (see the section on project management) if you can do that then you should be able to limit the damage not having a huge amount of time can do.

Money

Naturally if you have capital that you can invest into an idea, the smoother things could go for you, or if you have a good chunk of savings it means you could maybe invest a little more time into the project and less on consulting work or your 9-5.

There are entire industries dedicated to making you more money, but here is my meagre offering of suggestions;

  • If you do consulting work, increase your rates.
  • If you do 9-5 work, ask for a raise. (It is pretty much that simple, just ask, where is the harm?)
  • If you have monthly outgoings that involve paying off a loan or something, try and pay it off in one chunk now, it will hurt in the short term but each month you have less going out, plus interest etc.
  • Learn from the Money Saving Expert.
  • Have a clearout and sell stuff you don’t want or need.
  • Review your monthly outgoings, is there anything that can be killed or reduced? (A lovefilm account you no longer use, for example).

Focus

How much focus you can put into the project will greatly affect the effectiveness of it, you could have all the time in the world to spend on it, but if your mind is on other things then it is not time being well spent.

There are the few things I do when I really need to focus, I am still trying to form them into habits;

  • Stop visiting stupid websites and websites that eat up your day with pointless next next next clicking.
  • Plan your time well so you aren’t likely to get distracted by things like friends and other external entities.
  • Map out your day and break it down into small, manageable sections. It is easier to complete lots of little small things than one large task, this also helps reduce the issues that come up from context switching.
  • As I said in the Time section, following GTD principles will help a lot.

Focus can also mean how focused and committed you are to shipping the project and getting it over the line months after the initial excitement of starting a new project, my tips for this really come back to what was outlined in the section about your passion for the project, revisit the reason why you were so passionate about the project to begin with.

Wrapping Up

Hopefully you found this list useful and if nothing else hopefully I have introduced you to an excellent podcast!

The post Stacking the founder chips in your favour. appeared first on Toby's Ramblings.

]]>
http://tosbourn.com/2013/05/web-stuff/stacking-the-founder-chips-in-your-favour/feed/ 2
Comments are back http://tosbourn.com/2013/05/web-stuff/comments-are-back/ http://tosbourn.com/2013/05/web-stuff/comments-are-back/#comments Wed, 22 May 2013 19:16:19 +0000 Toby http://tosbourn.com/?p=1538 I have decided to reinstate comments on the blog using Disqus again. This is mainly down to the campaigning of @PunKeel so you have them to thank! Here is my post where I talk about turning them off, hopefully I won’t change my mind again!

The post Comments are back appeared first on Toby's Ramblings.

]]>
I have decided to reinstate comments on the blog using Disqus again.

This is mainly down to the campaigning of @PunKeel so you have them to thank!

Here is my post where I talk about turning them off, hopefully I won’t change my mind again!

The post Comments are back appeared first on Toby's Ramblings.

]]>
http://tosbourn.com/2013/05/web-stuff/comments-are-back/feed/ 0
Internet Explorer Version 999.1 http://tosbourn.com/2013/05/web-stuff/internet-explorer-version-999-1/ http://tosbourn.com/2013/05/web-stuff/internet-explorer-version-999-1/#comments Wed, 22 May 2013 15:22:45 +0000 Toby http://tosbourn.com/?p=1535 Was running a quick report on Internet Explorer usage today and found this;   Just wanted to share it as one of those LOLWTF things you find every so often.

The post Internet Explorer Version 999.1 appeared first on Toby's Ramblings.

]]>
Was running a quick report on Internet Explorer usage today and found this;

Internet Explorer 999.1

 

Just wanted to share it as one of those LOLWTF things you find every so often.

The post Internet Explorer Version 999.1 appeared first on Toby's Ramblings.

]]>
http://tosbourn.com/2013/05/web-stuff/internet-explorer-version-999-1/feed/ 0
MySQLslap – A quickstart guide http://tosbourn.com/2013/05/mysql/mysqlslap-a-quickstart-guide/ http://tosbourn.com/2013/05/mysql/mysqlslap-a-quickstart-guide/#comments Tue, 21 May 2013 12:49:47 +0000 Toby http://tosbourn.com/?p=1527 Let me set the scene of how I stumbled upon the need for MySQLslap. The database server was getting hit hard and slowing down the application, we narrowed the issue down to one potentially bad query. We then took a copy of some production data, put it on our local machines and started hacking to [...]

The post MySQLslap – A quickstart guide appeared first on Toby's Ramblings.

]]>
Let me set the scene of how I stumbled upon the need for MySQLslap.

The database server was getting hit hard and slowing down the application, we narrowed the issue down to one potentially bad query.

We then took a copy of some production data, put it on our local machines and started hacking to see if the query could be improved.

Even though using EXPLAIN we were able to see it was a bad query, and running our new query through EXPLAIN made it look like a good query, we couldn’t actually benchmark how much better it was. You see our issue was that when ran once the query finished in a reasonable amount of time, the issue only seemed to appear under production load.

There are plenty of tools available for testing your code under load, but I didn’t want anything above these queries dirtying the results, for example I didn’t want ActiveRecord to try and do anything smart with caching, I wanted only to see what SQL statement worked best.

Turns out MySQL comes with a tool to help you do just that, MySQLslap.

MySQLslap

As the name suggests MySQLslap slaps your MySQL tables with a load of queries at a rate and concurrency that you set.

After the queries have ran it will produce a small table breaking down the times for you, which allows you to easily compare and contrast.

Here is an example of some output from MySQLslap;


	Average number of seconds to run all queries: 0.014 seconds
	Minimum number of seconds to run all queries: 0.012 seconds
	Maximum number of seconds to run all queries: 0.017 seconds
	Number of clients running queries: 50
	Average number of queries per client: 2 

This was generated from one command, that took a very small amount of time to set up.

MySQLslap – Setting it up

In order to get the above output I just needed to enter one line into my terminal;

mysqlslap --concurrency=50 --iterations=5 --query=/Users/me/Desktop/test1.sql --create-schema=my_database  -umy_username -pmy_password

I will go through each flag in turn;

  • mysqlslap – This is the program we are running, if you don’t have it installed make sure you are running at least MySQL 5.1.4
  • –concurrency – This is how many connections you want to emulate  very roughly this adds more load onto MySQL, imagine 50 people hitting the same page at the same time.
  • –iterations – This is how many times you want to run the test, obviously the more you do it the more accurate your average will be.
  • –query – You can type the query or queries into here, but I preferred to have them saved in a .sql file, so in my case I just reference where my file is located (note: you cannot reference the home directory by typing ~/ mysql doesn’t understand it)
  • –create-schema – This is the most confusing flag in my opinion, this means which database you want the test to use, because it is called create I wrongly assumed at the start it would kill my current database, it does not (but any queries you run will affect it)
  • -u – The username you use to connect to your database (optional depending on your setup)
  • -p – The password you use to connect to your database (optional depending on your setup)

Hopefully that will help get you on your way.

MySQLslap resources

Here are a collection of useful resources (I will add to this over time);

The post MySQLslap – A quickstart guide appeared first on Toby's Ramblings.

]]>
http://tosbourn.com/2013/05/mysql/mysqlslap-a-quickstart-guide/feed/ 0
You should never publish a blog post on the day you write it http://tosbourn.com/2013/05/development/you-should-never-publish-a-blog-post-on-the-day-you-write-it/ http://tosbourn.com/2013/05/development/you-should-never-publish-a-blog-post-on-the-day-you-write-it/#comments Tue, 14 May 2013 13:23:24 +0000 Toby http://tosbourn.com/?p=1514 This is something I am continually guilty of, writing something, giving it a quick read over and then immediately posting it up. This isn’t a good idea and it leads to lower quality content being produced and potentially ill conceived ideas being aired. Obviously in some situations there is an advantage to being first to market, and [...]

The post You should never publish a blog post on the day you write it appeared first on Toby's Ramblings.

]]>
This is something I am continually guilty of, writing something, giving it a quick read over and then immediately posting it up. This isn’t a good idea and it leads to lower quality content being produced and potentially ill conceived ideas being aired.

Obviously in some situations there is an advantage to being first to market, and this applies to blog posts as well. If you are writing about some form of breaking news or writing a ‘live blog’ about something then it would make good sense to ignore this post, but for most other types of writing I think you would benefit from taking a break between writing and publishing.

There are several reasons for this;

  • During the time you finish writing and the time you publish you might come up with a new idea or angle to explore in the post.
  • Grammatical and spelling errors are easier to pick up with fresh eyes.
  • Social media along with sites like Reddit and Hacker News mean your post could be being seen by thousands of people within minutes, so you don’t have the luxury of making small incremental changes after you post.
  • You might think of better wording for something or a more eloquent way to write it.

I have read some people like to wait a week or more before revisiting a body work, I have done this before but I haven’t found that any more effective than just leaving it for a day or two. Your mileage may vary.

It also helps to steady your output, I for one have this massive creative surge for writing at around 11PM at night, depending on the length of the post I could have it written and proof-read by midnight, even if it was good to go and I didn’t think anything could be added it to this would not a good time to post, holding off means I have content that I can share at more opportune times.

The post You should never publish a blog post on the day you write it appeared first on Toby's Ramblings.

]]>
http://tosbourn.com/2013/05/development/you-should-never-publish-a-blog-post-on-the-day-you-write-it/feed/ 0