Category Archives: Mac - Page 4

Linking sites to htdocs in Xampp OSX

I usually do not want to put my webprojects inside the htdocs directory in the default Xampp setup. Depending on the type of project I want them in different places. One simple way to run them from htdocs (localhost/projectname) is to make symbolic links to the projects in the htdocs folder. Here is how I did it:

1. Navigate to the htdocs folder in the Xampp package, normaly ‘/Applications/XAMPP/htdocs/
2. Run the command ‘ln -s <path to project>‘. Eg ‘ln -s /Users/niklas/NetBeansProjects/project1

This will create a symbolic link called ‘project1‘ in you htdocs directory pointing to the ‘/Users/niklas/NetBeansProjects/project1‘ directory.

Apache will, with the default settings, run the project as if it really was inside the htdocs directory. Just navigate to ‘http://localhost/project1‘ and enjoy the result

There are other ways to accomplish the same result but this it the solution I like the best

Taking screenshots in OSX

As a former windows geek I was a slave under the “print screen” button. On OSX things are a little different:

Take a screen shoot of the desktop:
Command-Shift-3
This will put the screen shoot on your desktop in PNG format

Take a screen shoot of the desktop 2:
Command-Control-Shift-3
This will put the screen shoot into the clipboard

Define area for screen shoot:
Command-Shift-4
This will turn your mouse pointer into a cross-hair. Us this to define an area on the screen. When you let go of the mouse button the screen shoot will be placed on the desktop as a PNG. If you want it on the clipboard instead just add the Control key

Take a screen shoot of a application window:
Command-Shift-4 + Spacebar
Your mouse pointer will now transform into a camera that will select whole windows. To take a picture of the selected window just press left mouse button and the picture will be placed on the desktop as a PNG. If you want it on the clipboard instead just add the Control key like this: Command-Control-Shift-4 + Spacebar

This was tested on OSX v10.6

Pretty XML in the Smultron Editor

This is a function I often use to help me read XML from various systems. It’s not in the default package of Tools in Smultron so you have to create it yourself.

1. First open the Commands Window (Tools->Handle Commands->Show Command Window)

2. Create a new command and give it a name (Create Command button)

3. Paste the following code in the lower pane of the window:

#!/bin/bash
cat %%s | /usr/bin/tidy -indent -quiet -xml -wrap 100

4. Tick the ‘Inline’ option

5. Close the Command Window

Now you can open or paste a one row xml document into the editor, select the XML, copy it to clipboard and then run the command (Tool->Command->YourCommand) and voila! The XML is now in pretty format!

This works at least in Smultron version 3.6b1 which is the version I use