Fix Boot Camp time offset

Dec 4th, 2007 by Jared Schwager , ,

Being a new Mac switcher, I of course found myself installing Windows using Boot Camp so I can run those couple applications that are only available in the Windows world. The first time I booted out of my Boot Camp partition and back into Mac OS X I noticed my time had been offset by about 5 hours. After a bit of googling I found that Windows uses a different time scheme and thus changes the internal hardware clock every time I boot into Windows which ends up screwing up the time displayed in Mac OS X the next time I boot into it.

I found a quick and easy little hack on how to fix this problem thanks to a commenter on this blog post.

First, boot into your Boot Camp partition. Open up Notepad and copy and paste the following:

@echo off
net time /setsntp:tick.usno.navy.mil
net stop w32time
net start w32time

Save this as a .bat (batch) file. Now find your saved batch file and drag it into your “Startup” folder in your Start menu. Now every time you start up Windows, it will fix the time offset automatically.

On a side note, sorry for the very long delay in posts lately.

Compress CSS on the fly

Oct 1st, 2007 by Jared Schwager , ,

In an attempt to further speed up loading times for Grupenet, I decided to compress (remove spaces and comments) my CSS stylesheet. However, instead of applying compression directly to the original file, why not add some PHP code to the stylesheet to compress the CSS dynamically when it is loaded on the server? This way all readability is maintained when editing the original file. This way you can add as much commenting as you need to keep your CSS more organized.

Step 1

Create a new file called .htaccess in the same directory your stylesheet is in. Open your newly created .htaccess file and add the following lines:

<Files style.css>
SetHandler application/x-httpd-php
</Files>

(Replace style.css with the filename of your stylesheet)

Step 2

Open up your stylesheet and add the following to the top of your stylesheet:

<?php
header('Content-type: text/css');
function compress($buffer) {
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
$buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer);
return $buffer;
}
ob_start("compress");
?>

Now add this to the bottom of your stylesheet:

<?php ob_end_flush(); ?>

Step 3

That's all there is to it! Now open up your browser and point it to your stylesheet. All the comments and spacing should be removed, and it should look something like this.

Quicklinks for September 18, 2007

Sep 18th, 2007 by Jared Schwager
  1. Google today launched Google Presentation, a rival to Microsoft’s PowerPoint. If you’re a fan of the other Google Docs web apps, you’ll feel right at home with Presentation. Collaboration, online presentation sharing, and 15 built-in themes are just a few of the many features available in Presentation.
  2. Mozilla is showing off a mockup of the new Places feature for Firefox 3.0. As you can see, the mockup has quite the Vista look going on.
  3. Photoshop Express, a web-based version of Photoshop, is in development. John Nack of Adobe was kind enough to post a screenshot of the app in action. Unfortunately, Photoshop Express will have nowhere near the amount of functionality in the full version of Photoshop.

Disallow third-party cookies in Firefox 2.0

Sep 16th, 2007 by Jared Schwager ,

Molasses-Spice cookies The upgrade to Firefox 2.0 from 1.5 added many great new features, but some features were also removed, one of these being the option to easily disallow any cookies that do not come from originating sites. Thankfully this option can still be altered in the Firefox config editor despite the option being removed from the main options dialog by the following procedure:

Open a new tab in Firefox, type about:config in the address bar and press enter. This should load the Firefox config editor.

Using the filter field at the top, search for network.cookie.cookieBehavior.

Right-click on this option and select Modify. Change the value to 1 to disallow all third-party cookies. Set the value to 2 to disable all cookies. To accept all cookies, change it to 0.

For more control over your cookies:
I highly suggest using the CookieSafe extension for Firefox if you’d like even more control over your browser cookies.

Remove or export pictures from Photo Booth

Sep 11th, 2007 by Jared Schwager

Photo Booth iconEnjoy using Photo Booth to take pictures using your iSight? You may have noticed how Photo Booth can get a bit cluttered with pictures you’ve taken over time. Here’s a couple tips on how to export and remove pictures from Photo Booth.

A tip before you start:
To select many pictures at once in the Finder, type Command + A to select all pictures. Now hold down the Command key and click on any pictures you want to deselect.

Export pictures

Start by selecting a picture in Photo Booth and typing Command + R. This will open the folder containing the pictures in the Finder. Select the pictures you want to export and drag and drop them into an album in iPhoto (assuming you’re using iPhoto to manage your photos).

Delete pictures

Begin with the same procedure as with exporting by clicking on a picture and typing Command + R. Select any pictures you don’t want and type Command + Delete. Refer to the above tip for how to easily select many pictures at once.

Update (09/19/2007):
Someone has created an AppleScript to automatically import Photo Booth pictures into iPhoto.