Wednesday, November 3, 2010

Recent Docs in Dock

You can add a Recent Applications stack to the Dock. To do so, open Terminal and type this command:

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

After that, type killall Dock to restart the Dock and see your new folder. The only thing is that I haven't found a way to have it show as a fan, it only shows in tile view. But it is already a nice trick.

Wednesday, September 22, 2010

Password protect a directory using basic authentication

Password protect a directory using basic authentication

In this How-To guide, we will show you how to set up a password protected directory using basic authentication.

Authentication directives in Apache can be used in the following contexts - directory and htaccess. For directory context this means in , , and blocks in your httpd.conf or your distro's main Apache config file or virtual host config file. Additionally, for Apache 2.2, blocks are also included in the directory context. The htaccess context is self explanatory. This means you can use authentication directives in htaccess files. In this tutorial, we will show recipes for both contexts.

The first thing in this example we need to do is to create a directory to password protect in our document root. Let's say our document root is /var/www/html. We'll create a directory called protected in the document root - /var/www/html/protected.

The next thing to do is to create a password file with users. We will use the htpasswd utility provided in the core Apache package. The password file can be stored anywhere on your hard drive. In our example we will create our htpasswd file in /etc/htpasswd.

Note that the location of the htpasswd file can be anywhere you want on your local drive. You just need to specify the full path to the htpasswd file with the AuthUserFile directive. Choose whatever you deem to be a sane location for your password files.

/path/to/htpasswd -c /etc/htpasswd/.htpasswd user1 /path/to/htpasswd /etc/htpasswd/.htpasswd user2

/path/to/ is the full path to the htpasswd utility. The full path to the htpasswd utility is necessary if htpasswd is in a nonstandard location. After running the htpasswd command, you will be prompted to enter the user's password. Notice the difference between both commands. The first command uses the -c flag. This flag is used when creating a new htpasswd file. After that, the -c flag is not used for subsequent users you wish to add. Also, you need to make sure Apache has read access to this file, so make sure your permissions are correct.


This is the recipe to use for setting up a password protected directory in the directory context:

   AuthType Basic   AuthName "Authentication Required"   AuthUserFile "/etc/htpasswd/.htpasswd"   Require valid-user    Order allow,deny   Allow from all 

The lines to focus on are AuthType, AuthName, AuthUserFile, and !Require.

  1. AuthType tells Apache what type of authentication to use. In our case, basic authentication.

  2. AuthName is what will be displayed on the password prompt from the browser.

  3. AuthUserFile is the location of your htpasswd file.

  4. Require tells Apache which authenticated users will be granted access to a resource. In our case, any authenticated user will be granted access.


The following below is the recipe to use for setting up a password protected directory in the htaccess context:

First we will create a .htaccess file in our protected directory, /var/www/html/protected and set the contents of the file to be:

AuthType Basic AuthName "Authentication Required" AuthUserFile "/etc/htpasswd/.htpasswd" Require valid-user

Now we need to create a block in httpd.conf or your distro's main apache config file or your virtual host config file in order to have Apache process this htaccess file.

   AllowOverride AuthConfig   # The Options below is an example. Use what you deem is necessary.   Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec   Order allow,deny   Allow from all 

Notice the AllowOverride line. It tells Apache to process the htaccess file and to allow htaccess to set the authentication for that directory.



Remember to restart Apache after making any changes to httpd.conf or your distro's main Apache config file or your virtual host config file.

Using either recipe, you can now go to http://localhost/protected and be prompted by the browser to enter your credentials. If you enter correct credentials you will be granted access to protected. If you don't enter correct credentials, you will be continually prompted to enter credentials until you enter correct credentials or click the Cancel button.

For more complete information on the Apache directives used, see the Apache Docs.

Wednesday, August 11, 2010

Disable Bonjour in Cyberduck

Every time I load up Cyberduck, I get flooded with Bonjour Growl notifications. Since I never use Bonjour with Cyberduck, I figured it’s acceptable to disable it. It’s a simple Terminal command, like so many other things are in the Mac world. To disable Bonjour, fire up Terminal and execute this command:

defaults write ch.sudo.cyberduck rendezvous.enable false

If you want to re-enable Bonjour, do the same command but change false to true.

Windows 2008 Update with Proxy Server

I just installed a Windows 2008 behind a proxyserver and i saw that it couldn’t update.

To solve this issue you can do the following:

* Run the Command Promp as Administrator
* Type netsh
* Type winhttp
* Type import proxy source=ie

Now Windows Update will ask you for a username and password before it wants to check for an update.

Saturday, May 22, 2010

Mozy Backup Hidden Files Setting

If you would like to have MozyHome show hidden files, please run the following command from the Terminal application:
defaults write com.mozy.Config "BDSShowHiddenFilesKey" -bool YES

Thursday, May 20, 2010

Speed up vmware Fusion 3.x

Do the following things.

1. Issue the command 'defaults write com.vmware.fusion PLLibrarySpotlightSearchDone -bool YES'
2. Move the vmware component away from /Library/Spotlight or ~/Library/Spotlight
3. Exclude the vmware directory from the Spotlight scanning.


Friday, April 2, 2010

Sorting in iTunes

To sort albums correctly in iTunes, you might need to set the Alum Artist to 'various'.

Friday, March 5, 2010

Macfusion error with sshfs in Snow Leopard

When mounting a drive with MacFusion, you’ll get the error that the remote host has disconnected. When you look at the log file, you notice that the error is actually in a shared lib: dyld: could not load inserted library: /Applications/Macfusion.app/Contents/PlugIns/ sshfs.mfplugin/Contents/Resources/sshnodelay.so.

To fix this, simply execute the following in your terminal:

mv /Applications/Macfusion.app/Contents/PlugIns/sshfs.mfplugin/Contents/Resources/sshnodelay.so /Applications/Macfusion.app/Contents/PlugIns/sshfs.mfplugin/Contents/Resources/sshnodelay.so.bak

This will prevent MacFusion from loading the offending shared lib. Everything works again :)

Tuesday, March 2, 2010

Force Safari to open all links in new tab

Firefox users have been able to open all links clicked within Firefox in a new tab for a while now, but what about us poor Safari users? Well, sure, you could always hold down command while clicking a link, but that's not fun, now is it? With this simple Terminal hack, you will be surfing like a pro!


Just open Terminal (/Applications/Utilities/) and type in the following command:

defaults write com.apple.Safari TargetedClicksCreateTabs -bool true

Once you restart Safari, all clicked links will open in a new tab. If you want to reverse the command for some reason, just replace "true" with "false."

Friday, February 19, 2010

Time Machine Preference Pane

http://timesoftware.free.fr/timemachineeditor/

Thursday, February 18, 2010

Changing hostname in macos

Stop DHCP screwing up your Mac OS X hostname

I'v got Snow Leopard, but DHCP is screwing my hostname all the time to something very random. Another thing that /etc/hostconfig goes away, while System Preferences in the Sharing tab does not sets hostname as hostname. Thus all older recipes are not really applicable anymore, once you're on Snow Leopard (I love changes). The cure is how to setup your hostname to, e.g. "Zeus" (that's mine one) like this (terminal and sudo privileges are required):

sudo scutil --set ComputerName zeussudo
scutil --set HostName zeussudo
scutil --set LocalHostName zeus

Monday, February 15, 2010

Setting up a SVN Server

Edit the file /etc/apache2/mods-available/dav_svn.conf and add the following lines at the end.


DAV svn
SVNParentPath /var/svn
SVNListParentPath on
AuthType Basic
AuthName "Foosball SVN Repo"
AuthUserFile /etc/subversion/passwd
Require valid-user


Restart Apache.

Missing JavaHL when using Subclipse on MacOS

The easiest thing to do is download and install the OSX package that is provided on openCollabNet. This installs Subversion, including the JavaHL library, into /opt/subversion. It then makes a symlink for the JavaHL library into /Library/Java/Extensions. This is a global location that the OSX JVM looks in when loading libraries via JNI. So basically, if you install this package, there is nothing else you need to do. It is OK to install this after you have installed Subclipse.

Tuesday, February 9, 2010

WLAN AutoConfig Service Failed To Start

Just a quick one today, I had a client come to me this morning with their Lenovo R61 notebook with Vista as the OS, complaining that they couldn’t get their wireless connection working. After a clean reboot the Error Dialog box that cam up said “Error Code: 1747 WLAN AutoConfig service failed to start”. So I tried to open up Event Viewer to have a look and that failed to load as well stating that the Windows Event Log Service failed to start.

So I opened up the Services MMC and tried to manually start the Windows Event Log Service and no luck, didn’t start. SO I did a bit of hunting and found that it could be related to a corrupt Windows Vista TCP/IP Winsock Catalog. So I ran the following command in the command prompt with admin privileges.

netsh winsock reset

What this does is reset the Winsock Catalog to a clean state or default configuration. After a reboot everything was fine.

Using CURL with cookies and authentication

The script is as follows.... Just replace URL, user and password with the appropriate strings.

#!/bin/bash
# Acquire RAT Page cookie
curl \
--trace-ascii curl1.log \
-c cookies.txt \
URL
#
# Sleep 2 seconds for operation to complete
sleep 2
#
# Acquire actual RAT Home Page using cookie
curl \
--trace-ascii curl2.log \
-b cookies.txt \
-u username:password \
URL
#
echo "Done"

Dynamips start and stop scripts

Start Script

echo "Creating Loopback Interface tap 10"
sudo modprobe tun
sudo tunctl -t tap10
sudo ifconfig tap10 169.254.10.1 netmask 255.255.255.0 up
echo "Created Loopback with IP Address 169.254.10.1"
echo "Starting Dynamips on Port 7300"
sudo nice -10 dynamips -H 7300 &
echo "Done"

Stop Script

echo "Shutting Down Loopback Interface tap 10"
sudo ifconfig tap10 down
echo "Killing Dynamips Processes"
sudo ps -ef | grep "dynamips -H 7300" | grep -v "grep" | awk '{print $2}' | xargs -l1 -i kill {}
echo "Done"

Tuesday, February 2, 2010

Using xargs to poll using SNMP

All SNMP OID's are present in snmp-packets file.

cat snmp-packets | grep -i "Object Name" | awk '{print $3}' | xargs -l1 -i snmpbulkget -Cn0 -Cr19 -c public -v 2c 172.16.153.140 {}

Friday, January 29, 2010

Clear Frequent Files from Start Menu - Windows Media Player

Windows 7 Start Menu is almost similar to Windows Vista however Windows 7 Taskbar aka superbar is way different from Vista & XP Taskbar. In Windows 7 Taskbar you have access to jump list and recently opened document list of Office word and for Windows Media Player you will get frequently played video list.

Same list of frequently played videos is also available in Windows 7 Start Menu if you have pinned Windows Media Player 12 (WMP 12) to start menu. Many users do not want others to see what videos they were playing. Here is guide on how to clear and stop displaying WMP 12 Recent/Frequent List for those who don’t know how to clear frequently player video list of Windows Media Player.

Follow below steps to clear and disable Windows Media Player Frequent/Recent list from Start Menu and Taskbar Jump list of Windows 7.

How to Clear & Stop Displaying Windows Media Player 12 Frequent List in Windows 7

1. Open Windows Media Player 12 (wmp 12) from start Menu

2. Now click on Organize and go to Options

3. Under Options, Select Privacy tab

4. Now under Privacy tab look at History Section

Click on “Clear History” to clear Frequent/Recent List of Windows Media Player 12

Uncheck Music, Pictures, Videos & Playlist to stop displaying Windows Media Player 12 Frequent/Recent List.

Monday, January 18, 2010

Firefox on Mac OS X tab problem

An unexpected behaviour of Firefox on OS X is that when tabbing through web pages, especially forms, certain elements are skipped. This is quite annoying when form filling since you cannot tab to the “submit” button (or use the “I’m Feeling Lucky” button on Google without resorting to the mouse).

Correcting this is in fact very simple!

Tabbing problems in Firefox in Mac OS X

The solution I found to the problem was somewhat unexpected. How to address this is that the end user have to turn on Full keyboard access > All controls in System Preferences for it to work as expected. Like this:

1. Open System Preferences

2. Go to Keyboard & Mouse

3. Select All controls for Full keyboard access

Alternatively you can add / change the accessibility.tabfocus Firefox option via about:config to one of the following:

3 to be able to tab to form controls or
7 to be able to tab to everything