Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 20 Aug 2014, 07:03
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Vala and Genie programming
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 30 of 35 Posts_count   Goto page: Previous 1, 2, 3, ..., 28, 29, 30, 31, 32, 33, 34, 35 Next
Author Message
rarsa


Joined: 29 May 2005
Posts: 3053
Location: Kitchener, Ontario, Canada

PostPosted: Sun 01 Nov 2009, 23:23    Post_subject:  

disciple wrote:
And how much easier do you think it would be to learn vala than C?
C : Pretty easy to learn, and there are a lot of resources. The problem is that it is not easy to program well. It's very easy to write crappy code that's difficult to understand and maintain.

Vala : Although the language is simple, documentation is still lacking so you must resort to look at examples in other languages to understand how to do some things in Vala. It is easier to write maintainable programs. Vala is a more modern language which takes care of many of C pitfalls (e.g. memory management) but to use it properly you better have an Object Oriented background. (most of the examples I've seen are spaghetti code)

_________________
http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to

Edited_time_total
Back to top
View user's profile Send_private_message Visit_website 
rarsa


Joined: 29 May 2005
Posts: 3053
Location: Kitchener, Ontario, Canada

PostPosted: Sun 01 Nov 2009, 23:37    Post_subject:  

OK, I'm jumping into the Vala wagon.

I started today with Genie but found several little annoyances which, without proper documentation, gave me a headache.

So I moved to Vala and it just feels natural.

I wrote a little test application that uses Gtk, Glade, and SQLite. Creating multiple windows defined in separate classes and source files. Some of those things are not well documented but I drew from experiences from other languages.

I know I'm at the bottom of the learning curve but I hope to put my new learnings to a good use. (time permitting)

_________________
http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to
Back to top
View user's profile Send_private_message Visit_website 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7047
Location: Perth, Western Australia

PostPosted: Mon 02 Nov 2009, 19:13    Post_subject:  

rarsa,
Great to "hear" from you again!

Ah yes, I always remember your statement that anything with the name "Basic" in it makes you break out in a rash! Smile

_________________
http://bkhome.org/news/
Back to top
View user's profile Send_private_message Visit_website 
rarsa


Joined: 29 May 2005
Posts: 3053
Location: Kitchener, Ontario, Canada

PostPosted: Thu 05 Nov 2009, 20:14    Post_subject:  

BarryK wrote:
Great to "hear" from you again!
Thanks!

BarryK wrote:
Ah yes, I always remember your statement that anything with the name "Basic" in it makes you break out in a rash! Smile
Oh, I wouldn't put Genie in the same leage as Basic.

I think it is a nice language which I will surely get into once I get my head around Vala which is better documented.

I am also a python guy so Genie seemed familiar just that I wasted time with some very basic things:

I mixed tabs and spaces and the interpreted got confused until I added the [indent..].

When setting an object method as the event handler I had to do
Code:
button.clicked += def () myMethod()

But if it was a global method
Code:
button.clicked += myMethod()

which wasn't documented anywhere. In Vala the def() is not required.

Most examples use global methods, not classes so it was quite an experience.

So this combined with the indent issue was quite confusing: The myMethod() looked indented as other class methods (4 spaces), but it really wasn't due to using tabs (1 tab) so it was interpreted as a global method outside the class but without visibility to the private members of the class.

Smile enough rambling, I like both languages, I just decided to start with Vala to understand the programing model and then try Genie.

_________________
http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to
Back to top
View user's profile Send_private_message Visit_website 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7047
Location: Perth, Western Australia

PostPosted: Fri 06 Nov 2009, 06:43    Post_subject:  

Oh, I didn't want to imply that Basic and Genie are in the same league. It is just that my memory was jogged, about the comment you made about "anything with Basic in the name" long ago -- or I think it was you, maybe my memory is faulty.

It is probably unwise to stir up that tabs versus spaces thing again. It is interesting that Jamie decided to use tabs as the default.

Personally, I like tab indents. Very easy to indent consistently, also easy when editing existing text. As long as nobody opens/edits my code in a text editor configured to convert tabs to spaces...

_________________
http://bkhome.org/news/
Back to top
View user's profile Send_private_message Visit_website 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7047
Location: Perth, Western Australia

PostPosted: Fri 06 Nov 2009, 06:49    Post_subject:  

Double post
_________________
http://bkhome.org/news/
Back to top
View user's profile Send_private_message Visit_website 
rarsa


Joined: 29 May 2005
Posts: 3053
Location: Kitchener, Ontario, Canada

PostPosted: Fri 06 Nov 2009, 09:32    Post_subject:  

BarryK wrote:
"anything with Basic in the name"
Yep, it was me. I'm scratching already. Very Happy

And no, no intention to stir any debates Smile . Once I understood the [indent=...] things were clear.

Its clearly a matter of preference.

Well, back to Vala/Genie

_________________
http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to
Back to top
View user's profile Send_private_message Visit_website 
gyro

Joined: 28 Oct 2008
Posts: 419
Location: Brisbane, Australia

PostPosted: Mon 16 Nov 2009, 08:53    Post_subject: vala 0.7.8 pet??  

Hi,

Is there a .pet of vala 0.7.8 anywhere?
I wish to install it on pup-431.

There seems to be omissions in Xlib.vapi in vala 0.7.4.

gyro

Edit: It is x11.vapi not Xlib.vapi.

Edited_time_total
Back to top
View user's profile Send_private_message 
ttuuxxx


Joined: 05 May 2007
Posts: 10747
Location: Ontario Canada,Sydney Australia

PostPosted: Mon 16 Nov 2009, 10:02    Post_subject: Re: vala 0.7.8 pet??  

gyro wrote:
Hi,

Is there a .pet of vala 0.7.8 anywhere?
I wish to install it on pup-431.

There seems to be omissions in Xlib.vapi in vala 0.7.4.

gyro


here try this Smile
ttuuxxx
vala-0.7.8-i386.pet
Description  vala-0.7.8-i386|vala|0.7.8-i386||BuildingBlock|6100K|pet_packages-4|vala-0.7.8-i386.pet||vala|puppy|4|official|
pet

 Download 
Filename  vala-0.7.8-i386.pet 
Filesize  1.26 MB 
Downloaded  552 Time(s) 

_________________
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games Smile

Back to top
View user's profile Send_private_message Visit_website 
gyro

Joined: 28 Oct 2008
Posts: 419
Location: Brisbane, Australia

PostPosted: Tue 17 Nov 2009, 03:34    Post_subject: Re: vala 0.7.8 pet - works  

ttuuxxx wrote:
here try this Smile
ttuuxxx
Thanks
The updated x11.vapi looks good
gyro

Edit: Works fine, thanks ttuuxxx
Back to top
View user's profile Send_private_message 
tsura

Joined: 01 Dec 2009
Posts: 3

PostPosted: Tue 01 Dec 2009, 04:33    Post_subject:  

disciple wrote:
Hi guys, I haven't really looked at Vala yet, but I'm wondering - does anyone have any idea how hard it would be to convert a simple-ish gtk program from c to vala? And how much easier do you think it would be to learn vala than C? Is Vala:
0. No easier than C
1. A little easier than C
2. Quite a bit easier than C
3. A lot easier than C
4. So much easier than C that there's no comparison.

Any thoughts?


Hmm. It's a whole lot easier, but I wouldn't say there's no comparison. It has its similarities, but at least you don't have to deal with header files, having to put functions in certain places, funky less-readable syntax and all that other stuff. Plus you get some nice string functions, such as up(), down(), strip() and split() out of the box. Making a GUI in Vala is easy, too, and although there's not a whole lot of extensively commented-on documentation, you can always look at Gtk documentation for other languages and often figure out the Vala method with ease.

I highly recommend learning Vala. It's worth it, I'd say.

Here are some helpful links:
• http://references.valadoc.org/
• http://live.gnome.org/Vala
• http://www.pygtk.org/docs/pygtk/
• etc.

Anyway, other, non-Vala sites on Gtk often give information that the Vala sites don't give, so that's why I list a few others. Even the C documentation on Gtk can be quite helpful, actually. Vala is one of the few languages that seems quite easy to use documentation from other languages with.

I like to ask questions on the programming forum at Ubuntuforums. People don't always answer, but they do often enough that it's worth it.
Back to top
View user's profile Send_private_message 
ljfr

Joined: 23 Apr 2009
Posts: 176

PostPosted: Mon 01 Feb 2010, 09:28    Post_subject: JWM shortcut manager  

Hi,

Note:Some objects of the bellow examples are not freed correctly, some function to do that are missing in the current libxml bindings (reported to gnome bugzilla).

following Caleb72 example, I attached a jwm shortcut manager (similar to the one in jwmconfigmgr) in vala using libxml, using xpath to find desired nodes.

To compile and run it:
Code:
valac -X -Os --pkg libxml-2.0 --pkg gtk+-2.0 jwmshortcut.vala
strip --strip-unneeded jwmshortcut
./jwmshortcut


As libxml provide an easy way to handle jwm configuration files, a full jwmconfigmgr in genie/vala might not be so big and ... improved.

Regarding compilation, is there a better way to decrease executable size?

regards,
jwmshortcut.tar.gz
Description 
gz

 Download 
Filename  jwmshortcut.tar.gz 
Filesize  5.28 KB 
Downloaded  442 Time(s) 

Edited_time_total
Back to top
View user's profile Send_private_message 
technosaurus


Joined: 18 May 2008
Posts: 4334

PostPosted: Tue 02 Feb 2010, 00:16    Post_subject:  

the compile scripts that were packaged with nicoedit first generate the "C" code and then compile it
if you add this after gcc
gcc -Os -fomit-framepointer -momit-leaf-frame-pointer -fmerge-all-constants -march=i486 -mtune=i686 ... rest of stuff

then better stripping
strip --strip-all --remove-section=.comment --remove-section=.note *

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send_private_message 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Tue 02 Feb 2010, 01:12    Post_subject:  

Hi rarsa Smile

This is quite a technical question
- so make the answer fit for an idiot (me)

Is Vala more secure than C?
Or is it how the code is written?

As you know some languages such as javascript are very useful but insecure (so let's base the whole Cloud thing on them Embarassed )

Is Vala pronounced valour
and suitable for the brave?

_________________
Puppy WIKI
Back to top
View user's profile Send_private_message Visit_website 
DMcCunney

Joined: 02 Feb 2009
Posts: 897

PostPosted: Tue 02 Feb 2010, 20:54    Post_subject:  

Lobster wrote:

Is Vala more secure than C?
Or is it how the code is written?

It is always how the code is written.

Quote:
As you know some languages such as javascript are very useful but insecure (so let's base the whole Cloud thing on them Embarassed )

And your vast knowledge of how insecure JavaScript is comes from where, exactly?

See above about it always being how the code is written.

(And while you're at it, define just what you mean by "security".)
______
Dennis
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 30 of 35 Posts_count   Goto page: Previous 1, 2, 3, ..., 28, 29, 30, 31, 32, 33, 34, 35 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1023s ][ Queries: 12 (0.0096s) ][ GZIP on ]