miércoles, 30 de diciembre de 2009

startup lessons

Y combinator (Paul Graham's company, and hacker news hoster) publishes a list with links that talk about startups. Many of them are Graham's past articles (worth reading nonetheless).

I've quickly scanned the list, and some of the articles linked, and it seems quite interesting, so worth pointing it here.

As I don't have anything else to add, I'll just post an image I saw yesterday at #perl6 channel @freenode. It's funny and, maybe can add information if you are deciding what language will you base your startup on.


It's a pity there's no perl there.

martes, 29 de diciembre de 2009

Binary search and dumb compression in Common Lisp

In my quest to learn lisp, I've been alternating scheme and common lisp readings and lectures.

I find scheme really enlightening, but quite difficult to write in it. Maybe it's because I haven't officially reached the set! chapter in SICP, and I still find difficult to write (so) functional code.

The point is that I finished this book and then, I started Paul Graham's ANSI Common Lisp. I've been really enjoying this reading, because it shows you interesting things (from an experienced programmer point of view) from the very beginning.

During the first 3 or 4 chapters, threre are some code examples, that I've tried to write on my own (maybe grasping a bit on graham's code when I got stuck, but well)

First, here's a compress/decompress lists lisp code. When entered a list like (0 0 0 1 2 1 1 0 4 4), compress returns a list of atoms or lists themselves, that contain the number of repetitions and the value to repeat: ((3 0) 1 2 (2 1) 0 (2 4)) . It's nice to see that at such low level point, being able to ask for a type of a given element gives us enough power to code this in a very simple way. I don't even want to think how I'd code it in java/c++.

Decompress does obviously the reverse operation



The binary search is just what its name says. Does a binary recursive search on an already sorted vector (array of 1 x N dimension).



I'm getting very fond of 'cond'. It takes the best things of both if and switch/case worlds. A switch-case like syntax, with powerful conditionals (not just comparing with '=')

That's all for now. Sorry for the crappy gists code listings. it seems github doesn't know much about common lisp (syntax nor indenting).

Btw, I've received my SICP copy in dead-tree format, so I'll probably spend some time with scheme when I finish Ansi Common Lisp.

Oferta de trabajo


Aquí voy a trabajar yo.

viernes, 25 de diciembre de 2009

Programmers, improving productivity and salaries

Hello dear reader,
Today you'd better be prepared for a mashup post of several sites and articles about programming (in the most generic sense of the word), improving your programming skills, and what people think about how to divide the programmers set into two subsets: good ones, and bad ones {disjoin,complete}. Lots of links, yeah. It all depends on the time/willingness at your disposal.

Learn to program
Learning to program is not an easy thing, nor something that can be achieved in 21 days (see Peter Norvig Teach yourself programming in 10 years). But the nice thing about programming is that you can learn by practice, and start with babysteps, and improving little by little, learning about new paradigms(lisp,Io,haskell are nice tools for that), reading highly recommended books (you can get lots of them legally for free on the internetz), or joining a Opensource Project to learn from others.

Little by little, I feel how I get the knowledge, sometimes through slow readings, and sometimes with sudden "OH FUCK!, AHAHA!". This moments when your brain 'clicks' (mostly in functional programming) are priceless. I hope to have achieved a good level of programming skills in a couple of years. For the moment: keep learning.

Motivation

Keeping the interest for something is very difficult nowadays, with so many potential distractions (beer,friends,girls).

What can keep you motivated to keep learning? I've no f*cking idea. For me, it's a mix of several things:

  • Keeping in touch with good hackers. This really pushes me to keep learning. I've found it priceless. After someone told me about Barcelona Perl Mongers, I joined them, there I met great programmers (now friends), and we could even start collaborating. Nowadays I'm at Barcelona.PM , GTSmalltalk and flibug.
  • Collaborating in some project is good to keep hype on something.
  • Open a new project to play with it.Even if it's nothing serious, but you'll get in touch with git/mercurial, and can try things as you learn elsewhere.
  • Be humble. Keep reminding yourself that everything you do, can be improved. Having a (false) feeling of superiority makes you lower the bar. However, of course, if you think you did something well, you can give yourself a cookie, pat your shoulder and show the code to your friends :)
  • IRC. yeah, ircing on freenode has teached me lots of things.
  • Keep it fun. please
Listen to the masters
Masters are so for a reason. foreach problem you may have now, they have "been_there_done_that", so listening to what they have to say it's very valuable.

I'll just paste some links, about guidelines to improve your coding. They tend to be very general (and language agnostic), from the well known "comment code", to "follow idioms". For me, knowing the idioms of a language has been a great improvement to feel more self confident when writing and reading code. Reading reddit and hacker news from time to time can show you new people to follow. (ALERT!: Addictive)

there are guidelines that can be splitted in small chunks and read a paragraph on a daily basis. I've been doing this for some time, and I think it's very useful. I've doing this TipOfTheDay style reading with "Perl Best Practices" and "Pragmatic programmer" too.

Other are more like checklists. Anyway, there are lots of similar lists.
Hire programmers
Here are some essays about recognizing a good programmer. It's interesting how most points in theese latter essays match with the points on the upper links in this thread. I guess we're on the right track.

UPDATE (09/12/30): In HN there has been linked a site with a programmer competency matrix according to knowledge of a given programmer. I don't know how useful or fair it is, but it matches quite good with my ideas. I'm glad to be between level 1 and 2 (mostly 2, and hey, there's level 0 ;) ) and I am in some level 3 situation, or will be in couple months (estimated time). I think it also leaves it misses some other important points, and eventually, real productivity can only be measured after the work is done. Mind you it's not easy to measure productivity (see "office enabler" below)

Remuneration


But, do great programmers (that can be 10x more productive than average ones) earn that proportional money? Clearly no. Read the complete article by John D.Cook.
It reminds me of the "office enabler" role I talked about last august.

martes, 22 de diciembre de 2009

1984. You never pushed that.

Rewriting history is one of those things we all would want to do at least once in our lives.

Well, unfortunately, I don't have a solution for that, but in the computer world, you know... we even have ctrl-z !

But when things are uploaded to external server or repository, it's not that easy. Until git.

I accidentally pushed a 600Mb file to a git repo that (luckily) never changed, but when I cloned the repo, I had to wait for several minutes until git downloaded the 30+ Mb file (git, or at least github compress files).
git filter-branch -f --index-filter 'git update-index --remove filename' HEAD
git push --force --verbose --dry-run
git push --force
With just theese lines, you can pretend you never uploaded it. The only thing to keep in mind is that you should work on a up to date working copy.

Now you could even convince Winston Smith in room 101 that a given file never existed.

Scared? Yeah, you should be.

domingo, 20 de diciembre de 2009

Dos hablando

- Es una pena que las mejores cosas de la vida, sean ilegales...
- Lo dices por las drogas?
- Nono, lo digo porque lo pienso de verdad.

viernes, 18 de diciembre de 2009

git clone and pull remote branches

I thought that when I pushed/pulled branches in git, I only acted on the active branch (unless I specified it).

Well, that is not (entirely) true.

The problem is that when I clone a repo, I can't specify a given branch, and git only seemed to fetch the master branch.

When you clone a repository, you fetch all branches, with all the history (I thought that happened in hg but not in git, well anyway).

What happens then, if I don't see other branches than 'master'?
type:
git branch
And you'll only see master branch. Other branches are hidden. To see them you should type:
git branch -a

So your branches are effectively there. To use any of them, you should
git checkout -b local_branch_name origin/remote_branch_name
I think what that line does is create a new branch and filling it with the fetched branch with that name, and bind the pull and push paths to the remote ones.

Another way?

In other sources, I've found that simply pulling with:
git pull origin Branch_name
will do the same, but, when I tried it, it downloaded/extracted the files, but without changing to the branch name.

Question

Now the question is:

What happens if I modify two branches, and then just "git push" ? will it push both branches? That's what I'll try in next days, and after a bit of experimenting, I'll post back.

Btw, here are a couple of links you can read for a bit more info.