TortoiseHg Directory Lock

Today I’m just happened to start coding again after a long hiatus. And suddenly, tortoisehg is stuck and hg gave me “waiting for lock” message when I try to commit. I’m using tortoisehg 2. Here is the workaround I found:

Delete the

.hg/wlock

file in your working directory.

It works, although I don’t know whether it’s safe or not.

PHP json_encode and jQuery json

Ajax requests using jquery is pretty easy. All you have to do is to specify the URL for request, data sent along with the request, the data type returned, and the callback function. I choose datatype json because it’s much easier to modify with javascript. Here is the example:

Your PHP script, located at http://your/url/to/php/script/:

<?php
$array = array(
  'name' =>; 'alex',
  'fruit' =>; 'apple'
);
echo json_encode($array);

Your javascript Script, with jQuery supported:

$.get(
  'http://your/url/to/php/script',
  {your: data_to_send}, // ignore this for now
  function(returned_data) {
    //do something with the data returned
    console.log(returned_data.name); // will output 'alex'
    console.log(returned_data.fruit); // will output 'apple'
  },
  'json'
);

It won’t output anything on the page, but in the Javascript console instead. Firebug and Webkit-devtool users can see the console output using the “Inspect Element” tool. As far as I know, IE8-9 also has developer tools (press F12), as well as Opera Dragonfly.

Saboteur – by me

Saboteur

Actually this is the main purpose which takes my time so I almost has no time to post (not even have a holiday). This game is my final project for my pre-graduate study. It will be hosted on http://saboteur.arkross.com.

For those who haven’t heard of this game, I’ll give you a quick explanation. It’s a mining-themed card game. The players make a path at each of their turns, until they find the gold, or until the deck is eaten up. The full guide is here.

Okay, back to topic. The rules isn’t important here. What I want to say is, I’m remaking this card game using web application – or in another word, a Web Game. After some time I spent on researching, I found that almost every popular web game is based on Flash. The problem is, I don’t know much about Flash. Something inside me is protesting: Why Flash when there’s Javascript? (I don’t know why I’m such a pro to Javascript, but that’s me).

And my stubbornness leads me to Ajax. An ordinary ajax technique won’t be sufficient, I need Ajax Polling technique. According to my research, the true Ajax Polling is one of the technique which is called Comet Programming. What the hell is that? Well if I know, I would not be so confused doing this project.

So far about my project, I’m using CodeIgniter 2.0.2 (and I will continue updating it), jQuery 1.5.2 (always updated), and some CI Libraries. I hosted my project on Github. If you want to check just stop by.

HgIgnore for PyroCMS

TortoiseHgPyroCMS
PyroCMS bundle includes .gitignore file. But since I’m using TortoiseHg, I need to find an .hgignore equal for it. Here is what I translated from .gitignore:

glob:.DS_Store
glob:.buildpath
glob:.project
glob:.settings
glob:system/pyrocms/cache/*_m/*
glob:system/pyrocms/cache/*_lib/*
glob:system/pyrocms/cache/dwoo/compiled/*.php
glob:system/pyrocms/cache/simplepie/*.spc
glob:system/pyrocms/cache/twitter/*
glob:system/pyrocms/config/database.php
glob:system/pyrocms/logs/log-*.php
glob:nbproject/*
glob:uploads/*
glob:documentation/*

Hope it’s useful for PyroCMS users who uses TortoiseHg. Enjoy!

[Linux] Setting Permissions on ntfs-3g Disks

If you’re originally a Windows user and going to migrate to Linux, you may still want to use your data formerly on your NTFS harddisk. This is my experience using Kubuntu 10.04, migrating from Windows XP. Please take note that the word ‘migrating’ here does not mean I delete my Windows OS. I’m just doing dual-boot. Continue reading “[Linux] Setting Permissions on ntfs-3g Disks”

Perceptions and Judgement

This is just a note summarizing a lecture. I found this topic interesting and useful, so I dig more.

As we’ve known well, humans make decisions by how they perceive, which is influenced by the events, people, and things around them. Generally humans cannot see something as a whole thing – they just know some part of it.

We don’t see things as they are, we see things as we are.
Continue reading “Perceptions and Judgement”