Archive for the ‘Software’ Category

6
May
2012

Installing Indefero on Ubuntu Precise Pangolin

Tags: ,     Categories: Software

Indefero is an open-source Git hosting web app, built on PHP (using the PLUF framework) and MySQL. I use it for some clients because it is shared hosting friendly (no need to set up Ruby on Rails or daemons, as with Gitorious). Here’s a quick guide to installing it on the latest (as of time of writing) Ubuntu release, Precise Pangolin v12.04 LTS.

Conveniently, someone (shockflash) has packaged Indefero for Ubuntu installation. As of time of writing, these packages were limited to Ubuntu Lucid Lynx v10.04, so there’s a couple of extra steps, but the install process is still relatively painless.

On a basic Ubuntu 12.04 install, I opted to enable the LAMP package set (which installs MySQL, PHP, and Apache web server all needed by Indefero). If you are installing on an existing Ubuntu server machine, you just need to install apache2, mysql-server, and various php5 packages.

  1. Install Indefero package

    • Make sure to have MySQL (server) installed in advance, along with apache2.
    • As per the instructions on this Launchpad page, you add their repository: sudo add-apt-repository ppa:shockflash/indefero
    • A quick edit of /etc/apt/sources.list.d/shockflash-indefero-precise.list and change the precise to lucid. This hack just tells apt to use the packages for the older lucid install (as these are the most recent packages available at the moment.
    • Update your repository cache by using apt-get update, or “u” within aptitude
    • Finally, install the packages added by this new repository. If your software was fully up to date, then you should see 5 new packages available to install. These packages are indefero, pluf, and any/all of the 3 other scm-specific packages indefero-git, indefero-hg, indefero-svn, as needed.
  2. Configuration

    • As noted during the install, the default admin login details are admin / pass
    • These packages automatically install at <your_server_hostname>/indefero/, though you may want to set up a more specific arrangement using virtual hosts, etc.
  3. Potential Apache config issue

    • There’s one slight issue that I found on a few installs. That is that the Indefero CRON script for synchronising Git keys breaks because it can’t determine the hostname (correctly, or at all). This means that after adding valid user SSH keys in Indefero, these keys won’t work because the cron script never gets to add them to the git user’s authorised keys. This problem also surfaces when you start/restart/configtest apache2 and get the message apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName. To fix this, simply fix your apache configuration! If you are not using virtual hosts, you can fix the base Ubuntu install by just adding ServerName <your server hostname> (or even ServerName <localhost>) at the start of the /etc/apache2/apache2.conf
  4. First steps using Indefero (Git)

    • Login as the default admin user
    • Create a new user, and add an SSH (private) key for that user. Of course, you can have that new user login and provide their own SSH key.
    • Create a new project, and add your new user to the team
    • You can follow the instructions on the project page for creating a new repository, or you can upload an existing repository as follows:# You probably want to remove any existing 'remote' (like GitHub,
      # Gitorious, or your own SCM hosting). If so...

      # List any existing remotes
      git remote
      # Remove any remote. Likely called 'origin', or whatever
      # is listed above.
      git remote rm origin

      # Now add your Indefero project as a remote
      git remote add origin git@<your server hostname>:<your project name>.git
      # For example, if your server is 'scm' and your new project is 'test'...
      git remote add origin git@scm:test.git

      # Push your repository to its new origin, or home, on Indefero
      # in the 'master' branch.
      git push origin master

      # Thereafter, you can simply push any changes with
      git push

 

2
May
2012

Python iCalendar module, Google Calendar, and the case of the missing whitespace!

Tags: ,     Categories: Software

TL;DR Update your icalendar module to the latest (beta) build.

As the title suggests, if you’re having the same issue I had where Google Calendar seemingly deleted random spaces between words, on an imported calendar (iCal/.ics file) generated by the python icalendar module, then read on!

Versions 3.0 (which is, in itself, recent), and older, of this module correctly wrapped long lines in the generated iCal file. However, they also incorrectly stripped whitespace from the end of lines in that wrapping, or folding, process. The iCal spec does call for wrapping of long lines, and specifically sets out that the next line should start with a space.

So, whilst it looks line a wrapped line has the correct whitespace between words, the first space character of the second/subsequent line isn’t part of the text. The previous line (assuming the wrapping has been performed nicely between two words) should end with a space; which, crucially, was being deleted in error. The result is Google Calendar correctly removes the space at the start of the second line (it being part of the protocol), leaving the last word on line 1 and the first word on line 2 to now be joined. The raw iCal file can be deceiving in that case, trust me!

To fix this, simply update to the latest version (a v3.1.x, or directly from source). If you can’t do that (for reasons other than file permissions!), you can also edit the offending line in icalendar/parser.py. Search for drop_whitespace and change it from True to False. A simple fix, when you know how! If that still doesn’t work, make sure to remove any older/conflicting versions of the module, and to restart the server/script that’s using it.

Update: Of course you were not using the original, and now obsolete, codespeak.net/icalendar/ page, were you? Of course not, but do note it’s now under active development again (with the blessing of original authors) at GitHub.

 

23
Jun
2011

Mac keyboard, Ubuntu Synergy server, and Mac Synergy client

Tags: , , ,     Categories: Software

This post serves to highlight just how awkward my setup is, and as a guide to help with anyone with a similar setup (all 3 of you, worldwide).

I’ve recently started using Synergy to control my Macbook from my Ubuntu (10.04, if that turns out to matter!) desktop. However, I use the slim Apple USB keyboard on my Ubuntu desktop (a subject of previous posts here). They key mappings for Alt and Command on my Mac were reversed when I was controlling the Macbook. I.e. the Apple keyboard wasn’t being reported as such to the operating system. Here’s a snippet from the synergy configuration file showing the swap to make the Apple keyboard work as expected on a Mac Synergy client. If you use QuickSynergy, the config file is in ~/.quicksynergy/synergy.conf.

section: screens
ubuntu-synserver:
macbook-synclient:
alt = super
super = alt
end

 

18
Jan
2011

Irish-friendly keyboard layout for an Apple aluminium USB keyboard on Ubuntu

Tags: , ,     Categories: Software

By default, Ubuntu has plenty of Irish keyboard layouts which will let you type a fada on your vowels. However, if you’re using an Apple aluminium USB keyboard, like me, you’re layout options are restricted. I have the UK variant of the keyboard, which does have a corresponding layout in Ubuntu (under United Kingdom > Macintosh), but that doesn’t provide support fadas (acute accents).

My goal was to have Shift+2 give me @, AltGr+2 give me €, Shift+3 give me # and AltGr+3 give me £. Also, of course, the fadas to work on any vowel (including Shift support for upper case). To do this I appended a variant to the end of the existing Ireland “symbols” file, as follows:

  1. As root, edit /usr/share/X11/xkb/symbols/ie. Older versions of Ubuntu (earlier than 8, I think), has a different file path.
  2. At the end of the file, append the following: partial alphanumeric_keys
    xkb_symbols "macie" {
    // Fix currency symbols, # symbol and 'fada' support.
    include "latin"
    name[Group1]= "Ireland - Macintosh";
    // Numeric Row 123456789
    key <AE02> { [ 2, at, EuroSign ] };
    //key <AE03> { [ 3, sterling, numbersign ] };
    key <AE03> { [ 3, numbersign, sterling ] };
    // Top Row QWERTYUIOP
    key <AD03> { [ e, E, eacute, Eacute ] };
    key <AD07> { [ u, U, uacute, Uacute ] };
    key <AD08> { [ i, I, iacute, Iacute ] };
    key <AD09> { [ o, O, oacute, Oacute ] };
    // Middle Row ASDFGHJKL
    key <AC01> { [ a, A, aacute, Aacute ] };
    include "level3(ralt_switch)"
    };

    You’ll see a comment line for the more accurate keyboard mapping of Shift+3 giving the £ symbol (to closer match the printing on the keys of a UK Apple keyboard). However, I prefer Shift+3 to give # as I’m a programmer; feel free to choose whichever you want (and comment/uncomment as appropriate). Save the file.
  3. Then, you edit /usr/share/X11/xkb/rules/evdev.xml to configure your new variant. Search for Ireland, and you’ll see it has a <variantList> with a bunch of <variant> nodes. You want to add the following XML as a new <variant> node at the end of the others, and before the closing </variantList> tag. <variant>
    <configItem>
    <name>macie</name>
    <description>Macintosh</description>
    </configItem>
    </variant>
  4. Finally, to start using your new custom layout, go to System > Preferences > Keyboard (on a Gnome desktop) and, on the Layouts tab, you can add your new custom layout. Select “Ireland” as the country and you should see the new “Ireland Macintosh” layout. You can set the layout priority by moving the new layout up/down the list, or remove any others if you just want the one layout.

So there’s a quick way to get fadas and currency symbols working for your Apple UK USB keyboard on Ubuntu.

UPDATE: Added missing closing XML tags for name/description in snippet above, and fix tag angle bracket mushing by WordPress.

 

7
Jan
2011

Unlocking your o2 broadband modem

Tags: , ,     Categories: Comms, Hardware, Software

If you, like me, have an o2 broadband (midband, really) modem, made by Huawei, that you want to unlock to use with other services, you can get quite the run around if you Google how to do this. There are many options (and most Huawei models seem to be easily unlocked), that charge from €5 to €15 for a code to unlock, with the most common one appearing to be dc-unlocker.com (deliberately not linked!).

Well, there are a few free options that are easy to use (and phone unlocking software isn’t always easy to use!). I came across Ruchira Sahan‘s blog which details the process, and provides the required software. Basically, you need to generate an unlock code which is based on your IMEI number (a unique code for your modem/SIM card). Software gets that for you, and will unlock the modem for you as well. He details it much better, but a summary of what I did to unlock my Huawei E1752 (an older o2 broadband USB modem) is:

  1. Close the o2 connection software
  2. Download the software he links to in this post, run it (there was only 1 COM port to select in my case, and it had an obvious HUAWEI label), and let it retrieve the IMEI
  3. Using that IMEI, I used the calculator he links to from this post to generate an unlock code
  4. Using the same software, I then enter the unlock code from the previous step, and it unlocks the modem for me, with no errors or delay
  5. Finally, because the o2 connection software is still crippled (and wouldn’t work with my Three SIM), I downloaded the generic Huawei connection software for that model, and many other models, from dc-files.com. I did check for the presence of a virus, but still be careful when downloading any of this software. I created a new profile in that software, but that’s all I did (nothing with dial in numbers, networking, APNs or anything like that).

I rarely use my o2 Broadband Modem, now that I have tethering with my iPhone4 (and a plan that includes 2GB of data), but it is handy to have in the laptop bag. It’s much handier to have with a SIM from another network on standby too!