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).

I’m not really fond of Opera’s translation menu; maybe it’s because it only offers a handful of languages (and I have some Finnish, Danish, Swedish and other -ishes friends on Facebook).

Hopefully Opera’s known power user, Tamil, had a solution for a similar task, which I changed a bit:

  1. Go to Tools -> Preferences -> Advanced -> Toolbar
  2. Find “Menu Setup” (bottom right), click “Opera Standard” and press “Duplication” (skip this part if you already have a “Copy of Opera Standard”).
  3. From the profile directory, open “menu” folder and edit the file called “standard menu (1).ini”
  4. Find the section named “[Hotclick Popup Menu]” and add the entry:

    Item, "Google Auto Translation"= Go to page, "http://translate.google.com/?hl=auto#auto|auto|%t"

  5. Save the file, restart Opera

Now simply select a word or phrase from the HTML document, right click and choose “Google Auto Translation”.

If you want to have the ability to translate the entire page, find the section named “[Document Popup Menu]” and add the following item:

Item, "Google Auto Translation"= Go to page, "http://translate.google.com/translate?hl=auto&sl=auto&tl=auto&u=%u"

A group of journalists, bloggers, professionals and creators want to express their firm opposition to the inclusion in a Draft Law of some changes to Spanish laws restricting the freedoms of expression, information and access to culture on the Internet.

Read the declaration here.

16 Nov 2009

Ride the Wave

Filled in: Mumble, tags:

I have just added a new page, which includes my first wave! I’m eager to see how this works. For this, I used wavr

12 Nov 2009

Just made

Filled in: Websites

kyriakochori

http://www.kyriakochori.gr

02 Jun 2009

Ding

Filled in: Mumble

One thousand spam blocked….. I love Akismet.

Bring it on, punk.

20 May 2009

XML serialization ouput my way

Filled in: .NET, tags: ,

The default XML serialization adds the xml header and a couple of namespace definitions – elements which aren’t always welcome. Here’s how to control the XML source.

Let’s start with a simple class called ‘Book’:

Public Class Book

    Public Title As String = String.Empty

    Public Sub New()
    End Sub

    Public Sub New(ByVal title As String)
        Me.Title = title
    End Sub

End Class

Our mini-project (in this case: a console application) should be able to create a new instance of the book class and serialize it:

Imports System.IO
Imports System.Xml
Imports System.Xml.Serialization

Module Main

    Sub Main()

        Dim book As New Book("XML Serialization")

        Dim result As String
        Dim serializer As New XmlSerializer(GetType(Book))

        Using writer As New StringWriter()
            serializer.Serialize(writer, book)
            result = writer.ToString

        End Using

        Console.WriteLine(result)
        Console.ReadLine()

    End Sub

End Module

The result looks like this:

<?xml version="1.0" encoding="utf-16"?>
<Book
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Title>XML Serialization</Title>
</Book>

Task #1: removing the namespace definitions

In order to remove the namespace definitions, we need to define a new set of namespaces and tell our serializer to use this set. We can do this by using the XmlSerializerNamespaces class. We need to add the following lines just after the XmlSerializer definition:

Dim nameSpaces As XmlSerializerNamespaces = _
    New XmlSerializerNamespaces()
nameSpaces.Add("", "")

and we also need to replace line 15 in the original code with the following statement:

serializer.Serialize(writer, book, nameSpaces)

This way our XML source becomes:

<?xml version="1.0" encoding="utf-16"?>
<Book>
  <Title>XML Serialization</Title>
</Book>

Task #2: Removing the XML header

Next thing on the to-do list is to find a way to produce a plain XML file without any definitions whatsoever. To accomplish this, we need to further modify our code and use the XmlWriterSettings class with OmitXmlDeclaration property set to true. Replace lines 14-18 with the following:

Dim settings As New XmlWriterSettings()
settings.OmitXmlDeclaration = True
settings.Indent = True

Using writer As New StringWriter()

  Using xmlWriter As XmlWriter = _
      xmlWriter.Create(writer, settings)

    serializer.Serialize(xmlWriter, book, nameSpaces)
    result = writer.ToString

  End Using

End Using

Our XML now becomes:

<Book>
  <Title>XML Serialization</Title>
</Book>

Task #3: adding our own namespace definition

Our final task is to insert our own namespace definition (and only that one). First thing to do is to instantiate the XmlSerializer with our own namespace. Then we need to add our namespace to our custom namespace list. Replace the serializer definition with:

Dim serializer As New XmlSerializer(GetType(Book), _
    "urn:our_namespace")

add change the nameSpaces.add statement with:

nameSpaces.Add("", "urn:our_namespace")

The last set of changes produce the following XML:

<Book xmlns="urn:our_namespace">
  <Title>XML Serialization</Title>
</Book>

There you have it.

02 Apr 2009

Back to school

Filled in: PHP, tags: ,

This entry is part 2 of 2 in the series Simple user authentication in CakePHP

I’ve got a couple of messages from [apparently] junior programmers regarding my previous post, so I decided to go back and explain some of the magic that’s happening every day inside Cake applications.

As you know (or should have known) Cake does a lot of magic behind the scenes, as long as we’re following some naming conventions. The developers prefer convention over configuration (via files), which may seem a bit restrictive for some, but, once you get used to it, you will notice that it speeds up things.

If you recall from the previous post, the User Model looks like this:

class User extends AppModel {
  var $name = 'User';

}

This class extends a class named “AppModel“, which in turn extends a class named “Model“. Therefore, each method described in the Model class is also available to the AppModel and (our own) the User class in turn.

Why did the developers go so far as to create two classes instead of one? Simply because they wanted to give us more flexibility. We have the option to create a class called AppModel and place that code inside the app directory like this:

/**
 *
 * Filename: /app/app_model.php
 *
**/
class AppModel extends Model {

}

Now, whenever you create this file, you can add your own custom functions, which will be available to all your models. The same goes for all your controllers, i.e. you can create a file named app_controller.php and place it inside your app directory, where a class named AppController will extend the Controller class.

In case you didn’t figure it out yourself by now, there is a file named app_model.php which Cake uses if you haven’t created your own (take a look at /cake/lib/model). Cake automatically includes your own app_model.php if you have one, or its own (empty) version if you don’t. Talking about some serious magic here!

In general, whenever your application runs, all requests are redirected to the index.php file, which in turn includes all necessary files. Cake examines your app directory and, if it finds files which can override its core files, it includes those files instead.

Finally, if you follow the naming conventions mentioned earlier, you won’t have to include anything in your files (there are some exceptions to this rule, if you need a certain level of complexity). For instance, if you name your model User, that model will be automatically available in your UsersController controller, simply by typing $this->User.

Catch you all next time.

31 Mar 2009

The Indie scene

Filled in: Mumble, tags:

For those of you (like myself) who have been hiding under your shell, there’s a whole world of games out there, away from the publicity lights. It’s the “Indie” (independent) scene, where small groups of people create wonderful games.

I was only aware of such groups thanks to Uplink, a hacker simulation game from Introversion (“the last group of bedroom programmers”). This unique game, with great plot and replayability managed to keep me in front of the computer for weeks.

Recently (read: 4 months ago) I was lucky enough to discover another great game: World of Goo from 2DBoy. The idea is to go from point A to point B, by building structures consisted of small balls (goo), which are interconnected. It’s a game certainly worth its money and, if you love puzzle games, you should certainly check it out.

World of Goo

About

Hey visitor. I'm a young (in the sense of "spirited") man living in Athens, Greece and I decided to setup this blog, in order to share my thoughts with you. Jump along and feel free to retort.

Contact

  1. (required)
  2. (valid email required)
 

cforms contact form by delicious:days