Tuesday, June 22, 2010

#quake #sdl on #haikuos

wget http://www.libsdl.org/projects/quake/data/quakesw-1.0.6.tar.gz
wget http://www.libsdl.org/projects/quake/src/sdlquake-1.0.9.tar.gz

tar -x --strip-components=1 -f sdlquake-1.0.9.tar.gz
tar -x -f quakesw-1.0.6.tar.gz

wget http://gist.github.com/raw/448637/e43f70ff6e6e7bbdac1a26b4b0886d162a1ab7a2/sys_sdl.patch

wget http://gist.github.com/raw/448609/d077f11f4cb72e0044773bda2ce1a921389f508d/net_udp.patch


patch -p1 < sys_sdl.patch
patch -p1 < net_dgrm.patch
patch -p1 < sys_sdl.patch

./configure --host=i686-beos

or you can enable asm optimizations too if you want so

./configure --host=i686-beos --enable-asm



Bellow is why i needed the patches and what they do

first i had this error
sys_sdl.c:16:21: error: sys/shm.h: No such file or directory

deleted the line with

#include sys/shm.h

I have reviewed the udp patches from native client to disable udp related communication

My next patches will be the ones with audio to make it usable and also the network should be reenabled somehow 

Question on #HaikuOs: why are my Alt and Control keys switched in functionality?

Answer is from #haiku irc channel archive ~ [21:22:22] :
MacOS heritage.. inspect a classic and modern Mac keyboard
Command keys where Alt is usually found on a PC keyb
BeOS keymap emulated a Mac keyboard using a PC keyboard
you can switch them if you prefer Ctrl as your shortcut key:
preferences/keymap there's a big button

Sunday, June 20, 2010

Firebird Database Porting progress on haikuos

Firebird Database Porting progress on haikuos

I have defined the platform first to be linux but there are big issues there so next one that i copy pasted is from NetBSD in configure.in

    AC_DEFINE(NETBSD, 1, [Define this if OS is Haiku])

There there are some issues with the ntpl ( posix with pthread but without ntpl ) this is why o get undefined reference to `___tls_get_addr'

/*Thread bug on haiku os */
#undef HAVE___THREAD

next thing that is missing

POSIX specification: http://www.opengroup.org/susv3xbd/sys/shm.h.html

Portability problems not fixed by Gnulib:This header file is missing on some platforms: mingw, BeOS.

g++ -I../src/include/gen -I../src/include -I../src/vulcan -DNAMESPACE=Vulcan -O -fno-builtin -DNDEBUG -pipe -MMD -fPIC  -DBOOT_BUILD  -c ../src/jrd/os/posix/isc_ipc.cpp -o ../temp/boot/jrd/isc_ipc.o
../src/jrd/os/posix/isc_ipc.cpp:94: error: 'siginfo_t' has not been declared
../src/jrd/os/posix/isc_ipc.cpp:127: error: 'siginfo_t' has not been declared
../src/jrd/os/posix/isc_ipc.cpp: In function 'bool isc_signal2(int, void (*)(), void*, ULONG)':
../src/jrd/os/posix/isc_ipc.cpp:186: error: 'struct sigaction' has no member named 'sa_sigaction'
../src/jrd/os/posix/isc_ipc.cpp:187: error: 'SA_SIGINFO' was not declared in this scope
../src/jrd/os/posix/isc_ipc.cpp:193: error: 'struct sigaction' has no member named 'sa_sigaction'
../src/jrd/os/posix/isc_ipc.cpp:199: error: 'struct sigaction' has no member named 'sa_sigaction'
../src/jrd/os/posix/isc_ipc.cpp: At global scope:
../src/jrd/os/posix/isc_ipc.cpp:347: error: 'siginfo_t' has not been declared

so i might need to study more about it

System calls from a user program are made in the traditional UNIX way of trapping into the kernel and then jumping to the real code. Since the only way a user program can get into the kernel is via a trap, our kernel is more robust because an errant or malicious program can't just jump into random kernel code and cause damage. The overhead to make a simple system call is quite low, coming in at just over three microseconds.

The mechanism for IPC in UNIX is traditionally through a pipe or the System V shared memory and message routines. The main mechanism for IPC under the Be OS is through named message ports that have a queue for incoming messages. Be message ports are unidirectional, and the incoming queue is limited in size to prevent run-away processes from gobbling all of system memory. We also support shared memory through the create_area() and clone_area() system calls, which allow one process to create an area and another to obtain a mapping to that area. The higher-level library code uses both message ports and shared memory to enable communication between threads in different teams.

Friday, June 18, 2010

Tips for building #qt 4.7 and #AroraBrowser on #HaikuOs

Install qt 4.5 (needed for qmake and other devel tools)
then checkout qt 4.7 from gitoriuous
and configure it without phonon , without inconv (it crashes otherwise) and other crap like qt3support (you don't need it)
I wonder if i need to enable qt png

git clone git://gitorious.org/+qt-haiku/qt/qt-haiku-port.git

cd qt-haiku-port

~/qt-haiku-port> configure --prefix-install=no -no-pch -debug -opensource -confirm-license -no-largefile -qt-libjpeg -qt-libtiff -qt-libmng -qt-gif -no-qt3support -no-opengl -no-phonon -no-phonon-backend -optimized-qmake -fast -nomake examples -nomake demos -no-iconv -no-svg -no-ipv6 -no-ipv6ifname -no-multimedia

make install

then the same for
arora browser

git clone git://github.com/Arora/arora.git

cd arora 

Wednesday, June 16, 2010

rails on haiku os

install ruby 1.9 with haikuporter

haikuporter -i ruby

gem update --system
gem install rails

rails foobar

cd foobar

StyledEdit ./script/server

replace the first line with


=> Booting WEBrick
=> Rails 2.3.8 application starting on
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2010-06-16 19:09:09] INFO WEBrick 1.3.1
[2010-06-16 19:09:09] INFO ruby 1.9.1 (2009-07-16) [i586-haiku]
[2010-06-16 19:09:09] INFO WEBrick::HTTPServer#start: pid=129249 port=3000

sqlite doesn't load of course

strace is very nice on haiku

try with strace ruby

Monday, June 14, 2010

PHP Fragment Cache - an introduction

I love this quote from the following article (see at the bottom part)

"Treat every optimization task as if John Miles has just written to inform you that he’s made it faster than your wildest dreams, and you’ll be amazed at what you can do!"

So if web caching is not an option, what is the next best thing? To cache parts of the page, put them together, and serve that. You can use a caching tool for this, like Memcached. There's only one catch: the cached content may need to change when any of the things it depends on changes: data, code, user input, and the like. You can pass an expiration time when you add your content to Memcache. This will cause your cache to live only a certain amount of time and then expire. Nice, but we can do better.

This article will introduce you to that powerful new form of website speed optimization called Fragment Caching. It builds upon ideas used elsewhere to make the technique even more powerful. A PHP implementation is available for download.

Tips for building Arora / Qt on Haiku OS

Install latest qt for haiku from http://qt-haiku.ru/index.php?option=com_rokdownloads&view=file&Itemid=60&id=65:qt-4-5 then set the gcc version to 4

git clone git://github.com/Arora/arora.git
cd arora
setgcc gcc4
check to be 4

g++ -v

make -j2


seems there are some issues with png files on haiku alpha2 and with
gmail logging but i will install qt 4.7 from git and rebuild arora

libpng warning: Incompatible libpng version in application and library
libpng warning: Application was compiled with png.h from libpng-1.2.40
libpng warning: Application is running with png.c from libpng-1.4.1

Sunday, June 06, 2010

playing ogg with SDL and freepascal

I have found this example for playing wav/ogg with sdl mixer using the pascal language

on ubuntu debian all you need is fpc/lazarus and then
install libsdl1.2-dev headers and shared library

sudo apt-get install libsdl1.2-dev
also you need the mixer

sudo apt-get install libsdl-mixer1.2-dev

wget http://www.freepascal-meets-sdl.net/seiten/kapitel/kap7/chap7.pas

fpc chap7.pas

also you need the samples
In my mind.ogg and dial.wav


some new errors with karmic install under virtualbox 3.2.0 (debian sid 32/64)

I have noticed that there are some errors with the ubuntu install process under virtualbox , be it if is on 32 bit debian or 64 bit ones the errors are the same if you do the live cd and then install, I have reproduced the bug on 2 sid machines already , and the progress bar goes over 125%

Friday, June 04, 2010

Firebird saga continues What community did without the need for Interbase name and Inprise help

yes is that time when you start digging the Firebird/Interbase history and find the old building tips and source code overview and the battle between community and the corporate brainless drones aka : Inprise at that time : Read InterBase Saga Continues article to see how short minded they were by retreating in the Closed Source Cave

Here is how it was the situation in A.D. 2001

At this time, although the latest source code and CVS tree have been released, some key pieces are still being held by Inprise. These include:

  1. release notes

  2. build instructions and makefiles

  3. build documentation including known bugs list.

  4. the testing suite

  5. the InterBase name

A key issue for the community is the ownership of the documentation. Inprise is the copyright holder to the original documentation, But ISC had commissioned an outside company to update the documentation in anticipation of being transferred the copyright. According to Paul Beach, who was appointed VP of sales and Marketing at ISC, the new documentation is not 'derivative' enough (over 30% different) to allow them to release the new version without violating Inprise's copyright.

Well i will start with bottom up what community did all these years 2000 -> 201x
5. Interbase name : Firebird name is better than InterBase name and Firefox name
4. Testing suite : Is better than original and is written in Python , easier to parse and write for the brain
3. Building is easy these days and is packaged for major linux distros and compilers g++, vc++
2. On my linux i just type ./configure ; make ; make install so all is done for posix systems , win32/64 ok ok we don't have an HaikuOS port but that is easy :)
1. Release Notes : We have plenty

So in the end community filled all the missing gaps and it will finish the All the documentation too , It was a strategic mistake to ignore the community and the power of open source

Wednesday, June 02, 2010

Rails tip : joins without associations between models

seems that is possible to create complex joins with no associations between models
first i have tried to use the table name in the :joins/:include parameters area (see the Eager loading of associations in Active Record doc)

conditions[:joins] = "comments"

but doesn't work if there is no association between the model and even if is trough another table/model it doesn't work like i expected
so the solution is to add another join expression in the conditions arguments

conditions[:joins] = "LEFT JOIN comments ON comments.post_id = id"

and then you can filter on comments content or id

conditions[:conditions] ="comments.id=#{some_comment_id}"

then filter the model and use the results

Blog.all conditions

ubuntu 64 Not recommended for daily desktop usage ?

Common get real , i use ubuntu 64 on the desktop from the first version
and that was the main reason i installed it on the athlon64 box instead of debian at that time (there was no almost stable 64 bit installer or live cd with installer option)
I think the page should encourage 64 bit users not avoiding them , also i think the Windows Installer is NOT stable and usable
try to do some kernel upgrades and you will see the results.
In Fact 64 bit version is faster than the 32 bit one