martes, 22 de marzo de 2011
Managing the unmanageable with git
Mostly, for me there's a first blocker that is understanding how the global thing works. To solve this, I can recommend git from the bottom up. a great introduction to git written quite differently from most other docs that want to explain the same. Understanding the low level stuff helps you getting intuition, and IMHO it's essential to get this kind of intuition when using such holistic systems.
Most tutorials give you the essential syntactic information that you can get from man (btw, man git-whatever will give you lots of info), but for me, knowing the workflow and how-to think gittish (or thinkgit if you prefer) is what bothered me most of the time.
You probably have heard about nvie's git workflow. I haven't tried it yet, and at work we use a simpler workflow based on a remote master branch, two local branches (master,working) and quite centralized flow.
Not being a git power user (I'd say I'm just scratching the surface) I'm going to write a couple of posts that are what I'd have needed when I started with it seriously.
Checkout - what happens when you checkout
Clean - oops, I think I messed something
Stash - Smashing the stash for fun and profit
Rebase - commit -am 'fdsda'
Bisect - It's always been that way NOT!
If you have suggestions or something to add, I hope you will comment. Remember, I'm learning as I write these posts, so you can and MUST collaborate!
lunes, 7 de marzo de 2011
Perl Higher Order Functions
To clarify the concepts, I wrote some trivial scheme functions-as-data munging in scheme, and translated them to Perl.
What surprised me, was the "wow!" comments about concepts that aren't perl unique features, but general higher order procedures. Certainly, Java and C++ are 'a bit' behind Perl, Ruby, or Lisp, but it's fun to remember how mind blowing are these concepts to newcomers. I discover mind-blowing concepts quite frequently too.
We had a good afternoon, reviewing code, Quines, concurrency, talking about GEB (The book I'd take to a desert island along with SICP)...
Here's part of the code we've written (as a reminder). Nothing useful, but tiny proof of concept of HOP. Ah, btw, I recommened him to read chromatic's Modern Perl book. I recomend it to all of you in the Perlsphere. Great book.
domingo, 6 de marzo de 2011
Window navigation on Emacs
I talked about one of the greatest aid to frame/window navigation of screen and ratpoison, that is window numbering, and being able to switch to random windows instead of just sequentially.
Well, today I spent some time thinking about possible solutions, and searching for already implemented modes.
Guess what? There are a couple of ways already implemented (in default emacs, or as an extra downloadable package).
Windmove comes bundled with emacs since 21-dot-something, and in fact is what vimpulse uses for the c-w [hjkl] emulation.
(windmove-default-keybindings) ; enable shift-arrowExpanding the concept further, there's also FrameMove, that integrates seamlessly with windmove. Here's a little extra info about it.
I found a couple of more esoteric plugins to navigate windows, but haven't tried them.
http://blog.lathi.net/articles/2007/11/07/jumping-to-specific-windows-in-emacs explains how to jump to windows by title. I suppose like ido-mode or anything-buffers.
There's also https://github.com/dimitri/switch-window , that seems to bring ratpoison's numbering of frames to emacs' windows. Nice idea. Here follows a screenshot of switch-window from it's homepage.
lunes, 28 de febrero de 2011
Programmer problem solving sequence
2010 developer’s problem solving sequence:
- Coworkers
- StackOverflow
- RTFM
- Think
It's funny because it's true.
Via HN -> JCook -> Philippe Leybaert
lunes, 21 de febrero de 2011
run interactive applications inside emacs
To run an interactive shell, get history for free, and completion (at least hippie-expand if you teach your emacs to use it), you just have to use make-comint.
(defun run-has ()
(interactive)
(make-comint "has" "/path/to/hascheme/script/lis.pl" nil "/path/to/hascheme/script/builtins.scm"))
the last parameter is the argv, you can fill it with whatever you want. In my case, the scheme file with some builtins.
On the hascheme side, I've been experimenting with tail call optimitzation, an improved repl with multiline support and with some cool debugging features. You'll know shortly about them if you follow this little blog of mine.
Well, and here's a screenshot of the comint buffer on hascheme. note the completion thing on the minibuffer.
martes, 8 de febrero de 2011
(let ((there be)) lisp)
I keep having lots of fun with hascheme. In the last couple of
days, I implemented quite a few things. Mostly they are syntax
sugar for things you could already do in HAS, or useful procedures
needed for my basic interpreter testing.
- Perl side
- (define (fun args) body) is now accepted as an alternative way
to declare procedures. - (let) implemented. These bindings for local vars are just sintactic sugar for
what you'd write in perl:
sub { my $a=shift; … }->(initialval)
- (define (fun args) body) is now accepted as an alternative way
- Scheme side
Reread the 'Why functional programming matters' paper, and implemented:- make-counter, foldr
- append, sum-list, length, map . All are specific cases of the previous
- make-counter, foldr
Reading chapter 4 of our MIT beloved book, I saw the next step, making a lazy
interpreter from this Half Assed one.
Ah, the repo
lunes, 7 de febrero de 2011
Put more vim into your emacs
I'm a vim editing model fan, but emacs is slowly crawling into my
life. emacs had viper (vi emulator) for ages, but it falls short if
you're a vim power user. Vi is not Vim.
For some time there's been vimpulse package that tried to narrow the
difference, adding Visual mode, and some other goodies. Recently,
vimpulse got reactivated, and now, we get text objects, and many
other features from our beloved text editor.
You can even use map, imap, vmap and the like;
the first thing I tried was mapping jk to esc, but the tip in the
vimpulse wiki didn't work. I managed to make it work with this line
in my .emacs file.
(vimpulse-imap "jk" 'viper-exit-insert-state)
Now, there's no need to reach the far escape key.