Vala and Genie programming

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#161 Post by MU »

there are not many Genie examples.

But once you wrote some small programs, using our examples as template, you will find a meanwhile quite huge collection of other examples: those from Vala.

A genie program has a simpler syntax.
So it is pretty easy, to "translate" vala code to genie.

This is especially valid for Gtk based examples.
Both languages use external libraries, and their call are almost identical.

Vala

Code: Select all

if ( a == 10){
    window.set_title("test");
}
Genie:

Code: Select all

if a is 10
    window.set_title("test")
So translating parts of code basically means to remove some "{ }" , some ";" and rename some keywords ("is" instead of "==").

I currently collect small examples, and will upload them in 3 weeks or so, after I cleaned them up.
It will be a collection of those posted in this thread, and maybe some simple others.
They can be browsed using a treeview, and you then can run them, or open them in the Vala-Ide.
But first I need to clean them, as especially my first Glade examples were too complicated, they can be simplified like the last ones.

Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

caleb72
Posts: 57
Joined: Fri 15 May 2009, 12:44

#162 Post by caleb72 »

Good to know.
I will try to jump in when I can.

I'm currently swamped with Perl coding commitments for work - but I'll keep an eye on this for personal programming projects.

Great to see it can compile to Windows executable as well if the need arrives. With a windows executable will there be any dependencies or are they all built into the binary?

Regards
Caleb

gpnet
Posts: 56
Joined: Sat 09 May 2009, 15:49
Location: Ivrea ,Italy

#163 Post by gpnet »

Hi to all , Guys

I need help.
I have puppy 4.20 and devx_420.sfs installed.
I usually program in win c# and I would like to try vala in puppy. So I have download these packages from a deb repository:

valac_0.7.2-1_i386.deb
libvala0_0.7.2-1_i386.deb
vala-utils_0.3.4-1_i386.deb
libcairo2_1.4.14-1_i386.deb
.. because I wanted to try the last version with last fixed bugs.
.. converted to pet and installed

and gtksourceview-2.0.2-i486.pet from this thread

and valide-0.4-1-i686-svn-2009-03-27.pet from this site : http://dotpups.de/puppy4/dotpups/Programming/Vala/

Next step i compile by hand the hello.vala pgm example, and all gone well

so i tried to create a new project in valaide and I have got these errors:

1. when I try to create a new project :
valide_project_manager_copy_template: assertion `path != NULL' failed

2. so i create a project by hand copying from glade1.vide in this thread and than open the project and tried to compile. but I have got this error:

PCRE library is compiled without UTF8 properties support.

Coul any one help me to understand what's wrog !

thanks

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#164 Post by MU »

gpnet,
Please use this gtksourceview, the other one works erratic:
http://dotpups.de/puppy4/dotpups/Progra ... -2.4.2.pet

I also attach the pcre-libraries I use in newyearspup.
Maybe those work for you.

Caleb,
no, the libs are not built into the binary.

There are 2 ways to deliver them:
1.) the user installs vala, a 10 MB download.
2.) you add the required libs in the same folder, where your binary is located.

I made a 5 MB (12 MB extracted) example package including required Wiindows libs:
http://www.murga-linux.com/puppy/viewtopic.php?t=40193
It is a pet, so easy to install, then it can be run with Wine.

Mark
Attachments
libpcre.tar.gz
(161.09 KiB) Downloaded 688 times
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

gpnet
Posts: 56
Joined: Sat 09 May 2009, 15:49
Location: Ivrea ,Italy

#165 Post by gpnet »

Hi Mu,

Thanks for replay,

No, I can't use the gtksourceview 2.4.2 with valaide because if I do that (i tried ) I lost syntax Highlight ( almost in vala ). So I had to come back to previous version.

Thank you for the pcre libraries , I presume I have to replace the older one?

And what about the creation of a new project :assertion `path != NULL' failed
have you any suggestion?.

Also I notice that to work with vala / glade would be necessary the 3.6.x version because with this version you can save the xml UI in proper way for Gtk.Builder("xxxxx");
Have you any news about a new release or could I install it from deb packages ?.

Tanks a lot.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#166 Post by MU »

I have not used Gtkbuilder yet, as I did not understand exactly, how to use those files in Genie.
It is something though I must look at in future, as libglade has become depreciated, and Gtkbuilder shall be used instead.

Concerning libpcre:
yes, replace them (but backup the old ones first).
Or better try what I suggest next:

I just tried to reproduce your problems in Puppy 4.20.
It works however.

I installed these files:
http://dotpups.de/puppy4/dotpups/Progra ... 0-i486.pet
http://dotpups.de/puppy4/dotpups/Progra ... -2.4.2.pet
http://dotpups.de/puppy4/dotpups/Progra ... -03-27.pet

Then in a console, I typed:
validestart

I clicked on "new projet", chose "Genie , Gtk".
Filled in every field then (that is important - also the license, or the IDE crashes later, if you try to open the options).

If you loose syntax highligting in other programs, try to run them with a startscript like /usr/bin/validestart.
It forces to load the newer Gtk libraries required by the newer gtksourceview.

If you need help with that, let me know.
I can compile vala 0.7.2 tomorrow, today I was away and had no time for programming.
Tomorrow I will be away, too, but hope I can compile it in the evening.
For first steps, 0.7.0 should be fine though.
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#167 Post by MU »

and important:
if you use Vala-IDE, other programs might crash afterwards, e.g. seamonkey.
This happens if you try to open the "file open" diialog.
The reason is the file /root/.recently-used.xbel.

Simply delete it then, the Ide seems to write a wrong line in there.

Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

gpnet
Posts: 56
Joined: Sat 09 May 2009, 15:49
Location: Ivrea ,Italy

#168 Post by gpnet »

Hi MU,

Sorry , I didn't save the libs before replacing.

Any way I can tray to copy from the .sfs. Well now I remove the currents and try to install the packages you link me.
I would like to get rid of this!.

I thank you if you can compile vala 0.7.2.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#169 Post by MU »

[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

gpnet
Posts: 56
Joined: Sat 09 May 2009, 15:49
Location: Ivrea ,Italy

#170 Post by gpnet »

Thank you MU

Now I'll try. I'll keep you informed.

gpnet
Posts: 56
Joined: Sat 09 May 2009, 15:49
Location: Ivrea ,Italy

#171 Post by gpnet »

Wow, it works!

I have installed vala 0.7.2 / gtksourceview 2.4.2 and valide and launch from terminal /usr/bin/validestart.

All seems to work. Only one notation; missing lib linselinux.so.1 , what is this? and what is need for ?

Last thing. I was walking in the other thread "Mono / .net related stuff - Monodevelop.sfs" and I found what I was looking for. I appreciate all the work you and others guys are working on.

I , and my colleagues, are c++Builder and c# developers but also we like linux and puppy. My goal was to try to port part of our application to puppy. That's why I am interested in vala.

the problem for me is that I have a good experience in windows but not in linux nor in puppy. I could try to work with monodevelop/mono but I think , like you, it would be better to work in vala.
The work of converting c# widgets to gtk glade is the right clue we need to go one step ahead.

Also I think there is a very interesting tgkaml because is closer to c# mode to define widgets inside a program and also because is more readable than glade.

I stay tuned to see how the thing goes on.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#172 Post by MU »

All seems to work. Only one notation; missing lib linselinux.so.1 , what is this? and what is need for ?
No idea, must check it out tomorrow.

-----------------------------------------------------
I attach Picturebrowser 0.6, including the windows binary.
Like Pictureviewer, it now depends on the PDF-library Poppler, see:
http://www.murga-linux.com/puppy/viewto ... 062#303062

Details:
http://www.murga-linux.com/puppy/viewto ... 550#306550

Unfortunately, main.gs has become somewhat "untidy", as the program as such meanwhile is pretty complex.
So it might not be well suited as example for people who want to learn Genie from new.
I must add more comments, and soon start to write the "example browser" with shorter examples.

Mark
Last edited by MU on Mon 18 May 2009, 00:35, edited 1 time in total.
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

gpnet
Posts: 56
Joined: Sat 09 May 2009, 15:49
Location: Ivrea ,Italy

#173 Post by gpnet »

Thanks MU,

I'll give a try, to understand a little bit better.

Could I also ask you to create a new PET for the new tgkaml-0.2.6 ?.

... the time has come to learn it by myself. Tomorrow I want to try.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#174 Post by MU »

you just download the source, extract it, then open a console in that folder, and type:

./configure --prefix=/usr
make
new2dir make install


After a while you get the question, if a PET shall be created.
Before you confirm, examine the new program-i486 folder.
It has folder usr/bin and usr/lib.
Open a console in them, and type:
strip *

Then continue to build the pet.
(note: NEVER run strip * in Puppys own /usr !!!)

I uploaded a pet of gtkaml-0.2.6 with the binary, and a *.tgz with the full source compiled. It has some subfolders with examples to run with a mouseclick.
http://dotpups.de/puppy4/dotpups/Programming/Vala/
(compiled in Puppy 4.12)

Buena notte,

Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#175 Post by MU »

Picturebrowser 0.6 had a bug, I uploaded a fixed archive.
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

gpnet
Posts: 56
Joined: Sat 09 May 2009, 15:49
Location: Ivrea ,Italy

#176 Post by gpnet »

Hi , Mark,

Wow, I tried to create a PET package. It works ! . nice. Though I am requested to enter/confirm a lot of questions, at the end the Pet package is out.

I think this would be a nice exercise for a genie/vala program with a nice form.

Now , all the bricks are well sited and the environment it's coming to take place.
Two more questions: ( if I can and if this is the proper thread )

1. Using seaMonkey do you know if it possible in to save the currents open tabs like I can do in firefox ?. this is very usefull when I have have several tab open and I want to have they open at the next launch.

2. I use tuxcmd as file manager. I noted when I search something in file system, that there is a symlink in /mnt whose name is /Home that result in a endless loop. I dont know why is this necessary but I want to know how to getting around this.

thanks Mark for all your help.

gpnet
Posts: 56
Joined: Sat 09 May 2009, 15:49
Location: Ivrea ,Italy

#177 Post by gpnet »

Hi MU,

Sorry, I am here again to well out of your patience. I was initiating a test vala pgm using gtk.builder with glade , so I downloaded the example ( sample.ui) and tried to compile it in vala, but when I launch the pgm I got this error :

: required gtk+ version 2.16 , current version is 2.14

I tried to find current package 2.14 where it is, but I didn't find it. Suppose that now I download it from ftp.gnome.org and I install it, I would like to know if the new installed version totally replace the older one or I have two packages installed in the system ?.

Same question is for glage 3.6 over the current installed and gnerally for all upgrades.

Thanks Mark.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#178 Post by MU »

sorry for the short answers, but I'll be away again in some minutes.

I'd suggest to try this "Monodevelop" iso:
http://www.murga-linux.com/puppy/viewtopic.php?t=40567

It is based on ultrapup/newyearspup, that uses a newer Gtk library.
Compiling Gtk yourself might work, but you certainly also would need a newer glib, and maybe others, like pango or cairo.

The upgrade would replace the existing Gtk libs in /usr/lib/.

Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

gpnet
Posts: 56
Joined: Sat 09 May 2009, 15:49
Location: Ivrea ,Italy

#179 Post by gpnet »

Hi MU,

You right. In fact I tried to download and compile gt+2.16 source and when I launched the ./configure command I have got the warning abou Pango and cairo libs also.

so I opened a new thread in "users" about the update of gtk.

I would prefer to set the environment in the proper way because my intention is to start programming in puppy. I currently work with sharpdevelop in win XP3 and I know monodevelop. I don't know linux and puppy and this is what i would like to learn.

I know that the road may contain some hole , but this is the way I learn. I thought you help me to smooth the way, if you can.

Do you agree ?

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#180 Post by MU »

well the problem is:
Puppy has the old Gtk.
So if you upgrade to compile, and then want to spread the program, other Puppys cannot use it, unless they also upgrade Gtk.

Yo would have the same problem with the monodevelop iso.
I develop in newyearspu, but the final pets I create (compile) in Puppy 4.12.

In some cases this does not work.
E.g. in the pictureviewer, the picture is centered, when you zoom in.
To calculate the position, I used the size values you can request from a "GtkAdjustment".
In Puppy 4 then I got an error, that this is not supported by the older Gtk.
So I had to use other comands to get it working.

But if you need Gtk 2.16, simply also compile the dependencies, like Glib, Pango and Cairo.
With some luck, this is sufficient, if I remember well, nothing more is needed.

You can backup your savefile first, in case you mess up your system, or use a second one.
(I assume a frugal installation).
Boot from CD with the option:
puppy pfix=ram
That starts without the first savefile, so at shutdown you are offered to create a second one (you MUST use a different name there).
Then on next start, you get a small menu, to select one of the savefiles.
So you can use one for tests, and one for normal use.

Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

Post Reply