sábado, 4 de agosto de 2012

Back to Vec


  If you've followed this blog, or you know me, you know I've been a
   vectorlinux user and collaborator for a few years.  Lately, I didn't
   use it and favoured Ubuntu and Arch. The change was done because I
   needed packages that weren't in the official vl repos, and were not
   trivial to build. And was lazy.

   After 1 year (more or less) I found another opportunity for vl, and
   I have to say I'm happy to have tried it.

Installing vectorlinux

   I'm using a Lenovo thinkpad X61, and it doesn't have CD, so the way
   to get a linux running there is booting through an usb drive.
  
   I used unetbootin + VL light 7.0, and found the first
   issue. There's some missmatch between unetbootin versions and vl
   image format, and my unetbootin left the boot image in
   isolinux/kernel/sata instead of /syslinux/kernel/sata . Just
   copying the directory to the other place solved the booting issue.


Booting

   As usual, everything worked as expected, no glitches, and all
   configs did their job.

Packages

   After installing a linux distro, first thing to do is installing
   the 'must have' apps.
  
   - edit /etc/slapt-get/slapt-getrc and enable a few more repos
   - slapt-get --update
   - slapt-get -i ratpoison

   Nice we have 1.4.5 there :). Then, let's go for emacs. OOps,
   there's just emacs 23.X in the repo.

   As a side note, I have to say that besides not having used vl for a
   year, I kept an eye on the irc channel, and I've kept in touch (and
   sometimes giving a hand or opinion in vl projects) with rbistolfi 
   (one of the devs).

   Long story short. After pinging rbistolfi and asking for emacs
   24.1, I had a working package in 30 minutes. And the effort is not
   lost, but all the work is prepared to be pushed to the repos.
  
   While doing my usual instalations, I found some missing packages in
   the repo, so asked for a way to contribute back. You know, I wrote
   the package that vl still uses to build packages, but now I see the
   workflow is much more streamlined. See it in the NEXT POST (NIY).

Early opinion

The first impression is that the whole system is faster than ubuntu. As always, the package selection is really nice, and not having to install 5 related  -dev packages but just one when I need a feature is really confortable.

I already comited a couple of packages to the repo, and found some bug in sbbuilder that I'll try to tackle this weekend.

Vectorlinux, I'm back!

martes, 24 de julio de 2012

Maybe google doesn't know so much about me

Ok, I just used G+ for a few days, and I find some interesting people in there, and also read all that hype that's having, so I decided to explore it a bit, and maybe add people I know IRL to G+ (I  refuse 70% of known people, also on facebook).

I found a tab named "Explore", and thought that maybe these guys would present me something useful. A g+ walkthrough, or interesting posts (hint: TED talks or Google.IO). So here are the first 3.





Jooooder, suputamadre, and many more spanish swearing words after seeing the 'highlighted' posts that google selected for me. It's like quantum leap happening and being an average retarded 15 year old.

Google, I like programming, music, skating, partying, science, art, books, and pr0n.

Thank you.

sábado, 21 de julio de 2012

When mapcan backfires

While writing some elisp for clasker (still alpha), The destructive function mapcan backfired in a really strange way.

Calling mapcan on a list of really simple functions that just returned lists, worked ok, but just the first time.

The issue is a combination of different things, mainly Iterating through functions that return quoted lists.  When nconc does its thing, it uses the lists in place, so we're indeed modifying the defuns.

Here's the small code that exemplifies the issue, and a possible way to avoid it.

ELISP> (defun t1 () '("hola"))
t1
ELISP> (defun t2 () (list "adeu"))
t2
ELISP> (t1) 
("hola")

ELISP> (t2)
("adeu")

ELISP> (mapcan 'funcall '(t1 t2))
("hola" "adeu")

ELISP> (t1)
("hola" "adeu") ; => Oops, t1 has been modified

ELISP> (mapcan 'funcall '(t2 t1))
("adeu" "hola" "adeu")

ELISP> (t2)
("adeu")

ELISP> (defun t1 () '("hola")) ; Redefine t1 and t2 for sanity assurance
t1
ELISP> (defun t2 () (list "adeu"))
t2
ELISP> (mapcan 'funcall '(t2 t1))
("adeu" "hola")

ELISP> (t2) 
("adeu") ; => t2 is fine

Generating the lists with the (list ...) function solves the issue, because a new object is created every time, so we're not returning the literal object from the source.

Also,  (reduce 'append (mapcar ...)) will do "the right thing" (tm)

jueves, 5 de julio de 2012

Learn javascript as a little schemer

I recently found a blogpost talking about javascript prototypes in a very funny and uncommon way. It was funny to read, easy to follow, and high on insights. Out of the sudden, something clicked in my brain, and I thought:

 - Aha!, I've seen this way of explaining things in some other place! It's like the Little Schemer (and all the schemers collection (which I haven't read (yet)))!

 Then, I checked other posts on the same blog, and most articles follow the same socratic experience of explaining things.

 Really, it's funny, and it builds up on you.

 Well, and here's the url of the blog. Kudos to AngusCroll (author), you have a new blog follower.


EDIT: I just found another instersting post for js wannabies like me. Simpler, but interesting read

miércoles, 4 de julio de 2012

"Chrome does UDP sockets" joke

Opening a new section, here's the first post in the new section irclog, where I'll just copypaste remarkable pearls that appear in one or other channel I'm usually logged. Be prepared for geek jokes. I can't promise to be involved in all :) And here's the first. with my 3scale coworkers
<a> http://blog.alexmaccaw.com/chrome-tcp-udp "Chrome supports TCP & UDP Sockets"
<a> you can do udp jokes in chrome now
<rgrau> I didn't get it
<a> I don't care
<rgrau> great!

martes, 19 de junio de 2012

erc-oops

Hi again emacsians.
Maybe you're familiar with this IRC log samples.

  15:54 [rgc] xb
  15:54 [rgc] ooops, C-fail

  12:02 [xyz] ls
  12:02 [xyz] oops

  00:21 [foo] cd
  00:22 [foo] wrong buffer :/

To avoid that, some time ago I wrote some elisp to make erc-buffers read-only, but I just came up with a better solution:
(defun rgrau-erc-oops (txt)
  (when (member txt '("ls" "xb" "cd"))
      (setq erc-send-this nil)))

(add-to-list 'erc-send-pre-hook 'rgrau-erc-oops)


It's too simple to make an erc module out of that(isn't it?), so I just put it in this blog entry.

jueves, 7 de junio de 2012

erc-button fun


Erc is one of multiple irc clients bundled with emacs.  It's probably the most complex one, in fact, in #emacs you read that quite a few people left it in favour of simpler clients like rcirc. But I kind of like its complexity :)

One nice thing about erc that's not very known is erc-button.  Yeah, the thing that allows you to click on nicknames and kick them :).

At work, we use github issues to manage our stuff, and we wrote a super simple extension for our bot that whenever it sees #number it just pastes the url of the issue. I tried to use a more silent approach using erc-button, and here's the result.

It just highlights #123 like strings and make them clickable, linking to the appropiate issue in the appropiate repo.


Neat, no?

Well, if you happen to use other sites for your issues, you can work around that github-centric approach with something else, I just hacked an ugly solution on top of the previous one. Not very clean maybe, but working.

Probably, the most sensitive solution would be writing the whole urls for each one, but well... :D

The nice point here is the tight relation between emacs and all other tools and use case. In really few lines of code we solved a problem, and we did it flexibly enough to be used in multiple scenarios.

Btw, hi to all planet emacsers, that's my first post here since I signed in. I hope to contribute here some of my emacs tricks. Don't hesitate giving feedback and commenting.

Update: There are gists inlined in the post that aren't visible in planet emacsen.  Will try to change approach for the next one.