1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Author Archive

OK, so how do I start blogging?

OK, so you’ve read my previous post about why you should start blogging today, and you want to give it a spin. What’s next?

Let me give you a very quick getting-started guide from my angle, along with a few tips for those of you not afraid to get their hands dirty.

Domain

You have two options – buy your own top-level domain (e.g. ripper234.com), or use a “subdomain”, under some company (e.g. ripper234.blogger.com or ripper234.wordpress.com). I highly recommend going with the former option and buying your own domain from the start.

Even if you’re just experimenting with blogging, and not sure it will stick, the cost for using a custom TLD from the start is so small ($5-$11) that it’s not worth the trouble. The big win about using your own domain is that you own 100% of the content down to the URL structure, and you can start building good, long term SEO for your site (essentially, start accumulating good page rank in Google). If you start your blog on a on someone else’s domain, and two years afterward you want to switch to another provider, your links will have to change (e.g. ripper234.wordpress.com/my-cool-post to ripper234.blogger.com/my-cool-post), and this might affect your Google ranking. There are workarounds for this, but it’s better to just do it right from the start.

Platform

There are a lot of blogging platforms out there, but IMO there is one clear winner, popularity wise, which is wordpress (5 million wordpress sites, much more than the alternatives). WordPress has gotten to be real easy to use in the last few years, with one click updates, improvement on its editing and plugin mechanisms, and just overall richness of the ecosystem.

WordPress is open source, so even if you don’t know PHP, there are a lot of coders out there hacking away, fixing bugs, submitting new features (mostly in the form of plugins), and you can rest assured that whatever feature you need from your blog in the future, someone will add it sooner or later.

I migrated my blog from Blogger to a self-hosted WordPress blog about four years ago, and never looked back.

Self-hosted vs “Hosted”

I recommend you start with opening a Hosted solution on wordpress.com, and register your own domain. This will cost you around $20 a year total, and you get all the advantages of a custom domain. You will not have the full customization/plugins options of a self-hosted blog, but when you start out, you won’t need it … there are plenty of customization options given free, out of the box (check under Appearances–>Widgets).

Sooner or later you might discover that you need your blog to do something that is not supported in the Hosted option, like automatically push your posts to Facebook/Twitter, connect your blog to Google Analytics to see powerful data about your visitors, post code snippets in Java, or have automatic backups of your blog sent to your email. For these, you’ll have to migrate off the comfort zone of wordpress.com, and into a more professional hosting. This might cost a bit more (you can get decent hosts from $5-$10 a month), and won’t be covered in depth in this post.

If you’re willing to pay extra for the comfort, you can get the best of both worlds – a fully customizable blog, with almost zero maintainence and setup time. Check out WPEngine … they’re rather expensive (starts at $30 a month, not including the domain name), but at least they have a 60 day free trial period.

Ask Questions!

If you have any question about WordPress blogging, go to wordpress.stackexchange.com and fire away, there’s a community of professional bloggers ready to assist you.

Why you should write a blog post today

Blogging was quite a trend a few years ago, but with the rise of Facebook & Twitter, it’s fallen out of favor with some. Well, I’m here to tell you that you should open your own blog today, and if you own a blog but haven’t posted in a while … you should come back to it and post some more.

There are several reasons for maintaining a blog, some of which I’m sure are relevant to you:

Reason 1 – A technical memento to your future self

I found out today how to do something cool. In a year, I won’t remember how to do it … but I might remember it enough to know what to look for. Once I’ve blogged about something, if I Google for it in the future I often find my own blog post, and save myself a considerable amount of time.

There are other venues for such mementos-to-self, but none as indexable and expressive as a blog post. Facebook content is poorly searchable … I searched for something I posted 2 days ago on Facebook and failed to find it except going over my stream/timeline. Twitter is very limiting … I guess it might be good for something, but not for keeping concrete knowledge about how to solve a problem, except that knowledge is just a link.

You could post a Stack Overflow or Quora question, and answer it, but that feels kind of akward. Actually, Quora has Boards which are rather similar to blogs for this purpose.

Reason 2 – Why not share the love?

An immediate followup to Reason#1 – if you worked hard and found out something, why not share it and save some time for other people who might run into the same problem? It’s just being a good citizen, and it doesn’t cost you more effort to share it rather than keep it in a private knowledge base e.g. Evernote / Google Docs. If you’ve ever Googled and found a blog post that solved your problem – now is your time to give something back.

Reason 3 – Professional Resume

Your blog tells the world about you. Whenever I interview for a job, the first thing on my resume is my blog. It shows that I am passionate about my profession. Even if your blog is just a collection of links, it shows what kind of technology stack you’re using or interested in, what your beliefs are, and what makes you tick. I’ll give a candidate with a personal blog a big +1 over a candidate without a blog any time. It takes courage to go out there and say “Even though I’m not worthy, I’m still out here, doing, writing, and sharing. I’m not the best software engineer / biologist / whatever in the world … but I’m trying my best, and I want to share it with you”.

Reason 4 - Alzheimer

This is an extension of reason 1. Reason 1 was about forgetting technical stuff … but as the years pass, you don’t just forget technical stuff, you forget who you were. Your life isn’t lived by a single personality, but is rather experienced by an endless series (or continuum) of personalities, each slightly different than the ones before it. I hardly remember what things we like twenty years ago … but I do know that 5 years ago, I felt the immense joy of leaving the army, didn’t like Google for a day, and had loads of fun playing Portal.

I recently started maintaining, in addition to this blog and social media accounts, a personal record of how each day worked out for me. My setup is simple – I setup a Google Calendar event to send me a daily reminder at 7 PM each day. I forward this reminder to Evernote, and prefix it with a number between 1 and 5 of “how much I enjoyed this day”, plus a one liner of key events that happened. I have a grand plan to one day go over these notes, chart out my happiness graph, and note any specific events … but for the time being I’m recording.

A blog can serve to record part of your history – the part you’re willing to be public about, of course. I picture my kids, ten or twenty years from now, reading through my blog (yeah right, all hundreds of entries :) , to learn who their father was back on 2012, when we didn’t have hovercrafts and teleportation. Maybe it will happen, maybe it won’t, but I know that I would have been happy if my parents had kept such a diary.

Reason 5 – Helping semi-distant friends keep in touch

I have 267 friends on Facebook … guess with how many I actually keep in touch in real life? I guess maybe ten-fifteen max, and the real number is probably more close to five. But, thanks to Facebook, I get to not lose my other friends completely. Even though I don’t spend enough time with them, I get occasional glimpses of their lives.

The problem with social networks is you can’t possibly keep up with everything … I even miss cool posts like this one because they’re swallowed up in a huge stream of noise.

A part of the fix is blogging. When you have a blog, I’ll follow it with my trusty Google Reader, and it won’t get swallowed up, because I do read or glance everything in my reader stream. So please, if you’re a friend of mine, do me a personal favor and blog – I want to keep in touch with you!

Summary

Please, don’t give me bullshit like “You don’t have anything worth writing about” or “You’re not a good enough writer”. Perfect is the enemy of good … just start by writing something, it’s better by any definition than not writing anything. If you care about it, work on your writing and save up interesting bits to write later (I was saving the idea for this post for a couple of months now, until I got the time and energy to write it). Stuff happens in your life, both personal & professional. Save up the good parts, and write … your future self + children will thank you later.

First Java & JVM Tel Aviv Tools Night!

After a few months of gathering forces, we have a critical mass of people interesting in learning and teaching about Java & JVM related technologies.

Our first Tools Night is this upcoming Sunday (29/04), in Sears Israeli (Hertzelia Pituah).

Please check out the schdeule on EventBrite, and subscribe if you’re interested. Also don’t forget to subscribe to the google group.

How UserVoice use Trello

(Via Joel Spolsky)

Read this bit on how UserVoice use Trello.

Takeways:

  1. They use six+ dedicated board
  2. Whenever a list gets to be so long that you’re scrolling down –> you’re doing it wrong.
  3. Developer only works on 1-2 things at a time: One Major feature and sometimes one Minor feature. Don’t pre-assign ownership before you work on something … it’s flexbile.
  4. Don’t have a separate system for bugs
  5. They don’t try to do project estimates – it just does’t work :)
  6. Celebrate deployments – each week/sprint, review what was achieved in that week, and celebrate the good stuff. Keeps the product team connected to R&D.

bitcoin.org.il – a site for the Hebrew/Israeli Bitcoin Community

In the last Bitcoin meetup with had in Tel Aviv, a bunch of us decided to create a place for the Israeli Bitcoin Community.

So, if you’re in Israel (or just read Hebrew), and dig Bitcoin, drop by the site and subscribe. The site is of course non-profit, and its goal is to build and strengthen the Israeli Bitcoin Community, ranging from “Bitcoin Curious” through users to developers and investors.

P.S. We are looking for content writers – if you’d like to write articles about Bitcoin in Hebrew (and maybe even earn a few BTC in the process), be in touch.

Easy linux backup with duplicity

After looking at several backup solutions for a linux-based project of mine, ranging from more advanced systems like bacula to a range of python/bash scripts, I finally found the ultra simple duplicity. Don’t get me wrong, bacula and its brethren really seem more powerful overall, but when you just need a simple solution, you can’t compete with duplicity’s simplicity.

duplicity is drop-dead simple backup system that does incremental/full backups, and supports a wide variety of backup targets from the box, including file, ftp, scp, s3, and a dozen others. The usage is simply

duplicity /folder/to/backup file:///path/to/target/folder

You can have the target folder be a local or S3-mounted folder (with the excellent s3fs), or use other supported URIs. The default is an incremental backup, by you can override by choosing a full backup. It even has support for “keep the last N full backups and delete the rest”.

The only feature that I required, and duplicity didn’t have, is automatically choosing when to do full vs automatic backups. I would like to tell it “every 100 runs, do a full backup”, and this is not supported out of the box … although easily fixed with a wrapper script. Put that in crontab and you’re set. Oh, by default it requires setting a PGP key, but if you’re lazy you can skip it with the –no-enc option.

A few jQuery tricks from a newb

Hi all, this is your newb web developer talking again. While some of the following might be obvious to the more experienced web devs among you, this is a post that I wish I’d read when I just started using jQuery.

Write your own jQuery plugins

The word “plugin” usually entails something complicated and with some non-trivial learning curve (e.g. how many of you ever wrote a Chrome of Firefox plugin?) Well, in jQuery, this is really not the case. Here is how you write a simple jQuery plugin:

$.fn.enable = function() {
  $(this).prop("disabled", false);
};
 
$.fn.disable = function() {
  $(this).prop("disabled", true);
};

I find it useful to wrap even simple one liners such as .prop(“disabled”, false) with a plugin, because the semantics of writing $(“#foo”).disable() is much nicer than playing with properties/attributes directly. I haven’t written a lot of plugins yet, but it’s something to keep in mind as a useful tool to wrap actions on specific DOM elements.

Know the commonly used plugins
There are a ton … I still know very few of them. Here are a bunch of useful ones (and the ones I personally know and use).

A lot of plugins are very easy to use, and have good documentation and demos, so not using them and rolling your own solution is usually just a result of ignorance. Take the time to educate yourself!

UI Queues
For a long time I’ve that you can do things like $(“#mydiv”).show(), $(“#mydiv”).hide() and even $(“#mydiv”).show(1000) for a simple animation. Only recently I discovered you can actually chain these using Event Queues:

$("#mydiv")
  .hide(1000)
  .delay(500)
  .show(200)
  .fadeOut();

Each call to an animation method gets queued up and executes after the previous one.

Deferred
jQuery Deferred is a little gem. It lets you write fluent code similar to the queue example above. Here is how you use it:

$.when($.post('http://api.com/request_1'),
       $.post('http://api.com/request_2'))
  .then(function(){alert("Got two responses")});

You can also use them with the event queue:

  $("#mydiv")
    .show(1000)
    .delay(500)
    .promise()
    .then(function(){/*do something */});

That’s all I have for now. Have any essential tips & tricks that I’m missing out on?

Javascript refactoring is hard

I’ve been refactoring code all my professional career. I started from C/C++, and when I hit C# (Resharper) and Java (IntelliJ), my productivity at refactoring was boosted by a few factors by the wonderful IDEs and refactoring tools that these languages have.

I am rather confident when I write “dirty code” in Java or C#, because I know that I can swiftly refactor it into beautiful code without too much trouble. Both aforementioned IDEs are so great at this, that it’s painless. You can take an ugly 300 line method and break it into several methods, break a long class into several classes, inline, move, and otherwise shape your code.

Enters javascript and web development.

Last year I’ve made the plunge and officially started working on front end web development, first at Google, and recently at Commerce Sciences. And I’ve recently discovered that … refactoring javascript and frontend code is hard.

The language is dynamically typed

Compilers and IDEs can help you less when the language is dynamic. They can make less assurances about your code, making reasoning and refactoring harder. Safely moving a method from class Foo to class Baz is an easy feat in a statically typed language, and a difficult or impossible one in a dynamic language.

Classes are not first-class citizens

While you can do OOP in javascript, classes are not first class citizens, but rather they’re implemented using functions, objects and prototypes. Automatically reasoning about “classes” without having an equivalent of keyword class is difficult.

Your code is not just Javascript, it’s HTML & CSS as well

Web development is not just about javascript, it’s a combination of JS, HTML & CSS (not to mention other potential technologies such as LESS/SCSS, HAML, JSON, and whatever language your backend is written in). Unless you’re already a web development ace and perfectly design your codebase … you will get these mixed up. Refactoring is about changing the design of your program, and when that design is split up between three or four different technology domains, design mistakes are harder to rectify.

You can’t (at least not yet) do an automatic refactoring to “move inline css into an external css file”, or to “convert static html snippet into a javascript DOM manipulation method”. The makers of IDEs and refactoring tools don’t have javascript completely figured out yet, no wonder they haven’t gotten around to building cross-domain refactoring!

Again, if you “know what you’re doing”, you can structure your program perfectly in the first place, and won’t ever have to do this kind of “cross domain refactoring”. Sadly, we’re not all born with this kind of experience.

It’s harder to know when you’ve broken something

Backend code is so much easier to test than frontend code. While frontend testing is important, and growing, it is by no means as well understood or practiced as classical “backend TDD, this is a calculator, assertEquals(30, calc.plus(10, 20))”.

So, since BE code has much wider test coverage than FE code, and is bloody compiled for Java & C#, when you refactor FE code it has a much greater chance of breaking down, often in subtle ways you’ll only notice on IE 8, or when the network is slow, or whatever edge case surfaces your particular bug.

 

 

So … how do we manage?

  • Refactor less – Since we know refactoring is hard, we try to do less refactoring and more pre-factoring. Think a little more than usual before coding. While I’ve grown the habit of “code first, think about design later” over the years due to power of refactoring, it’s less useful in FE dev, so I need to take the time before coding and try harder to get it the design right on my first attempt.
  • Still .. refactor – IntelliJ and Resharper both offer some refactoring capabilities. I’m most comfortable with “limited scope refactoring” – those that affect one function like Extract Variable. Use the tools you do have, instead of whining about the tools you don’t.
  • Try to think harder about the different problem domains (JS/HTML/CSS), and to develop a better understanding of how to structure your program in a way that won’t force you do to refactoring across problem domains.

Please do share your own experience with refactoring in web dev!