Developer Tutorials

Hey everyone,
We’re in need of some simple tutorials to help people get started programming in BeOS / Haiku. If anyone would be interested in writing a tutorial, please email me at kurtis at zekimedia dot com and let me know what you’d be interested in doing. Some sample ideas are:

Hello World
Graphical Hello World
Creating Simple Graphical Windows
Using Messages
Graphical Menus, Buttons, and Inputs
Simple BeOS Preference App
Database Interaction in Your Program
etc.

If you feel the need to write something more complex, that’s cool too. You can write something as easy or as complex as you like. The only requirement is that these should probably be written with example code in C++ since that’s what the Haiku source tree is. If you have any questions, again, email me.

Thanks.

1 Like
kurtis wrote:
Some sample ideas are:

Hello World
Graphical Hello World
Creating Simple Graphical Windows
Using Messages
Graphical Menus, Buttons, and Inputs
Simple BeOS Preference App
Database Interaction in Your Program
etc.

I think most of them are already implemented in the BeOS sample code:
http://www.bebits.com/app/3019

Why not just use those (or adapt them to OpenBeOS if changes are needed)? I don’t see a reason why Be’s sample code license shouldn’t permit that.

would it be possible to re-write / summarize the Developers Workshop – BeOS Programming Basics from the BeOS Newsletters ? I already have all the Developers’ Workshops in one text document if it helps.

there’s also two online BeOS books that i know of :
http://www.nobius.org/~dbg/ – Practical File System Design with the Be File System
http://www.oreilly.com/catalog/beosprog/book/ – Programming the Be Operating System

Both are in PDF file formats, so perhaps we could include them in Haiku ?

also what development method should these authors be striving for?

BeIDE projects , make files, jam files, Text Editor + gcc … ?

edit:

there’s also the BeShare C++ Workshops that can be edited.
my BeAPI knowledge isn’t fantastic, but i’m willing to re-write the Dev Workshops or BeShare C++ Workshops. just give me the green light.

kurtis wrote:
Hey everyone, We're in need of some simple tutorials to help people get started programming in BeOS / Haiku. If anyone would be interested in writing a tutorial, please email me at kurtis at zekimedia dot com and let me know what you'd be interested in doing. Some sample ideas are:

Hello World
Graphical Hello World
Creating Simple Graphical Windows
Using Messages
Graphical Menus, Buttons, and Inputs
Simple BeOS Preference App
Database Interaction in Your Program
etc.

If you feel the need to write something more complex, that’s cool too. You can write something as easy or as complex as you like. The only requirement is that these should probably be written with example code in C++ since that’s what the Haiku source tree is. If you have any questions, again, email me.

Thanks.

I think the neo-programmers site had a lot of this kind of stuff, but I dont know if anyone still has the database.

Hi everyone!
Sure there are tutorials out there, but please don’t just point to them and say someone else has done it before. Haiku needs new and innovative sample code, from the very simple to the complex. Can’t you other devs think of something else to code???

I’ve started a binary tree demo program that draws a binary tree of the letters comprising HAIKU and does Pre, Post and In Order traversals on the tree. The nodes of the tree will be the haiku leaves.
The demo is interesting for a number of reasons,
(1) Binary Trees are a data structure - it’s educational people!
(2) It ties in with the Haiku Autumnal Theme
(3) The Tree is drawn recursively (see (1))
(4) There’s quite a few things covered in the code, drawing, messaging, etc.

I’m awaiting on images from Kurtis for the leaves, once they’re integrated into the app I’ll post a screenshot :slight_smile:
Edit: Here’s a preliminary screenshot http://misza.beosjournal.org/screenshots/HaikuBinaryTree.png
P.S. All sample-code apps/dev tutorial apps should have a Haiku in the about box :slight_smile:

-misza

I updated the above screenshot, the app is much nicer now.
You can also try the binary here:
http://misza.beosjournal.org/files/TreeDemo.zip
I want to see someone make new, innovative demo apps. Anyone up to the challenge?

misza wrote:
... Haiku needs new and innovative sample code, from the very simple to the complex. Can't you other devs think of something else to code???? ...
I'm sorry, but I don't agree with you. There is no need to write a new sample program for every aspect that is already covered by existing sample code.

Of course it is nice to have more and better sample code, but in my opinion it would be more efficient to review the old sample code, see if it still works with Haiku and, if needed, adapt it. By doing this, one would also see if the examples are really understandable. If I remember well the examples for producing audio are not very well documented.

Cheers,
Fritz

misza you never cease to amaze :smiley:

Sikosis wrote:
misza you never cease to amaze :D
Thanks Sikosis! I'd like to see you make a nice haiku demo app :-) Perhaps a hello world, that would display a bitmap of each season one after the other. "Hello Winter", "Hello Summer", etc. http://images.google.com/images?q=autumn&ie=UTF-8&hl=en&btnG=Google+Search contains a wealth of inspiration (and blatant disregard for image copyright :twisted: )

Hi everybody! I’m trying to compile my first program, but I’ve got a next message in the result:

a.cpp: (.text+0x3f): undefined reference to `BApplication::BApplication(char const*)'
collect2: ld returned 1 exit status

There is a code:

#include <Application.h>

main()
{
BApplication *a = new BApplication(“application/x-vnd.your-app-sig”);
a->Run();
delete a;
}

I use “g++ a.cpp” for compiling.

What did I do wrong?

PS. I’m a newb in haiku… =( But I realy want to examine this OS.

You don’t link libbe.so. This library implements BApplication and many other classes(see BeBook for details). libbe.so can be linked by -lbe command line argument to gcc.

many thanks!

g++ a.cpp -lbe

It’s working!!! =)

Sure there are tutorials out there, but please don’t just point to them and say someone else has done it before. Haiku needs new and innovative sample code, from the very simple to the complex. Can’t you other devs think of something else to code???

I totally agree with you…

Easy to follow code for at least:
C++ and Python with samples how to use Pygame and Bethon modules!

Which editor? Which Libs? Which modules?
How to install those; If not included in Haiku by default?
Where should the modules go to? Which folder should be used?
How to make Haiku productive? How to make Haiku popular for people who like to learn how to programme? How to get schools interested using Haiku for their students?

Give people not the operating system Haiku only… give them Haiku to get productive…
a Haiku experience/experimental/coding/working environment…

A Haiku copy people use… and make them say…

I use Haiku to:

I use Haiku to learn C++!
I use Haiku to learn Python!
I use Haiku to learn how to make Games with Python, SDL, OpenGl…
I use Haiku to teach my students how easy it is to use a Operating System which everything included to start programming without hassle!
I use Haiku to get my emails done quick!
I use Haiku for work not for gaming!
I use Haiku because I am bored of loosing data by every new update/install!

Haiku should be a easy to use platform for beginners!

Easy, fast, productive… without the need of knowing each aspect of the OS itself…

Give people a real Haiku experience!

Make them say I love Haiku because it is easy to use and I get my work done fast…

Some Tutorials you can found at http://www.besly.de too (in several languages).

That depends on weather or not the person writing the code is very familiar with the BeApi. Sorting through a bunch of old examples might actually be more time consuming than just writing new stuff. At least with the very basic code. Also some more advanced code may need to be adapted to fit proper style requirements or reflect api changes.

Just an FYI - I have an article coming out very soon. It’s from zero to Hello World Haiku in 1 - 2 hours, with all steps in between. It’s not a programming tutorial, more of a development environment tutorial.

If I wrote an article on programming, there would be big trouble :slight_smile:

But I agree that more native Haiku coding sample are very important. Now that Alpha R1 is out (and stable!) we should put some emphasis on writing native Haiku apps. I think it’s OK to reuse old BeOS code. There are some good ideas, and some good code, why not reuse it?

Most important is to have a list of code example code to look at. Also important is to have Living Haiku code projects as good examples of active collaboration.

As promised, here’s my contribution. All you wanted to know about coding for Haiku R1 but didn’t know where to look:
http://www.osnews.com/story/22903/Writing_Applications_for_Haiku

In a month or so we can put this on haiku-os.org.

  • AndrewZ

Great article, all the cred to you!

Thanks

Yes very helpful article thx.

Unfortunately I cannot get the sample code to work with Paladin.
Should work with command line in Terminal but I dont know how to do that…
I tried the SampleCode with the terminal like this: gcc -o HelloWorld HelloWorld.cpp
but I cannot get it working…
Then I tried the makefile: and typed make…
got a lot of error messages…

I would like to get it working with Paladin instead…

Would be nice if someone could make a short tutorial abaut importing BeSampleCode in Paladin and make it work.

Hi Bruno,

One thing my article did not address was real differences between Haiku GCC2 and GCC4. Depending on which one you have installed, it can make a big difference when you compile and link.

What errors are you seeing?

Also, Paladin was created by darkwym. You might send him an email with questions.

  • Andrew