sábado, 22 de septiembre de 2012

the gif is dead, long live the gif

Just a couple of funny links I read last week on gifs, and embeded animations on the web.

Here's a library that uses animated gifs as a way to comunicate with browsers. gifsockets is written as a joke o proof of concept, but anyway the idea is cool.

In the last days, after the presentation of the iPhone 5, there was also some discussions around on how and why they managed to put an animation on that website that would be playable in all devices, and would be high quality and wouldn't weight too much. It's funny how we have to fight the same old problems daily, and there's no fixed solution.

<rant> New platforms are so flaky that they don't even try to comply the standards, and they evolve from naive patch to naive patch to solve immediate problems, making them more and more appart one from the other. Everything is fucking broken, and you have to be an expert even to put a short animation online. And Apple is not the only one doing these tricks.  That same hack has been used for many others. SublimeText, for example also used this trick. Very clever, but fuck, that's not blackbox abstraction, when You have to think about how your animation will be encoded when doing a web.</rant>


Well, and the appropiate HN pages, just in case you wanna dive into the comments.







martes, 18 de septiembre de 2012

emacs checking your temperature

Yesterday I was on my laptop, with the usual tools opened (that means emacs, urxvt+screen and chromium-browser).Nothing strange. I went out for a rollerskating session with a couple of friends and when I came back, the laptop was awfully warm. I mean, keyboard really hot, and when I took the laptop on my hands, it was freaking hot. Luckily it didn't melt :).  A quick glance at top(1) showed that chromium was taking all the cpu, and a big amount of memory. probably some js, who knows.

Just killing the offensive process made my little old thinkpad come back to normal temperature.

Then, to make sure it doesn't happen again, I wrote a little elisp script to warn me in case my lappy is warming beyond acceptable limits. Or even kill chromium-browser in case the temperature is >95C.

So here's the  code. Checking the temperature of the cpu, and acting if needed.

;;; raimonster@gmail.com
; The array returned by battery-statys-function => '((99 . "25330") (76 . "on-line") (100 . "54") (114 . "0 mW") (66 . "charged") (98 . "") (104 . "0") (109 . "0") (116 . "0:00") (112 . "97"))

(defun rgc-check-for-hotness ()
  (interactive)
  (let ((temp (string-to-number
                (cdr (assq (string-to-char "d")
                           (and battery-status-function (funcall battery-status-function)))))))

    (cond ((> temp 95) (async-shell-command "killall -9 chromium-browser"))
          ((> temp 75) (message "FUCK! I'M HOT"))
          (t (message "ok, no problemo")))))

(defvar rgc-hot-timer nil "timer")

(defun rgc-hot-hot-hot ()
  (interactive)
  (setq rgc-hot-timer
        (run-at-time nil (* 60 5) 'rgc-check-for-hotness)))

(defun rgc-stop-hot-checker ()
  (interactive)
  (cancel-timer rgc-hot-timer))
As always in this blog, no rocket science, but (hopefully) useful bits of elisp.

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!