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

http://gist.github.com/raw/448637/e43f70ff6e6e7bbdac1a26b4b0886d162a1ab7a2/net_dgrm.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

make

./sdlquake


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


  *-*-haiku*)
    MAKEFILE_PREFIX=netbsd
    PLATFORM=NETBSD
    AC_DEFINE(NETBSD, 1, [Define this if OS is Haiku])
    EDITLINE_FLG=N
    SHRLIB_EXT=so
    ;;


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
sys/shm.h

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
make install

then the same for
arora browser

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


cd arora 
qmake 
make 
 ./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

#!/boot/common/bin/ruby

./server
=> Booting WEBrick
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
=> 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
then

make -j2

./arora

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

./chap7

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

Monday, May 24, 2010

hey stupid it's the sql and is better when it's free like free s_x

google allows you to use sql now but only for enterprise
you know you can build a simple machine with firebird sql and deploy it on amazon ec2
or in your private cloud for free , in fact you can build an infinity of machines and use a better framework than the one from google and i talk about django and you don't need their restrictions
ahh and for the java is the same , use tomcat (jruby) -> firebird + s3 and seems that is better for the long term than what google allows you for a premium price

Friday, May 21, 2010

When frameworks do fail use sexy sql

Imagine this scenario : is x AM in the morning your preferred framework model is starting to fail (Ruby On Snails )
Active Record model stinks when you start using multi monster joins so you got to stick with the old sql skills
something like ActiveRecord::Base.connection.select_all("select id from restaurants order by popularity limit 100")



and this will help even when at the same time when heroku rake db:migrate fails
what to do ?
$heroku console 
and start writing sexy sql statements like
>> ActiveRecord::Base.connection.select_all("ALTER TABLE xxx ADD COLUMN xxx_id integer")
>> ActiveRecord::Base.connection.select_all("select xxx_id from xxx order by xxx_id limit 100")

Tuesday, May 18, 2010

A weekend with Active Record and _why ruby guide

This weekend was dedicated to ruby and to other activities but specially in the programming field it was all about _Why guide (I have finished chapter 3 ) and A Guide to Active Record and if you really want some really cool hacks in firebird sql here is the XML Generator – Stored Procedure for Firebird (Portuguese)and that made me think why we don't have asXML/asJson in the Firebird engine directly ?
-Maybe because in Delphi we had asXML with no real work to be done on the engine part

Friday, May 14, 2010

Day 2 on Debian - Revenge of the Squeeze on eeePC 1005p

in day two i have installed debian with usb image on eeepc
first i tried to use the lxde eeepc image but the kernel was a little bit older and it
wasn't recognized so i found that the best way is to install squeeze on it
and wireless works without issues and without the ndiswrapper! like is on ubuntu but i don't use encryption at home, only the trackpad does't quite respond to double click but i will find a solution to that
also the installer asked me the ESSID for the network while installing it over the wireless network it didn't detected the networks from around
Here is the obligatory screen shot and of course i will be evil and upgrade to sid . It doesn't look to bad isn't it ? and gnome is not so butchered by ubuntu people , yes it does come with epihphany browser and iceweasel

Thursday, May 13, 2010

Firebird documentation building (html/pdf) howto on Ubuntu Lucid Lynx or Debian

I always need to remember howto build the firebird documentation on my ubuntu/debian machines so i decided to
write a minihowto inspired by the great document Getting and building the Firebird manual module

mkdir firebird_doc
cd firebird_doc/
export CVS_RSH=ssh
cvs -z3 -d:ext:mapopa@firebird.cvs.sourceforge.net:/cvsroot/firebird co -P manual
cd manual

or you can checkout anonymous mode from sourceforge's cvs repository
cd lib/
cat _readme_libs.txt
wget http://www.firebirdsql.org/doclibs/ALLJARS.ZIP
unzip ALLJARS.ZIP
cd ..
cd tools
cat _readme_tools.txt

wget http://www.firebirdsql.org/doctools/docbook-dtd.zip
wget http://www.firebirdsql.org/doctools/docbook-stylesheets.zip
unzip docbook-dtd.zip
unzip docbook-stylesheets.zip
cd ..
Install jdk

sudo apt-get install openjdk-7-jdk

On debian is in non-free repository and must be added to apt/sources.list

Check the jdk content
dpkg -L openjdk-7-jdk
on Ubuntu
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64/
on Debian sid (unstable)
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/


cd src/build
./build.sh html
./build.sh pdf
At this point you should add some nice rendered documentation in pdf or html format

cd ../../dist/html/

google-chrome ./index.html

there are some interesting files that are not yet on the main website so is good to dig around
something like isql-fb manual or the vpn guide


Lxdebian is not for average people - Day one of pain

first nvidia proprietary drivers must be installed manually and then
if you get some errors with the debian way (i have tried to compile / use the nvidia driver that comes in testing) then the alternative is to upgrade to unstable "which contains the current drivers series" so you better replace in apt/sources.list the testing/squeeze word with unstable or sid like this


and
apt-get update
apt-get dist-upgrade

you can read more instructions on nvidia/debian wiki page.

Also i had some errors about the GTK+ icon set in squeeze and lxde setup but i hope they will disappear after squeeze -> sid upgrade


ps:what is wrong in debian by default?

1.exim by default
2.portmap, rpc.statd are started by default they should be removed by default
3.openoffice by default in lxde install image
that is huge i think some packages and themes from lubuntu should be added by default
like gnumeric, chromium ,abiword , pidgin but please avoid the bloatware like openoracleoffice
4.why i'm not in the list of sudoers by default? , also i don't need to know my root password if i create a admin type of user anyway

Debian LXDE and faster systems - Yes i'm switching all my desktops to Debian x64 - Sorry Ubuntu your marketing failed

For simpler systems there is a special CD with LXDE as desktop environment, download the one for your system architecture for me is x86-64 on All systems (I wonder why the frack ubuntu gives you 32 bit version by default when you download the iso , 32 bit is legacy and 64 bit should be considered mainstream and for server is stupid to have 32 bit version)
Before the installation starts choose lxde instead of xfce from the install menu
ps:xfce/lxde on debian it's a little bit faster than what it's inside xubuntu 
my reasons are that i want to become a debian developer to help the firebird packages and fixing bugs there this is why i need to use debian unstable/experimental 
also i'm contemplating arch linux and haiku when i will have enough time 

Sunday, May 09, 2010

Installing the latest ruby on rails on any ubuntu :lynx,karmic ....

I needed to have the latest rails on my ubuntu desktop : lucid lynx (the one that is by default in repository is too old)

and this command will not work on any debian based system because it's disabled and
it will break the debian way
sudo gem update --system
anyway you can update and the replace the gem installed on the system this way
sudo gem install rubygems-update
sudo update_rubygems

if it's not in the path (I wonder why is not there by default when the gem package is installed)
you can do this
sudo  /var/lib/gems/1.8/bin/update_rubygems 
RubyGems 1.3.6 installed

=== 1.3.6 / 2010-02-17
changelog and notices
--------------------------------

RubyGems installed the following executables:
 /usr/bin/gem1.8


then you can install the latest stable rails
sudo gem install rails