Capture Unix top command output into a file

21/11/2007

Firstly, you need to make sure that your top command does not redisplay the output. This is what you do on Linux and Mac OS:

Linux:

$ top -b -n 1

Mac OS X:

$ top -l 1

(Note that the first sample displayed will have an invalid %CPU displayed for each process, as it is calculated using the delta between samples. (from the top manual))

You can use a standart Unix command in order to save the details to a file:

$ top -b -n 1 > my_top_report.txt

All application windows from all Spaces on your Mac Leopard screen

19/11/2007

Those of you who had pleasure to work on Mac OS X Tiger must have come across an Expose’s F9 keyboard shortcut that basically displays thumbnails of all the open windows on your desktop. Now, on Mac OS X Leopard you have a new application called Spaces that manages your virtual desktops and if you want to see all your “spaces”, you just hit F8. But what if you want to be able to see all the windows from ALL of your virtual desktops? Just hit F8 and then F9 and… that’s it :-)

Database specific bulk inserts (MySQL, PostgreSQL and SQL Server)

19/11/2007

As running multiple INSERT statements is usually not the best way of pushing large amounts of data into a database, you might want to use various database-specific SQL extensions in order to achieve the goal. Here’s what I do on MySQL and SQL Server:

MySQL

INSERT INTO table (field1, field2)
VALUES (value1, value2), (another_value1, another_value2), [and so on];

PostgreSQL

PREPARE PgSQLInserter (int, int) AS
INSERT INTO table (field_1, field_2) VALUES ($1, $2);
EXECUTE PgSQLInserter (1, 234);
EXECUTE PgSQLInserter (2, 5678);
EXECUTE PgSQLInserter (3, 234);
DEALLOCATE PgSQLInserter;

SQL Server:

INSERT INTO table (field1, field2)
SELECT (value1, value2) UNION
SELECT (value1, value2) UNION
SELECT (value1, value2) UNION [and so on];

How to darken edges of your photos in Photoshop CS3

13/11/2007
  1. Go to Filter.
  2. Go to Distort.
  3. Go to Lens Correction.
  4. Vignette Amount and Midpoint.

leaves3.jpg

leaves2.jpg

Author: Paula