Aug 242012
 

I’m usually using mysql, today for a test i had to use Postgres. I’m fairly happy how smooth everything went, as it was mainly verifying a database creation and setup. Here the little things I needed to do.

  • download and install Postgres.app. I won’t use postgres regularly and I don’t want to have it autostarting or deeply integrated in my system. 
  • add postgress path to ~/.profile, all you need is export PATH=/Applications/Postgres.app/Contents/MacOS/bin:$PATH. Otherwise an older, macos-native postgres client will be used.
  • open postgres console from terminal using psql -h localhost
  • create user create user <usr> WITH password ‘<pwd>’ CREATEDB;
  • make user super user alter user <usr> with superuser;
  • list existing databases \list
  • drop a database drop database <db>;
    • in case of error: “ERROR:  database “<db>” is being accessed by other users”
    • run select procpid from pg_stat_activity where datname=’<db>‘; to get a list of process ids that are accessing the database.
    • in terminal run kill <pid> for all processes out of the list provided by the statement above
  • exit postgres console with \q.

This is all I need for my test environment.

 

Popularity: 7% [?]

Tags: , , , ,
Aug 162012
 

Following up my previous post I also want to see the contents of any text file in preview without opening an editor.

I found this page with lots of quicklook plugins: QLPlugins.com. One of the plugins there is QLStephen. Download it, mount it, then open Terminal and run:

 

sudo cp -R /Volumes/QLStephen_1/QLStephen.qlgenerator /Library/QuickLook/

qlmanage -r

 

Result: Manifest.MF is now previewed in Finder and I don’t need to open a text editor anymore.

Popularity: 8% [?]

Tags: , , , , ,
Aug 162012
 

It happens quite regularly that I need to extract a JAR or WAR file for a brief inspection. Of course I can do it on command line however, when operating in Finder I wanted to get something that just unarchives a selected file by mouse click. 

To achieve this I used for the very first time Automator, a tool I didn’t really think would be providing a solution to any of my needs. What I did do:

  • Open Automator
  • New > Service
  • In the drop down menus choose in Service receives selected files or folders in Finder.app
  • In Actions search for Run Shell Script and double click on it
    • enter this as command line unzip -n “$1″ -d “$1″.zip
    • select for Pass input as arguments
  • Click on Save and give a name, e.g. Extract Archive

To verify:

  • Open Finder
  • Right click any archive
  • In the context menu select Services > Extract Archive

Note: As a filetype cannot be selected the menu is available for all files and folders. If you select something that is not a extractable with unzip you’ll see an error message.

Popularity: 3% [?]

Tags: , , , ,