Uninstall PostgreSQL 9 from Mac OS X

These steps are to remove the One-Click install of PostgreSQL 9.1 (not the homebrew editions). This can be ascertained if you find the /Library/PostgreSQL directory.

  1. Open a terminal window. Terminal is found in: Applications->Utilities->Terminal
  2. Run the uninstaller. Both methods will ask for the administrator password to run the uninstaller.
    If you installed with the Postgres Installer, you can do:

    open /Library/PostgreSQL/9.2/uninstall-postgresql.app

    OR force uninstall using:

    sudo /Library/PostgreSQL/9.1/uninstall-postgresql.app/Contents/MacOS/installbuilder.sh
  3. Remove the PostgreSQL and data folders. The Wizard will notify you that these were not removed.
    sudo rm -rf /Library/PostgreSQL
  4. Remove the ini file:
    sudo rm /etc/postgres-reg.ini
  5. Remove the PostgreSQL user using System Preferences -> Users & Groups
    • Unlock the settings panel by clicking on the padlock and entering your password.
    • Select the PostgreSQL user and click on the minus button.
  6. Restore your shared memory settings:
    sudo rm /etc/sysctl.conf

The uninstall wizard would have removed all icons and start-up applications files so you don’t have to worry about those.

Source

Configure Sonos Playbar with Samsung F8500 Plasma TV

How to setup the Smart remote to work with SONOS Playbar:

While SONOS devices are easy to configure using the normal TV/STB (Set Top Box) remotes, the Playbar does not understand the smart remote signals. To counter this, one needs to use the IR extender that came with Samsung F8500.

  1. Connect the IR Extender that came with the TV.
  2. Hold the IR extender module  close to the IR sensor on the Playbar. (around 0.16ft far).
  3. From the SONOS app goto Settings > RoomSettings > [ Select the Playbar if you have multiple SONOS devices]
  4. Select “TV Setup and Control” > Remote ControlSetup
  5. Follow the steps as asked by the SONOS app. It generally asks the user to press the Volume UP/DOWN and MUTE Key on the Smart Remote.
  6. It is essential to keep the IR Extender (viz. connected to the TV) within close proximity of the Playbar always. The Playbar does not understand the smart remote signals without the IR Extender.
  7. Always point the remote at the IR Extender when configuring the remote on the SONOS play bar for the first time.

Even after the initial configuration the TV does not detect that the smart remote has been configured to work with the Playbar. As a result every time the volume key is pressed a popup comes up. These steps would avoid the annoying popup that comes when the volume is being controlled using a TV/Cable Box remote on F8500 while using the Sonos Playbar.

Goto:

  1. On the TV: Use the Smart remote to goto: Menu > System > Device Manager > Universal Remote Setup
  2. Press the start button and add a HTS (Home Theater System)
  3. Select the “optical output”.
  4. Choose “Bose” as the company. Bose worked for me, maybe the brand is inconsequential.
  5. The TV would now go to a verification screen where it tests if it could power up the HTS. Ignore this and press yes.
    NOTE: Here its noted that the the user can quickly switch between the external speakers and internal speakers using
  6. Now while watching TV, use the on screen remote to switch to the external speakers.

DISCLAIMER: I am no hardware expert and I don’t know what exactly makes the things work. But these steps worked for me and now I can use the TV with the SONOS Playbar without the annoying popup.

Disable/Enable PostgreSQL autostart in Mac OS X

After installing PostgreSQL 9.1, I noticed that there is no option in its GUI to prevent it to autostart at system boot. The following commands help in disabling/renabling  autostart for PostgreSQL.

See gist at https://gist.github.com/1960888

## Stop PostgreSQL from auto starting in Mac OS X 10.7.x (Lion)
sudo launchctl unload -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.1.plist
## Enable PostgreSQL to auto start in Mac OS X 10.7.x (Lion)
sudo launchctl load -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.1.plist

## Note:
## - Without "sudo" the commands seem to run successfully but don't take effect
## - Contents of com.edb.launchd.postgresql-9.1.plist in attached file (Permission MUST be: -rw-r--r--  1 root  wheel)

Fix Mac BootCamp after accidental disk (re)partition

Repartitioning your Storage Drive (e.g. shrink and resize) after installing BootCamp can corrupt the boot record for your bootcamp. Fixing this is vey simple but writing this as I can forget how to get to the beginning.

  1. From within Mac’s System Preferences -> Startup Disk choose to boot from the Windows HD
  2. Restart your system
  3. Boot using the original Windows installation media. (Insert media and press “Alt/Option” during startup)
  4. Choose the option “Repair your Computer”
  5. Choose the option Startup Repair.
  6. Let the process complete and reboot.
  7. Your should have booted using the boot camp. (As we set the startup disk to windows in step 1)

0_choose_-_windows_hard_disk_from_startup_disk1_boot_from_bootable_media2_choose_-_repair_your_computer3_choose_-_startup_repair4_reboot_after_the_process_completes

 

 

Solve “PresentationFontCache” (.exe) taking too much CPU

After working on a project on Visual Studio 2010, I faced an issue where nearly 25% of my CPU (i7 M620, Windows 7) was being taken by the PresentationFontCache.exe. This service is used by applciations that use Windows Presentation Foundation (WPF) but many a times I was not even using a .NET applicaton (rather I was working on Java !!) and still the PresentationFontCache.exe was hogging my CPU.

After some search and analysing multiple possible solutions, running these commands on console and rebooting solved my problem on my Windows 7:

cd /d C:WindowsServiceProfilesLocalServiceAppDataLocal
del Font*.dat

Apple gets restrictive and network dependent in software distribution

App_store_excerpt

This is an excerpt from the Mac App Store India License. I hate the way Apple is trying to restrict the acquiring of softwares to “download only” versions and not any physically accessible media that can be backed up for later use. While I understand that this is to curb piracy; many user groups, especially developers and those of whom who work and support a wide gamut of platforms, would be impacted greatly. Image a plugin or extension that you depend on not working in the newer version of the software.

Please make sure that prior to switching to any of “download only” version of of the software you make backups. And do share any news you get on how to switch-n-bounce between different versions of these “download only” version of these softwares.

 

How to Access a Cassini (IIS in Visual Studio) hosted site from a remote machine

Visual Studio provides Cassini (a local only version of IIS for Web Projects in Visual Studio) for developers to test their projects on their systems without having to use the real IIS server. However, it also imposes a restriction that only the localmachine (OS on which Visual Studio is Installed) can access it. Following the steps here would allow us to go around this restriction and view a site hosted on the Cassini server from another host (machine or virtual-machine) which is on the network. This helps when doing cross-platform or cross-browser UI testing.

Perquisites:

  1. Remote Machine/VM.
  2. Fiddler 2 (download from here). TIP: We will use its reverse proxy capabilities.

Steps:

  1. If using a VM, make sure you are using the Shared Networking/Bridged Mode.
  2. Build and Run the web-application/web-project on Visual Studio and make sure you can access it on your local machine. Take note of the port on which is hosted.
  3. Start fiddler and open from the menu. Tools > Fiddler Options.
  4. Go to the ‘Connections’ Tab and make sure the option – “Allow remote computers to connect” – is check marked.
  5. Customize the “Fiddler listens on port:” to a port not used by any application on your system (e.g. 9999)
  6. Click [Ok] button to save these options.
  7. Press ‘Ctrl+R’ to Customize rules (You can also go to Rules > Customize rules). This generally opens the rules file in notepad (or the default editor)
  8. Find the function OnBeforeRequest (The rule files follows the Jscript syntax)
  9. At the end of this function add these line:
    if (oSession.host.toLowerCase() == "192.168.2.6:9999"){
        oSession.host = "localhost:58060";
    }
    // The IP address is the original machine's (with Cassini) IP
    // the localhost:port is the application port on Cassini
  10. Run cmd.exe and renew your IP by doing an:
    >> ipconfig /release

    followed by

    >>ipconfig /renew
  11. From your browser in remote machine/VM access IP:<Fiddlers port>. e.g.
    http://192.168.2.6:9999

You should be seeing the website, served from Cassini, on the remote machine!

Use MySQL with Python/Django on Mac OS X (Snow Leopard)

Setting up MySQL with Python ( or Django ) can be a bit tricky since no database driver is officially provided by MySQL (as of Feb 2011). I had a couple of failed attempts, but finally got it working. A hit and trial method and troubleshooting guides from various websites helped. To sum it up, here is what worked for me:

Environment:

  1. Mac OS X 10.6.6
  2. Python 2.6.1 (Django supports this version and is installed on Mac by default if Xcode is installed)
  3. GCC 4.2.1
  4. MySQLdb 1.2.3 (Download from http://sourceforge.net/projects/mysql-python/)
  5. MySQL 5.1.x Server (Since MySQLdb supports upto this version as of Feb 2011)

Don’t try to reuse the MySQL installed as part of MAMP because it doest match typical deployment environments if you would use Python/Django for professional application and secondly its overtly complicated.

Install MySQL:

See previous post Install/Uninstall MySQL 5.1 on Mac @ http://abhishekdev.posterous.com/installuninstall-mysql-51-on-mac

Perquisites: before installing MySQLdb

  1. Add the following line to the ~/.bash_profile or ~/.profile (Found by default on10.6.x) file under the User Home (if ~ is not known to you)
    PATH=”${PATH}:/usr/local/mysql/bin” 
  2. Type in Terminal
    mysql –version
    Should read something similar to “mysql  Ver 14.14 Distrib 5.1.55, for apple-darwin10.3.0 (i386) using readline 5.1”

Install MySQLdb:

  1. Extract MySQLdb if it came archived/compressed
  2. Open Terminal
  3. Make the extracted folder as current working directory
    cd [Path if any]MySQL-python-1.2.3
  4. Type in Terminal
    python setup.py build
    sudo python setup.py install
    
  5. If no Errors get thrown. In Python Prompt type “import MySQLdb”
    python
    import MySQLdb

Install/Uninstall MySQL 5.1 on Mac

Install

  1. Download a x64 bit (.dmg) copy from MySQL website
  2. Install it
  3. Also install the Preferences Pane

Troubleshoot if MySQL wont install or a version (previous/latest) is already installed.

Uninstall

  1. Make sure MySQL is not running
  2. Open Terminal
  3. Type in Terminal:
    sudo nano /etc/hostconfig
  4. Enter your password, if asked for.
  5. Delete the following line if its there: “MYSQLCOM=-YES-”
  6. CTRL+X (This is the command for closing NANO, Enter the “Y” key to save the file if you changed it and exit nano).
  7. Type in Terminal
    sudo rm /usr/local/mysql
    sudo rm -rf /usr/local/mysql*
    sudo rm -rf /Library/StartupItems/MySQLCOM
    sudo rm -rf /Library/PreferencePanes/My*
    sudo rm -rf /Library/Receipts/mysql*
    sudo rm -rf /Library/Receipts/MySQL*
    sudo rm /etc/my.cnf
    sudo rm -rf /var/db/receipts/com.mysql.mysql*

How to use AllShare on Samsung Galaxy S

Finally got time to find, how to view media content from my home computer on my phone. After testing a few softwares I have zeroed in on TVMOBiLi server. Its free and awesome. It does what it says.

What and Why I Liked it:

  1. Is Cross Platform (Windows / Mac / Linux)….So I am not bound to a platform
  2. Its NOT Java…Now I know how it is so fast and light!!!
  3. Web Interface
  4. External Access
  5. Share with Friends
  6. Very fast transfers and lag-less buffering.

What I dont like:

  1. No ability to remove the default folders
  2. The web interface design is not very appealing (Too many bright colors and hues…looks 90’s)
  3. On Galaxy S only the first 6 items show up in the contents….However the Dev Forum at TVMOBiLi reports that it has fixed this problem in a developer build and is soon going to publish it. Would update when I get it