Is your Lion having trouble sleeping?

September 16th, 2011 by Nuno F. Mendes

Since i've upgraded to Lion (OSX 10.7) some curious bugs have appeared. One of them is the trouble sleeping. Sometimes i just close the lid and lion doesn't go to sleep. Here's a good tip how to solve that.

First walk to the terminal window and type

pmset -g

It will list a set of profiles like the following example

Active Profiles:
Battery Power                    -1
AC Power                    -1*
Currently in use:
womp                    0
autorestart          0
halfdim          1
sms                    1
panicrestart          157680000
hibernatefile          /var/vm/sleepimage
networkoversleep          0
disksleep          10
sleep                    0 (imposed by 350)
hibernatemode          3
ttyskeepawake          1
displaysleep          10
acwake                    0
lidwake          1

The bolded line is the important one. It states which process is currently blocking your Mac from sleeping.
After this you just have to type

ps -ef | grep -e 350

or

ps x (and look for the PID number 350)

In my case it was the cupsd which means "network printing", so i just cancelled the print job and it went back to sleep normally.

Backup GMail to Dovecot and Free Space

June 28th, 2011 by Afonso Delerue Arriaga

1. Create a new tag in GMail (something like "Before 2008") and using Search apply that tag to all emails you wish to backup.
2. Install imapsync. # yum install imapsync
3. $ imapsync \
--host1 imap.gmail.com --ssl1 --user1 user@gmail.com --password gmailpassword \
--host2 dovecotserver.com --ssl2 --user2 user@yourdomain.com --password2 yourpassword \
--useheader="X-Gmail-Received" \
--useheader 'Message-Id' \
--include "Before 2008"
4. Verify that all the emails have been synced.
5. Check again!
6. Delete emails under "Before 2008" tag in GMail, which will free some space.

How to update “locate” database on Leopard

December 26th, 2009 by Miguel M. Almeida

Terminal
I always loved the locate and updatedb because its speed against find and Mac OS X always had the both commands... until Leopard. I don't know why, Apple maintained the locate, but removed the updatedb... what the #@!&? For years I couldn't use locate anymore because of this! Today I accidently discovered how to "update the db"! You just have to run this (intuitive) command:
$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

Safari 4 speed… Safari 3 style

May 18th, 2009 by Miguel M. Almeida

SafariA few weeks ago I downloaded Safari 4. After a few minutes of using it I had to uninstall it. Apple took the wrong way about a lot of new features.
Without a workaround I will have to switch back to the (slow) Firefox. So I've decided to wait, wondering Apple will develop an option to turn all this annoying features off...

Read the rest of this entry »

Using a SOCKS server… transparently!

April 22nd, 2008 by Miguel M. Almeida

3D Maya modelMy first post on seven geek wonders talks about using SSH as a tunnel. It can be useful when used along a SOCKS server. But.. to be honest, it is really boring to tunnel every single connection. Even with the -D 1080 it sucks, because you need to configure your program to use the tunnel.

What about a transparent tunnel? ;)

Read the rest of this entry »

Loading 3D models with GLM on OpenGL

April 21st, 2008 by Miguel M. Almeida

3D Maya modelWriting simple polygons with OpenGL is nice when you're starting with OpenGL, but when you want something useful and nice will need to import models from Maya, 3D Studio Max or other kind of 3D modeling programs. I'll explain here how to import a model to be used on your C++ code, using Xcode on my case.

Read the rest of this entry »

How to use DevIL on Xcode

April 21st, 2008 by Miguel M. Almeida

OpenILWell, my Computer Graphics course is getting complicated. My teacher is asking me to draw a 3D terrain based on a flat b&w image. Of course I don't need to do this from scratch! I may use a cool set of libraries called DevIL.

A friend of mine, Bruno Gomes, wrote a small text (in portuguese) explaining how to compile it on OS X. It is a little bit tricky, because a small bug. I've translated this how to and I'm posting it here, step by step.

Read the rest of this entry »

How to pair your apple remote with your computer

March 28th, 2008 by Nuno Rafael Rocha

apple_remoteAre you working and suddenly the front row starts to work alone? Or are you listening iTunes and the music stops or jumps to the next song? Do you start hearing laughs at the back of the room? Well, your are being a victim of a practical joke from somebody that have an apple remote control. To avoid this pranks I found an option that pair your apple remote control with your computer.

This is a simple process but it's in a hidden place.
Read the rest of this entry »

Internet Connect for Leopard

March 27th, 2008 by Miguel M. Almeida

Internet Connect for Leopard
Today I've upgraded to Leopard. Everything was working fine until I tried to connect to my university's wireless network. This network uses an 802.1X authentication protocol, but Leopard doesn't like it. And... where's Internet Connect?! Well, here it is! It just arrived from Tiger :)

XCode running OpenGL

March 25th, 2008 by Nuno Rafael Rocha

Teapot small
Do you have a mac and you want to start programming OpenGL?Do you want to use a POWERFUL tool? Well, in this post I will show you how to run OpenGL on XCode :D

Read the rest of this entry »

Transparent PNG in Internet Explorer

January 31st, 2008 by Miguel M. Almeida

NO IE I'm going insane every time I develop for the web. I use Safari and Firefox and everything goes well, until, finally, I decide to open the page in IE! It's all completely screwed up and I need a lot of extra hours to solve every single problem.
  - the resized images are pixelized,
  - images have a border by default,
  - the height's values aren't correctly respected,
  - the CSS's background images aren't well cached,
  - the PNG's transparency doesn't work,
  - ...and many, many, many, many other things.

I only see an explanation: Microsoft have a specialized bug's department to _develop_ this bugs, calling them "features".

To solve this problem, I've made a simple php function:

Read the rest of this entry »

Connlimit compiled for Linksys’ OpenWRT

January 5th, 2008 by Miguel M. Almeida

Linksys WRT54G
A few moths ago I wanted to limit the connections of each ip of my network. I'm using OpenWRT running on a Linksys WRT54G and tried to use rules like this:

$ iptables -A FORWARD -s 192.168.1.2 -p tcp -m connlimit --connlimit-above 10 -j DROP

but I get the error "No chain/target/match by that name" because the module isn't installed. After a Google's research I didn't found a compiled module ready to download, but forums telling how to compile this. That's what I've made, but it took me a lot of time because I had compile a custom build with a patched kernel (using Netfilter's patch-o-matic for connlimit). So I've decided to share the results.
Read the rest of this entry »

A (very) short introduction to bash scripting

December 28th, 2007 by Miguel M. Almeida

Terminal
Finding a good bash scripting tutorial or manual is not that easy. Today I've found this one, very good, on linuxreviews.org, so I've decided to post it here too. Thank you very much to the writers.

Read the rest of this entry »

How to disable Leopard’s translucent menu bar

December 23rd, 2007 by Miguel M. Almeida

The Mac OS X Leopard's menu bar in the newest macs is different than in the oldest ones.

With the appropriate OpenGL capabilities it is translucent:
Leopard’s translucent menubar

...but, without them, it is solid:
Leopard’s solid menubar

Having a translucent menu bar is nice in a screenshot, but using it every day is really bad.
Many people use a tricky hack, using a white or black stripe in the background.

Here's another hack, more simple and useful, to disable this beautiful, but annoying feature...
Read the rest of this entry »

SSH using RSA/DSA keys instead of password auth

November 22nd, 2007 by Miguel M. Almeida

Terminal
If you access an SSH server frequently, for shell usage or scp, probably you're tired of writing your password each time you want to access it. You can be authenticated without a password if you "tell the server who you are".



To do that SSH uses a public/private keys system. You just have to store your private key on your computer and put your public key in the SSH server.

Read the rest of this entry »

Website updated from SVN repository with email notification

November 9th, 2007 by Mário Filipe Pinhal

SVN logo
If you are interested in having a version control management system for some set of files, a subversion (SVN) repository is the right thing for you. What I did and will explain further, was to use the "internal actions" of a SVN server repository to automatically update a web folder in the same server, so that when changes are committed to your svn server it automatically "replicates" and your website is instantly updated with the committed changes. In addition, i also found a way so that you can be notified via e-mail each time your repository is updated, to keep you track of the changes of the repository if its a shared one (as it was in my case).

Read the rest of this entry »

How to force apache to download a file using PHP

November 9th, 2007 by Miguel M. Almeida

Apache logo

When I want to send a heavy file to someone I can't use e-mail because the e-mail servers usually don't allow me to send big files. So, I've created a folder in my domain, where I upload my heavy files. Then, I only have to send the URL of the file in the e-mail message. Simple. But... I have another problem: when the file is a photo, a movie, a music, a pdf, a text, etc. it is displayed, instead of downloaded. How can I force the download of this folder files? I will explain here how to configure apache do to that.

Read the rest of this entry »

iPod nano tilted screen

November 4th, 2007 by Miguel M. Almeida

iPod nano 3G
This month I bought one of the new iPod nano (3rd generation), also known as The Fatty.
Unfortunately, after a few hours, I realised the screen was a little bit tilted. At the first day I just though I was paranoid, but after a few days I found I'm not the only one seeing it tilted. So, I went to the shop again and I realized that ALL the iPods nano in ALL the stores had the same tilted screen. All of them, really!

I've made some calls to the Apple Support service, but Apple didn't recognized the problem. In a high quality product with so much high quality details this isn't acceptable... and it's very annoying!

Read the rest of this entry »

Enable iScroll2 in Leopard

November 1st, 2007 by Miguel M. Almeida

iScroll2 icon
If you have a PowerBook or iBook with iScroll2 and installed the new OS X 10.5 known as Leopard, probably you scream each time you try to use the two fringers scroll!

Apparently iScroll doesn't work with Leopard. In fact it works! It simply doesn't start automatically.



Read the rest of this entry »

Understanding Leopard’s Time Machine

October 29th, 2007 by Miguel M. Almeida

Time Machine from AppleThe most expected feature of the new Mac OS X 10.5 (Leopard) is Time Machine. And, belive me, it is phenomenal (as Steve Jobs would say).

At the beginning it is a bit hard to understand how it really works, but in fact it is really easy and cool!

Read the rest of this entry »

How to install linux without a CD

October 26th, 2007 by Miguel M. Almeida

Tux
My laptop's CD-ROM drive is broken and I want to install Ubuntu without CD. Is that possible? Fortunately yes!
After a quick google search I found a very cool software called UNetbootin.

Read the rest of this entry »

How to access the modem behind a router

October 25th, 2007 by Miguel M. Almeida

Linksys WRT54G
My ADSL modem is connected to a router Linksys WRT54GL running the Tomato firmaware, but it could be DD-WRT or even OpenWRT.
I want the router to make the PPPoE connection, instead of the modem, but there's a problem with this configuration: I can't access the modem configuration.

Read the rest of this entry »

Using SSH behind a SOCKS server

October 25th, 2007 by Miguel M. Almeida

Terminal
As I told on my first post, my university's wi-fi network only allows me to access the Internet using an HTTP proxy and a SOCKS server for some services, like SSH.
I need to configure my ssh client to use this server, but it doesn't have a simple configuration embed. So, we have to do a little trick, using the SSH Proxy Command.

Read the rest of this entry »

Coloured OS X/linux bash

October 25th, 2007 by Miguel M. Almeida

Terminal
In the 80's we had real terminal monitors with all that horrible green apperence. Later, we had black & white monitors, but now we have really beautiful colors available in our monitors. Why still using the old fashioned ugly terminal?

Read the rest of this entry »

Using SSH as a TCP tunnel

October 25th, 2007 by Miguel M. Almeida

Terminal
Argh! Here I'm again connected to my university's wi-fi network, which only allows me to use HTTP through a proxy and SSH. Rules of the BOF :\ So, why not using the SSH as a tunnel, allowing me to connect to anywere in the "real world"? That's what I'm going to describe here, in 4 practical cases.

Read the rest of this entry »