Home Blog
Jul 21
2010

Couple of useful OS X Tricks

Posted by: Marko Tomic

Tagged in: OS X , HOWTO

I just stumbled upon 30 Fantastic Geeky Tricks To Get The Most From Your Mac and I thought I'd write down a couple of tricks I found useful.

Recent Items Stack

Type this in terminal window to show a stack of your 'recent applications'.

defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }'

Show Hidden Files

The following command will show all hidden files in your Finder.

defaults write com.apple.Finder AppleShowAllFiles YES

Similarly, change the last bit to 'NO' to re-hide the files.

Enable Safari Inspector

I didn't know that Safari had an Inspector that looks like the one in Google Chrome. As a web developer, I can say that this is music to my ears. Enable it in Terminal:

defaults write com.apple.Safari IncludeDebugMenu 1

Better Screen Sharing

When I first saw Screen Sharing on a Mac, I thought it was the best thing since sliced bread. Apparently, there are more nifty Screen Sharing features that are hidden by default.  This includes a number of options for adjusting quality and allowed input on each side of the screen share. To turn them on, type this in your Terminal:

defaults write com.apple.ScreenSharing \
'NSToolbar Configuration ControlToolbar' -dict-add 'TB Item Identifiers' \
'(Scale,Control,Share,Curtain,Capture,FullScreen,GetClipboard,SendClipboard,Quality)'

Jun 16
2010

Removing default icons from Flex Tree control

Posted by: Marko Tomic

Tagged in: HOWTO , Flex , AS3

What's so cool about Flex framework is the fact that it's very extensible, which allows me to do almost anything I want with it.

For example, to remove folder/arrow icons from Flex Tree control, which prevents nodes from collapsing and also creates more space for labels, you can add the following in your stylesheet:

defaultLeafIcon: ClassReference(null); 
folderClosedIcon: ClassReference(null);
folderOpenIcon: ClassReference(null);
disclosureClosedIcon: ClassReference(null);
disclosureOpenIcon: ClassReference(null);

For more information on Flex Tree CSS properties, refer to AS3.0 Reference.

Marko

May 20
2010

Startup Script for Apache Tomcat on Snow Leopard HOWTO

Posted by: Marko Tomic

Tagged in: Tomcat , Railo , OS X , HOWTO , Apache

I have just set up Apache Tomcat startup script on Snow Leopard and I thought I'd blog about it while it's still fresh in my head.  Assuming you have installed Tomcat in /usr/local/tomcat directory, you can do the following to start Tomcat on system startup.

1. Create your startup script:

sudo nano /usr/local/tomcat/bin/tomcat

#!/bin/sh # Tomcat Startup Script
 
CATALINA_HOME=/usr/local/tomcat; export CATALINA_HOME
JAVA_HOME=/Library/Java/Home; export JAVA_HOME
TOMCAT_OWNER=root; export TOMCAT_OWNER
 
start() {
        echo -n "Starting Tomcat:  "
        su $TOMCAT_OWNER -c $CATALINA_HOME/bin/startup.sh
        sleep 2
}
stop() {
        echo -n "Stopping Tomcat: "
        su $TOMCAT_OWNER -c $CATALINA_HOME/bin/shutdown.sh
}
 
# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        start
        ;;
  *)
        echo $"Usage: tomcat {start|stop|restart}"
        exit
esac

Set your TOMCAT_OWNER correctly.  You should run it as a valid system user.


2. Create a symbolic link in /usr/bin for easier access

sudo ln -s /usr/local/tomcat/bin/tomcat /usr/bin/tomcat


3. Create the startup daemon which will start Tomcat when the system boots up

sudo mkdir /Library/StartupItems/tomcat
sudo nano /Library/StartupItems/tomcat/tomcat

#!/bin/sh
. /etc/rc.common
 
# The start subroutine
StartService() {
    # Insert your start command below.  
    tomcat start
}
 
# The stop subroutine
StopService() {
    # Insert your stop command(s) below.
    tomcat stop
}
 
# The restart subroutine
RestartService() {
    # Insert your start command below.
    tomcat restart
}
 
RunService "$1"


4. Create your startup parameters plist file

sudo nano /Library/StartupItems/tomcat/StartupParameters.plist

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
    <dict>
        <key>Description</key>
        <string>Tomcat web server</string>
        <key>OrderPreference</key>
        <string>Late</string>
        <key>Provides</key>
        <array>
                <string>Local Web Services</string>
        </array>
        <key>Uses</key>
        <array>
                <string>SystemLog</string>
        </array>
    </dict>
</plist>

Restart your Mac and you should be sweet.

For more info on how to install Tomcat, e.g. Railo on Tomcat via Apache see my blog post on Learnosity Website. Also, have a look at Mark's version using Apache mod proxy 
 
Marko

May 19
2010

MySQL startup script on Mac OS X Snow Leopard

Posted by: Marko Tomic

Tagged in: OS X , MySQL , HOWTO

I've had problems starting up MySQL database server on startup on Snow Leopard.  MySQL preference pane seems to be flaky and it often fails to start MySQL server.

I created this startup script myself and it seems to work nicely.

sudo nano /System/Library/LaunchDaemons/org.mysql.mysqld.plist

<?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>RunAtLoad</key>
<true/>
<key>Umask</key>
<integer>7</integer>
<key>UserName</key>
<string>_mysql</string>
<key>Disabled</key>
<false/>
<key>WorkingDirectory</key>
<string>/usr/local/mysql</string>
<key>GroupName</key>
<string>_mysql</string>
<key>KeepAlive</key>
<true/>
<key>Program</key>
<string>/usr/local/mysql/bin/mysqld</string>
<key>Label</key>
<string>org.mysql.mysqld</string>
<key>ProgramArguments</key>
<array>
<string>--user=_mysql</string>
</array>
</dict>
</plist>

Now make sure file permission is correct and load the daemon.

sudo chown root:wheel /System/Library/LaunchDaemons/org.mysql.mysqld.plist
sudo launchctl load /System/Library/LaunchDaemons/org.mysql.mysqld.plist
sudo launchctl start org.mysql.mysqld

Restart your Mac and your MySQL server should be running.

Marko

Apr 24
2010

Zen Cart to VirtueMart csv export

Posted by: Marko Tomic

Tagged in: Zen Cart , VirtueMart , PHP

Following my post on Zen Cart friendly URLs, I would now like to give VirtueMart some love.

I've been looking for ways to export Categories and Products from Zen Cart and bulk insert them into VirtueMart.  Wishful thinking? That's what I thought after googling for a solution and couldn't find anything that's convincing and, of course, free.

This motivated me to download a free version of CSV Improved component for VirtueMart and have a look at the csv format required for importing products into VM.  After a bit of head scratching I've come up with a pretty simple Zen Cart export tool that's very primitive, but worked nicely for me. It can certainly save you days/months of manual data entry, depending on the number of products you have. Keep in mind that this tool will only export Categories and Products. If you need to export other stuff, you'll have to extend this code a little bit. More info in readme.txt.

Download a copy of ZenCartToVirtueMartCSV.zip .

Don't run this script in production environment until you have tested it thoroughly. Make sure you read the readme.txt for requirements and instructions. Use it at your own risk.


This little script can definitely be improved, but it is all I have time for.  Feel free to modify it and use it as a base for something more sophisticated.

Happy Exporting
Marko

Apr 19
2010

Zen Cart Friendly URLs

Posted by: Marko Tomic

Tagged in: Zen Cart , PHP , HOWTO , Apache

I've been exploring Zen Cart shopping cart for a long time and one thing that, I thought, needed improvement was the support for friendly URLs. Ultimate SEO URLs break my site and I needed another solution. I found this little beauty called Simple SEO URL and it works beautifully.  It's a little tricky to set up, but it's worth the effort.  Installation process will take you about 15-20 minutes.

I use Zen Cart 1.3.8a and SSU 3.8.3. If you have different version(s) the following steps may not work.

Download Simple SEO URL


Requirements
1. PHP 5
2. mod_rewrite enabled on your Apache web server

3. Zen Cart Module Manager installed


Installation
1. Unzip and upload your files to web server
2. Go to Admin==>Extras==>SSU Manager
3. Open path_to_store/.htaccess and add:

If your .htaccess file already has stuff in it, do not overwrite it.  Simply append the following

#### BOF SSU
Options +FollowSymLinks
RewriteEngine On
# Change "/zencart/ to the correct setting
# if your site is located at root folder, then you should have RewriteBase /
# Go to your include/configure.php, this value should be the same with the value of DIR_WS_CATALOG
RewriteBase /zencart/

# Deny access from .htaccess
RewriteRule ^.htaccess$ - [F]

RewriteCond %{SCRIPT_FILENAME} -f [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule .* - [L]

RewriteRule ^(.+) index.php/ [E=VAR1:,QSA,L]
#### EOF SSU

Makle sure your "RewriteBase" path is correct.


4. Set path_to_cache_folder/ssu and its subfolders permission to 0777
5. Now go to Admin==>Configuration==>Simple SEO URL to enable and configure your friendly URLs.

That's it.  You can also test your installation http://yoursite/ssu_check.php after which you can remove ssu_check.php from your server.

Marko

Apr 09
2010

Illegal override of activate in mx.managers.SystemManagerProxy - Solved

Posted by: Marko Tomic

Tagged in: General , Flex , AS3

I've been quiet on the blog front for a while.  I was having a rough time scuba diving in the tropics and so on... If you're interested, take a look at some of my holiday pics I uploaded on facebook.

Now back to business.

At Learnosity, I've been working on migrating our core Flex 3 app to Flex 4.  One of the problems I encountered was embedding an external swf file into the main app. I was getting the following error:

#1053 Illegal override of activate in mx.managers.SystemManagerProxy

It turned out that my Flex 4 app didn't like the external swf because it was compiled with SDK 3.0.  Sounds obvious, but it took me half a day to figure it out :)  I compiled my external swf with SDK 4.0 and everything worked beautifully.

So the lesson learnt is that if your app has other project dependencies, make sure they are all compiled with the same SDK version and you should be sweet.

Marko

 

Feb 12
2010

Adding a startup script on Ubuntu server

Posted by: Marko Tomic

Tagged in: ubuntu , Shell , linux , command

This is a useful tip for my reference.  I've been creating some startup scripts on my Ubuntu server lately and her are a couple of steps required to get this working.

Write your startup script and place it in /etc/init.d/ directory. Let's say you called your startup script - myScript.  You then install your script by using update-rc.d debian utility:

update-rc.d myScript defaults

Have a look at man update-rc.d for more info.

And finally, you have to make your file executable:

chmod +x myScript

Feb 06
2010

HOWTO convert and shrink your DVD into a web-playable format

Posted by: Marko Tomic

Tagged in: HOWTO , HandBrake , DVD , command

HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded video transcoder, available for MacOS X, Linux and Windows.

It is my tool of choice when it comes to backing up my DVDs. It allows me to shrink DVDs to a relatively small size and convert them to a web-playable format, such as mp4.

I use the Command Line version of HandBrake simply because it is more efficient and I love typing geeky commands in my terminal window.  So here it is, the simplest command to convert your DVD into an .mp4 file is this:

HandBrakeCLI -i VIDEO_TS -o myVideo.mp4 -e x264 -b2000 -B 192

That will encode a source video located at the path VIDEO_TS to an output file called myVideo.mp4. It will use x264 with a bitrate of 2000 to encode the video, and encode the audio as 128kb/s AAC.

Jan 08
2010

yellowtrace blog

Posted by: Marko Tomic

Tagged in: General

I would like to welcome my dear sister to the blogosphere - the yellowtrace blog.  She has been blogging for about a month and I'm amazed with the number of ideas and thoughts she has shared in such a short period of time.  I find her blog posts very inspiring even though we have completely different careers and characters.

She's a very talented Interior Designer and I'm just a code buster.
She's cool and I'm not.
She's extremely creative and I'm not.
Her blog posts are exciting and mine are not.
These are just some of the differences between us, but the key difference is: I can build a good Website and she can't :-)

Best of success sis!


« StartPrev12NextEnd »

Stalk Me

Facebook: marko.tomic Twitter: mtomic Twitter: SydneyScuba YouTube: migonyourtail Linked In: tomicmarko MySpace: markomedia Google Wave: marko2009 blip.fm: markotomic Flickr: markotomic FeedBurner: markomedia

Site Login

Tag Cloud

Browser Poll

What browser do you use?