
Friday, December 4th, 2009
I was browsing Chris Langan’s website (he’s literally thought be the smartest man in the world with an IQ of around 200!) and this made me chuckle. I guess it really does happen to the best of us.

Makes me feel better in a shallow sort of way but at the end of the day I still know my place. If you do ever read this, sorry Chris! While you’re here could you tell me something that has puzzled me; why do some guitar riffs sound better than others, even if they are simpler. Is it all just opinion or is there a cause?
Anyway my point of dwelling on this is paradoxically to make the point that there is no point dwelling on these type of things, making a mistake doesn’t mean you’re stupid.
No Comments
Posted by kzar in Uncategorized 

Friday, November 13th, 2009
If the Magento path changes everything breaks, here’s how to fix it:
Run this query in your Magento database:
update core_config_data set value='http://new-url.com/' where value='http://old-url.com/example/';
and delete your cache
rm -r magento/var/cache/*
No Comments
Posted by kzar in PHP 

Monday, August 3rd, 2009
I’m still reading Eternal Golden Braid, I have been on and off for maybe a year now and every few chapters gives me enough to ponder for a few months. I’m sure it’s part of the reason I’m so absent minded and mumbling to myself sometimes. Anyway here are a couple of thoughts I had.
The first was about chess. I always used to like chess, I thought it was a fun game but that was until I started to program. After coding for a while and learning how the various chess computers worked by bruteforcing the game I could only think of chess in those terms, as an amazing number of possible combinations that I was too small minded to hold in my brain. When you think of chess like that it seems pointless, I was saying to myself “There’s a move here which is perfect but I can’t see that far ahead, I’m just guessing”.
Anyway I’m happy to say I no longer think like that, if you read the book he explains how everything is made up of low level parts but there can still be meaning on a higher level. The example he gave was an ant colony, although made up of mindless ants functioned as a pretty advanced entity. You could say “Bah! It’s just a bunch of ants” but that would be ignoring what the colony achieves as a whole. Now I think although chess is ultimately made up of all these combinations of moves you can still think of it in higher terms like attacking that area of the board or protecting your queen. Suddenly it’s fun again!
The second thought I had involved the clash between logical people and for lack of a better term hippies. (Now depending on who you ask I fit into both groups so maybe I have a good insight.) Anyway I noticed how ‘hippies’ always came out with all this crazy crap about meditation and relaxing or not worrying and most logical people would just write it off immediately. The problem was that although a lot of the things they said where illogical, it seemed to work, they where relaxed with good posture and a positive happy frame of mind.
Now obviously excessive computer use plays a part in bad posture and illicit drugs might play a role in a happy frame of mind but there is still something there. I gave this a lot of thought and whilst reading the book I came to a realisation. When reading the example Kōans like “If you call this a short staff, you oppose its reality. If you do not call it a short staff, you ignore the fact. Now what do you wish to call this?” your immediate reaction is to reject it. The problem is if it leads to enlightenment maybe it’s worth dwelling on. I suspect the reason is you need something illogical to stop the recursion in your brain, you’re constantly thinking about thinking about what you just thought about and it’s impossible to get any peace. Although the Kōan is ovbiously junk if taken literaly I think it helps you focus your mind away it can help you relax and could be a worthwhile thing. So I guess my point is maybe there is real value behind this stuff even though it ’sound stupid’ maybe it’s not wise to judge so quickly. Maybe the logic is that there is no logic, maybe you can be a hippie with an analytical mind.
I can’t recommend the book enough, it has helped me understand a lot of things like this that have bugged me for a long time. I’m going to work through it several times until I understand every last bit.
No Comments
Posted by kzar in Thoughts 

Sunday, August 2nd, 2009
If you recently upgraded to Emacs 23 from Carbon Emacs on your Mac you might have found all the control keys are bound wrong. Anyway it’s easy to fix, add these lines to your .emacs and restart Emacs.
; Setup the Mac keys
(setq mac-option-key-is-meta nil)
(setq mac-command-key-is-meta t)
(setq mac-option-modifier nil)
(setq mac-command-modifier 'meta)
(global-set-key (kbd "<kp-delete>") 'delete-char)
No Comments
Posted by kzar in Emacs 

Tuesday, July 14th, 2009
I coded a basic captcha for my web.py form, here’s how:
First I made a function that generates an image and returns it + the code (yea yea it’s a mess)
Now here’s snippets of web.py code:
Also to make the form look prettier I modified web.py to give the table rows an id and then used css to alter their padding etc.
Sorry I didn’t take much time over this post, hopefully the code will get you started though, Dave.
2 Comments
Posted by kzar in python 

Friday, July 10th, 2009
If you want to follow the web.py tutorial using sqlite here’s how:
Line for your python to connect to DB
db = web.database(dbn='sqlite', db='testdb')
To create the database type
sqlite3 testdb
and input this SQL:
CREATE TABLE todo (id integer primary key, title text, created date, done boolean default 'f');
CREATE TRIGGER insert_todo_created after insert on todo
begin
update todo set created = datetime('now')
where rowid = new.rowid;
end;
Now create an entry with this SQL
insert into todo (title) values ('Learn web.py');
Finally quit sqlite3 when your ready by typing
.quit
No Comments
Posted by kzar in python 

Friday, July 10th, 2009
So I decided to learn Python and Django in the hopes it would be a half way house between PHP and Lisp, letting me actually get stuff done whilst not being PHP.
My first impression of Django has been pretty bad, I bought the ‘definitive guide’ book only to find it was not so much definitive as obsolete. Also the amount of arbritary seeming magic didn’t impress. Having said that I have passed through that and I’m beginning to get the hang of it.
Python on the other hand was different, to start with I HATED the look of the code compared to Lisp but after a few hours hacking it doesn’t seem that bad. For my first program I decided to solve this little puzle. This great guide got me going quickly and along with a few small pointers from verte in the friendly seeming #python I came to a solution.
It didn’t take long, the code looks nice and most importantly I enjoyed writing it. I’m pretty impressed!
No Comments
Posted by kzar in python 

Saturday, July 4th, 2009
If you use dired-do-query-replace-regexp to replace things in read-only files the bell will sound and the batch replace will stop. Here’s a quick workaround, cheers to bojohan in #emacs for helping me with this:
M-x set-variable RET inhibit-read-only RET t RET
Then do your replace again and finally set the variable back to nil again!
No Comments
Posted by kzar in Emacs 

Saturday, July 4th, 2009
I was having a problem on my macbook that I had to login every time I wanted to save or open a new file through Tramp. The weird thing was that tab completion only required me to login once.
Anyway I got to the bottom of it, just add this to your .emacs:
(setq tramp-default-method "ssh")
No Comments
Posted by kzar in Emacs, Mac 

Tuesday, June 23rd, 2009
If you are having problem getting the darwinport of meld running on your mac try these two commands before running the program again.
sudo launchctl load -w /Library/LaunchDaemons/org.freedesktop.dbus-system.plist
sudo launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist
The error I was getting before was this:
Xlib: extension "RANDR" missing on display "/tmp/launch-RsRIqw/:0".
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
Traceback (most recent call last):
File "/opt/local/bin/meld", line 109, in <module>
meldapp.main()
File "/opt/local/lib/meld/meldapp.py", line 855, in main
app = MeldApp()
File "/opt/local/lib/meld/meldapp.py", line 528, in __init__
self.prefs = MeldPreferences()
File "/opt/local/lib/meld/meldapp.py", line 465, in __init__
prefs.Preferences.__init__(self, "/apps/meld", self.defaults)
File "/opt/local/lib/meld/prefs.py", line 91, in __init__
self._gconf.add_dir(rootkey, gconf.CLIENT_PRELOAD_NONE)
glib.GError: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details - 1: Failed to get connection to session: Not enough memory)
</module>
No Comments
Posted by kzar in Mac 