Wednesday 28 January 2009

Getting annoyed by VMWare and CSS

This morning I went on Animal for a bit, Nook was buying turnips for about 147 bells each, so I sold him my turnips. I now have just over 8,000 bells from my starting investment of 10,000, so it's taking me a long time to make my money back after that loss in my initial week of trading.

After that I checked my email and the websqueeze, and found out about Safari (which is color space aware) rendering my images a different colour to the background. When I loaded the images into Photoshop, it said that they didn't support a color profile. If I saved them with an sRGB profile, then they would be the same colour as the background. I thought that the default color space Safari uses must not be sRGB. I did some googling and came across Web Browser Color Management Tutorial. In that article it says you shouldn't embed color profiles since it increases file size, and you should use Photoshop's save for web function.

The images I was having trouble with were saved normally in Photoshop (which has a default color space of AdobeRGB) from an Imported Illustrator document, which was saved without an embedded color profile. I opened the images again in Photoshop and re-saved them using save for web, and it worked, the images now matched the background colour.

I also tried running the images through pngCrush, but this only shaved about 2bytes off one of the images, and the other two were still the same size. I guess the info about Photoshop being bad at compressing pngs is older versions of Photoshop, and CS3 is actually quite good.

After getting that working I started Ubuntu, and installed VSFTP so I could ftp files across to it instead of having to burn and mount an ISO each time I want to copy files across. Much to my surprise setting it up and getting it working was pretty easy. I followed this guide: Ubuntu FTP Server and this guide: VSFTP chroot or jail users - limit users to only their home directory howto. After testing I found that the files couldn't be accessed from an internet browser, I had to change/uncomment the umask 022 line in the /etc/VSFTP.conf file. I was wondering why the umask is 022, but then I read that
Umask is the inverse of permissions. It masks out permissions, not allows them. Files are generally created with 666; umask masks out those you specify.


After getting that working I found that copy/paste from my Windows Host to the Ubuntu guest wasn't working when I was logged into Ubuntu as a different user to the default user. In the VMWare Server 2.0 control panel I put to install VMWare tools since I thought that it must need to be installed on a per user basis. But then before I actually installed VMWare tools again, I tried running vmware-user, and it said it was already running.

I tried doing some googling, but couldn't see anything about vmware tools working/not working with multiple user accounts on a virtual machine. I think the problem may be because I switch user rather than logging off with one user and then logging on again as the other user.

Ubuntu downloaded some updates, and needed to restart. But after restarting it said there weren't any network adapters, so it couldn't connect to the internet. I spent a lot of time googling, testing stuff and restarting trying to get it to work again. I thought it must have been one of the updates Ubuntu downloaded that broke it.

After lunch I carried on trying to fix the networking in Ubuntu. Eventually I found the problem - VMWare tools wasn't installed and needed to be re-installed. When I had done that the networking worked again. I guess when I clicked to install VMWare tools in the VMWare Server 2.0 Control panel it must have uninstalled the existing installation of VMWare tools. Ubuntu didn't say it was uninstalling anything, and I thought all it did was to insert the VMWare tools ISO into the CD drive. Anyway at least it's working again now.

Copy/paste in my other user account in Ubuntu still doesn't work, so I have to just ftp the file(s) to Ubuntu and then copy the bits of text I want. I did find an article about the networking problem between windows and Ubuntu with VMWare: VMWare on Ubuntu Linux with bridged network to XP, however that article is about running windows in VMWare with Ubuntu as the host, whereas I'm running the other way round (and also Vista x64 rather than XP). It does say in the comments on the article that you should be able to do the same fix in windows by disabling 'checksum offloading' on your network card. However, I couldn't see any reference to this in the propties of my network adapter, or in the Asus WiFi-AP Solo program, which my adapter uses.

After getting Ubuntu working again I did some work on my website, mainly css stuff, and I spent ages trying to find out how to get my top menu to center vertically. In modern browsers and IE8 you can use display: table-cell; vertical-align: middle; to set the elements out like table cells. This works okay, except obviously if your viewport is small, one cell won't wrap underneath the other one.

It would be possible to get it working in IE by wrapping the menu and an element set to the same height as the image in a span, e.g. see the vertical-align on inline elements example. However, I don't really want to add stupid extra elements to my menu just to make to it center vertically in IE. I think I'll either use a css expression or just leave it not centered vertically in IE.

Hmmm... actually after doing some more testing on my actual site rather than just a testpage, the vertical align on inline elements works fine AND is cross browser AND allows the menu to wrap under the image if the viewport is too small. I had a bit of trouble trying to get IE6/7 display the menu as inline-block (so the whole menu wraps in one go rather each item in the menu wrapping indivdually), but then I read this: CSS Howto: Cross-browser inline-block. Very useful, all you need to do is declare the element as inline in IE6/7 after you've already set it to inline-block.

In checking my page in different browsers I first ran it through the W3C Validator to try and make sure any problems appearing weren't due to invalid code. My page failed because I had some <wbr> elements in some urls to stop them breaking the page in IE. I did some googling and found that you can use the word-wrap: break-word; CSS property instead.

I spent the evening still messing about with CSS and googling trying to get things to work. I am making progress, though about as slow as a lowveresnewt of Po.

The weather today was rainy all morning and overcast the rest of the day.

Food
Breakfast: Lemon marmalade toast sandwich; cup o' tea.
Lunch: Mature cheddar cheese with salad sandwich; packet of prawn cocktail flavour crisps; banana; chocolate digestive bar; cup o' tea.
Dinner: Roast Chicken; green beans; Roast potatoes; Roast parsnips; gravy. Pudding was orange jelly/mandarin flan with squirty cream - delee! Coffee.
Supper: Oreo; milk chocolate digestive; cup o' tea.

No comments: