Archive for the ‘English’ Category

Did you know…?

Thursday, June 5th, 2008


# apt-get install vim-
Reading package lists... Done
Building dependency tree... Done
The following packages will be REMOVED
vim
0 upgraded, 0 newly installed, 1 to remove and 9 not upgraded.
Need to get 0B of archives.
After unpacking 1438kB disk space will be freed.
Do you want to continue [Y/n]?

Another example:

# apt-get install ruby- python
Reading package lists... Done
Building dependency tree... Done
Package ruby is not installed, so not removed
python is already the newest version.

;)

strace on Mac OS X Leopard

Monday, February 25th, 2008

One of the most important tools for sysadmins and programmers working in the Linux/BSD environment is called strace. As it took me some time to find out where is "strace for Mac", I thought it would be worth documenting here...

Making a long story short: in Tiger it was called ktrace, in Leopard it's called dtrace, but it's simpler if you just call dtruss.

Here are some examples directly from the dtruss man page:

dtruss df -h     # run and examine the "df -h" command

dtruss -p 1871   # examine PID 1871

dtruss -n tar    # examine all processes called "tar"

For a more "real-life" example, please see this article: Why DTrace Makes Leopard a Must-Have Upgrade -- you'll even learn how to prevent Time Machine from consuming all your CPU.

UPDATE: Just after posting this I discovered that:

1. There's a really cool GUI for DTrace called Instruments. After playing with it for just a few minutes I was able to detect that it was psyco that was causing Python 2.4 to segfault when running web2ldap. Now back to a little more tinkering to discover why...

2. Leopard/DTrace provides one command that I always wanted: iotop, to show which processes are responsible for the disk I/O (more dtrace commands here). Now to the question: is there a Linux version? The answer is: yes, and it's written in Python (and requires a kernel >= 2.6.20).

Studying SQLAlchemy

Saturday, August 18th, 2007

Well, I could be stealing, I could be killing, I could even be programming... But today, inspired by this enlightening SQLAlchemy diagram and some great docs, I decided to just... draw.
... 

(more...)

OmniOutliner Styles

Wednesday, August 15th, 2007

I'm sure I'm not the only person to get confused with OmniOutliner auto-styles - like when it decides that all fonts for some level are now going to be red, just because you said that once.

You may have noticed that choosing "Clear Styles" or disabling "Automatic Styles" just don't work as expected, neither choosing a different color in the font menu (⌘T).

So, here's the tip: open "Utilities" (⌃⌘T), choose a level (eg.: "All level 1 rows"), then open "Styles Inspector" (⌘5). There you can remove that red color you couldn't get rid of...

One of the advantages of OmniOutliner Pro is exactly more control over styles (ie: creating your own styles), but I think I don't really need that.

P.S.: Yes, I'm really going to post entries in random languages. :) If you prefer to see posts in only one language, just select it in the "Categories" menu.

Wake on Lan

Tuesday, October 31st, 2006

I knew from a long time that there existed something called "Wake on Lan", and was always a little curious for how it would work. "In which situations would the machine decide to wake up? Obviously not on broadcasts, but would it wake up on any traffic directed to it?" As I've never had a network card which supported it, I never went beyond mere curiosity...

Well, it just happened that Gustavo bought a Mac and it supports Wake on Lan. As we noticed this, we tried it just like everyone else sure does: we put the computer to sleep, then tried to ssh to it.

"Did it work?" No. At least, it's one less doubt: it won't wake up on any traffic...

After a couple days and a visit to Wikipedia, I discovered that a WoL-enabled machine will only wake up if it receives a Magic Packet, which must contain its own MAC address ("Aha! Here's the 'authentication'!" :D)

So, all you need to remotely bring to life a machine that's "sleeping" is its IP and MAC addresses and some program capable of sending magic packets, like WakeUp for Macs (the wikipedia article has links to clients for other platforms, even cell phones!).

And what's all this Wake on Lan stuff useful for? Well, let's say you have a Mac Mini plugged to your big flat screen TV at home and - what? You don't have a Mac Mini? Nor a big flat screen TV? Me neither. Let me try again: let's say you have a machine at work with some files that you may want to access from home (easier, ahn?). Well, you got the picture...

As every other Mac article here, this one wouldn't be complete without a keyboard shortcut: hold ⌘−⌥−Eject for two seconds to put your Mac to sleep.

Note: if have a laptop with Mac OS X it has a great chance of supporting Wake on Lan, even if it was not made by Apple... ;)

Lock your Mac screen without clicking

Tuesday, October 31st, 2006

UPDATE: SizzlingKeys is really a better alternative.
... 

(more...)

Mac OS X Keyboard Shortcuts

Monday, September 25th, 2006

Here are some not so obvious Mac OS X shortcuts that I think are useful:

⌘−H to hide an application
⌘−⌥-H to hide all applications except the current one
⌘−Tab−Q to close applications
Shift-Volume keys: silently change volume
Spacebar on dialogs to select highlighted/secondary option. Eg.: power key then enter corresponds to shutdown, power key then spacebar is restart. Only works if you have “All Controls” set in the “Keyboard shortcuts” preferences (you can enable it by pressing Ctrl-F7)
⌘−⌥−Esc to Force Quit any application
Force the computer to restart (when locked): ⌘-Control-Power key
⌘-Drag’nDrop file forces an application to open it. Also useful to move toolbar buttons and menu bar icons.
⌥-Arrow keys Jump words (same as Ctrl in Windows)
Ctrl-Spacebar: only works if you install Quicksilver, but you will do that, won’t you? ;)
Shift-F9 Just try it :) (Shift-Minimize works too)

If you’re feeling brave, I recommend swapping your Caps Lock with your Command key. It may take one day or two to get used to it, but I think it’s worth the effort. Go to “System Preferences - Keyboard & Mouse - Modifier Keys” to do that.

Finder

⌘-O Open files
⌘-Backspace Delete file
⌘−Click on title bar: show/open parent folders
⌘-Shift-G Go To Folder (tab to autocomplete)

You may want to install DoubleCommand too, as it enables you to use PC-style home / end keys.

Be sure to read this howto for some great tips.

Blogged with TextMate in MarkDown mode

Vim Tips

Tuesday, July 25th, 2006

I decided to write down some Vim commands I use frequently and others that I've been discovering recently, check it out.

I've created it as a separate page, as I intend to keep updating it regularly.

Now reading… #1

Friday, July 21st, 2006

One of my passions definitely is reading, and you can expect many posts about this subject here. After trying to read too many books in parallel, I've found a formula which works very well for me: one technical book (almost always from the Diginet ever-growing library) and one non-technical/fiction book (these ones I have to buy :)).

Now I'm reading The Pragmatic Programmer, which is one of the best books on programming I've ever read. It is almost like a complete programming course in a compact form (actually learning a programming language is left as an exercise to the reader ;)). The subjects vary: from things that you usually learn on college (like BNF grammars and big-O-notation) to things that you will normally won't learn on college (like being pragmatic).

In the way, you will find many good practices and advice, like the importance of using a source code control system, admitting there's no such thing as perfect software, and using "tracer bullets" (ie. iterative design, instead of a big pile of requirements that doesn't solve any of the client's problems). I could go on and on, but you really have to read the book to see everything.

Another interesting thing about the book is that almost all chapters start with some quote related to the subject, but one in particular doesn't. It's called "Temporal Coupling". It is basically about analyzing your code to see if all the assumptions some piece of code makes about what was executed before it are really necessary, so that the program can run smoothly in concurrent environments later. Then, soon after I read this chapter, my copy of The Ultimate Hitchhiker's Guide arrived, and when I opened it in the last book ("Mostly Harmless") I found this quote:

Anything that happens, happens.
Anything that, in happening, causes something else to happen, causes something else to happen.
Anything that, in happening, causes itself to happen again, happens again.
It doesn't necessarily do it in chronological order, though.

Well, I thought this would be a great opening for that chapter and e-mailed the authors with this suggestion. Andrew Hunt answered my e-mail and apparently he liked the idea ("Most excellent!" were his words). Let's see if it comes in the next edition... :D

English or Brazilian Portuguese?

Wednesday, July 19th, 2006

The blog went online yesterday and I already was asked the same question many times: why writing in English?

I thought for a long time before taking this decision, as this isn't my native language and I'm no Shakespeare. I've decided for English for a simple reason: this blog will be mainly about programming and other nerd things, and I don't like when I find a blog about this subject and I can't read it because it is written in Dutch or Japanese [1].

I'd like to make it very clear that I still think Brazilian Portuguese is the most beatiful language in the world ;), but I think that the blog in English can reach a wider audience. Another thing: considering that this is a blog for nerds, come on: if you can't read any English, you're going to suffer a lot to be a good nerd, aren't you?

It's important to remember that, contrary to many other more radical bloggers, I don't have any problems with comments in Portuguese and, if I decide to comment any more "local" subject, it will be in Portuguese too.

[1] Besides that, or even *because of that*, sometime ago I used to find so many things in German that I decided to learn German. I ended up learning only the most basic stuff, by my own. But the language is still on my "things to learn" list.

P.S.: I'd like to apologize upfront for any violence against the English language, or any new words I invent in this process... ;) E-mails with corrections will be welcome.