Archive for ‘Apple’ Category

Lion Tip: Adding your digital signature to PDF files….

datePosted on 11:24, August 4th, 2011 by Many Ayromlou

If you ever are in need of signing a PDF file, you don’t need to print/sign/scan it anymore, Lion’s new preview app lets you insert/sign those pdf docs in a flash. Here is how you get your signature “scanned”.

  1. Use a Sharpie marker and sign your name on a plain piece of paper. Make sure it’s a plain sheet of paper with nothing written on either side.
  2. Open the Preview App and go to Preferences>Signatures and Press the small + button to add a new signature.
  3. A new window will pop up with your webcam video inside.
  4. Hold up the paper with your signature in front of the camera and make sure there is enough light in the room for the camera to get a clean image
  5. Align the signature — by moving it back and forth — with the blue line and wait for the machine to give you the clean scan of it in the window beside it.
  6. Press Enter to accept the signature when you’re ready.

I had to do this twice, but it’s very easy and quick to do. You can even have multiple pics taken of your signatures (or other peoples sig in your household).

Lions new Finder Tricks….

datePosted on 15:21, July 26th, 2011 by Many Ayromlou

Now that I’m getting settled in the latest OSX, I thought I share with you a couple of finder gems that might not be obvious right from the get go:

1) You now have the ability to select multiple files in a folder and right click on them to choose “New Folder with X Selections”. This will create a new folder and move the selected files into that folder. Kinda neat and makes the process of moving large number of files a bit simpler.

2) You can now “move” files and folders from one place to another. First “copy” the file/folder in question by selecting it and using the command-c shortcut. Then find the place you want to move them to and instead of using the usual command-v (which copies the files/folders) use command-option-v instead. Yeaaaaa, we can finally be just like our windows cousins :-).

3) To remove something from the finder sidebar, hold the command key as you drag it out.

4) In the Finder’s “Go” menu hold the option key to reveal a “Go to Library” menu item.

Although not strictly a new finder gem, Window resizing now supports standard modifier keys, so holding Shift while resizing a window constrains it to its existing aspect ratio, while holding Option resizes the window from its center point.

Tethering iphone 3GS and ipad 1G using bluetooth…

datePosted on 22:21, March 19th, 2011 by Many Ayromlou

Yep, it works. I was kinda disappointed when firmware 4.3 was introduced and the 3GS owners were left in the cold as far as wifi hotspot sharing. Apple only activated that function on the iphone 4. Anyhow, after messing around with the menus a bit tonite, I figured out how to do something similar to wifi tethering (hotspot) of ipad to the iphone 3GS using bluetooth. Here is how you do it:

  1. Turn wifi off on your 3GS and ipad device. I’m testing from home so I wanted to make sure I was NOT using wifi.
  2. Turn on Bluetooth on both your 3GS and ipad device. This is under Settings/General
  3. On the iphone 3GS turn on “Personal Hotspot”.
  4. On the ipad go back to the Bluetooth menu and let it scan for a second. You’ll find a Entry for your iPhone soon. Click on the entry and connect.
  5. You’ll be prompted on the iphone and the ipad to make sure you see the same code. Just say Okay/Yes.
  6. Viola, you’re tethering your ipad to your iphone 3GS using bluetooth. You should see a Blue throbbing menu bar on top of your iphone 3GS saying “Personal Hotspot: 1 Connection”.

To stop turn Personal Hotspot off on the iphone. If you need to connect again, turn Personal Hotspot on (assuming BT is on already) and click on the iPhone entry in the Bluetooth menu on your ipad.

N.B. The iphone can also “share” it’s wifi connection with the ipad using bluetooth. Neato :-). Oh and that GPS location transfer thing that people are talking about using wifi tethering doesn’t seem to work when using BT…..Oh well, small price to pay.

UPDATE: After a bit of testing here are some numbers. These were done around midnight on Rogers/Fido Network through bluetooth (iphone 3GS on 3G):

  • Ping: ~320ms
  • Download: 1.53 Mbps
  • Upload: 0.23 Mbps

Not bad for bluetooth I guess.

Adding mcrypt support to builtin php5 on OSX Leopard….

datePosted on 17:51, February 4th, 2011 by Many Ayromlou

I got a request to add mcrypt support to our Leopard server today and here is a brief step-by-step installation instruction. This works well under the current 10.5.8 server installation. It should also work for 10.6 (snow leopard), but I have not tried it. Before you start here are the requirements:

  • Backup your system
  • Install (and update) the latest XCode (I’ve got version 3)
  • Install X11 client stuff from your server install DVD
  • install X11 SDK stuff from your server install DVD
  • Ensure you have server 10.5.8 (latest update as of Feb.04.2011)
  • Make sure you have not tried to install mcrypt using another method. We need a “virgin” 10.5.8 install (as far as homebrew/local installs)
  • BACKUP

Please note that this will add mcrypt support to php. This is NOT the same as compiling mcrypt.

Okay, so now that we have all the requirements, you need to get a command line window opened and get a root shell (sudo -i). The rest of this document assumes you’re typing the commands in a root shell.

There is one dependency that we need to clear before we actually get down and dirty and that is libmcrypt. Follow the instructions below to get this installed:

mkdir /SourceCache
cd /SourceCache
curl http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.bz2/download -o libmcrypt-2.5.8.tar.bz2 -L

This is the latest version as of this writing (Feb.04.2011).

NOTE: If you’re compiling on a G5 machine you’ll need to tell the compiler that you want to build/configure for a ppc64 target so instead of the below configure command you need to use this:

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=" -arch ppc64 -g -Os -pipe -no-cpp-precomp" CCFLAGS=" -arch ppc64 -g -Os -pipe" CXXFLAGS="-arch ppc64 -g -Os -pipe" LDFLAGS="-arch ppc64 -bind_at_load" ./configure --enable-shared
tar -xjvf libmcrypt-2.5.8.tar.bz2
cd libmcrypt-2.5.8/
./configure
make
make -n install

The last command will simulate the installation process. Make sure the stuff is getting installed in /usr/local/lib

make install

At this point you should have a working installation of libmcrypt. This next command prints out the current version of your php engine. In my case under 10.5.8 it’s php 5.2.14.

server:libmcrypt-2.5.8 root# php -v
PHP 5.2.14 (cli) (built: Oct  6 2010 16:57:10)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

Grab the appropriate php-5.2.XX.tar.bz2 file from php.net. I just grabbed the stock PHP 5.2.14, since I wanted a perfect match between my php engine and the extension. I transferred the file using sftp to the /SourceCache folder on the server.

NOTE: If you’re compiling on a G5 machine you’ll need to tell the compiler that you want to build/configure for a ppc64 target so instead of the below configure command you need to use this:

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=" -arch ppc64 -g -Os -pipe -no-cpp-precomp" CCFLAGS=" -arch ppc64 -g -Os -pipe" CXXFLAGS="-arch ppc64  -g -Os -pipe" LDFLAGS=" -arch ppc64  -bind_at_load" ./configure --with-php-config=/Developer/SDKs/MacOSX10.5.sdk/usr/bin/php-config
cd /SourceCache
tar xjvf php-5.2.14.tar.bz2
cd /SourceCache/php-5.2.14/ext/mcrypt
phpize
./configure --with-php-config=/Developer/SDKs/MacOSX10.5.sdk/usr/bin/php-config
make
make test
make -n install

The last command will simulate the installation process. Make sure the stuff is getting installed in /usr/lib/php/extensions/no-debug-non-zts-20060613

make install

Now we need to modify our php.ini file and tell the php5 engine of the availability of this new module. To do this you need to copy php.ini.default to php.ini (in /etc directory). For details of why have a look at this article.

cd /etc
cp php.ini.default php.ini

Edit the newly created/copied php.ini using your favourite editor. Add the following line to the appropriate location (read the comments in the file to find the location):

extension=mcrypt.so

Still in the same file find the variable “extension_dir” and change it’s value to “/usr/lib/php/extensions/no-debug-non-zts-20060613” path instead of “./”. Save the php.ini and use the following command to see if mcrypt extensions are available:

server:etc root# php -i |grep mcrypt
mcrypt
mcrypt support => enabled
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value

Done. Restart Apache service from the server manager (just for the sake of completeness).

Adding GD support to builtin php5 on OSX Leopard….

datePosted on 15:17, February 4th, 2011 by Many Ayromlou

I got a request to add GD support to our Leopard server today and here is a brief step-by-step installation instruction. This works well under the current 10.5.8 server installation. It should also work for 10.6 (snow leopard), but I have not tried it. Before you start here are the requirements:

  • Backup your system
  • Install (and update) the latest XCode (I’ve got version 3)
  • Install X11 client stuff from your server install DVD
  • install X11 SDK stuff from your server install DVD
  • Ensure you have server 10.5.8 (latest update as of Feb.04.2011)
  • Make sure you have not tried to install GD using another method. We need a “virgin” 10.5.8 install (as far as homebrew/local installs)
  • BACKUP

Please note that this will add GD support to php. This is NOT the same as compiling the GD graphics library (libgd).

Okay, so now that we have all the requirements, you need to get a command line window opened and get a root shell (sudo -i). The rest of this document assumes you’re typing the commands in a root shell.

There is one dependency that we need to clear before we actually get down and dirty and that is libjpeg (known as jpegsrc). Follow the instructions below to get this installed:

mkdir /SourceCache
cd /SourceCache
curl -O http://www.ijg.org/files/jpegsrc.v8c.tar.gz

This is the latest version as of this writing (Feb.04.2011).

NOTE: If you’re compiling on a G5 machine you’ll need to tell the compiler that you want to build/configure for a ppc64 target so instead of the below configure command you need to use this:

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=" -arch ppc64 -g -Os -pipe -no-cpp-precomp" CCFLAGS=" -arch ppc64 -g -Os -pipe" CXXFLAGS="-arch ppc64 -g -Os -pipe" LDFLAGS="-arch ppc64 -bind_at_load" ./configure --enable-shared
tar -zxvlf jpegsrc.v8c.tar.gz
cd jpeg-8c/
./configure
make
make test
make -n install

The last command will simulate the installation process. Make sure the stuff is getting installed in /usr/local/lib

make install

At this point you should have a working installation of libjpeg. Now we double check our php version.

server:jpeg-8c root# php -v
PHP 5.2.14 (cli) (built: Oct  6 2010 16:57:10)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

Notice in the output that I have php 5.2.14 installed on the machine (again the latest update as of Feb.04.2011). Apple does not provide source code for this exact version of PHP. On top of that The numbering scheme that they use is weird. On my machine it is “apache_mod_php-44.6”, you can find yours using the following:

server:jpeg-8c root# php -i |more
phpinfo()
PHP Version => 5.2.14

System => Darwin saturn.rcc.ryerson.ca 9.8.0 Darwin Kernel Version 9.8.0: Wed Ju
l 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
Build Date => Oct  6 2010 16:55:34
Configure Command =>  '/SourceCache/apache_mod_php/apache_mod_php-44.6/php/confi
gure'  '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--
disable-dependency-tracking' '--with-apxs2=/usr/sbin/apxs' '--with-ldap=/usr' '-
-with-kerberos=/usr' '--enable-cli' '--with-zlib-dir=/usr' '--enable-trans-sid'
'--with-xml' '--enable-exif' '--enable-ftp' '--enable-mbstring' '--enable-mbrege
x' '--enable-dbx' '--enable-sockets' '--with-iodbc=/usr' '--with-curl=/usr' '--w
ith-config-file-path=/etc' '--sysconfdir=/private/etc' '--with-mysql-sock=/var/m
ysql' '--with-mysqli=/usr/bin/mysql_config' '--with-mysql=/usr' '--with-openssl'
 '--with-xmlrpc' '--with-xsl=/usr' '--without-pear'

The thing you’re looking for (“apache_mod_php-44.6”) is under Configure Command. If you go to the following URL (http://www.opensource.apple.com/source/apache_mod_php/) in your browser (safari, firefox) you’ll soon discover these weird directory names with numbers that don’t match the php versions. Again, as of this writing (Feb.04.2011), I can’t find apache_mod_php-44.6 folder in the listing so I grabbed the nearest numbers apache_mod_php-44.2 which is php 5.2.8…….close enough. It seems to work. Follow the steps below to get the file and compile the GD portion of it. Remember we’re not recompiling the entire php, just the GD plugin portion.

UPDATE: You CAN install the exact version of your PHP’s GD extension. Instead of grabbing the file from Apple, figure out the version of your PHP using “php -v” and grab the appropriate file from php.net instead. I just recompiled the GD portion of PHP 5.2.14, since I wanted a perfect match between my php engine and the extension. The instructions below (except curl which needs to be modified) work.

NOTE: If you’re compiling on a G5 machine you’ll need to tell the compiler that you want to build/configure for a ppc64 target so instead of the below configure command you need to use this:

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=" -arch ppc64 -g -Os -pipe -no-cpp-precomp" CCFLAGS=" -arch ppc64 -g -Os -pipe" CXXFLAGS="-arch ppc64  -g -Os -pipe" LDFLAGS=" -arch ppc64  -bind_at_load" ./configure --with-zlib-dir=/usr --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/X11R6 --with-freetype-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6
cd /SourceCache
curl -O http://www.opensource.apple.com/source/apache_mod_php/apache_mod_php-44.2/php-5.2.8.tar.bz2
tar xjvf php-5.2.8.tar.bz2
cd /SourceCache/php-5.2.8/ext/gd
phpize
./configure --with-zlib-dir=/usr --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/X11R6 --with-freetype- dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6
make
make test
make -n install

The last command will simulate the installation process. Make sure the stuff is getting installed in /usr/lib/php/extensions/no-debug-non-zts-20060613

make install

Now we need to modify our php.ini file and tell the php5 engine of the availability of this new module. To do this you need to copy php.ini.default to php.ini (in /etc directory). For details of why have a look at this article.

cd /etc
cp php.ini.default php.ini

Edit the newly created/copied php.ini using your favourite editor. Add the following line to the appropriate location (read the comments in the file to find the location):

extension=gd.so

Still in the same file find the variable “extension_dir” and change it’s value to “/usr/lib/php/extensions/no-debug-non-zts-20060613” path instead of “./”. Save the php.ini and use the following command to see if GD extensions are available:

server:etc root# php -i |grep GD
GD Support => enabled
GD Version => bundled (2.0.34 compatible)

Done. Restart Apache service from the server manager (just for the sake of completeness).

Hauppauge Broadway: OTA ATSC streaming for iOS devices….

datePosted on 23:27, January 16th, 2011 by Many Ayromlou

Yep, just like the title says, hauppauge has announced the Broadway, a new “set-top” aimed at iPhone, iPad and iPod touch users. The hardware streams live OTA HDTV to an Apple handheld after first compressing the video using H.264. The resulting media can be delivered locally over Wi-Fi, or to a remote place using any Internet connection. Over-The-Air ATSC signals can be captured using a built-in ATSC tuner, while cable is supported through clear QAM. Pricing is a bit steep at $199 and the box is scheduled for February release.

Optimizing Snow Leopard for SSD drives….

datePosted on 22:13, January 16th, 2011 by Many Ayromlou

I just installed a new 128GB SSD drive in my older C2D 17″ macbook Pro and let me tell you….WOW….This thing is on fire. The system is extremely responsive and apps literally jump onto the screen. The machine now boots up to full desktop in roughly 17 seconds. Now that’s nice. I did do a bunch of changes to the way Snow Leopard is setup to optimize a couple of things that are normally tuned for HDD’s.

  • Turn off Sudden Motion Sensor (SMS): If you are replacing your primary (and only) HDD internal drive with a SSD, you can get a bit of a performance boost by turning off the Sudden Motion Sensor technology that comes with your laptop. Remember your SSD doesn’t use read/write head on rigid platters so there is no reason to keep this feature turned on. You can safely turn it off by issuing the command below in Terminal, type in administrator password when asked.
    sudo pmset -a sms 0
  • Turn off hibernation and delete sleepimage file: Using SSD, you can achieve under 20 seconds boot-up time. Why bother using Hibernation and waste too much space on your SSD. To do so, issue the commands below in Terminal, enter administrator password when asked.
    sudo pmset -a hibernatemode 0
    sudo rm /var/vm/sleepimage
  • Reduce disk I/O by mouting partition with noatime: Stop OSX from updating “last access time” or atime everytime a file is touched on your filesystem. This is IO expensive and unnecessary. In a terminal window create a file called com.nullvision.noatime.plist under /Library/LaunchDaemons folder and stick the following lines in the file. Save the file (you need to sudo when you edit the file) and reboot your machine.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
            "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
        <dict>
            <key>Label</key>
            <string>com.nullvision.noatime</string>
            <key>ProgramArguments</key>
            <array>            
    		<string>mount</string>
                	<string>-vuwo</string>
                	<string>noatime</string>
                	<string>/</string>
            </array>
            <key>RunAtLoad</key>
            <true/>
        </dict>
    </plist>

    Once the machine has rebooted you can check to make sure your root partition is mounted with noatime by issuing the following command

    mount | grep "/"

    and look for something similar to this in the output

    /dev/disk0s3 on / (hfs, local, journaled, noatime)

This should do it. Have fun with your new SSD drive.

Five minute Augmented Reality via Quartz Composer….

datePosted on 21:40, January 16th, 2011 by Many Ayromlou

Great little video on how to setup AR marker recognition under QC. Even has a nice mellow background music :-).

I wonder what it will look like in 2020….

datePosted on 13:49, October 19th, 2010 by Many Ayromlou

10 years

Terminal Tip: Finding information about a mp3 audio file…

datePosted on 13:24, October 19th, 2010 by Many Ayromlou

Here is a quick tip for you OSX command line fans. If you want to find metadata information about a mp3 file use the “afinfo” command. Very quick and scripting friendly. Here is a example:

$ afinfo 08_\ Lily\ Allen\ -\ Fk\ You.mp3 
File:           08_ Lily Allen - Fk You.mp3
File type ID:   MPG3
Data format:     2 ch,  44100 Hz, '.mp3' (0x00000000) 0 bits/channel, 0 bytes/packet, 1152 frames/packet, 0 bytes/frame
                no channel layout.
estimated duration: 215.249 sec
audio bytes: 5167920
audio packets: 8240
audio 9490176 valid frames + 576 priming + 1728 remainder = 9492480
bit rate: 192000 bits per second
packet size upper bound: 1052
maximum packet size: 731
audio data file offset: 32353
optimized
----
1234... 111213PreviousNext