NFS Automount with Snow Leopard

english, geek, howto, pat No Comments »

Before upgrading to Snow Leopard, I was using the NFS automount capability of Mac OS X. It was a handy way for my laptop to connect to my home NAS server (a linux box running Ubuntu).

Unfortunately I had to redo the NFS config after upgrading and I noticed that Directory Utility was not present anymore in Snow Leopard.

Here is what I found out after some research:

  • the NFS automount configuration is now done directly in Disk Utility (under File > NFS Mounts…) and not in Directory Utility like in Leopard (which does not exist anymore).
  • the configuration that worked for me was the following one (for accessing a read-write NFS share):
    Remote NFS URL: nfs://[server]/[path]
    Mount location: [path to local mount folder]
    Advanced Mount Parameters: -i,-s,-w=32768,-r=32768
    
  • for automount to reload its configuration, I had to run the following command:
    sudo automount -vc
  • That’s it. The NFS share should now be accessible.

    References:

  • http://discussions.apple.com/thread.jspa?threadID=2137675
  • Time Machine: Handy but Bitchy!

    english, geek, howto, pat No Comments »

    I have been spending the last couple of days of my spare time performing a simple operation with my mac, yet slightly more complicated than expected: merge the two partitions of my hard drive into one. This was necessary since I did a mapping, quite usual on Linux, where my system was sitting on the first partition (50 GB) while my user data was on the second one (the rest of 300 GB). But this mapping was not making me happy, since the system partition was always almost full (Mac OS X is not well suited for a multi partition disk drive, I find).

    Although you can resize a live partition with Disk Utility (great feature, even if you booted with it), you cannot move the base position of a partition. You can merely resize it, if more space is available. So I had to back my second partition up for later restoring it. I went for Time Machine, since I was already using it for backing up my laptop.

    Time Machine Caveats

    Unfortunetely I noticed a couple of caveats during the restore operation:

  • When using the Time Machine restore utility shipped with the OS X install DVD, you can only restore the partition where the system is, but not other ones. This was quite of a surpise to me. Although you can choose on which partition you want to restore your system (the target, not the source).
  • Although your data is actually sitting on the Time Machine backup drive, you cannot use it directly (i.e. copy it back using the Finder or a shell). The reason for that is the ACLs that Leopard is putting on each and every file and folder to protect changing the Time Machine backup. In addition the ACL system (which is a parralel access control to the Unix one, which I did not know the existence of beforehand) is deeply flawed: you cannot reliably remove recursively the ACLs from a directory structure (you will still find files scattered within the structure having ACLs) and you even cannot remove the ACL permissions on symbolic links (this seems to be a bug of chmod on Leopard, although ACLs on a symlink do not seem to have any effect)
  • Solution for merging two partitions

    I finally found a solution to restore the second partition or to merge them: I had to fiddle directly with the Time Machine backup, copying manually the files I wanted from the second partition to the first, and did a restore of the first partition using Time Machine restore utility.

    Here are the details of the steps I took:

  • Plug my external drive where I have my Time Machine backup, open a terminal and sudo as root:
    sudo -s
  • Deactivate on that drive the ACL checks, so that I can modify directly the Time Machine backup:
    fsaclctl -p /Volumes/[backup drive] -d
  • Move the folders from the second partition to the first one with
    mv [from] [to]
  • Reactivate the ACL checks on the external drive:
    fsaclctl -p /Volumes/[backup drive] -e
  • Do the restore of the first partition with the Time Machine restore utility (located on the Leopard install DVD).
  • This worked for me. You should now have a merged partition on your drive, the restore utility having removed the ACLs during the operation. Phew! This was not a straight forward action! I still cannot believe that Apple did not take into account that people can have more than 1 partition on their drive (I might still have missed the way to do it, did not find it so far though).

    Links/Info

  • Macosxhint: reconnect Time Machine backup after a drive swap
  • Inspect the ACLs of your file with ls:
    ls -le

    For the record, this will yield the following listing when ACLs are present (pay attention to the lines starting with ‘0: ‘ and ‘1: ‘:
    drwxrwxr-x@ 138 root admin 4692 Sep 13 2008 Applications
    0: group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown
    1: group:everyone deny delete
    drwxr-xr-x@ 2 pat staff 68 May 9 22:12 DeveloperSDK3
    0: group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown
    drwxr-xr-x@ 5 pat staff 170 Oct 23 2008 VirtualBox
    0: group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown

    You can also do that recursively using the following command:
    ls -lateR > filelist

  • You can remove ACLs on a file with this command (not working properly for a recursive operation with the option -R)
    chmod -a# 0 [file]
    where 0 is the ACL entry to remove.

  • The Geekiest Hello World

    english, geek, pat No Comments »

    Folks, I think that I have found (one of) the geekiest hello world out there. Implemented in Groovy using the dynamic interception of method calls. Here it goes:

    class Hello {
      Object invokeMethod(String name, Object arguments) {
        System.out.println "hello $name!"
      }
    }
    
    def hello = new Hello()
    hello.john()
    hello.you()
    

    Which produce the following output:

    hello john!
    hello you!
    

    I suppose the same mechanism can be used with Ruby (and some other dynamic languages).

    Self-Reproducing Program in Groovy

    english, geek, pat 3 Comments »

    I had this in mind since yesterday: how to write a self-reproducing program in Groovy, or a Quine, a program which prints out its source code. It’s actually a fun exercise.

    Here is my version:

    a = 'c = (char)39; println "a = $c$a$c"; println "$a"'
    c = (char)39; println "a = $c$a$c"; println "$a"

    It looks scary, but it is actually not that terrible. The first line is the definition of a variable a of the form:

    a = '[some string]'
    

    The second line is first the definition of the single quote character assigned to c. We then print out the first line (including the variable definition), where we replace the single quote by our character c, and where $a is the content of a. This part looks like:

    println "a = $c$a$c";
    

    Finally we print out a.

    The only thing that we need now to do, is to replace [some string] in the first line. It happens that if we take the complete second line and assign it to ‘a’ in the first line, we will get the desired output. We see here that if we had not used $c in the first println of the second line instead of the single quote, the string assigned to a in the first line would not be legal, since it would contain inside the string a string delimiter (and if we escape it, we don’t get the same output as the program code).

    That’s it. It was fun.

    Links:

  • A quine on Wikipedia
  • Interesting blog post about a self-reproducing program
  • Annoying ’screen’ Backspace Problem

    english, geek, howto, pat No Comments »

    Already a long time that this issue is bugging me. The great ’screen’ unix command has a problem, at least on ubuntu: the backspace key produces the same effect than delete (first char on the right of the cursor gets deleted). Very annoying. Hopefully the solution is easy. Edit your file ‘~/.bashrc’ and add the following line:

    alias screen='TERM=screen screen'

    New Mix: Electro-rock to Minimal

    SoUnd, general, pat 3 Comments »

    Check out my new mix in the sound section! I did something a bit different than the previous time, as I wanted to explore the electro-rock style, which is really a great and energetic combination.

    • Extrabright Mix 02: From electro-rock to minimal, with an electronica introduction and a new age epilogue. Calvin Harris remixed by Mr. Oizo, Ellen Alien, Justice, Miss Kittin, Love Motel and a couple of other great tracks.

    WPtouch Plug-in

    english, geek, pat No Comments »

    Just installed a Wordpress plug-in that aims at providing a good rendering on the iPhone. It’s called WPtouch. Neat.

    Database Issue

    english, general, pat No Comments »

    I had some database issues 2 weeks ago, therefore I lost a couple of comments. Sorry guys. I hope it will stay stable now.

    Cheers!

    Pidgin Status Update from Twitter

    english, geek, howto, pat 5 Comments »

    Just figured out how to get Twitter update the pidgin status (e.g. GTalk, Jabber, ICQ, MSN, etc.). For that, you need to install a pidgin plug-in written in Perl. Here is a small howto about it (as the Perl stuff was a bit tricky):

  • Download and install the multi-network Pidgin client
  • Install Perl. On Windows (yeah, I know. It’s at work. ;) ), install Active Perl version 5.8.8.X. Don’t take the last one, the 5.10.0, as Pidgin does not support it yet.
  • Install the Package XML:XPath, either using the CPAN console (install XML:XPath) or using the package manager of Active Perl.
  • Restart Pidgin and check that Perl is enabled. (Help -> About -> at the bottom of the page, you should see ‘Perl: Enabled’).
  • Download the twitter plugin and put it in the plugin folder of Pidgin. (For instance on Windows in ‘C:\Program Files\Pidgin\plugins’)
  • Configure the plug-in and enjoy!
  • Posting from the iphone

    english, general, pat No Comments »

    Testing the wordpress application on the iPhone. It seems quite easy to post something. Apparently it works also on a self-hosted wordpress instance.

    Flock for Blogging

    english, geek, pat No Comments »

    Just trying the Flock browser for posting a blog news. It’s great. It’s about like writing an e-mail, with a good blog integration, where you can define tags, categories and that kind of news-related things. Really cool. Much quicker than the web interface. ;)

    Green Server II

    english, environment, pat No Comments »

    I published some time ago a news regarding reducing the power consumption of my home server to 53 W. There was some open issues like how to reduce the consumption further.

    Regarding this, I finally simply decided to switch off the server automatically every night using a Cron job. This is an elegant solution, as I am not hosting anything on this home server, other than stuffs I am using at home. Everything else is on my dedicated server.

    This solution has the following two advantages:

  • It is very effective: I just need to switch on the server when I need it. It will get switched off automatically after a while. Hence the server is off most of the time.
  • It is handy: I don’t need to remember to log on into it just before leaving home. Just switching on the server when I need it, is fully OK for me.
  • What I can still improve:

  • Getting wake-on-lan working. That way I would not even need to switch it on. This would be really cool. I could even configure my WIFI access point to send automatically a wake-on-lan packet to the server, whenever it is accessed for the first time after a long inactivity period. I would just have a longer latency the first time I am accessing the server, whenever it gets waken up.
  • Will check this out.

    Update: I actually activated wake-on-lan. This is really handy. I did a small script on my mac, which uses the utility ‘wakeonlan’ (installed through fink). That way I can confortably switch on the server remotely from my laptop when I need to. (The wake-on-lan option must be activated in the BIOS.)

    The small script that I use (this will only work if the server is in the LAN):

    #!/sw/bin/bash
    /sw/bin/wakeonlan [server mac address]
    

    Tomato on WRT54GL: LED shows WIFI status

    english, geek, howto, pat No Comments »

    Something I wanted to do since ages. My wireless router WRT54GL running the Tomato firmware has a button on the front, which can be used to toggle WIFI on and off. The router has also a rather visible LED indicator, behind the button, that is unfortunately not used to show the WIFI status. (Originally, the wifi status is just shown by a tiny LED, that is just visible when watching closely the device).

    It’s easy to fix that. Using the web interface, go to the ‘Administration’ > ‘Buttons / LED’ page. Replace the custom script by the following code:


    # status: 1: wifi on, 0: wifi off
    status=$(wl -a eth1 dump | grep associated | cut -d " " -f 2);
    # toggle wifi & amber led
    wl -a eth1 $([ $status -eq 0 ] && echo up || echo down)
    led amber $([ $status -eq 0 ] && echo on || echo off)

    Then change the setting for ‘0 – 2 Seconds’ to ‘Run Custom Script’. That’s it. Now when we press the button, the wireless is toggled and the LED switches itself accordingly.

    Tested with Tomato 1.19.

    Googling his credit card number

    english, geek, pat No Comments »

    According to the free newspaper “news” of today (Zurich, Switzerland) page 15, the computer-science Professor Kieron O’Hara, which is concerned about the loss of privacy in the internet age, is advising the editor in the interview to “google regularly one’s name, phone number and credit card number”, to see if this information is to be found somewhere on the net. OMG. I am wondering where this crap comes from. Either is this professor as intelligent as my banana tree, or the editor writing this did the interview in Esperanto, which neither of the two are understanding.

    Why is it a bad idea to google one’s credit card number? Just in case you don’t know.

  • The connexion to the google server is not encrypted. So anybody evesdropping on the path to it could get the information (e.g. at your local provider or your neighbour that just hacked your weak WEP wireless encryption).
  • There is no guarantee whatsoever about what google is gonna do about the submitted queries. At best it will be stored in one of their database in clear text.
  • At worst it will appear on a big screen inside the reception room in a google office, on the live query list.
  • Philippe Starck – Why Design

    english, general, pat No Comments »

    I have watched this talk a couple of days ago. It is really interesting so I am posting it hereafter.

    WP Theme & Icons by N.Design Studio
    Entries RSS Comments RSS Log in