Wednesday, February 13, 2008

Design Patterns as Higher Order Datatype Generic Programs




Lately I was struggling with some other issues, that is why I'm updating my blog now with some older issues.

On 14 of November I went to the LHUG meeting to listen to the speech about Design Patterns as Higher-Order Datatype-Generic Programs. There is a video from this event. As always I asked some silly questions. The speech was excellent, but the best part was the beer after the event. I had an opportunity and pleasure to talk with Dr Jeremy Gibbons and discuss even more research that he did. As always beer conversation lead to the deeper thoughts about nature of programming languages. Enjoy the video.

Saturday, November 10, 2007

/. party




I went to /. party at Cambridge. Slashdot 10th anniversary party. Few geeks showed up, but quality not quantity that matters. It was awesome, and off course Cambridge is a beautifull city. Plenty of students, bicycles and beautiful buildings, excellent plays to live in. Cheers.

Sunday, September 23, 2007

haskell meeting




Last Thursday I went on London HUG meeting. There were two speeches, one about finger trees, and other about games in Haskell. You can see me on both videos. Cheers.

Wednesday, September 12, 2007

haskell on Mac




I have to take my words back in terms of edgy development on Mac, in respect to Haskell. Basically thru macports system it is possible to install Haskell in version 6.6.1 or even development version 6.7 witch is really edgy now. And it is as easy as on Linux:

sudo port install ghc

or ghc-devel for 6.7 version. I was really surprised when I find out that really cool package hoc. It was created for Haskell version 6.1, of course it works perfectly for my needs – you can use it with the newer version but you can only use procedures that existed in version 6.6.1, but it means that sooner or later I will face problems. Any way, be aware that macports will additionally install ncurses-5.6, gmp-4.2.1, perl-5.8.8, readline-5.2, ghc-6.6.1. Do you see what I see Perl, what is this guy doing here. It reminds me this RoR installation - it installs PHP and actually uses it to do configuration tasks; how weird is that? By the way Instant Rails is the most common way to install RoR on windows.

Going back to main topic installation of all GHC dependencies will take a while, so be patient. If you never wrote anything in Haskell be sure to see if GHC is really the thing that you want. Basically majority of programs written for HUGS will not run on GHC and vice versa. It reminds me (again) about scheme, if you use guile your programs will probably not work on MIT/GNU Scheme or DrScheme. You will have to modify your code. Oh, well - life is taft.

But again don't you feel that it is sad. You program in a language that is understood only by a few, and you are unable to share it with all of those who understand it?

Saturday, September 8, 2007

Mac the return




I‘ve been trying to configure Mac for the last few days. I‘m in a middle of the python development and I had to install py-unit on Mac, and then integrate it with Eclipse. There is a darwin port of py-unit so I did a little research to find out what is the difference between fink and darwin. The only think that I can say is that it worked. PyUnit is running fine.

For some time on I was willing to give a git one more shot. Last time when I tried it (1.5 year ago), I did not enjoy it. It just didn't suit my needs. To be honest I did not spent too much time then to read about all the benefits that it brings. Few days ago I finally managed to watch Linus speech at dev days about git. Linus made some strong point, and I totally agree with him there, but also this speech did not answer few questions: why git merge code so well, why does it better than subversion. Also a thought about SHA1 was really interesting, I am not a security guru, I have a very basic knowledge about that, but I enjoy math and I spend a lot of time researching math issues, any way Linus said that SHA1 is the best hash that is available on a market. That's interesting, why is that? I have to do some bigger research on that subject.

I don't think that distributed source code management systems (SCMS) is something that I need now - working on my own projects, or with a few friends, but in the old days (when the Earth was young, and mountains small) it was just a thing that I would needed. I was most curious to find out how branches and merges are implemented in git, how many tools support it (plugins, GUIs and so on). I am using a subversion to run my local projects, I thought that it would be a good idea to use both SCMS systems at this same time, cause it will give me some picture witch one is faster, easier to do simple stuff, and more advanced ones. To install git on Mac:


curl http://kernel.org/pub/software/scm/git/git-1.5.0.5.tar.gz -O
tar -zxf git-1.5.0.5.tar.gz
pushd git-1.5.0.5
make configure
./configure --prefix=/usr/local
make all
sudo make install


Then add to .profile file:


export PATH=${PATH}:/usr/local/bin



Simple, but still I would prefer to use fink or darwin ports, unfortunately I did not find git project in those repositories.

There is a dmg for subversion
. Unfortunately current version of subversion is 1.4.5 and mentioned dmg is for version 1.4.4, but still it is not that bad. In order to run svn you have to add /usr/local/bin to your PATH, just like it was done fore git. In other words if you done it for git you don't have to do anything, but if you are reading this article to configure subversion on your Mac be sure to do this also.

If you are looking for a GUI for subversion to run on Mac be sure to try svnx. It is really simple to create a repository in svn, and to add an existing project to it.


svnadmin create /Users/sagasu/worek/subversion/repositories/myProjectRepository
svn import /Users/sagasu/workspaces/workspace/myProject file:///Users/sagasu/worek/subversion/repositories/myProjectRepository -m "initial import"


to use git is also easy, but I was only able to create a repository in a path above source that I wanted to add. I spent some time trying to figure out if I can create a repository anywhere I want, I did not find this information.


git config --global user.name "Your Name"
git config --global user.email my@email.com

git init
git add .
git commit


And we are ready to rock and roll.

Saturday, September 1, 2007

Some thoughts about Mac




I've been playing with my new Mac for the last few days. I've been really surprised. I thought that it will be much easier to do all this stuff that I do on my Ubuntu. Unfortunately it is not. I've been trying to run pygames cause lately I've been adding an Arabic language support to one of games that runs on that engine. Guess what? By default Mac ships with python version 2.3, this is so old. Now days we have version 2.5. It's getting even worst, I would like to upgrade my python to never version, but there is no package management system that would be up to day. There is fink but it doesn't have a new python also. I was able to find .dmg for python 2.5 and it installed without any problems. Unfortunately to run pygame you need to take care of some dependencies - PIL, SDL, PyObjc and so on, because there is no package manager I had to surf thru the web and find all the packages by hand. Good news is that they worked - installed without and problems. Then you have to compile pygame by hand - it reminds my of GNU/Linux 10 years before, I had to do exactly this same. I've compiled pygame by hand cause I wanted to run on python2.5, there is .dmg for pygame working on python2.4. To compile by hand I had to find source code, find dependencies, and compile just to find out that I've missed some dependencies. Dependencies have dependencies and this cycle never ended. Let's face it this sucks. Not many people use pygame so I thought that I could install eclipse here. So again I've checked the Java version - 1.5.0_07, but I would like to have 1.6 update 2, unfortunately this version is not ready for Mac. What about Jave EE, it's getting even worst, forget about it! There is no way I'm going to play with different frameworks on Mac cause everything here is just a pain in the ass, from the easy development point of view. I understand that it is fun to program on Mac in Haskell, SML or hacking RoR but I just can't see how to develop some java apps on new engines (I mean edgy). Mac has also a good side, I truly enjoy all the gadgets, iLife set - not including iTunes - I prefer Amarok - and again trying to make it work under Mac is painful. I really think that Mac is a good environment for desktop. It has MS Office (the app that I miss on Linux), and all this apps for movie, music and picture gameplay. And everything looks nice, and works out of box (I mean camera, Skype ...).

Conclusion. I'm going to install Ubuntu as my development system and use Mac just to play with my pictures and movies. I hope that in the next 3-5 years Mac will be ready for up to date development (edgy). Well it is ready to up to date development if you like to spend a lot of time trying to compile things, or developing on Windows is a thing that turns you on.

I've played also with dual boot. It is really easy to run Windows on Macbook Pro, but here goes the real problem - overheating. When I started an app that uses plenty of CPU resources on Windows I was scared almost to death. Macbook was so hot and fans were running really fast and really loud but were still unable to cool the darn thing down (temperature over 70° C). I've heard recently on /. about Macbook that catches on fire and burned a house. This is an extreme but it made me thinking how gamers can use Macbook pro, I just can't imagine running WoW for more then 2 hours and still be brave enough to keep it going. Don't get me wrong, the machine will hold it for more then 2 hours I'm just concerned how long will it take till something will really brake down. Macbooks are pretty expensive and I would be really sad if I would overheat my box and had to replace motherboard and CPU for a new one. I would have to think about some system (system of fans or cold water) to dock my Mackbook. This system would have to cool it down. As for now I will try to not overheat it.

Overheating is not a new thing to Apple; do you remember firmware updates last year? I thought that from that time on Apple would be more serious and cool laptops better, but as far as I can judge “it is not like that”. I’ve been interested how hot are apple products developed for a desktop use. Do they get so hot also? I’ve read on blogs that gamers don’t have problems in running games on non laptop machines, but they are not saying if the cover is hot or not. Especially I’ve been interested in the newest product.

To sum things up I would like to say that I truly enjoy hacking this system. It is a fun thing to do when you return to your home after work. Just like in old days, so many things to discover, and so many paths to take. I feel like I’m young again.

Friday, July 27, 2007

World is full of bugs




It happens to me pretty often. I'm up to something. Doing some research, playing with a new technology or just using a system that should work. And then when you really need something, you find out that that feature is buggy. In my flat in London I'm using D-link router to connect to the internet. I'm using a WiFi connection, with mac address filtering. My D-link router looses (somehow???) a safe list. The list of mac addresses that should be allowed to use WiFi connection. Then you have to go to router, connect to it by cable and re-add your mac address to the safe list once again. Sound simple, unfortunately there is a problem. The problem is called software bug, or laziness. I'm using web interface to configure my router. Unfortunately software that runs there was written to support only IE, in some cases. And this part is really interesting, cause majority of functionality is working under Firefox, Safari or you call it. Unfortunately not the functionality responsible for the modification of the safe list. Operating systems that I hold on my computer change in time (always doing something). Sometimes I have a working version of windows sometimes I do not. The only operating system that is working all the time is my Ubuntu. I was trying to use IE for GNU/Linux to modify the safe list, and it worked. I would not be myself if I did not write software that would run not only on IE but also on other thin clients. First thing to do is to see what the problem is. Firebug showed me that javascript engine can not find any element by it's id:


function jslSetValue(variable,value)
{
document.getElementById(variable).value=document.getElementById(value).value;
}


I've search the web to find out if somebody had already reported D-link with the problem, or did D-Link created any software update for that router model. I did not find anything. I've reengineered JavaScript that is used in that web interface and I've send it to D-link, maybe they will use my code instead of the current one. Now don't laugh I always send corrected code to the producer, unfortunately not very often I receive any reply. I can even bet that D-Link is not going to do anything with my code, they will just /dev/null it. But if even one per 20 companies that you send a code to will replay and thank you it is worth a try. If you face this same problem as I do there is a more simple way to quick fix your problem. After loading "Wireless Management" page just type in your URL:


javascript:document.forms.uiSetForm.uiPostAddMacAddress.value="00-1b-77-27-ca-72";


where 00-1b-77-27-ca-72 is your mac. And hit enter. Then hit history.back button in your browser. Then click "Add", now you will notice in a JavaScript console that there are bugs on the page, then click the "Apply button". Vuala your mac is added.

For smart ones, don't try to use 00-1b-77-27-ca-72 mac near my flat, it won't work cause it is just an example, I don't use it.

There are some interesting things about this particular pice of software. You may say that it is not a bug but producer simply just not want to support anything else besides IE. If it is true then why did they write JavaScript so some functionality will work on Firefox and some will not? Next interesting thing is the design. You probably noticed that they extracted some very simple logic into separate functions. I truly enjoy that. It also means that somebody did either a good design or refactored that software in a really nice manner. Why then he did not check if all the functionality works on different then IE thin clients? I'll never known. Whatever guess I'll take I'll still be just a child living in the big world. The world that I can never truly understand.