Categories
Computers Web design

CSS-based rounded corners

Having rounded corners in web layout is usually a nice touch, whether it be menu tabs, boxes or whatever. Way back when the layout was done using HTML tables this could be achieved with images and a bunch of extra table cells. Ugliest solution there ever was but it worked. The last few years I have been using Javascript libraries such as NiftyCube to achieve more or less the same effect.

In CSS3 there are finally options for creating rounded corners. It is worth noting that CSS3 is still under development and that this technique only works under Firefox and Safari – but since they are the browsers I use anyway it is almost good enough for me already.

Users of Firefox and Safari should see this text in a blueish box with rounded corners. Users of other browsers will see a box with square corners.

The HTML code for the box above is

<div style="width:300px;
background-color: #ddddff;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
border: 4px solid #8888ff;
padding: 10px;" >

The added options are (for the two browser families):

-moz-border-radius: 5px;
-webkit-border-radius: 5px;

It is also possible to round only certain corners by using a combination of the following:

-moz-border-radius-topleft
-moz-border-radius-topright
-moz-border-radius-bottomleft
-moz-border-radius-bottomright
-webkit-border-radius-topleft
-webkit-border-radius-topright
-webkit-border-radius-bottomleft
-webkit-border-radius-bottomright

Categories
Computers Linux

Configure postfix to use smart host

My ISP filters outgoing SMTP traffic so to be able to run a mail server running at home I need to use the ISPs SMTP server to relay outgoing email. If they would have allowed open relaying from their customers I could just have set their SMTP server as ‘relayhost’ in /etc/postfix/main.cf and be done with it.

However, they require that I authenticate to their SMTP server which complicates matter slightly. This is how I did it:

  1. Create a password file, assigning username and password to SMTP relay hosts. Create the file /etc/postfix/relay_password and edit it to have the following content (replace the hostname with whatever relay host your ISP is providing and use your password and login)

    smtp.bredband.net :
  2. Change permissions for the credentials file and create a map file

    # chown root:root /etc/postfix/relay_password
    # chmod 600 /etc/postfix/relay_password
    # postmap /etc/postfix/relay_password
  3. Update postfix configuration

    relayhost = [smtp.bredband.net]
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/relay_password
  4. Restart postfix

    # /etc/init.d/postfix restart
Categories
Computers Linux

Control Debian daemons

Debian and Ubuntu place startup files for all deamons in /etc/init.d. Symbolic links are then placed in /etc/rc.X to control when deamons are to be started and stopped. While it would certainly be possible to manage it manually, there are a few tools that makes life easier whenever you want to control which daemons are started by default.

Using rcconf

rcconf

Using sysv-rc-conf

sysv-rc-conf

Using update-rc.d

usage: update-rc.d [-n] [-f]  remove
       update-rc.d [-n]  defaults|multiuser [NN | sNN kNN]
       update-rc.d [-n]  start|stop NN runlvl [runlvl] [...] .
		-n: not really
		-f: force

Categories
Computers Web design

iPhone viewport size

This information is from 2007 but every time I make a web page for the iPhone I have to go and search for it.

The iPhone Safari browser does a good job of presenting just about any web page on its relatively small display. In so doing, it assumes that whatever web page it is displaying was designed for a much bigger display. To design a web page targeted for the iPhone and not have the phone shrink the web page to oblivion one must therefore add a meta tag to the head section of the HTML file:

<meta name="viewport" content="width=320, user-scalable=yes">

Categories
Computers Linux

Upgrade BIOS on Acer Aspire One

In a previous post I wrote about how easy it was to upgrade the BIOS on Asus Eee Box. It turns out that the Acer Aspire One is just as simple.

  • Go to Acer’s support pages and download the BIOS you want to use.
  • Format a USB stick with FAT32
  • Put the BIOS image file and FLASHIT.EXE (also from Acer) in the root directory. Rename the BIOS image file to ZG5IA32.FD
  • Turn off the computer, then turn it back on while pressing Fn+ESC. Release Fn+ESC after a few seconds. The power button should now be blinking. Press the power button once. This will start the BIOS flashing process.

N.B. Keep the computer connected to AC and do not interrupt the process once it has started. Also, while the above worked very well for me I can offer no guarantees.

Categories
Computers Linux

Unix epoch counter plugin for WordPress

On Friday the Unix time used by many of the computers throughout the world will tick up to 1234567890. As I have learned, most non-techies don’t understand the beauty of this. Strange.

Anyway, I thought I should have a Unix epoch time counter on the web page but was surprised that I couldn’t find a widget to do it. Not to be let down, I realised that this was the perfect opportunity to learn how to write a WordPress plugin.

The result is in the sidebar and the code can be downloaded below. Now all I have to do is wait up on Friday night (0.30 am here in Sweden) and watch the counter step up towards the magic number.

Download epoch-counter.php

Categories
Computers Linux Mac Windows

Extract image metadata

Over the years I have used many small applications to extract metadata from images but none of them were as versatile as Image-ExifTool by Phil Harvey. It support just about any image or video file format your can imaging. And a nice thing is that it is implemented in Perl so that one can easily use it to build a script. And it works cross-platform which is important for me who move between three operating systems on a daily basis.

This is all it takes to extract all metadata from a file:

Categories
Computers Mac

Cyberduck crash report question

Cyberduck is a great application for FTP/SFTP/WebDAV use on the Mac which I use daily to manage files on various Linux and Windows servers. It also works rather well together with TextMate, my favourite text editor on Mac (or elsewhere for that matter!) although I lack the ability to open a set of files and get them in one TextMate window.

With the latest version of Cyberduck (3.0.3) I received the message “do you want to report the last crash” every time I started the application. There was no option to remove the alert on future application launches.

To remove the warning when the application is started, just remove the files ~Library/Logs/CrashReporter/Cyberduck*.

Categories
Computers Gadgets Mac

Completely remove U3 from Sandisk Cruzer on Mac

My collection of USB memory sticks is constantly growing. Some USB sticks I have bought, others were given to me as giveaways. The nicest ones from a physical perspective are a couple of Sandisk Mini Cruzer but unfortunately they came with U3 which I utterly dislike. U3 means that there is a small CD partition on the flash disk which is used to hold the U3 software. Since I am mainly using a Mac that is of no use to me and is just causing more clutter to my desktop. Even when I am running Windows it feels like a nuisance. The extra CD partition also meant that I couldn’t install a live USB OS on them. As a consequence they haven’t been used much.

For the longest time I thought it was impossible to fix this issue. But then I found an article on the Sandisk forums. So, if you want to remove the U3 partition to gain access to the full USB memory (or for whatever reason), just download and install this file.

Run the Launchpad Removal Utility for Mac application from within the SanDisk Cruzer folder in the Utilitites folder inside the Application folder.

Categories
Computers Linux

Ubuntu 8.10 – libpolkit error

On a newly installed system with Ubuntu 8.10 you will see these kind of lines in /var/log/syslog:

Nov 24 01:12:31 sirius console-kit-daemon[9837]: CRITICAL: cannot initialize libpolkit

The error will repeat every ten minute or so and the fix to this issue is to install policy-kit, i.e.:

sudo apt-get install policykit

This is described in more detail on Launchpad: https://bugs.launchpad.net/ubuntu/+source/policykit/+bug/275432

css.php