martes, 14 de abril de 2015

Cache is the new GC

Now all rubyists are pros in all Garbage Collection techniques.

And we all have to know the difference between mark&sweep, reference counting, generational, and whatnot (I also see more references to this in the lua mail list lately).

And we're already optimizing for not creating so many objects. And we pray Rust and Nim for being so powerful and fast and allow us to manage memory manually. and we decide that checking for existence of an element in a short Array is probably faster than checking in a small Set.  Even more if we know the distribution of the expected values.... Well... now, the next step is Cache.

Interesting points here http://dev.mensfeld.pl/2015/04/ruby-global-method-cache-invalidation-impact-on-a-single-and-multithreaded-applications/ .

And after that, Locality of variables, and compiler tricks to optimize code. Here's a nice StackOverflow thread.

Inside this thread the thing that brings you back to reality is that compilers are allowed to do pretty amazing things . Things that are so complex, that if you have to have that in mind... well.... good luck.  I guess for real time systems it makes sense, or very low level programming, but there are really complex techniques which seem really hard to anticipate .

What's the point of all that? No idea. it's just funny that sometimes we try to push low level languages to higher levels, and then, we program ruby as if we were forging asm.  Funny :) . In the end, all benchmarks are made to lie in one or other regard, so I guess the most important thing, is having Amdahl's law in mind (or an adaptation of it): All the optimizations you'll do, will apply only to the percentage of code where the optimization is feasible.  The original speaks about intrinsically serial code that cannot be parallelized.   My idea is that optimizing for cache hits in ruby when you have a webapp which does http calls here and there to external systems is not really the way.
 

miércoles, 8 de abril de 2015

Regexp puzzles!

I've been trapped into this http://regexcrossword.com/ for  the whole afternoon...  Pretty cool pastime.

I guess I'd enjoy a bit more complicated one with more usage of recursion, backreferences, and maybe lookaheads...  But it's fine.  A nice exercise to get your brain spinning for a while.

I'm now back to my haskell lectures.   Oh yeah, I'm trying to learn Haskell.

Again

martes, 24 de marzo de 2015

download youtube videos with conkeror

As internet is scarce in my new $HOME, now, when I have some, I tend to download lots of things in my $COWORKING-PLACE and schedule them for watching/reading later.

So I tried to automate the process a little bit. Obviously, using conkeror.

  • install youtube-dl  .
  • put this in your .conkerorrc file.
  • M-x youtube-dl RET
Done.

sábado, 21 de marzo de 2015

more about XEROX

You know I love to read about XEROX stories, right?

Here's an article titled How parc saved xerox.

Enjoy it, and the links of it.   Entertaining and nice

jueves, 19 de marzo de 2015

Wifislax and booting

This is not a particularly general tip or post, but Toni and I have been stuck with it for a few hours (day and 1/2, on and off).

Wifislax is this great auditing linux distro you can install and run from your usb.

But you have to know that even when burning it with either unetbootin or dd, the usb drive is not bootable.  Don't know why, but it's not.

You have to mount the drive, and  run a file called /boot/bootinst.sh .

Tada!.

Stupid, yes. But it took us hours to find out. It took more time to burn the iso than to do the actual 'auditing' job.

miércoles, 18 de marzo de 2015

Corgfiguring

Org is a beast, you probably already know it, whether you use it or not.

I've been using it on and off for a few years (at least 5), but never settling with it. Now it seems it's changing. But I digress.

Something that in the beginning was disturbing me was the many many ways you had to configure its behaviour. there were these #+FOO BAR , and these :PROPERTIES:,  but you never knew which one to use, and in fact, I didn't even try to remember them.

But there's an absolutely coherent logic behind it. I'll try to explain.

If you use org as a way to manage your life, you can store different info in different files. One for calendar related things (that come from google calendar, or some rss feed), captures, captures from your browser, or from different areas of your life (work, home, fun).  Some of them could live in the same file, but you can decide to use different files (One of my biggest questions to date is what should be a file, a heading, or a tag).

So it makes sense to be able to have global configurations for everything.  For example org-startup-folded . this variable defines in which folding state will be your org files opened.

BUT!  There might be a file, which you want different settings.

     #+STARTUP: overview
     #+STARTUP: content
     #+STARTUP: showall
     #+STARTUP: showeverything

Put one of those in the beginning of your file, and this option will override the global variable.

AND! You may want one of the trees/subtrees in that file to be ruled by a different rule.  Then is when you put a property in that given subtree.  In this case, the property is called "VISIBILITY", and the allowed values are folded, children, content, and all.

So after all, it makes sense that things can be configured at so many levels.

Usually, there's a global var and a file setting for most of the options. The subtree level one is not so common, but you get the idea already.

domingo, 23 de noviembre de 2014

Temporarily ignore people in IRC

I'm using irc more and more for my communication with others.  And spending more time in IRC means that it makes more sense to optimize it.  And also, erc is a good playground for us, elisp hackers :)

So when someone is bitching or saying nonsensic BS on some IRC channel (or slack, or hipchat, or anything that supports bitlbee), you can ignore him/her, but often you forget to unignore, and after a few hours they tell you something important and you just miss it.  Not good.

So here's a timed ignore command for erc


(defun erc-cmd-TMPIG (&rest users)
  (let ((b (current-buffer)))
    (dolist (user users)
      (erc-process-input-line (format "/ignore %s" user)))
    (run-at-time (* 60 10) nil
                 (lambda ()
                   (dolist (user users)
                     (with-current-buffer b
                         (erc-process-input-line (format "/unignore %s" user))))))))


Yes, some of you reading this will be the victims of this... :)

EDIT: This code needs to be in a file with lexical scope active. otherwise, use lexical-let instead of let