Archive Page 2

Bye, bye Google Analytics

I know being tracked by Google/Microsoft/Facebook wherever on the net is not something you really want, so I’ve made a couple of changes lately to mitigate that. I decided to get rid of my Facebook account, and it wasn’t easy. They have a creepy amount of data about you, and all this Facebook-enabled sites give information to Facebook. That, and the fact that it is a big time sucker, moved me to delete my account. If you want to know how to do it, read here.

My blog used to have Google Analytics, but now I’ve found a compelling, open-source, alternative: Piwik. It has a very nice interface, and there is a WordPress plugin to easily integrated it. So, if you are visiting this blog, you are no longer tracked by Google Analytics.

Now that I’m talking about privacy, I just want to add that I do use Google’s search engine, buzz, gmail, reader and picasa. Google search results are the best, so I don’t think I will be switching to something else anywhere soon; I’m alternating buzz and twitter as my “social” networks, I don’t like the alternatives to picasa or reader, so I’m sticking to them. And yes, I trust Google more than I trust Facebook.

Twitter in emacs (twittering mode)

Edit: As pointed out by Seth in a comment, you don’t need to set your username nor password if you are going to use oauth and the master password, as I’m doing. My configuration snippet now reflects that.

I started to get interested on Twitter a few weeks ago, after some time having my account abandoned. I’m using Twittering mode, which is pretty nice: has support for oauth (twitter.el don’t have that, so don’t bother trying to use it), supports multiple url shorteners (I use bit.ly), easy navigation, tons of functionalities (check the EmacsWiki for a comprehensive list).

Get it from github:

git clone git://github.com/hayamiz/twittering-mode.git

Today I found this blog post, which explains how to avoid the oauth request every time you start your emacs:

(setq twittering-use-master-password t)

Of course, EmacsWiki also explains that but is burried inside a comment, so I didn’t read it… This is my configuration:

(require 'twittering-mode)

(eval-after-load "twittering-mode"
  '(progn
     (twittering-icon-mode)))

(setq twittering-timer-interval 36000     ; I don't want auto-refresh
      twittering-tinyurl-service 'bit.ly
      twittering-bitly-login "XXX"
      twittering-bitly-api-key "XXX"      ; find it on bit.ly settings
      twittering-use-master-password t
      twittering-url-show-status nil)

Nice Python Gems

EDIT (9/18/2011): There is another way of having a default value in python dictionaries, and it’s using the defaultdict class in the collections module (python 2.5).  Here are the docs.

I was checking my old bookmarks and I stumbled upon these two blog posts: Gems of Python by Eric Florenzano and Python gems of my own by Eric Holscher.

Did you know about setdefault for dicts? I’ve found myself more than once using a dict as a multimap and I always felt that there must be a better way of doing it than this:

dct = {}
items = ['anne', 'david', 'kevin', 'eric', 'anthony', 'andrew']
for name in items:
    if name[0] not in dct:
        dct[name[0]] = []
    dct[name[0]].append(name)

And I was right, from Eric Florenzano’s post:

dct = {}
items = ['anne', 'david', 'kevin', 'eric', 'anthony', 'andrew']
for name in items:
    dct.setdefault(name[0], []).append(name)

I knew it…

Things I keep forgetting: Gnus reply key bindings

edit: added mail-forward

Summary mode:

While reading a mail, you could reply to it using the following commands:

key command
r gnus-summary-reply
R gnus-summary-reply-with-original
S w gnus-summary-wide-reply
S W gnus-summary-wide-reply-with-original
C-c C-f gnus-summary-mail-forward

Message mode:

If you are writing a regular reply and then you decide to make it “wide” use:

key command
C-c C-f w message-insert-wide-reply

Zsh case insensitive completion

Update: Göran Gustafsson pointed me out the reason why setopt no_case_glob doesn’t work: setopt no_case_glob turns on case-insensitive globbing which is completely different than tab completion. When using * in commands Zsh completely ignores cases. README.txt is the same as readme.txt. rm + case-insensitive glob is horrific. Thanks!

If you want case insensitive completion, and you use zsh, include the following snippet in your .zsh file:

## Completions
autoload -U compinit
compinit -C

## case-insensitive (all),partial-word and then substring completion
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' \
    'r:|[._-]=* r:|=*' 'l:|=* r:|=*'

The original thread where I found the code is here.

As a side note, the zsh tips and tricks page states that you only need to add setopt no_case_glob, but it didn’t work for me.

p.d. If you use bash instead, take a look at this post from nixCraft.

Ibuffer reference

For those who doesn’t know it, Ibuffer is an replacement for BufferMenu, which is a buffer showing, à la Dired, all currently open buffers. Ibuffer allows you to easily filter, group and operate over the buffers, which is quite useful. It’s included by default on any version greater than 22.

You can directly invoke it using M-x ibuffer, or make it replace BufferMenu by setting the appropriated key binding:

(global-set-key (kbd "C-x C-b") 'ibuffer)

Here is the mandatory screenshot:

http://www.rlazo.org/media/photos/ibuffer.jpg

The interface shows information as columns (status, buffer name, size, major mode, filename), also allows you to do grouping (out of the box you have a single group, named “[ Default ]“). You can filter and sort the buffers (by major mode, filename, status, etc.) and operate over all or some of them (save, kill, search, etc.).

There are a lot of good posts around the web about Ibuffer:

  • emacs-fu has an introduction to Ibuffer, including other two alternatives considered (ido, elscreen), plus an example of buffer grouping.
  • Martin Owen’s blog also has an example of buffer grouping, plus a few more options (ibuffer-expert, ibuffer-show-empty-filter-groups, ibuffer-auto-mode, dired).
  • Little red bat, shows how to add a new column.
  • A curious programmer, includes a small function to compare two marked buffers using ediff.
  • The abstract factory, includes a listing of some default keybindings, and how to combine them to get cool results.
  • Tech Rants, also includes a listing of key bindings, and describes the methods ibuffer-do-occur, ibuffer-do-isearch, ibuffer-do-query-replace and ibuffer-do-eval. Pretty cool.
  • Obviously, EmacsWiki.

org-mode + wordpress = org2blog awesomeness

I haven’t been blogging for a long time, and while most of the “reasons” for that have to do with my amount of free time, I also needed a small push to do it. My blog engine, as stated in another blog post, is WordPress. It’s full featured and very nice, but as a guy who lives inside Emacs as much as possible, the web interface is sub-optimal.

For those who doesn’t know it Org-mode is an Emacs mode for /keeping notes, maintaining ToDo lists, doing project planning, and authoring with a fast and effective plain-text system/. If you want to learn more about it take a look at its manual or to the Talks and screencast.

Well, I’m definitely not the only one blogging using orgmode, take a look at this post in the emacs-fu blog (which by the way is very good) which is a nice introduction to orgmode capabilities and markup.

So, let’s assume you wrote your post in orgmode, and you have your wordpress blog, and you want to publish… you have the awesome tool org2blog. Very simple to use, you just do a checkout of the git repository

git clone http://github.com/punchagan/org2blog.git

then copy the the corresponding files to a directory in your load-path. My .emacs looks like this:

(require 'org2blog)
(setq org2blog-server-url "http://www.rlazo.org/xmlrpc.php"
     org2blog-server-user "admin"
     org2blog-use-tags-as-categories t
     org2blog-confirm-post t
     org2blog-server-weblog-id "")

It’s pretty much self-explanatory.

My configuration is a single file where each post is a subtree, using the same idea that Sacha Chua explains in this post (BTW, that is also a nice blog to follow). If you read that post you will find that you need to patch the code from org2blog to add the command to create a blog post from the current subtree (which is org2blog-post-subtree ). But, since then, those changes have been integrated into org2blog repository, so no more patching required :) . Happy blogging!

New life, blogging again

It’s been a long time since I posted something here, so a lot has happen and now it’s time to do a quick update :D :

I’ve got married!

http://www.rlazo.org/media/photos/boda1.jpg

We’d moved abroad

We left our home-country, Peru, and landed in this beautiful land: Brazil!

http://i319.photobucket.com/albums/mm452/Raquelider/th_bandeira-do-brasil.jpg source

We are living in Campinas, São Paulo. We are already three months here, and it’s really beautiful country with very friendly people, although we are still not completely used to the weather, it’s hardly a problem.

I’ve started my Masters in Computer Science

At the Instituto de Computação da Universidade Estadual de Campinas – UNICAMP (Institute of Computing – IC of the Campinas State University).

http://www.rlazo.org/media/photos/unicamp.jpg source

It’s a nice, challenging university and I’m happy to study here.

emacs 23.2 released

http://permalink.gmane.org/gmane.emacs.announce/17

hit the link for the official announcement. for what’s new Check. the link below

http://www.gnu.org/software/emacs/NEWS.23.2

history of emacs

If you want to read about the history of Emacs, here is a nice article from the H

Emacs & the birth of the GPL

Emacs somehow made possible the free software idea in stallman, Awesome!