Search Results: "Pablo Lorenzzoni"

30 November 2015

Pablo Lorenzzoni: Duas dicas para acelerar o APT

s vezes voc s quer um pouco mais de velocidade nos downloads do APT e n o tem muito como modificar muito a instala o do cliente. Duas dicas simples podem ganhar minutos preciosos: Coloque em algum dos /etc/apt.conf.d (sugiro criar o /etc/apt.conf.d/71parallel) a seguinte linha:
Acquire::Queue-Mode "host";
Isso faz com que o modo de queue do APT seja orientado ao host e n o ao tipo de URL. Dependendo dos seus sources, isso acelera mais do que o modo access padr o. A segunda dica um hack que encontrei h algum tempo em um blog que faz o download pr vio das URLs que ser o utilizadas na opera o do APT para o /var/cache/apt/archives usando xargs:
#!/bin/bash
NBATCH=3
NPARALLEL=5
(apt-get -y --print-uris $@ egrep -o -e "http://[^\']+" xargs -r -l$ NBATCH -P$ NPARALLEL wget -nv -P "/var/cache/apt/archives/") && apt-get $@
Ajuste os par metros NBATCH e NPARALLEL e boa sorte.

3 December 2012

Pablo Lorenzzoni: Nostalgia time

My parents will soon be moving to a smaller home, so they are digging up a lot of stuff of my sister and mine past. Among my stuff, they just sent me my first computer (which was, of course, the first computer of my father s company I was using in the spare time). I couldn t believe they kept that. It was an Unitron Apple ][ 64K!! I just had it cleaned and took this picture: Due to the closed informatics market Brazilians were subject to at the time, it came with a full set of manuals in Portuguese which taught me how to code in Basic (I was too young to learn English at the time) Interesting how a bad policy like that can result in a Good Thing sometimes. :-) Is it just me or does this picture made you nostalgic also?

20 November 2012

Pablo Lorenzzoni: Decision-making by flipping a coin

Yesterday I was discussing in an online board how to break a decision deadlock in life. There are real deadlocks, but I don t think they are very frequent most of the time, doing a pros and cons analysis is enough to decide what to do. Sometimes our judgement is impaired by lack of objectivity or by our inability to see things from a different point of view (it s hard to think straight when everything seems to be falling apart around you); talking to a friend or relative can help in these situations. But there are times when nothing helps. When you are really stuck and nothing seems to break the deadlock. At these times I give it one or two days, sleep on the issue and if I cannot come up with a decision I assume the alternatives are equivalent to me and just flip a coin. Of course, this will do if you can postpone the decision, giving yourself (and your inner self) time to decide on a course-of-action. But is there some way to speed up the process? During the discussion, someone came up with a rather smart quote by Rothstein character in Boardwalk Empire TV series:
Flip a coin. When it s in the air, you ll know what side you re hoping for.
I found it an interesting way to give your inner self an ultimatum: decide or luck will decide instead. I ve never did it like that, for I would not flip a coin unless it s my last resort. Being such a clever psychological idea, I doubted it originated in the TV series itself, so I went on pursue of the original idea. I found a Danish poet and mathematician called Piet Hein, who wrote a poem about it circa 1969:
A PSYCHOLOGICAL TIP Whenever you re called on to make up your mind,
and you re hampered by not having any,
the best way to solve the dilemma, you ll find,
is simply by spinning a penny.
No not so that chance shall decide the affair
while you re passively standing there moping;
but the moment the penny is up in the air,
you suddenly know what you re hoping.
And also, there are a Donald Duck comic called Flip Decision circa 1953 that introduces Flipism philosophy, which supports a rather radical anecdotal variant: make all decisions by flipping a coin. Piet Hein or Rothstein character idea is much better than Flipism, of course. Does anyone knows any older sources of the same idea?

7 November 2012

Pablo Lorenzzoni: That s a lot to do!

Reading about Michael Stapelberg s codesearch I bet a lot of people had the same idea. I just had to post a screenshot of it: It seems we have a lot to fix :-)

24 June 2012

Pablo Lorenzzoni: Zotero and note-taking

I was looking for an excuse to try Zotero and the perfect opportunity appeared when I got a whole lot of references to group for a month of Magnetic Ressonance studies I am currently taking. I was also pleased to notice it is packaged to Debian. I am used to note-taking software. Back when I used a Palm m130 (and a Treo 650), I managed a lot of Memos I eventually migrated to Note-Everything in my current Android phone. Zotero, unfortunatelly, is not interfaceable with my phone (or I was still unable to figure out how to do so), but it s powerful in managing references beyond simple note-taking. Is anyone using Zotero in a more ambitious way? I ve read about people using it to keep large researchs to support fiction and non-fiction book-writing I also watched some YouTube videos on it. As far as I went with it, Zotero might become an important piece in my toolbox wrt reference keeping, so I was just trying to figure out how many other niches it can fill

19 April 2012

Pablo Lorenzzoni: Timeout a process in Bash > v4

Just for reference, this is really useful:
( cmdpid=$BASHPID; (sleep 10; kill $cmdpid) & exec some_command )
Update Apr 20, 2012 @ 16:54: As pointed in a comment by Timo Juhani Lindfors, if some_command exits early and the interval is long, another process can reuse its process number and get killed once the sleep runs out. Does anybody know a better way of doing that without using timeout from coreutils (better yet: using just bash)?

16 April 2012

Pablo Lorenzzoni: Key Signing Party at FISL13

You know the drill. Official announcement is here (or here in portuguese). Anybody planning to drop by FISL13 should submit a key.

29 March 2012

Pablo Lorenzzoni: Using Gmail anti-spam with mutt

OK, this is not another post on how to use Mutt and Gmail. This is just to comment on a feature I found in Mutt that was not obvious, and that helped me to stop running my own anti-spam tool. So, for a number of reasons, my company stop filtering spams. I was setting up dspam to take over that job when I decided that it was just too much pain for a single account. Besides, although I am spammed a lot, I would never possibly be more efficient than Gmail anti-spam, given the load of emails their users classify everyday. I am not migrating my old emails over to Gmail, though. And I am pretty comfortable with my current email work-flow I am simply not going to use a webmail (even one as powerful as Gmail). OK, I am using GNOME 3 after being a Fluxbox and Bluetile user, but everything has a limit But how to keep the best of both worlds? And, more important, how to do that with minimum disruption of what I already have (my own IMAP server and Mutt managing my account there as spoolfile)? The answer is a little known trick using the mailboxes directive in .muttrc. This directive accepts a fully-qualified imap mailbox address. So I just added something like:
mailboxes 'imaps://gmail-user:gmail-password@imap.gmail.com:993/[Gmail]/Spam'
and added some shortcuts to save email from my inbox to that mailbox (the same as train-as-spam) and to rescue email from it (the same as train-as-ham):
macro index <F3> ";Wo;Wn;simaps://gmail-user:gmail-password@imap.gmail.com:993/[Gmail]/Spam\n" "Train as SPAM"
macro index <F4> ";Wo;Wn;simaps://gmail-user:gmail-password@imap.gmail.com:993/INBOX\n" "Train as HAM"
and that was it. In my IMAP machine I got a fetchmail downloading emails from Gmail s INBOX so I can get trained-as-ham and new emails (all emails arrive first in my Gmail account) into my IMAP server. All my sieve rules are in place and nothing changed in my email work-flow. It s been working flawlessly for a week now. The only drawbacks are (1) Gmail knowing everything that arrives to me (not a big deal, since unencrypted emails aren t private anyway), and (2) not getting the spam-count once Mutt is run: I have to change into that mailbox to log-in to Gmail. Update: Mar 30, 2012 @ 18:15: I just found out that drawback number (2) above can be fixed by adding the following to .muttrc:
unset imap_passive

24 March 2012

Pablo Lorenzzoni: Annoyed by F10 key in gnome-terminal?

I am one of those people that like to map Fx keys to special functions. After all, that s what F-unction keys are for, right? So, one of the first things I do once I have to configure a new Desktop is disable F10-capture by gnome-terminal. It has been working flawlessly, until I begin using GNOME3. No matter what, F10 was still being captured. I found that this is a bug and that adding the following:
@binding-set NoKeyboardNavigation  
	unbind "<shift>F10"
 
 
*  
	gtk-key-bindings: NoKeyboardNavigation
 
to ~/.config/gtk-3.0/gtk.css serves as a workaround. Hope this helps people with the same problem.

22 March 2012

Pablo Lorenzzoni: GNOME 3 is like Vim.

You might know that I am testing GNOME 3. So far, so good. I was a little annoyed by the not-obvious and undocumented have-to-add-user-to-pulse-and-pulse-access procedure and the keyboard-shortcut-settings-bad-design-bug, but now sound works and my usual shortcuts are in-place I found myself liking the environment, but not sure about why I was liking it. I was always a minimalist user. At one time I convinced myself X11 (or Xorg) served as a terminal multiplexer but now, GNOME 3 is changing that with its unobstructiveness (is there such a word?). One thing that might be selling GNOME 3 to me is that it resembles Vim, my beloved text-editor and multipurpose IDE. Just think about the Overview mode as a command-mode in Vim. While working in Vim, I focus in one thing at a time, and everytime I want to do some meta thing, I Escape to the command-mode. It s just the same in GNOME 3: Overview let me do meta things and gives me the whole power of the Desktop in one screen. I am not sure I am going to keep GNOME 3 But thinking it s like Vim is a compelling argument.

18 March 2012

Pablo Lorenzzoni: Time to change Window Manager again?

Ten years ago I was a fan of NEXTSTEP desktops and a die hard user of Window Maker. I love dockapps, and used to collect them. Things changed, and, as I moved from Desktops to Laptops, I began using simpler Window Managers. The powerful keyboard-shortcuts Fluxbox along with its capability to join windows with tabbing won me over and I began using it in my Laptop, while preserving Window Maker in my Desktop. In time, Fluxbox were used in both sides. Then the netbooks came and I bought an EeePC. The screen was so small that even the non-obstructive nature of Fluxbox were not enough. I began to try tiling window managers and I settle for Awesome. I was using Fluxbox in my Desktop and my Laptop, but Awesome was running in my Netbook. Tiling was making a lot of more sense and I could be productive, even in a small Netbook. Eventually, I started using Bluetile in my Laptop. Also, Bluetile was written in Haskell, and I was interested in Functional Languages by that time Now I got a new Laptop, and, since it features a Realtek 8191SE Wi-fi card, I had to install Wheezy (in my laptop, I usually run stable). Wheezy comes with the new GNOME 3 desktop, of which I read a lot. I decided to give it a try. I am missing advanced tiling (it seems that GNOME3 tiling works just in the side-by-side approach) and I also think that creating custom launchers should be improved but so far I am not disliking it, which is a good step toward adopting it. I ll give it a week to convince me. Let s see how it works its charm on me :-)

16 March 2012

Pablo Lorenzzoni: Windows Laptop with Debian Recovery Partition

I was playing with my new Laptop (a Philco 14E-P686WP) that comes with (argh!) Windows 7. I was gathering information in order to avoid surprises with regards to drivers and hardware-compatibility so I can proceed with the Debian installation By doing that with a new machine, I, usually, peek and poke everywhere, including the Recovery System. I was shocked to find out that this (argh) Windows 7 laptop has a bootable recovery partition loaded with a customized Debian just to run Partclone which installs a Windows factory image. I was about to take some pictures of the process, but I managed to find some in a forum post. Debian is being used to re-install (argh) Windows How sad is that! ;-)

12 March 2012

Pablo Lorenzzoni: Migrating from Mephisto to WordPress

Just as I promised yesterday, I pushed a new git repo with my fork of the tool I used to migrate my old Mephisto blog to this new WordPress one. I forked because the tool have not worked the first time. First of all, I was missing uuidtools gem, and to install it would be a pain inside the jail system I used to run my blog. Too much trouble just to get a UUID we can get by other means so I just added an environment variable UUIDGEN anyone can use to point to a tool to do the job. I know this have performance implications, but I am not talking about 10-thousand entries Then, I found out that, for some odd reason I still have to understand, WordPress was cutting my articles everytime it read a character. I could study the subject, but I just added a #gsub in mephisto-to-wxr code and moved on. I was about to remove it from the repo, but I left it there since it could help other people. Also, since there might be other similar occurrences, leaving it there serves as a heads up. Also, I added support for Categories and Tags to mephisto-to-wxr, that seemed to be limitedly accepted (I translated Mephisto Sections into WordPress Categories). All other activities were just clean-up. That tool generated a .WXR with all the articles and comments from my Mephisto blog. Everything I had to do was import it using WordPress import tool.

3 February 2010

Pablo Lorenzzoni: Swiss Tournament in Ruby

Being a chess player (not a very good one), I ve always been intrigued by Swiss Tournaments. They are so practical, and ensure that even a lowsy player like myself, can play the same number of rounds as any other player. That s being inclusive! I ve played some knock-out tournaments (to me it meant being kicked off in the second or third round), and, given their nature, not-so-good players tend not to attend these tournaments (since their fun will, almost surely, end before long). Well, to solve a very similar problem, but not in any game championship, a co-worker suggested we could use a Swiss Tournament system. I liked the idea, but not being sure it could really solve the problem, I had to quickly implement something to test our data with so Ruby to the rescue! In no time we were up and running, and apart from minor issues that were being fixed along the way, I guess it s a pretty good implementation. You can checkout the code to get a feel of it. Of course, it doesn t follow any rules from any Chess or Go association (Wikipedia, after all, was my guide here), but it serves our goal. Being a proof-of-concept code, feel free to improve it (just tell me about it, will you?).

13 January 2010

Pablo Lorenzzoni: Real Life: Programming is about logic and simplicity

Why is it so hard for non-programmers to understand mutex locks? No I am not asking non-programmers to understand programming at all. But concepts that we use in programming that came from real-life in the first place? Come on Programmers learned from real-life, not the other way around! Let me explain: at the hospital, after a not so clever renovation, we ended up with an employee restroom that is far from work place (in fact, almost in another department). Most of the times it is occupied So it takes a trip to the restroom just to learn that it cannot be used at that moment! In a busy morning, one of those trips is just what one can do! As a programmer I suggested a mutex lock: change the restroom door lock and make only one copy of the key, that should be kept in a common place and returned after being used. If you want to use the restroom and it s occupied, just learning the key is not there is enough to save a useless trip. Come on that is not a hard concept! As I said, we, programmers, learned it from real-life, in settings just as the one I described above! Well, I just got the key ( acquired the lock , in programmer speech) and went to the restroom. When I unlocked the door I was surprised by someone already using it! How embarassing! Someone had the smart idea of making a copy of the key! What part of the mutex concept did people not understand? Luckily, most computational mutex algorithms prevent lock cloning ... :-)

16 December 2009

Pablo Lorenzzoni: Debian-RS and Vincent Danjean

The day before yesterday I learned that a fellow Debian Developer was visiting Porto Alegre Federal University to do some work on Parallel Computing: Vincent Danjean. People from local user group organized a last minute get-together at Cavanhas (that served as last meeting of the year) and we had the most pleasant time. Guaraldo registered the moment with his cellphone camera: Vincent is flying back to France today or tomorrow. Hope he had a great time in Porto Alegre and have a safe trip back home.

Pablo Lorenzzoni: Debian-RS and Vicent Danjean

The day before yesterday I learned that a fellow Debian Developer was visiting Porto Alegre Federal University to do some work on Parallel Computing: Vincent Danjean. People from local user group organized a last minute get-together at Cavanhas (that served as last meeting of the year) and we had the most pleasant time. Guaraldo registered the moment with his cellphone camera: Vincent is flying back to France today or tomorrow. Hope he had a great time in Porto Alegre and have a safe trip back home.

17 November 2009

Pablo Lorenzzoni: Looking for a new programming language to learn

I know it has been a long time since my last post. I am sorry about that, but life has it s complications every now and then (as you know)... Well, on to the article. Recently I had to reimplement in C a prefork server I wrote in Ruby for an internal project at Propus. Not that the Ruby version wasn t enough (after all, although being in Ruby, I was using Unix plumbing, much in the fashion Ryan tell us about in the now famous I like Unicorn because it s Unix article)... The problem is that, in one of our clients, the only version available for Ruby was 1.8.1. Yeah I know But we were not allowed to upgrade and, although it didn t seem at first, the same server presented a nasty memory leak in 1.8.1 that was not present in 1.8.7 and 1.9.1. I still don t know where the problem is I suspect some of the C-to-Ruby glues around TCP sockets might be blamed, but after a couple of days trying to figure it out, I decided it was easier just to reimplement it using C. It actually took less than a day to get the C version going nothing fancy and, apart from memory footprint, just the same functionality and about the same speed of the Ruby version. But it was enough to remind me I really don t like all the scaffolding one has to raise in order to make something useful in C. It s not just a matter of SLOC (of course, C version was more than 3 times longer than Ruby one)... I am talking about all the manual memory management, pointer operations and the disgusting experience of dealing with strings in C. I know some people are addicted to that sort of thing like heroin, but to me it just slows development. This experience made me think about learning a second compiled programming language. I do some Perl, a lot of Python and (of course) most of my work in Ruby, but those are all interpreted languages. For compiled languages I always resorted to C So I am officially looking for a language to learn. So far, the best candidates are OCaml (I got a little excited about JoCaml a few months ago, now I might get serious about it), Haskell, Lisp, Objective-C, Ada, and Vala. Of these, I ve been reading a lot about OCaml It seems a fine and expressive language, with decent foundations, object-oriented extension, broad standard library and (with JoCaml) concurrency Also it might give me the proper excuse to finally wrap my mind around a functional language! People keep me pointing to Java and Erlang Well for using Java I would much prefer using JRuby. Erlang, ITOH, has a weird syntax (at least to me) and it seems much of what makes it great will, eventually, be part of Ruby (or already is using libraries) either that or I ll just wait for Reia to be ready. Besides, neither can be compiled to native code (ok, that argument can be stretched both ways, so just ignore it). So, what do you think? Any advice?

10 October 2009

Pablo Lorenzzoni: XMPP4R-Observable now on GemCutter

Just a quick update: XMPP4R-Observable is now on GemCutter. That s due to GitHub disabling gem building, and although everybody can get the source from GitHub as usual, those who want to quickly install it using Rubygems can do:

bash$ gem install xmpp4r-observable -s http://gemcutter.org
Happy Hacking.

28 September 2009

Jon Dowland: Ruby vs. Python

Pablo Lorenzzoni writes to defend Ruby in response to Kanwei Li's April post about dropping it in favour of Python. Kanwei's post has some questionable points that Pablo rightly picks up on (being forced to use ternary operators?) and some that he doesn't ("LOC matters, people."). Just like Kanwei, some time ago I decided to ditch Ruby and focus on Python for the tasks that I would normally use Ruby for. The two final nails in the coffin for me were Interestingly, Pablo cites rubygems as one of the points in favour of Ruby. Whilst both Pablo and Kanwei mostly focus on technical details for their attack and defence of Ruby, these two points for me were largely social, community issues.

Next.