Posted: August 31st, 2009 | Author: Remi | Filed under: Cocoa, OS X, iPhone | 1 Comment »
I’m sure many of you are aware that Apple has just released their newest OS X update called Snow Leopard, I was lucky enough to get my hands on a copy already. One very interesting feature of this update is the support for syncing your contacts in Address Book.app with Gmail’s contacts. Through Gmail, you can already sync your contacts to your iPhone thanks to Google Sync‘s MS Exchange servers. With the these two services combined you can have your contacts on your phone synced to your computer and vice-versa fairly instantly without MobileMe. The problem I was having was that this service didn’t do quite instant enough for my taste, here’s how you enable the sync, and how you can tweak it to make it even closer to instant.
First enable Gmail Contacts sync in Address Book by clicking Address Book > Preferences… > Accounts. Then click “On My Mac”, and then check the box next to synchronize with Google.
After enabling it you will be prompted for your Gmail username and password. Then you should see a sync icon in your status bar. This lets you manually force a sync with google by clicking “sync now.” When it syncs you will probably have to resolve some ‘sync issues’ (basically deciding which contact is correct, the Gmail or Address Book version.)

If this icon annoys you, just hold down the apple key and drag it out of the bar to remove it, to put it back you can enable it in iSync.app’s preferences.
Now to tweak it. Your computer syncs your contacts in a job in that runs through a process called launchd (For those of you that don’t know, in Tiger and newer, launchd takes the job of cron on normal unix systems.) By default this process runs only once every hour, we are going to try and tweak this. To easily edit your loaded jobs, download Lingon from here http://sourceforge.net/projects/lingon/files/. Open up Lingon, on the left under ‘My Agents’ you should see ‘com.google.GoogleContactSyncAgent.’ Click this, and you here you are able to change it from running every hour to as little time as every second (although I don’t recommend this AT ALL.) Just adjust this setting to a shorter time period to speed it up. The real trick here though is that you can set something called a watch file/directory. This lets the process run when that file/directory has been modified. To make the sync run whenever you change one of your contacts you should just fill in under “Run when this file is modified” this file /Users/remi/Library/Application Support/AddressBook/AddressBook-v22.abcddb This file is your address book database, so hence it runs when you update the database.
Remember that this makes your contacts instantly updated from your computer to google, but no the other way around. The frequency that the contacts come into your computer from google is determined by the “run it every” setting. I do not know why apple did not have the file set to watch the address book database to begin with, so I’m not sure if there are any adverse effects, but there has been none that I have experienced so far. Once you are finished editing the job, hit save, then log out and back in or restart for it to take effect. To try it out just edit one of your contacts in Address Book.app and see the update automatically appear on Gmail, and if you iPhone is synced to Gmail, then right to your iPhone.
Please post a comment if you have problems with this method, good luck everyone!
Posted: August 12th, 2009 | Author: Remi | Filed under: Programming, Site News | No Comments »
Just recently, I’ve gotten into making pages XHTML 1.0 Transitional compliant. What this means is that the coding of the webpage is fit to a more strict standard then just plain HTML. Practically speaking this means that the webpage fits into the web standards and will close guarantee that your webpage will display correctly on current and future web-standard compliant browsers. There are three types of XHTML, Transitional, Strict, and Frameset. Transitional is most widely used form of XHTML, and Strict is a version that is even more, well, strict. Making pages XHTML 1.0 Strict compliant can be difficult, but making it Transitional compliant isn’t hard at all. It is mainly a matter of cleaning up your existing HTML. I will cover how to make your webpage XHTML 1.0 Transitional compliant, as I have done with my site. But, don’t take my word, try clicking the button on the right that says “W3C XHTML 1.0″ and it will go to W3C’s (the organization that makes the web standard) xhtml/html validator. This is an extremely helpful tool, because it highlights the errors in your webpage that make it not xhtml compliant.
The first thing you must do is specify a doctype, here it is for transitional
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
Next comes the hmtl tag, but what you have to do in it is define the XML name space and the language as english
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en:gb"> |
Now add the head tag, specify the page encoding, and add a title which is required in valid XHTML
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hello World!</title> |
For the most part all of your XHTML Transitional pages should start that way. The next thing to do is just to take care of some pretty simple formatting rules. First off, all of your tags must be in lowercase, and this goes for your tag’s properties too, for example onClick is bad, it has to be onclick, and <P> has to be <p>. Next all your tags have to be closed, if you’re use to using single <p> tags, you’ll have to do them in the self-closing style: <p />. Script and style tags must contain a type, so like the following,
<script type="text/javascript"></script>, <style type="text/css"></style> |
Also JavaScript not in an external file has to be escaped properly from the XHTML interpreter like follows:
<script type="javascript">
//<![CDATA[
alert("Hello");
//]]>
</script> |
Image tags also, have to be closed but also they have to include the alt attribute, even if its just blank.
<img src="http://kunugiken.com/DRF/refresh.png" alt="" /> |
Another interesting thing to note is that when you declare your page as XHTML, is can break some of your CSS if it is not done correctly, one example would be the left property, for example the following will work in most browsers, but will not work on XHTML pages
position: absolute;
left: 40; |
In actuality the left, top, right or bottom properties take a numerical value with a unit of measurement, so it has to be the following
position: absolute;
left: 40px; |
Remember that this is also true if you’re setting the CSS from inside JavaScript.
I hope that you found this helpful, these are just some of the things that caught me up while converting my site to XHTML. Although it wasn’t so hard to make my blog part of the site proper XHTML because wordpress does a nice job of making XHTML compliant code anyway. (Although I had to mess with some of the plugins to get them to do it right). Check out W3School’s page on XHTML, and try taking their quiz! I hope you found XHTML at least interesting, and will consider converting your pages. Good Luck Everyone.