While diving in into Django for a project, my first problem was how to create a dynamic toolbar and sidebar, depending on logged users’ rights.

I started with the skeleton HTML (based on the amazing Twitter bootstrap) which was something like this (irrelevant code parts removed):

Read the rest of this entry »

For Magento 1.6.0.0 the following procedure should be followed:

  1. Complete the master installation
    note down the password key.
  2. Login as admin and create the second website and store
  3. Complete the secondary installation
    During the DB step, enter remote database server and credentials
    Use the password key from the master installation
  4. Edit the secondary installation index.php file, remark the last line and enter the following:

    Mage::run('my_additional_store_view_code');

  5. Login to the secondary admin interface and go to System -> Configuration -> Web:
    For default config enter the desired (main) URLs for insecure and secure
    For secondary website, alter the secure URL (use non-global)

12 Jun 2011

Just finished

Filled in: Websites

Here’s how to have a fixed column width when using TableLayout in Android:

  1. Set each View’s layout_width equal to 0.
  2. Add in each View layout_weight, according to your needs

Here’s an example of a TableView with two equal-sized fixed columns:

<TableLayout android:layout_width="fill_parent"
  android:layout_height="wrap_content">
    <TableRow>
        <TextView android:layout_width="0dip"
          android:layout_weight="1"
          android:text="1" />
        <TextView android:layout_width="0dip"
          android:layout_weight="1"
          android:text="100000" />
    </TableRow>
    <TableRow>
        <TextView android:layout_width="0dip"
          android:layout_weight="1"
          android:text="100000000" />
        <TextView android:layout_width="0dip"
          android:layout_weight="1"
          android:text="1" />
    </TableRow>
</TableLayout>

26 Oct 2010

Capitalize greek strings in MySQL

Filled in: MySQL

Here’s a handy function:

DELIMITER $$
DROP FUNCTION IF EXISTS Capitalize $$
CREATE FUNCTION Capitalize(x char(255))
  RETURNS char(255) CHARSET utf8
BEGIN 
RETURN
  LTRIM(CONCAT(
    UPPER(SUBSTRING(x, 1, 1)),
    LOWER(SUBSTRING(x, 2, CHAR_LENGTH(x)-2)), 
    IF(
      UPPER(SUBSTRING(x, -1)) = "Σ",
      "ς",
      LOWER(SUBSTRING(x, -1))
    )
  ));
END $$
DELIMITER ;

The key function here is CHAR_LENGTH which returns the count of characters (instead of bytes).

If you are using both WPaudio and WPminify plugins in wordpress you will notice that WPaudio has stopped working.

The solution is easy: go to WPminify options, scroll down to the text area titled “Javascript files to exclude from minify (line delimited)” and add the following two lines:

soundmanager2-nodebug-jsmin.js
wpaudio.js

Don’t you hate it when users press ENTER to move to the next field and the form is submitted instead? Here’s a quick solution:

1. Before the form->create method, add the following:

<script type="text/javascript">
var itsclicked = false;
</script>

2. At the form->create method, add the following:

<?php 
echo $this->Form->create('model',
    array('onsubmit' => 'return itsclicked;'));
?>

3. At the end of the form, replace form->end with the following:

<?php 
echo $this->Form->submit('Submit', 
    array(
        'onmousedown' => 
            'itsclicked = true; return true;',
        'onkeydown' =>
            'itsclicked = true; return true;'
    ));
?>

The ENTER is now trapped and the only way to submit the form is to either click on the submit button with the mouse or to press any key while the submit button has the focus.

I’m using Google Chrome on my dear netbook, running Ubuntu 10.04. Since yesterday after an abnormal shutdown, I was getting the message “Your profile could not be opened correctly” yada yada.

I tried some rm – cp stuff, suggested elsewhere, but it didn’t work. In the end, I opened ~/.config/google-chrome/Default/ and I deleted every file related to “History” while having Google Chrome closed, i.e. every file starting with “history”. I re-opened the browser and I got rid of that dreadful message.

03 Feb 2010

Notepad++ Function List Plugin

Filled in: Mumble

After upgrading to the latest (5.6.6 Unicode) version of Notepad++, I had several problems (read: crashes).

After playing around with the plugins, I noticed that the problem was with one of my (favorite) plugins: Function List.

Fortunately, thanks to Ruslan’s blog I found the solution: download a copy from here.

25 Jan 2010

Mystery Express

Filled in: Mumble

Days of Wonder, my favorite board games publisher, is up to a new suprise. The game “Mystery Express” was announced a few minutes ago, sadly without too many details.

According to the website, the game is out in March and it will be available in English, French and German. From the publisher’s blog we read the following:

Experience the very pinnacle of stylish and luxurious travel aboard the famed Orient Express until you find the body!

Suddenly everyone on board is a suspect, as you desperately attempt to solve the murder before the train reaches Istanbul.

Welcome to the Mystery Express!

A new website is up, where people can read what this new game will be about.

Update:

Boardgame News, posted an interview with Antoine Bauza, one of the game designers (the other one is Serge Laget).

Stop censorship