Archive for the ‘tutorial’ Category

Upgrading to Snow Leopard - Part 1 Upgrading Parallels to 4.0

Saturday, December 5th, 2009

I saw that Snow Leopard was only going to be $29 and I was so ready to jump on that bandwagon until the day they released it. Rumors went around that Parallels 3.0 does not work on Snow Leopard. This doesn’t work for me because I have a windows XP drive set up with parallels 3.0 which I use when some clients require me to use Windows or to test web pages on IE. Some people recommended I use a different VM but I spent a long time just setting up the windows on parallels that I don’t want to do that all over again.

Just when I quit on the idea of upgrading to snow leaopard, I found this site that has a large list of application compatibility with Snow Leopard:

http://snowleopard.wikidot.com/o-t

That’s where I found out that Parallels 4.0 works with Snow Leopard, so I decided to upgrade. I just spent $56.98 to upgrade to 4.0.

Installation is pretty straight forward. I downloaded a .dmg file from Parallels, double click on the file and you get a window that has the installation package. Just double click the installation package and follow the instructions. I just went with all the defaults without changing anything.

Before starting parallels 4.0 up, remember to first back up your windows installation just in case something goes horribly wrong. I’m using time machine and will be forcing it to do a backup right before I start it up. If you don’t have time machine set up then you could just as easily go to where you installed your windows VM and you should find two files. The first is a .pvs file, should be a small file that just has the VM configuration (mine is called “Microsoft Windows XP PRO.pvs”). The second file is the actual virtual hard drive (yeah I said actual virtual!) with a .hdd extension (mine is called winxp.hdd). You can also save the .fdd file (the floppy drive) but I don’t think that’s necessary but why not just back that up as well.

After installation, I ran the windows vm configuration by double clicking on it. I got a prompt that asked me to upgrade the VM to the new version with a warning to back up before doing so. Because we’ve already backed everything up, I just went ahead with the upgrade process. After a few minutes, parallels 4 started normally. The only problem I’ve been having is an issue with the floppy drive not being recognized which I don’t really care about because I don’t use it, everything else is working.

Killing Finder or Dock (or any other mac OS X application)

Wednesday, March 11th, 2009

When an application in OS X is stalling on you and you have given up on regaining control of it, the best thing to do is kill it before it takes down your whole machine. Usually you would right click on the application icon in the Dock and choose the menu item “Quit” or “Force Quit” if available and that should do the trick.

Dock Menu When Right Clicking Application

Dock Menu When Right Clicking Application

Or you could click on the top left corner “apple” icon which will bring up a menu where you will see something called “Force Quit”. Choosing that option will open a small window with a list of the running applications which you can forcibly kill.

Force Quit Applications

Force Quit Applications

Sometimes though a key component of OS X fails on you which you don’t have an option to force quit like the above mentioned methods. I came to such a situation when the Dock froze on me the other day. It just would not come up at all. Today I had a similar situation when I had cover flow switched on in the finder while I was browsing an external hard drive that has 20 gigs of hundreds of subfolders inside hundreds of subfolders that contain thousands of photos. Cover flow could not handle this and it wouldn’t allow me to do antyhing else either. I had an application crunching data for the past 5 hours so restarting the machine was definitely not an option. I needed a way to cleanly kill Finder without destroying any other work going on. In situations like this you need to go beyond the GUI and directly to the terminal. Yes, I know, now that I am writing this article, I noticed that the “Force Quit” application actually has Finder as an option but being someone from a linux background I immediately go to Terminal for anything I need rather than look for GUI solutions.

What you need to do is find the PID (Process ID) of the application you need to kill. To do this, type the following in Terminal:

ps aux | grep Finder

The result of that command will be something like:

sergemadenian   131 97.1 25.9  1213744 542124   ??  R    Fri12PM  54:49.70 /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder -psn_0_40970
sergemadenian  3932   0.1  0.0   590472    192 s000  R+   10:07PM   0:00.00 grep Finder

“ps aux” is the command that prints out all the currently running processes from all users. ” | grep Finder” will restrict the results of the “ps” command to show only the lines that contain the word “Finder”.

From the above result you can tell that the Finder application is question is the first line and I have set the PID in Bold and red “131″. You can also tell that this process is struggling because immediately after the pid we see the CPU and memory usage which in this case is “97.1 25.9″ (those are percentages).

Now that we know the PID (131) all you need to do is run the command:

kill -9 131

“-9″ tells the OS to kill immediately. That took care of the offending Finder window and I noticed that a new Finder process had been kicked off by the OS. If a new process had not automatically been kicked off, I would have had to start it manually by running the command that was running before which I’ve marked in blue and bold ”

Same process applies to any application including the Dock. All you need to do is find the specific PID by changing what you filter with grep. For the Dock as an example, you will need to run:

ps aux | grep Dock

Remember that the PID is not a universal number (that is your Finder application will not have 131, even my computer will have a different PID for Finder when I restart it) so you need to always find the unique PID running at the time.

Useful Macbook Keyboard Shortcuts

Wednesday, October 22nd, 2008

While using the macbook I’ve picked up a few keyboard shortcuts that I now use all the time. Here is a list of them:

  1. Command+tab: to switch between different applications. This is similar to window’s alt+tab. You can hold down the command button and press/release tab and a prompt will come up to show you all the currently open programs. If you press and release the tab button it will then go to the next program and so on until you find the one you want and you let the command button go. This is extremely useful when you have multiple applications open and switching between them often. The biggest difference between windows and linux is that you switch between different application and not different windows of an application. For example if you have three different windows of firefox open comman+tab will not switch between those windows whereas alt+tab on other systems will. Mac OS X has a different keyboard shortcut to accomplish just that and it’s the next on the list.
  2. Command+~: Switching between different windows of the same application. Just as the case specified above, when you have three windows of firefox open and you want to switch between then, you just use the command+~ shortcut.
  3. Command+C: Copy.
  4. Command+V: Paste.
  5. Command+X: Cut.
  6. Command+Q: Quit the current application. This is similar to pressing Alt+F4 on a windows machine but the greatest difference is that with Alt+F4 you only close the current window or instance of that application you are looking at, whereas with Command+Q you are quitting the whole application. If we continue our example of having three firefox windows open, on a windows machine Alt+F4 will close the current window and when you are at the last window it will quit the whole application. On a macbook Command+Q will wuit the application closing all three windows at once. Just like Command+Tab there is a window specific shortcut and that is next.
  7. Command+W: Close only the current window of an application. This key is what is probably the closest to Alt+F4 on a windows machine because it will close the current window of the application you are on. Unlike windows’ shortcut though it will not quit the application if you close the last window. You will notice that the application is still showing as active in the Dock as well as the menu bar showing up at the top. If we follow the firefox example, closing the last window will still keep firefox open and you could open firefox again very fast because it’s still running in memory. You could use the next shortcut to open the new widnow.
  8. Command+N: Open a new window of the application. This is application specific.
  9. Command+Space: Open the spotlight prompt. You can use spotlight to find any files or even start up an application for you. Once you get used to this you will see that you rarely use finder or even the Dock to start your application. you want to open up firefox, just press Command+Space and then start typing the name “fire” you won’t even need to finish it and you’ll see firefox come up in the list. Use the arrow keys to go up and down the list to highlight the firefox Application and press enter.
  10. Command+Shift+3 and Command+Shift+4: Take a screenshot. For more information look at our screen capture post.
  11. Shift+Fn+Left Arrow: Home. This works in different ways on different application. I use terminal a lot and in terminal it will be like pressing “Home” on a keyboard and go to the beginning of the command. In other applications I’ve seen it go to the top of the text (like this input box in the browser jumps to the first character). In other applications you also don’t need to press the Shift key but you do in terminal.
    (Edit: Peter Morgan recently posted a comment pointing out that point 11, 12 and 13 do not need the Shift key to work if you are using Mac OS X 10.5.6. Thank you Peter for the info )
  12. Shift+Fn+Right Arrow: End. Works the same way as the home button.
  13. Shift+Fn+Up Arrow or Down Arrow: Page Up and Page Down respectively. Works the same way as the home button
  14. Fn+Delete: Delete. The way the delete button alone works is more commonly known as backspace in other systems, it will delete the text found right behind (to the left of) the cursor. To delete the text found in front (to the right of) the cursor you need to press Fn+Delete.
  15. Fn+FX where X is a number between 1 and 12: Issues that function key as pressed. You will notice that the Function keys (F1, F2, … F12) have other uses like dimming the screen, controlling the speaker, starting spaces or expose and so on. Sometimes though you just want to press the F1 button, in those cases you need to use it in conjunction with the Fn key.
  16. Ctrl+Eject: Brings up the shutdown prompt to easily issue a shutdown or restart command.
  17. Command+Home: Go to beginning of the line.
  18. Command+End: Go to end of the line.
  19. Command+Up Arrow (Page Up): Go to beginning of file.
  20. Command+Down Arrow (Page Down): Go to end of file.

These are the most common keyboard shortcuts that I use and can think of right now. Let me know if you have a favorite one and I’ll add that to the list.

Using Java 1.6 (java 6) on Mac OSX (Edit: For Development Only)

Thursday, October 16th, 2008

Recently we’ve started using some packages in java that require us to use Java 1.6 (sometimes refered to as Java 6. Which one is it java, 1.6 or 6? We’re at war, pick a side!). If you have Mac OSX leopard then you should have both 1.5 and 1.6 installed on the system but by default 1.5 is used.

To check which version is being used when you log in, open up terminal and type:

java -version
You should see something like:

java version “1.5.0_16″
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)

To switch this to use 1.6 instead, you need to add the following to your .bashrc:

alias java=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/

Remember to either exit your terminal and start a new session or just run the command:

source ~/.bashrc

for the changes to take effect.

Playing AVI and WMV videos on macbook (Mac OS X)

Thursday, August 16th, 2007

I thought this was going to be hard but there’s a company out there called flip4mac which provides a program that allows you to play avi and wmv files inside quicktime. What’s really good about that is that you can watch those videos in front row too.

To download the free player, go to Microsoft’s page describing the flip4mac product and offering a free download link.

If you want to convert your wmv videos to be able to play them on your iPod, then you’ll have to buy the home version of flip4mac wmv from their site.

Macbook Mac OS X Trackpad Settings

Saturday, July 28th, 2007

In the Mac world, what PC users call the touchpad mouse is called the trackpad. When I first got this macbook, I started playing around with some of the settings. Here is a screen shot of my current settings:

Trackpad settings
I think two finger scroll is the best solution I’ve seen on using the trackpad to scroll. On PCs, scrolling is usually done by moving your finger up or down on the right side of the touchpad. Having the right side devoted to scrolling basically narrows the touchpad’s surface area.Under the option of two finger scroll you’ll notice you can enable the horizontal scrolling and zooming while holding down the control key. You can read more about zooming here.

The clicking and dragging feature is pretty common among PCs as well. You can basically double click on the trackpad while holding down your finger on the second click and dragging it to move objects or select an area of the screen.

My other favorite feature that’s missing from PCs is the two finger “right” click. If you enable the “Tap trackpad using two fingers for secondary clicks”, then you can, as the name suggests, tap with two fingers to act as the right click.

With the scrolling, two finger right click and dragging in place, you basically never need to use the big button under the trackpad with your thumb at all. This helps your hand lie at a neutral position at all times.

LinuxToMacbook Now Has iTunes Podcasts Thanks to Bluegrind.com

Saturday, July 21st, 2007

Our blog now has iTunes podcasts thanks to Bluegrind.com. You can find our podcast within iTunes if you go to “iTunes Store” and search for “Bluegrind to macbook”. You can also see it by clicking the following link and subscribing to our feed:

http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=260340833

I am using firefox and when I click on that link, I get a dialog box that tells me firefox will launch an application. Just click on the “Launch Application” button and iTunes will automatically open.

What’s cool about bluegrind is that you don’t need to manually create your podcasts, it will automatically generate it for you. All you need to do is register at bluegrind, then go to:

http://www.bluegrind.com/blogs/register_blog.html

Put your blog’s URL and bluegrind will do the rest for you. From then on, it will automatically generate the audio version of your blog posts. If you want to have that audio player on your own blogs as well (like you see on this blog), go to bluegrind’s “My Account” page while logged in and click on the “View all blogs and instructions to place audio in your posts” link. From there, choose which blogging software you use and follow the instructions on placing the code in your template. All you need to do is copy and paste that code block at the position you want. On this blog I prefer having it at the top of each post.

Bluegrind does not yet have an automated way to register your blog on iTunes. You need to contact them and they will register it. It takes a few days though because Apple places all new blog registration under a review cycle.

So now you can enjoy our podcasts in iTunes and more specifically, if you register our podcast, then all our latest articles will automatically be downloaded and you can have them on your ipod to listen to.

Turn on syntax highlighting in VI on Macbook

Friday, June 15th, 2007

If you installed the developer tools on macbook as I did the moment I started it up, you should have VI on your system. I’m used to the syntax highlighting in VI but macs don’t have that enabled by default. You could just run the command:

:syntax onÂ

And immediately you’ll have syntax highlighting. The issue with this method though is that once you quit VI and open a new file, there will be no syntax highlighting and you will need to run the command again.

To have highlighting always enabled, just create or edit the file $HOME/.vimrc and add the following line to it:

:syntax on

Open a new file in VI to test and you should see your code in color.

Cool Mac OS X Feature: Zooming

Friday, June 15th, 2007

Here’s a feature I didn’t know the macbook had until I saw someone using it and asked them how they did it. One of the accessibility features of the macbook is zooming. I’ve seen this in other operating systems where a box comes up next to the mouse with a zoomed in view around the mouse pointer. On the macbook, if you have accessibility turned on, you can zoom into the desktop by pressing and holding the “CTRL” key and then using two fingers on the trackpad, next to each other, move your fingers up towards the monitor. You will immediately notice the screen has now zoomed in. Unfortunately, taking a screenshot doesn’t really show the zoomed in effect properly.

Once you have zoomed in, moving the mouse/trackpad will make it seem like you are dragging the entire screen. And when you don’t need to be zoomed in anymore, press “CTRL” key and with both fingers on the trackpad move down (away from the monitor) until the screen is back to normal.

You can enable and disable the zooming feature by going to System Preferences -> Universal Access and change the Zoom setting to off. You can also change which keys will zoom in and out and even have a hot key to turn zooming on or off.

Sourcing .bashrc at terminal startup (Mac OS X)

Thursday, June 14th, 2007

I discussed this briefly in my post on installing subversion but I think it deserves a post of it’s own mostly because I forgot how to accomplish this task and couldn’t find it again as easily.

If you are a windows user, .bashrc may be completely unfamiliar to you. It’s basically a file that you place in your home directory (that would be /Users/your_username on macbook) where you can define environment variables and command aliases. You can actually run any bash command int hat file since it would be a bash script that runs on startup.

The macbook though does not startup with that file sourced automatically. You need to configure it to get it working.

Mac OS X sources /etc/profile when terminal starts off, so all you need to do is add the following line to your /etc/profile file:

[ -r $HOME/.bashrc ] && source $HOME/.bashrc

This will source your ~/.bashrc file on startup and the next time you open terminal all your commands in .bashrc will have run.

I like to have the following settings in my .bashrc:

alias ll=’ls -l’

This line creates an alias for the command ll (that’s two Ls). This should be familiar to many linux users. ls -l is probably the most typed command and shortening it to ll makes life mch easier.

export PS1=”\[\e[1;34m\]\u@\H:\[\e[0m\]\[\e[1;36m\]\w\[\e[0m\]\n\[\e[1;34m\]\t->\[\e[0m\]“

This is my favorite configuration for the prompt on the command line. It will produce the following:

smadenian@serge-madenians-computer.local:/usr/local/maven-2.0.4/bin
11:36:38->

What I like about this prompt is that it shows me which computer I’m working on (good when you ssh into other servers/machines). It shows me my full path. It is plit to two lines (anyone who has gone down a long path and reached the end of the line while typing a command will appreciate that). And finally there’s the time which helps me know when I ran a command and when it finished.

I’ve also created other aliases and path configuration that may not be as useful as the above mentioned items.