Re: [Vala] Parallel programming in Vala?

2014-05-27 Thread Al Thomas




 From: Costas Smaragdakis kesma...@gmail.com
Sent: Tuesday, 27 May 2014, 13:50
Subject: Re: [Vala] Parallel programming in Vala?
 

I would like to share the processes on multiple computers through
typical network.
If you want a distributed computing environment then Hadoop may be worth 
considering. It seems to be in demand at the moment so may help with a 
post-doctorate job too! Hadoop is distributed file system and Java based 
distributed process control system.

Hadoop also has a process called streaming that allows data to be processed by 
arbitrary binaries and scripts, and this could include Vala produced binaries. 
Not sure how this fits into Hadoop2 though, but a few links that I have 
bookmarked:

http://wiki.apache.org/hadoop/HadoopStreaming
http://www.glennklockwood.com/di/hadoop-streaming.php

Some comments on its application to scientific computing:

http://hortonworks.com/blog/hadoop-in-perspective-systems-for-scientific-computing/
http://www.slideshare.net/hortonworks/large-scale-math-with-hadoop-mapreduce

And at the really rough edge you could even try GPU computing nodes with OpenCL 
and Vala:

http://www.slideshare.net/DevCentralAMD/is-4011-zubindowlaty
http://dummdida.blogspot.co.uk/2011/11/wrapping-opencl-with-vala.html
https://gitorious.org/valastuff/vapis/source/d879797216778030f3a281f6d27d157c7fa1f76d:vapis/OpenCL.vapi
http://blogs.igalia.com/elima/2013/05/06/introducing-gocl-a-gobject-wrapper-to-opencl/
https://github.com/elima/gocl

If you ever do this, then a blog post to the world would be very interesting on 
how far you got.

Al
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] A brand new build system

2014-05-19 Thread Al Thomas




 From: Robert Ancell robert.anc...@gmail.com
To: Steven Oliver oliver.ste...@gmail.com 
Cc: vala-list@gnome.org vala-list@gnome.org 
Sent: Friday, 16 May 2014, 22:43
Subject: Re: [Vala] A brand new build system
 

(I'm the author of Bake).

Bake has detailed documentation with it (as shown in that link) 

The documentation is also readable in raw Mallard format (much the same as 
HTML):
http://bazaar.launchpad.net/~bake-team/bake/trunk/files/head:/help/
It give me the impression Bake is intended to be comprehensive :-) 
and the Vala page ( 
http://bazaar.launchpad.net/~bake-team/bake/trunk/view/head:/help/vala.page ) 
might be worth a look.

So it's held in Bazaar, any thoughts on switching to Git? Eric S. Raymond 
argues Bazaar is dying ( 
https://lists.gnu.org/archive/html/emacs-devel/2014-01/msg5.html ). You 
might get more people giving it a quick spin if they can do a git clone. I was 
about to give it a go, but only got as far as reading this ( 
http://askubuntu.com/questions/10389/how-can-i-import-bzr-branches-into-git ).



but lacks a website [1]. Help welcome :)

[1] https://bugs.launchpad.net/bake/+bug/1215366



What kind of website? I presume the project infrastructure, i.e. repository, 
mailing list, bug reporting will be handled off site?

How would you describe the current status of the project and its goals in a 
hundred words? :-)

Looks a very interesting project. NEWS file also gives a flavour ( 
http://bazaar.launchpad.net/~bake-team/bake/trunk/view/head:/NEWS )

All the best,

Al
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Memory safety

2014-05-15 Thread Al Thomas


 Vala inherits the problem of C, yes. You could certainly do some evil

 casts like in C. Vala however is certainly safer than C in many aspects,
 in other aspects however you have to know what you are doing and how
 Vala compiles down to C in certain cases.

Okay, good to know.  I asked because some of the offset/lengths check in 
the glib string library are a bit … off, and they can trigger C integer 
overflow, which is undefined.  But if Vala is general unsafe in this 
sense, it may not be necessary to fix these instances (it would be 
painful anyway because this code isn't in a dynamically linked).

-- 
Florian Weimer / Red Hat Product Security Team

Is there a bug report for this with more details?

I would say in general Vala/Genie attempts to be safer than C, within the 
limits of a language that compiles to C code.

Vala strings are UTF8 encoded gchar, but the length and indices are in bytes. 
See https://wiki.gnome.org/Projects/Vala/StringSample 


A program such as:

void main () {
    string a = hello;
    char b = a[100];
    print ( b.to_string() );
    print ( ((int) b).to_string());
    }


will compile and the C code generated uses the line

     _tmp1_ = string_get (a, (glong) 100);

to get the index. I'm not sure where string_get function comes from, but the 
output is a zero byte for an out of range index.

The GLib string builder function ( 
http://references.valadoc.org/#!api=glib-2.0/GLib.StringBuilder ) is also 
recommended for use in Vala.

So I think your question raises some interesting questions about how Vala 
programmers should handle strings securely to avoid buffer and integer 
overflows for a robust application. It would be nice to gather some ideas on 
this. Maybe for starters http://www.and.org/vstr/security

Regards,

Al Thomas
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Recommended way for combined C with Vala/Genie project?

2014-04-28 Thread Al Thomas
I've just got this error that made me wonder about valac's hidden capabilities:

error: test.g is not a supported source file type. Only .vala, .vapi, .gs, and 
.c files are supported.

I assume a .c file is passed straight through to the C compiler along with the 
generated C files from .vala and .gs files. Is this a recommended way of 
creating a combined C with Vala/Genie project?

I note XFCE decided to combine C with Vala. From a couple of blog post [1][2] 
it looks as though they use automake to create C files from Vala and then 
distribute and compile those files for the whole project. The argument being 
different versions of valac can produce different C files so it is more stable 
for a distributed version to build from the generated C files.

I also found the Parallel Builds [3] page. This is an interesting approach 
with, as I understand it, an intermediate object file for each vala file. These 
could be linked with object files from C or C++.

Then there is the --compile option of valac to produce object files.

So at the moment I'm thinking for large, mixed language projects, it is better 
to create object files and link outside of valac.

I am writing some documentation for Genie and was about to finish the attached 
diagram with arrows when I stumbled upon valac accepting .c files. At present 
I'm thinking this feature isn't too useful and it is better to create object 
files and link using another tool. This is also useful for GIR and using 
Vala/Genie binaries in Python, node.js, PHP, etc. So it is probably better for 
documentation to introduce the more general process.


Thanks for any thoughts.



Al Thomas

1 - http://blog.m8t.in/2009/09/build-project-with-vala.html
2 - http://blog.m8t.in/2009/12/messing-up-with-vala-again.html
3 - https://wiki.gnome.org/Projects/Vala/Documentation/ParallelBuilds
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] [Genie] Re: Vala on Android

2014-03-17 Thread Al Thomas
Great stuff Gontzal!

Does this mean Vala/Genie programs can be compiled for non-rooted Android 
devices?

I have created a new Genie wiki page:

https://wiki.gnome.org/Projects/Genie/TutorialsBlogsExamples

and included links to some of your projects and tutorials. I have also included 
a link to 
https://github.com/avalanche-games/avalanche/wiki/Getting-Started-%28for-Linux-users%29
 to help get people interested in this. What do you think?

Al




 From: gontzal txasato...@gmail.com
To: vala-list@gnome.org 
Sent: Saturday, 15 March 2014, 0:01
Subject: [Vala] Vala on Android
 

Hi Folks!!

Genie is already runing on Android using SDL 2.0.
See an educational app in android playstore named Katamotz Hitzak .
How to compile a genie/vala + SDL 2.0 game-application?
http://manualgenie.blogspot.com.es/
https://github.com/avalanche-games/avalanche/wiki/_pages

thanks... i love Genie. Maintain it please
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list



___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] How to convert a string to float ?

2013-09-24 Thread Al Thomas






 From: r...@no-log.org r...@no-log.org
To: vala-list@gnome.org 
Sent: Tuesday, 24 September 2013, 13:36
Subject: [Vala] How to convert a string to float ?
 

To convert a string to int : int.parse
ok, easy...

Try double.parse()

For more see https://wiki.gnome.org/Vala/Tutorial#Strings

Al
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Fw: Extra documentation for vapis on Valadoc

2013-09-24 Thread Al Thomas


From: Steven Oliver oliver.ste...@gmail.com
To: vala-list vala-list@gnome.org 
Sent: Tuesday, 24 September 2013, 19:15
Subject: [Vala] Extra documentation for vapis on Valadoc
 

My
 question is how did the extra documentation get there? I looked in the
Glib-2.0 vapi but there's nothing extra there.


My understanding is Valadoc is not generated from vapi files. 

It has it's own markup style ( see http://valadoc.org/#!wiki=markup ) and 
source code ( see https://gitorious.org/valadoc-org/valadoc-org/ ), but that 
may not be the whole story because the relevant valadoc file I can find ( 
https://gitorious.org/valadoc-org/valadoc-org/source/6c7d58e17a247438337d75bde80737f0e539fa2b:documentation/glib-2.0/glib-2.0.valadoc
 ) doesn't seem to contain the GLib.Markup.printf_escaped function you were 
interested in.

Hope that helps,

Al
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Worried about the state of Genie

2013-09-01 Thread Al Thomas
On Thursday, 29 August 2013, 9:53 Tal Liron wrote

I like your two suggestions, Al, and hope you will open them as 

enhancements so at least we can track them.

But this discussion on specifics is pointless if no work will be done on 
Genie! 


I've logged my two suggested enhancements. Next year I will try and look at 
implementing them.

I think the summary of the wider discussion is that the Vala community are OK 
with Genie so long as it is useful and maintains to be and that Jamie McCracken 
has indicated he will try and deal with serious bugs. There is a big gap here 
and that is the Genie community. I'm going to raise three new threads here to 
see what response we get.

Al

P.S. Thanks for sharing the link to your Genie talk. Some useful stuff there.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] [Genie] Print enhancements and handling of null

2013-09-01 Thread Al Thomas
This is using two Genie bugs as examples to try and find out how the Genie 
community handle triage, documentation and enhancements.
The two more bugs are print statement with no arguments does not compile ( 
https://bugzilla.gnome.org/show_bug.cgi?id=688016 ) and Print statement does 
not print newline if it has a null argument (
https://bugzilla.gnome.org/show_bug.cgi?id=690127 )


Print statement with no arguments does not compile
---
This is a request that to print a blank line just print can be used, instead of 
print . This would be like Python 2, although with Python 3 and print now 
being a function simply typing 'print' returns a statement that it is a built 
in function.

Personally I don't mind if print with no value just prints a blank line instead 
of returning a compile error. The question is who agrees this change? It is 
reasonable to have the print statement expect something to print so this is 
probably more an enhancement than a bug. Is there a Genie benevolent dictator 
such as with Python or can only a community consensus be agreed for a change to 
be accepted? How is the acceptance then recorded - presumably in bugzilla?


Once the change is agreed, who is assigned the task of fixing it? In this 
instance because it is a fairly trivial change I think it should be assigned to 
the raiser, but what if they are not capable of delving into the Vala source 
code for Genie to fix this? Should this instead be closed as a good idea, but 
with limited resources there was no-one to take on the task?

Once a patch is received in bugzilla how is it reviewed and applied? There is 
at least one bug ( https://bugzilla.gnome.org/show_bug.cgi?id=633083 ) which 
has a patch that has not been applied.


Print statement does not print newline if it has a null argument

I tried to generate some nulls and it made me come across what may be seen as a 
different bug.

    var test = new array of int [5]
    for var item in test
        print item.to_string()


prints all zeros. 


    var test = new array of string [5]
    for var item in test
        print item

prints all nulls. Would it be better to have this as all empty strings? There 
is a desire to avoid nulls, for example see 
https://wiki.gnome.org/Genie#Nullable_Types and 
https://wiki.gnome.org/Vala/Tutorial#Strict_Non-Null_Mode. Would a new array of 
strings with empty strings solve the use case the bug reporter was having 
problems with? If so then can this bug be closed as nulls are ugly so they 
should probably print ugly! and open a new bug that new array of string [x] 
should be empty strings not nulls. Otherwise I can't think of any problem with 
having print null print with a newline, so it leads so the same set of 
questions as the analysis above.

Thoughts?

Al
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [Genie] Using async methods in Genie

2013-04-28 Thread Al Thomas


Alex Stefan Kaye wrote on Saturday, 27 April 2013:


Is it possible to use Vala's async methods in Genie? If so, could 
someone give an example of the syntax to use?

I have not used them myself, but have made a few bookmarks when I was 
researching Genie:

https://mail.gnome.org/archives/vala-list/2011-February/msg00072.html - 
suggests it works and syntax for declaring a function is def async 
function_name ():


https://live.gnome.org/Vala/Tutorial#Asynchronous_Methods
    - hopefully Genie closely matches the Vala syntax such as the use of the 
yield keyword

Other bookmarks:
https://live.gnome.org/Vala/AsyncSamples
https://live.gnome.org/Vala/GIOSamples#Asynchronous_File_Listing
http://tecnocode.co.uk/2012/12/30/single-thread-synchronisation-in-vala/
https://mail.gnome.org/archives/vala-list/2011-July/msg00111.html

If you get it working a short write up of your code would be helpful,

Al
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [Genie] Dict/List as properties

2013-04-19 Thread Al Thomas
 On  Sun, 14 Apr 2013 20:50:07 +0001, Alex Stefan Kaye noxdeleo googlemail 
com wrote: I'm wondering if/how I can use dicts and lists in class 
properties, for example: 
 prop private channel_map:dict of string,list of Gst.ChannelPosition 
I remember having a similar problem in the one Genie program I've written so 
far.
I don't have an exact solution, but found this worked for an array of strings:

class log_hit : Object
    _fields : array of string[]
    prop readonly ip_address : string
        get
            return _fields[1]
    construct ( )
        _fields = new array of string[10]

I found using the _variable_name overcame what is probably a memory corruption 
bug 
when I used prop private. Then creating the actual array when the object is 
constructed
works for an array of strings.

So you could try something along the lines of:
class my_class : Object
    _channel_map : dict of string, Gst.ChannelPosition
    construct()
        _channel_map = new dict of string, Gst.ChannelPosition

If this inspires you to find a solution let us know!

Also some references on dicts and list:
http://bkhome.org/genie/datatypes.htm
https://live.gnome.org/Genie#Dicts
http://manualgenie.blogspot.co.uk/search/label/03.1%20Listas%20complejas.%20Lista%20de%20objetos.

Good luck,

Al
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


<    1   2   3