“the j stands for Jujube”
about me | research blog | wordpress plugins | jQuery plugins

27 July, 2011

Gedit syntax highlighting for Grammatical Framework source code

There is now an official page on the Grammatical Framework website about GF Editor Modes.

For correct syntax highlighting in Ubuntu’s default text editor (gedit) for anyone editing Grammatical Framework source code, put the code below into the file ~/.local/share/gtksourceview-2.0/language-specs/gf.lang (under Ubuntu).

Some helpful notes/links:

  • The code is based heavily on the haskell.lang file which I found in /usr/share/gtksourceview-2.0/language-specs/haskell.lang.
  • Ruslan Osmanov recommends registering your file extension as its own MIME type (see also here), however on my system the .gf extension was already registered as a generic font (application/x-tex-gf) and I didn’t want to risk messing any of that up.
  • This is a quick 5-minute job and might require some tweaking. The GtkSourceView language definition tutorial is the place to start looking.
  • Contributions are welcome!

14 July, 2011

Geany syntax highlighting for Grammatical Framework source code

There is now an official page on the Grammatical Framework website about GF Editor Modes.

I wrote a custom filetype config file for the Geany text editor, providing correct syntax highlighting for anyone editing Grammatical Framework source code. Put the code below into the file /usr/share/geany/filetypes.GF.conf (under Ubuntu). You will need to manually create the file:

Light Version

Dark Version

You will also need to edit the filetype_extensions.conf file and add the following line somewhere:

GF=*.gf;

Hope that helps someone who doesn’t feel like reading through the Geany documentation! (which btw can be found here).

25 July, 2010

Enabling compression with GoDaddy Shared Hosting

Compression of HTML, CSS and JavaScript is quite important for improving your site’s speed and should always be used.

Of you will find that all you need to do is add a line similar to the following to your .htaccess file:

AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml application/x-javascript text/javascript application/javascript
Source: StackOverflow

However, if you’re on a GoDaddy shared hosting account you may have realised that this doesn’t work. GoDaddy’s help page recommends that you paste this code in all your PHP pages:

<?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?>

That’s fine, but from my understanding this will not cache your CSS or JavaScript. However, I found a solution here here, which involves some .htaccess trickery to compress all your CSS and JavaScript files automatically. Enjoy!

6 July, 2010

j’s instead of smileys in Thunderbird 3

It seems the solution for the outlook smileys posted here only works for Thunderbird 2.
For Thunderbird 3, I found this very helpful discussion and add-on.  Enjoy!

9 May, 2010

Vertical alignment of inline images in LaTeX

This is one of those things which isn’t so easy to find, so here’s my contribution.

The Problem

You’re using LaTeX, and have a small image which you want to display inline with the text (i.e. not a float). So, you use something like the following:

...indicate whether the phrase you've constructed is valid (\includegraphics{tick.png}) or not (\includegraphics{cross.png}}). To make things...

This works, but often the vertical alignment is not quite right, as shown in the images below:

Inline images, non-aligned

Zoomed (x600)

The Solution

After some searching and experimenting, I found the best solution to be using the \raisebox command with a negative value, like so:

...indicate whether the phrase you've constructed is valid (\raisebox{-1mm}{\includegraphics{tick.png}}) or not (\raisebox{-1mm}{\includegraphics{cross.png}}). To make things...

The additional code is minimal and it works perfectly (as far as I can tell). Results as below:

Inline images, properly aligned

Zoomed (x600)

16 April, 2010

CSAI’s Guide To Dissertation Writing

I found this on my computer, not sure where it came from (can’t find it online now) but I figured it may be useful to other IT students writing their FYP/dissertation.

CSAI Final Year Projects Guidelines (B.Sc.IT)

7 April, 2010

Fonts, Keyboards & Layouts – How to correctly type Maltese characters

UPDATE: Thomas Pace kindly pointed out this very helpful link which basically covers everything here, and includes steps for Apple’s OSX: http://www.kunsilltalmalti.gov.mt/filebank/documents/kompjuter.pdf

I’ve been asked many times how to enter Maltese characters on a computer – i.e. ċĊ, ġĠ, ħĦ and żŻ.
It turns out there’s a lot of misconceptions out there, and many people think that typing Maltese and other non-Latin characters requires a special keyboard and/or specially installed fonts. This is completely not true, and all users with a moderately modern computer are able to enter such characters by simply adding a selecting a different keyboard layout from their OS.

Below is a short explanation of the misconceptions, if you just want to see the steps for selecting a different keyboard layout, click here.

“Maltese Fonts” and why they’re such a bad idea

A few years ago, everyone thought these so-called “Maltese Fonts” were the solution to entering Maltese characters into your computer. These fonts are just copies of the usual fonts we all know (Arial, Times etc) but with certain characters redrawn, such that when you type a [ it is displayed as a ġ, } becomes Ħ and so on. Now if all you're doing is typing into a word processor and printing directly from the same computer, the solution seems to work.

But what happens if you want to send a Maltese document to someone who doesn't have these fonts installed? Well, they will still be able to open the document, but in place of the proper Maltese characters they would see different punctuation symbols. So the phrase Għażiż Ċali would become something like:

G]a\i\ `ali

People just accepted this, and would say to each other “you need to install the Maltese fonts in order to read the document”. But, it gets worse. What if you’re entering text somewhere which doesn’t allow you to change fonts? I you were filling in a form on  a web page or even writing an email, you would just forget the use of Maltese characters altogether.

To summarise, “Maltese Fonts” are a very short-sighted and inelegant solution. Thankfully, due to a little something called Unicode, all modern computers today will allow you to enter (and read) Maltese and other non-Latin characters, simply by changing your keyboard layout settings (see below).

“Maltese Keyboards” and why you don’t need one (but might still want one)

Another misconception I’ve heard is that in order to enter Maltese characters, you require special hardware — i.e. a “Maltese Keyboard”. This is not true, because all a Maltese keyboard really is is a standard US/UK keyboard with different symbols printed on the keys. Circuitry-wise, everything else is identical. In fact any keyboard can be used to enter any type of character, simply by changing your computer settings.

However, that being said, users may find that having a Maltese keyboard is helpful since they don’t need to remember that they need to press the [ button to produce a ġ and so on.

How to select the Maltese keyboard layout on your computer

The screenshots below are taken in Windows 7. Steps for Windows Vista and Windows XP are very similar, almost identical. Steps vary for Linux because of all the different distributions, for Mac OSX refer to the linked article above.

  1. Start → Control Panel
  2. “Change keyboards or other input methods”
  3. Click “Change Keyboards…”
  4. This shows all your installed keyboard layouts. Click Add.
  5. Choose one of the Maltese keyboard layouts:

    • If on your keyboard, the @ symbol is above the number 2, choose Maltese 47-key
    • Otherwise, if the symbol is above the 2 key, choose Maltese 48-key
  6. You can also preview the keyboard layout:
  7. After clicking OK to everything, you should now notice a new icon in your taskbar next to the time, called the Language bar with this icon:

    Click on it to change the desired input language. After changing it to Maltese, try pressing these keys on your keyboard:

[ { ] } `¬ \ | # ~

You should now see our lovely Maltese characters on your screen :) (The last 4 will vary depending on whether you chose the 47 or 48-key layout).

Note that this setting is per-application. So, if you’re in Microsoft word and change it to Maltese, then switch to your email client, you will need to set the language again for that application. If you always want the Maltese keyboard layout to be the default active layout for all your applications, you can set it from the screen in point 4 above (under default input language).

5 March, 2010

Google Buzz: Stop getting emails via POP

Useful / , , , , / 8:05 pm

If you use Gmail /Google Buzz and a POP client for your email, chances are you’re receiving a bunch of emails telling you about new buzz’s – including your own updates!

This is very annoying and there’s no direct setting to turn it off. However this guy has come up with a great solution, by basically creating a Gmail filter for emails containing the words in:buzz

26 February, 2010

How to unescape HTML entities in JavaScript

This is one of those routine web development things which you assume is inbuilt, but actually proves quite tedious to find a nice solution to.

Specifically, I am talking about converting something like &#39; to ‘ or &amp; to & directly in Javscript.
This function does exactly that! Note how it adds a function to the prototype for String, so is called in the following way:

"Hello Jos&eacute;".unescapeHtml()

Find the code here: paul schreiber » Blog Archive » JavaScript: how to unescape HTML entities.

12 January, 2010

Errors saving files in Windows 7 – “You don’t have permission to modify files in this network location.”

So ever since I’ve been using Windows 7, every so often I get this annoying error message when saving files, most often when using “Save link as…” from within Firefox (but not only). I would get this error, and the file would in fact be created taking up 0 bytes. However when trying to re-save over it directly after, it would work correctly… so wasn’t too serious an issue.

The full error message is:

You don’t have permission to modify files in this network location.
Contact the administrator per permission to make these changes.

(I thought the “per permission” looked a bit funny…)

Anyway, after looking at this thread, it seems it this issue is NOD32-related. The solution I tried was disabling the “Scan on File Creation” option within NOD32, found under SetupAntivirus and antispywareReal-time system protection.

You could argue it’s less secure, but it seems to have worked and it’s a price I’m willing to pay.

Hope this helps anyone having a similar problem.

Newer Posts »