[Vala] How to pass null to Gst.init?

2016-08-23 Thread mar...@saepia.net
Hello,

I would like to pass NULL to Gst.init. I intentionally do not want to pass
argv.

It is defined as

void Gst.init (ref unowned string[]? argv)

but if I pass null it throws

error: Argument 1: Cannot pass null to reference parameter
  Gst.init(null);

despite parameter type having "?"

How can I achieve this?


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


Re: [Vala] Manipulating HTML tag soup in Vala

2016-08-01 Thread mar...@saepia.net
Hello,

how about 2-stage processing? Loading HTML into WebKitGtk, dumping DOM (
https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebPage.html#webkit-web-page-get-dom-document)
which contains already parsed structure, sanitizing DOM and displaying
serialized version of modified DOM for the future use?

It should be more secure, too.

m.

2016-08-01 10:01 GMT+02:00 Michael Gratton :

>
> Hey all,
>
> I'm looking for an HTML tag soup library for Geary, that can load tag soup
> HTML (i.e. possibly malformed) from a stream, allow some manipulation of
> it, and re-serialise it for display in WebKitGTK. Ideally, a pull-parser
> API like libxml2's TextReader or StAX[0] would be great, so the whole
> document does not need to be kept in memory as it is processed.
>
> These are the ones I know about:
>
> libxml2:
> - Pros: Has a pull parser API, has a HTML4 tag soup parser, installed
> everywhere
> - Cons: Pull parser doesn't work with HTML parser without reading whole
> document into memory, HTML parser out of date(?)
>
> GXml:
> - Pros: Nice Vala API, uses libxml2 under the hood
> - Cons: Not a pull parser, loads whole document into memory, doesn't seem
> to be packaged for any distros, doesn't use the libxml HTML parser(?)
>
> Others:
> - WebKitGTK+: Great tag soup parser, no pull API, doesn't allow
> manipulating the markup before displaying it (which is the main reason I
> need to parse the HTML beforehand)
> - XML Bird: Nice Vala API, but not a pull parser or a HTML parser
>
> So none of these seem to completely fit the bill. Are there any other
> options out there that I have missed? Has anyone else had parse tag soup in
> Vala?
>
> Ta!
> //Mike
>
> [0] - 
>
> --
> ⊨ Michael Gratton, Percept Wrangler.
> ⚙ 
>
>
> ___
> 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] Just a news I've read about popularity langage

2016-07-28 Thread mar...@saepia.net
I think we should reach consensus first about how vala should be advertised.

BTW vala-lang.org domain seems to point to some random website, anyone
knows is it intentional? :)

m.

2016-07-28 22:33 GMT+02:00 Ben Iofel <iofel...@gmail.com>:

> If you want to write it, make a pull request
>
> On Thu, Jul 28, 2016, 4:13 PM mar...@saepia.net <mar...@saepia.net> wrote:
>
>> Hm I don't think it's really alligned with what I meant.
>>
>> For example that introduction
>>
>> https://github.com/eustasy/vala-lang.org/blob/master/vwiki/vala.wiki
>>
>> is not-marketing driven. And so on.
>>
>> None of these features give any profit to the developer alone. Even their
>> combination. There's no single word about strongest point - easiness of
>> creating multiplatform apps using fairly-high level language, requiring no
>> interpreter/VM, with low overhead and small enough to handle embedded
>> devices.
>>
>> This is what I would like to see on vala's page if we are talking about
>> increasing interest.
>>
>> I also agree that nice application framework would be something that can
>> give a boost. But it's a huge effort. Vala gives a lot of profits to the
>> developers right now, even without one, so I think first thing should be
>> trying to get the most of what is available by "selling" this in a right
>> way.
>>
>> m.
>>
>>
>>
>> 2016-07-26 22:36 GMT+02:00 Ben Iofel <iofel...@gmail.com>:
>>
>>> You should contribute to https://github.com/eustasy/vala-lang.org
>>>
>>
>>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Just a news I've read about popularity langage

2016-07-28 Thread mar...@saepia.net
Hm I don't think it's really alligned with what I meant.

For example that introduction

https://github.com/eustasy/vala-lang.org/blob/master/vwiki/vala.wiki

is not-marketing driven. And so on.

None of these features give any profit to the developer alone. Even their
combination. There's no single word about strongest point - easiness of
creating multiplatform apps using fairly-high level language, requiring no
interpreter/VM, with low overhead and small enough to handle embedded
devices.

This is what I would like to see on vala's page if we are talking about
increasing interest.

I also agree that nice application framework would be something that can
give a boost. But it's a huge effort. Vala gives a lot of profits to the
developers right now, even without one, so I think first thing should be
trying to get the most of what is available by "selling" this in a right
way.

m.



2016-07-26 22:36 GMT+02:00 Ben Iofel :

> You should contribute to https://github.com/eustasy/vala-lang.org
>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Just a news I've read about popularity langage

2016-07-26 Thread mar...@saepia.net
I do not want to overlap with elementary guys if they are already doing
something, but I don't mind creating vala-lang.org or something like this
at some point.

m.

2016-07-22 16:42 GMT+02:00 Dr. Michael Lauer :

> > As an embedded system engineer I see huge potential using Vala in
> embedded
> > Linux, it has not the runtime drawback of python and java, and is way
> > simpler to use than C++, while C# has no porting to ARM.
>
> Yes. Unfortunately though the very useful POSIX profile has been removed
> from VALA
> and no substitute has been added.
>
> :M:
>
>
> ___
> 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] Just a news I've read about popularity langage

2016-07-22 Thread mar...@saepia.net
I think Vala needs a bit of "marketing" (quotes intentional).

It has to become known in the developers community as a good fit to resolve
problems within certain domain. I personally find it extremely useful for
doing multimedia stuff thanks to GStreamer. There are probably several
other "classic" areas in which Vala is superior to other solutions.

That should be clearly advertised on the proper website of Vala (now
there's only live.gnome.org/Vala which I don't think is encouraging in any
way, despite having a good content).

Look at another growing language: http://elixir-lang.org/ The first
sentence is

Elixir is a dynamic, functional language designed *for building scalable
and maintainable applications*.

They clearly define their "market".

m.

2016-07-22 10:04 GMT+02:00 Ulink :

> Am 2016-07-21 um 21:52 schrieb Adam Tauno Williams:
>
> > That is my greatest fear in picking up Vala.
>
> My fears are not that big because of the nature of the "binding": VAPI.
>
> Im using Vala now for two years for several projects and did not
> encountered any real LANGUAGE bugs.
>
> And creating or fixing VAPI bindings is relatively easy, this is the key
> point I think.
>
> --
> Bernhard
> ___
> 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] Equivalent for sqlitebck (sqlite backup)

2016-07-20 Thread mar...@saepia.net
Can't you just create a file with the DB in the SHM filesystem and then
copy it to the regular filesystem?

Marcin

2016-07-19 20:45 GMT+02:00 Adam Tauno Williams :

> I am attempting to resurrect an abandoned application, rewriting it in
> Vala.  So far vala is really nice.
>
> But I'm stuck on an equivalent for the Python module sqlitebck.
>
> sqlitebck wraps the SQLite backup/restore procedures.
>
> The applications 'opens' and SQLite database - restoring it to a
> memory:// database - and 'saves' that in memory database back to an
> SQLite on-disk database using sqlitebck.copy(source, target).
>
> How would one do an equivalent thing in Vala?
>
> --
> Adam Tauno Williams  GPG D95ED383
> OpenGroupware Developer 
>
>
> ___
> 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] GIO, GVfs, custom isolated URI handler

2016-07-13 Thread mar...@saepia.net
Hello,

isn't what you are planning an overkill? Are you sure you need a filesystem
abstraction layer for something that is basically, calling stat() a few
times?

You may also think about using GResource for compiling all resources and
linking statically with the app (that makes sense if they are not huge, of
course).

Marcin

2016-07-13 11:39 GMT+02:00 Aleksandr Palamar :

> Hi, everyone.
>
> I'm kind of new to GLib in general, but already have some basic
> understanding of how it works. I'm planning to make a game using Vala
> (which means GLib, GObject and GIO). One of the first things is to make
> isolated VFS with different mount points on file system, each of has it's
> own priority while looking for an existing file. I saw that GIO has
> something for mounting and it's own GVfs, so may I extend/set up them in
> some way to achieve my goal or that is totally another opera and I would
> have to reinvent my own bicycle?
>
> For example, while asking for file by URI resource://textures/blank.ktx it
> will try to search for (sorted by priority):
>
> ~/.game/mod/textures/blank.ktx
> ~/.game/base/textures/blank.ktx
> /opt/game/mod/textures/blank.ktx
> /opt/game/base/textures/blank.ktx
> ___
> 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] Use rust [was: Seeking for Vala programmer]

2016-06-18 Thread mar...@saepia.net
Hello

We strictly separate Web backends from the layer that does actual audio
processing so where we need http we use elixir, and where we need GStreamer
we use Vala. Communication between these layers used to be http (that's
the  point where I was considering valum) but was recently replaced by
binary protocols.

The case in broadcasting is also being reliable, being fast is cool but
it's secondary. In such case it's hard to compete with erlang VM. Any C app
can probably segfault, erlang will never do. Needless to mention builtin
fail over mechanisms.

But don't worry, there will be applications for valum for sure, we are
going to make devices where we will use internal APIs and they may be based
on valum.

M.
16.06.2016 5:30 PM "Guillaume Poirier-Morency" <
guillaumepoiriermore...@gmail.com> napisał(a):

Le jeudi 16 juin 2016 à 15:54 +0200, mar...@saepia.net a écrit :
> Valum is awesome, and I was considering it for a while but we have
> decided to use Elixir/Phoenix for our web backends (for obvious
> reasons if you are designing a soft-realtime software).

Phoenix looks really nice and complete. However, something more GLib-
based would be easier to integrate with a GStreamer audio stack I
guess.

Valum still need some work, but it's already usable and very fast. I
will probably release the 0.3 by the end of the summer.

I'm also implementing the SAGA specification https://en.wikipedia.org/w
iki/Simple_API_for_Grid_Applications if you ever need to distribute
some computation. I'm starting with the job API and a TORQUE backend
for my project.

>
> But I keep it in mind and I won't be suprised if it would have been
> used in some of our microservices later on.
>
> Marcin
>
> 2016-06-15 22:30 GMT+02:00 Guillaume Poirier-Morency  rmore...@gmail.com>:
> > I just want to state that I'm in perfect agreement with you Marcin.
> >
> > Rust might be a good system programming language, but it's clearly
> > not
> > ready for the needs of a product like RadioKit.
> >
> > Vala is a good language with incredible C binding capabilities and
> > really nice set of semantics. It has direct access to GTK and
> > GStreamer, unlike what you would have with GIR and pose reasonable
> > overhead over GObject C.
> >
> > Rewritting a working codebase because of a language hype is silly,
> > especially as it would result in a considerably lower utility.
> >
> > Yet, Rust is a really nice language with a bright future and I
> > think it
> > should inpire us putting some efforts on making Vala safer.
> >
> > Suit yourself,
> >
> > N.B. RadioKit looks really amazing and I really wish I could be
> > part of
> > it, but obligations forbids. Maybe Valum could be handy?
> >
> > Le mercredi 15 juin 2016 à 22:03 +0200, mar...@saepia.net a écrit :
> > > I don't say Rust is wrong. I don't even say it's worse than Vala
> > or
> > > less
> > > promising. There are just much more popular languages than Rust
> > that
> > > fail
> > > to maintain stable bindings to C libraries, including one I am
> > > interested
> > > of the most (GStreamer).
> > >
> > > As long as this https://crates.io/search?q=gst returns nothing
> > and
> > > this
> > > https://crates.io/search?q=glib returns bunch of immature
> > projects,
> > > it's
> > > just not an option. I am not going to spend half of my budget &
> > time
> > > for
> > > rewriting something that works perfectly in Vala just becuse some
> > > language
> > > appears to be promising.
> > >
> > > Marcin
> > >
> > >
> > > 2016-06-15 3:57 GMT+02:00 Daogang <daogangt...@126.com>:
> > >
> > > > don't care that, I just mention it.
> > > >
> > > > Rust is the most promising language in the coming 15 years,
> > > > https://www.rust-lang.org/.
> > > >
> > > > It is a system language, as c, c++, vala, but has more and more
> > > > powerful
> > > > theory basis than vala. It can reduce runtime bug significantly
> > for
> > > > its
> > > > safty feature.
> > > >
> > > > If let me choose, I want to recommand all elementary work
> > > > transfering to
> > > > rust.  :)  just keep your own direction.
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Gang Tang, Nothing is impossible.
> > > > +86 152 8102 0829
> > > >
> > > > Mamiwenwen.com, Chengdu, China.
> > > >
> > > >
>

Re: [Vala] Use rust [was: Seeking for Vala programmer]

2016-06-16 Thread mar...@saepia.net
Valum is awesome, and I was considering it for a while but we have decided
to use Elixir/Phoenix for our web backends (for obvious reasons if you are
designing a soft-realtime software).

But I keep it in mind and I won't be suprised if it would have been used in
some of our microservices later on.

Marcin

2016-06-15 22:30 GMT+02:00 Guillaume Poirier-Morency <
guillaumepoiriermore...@gmail.com>:

> I just want to state that I'm in perfect agreement with you Marcin.
>
> Rust might be a good system programming language, but it's clearly not
> ready for the needs of a product like RadioKit.
>
> Vala is a good language with incredible C binding capabilities and
> really nice set of semantics. It has direct access to GTK and
> GStreamer, unlike what you would have with GIR and pose reasonable
> overhead over GObject C.
>
> Rewritting a working codebase because of a language hype is silly,
> especially as it would result in a considerably lower utility.
>
> Yet, Rust is a really nice language with a bright future and I think it
> should inpire us putting some efforts on making Vala safer.
>
> Suit yourself,
>
> N.B. RadioKit looks really amazing and I really wish I could be part of
> it, but obligations forbids. Maybe Valum could be handy?
>
> Le mercredi 15 juin 2016 à 22:03 +0200, mar...@saepia.net a écrit :
> > I don't say Rust is wrong. I don't even say it's worse than Vala or
> > less
> > promising. There are just much more popular languages than Rust that
> > fail
> > to maintain stable bindings to C libraries, including one I am
> > interested
> > of the most (GStreamer).
> >
> > As long as this https://crates.io/search?q=gst returns nothing and
> > this
> > https://crates.io/search?q=glib returns bunch of immature projects,
> > it's
> > just not an option. I am not going to spend half of my budget & time
> > for
> > rewriting something that works perfectly in Vala just becuse some
> > language
> > appears to be promising.
> >
> > Marcin
> >
> >
> > 2016-06-15 3:57 GMT+02:00 Daogang <daogangt...@126.com>:
> >
> > > don't care that, I just mention it.
> > >
> > > Rust is the most promising language in the coming 15 years,
> > > https://www.rust-lang.org/.
> > >
> > > It is a system language, as c, c++, vala, but has more and more
> > > powerful
> > > theory basis than vala. It can reduce runtime bug significantly for
> > > its
> > > safty feature.
> > >
> > > If let me choose, I want to recommand all elementary work
> > > transfering to
> > > rust.  :)  just keep your own direction.
> > >
> > >
> > >
> > >
> > > --
> > > Gang Tang, Nothing is impossible.
> > > +86 152 8102 0829
> > >
> > > Mamiwenwen.com, Chengdu, China.
> > >
> > >
> > >
> > > 在2016年06月14 23时09分, "Al Thomas"<astav...@yahoo.co.uk>写道:
> > >
> > >
> > >
> > >
> > > From: Daogang <daogangt...@126.com>
> > > Sent: Tuesday, 14 June 2016, 13:58
> > > Subject: Re: [Vala] Seeking for Vala programmer
> > >
> > >
> > > can consider rust lang? i think it is promissing.
> > >
> > >
> > > An advantage of Vala is it has first class bindings to a large
> > > number of
> > > excellent projects, e.g. GStreamer, Gtk+.
> > > A quick search on Rust found this tutorial dated December 2015, but
> > > now
> > > advises "This guide is no longer compatible with the current
> > > codebase and
> > > thus will be rewritten in the future.":
> > >
> > > https://mmstickman.wordpress.com/2015/12/12/phoronix-reader-rust-pr
> > > ogramming-tutorial/
> > >
> > >
> > > https://www.gitbook.com/book/mmstick/rust-programming-phoronix-read
> > > er-how-to/details
> > >
> > > So maybe there is some way for Rust to go on the bindings front. I
> > > didn't
> > > look too much at other differences.
> > >
> > > Can you elaborate on your experiences with Rust and Vala that makes
> > > you
> > > recommend Rust?
> > >
> > >
> > > Personally, I find it encouraging the Marcin Lewandowski and
> > > RadioKit are
> > > looking to employ a Vala programmer. Marcin has filed a number of
> > > useful
> > > bug reports after I think investing some considerable time in using
> > > Vala. 

Re: [Vala] Use rust [was: Seeking for Vala programmer]

2016-06-15 Thread mar...@saepia.net
I don't say Rust is wrong. I don't even say it's worse than Vala or less
promising. There are just much more popular languages than Rust that fail
to maintain stable bindings to C libraries, including one I am interested
of the most (GStreamer).

As long as this https://crates.io/search?q=gst returns nothing and this
https://crates.io/search?q=glib returns bunch of immature projects, it's
just not an option. I am not going to spend half of my budget & time for
rewriting something that works perfectly in Vala just becuse some language
appears to be promising.

Marcin


2016-06-15 3:57 GMT+02:00 Daogang :

> don't care that, I just mention it.
>
> Rust is the most promising language in the coming 15 years,
> https://www.rust-lang.org/.
>
> It is a system language, as c, c++, vala, but has more and more powerful
> theory basis than vala. It can reduce runtime bug significantly for its
> safty feature.
>
> If let me choose, I want to recommand all elementary work transfering to
> rust.  :)  just keep your own direction.
>
>
>
>
> --
> Gang Tang, Nothing is impossible.
> +86 152 8102 0829
>
> Mamiwenwen.com, Chengdu, China.
>
>
>
> 在2016年06月14 23时09分, "Al Thomas"写道:
>
>
>
>
> From: Daogang 
> Sent: Tuesday, 14 June 2016, 13:58
> Subject: Re: [Vala] Seeking for Vala programmer
>
>
> can consider rust lang? i think it is promissing.
>
>
> An advantage of Vala is it has first class bindings to a large number of
> excellent projects, e.g. GStreamer, Gtk+.
> A quick search on Rust found this tutorial dated December 2015, but now
> advises "This guide is no longer compatible with the current codebase and
> thus will be rewritten in the future.":
>
> https://mmstickman.wordpress.com/2015/12/12/phoronix-reader-rust-programming-tutorial/
>
>
> https://www.gitbook.com/book/mmstick/rust-programming-phoronix-reader-how-to/details
>
> So maybe there is some way for Rust to go on the bindings front. I didn't
> look too much at other differences.
>
> Can you elaborate on your experiences with Rust and Vala that makes you
> recommend Rust?
>
>
> Personally, I find it encouraging the Marcin Lewandowski and RadioKit are
> looking to employ a Vala programmer. Marcin has filed a number of useful
> bug reports after I think investing some considerable time in using Vala. I
> hope the Vala community continues to grow and address some of those issues.
>
>
> Al
> ___
> 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


[Vala] How to set custom free function for an array?

2016-06-12 Thread mar...@saepia.net
Hello,

I am writing bindings for JACK.

I am struggling to properly handle jack_get_ports (
http://jackaudio.org/files/docs/html/group__PortSearching.html).

It returns const char **, but has to be freed by a dedicated jack_free
function instead of generic vala free func for arrays.

How can I handle this properly in Vala?

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


Re: [Vala] [OT] Vala -> C#

2016-03-29 Thread mar...@saepia.net
Excuse me but are you suggesting that Vala users should write a tool that
eases migration from Vala to C#? You are free to do it by yourself.

I agree that documentation, and overall support is incomparable between
Vala and any other enterprise-backed language and it might be much better
but what you are suggesting is an overkill. Many open source projects lack
this "developer happines" aspect as they are mainly curated by nerds, not
"product owners" but what you can do here is use time you spend on
complaining on improving this. If you don't get that philosophy, you should
stay in the safe harbour of enterprise languages.

Moreover, if speed of development was your primary need, it's your (or your
CTO if you have one) fault that you have chosen quite immature, niche
language for your work. There are shitloads of languages and frameworks
that are aimed at doing stuff fast, usually in exchange for performance,
resources consumption or low-level access to the bare metal.

I also sometimes spend ages on debugging low level stuff in Vala. But I
don't complain because it's still the best choice for writing
GStreamer-backed, truly cross platform multimedia applications that won't
get accidental lock because of garbage collector. For this use case it's
close to perfection. Maybe your use case was just differentbut. I am not
sure if your disappointment is fault of Vala and tools for migrating to C#
would have sorted that issue out.

Still, I agree that even within open source community there are examples of
better documentation/support/whatsoever but I consider this to be secondary
to your arguments.

m.

2016-03-29 0:48 GMT+02:00 Edwin De La Cruz :

> 2016-03-28 16:19 GMT-05:00 Edwin De La Cruz :
> > 2016-03-26 9:59 GMT-05:00 Steven Oliver :
> >> If having an IDE is high on your list check out builder. It's support
> for
> >> Vala is getting better every release. They are also really good about
> taking
> >> new contributors.
> >>
> >> Thank you,
> >> Steven N. Oliver
> >>
> >>
> >>
> >> On Thu, Mar 24, 2016 at 7:49 PM -0700, "Edwin De La Cruz"
> >>  wrote:
> >>
> >>> Dear. I'm using valac for quite some time, although work has been left
> >>> aside, I'm starting to use c #, I find it more productive but I refuse
> >>> to use it and recognize it, but it is.
> >>>
> >>> Among the ideas that came to my mind, including _mono_, I thought ...
> >>> because someone does not develop something similar to c # but Vala,
> >>> who has the same name functions, classes, methods, etc so if I have
> >>> one codigo.cs simply change it by codigo.vala and compile directly.
> >>>
> >>> I know it's an idea a little crazy and not all libraries can be
> >>> imported, but whether it would be much easier and productive to have
> >>> such a code.
> >>>
> >>> I program in C # using their mimas classes, but at the time of
> >>> compiling all transforms Vala.
> >>>
> >>> It would be great as well.
> >>>
> >>> I have made the task of doing that only with the most basic functions,
> >>> just to prove, as a hobby.
> >>>
> >>> In the years that I go with Vala language seems very much potential,
> >>> but lacks an IDE, MonoDevelop no longer supports it, also lacks more
> >>> documentation, easier to use libraries as well as in c #.
> >>>
> >>> Sorry for the extension of this message and perhaps not relevant but
> >>> needed to relieve the sadness of having to change Vala by c #.
> >>>
> >>> See you soon.
> >>>
> >>>
> >>> Mis proyectos de software libre en:
> >>> Github - edwinspire
> >>> ___
> >>> vala-list mailing list
> >>> vala-list@gnome.org
> >>> https://mail.gnome.org/mailman/listinfo/vala-list
> >
> >
> > Well, actually the IDE is not a priority, I've driven with gedit well,
> > that's no problem.
> >
> > Even I became a microide, what helps me is to compile and link the
> > binary libraries which depends with a simple click.
> >
> > Where I see the difficulty, or rather the obstacles to develop faster,
> > is in the documentation, examples, and functions that facilitate the
> > work.
> >
> > For example, to send an email in SMTP in c # is a matter of a couple
> > of lines and ready. With Vala me it was very difficult.
> >
> > Worse even if my applications development on the Linux (GNU / Debian)
> > but to deliver them to production will run on Windows.
> >
> > Last week tried C # to replace some parts where used Vala and I found
> > it very easy with Monodevelop.
> >
> > In 2 days with c # did the same as 8 days with Vala.
> >
> > What I suggested was to make a package that has the same functions and
> > classes that exist in C # but Vala, with the same names, which is
> > identical, so it would be very easy to move from one language to
> > another.
> >
> >
> > Mis proyectos de software libre en:
> > Github - edwinspire
>
> I meant to do something Como this:
> https://github.com/edwinspire/VSharp It is 

Re: [Vala] Need help in debugging async code

2016-03-20 Thread mar...@saepia.net
Felipe, SIGSTOP is real signal issued by the OS that has stopped the
execution.

Michele, it seems you were right. I've changed all callback() calls to
Idle.add(myfunc.callback) so I am 100% sure that they are async and crashes
stopped to occur.

I must admit that it was one of the weirdest bugs I've encountered ever. It
caused for instance Soup.Session from libsoup to stop using custom
TlsDatabase after some time and returing SSL error for all connections, or
crashes in GLib's memory allocators.

Awkward. I think such warning that code must be async in 100% cases should
be explicitely added to the documentation.

m.

2016-03-18 16:29 GMT+01:00 Felipe Lavratti <felipe...@gmail.com>:

> Hey, Why did you get a SIGSTOP on top of the stack trace? Is it emitted
> from the code you use to print the stacktrace or it is the real signal that
> stopped execution?
>
> On Fri, Mar 18, 2016 at 6:22 AM mar...@saepia.net <mar...@saepia.net>
> wrote:
>
>> Felipe, it's non threaded.
>>
>> Michele, good hint! I will check that.
>>
>> m.
>>
>> 2016-03-18 6:47 GMT+01:00 <michele.dioni...@gmail.com>:
>>
>>> A crash can happes if you call the callback to wakeup before the yield.
>>> Are you completly sure that your code is completly asyncrounous in any
>>> condition.
>>>
>>> Il ven mar 18 01:05:05 2016 GMT+0100, Felipe Lavratti scrive:
>>> > Hey Marcin,
>>> >
>>> > Just wondering,
>>> > Is your program using threading or any threaded object that is handled
>>> in
>>> > this part of code?
>>> >
>>> >
>>> >
>>> >
>>> > On Thu, Mar 17, 2016 at 20:44 mar...@saepia.net <mar...@saepia.net>
>>> wrote:
>>> >
>>> > > Hi all,
>>> > >
>>> > > I encounter random crashes in my app, which (it's my guess) is
>>> triggered
>>> > > when I call callback in async method.
>>> > >
>>> > > Such as
>>> > >
>>> > > public async void something() {
>>> > >   SourceFunc callback_ref = something.callback;
>>> > >
>>> > >   do_something_that_calls_another_callback(() => {
>>> > > callback_ref(); // here's crash happening. approximately 1/1
>>> calls
>>> > >   });
>>> > >
>>> > >   yield;
>>> > > }
>>> > >
>>> > > The chain of async calls is nested.
>>> > >
>>> > > I get stack traces like this:
>>> > >
>>> > >
>>> https://gist.githubusercontent.com/mspanc/9ca4795f48e56149a9a2/raw/9be534c66409b26820a66d54f8610f2aa6306e1e/gistfile1.txt
>>> > >
>>> > > It's rather hard to believe that such basic thing as memory
>>> allocation is
>>> > > broken in GLib.
>>> > >
>>> > > Crash happens totally randomly, once per 1-3 days. You can imagine
>>> how hard
>>> > > is to collect test cases. I am trying to hunt more stack traces in
>>> order to
>>> > > find a pattern, but maybe in the meantime anyone here can share
>>> experience
>>> > > in debugging such issues?
>>> > >
>>> > > Or maybe there are some well-known bugs or antipatterns related to
>>> async
>>> > > functions that should be avoided?
>>> > >
>>> > > I use GLib 2.44 & Vala 0.30.0. I will try to upgrade to 2.46 but I
>>> see
>>> > > nothing related in the changelog.
>>> > >
>>> > > m.
>>> > > ___
>>> > > 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
>>> >
>>>
>>
>>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Need help in debugging async code

2016-03-19 Thread mar...@saepia.net
Hi all,

I encounter random crashes in my app, which (it's my guess) is triggered
when I call callback in async method.

Such as

public async void something() {
  SourceFunc callback_ref = something.callback;

  do_something_that_calls_another_callback(() => {
callback_ref(); // here's crash happening. approximately 1/1 calls
  });

  yield;
}

The chain of async calls is nested.

I get stack traces like this:
https://gist.githubusercontent.com/mspanc/9ca4795f48e56149a9a2/raw/9be534c66409b26820a66d54f8610f2aa6306e1e/gistfile1.txt

It's rather hard to believe that such basic thing as memory allocation is
broken in GLib.

Crash happens totally randomly, once per 1-3 days. You can imagine how hard
is to collect test cases. I am trying to hunt more stack traces in order to
find a pattern, but maybe in the meantime anyone here can share experience
in debugging such issues?

Or maybe there are some well-known bugs or antipatterns related to async
functions that should be avoided?

I use GLib 2.44 & Vala 0.30.0. I will try to upgrade to 2.46 but I see
nothing related in the changelog.

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


Re: [Vala] Need help in debugging async code

2016-03-18 Thread mar...@saepia.net
Felipe, it's non threaded.

Michele, good hint! I will check that.

m.

2016-03-18 6:47 GMT+01:00 <michele.dioni...@gmail.com>:

> A crash can happes if you call the callback to wakeup before the yield.
> Are you completly sure that your code is completly asyncrounous in any
> condition.
>
> Il ven mar 18 01:05:05 2016 GMT+0100, Felipe Lavratti scrive:
> > Hey Marcin,
> >
> > Just wondering,
> > Is your program using threading or any threaded object that is handled in
> > this part of code?
> >
> >
> >
> >
> > On Thu, Mar 17, 2016 at 20:44 mar...@saepia.net <mar...@saepia.net>
> wrote:
> >
> > > Hi all,
> > >
> > > I encounter random crashes in my app, which (it's my guess) is
> triggered
> > > when I call callback in async method.
> > >
> > > Such as
> > >
> > > public async void something() {
> > >   SourceFunc callback_ref = something.callback;
> > >
> > >   do_something_that_calls_another_callback(() => {
> > > callback_ref(); // here's crash happening. approximately 1/1
> calls
> > >   });
> > >
> > >   yield;
> > > }
> > >
> > > The chain of async calls is nested.
> > >
> > > I get stack traces like this:
> > >
> > >
> https://gist.githubusercontent.com/mspanc/9ca4795f48e56149a9a2/raw/9be534c66409b26820a66d54f8610f2aa6306e1e/gistfile1.txt
> > >
> > > It's rather hard to believe that such basic thing as memory allocation
> is
> > > broken in GLib.
> > >
> > > Crash happens totally randomly, once per 1-3 days. You can imagine how
> hard
> > > is to collect test cases. I am trying to hunt more stack traces in
> order to
> > > find a pattern, but maybe in the meantime anyone here can share
> experience
> > > in debugging such issues?
> > >
> > > Or maybe there are some well-known bugs or antipatterns related to
> async
> > > functions that should be avoided?
> > >
> > > I use GLib 2.44 & Vala 0.30.0. I will try to upgrade to 2.46 but I see
> > > nothing related in the changelog.
> > >
> > > m.
> > > ___
> > > 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
> >
>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] [job offer] Remote senior Vala programmer wanted

2016-03-07 Thread mar...@saepia.net
RadioKit (http://www.radiokit.org) is an European startup with first paying
clients and initial product-market fit that is making sophisticated
cloud-based solutions for radio stations.

RadioKit seeks remote senior Vala programmer to take over development of
some standalone, multiplatform (windows, linux, mac, ios) tools that are
core components of RadioKit distributed systems.

Systems in general have microservices architecture, tools written in Vala
are installed on end-user devices and have to be very reliable. They are
written in pattern similar to Redux (http://redux.js.org/) so knowledge of
such patterns is welcome. They in most cases act as a daemons that have
embedded web-based UI written in React.JS.

Requirements:

- Good understanding of GLib stack
- Good understanding of Vala
- Good understanding of HTTP/WebSockets in theory and libsoup in practice
- GStreamer knowledge enough to construct and understand simple pipelines
- At least fair understanding of Autotools
- Good attitude to test-driven development
- Right to act as a contractor to the EU-based company (if must have a
company or be self-employed, or be an EU citizen)

Welcome but not necessary:

- Knowledge of React.JS
- Experience in compiling GLib apps on Android (JNI) and/or Mac OS X/iOS
- Experience in configuring CI
- Experience in debian packaging
- Experience in cross compilation on Linux

The job consists of series of tasks that can be done one after another or
in chunks, so it may be either one 3-6 months long contract or longer
relationship without full-time commitment.

Please send your offers with

- any sort of portfolio/github link/whatever that shows your skillset
- proposed renumeration scheme
- your availability

to me at mar...@radiokit.org with "Vala programmer" in the subject.

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


Re: [Vala] How to properly define struct in manually written VAPI?

2016-03-02 Thread mar...@saepia.net
It was long time ago, indeed:
https://bugzilla.gnome.org/show_bug.cgi?id=651271

Wow, how fast the time passes.

Ok, maybe I will give it another try :)

m.

2016-03-02 17:59 GMT+01:00 Ben Iofel <iofel...@gmail.com>:

> If you can make it segfault, please file a bug or at least post the code
> here
>
>
> On Wed, Mar 2, 2016, 11:09 AM mar...@saepia.net <mar...@saepia.net> wrote:
>
>> Hello,
>>
>> thank you for suggestions. I'll try to implement them.
>>
>> But should I keep it as struct or rather compact class?
>>
>> Regarding json-glib: I intentionally try to avoid it. I was able to make
>> segfault even with a few simple attempts that should be tested in properly
>> written library, I don't need mapping for GObject properties, and I think I
>> encountered also some issues with big integers, I don't remember now. In my
>> use case more low level, better-tested library will a be better choice.
>>
>> m.
>>
>> 2016-03-02 15:28 GMT+01:00 Ben <iofel...@gmail.com>:
>>
>>> FYI, Vala already has binding for json-glib
>>> http://valadoc.org/#!api=json-glib-1.0/Json
>>> It has nice features like deserialization with GObject properties
>>>
>>> On Wed, Mar 2, 2016 at 5:19 AM, mar...@saepia.net <mar...@saepia.net>
>>> wrote:
>>>
>>> Hello, I need to write VAPI for jansson JSON library. I have already
>>> started ( https://github.com/akheron/jansson/pull/273) and generally
>>> speaking it works fine but I have an issue with covering one struct. In C
>>> code there's the following struct: #define JSON_ERROR_TEXT_LENGTH 160
>>> #define JSON_ERROR_SOURCE_LENGTH 80 typedef struct { int line; int column;
>>> int position; char source[JSON_ERROR_SOURCE_LENGTH]; char
>>> text[JSON_ERROR_TEXT_LENGTH]; } json_error_t; it is an output parameter to
>>> function that should have the following syntax in Vala: loads(string input,
>>> LoadFlags flags, out Error error) I struggle to properly define it in VAPI.
>>> When I define it like this: [CCode (cname = "json_error_t", has_type_id =
>>> false)] public struct Error { public string text; public string source;
>>> public int line; public int column; public size_t position; } it complains
>>> about missing copy function during C compilation phase when I add [CCode
>>> (cname = "json_error_t", has_copy_function = false, has_type_id = false)]
>>> public struct Error { public string text; public string source; public int
>>> line; public int column; public size_t position; } it then throws
>>> api/auth/oauth2.c:939:2: error: array type 'char [160]' is not assignable
>>> _g_free0 ((*dest).text); ^  api/auth/oauth2.c:51:28: note:
>>> expanded from macro '_g_free0' api/auth/oauth2.c:940:15: error: array type
>>> 'char [160]' is not assignable (*dest).text = _tmp1_;  ^
>>> api/auth/oauth2.c:943:2: error: array type 'char [80]' is not assignable
>>> _g_free0 ((*dest).source); ^ ~~ How to define it properly?
>>> Underlying API does not provide any destroy/copy functions. I also tried to
>>> convert it to the compact class but then Vala Compiler creates
>>> pointer-to-pointer for underlying C code for the parameter which is
>>> improper. Thanks, Marcin ___
>>> 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 properly define struct in manually written VAPI?

2016-03-02 Thread mar...@saepia.net
Hello,

thank you for suggestions. I'll try to implement them.

But should I keep it as struct or rather compact class?

Regarding json-glib: I intentionally try to avoid it. I was able to make
segfault even with a few simple attempts that should be tested in properly
written library, I don't need mapping for GObject properties, and I think I
encountered also some issues with big integers, I don't remember now. In my
use case more low level, better-tested library will a be better choice.

m.

2016-03-02 15:28 GMT+01:00 Ben <iofel...@gmail.com>:

> FYI, Vala already has binding for json-glib
> http://valadoc.org/#!api=json-glib-1.0/Json
> It has nice features like deserialization with GObject properties
>
> On Wed, Mar 2, 2016 at 5:19 AM, mar...@saepia.net <mar...@saepia.net>
> wrote:
>
> Hello, I need to write VAPI for jansson JSON library. I have already
> started ( https://github.com/akheron/jansson/pull/273) and generally
> speaking it works fine but I have an issue with covering one struct. In C
> code there's the following struct: #define JSON_ERROR_TEXT_LENGTH 160
> #define JSON_ERROR_SOURCE_LENGTH 80 typedef struct { int line; int column;
> int position; char source[JSON_ERROR_SOURCE_LENGTH]; char
> text[JSON_ERROR_TEXT_LENGTH]; } json_error_t; it is an output parameter to
> function that should have the following syntax in Vala: loads(string input,
> LoadFlags flags, out Error error) I struggle to properly define it in VAPI.
> When I define it like this: [CCode (cname = "json_error_t", has_type_id =
> false)] public struct Error { public string text; public string source;
> public int line; public int column; public size_t position; } it complains
> about missing copy function during C compilation phase when I add [CCode
> (cname = "json_error_t", has_copy_function = false, has_type_id = false)]
> public struct Error { public string text; public string source; public int
> line; public int column; public size_t position; } it then throws
> api/auth/oauth2.c:939:2: error: array type 'char [160]' is not assignable
> _g_free0 ((*dest).text); ^  api/auth/oauth2.c:51:28: note:
> expanded from macro '_g_free0' api/auth/oauth2.c:940:15: error: array type
> 'char [160]' is not assignable (*dest).text = _tmp1_;  ^
> api/auth/oauth2.c:943:2: error: array type 'char [80]' is not assignable
> _g_free0 ((*dest).source); ^ ~~ How to define it properly?
> Underlying API does not provide any destroy/copy functions. I also tried to
> convert it to the compact class but then Vala Compiler creates
> pointer-to-pointer for underlying C code for the parameter which is
> improper. Thanks, Marcin ___
> 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


[Vala] How to properly define struct in manually written VAPI?

2016-03-02 Thread mar...@saepia.net
Hello,

I need to write VAPI for jansson JSON library. I have already started (
https://github.com/akheron/jansson/pull/273) and generally speaking it
works fine but I have an issue with covering one struct.

In C code there's the following struct:


#define JSON_ERROR_TEXT_LENGTH160
#define JSON_ERROR_SOURCE_LENGTH   80

typedef struct {
int line;
int column;
int position;
char source[JSON_ERROR_SOURCE_LENGTH];
char text[JSON_ERROR_TEXT_LENGTH];
} json_error_t;


it is an output parameter to function that should have the following syntax
in Vala:

loads(string input, LoadFlags flags, out Error error)

I struggle to properly define it in VAPI. When I define it like this:

  [CCode (cname = "json_error_t",  has_type_id = false)]
  public struct Error {
public string text;
public string source;
public int line;
public int column;
public size_t position;
  }

it complains about missing copy function during C compilation phase

when I add

  [CCode (cname = "json_error_t", has_copy_function = false, has_type_id =
false)]
  public struct Error {
public string text;
public string source;
public int line;
public int column;
public size_t position;
  }

it then throws

api/auth/oauth2.c:939:2: error: array type 'char [160]' is not assignable
_g_free0 ((*dest).text);
^ 
api/auth/oauth2.c:51:28: note: expanded from macro '_g_free0'
api/auth/oauth2.c:940:15: error: array type 'char [160]' is not assignable
(*dest).text = _tmp1_;
 ^
api/auth/oauth2.c:943:2: error: array type 'char [80]' is not assignable
_g_free0 ((*dest).source);
^ ~~


How to define it properly? Underlying API does not provide any destroy/copy
functions.

I also tried to convert it to the compact class but then Vala Compiler
creates pointer-to-pointer for underlying C code for the parameter which is
improper.

Thanks,

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


Re: [Vala] Is there any way to access generic type from the interface?

2016-02-28 Thread mar...@saepia.net
Hello,

of course I made mistake in my code.

I want to do interface that acts as a mixin, which will be mixed into class
specifies generic type, and I want methods from this mixin return the same
type as class that embeds the mixin.

Now I create interface with generic type, so in the parent class I have to
write

public class MyClass : MyBaseClass, MyInterface {

}

but it's kind of redundant. I would like to write

public class MyClass : MyBaseClass, MyInterface {

}

and access from MyInterface information that SomeType was passed to
MyBaseClass as generic type.

Is it possible at all?

m.

2016-02-28 2:12 GMT+01:00 Felipe Lavratti <felipe...@gmail.com>:

> Hey Marcin,
>
> What is exactly you need from interfaces in your code ?Are you doing
> Dependency Inversion?
>
> Felipe
>
>
> On Sat, Feb 27, 2016 at 4:40 PM Daniel Espinosa <eso...@gmail.com> wrote:
>
>> Is not valid code. Interfaces should "derive" from Object. Interfaces
>> list dependencies, the first one should be Object, then other interfaces
>> depends on, the order matters, because if other interfaces depends on same,
>> they should be added first.
>>
>> For your question, use typeof(G)
>> El feb. 27, 2016 1:26 PM, "Felipe Lavratti" <felipe...@gmail.com>
>> escribió:
>>
>>> I don't know if your code is valid Vala. MyInterface should not inherit
>>> MyClass.
>>>
>>> On Sat, Feb 27, 2016 at 10:59 mar...@saepia.net <mar...@saepia.net>
>>> wrote:
>>>
>>> > Hello,
>>> >
>>> > I am planning to use interfaces as in vspec as they are nice syntax
>>> sugar
>>> > for my purpose.
>>> >
>>> > However, in order to make it working properly, I need to access type
>>> > defined as generic in the parent class implementing interface.
>>> Something
>>> > like
>>> >
>>> > public interface MyIface : MyClass {
>>> >   public MyGenericType something() {
>>> > ...
>>> >   }
>>> > }
>>> >
>>> >
>>> > public abstract class MyClass : MyIface {
>>> >
>>> > }
>>> >
>>> >
>>> > Is it possible in any way?
>>> >
>>> > m.
>>> > ___
>>> > 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
>>>
>>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Is there any way to access generic type from the interface?

2016-02-27 Thread mar...@saepia.net
Hello,

I am planning to use interfaces as in vspec as they are nice syntax sugar
for my purpose.

However, in order to make it working properly, I need to access type
defined as generic in the parent class implementing interface. Something
like

public interface MyIface : MyClass {
  public MyGenericType something() {
...
  }
}


public abstract class MyClass : MyIface {

}


Is it possible in any way?

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


[Vala] Storing a list of delegates with targets?

2016-02-20 Thread mar...@saepia.net
Hello,

I am writing a program where I would like to have possibility to add
arbitrary amount of callbacks which must be delegates.

I would like to store them somewhere, and then call one after another when
it's appropriate.

My first step was

public class Test : Object {

  public void delegate MyFunc();
  private List funcs = new List();

  public void add(MyFunc func) {
this.funcs.append(func);
  }
}

But vala compiler complains about the fact that delegates with targets
can't be used as generics.

Is there any clear way of doing this at the moment (I am using vala 0.30).

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


Re: [Vala] Testing framework

2016-02-20 Thread mar...@saepia.net
I have started working on such project,

first effects are here: https://github.com/mspanc/vspec

m.

2016-02-02 3:25 GMT+01:00 Chris Daley :

> Hi Evan,
> Thanks for the offer, I've sent you a pull request on Github. I've got some
> new Vala posts in the can that aren't related to Valadate that should be up
> later this week as well.
> Cheers
> Chris D
>
> 2016-02-01 16:12 GMT-08:00 Evan Nemerson :
>
> > Since you're actively blogging about Vala, how would you feel about
> > being added to Planet Vala (planet.vala-project.org)?  Nobody on is
> > very active right now, so it would be good to get some new blood…
> >
> >
> > On Mon, 2016-02-01 at 14:37 -0800, Chris Daley wrote:
> > > Hi Steven,
> > >
> > > It's still very much active, I've just had to take some time out to
> > > do some
> > > work on my night job (managing a Rock band). I'm drafting a blog post
> > > this
> > > afternoon with an update on progress and some new ways to contribute,
> > > so
> > > stay tuned.
> > >
> > > Cheers
> > > Chris D
> > >
> > >
> > >
> > > 2016-02-01 14:22 GMT-08:00 Steven Oliver :
> > >
> > > > Hey,
> > > > I just wanted to drop in and see if any progress had been made on
> > > > this?
> > > >
> > > > I for one am very excited about the possibility.
> > > >
> > > > Thank you,
> > > > Steven N. Oliver
> > > >
> > > >
> > > >
> > > > On Fri, Jan 8, 2016 at 2:55 PM -0800, "Chris Daley"  > > > il.com>
> > > > wrote:
> > > >
> > > > Hi Al,
> > > > >
> > > > > Thanks for the input, this is very much appreciated and
> > > > > incredibly useful!
> > > > > I had in fact just written a post on my blog asking for exactly
> > > > > this sort
> > > > > of feedback - you can read it here -http://chrisdaley.biz/test-dr
> > > > > iven-development-in-vala-pt-1.html
> > > > >
> > > > > I've got some time to work on this over the next few weeks and
> > > > > hope to have
> > > > > a usable release out for testing not long after, so now's the
> > > > > time for
> > > > > anyone else interested in a testing framework to hit me up with
> > > > > your ideas!
> > > > >
> > > > > Have a good weekend,
> > > > > Cheers
> > > > > Chris D
> > > > >
> > > > >
> > > > > 2016-01-08 14:29 GMT-08:00 Al Thomas :
> > > > >
> > > > > > > From: Chris Daley
> > > > >
> > > > > >
> > > > > > > Sent: Tuesday, 5 January 2016, 1:16
> > > > > > > Subject: Re: [Vala] Testing framework
> > > > > > >
> > > > > > > I've done some thinking about this over the last couple of
> > > > > > > months and
> > > > > > used
> > > > > > > the holiday period to finish off a few things, namely a port
> > > > > > > of Gherkin
> > > > > > to
> > > > > > > Vala. You can grab it from here if you want to check it out:
> > > > > > > https://github.com/chebizarro/gherkin-vala
> > > > > > >
> > > > > > > I'm going to be sketching out what I think is a reasonable
> > > > > > > roadmap over the next week or so with a view to an alpha
> > > > > > > release around
> > > > > > the
> > > > > > > end of February. If anyone is interested in contributing, or
> > > > > > > has any
> > > > > > > specific ideas about what sort of features they would find
> > > > > > > the most
> > > > > > useful,
> > > > > >
> > > > > > > please get in touch
> > > > > >
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > Great work on porting Gherkin 3 to Vala.
> > > > > >
> > > > > > I wanted to put forward a few ideas that I have been slowly
> > > > > > researching over the past year or so in the hope they are
> > > > > >
> > > > > > insightful to any developments of testing tools for Vala.
> > > > > >
> > > > > > Gherkin
> > > > > > ---
> > > > > > Gherkin is a language for structuring human language in a
> > > > > > way that allows business analysts, developers and testers to
> > > > > > define
> > > > > > features of an application.
> > > > > >
> > > > > > Some computer languages have tools available to developers to
> > > > > > convert
> > > > > >
> > > > > > Gherkin to an outline of a computer program. The following
> > > > > > meaningless
> > > > > >
> > > > > > example shows the structure. This uses PHP's Behat to convert
> > > > > > Gherkin
> > > > > >
> > > > > > to PHP:
> > > > > >
> > > > > > Feature: test
> > > > > >
> > > > > > Background: given this is a test # features/test.feature:3
> > > > > >
> > > > > > Scenario: testing of app # features/test.feature:5
> > > > > > When i run something
> > > > > > Then it passes
> > > > > >
> > > > > > 1 scenario (1 undefined)
> > > > > > 2 steps (2 undefined)
> > > > > > 0m0.17s (9.41Mb)
> > > > > >
> > > > > > --- FeatureContext has missing steps. Define them with these
> > > > > > snippets:
> > > > > >
> > > > > > /**
> > > > > > * @When i run something
> > > > > > */
> > > > > > public function iRunSomething()
> > > > > > {
> > > > > > throw new PendingException();
> > > > > > }
> > > > > >
> > > > > > /**
> > > > > > * @Then it passes
> > > > > > */
> > > > > > public 

Re: [Vala] How to test async methods?

2016-02-20 Thread mar...@saepia.net
thanks!

m.

2016-02-17 15:51 GMT+01:00 Ben Iofel <iofel...@gmail.com>:

> You need a MainLoop to run async methods in vala
>
> On Tue, Feb 16, 2016, 8:19 AM mar...@saepia.net <mar...@saepia.net> wrote:
>
>> Hello,
>>
>> I need some advice on testing async methods.
>>
>> When I run .begin() in the isolated test suite (where mainloop is not
>> running) it seems that .end() callback never gets called.
>>
>> What is the best way to trigger running async methods? Should I just spawn
>> mainloop on purpose or is there any clearer way to do this?
>>
>> Thank you in advance,
>>
>> Marcin
>> ___
>> 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


[Vala] How to test async methods?

2016-02-16 Thread mar...@saepia.net
Hello,

I need some advice on testing async methods.

When I run .begin() in the isolated test suite (where mainloop is not
running) it seems that .end() callback never gets called.

What is the best way to trigger running async methods? Should I just spawn
mainloop on purpose or is there any clearer way to do this?

Thank you in advance,

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


[Vala] Need help in async methods

2016-01-16 Thread mar...@saepia.net
Hello,

I am trying to create a function is synchronous and block for the outer
world, but internally

a) does nothing unless certain callback is called
b) does not block mainloop

Something like synchronous HTTP calls in libsoup - you do request, the
execution if caller is stopped until it's done, the result is just returned
but internally it does asynchronous operations and does not block the whole
program.


I read tutorial and samples but I still struggle to find the valid pattern,
I came to the point that looks more less like this:

public class MyClass : Object {
  private OtherClass other;
  private SourceFunc other_callback;
  private bool   other_result;


  public bool dosomething() {
// What should I put here to block callee and call dosomething_async
asynchronously?
  }


  public async bool dosomething_async() {
this.other = new OtherClass();
this.other.finished.connect(on_other_finished);

this.other_callback = dosomething_async.callback;
yield;
// Now everything except the callee should continue execution
// unless OtherClass sends us a callback
  }
}


private void on_other_finished(bool result) {
  // Task is finished, should unblock dosomething();
  this.other_result = result;
  this.other_callback();
}


int main(string[] argv) {
  var instance = new MyClass();
  var result = instance.dosomething(); // <-- this should block

  return 0;
}


Thank you for your help

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


[Vala] Why valac is always called even if conditional automake clause is false?

2016-01-15 Thread mar...@saepia.net
Hello,

I have the following makefile that is responsible for conditional
compilation of one subdir of my project depending on the platform used:
https://gist.github.com/mspanc/5b31758b966fa6eab959

I am using automake's AM_CONDITIONAL to pass information about operating
system to further scripts.

It works (almost) well, the code compiles, but I've noticed that when I
call make in this subdir, it calls valac for all source files, even these
not matched by current condition:

$ make
rm -f libwhatever_common_media_audio_la_vala.stamp && echo stamp >
libwhatever_common_media_audio_la_vala.stamp-t
CDPATH="${ZSH_VERSION+.}:" && cd . && /usr/local/bin/valac --library
libwhatever-common-1.0-media-audio --vapi
libwhatever-common-1.0-media-audio.vapi -H media-audio.h
--enable-experimental --enable-experimental-non-null  -D PLATFORM_DARWIN
-C lifecycle.vala base_interface_monitor.vala
base_polling_interface_monitor.vala interface_monitor.vala
windows/lifecycle.vapi windows/interface_list.vapi
windows/interface_monitor.vala darwin/interface_list.vapi
darwin/interface_monitor.vala linux/interface_monitor.vala

(here should exclude windows/ and linux/ subdir as it was called on mac)

VALAFLAGS are set correctly, so conditionals are working fine for other
cases.

How to prevent this?

Is it a bug in automake's vala extensions or am I doing something wrong?

Thanks,

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


Re: [Vala] How to connect to signal if there's a property with the same name?

2015-12-10 Thread mar...@saepia.net
Not really, because I don't want to poll and check periodically if
connection is closed but to get event when it is closed.

For now I've invented something like this. Works but I have no clue yet if
there are no memleaks.


private bool on_dbus_server_new_connection(DBusServer server,
DBusConnection connection) {
  info(@"[Daemon] New connection
$(get_dbus_connection_remote_address(connection))");

  Signal.connect_object(connection, "closed",
(Callback)on_dbus_connection_closed, this, 0);

  on_dbus_connection_ready(connection);

  connection.ref();
  return true;
}


private delegate void DBusConnectionClosed(DBusConnection
connection, bool remote_peer_vanished);
private static void on_dbus_connection_closed(DBusConnection
connection, bool remote_peer_vanished) {
  info(@"[Daemon] Closed connection
$(get_dbus_connection_remote_address(connection)), remote peer vanished =
$(remote_peer_vanished)");

  connection.unref();
}


m.

2015-12-10 21:07 GMT+01:00 Al Thomas <astav...@yahoo.co.uk>:

> >From: "mar...@saepia.net" <mar...@saepia.net>
> >Sent: Thursday, 10 December 2015, 19:52
> >Subject: Re: [Vala] How to connect to signal if there's a property with
> the same name?
> >
> >I cannot rename this, this is part of GIO.
> >
>
> >
> https://developer.gnome.org/gio/stable/GDBusConnection.html#GDBusConnection--closed
>
> Hmm, there is also an is_closed() call:
>
> https://developer.gnome.org/gio/stable/GDBusConnection.html#g-dbus-connection-is-closed
>
> That would hopefully work around the name clash for you.
>
>
> I'm not sure how the name clash should be resolved in the bindings.
>
> Al
>
> >
> >m.
> >
> >
> >2015-12-10 16:29 GMT+01:00 Al Thomas <astav...@yahoo.co.uk>:
> >>Rename your property as 'is_closed', e.g.
> >>
> >>if ( connection.is_closed ) { }
> >>
> >>Otherwise I don't know.
> >>
> >>Al
> ___
> 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


[Vala] How to connect to signal if there's a property with the same name?

2015-12-10 Thread mar...@saepia.net
Hello,

I need to connect to "closed" signal of GDBusConnection, but because there
is a property with the same name, valac refuses to compile and throws the
following error

src/common/daemon/base.vala:63.11-63.35: error: The name `connect' does not
exist in the context of `bool'
  connection.closed.connect(on_dbus_connection_closed);
  ^

How can I overcome this?

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


[Vala] Testing framework

2015-12-09 Thread mar...@saepia.net
Hello,

I am coming back to vala development after a while and I wonder, are there
any new/recommended testing frameworks besides one built-in into GLib?

I dream about something like RSpec to Vala, can you recommend any projects
like this?

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


[Vala] Problems with building app with GStreamer in MSYS2/Win64

2015-12-09 Thread mar...@saepia.net
Hello

I am trying to build simple app written in Vala 0.30 and link them with
windows 64-bit build of GStreamer 1.6.1. I also want to reuse GObject, GLib
and Soup that ship with GStreamer so I don't introduce another dependencies.

I apologize if this is not truly Vala related, but I cannot assess whether
this is related to boilerplate code generated by Vala or not.

I've fetched MSYS2 and added lib/pkgconfig from GStreamer installation dir
to the PKG_CONFIG_PATH and pkg-config correctly recognizes all libraries.

However, when I try to build the app the following error occur.

I've found out that such issue often is related to cross-compilation issues
but I have no clue how to proceed with this exact case. Any suggestions?

Log below,

thank you

Marcin


 make
make  all-am
make[1]: Wejście do katalogu '/home/Marcin/aktivitis/app/electron-backbone'
gcc -DHAVE_CONFIG_H -I. -mms-bitfields
-I/c/gstreamer/1.0/x86_64/include/glib-2.0
-I/c/gstreamer/1.0/x86_64/lib/glib-2.0/include  -mms-bitfields
-I/c/gstreamer/1.0/x86_64/include/gstreamer-1.0
-I/c/gstreamer/1.0/x86_64/lib/gstreamer-1.0/include
-I/c/gstreamer/1.0/x86_64/include/glib-2.0
-I/c/gstreamer/1.0/x86_64/lib/glib-2.0/include  -mms-bitfields
-I/c/gstreamer/1.0/x86_64/include/glib-2.0
-I/c/gstreamer/1.0/x86_64/lib/glib-2.0/include  -mms-bitfields
-I/c/gstreamer/1.0/x86_64/include/libsoup-2.4
-I/c/gstreamer/1.0/x86_64/include/libxml2
-I/c/gstreamer/1.0/x86_64/include/glib-2.0
-I/c/gstreamer/1.0/x86_64/lib/glib-2.0/include  -g -O2 -MT
src/library/parsers/app_electron_backbone_daemon-versions_result.o -MD -MP
-MF
src/library/parsers/.deps/app_electron_backbone_daemon-versions_result.Tpo
-c -o src/library/parsers/app_electron_backbone_daemon-versions_result.o
`test -f 'src/library/parsers/versions_result.c' || echo
'./'`src/library/parsers/versions_result.c
In file included from
/c/gstreamer/1.0/x86_64/lib/glib-2.0/include/glibconfig.h:14:0,
 from
/c/gstreamer/1.0/x86_64/include/glib-2.0/glib/gtypes.h:32,
 from
/c/gstreamer/1.0/x86_64/include/glib-2.0/glib/galloca.h:32,
 from /c/gstreamer/1.0/x86_64/include/glib-2.0/glib.h:30,
 from src/library/parsers/versions_result.c:5:
src/library/parsers/versions_result.c: In function
‘app_electron_parsers_versions_result_get_type’:
/c/gstreamer/1.0/x86_64/include/glib-2.0/glib/gmacros.h:181:53: error: size
of array ‘_GStaticAssertCompileTimeAssertion_0’ is negative
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE
(_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
G_GNUC_UNUSED
 ^
/c/gstreamer/1.0/x86_64/include/glib-2.0/glib/gmacros.h:178:47: note: in
definition of macro ‘G_PASTE_ARGS’
 #define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
   ^
/c/gstreamer/1.0/x86_64/include/glib-2.0/glib/gmacros.h:181:44: note: in
expansion of macro ‘G_PASTE’
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE
(_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
G_GNUC_UNUSED
^
/c/gstreamer/1.0/x86_64/include/glib-2.0/glib/gthread.h:249:5: note: in
expansion of macro ‘G_STATIC_ASSERT’
 G_STATIC_ASSERT (sizeof *(location) == sizeof (gpointer));   \
 ^
src/library/parsers/versions_result.c:130:6: note: in expansion of macro
‘g_once_init_enter’
  if (g_once_init_enter
(_electron_parsers_versions_result_type_id__volatile)) {
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Problems with building app with GStreamer in MSYS2/Win64

2015-12-09 Thread mar...@saepia.net
I found a solution - I had 32-bit version of compiller instaled,

m.

2015-12-09 15:38 GMT+01:00 mar...@saepia.net <mar...@saepia.net>:

> Hello
>
> I am trying to build simple app written in Vala 0.30 and link them with
> windows 64-bit build of GStreamer 1.6.1. I also want to reuse GObject, GLib
> and Soup that ship with GStreamer so I don't introduce another dependencies.
>
> I apologize if this is not truly Vala related, but I cannot assess whether
> this is related to boilerplate code generated by Vala or not.
>
> I've fetched MSYS2 and added lib/pkgconfig from GStreamer installation dir
> to the PKG_CONFIG_PATH and pkg-config correctly recognizes all libraries.
>
> However, when I try to build the app the following error occur.
>
> I've found out that such issue often is related to cross-compilation
> issues but I have no clue how to proceed with this exact case. Any
> suggestions?
>
> Log below,
>
> thank you
>
> Marcin
>
>
>  make
> make  all-am
> make[1]: Wejście do katalogu '/home/Marcin/aktivitis/app/electron-backbone'
> gcc -DHAVE_CONFIG_H -I. -mms-bitfields
> -I/c/gstreamer/1.0/x86_64/include/glib-2.0
> -I/c/gstreamer/1.0/x86_64/lib/glib-2.0/include  -mms-bitfields
> -I/c/gstreamer/1.0/x86_64/include/gstreamer-1.0
> -I/c/gstreamer/1.0/x86_64/lib/gstreamer-1.0/include
> -I/c/gstreamer/1.0/x86_64/include/glib-2.0
> -I/c/gstreamer/1.0/x86_64/lib/glib-2.0/include  -mms-bitfields
> -I/c/gstreamer/1.0/x86_64/include/glib-2.0
> -I/c/gstreamer/1.0/x86_64/lib/glib-2.0/include  -mms-bitfields
> -I/c/gstreamer/1.0/x86_64/include/libsoup-2.4
> -I/c/gstreamer/1.0/x86_64/include/libxml2
> -I/c/gstreamer/1.0/x86_64/include/glib-2.0
> -I/c/gstreamer/1.0/x86_64/lib/glib-2.0/include  -g -O2 -MT
> src/library/parsers/app_electron_backbone_daemon-versions_result.o -MD -MP
> -MF
> src/library/parsers/.deps/app_electron_backbone_daemon-versions_result.Tpo
> -c -o src/library/parsers/app_electron_backbone_daemon-versions_result.o
> `test -f 'src/library/parsers/versions_result.c' || echo
> './'`src/library/parsers/versions_result.c
> In file included from
> /c/gstreamer/1.0/x86_64/lib/glib-2.0/include/glibconfig.h:14:0,
>  from
> /c/gstreamer/1.0/x86_64/include/glib-2.0/glib/gtypes.h:32,
>  from
> /c/gstreamer/1.0/x86_64/include/glib-2.0/glib/galloca.h:32,
>  from /c/gstreamer/1.0/x86_64/include/glib-2.0/glib.h:30,
>  from src/library/parsers/versions_result.c:5:
> src/library/parsers/versions_result.c: In function
> ‘app_electron_parsers_versions_result_get_type’:
> /c/gstreamer/1.0/x86_64/include/glib-2.0/glib/gmacros.h:181:53: error:
> size of array ‘_GStaticAssertCompileTimeAssertion_0’ is negative
>  #define G_STATIC_ASSERT(expr) typedef char G_PASTE
> (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
> G_GNUC_UNUSED
>  ^
> /c/gstreamer/1.0/x86_64/include/glib-2.0/glib/gmacros.h:178:47: note: in
> definition of macro ‘G_PASTE_ARGS’
>  #define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
>^
> /c/gstreamer/1.0/x86_64/include/glib-2.0/glib/gmacros.h:181:44: note: in
> expansion of macro ‘G_PASTE’
>  #define G_STATIC_ASSERT(expr) typedef char G_PASTE
> (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
> G_GNUC_UNUSED
> ^
> /c/gstreamer/1.0/x86_64/include/glib-2.0/glib/gthread.h:249:5: note: in
> expansion of macro ‘G_STATIC_ASSERT’
>  G_STATIC_ASSERT (sizeof *(location) == sizeof (gpointer));   \
>  ^
> src/library/parsers/versions_result.c:130:6: note: in expansion of macro
> ‘g_once_init_enter’
>   if (g_once_init_enter
> (_electron_parsers_versions_result_type_id__volatile)) {
>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Automake configuration for library other than one from the tutorial?

2015-12-08 Thread mar...@saepia.net
Hello,

I want to develop a library with Vala.

Can you please recommend any other automake sample configurations than
mentioned in the tutorial? The one from tutorial is definitely not a "hello
world" and while I am quite proficient with Vala etc. automake concepts
still seem to be quite obscure for me and this sample is not really helpful
because it is too complex.

Any good references that are simpler?

Thank you,

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


Re: [Vala] Automake configuration for library other than one from the tutorial?

2015-12-08 Thread mar...@saepia.net
Thank you!

M.
8 gru 2015 4:40 PM "Luca Dionisi"  napisał(a):

> Following is my recipe for a lib.
> 
> Enter a fresh new directory.
>
> $ mkdir m4
> $ touch README NEWS AUTHORS ChangeLog
>
> Create following (attached) files:
>  configure.ac
>  Makefile.am
>  libtest.vala
>  mylibrary.pc.in
>  mylibrary.deps
>
> Save all in VCS of your choice.
>
> $ autoreconf --install
>
> Add COPYING and INSTALL to the VCS.
> Tell the VCS to ignore all the other newly created files.
>
> $ ./configure
> $ make
>
> With these commands you will be able to see what's going to be
> installed with the usual "sudo make install"
>
> $ DESTDIR=$(pwd)/dest make install
> $ find dest
>
>
> --Luca
>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] viewport ADD

2013-01-20 Thread mar...@saepia.net
Hi,

you ask on wrong mailing list, try on Gtk mailing list.

m.

2013/1/12 Luis L. Rodríguez Oro lu...@uci.cu:
 How can I add object to the viewport??

 //valac --pkg gtk+-3.0 viewport.vala
 public class Application : Gtk.Window {
 private Gtk.Viewport viewport;
 private Gtk.ScrolledWindow scrolled;

 public Application () {
 // Prepare Gtk.Window:
 this.title = My Gtk.Viewport;
 this.window_position = Gtk.WindowPosition.CENTER;
 this.destroy.connect (Gtk.main_quit);
 this.set_default_size (200, 200);

 // ScrolledWindow:
 scrolled = new Gtk.ScrolledWindow (null, null);
 this.add (scrolled);

 // The Viewport:
 viewport = new Gtk.Viewport (null, null);
 viewport.set_size_request (200, 200);

 update();

 scrolled.add (viewport);
 Timeout.add(1000, update);
 }

 private bool update(){
 string name =  aaa;
 var mail_box = new Gtk.Box(Gtk.Orientation.VERTICAL, 5);
 var mail_grid = new Gtk.Grid ();

 mail_grid.attach (new Gtk.Label(data:), 0, 1, 1, 1);
 mail_grid.attach (new Gtk.Label(value + name), 1, 1, 1, 1);
 mail_grid.attach (new Gtk.Label(data:), 0, 2, 1, 1);
 mail_grid.attach (new Gtk.Label(value + name), 1, 2, 1, 1);
 mail_grid.attach (new Gtk.Label(data:), 0, 3, 1, 1);
 mail_grid.attach (new Gtk.Label(value + name), 1, 3, 1, 1);

 mail_box.pack_start(mail_grid, true, true);
 mail_box.pack_start(new Gtk.Separator(Gtk.Orientation.HORIZONTAL),
 true, true);
 viewport.add(mail_box);

 return true;
 }

 public static int main (string[] args) {
 Gtk.init (ref args);

 Application app = new Application ();
 app.show_all ();

 Gtk.main ();
 return 0;
 }
 }


 10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS
 INFORMATICAS...
 CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION

 http://www.uci.cu
 http://www.facebook.com/universidad.uci
 http://www.flickr.com/photos/universidad_uci
 ___
 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


[Vala] Ownership/properties

2013-01-02 Thread mar...@saepia.net
Hi all,

I have some questions related to ownership.

If I write something like this:

  public string test { get { return xxx(); } }

  private unowned string xxx() {
string a = XXX;
return a;
  }

I end with error:

error: Local variable with strong reference used as return value and
method return type has not been declared to transfer ownership


What is correct approach to fix this?

a)

  public string test { get { return xxx(); } }

  private unowned string xxx() {
weak string a = XXX;
return a;
  }


b)

  public string test { owned get { return xxx(); } }

  private string xxx() {
string a = XXX;
return a;
  }


??

Could anyone describe what happens with memory handling in both cases
under the hood?

Thank you

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


[Vala] Nice wrapper around libxml2 for vala?

2012-12-29 Thread mar...@saepia.net
Hey,

is there any nice library with vala bindings that wraps original ugly
libxml2 interface into something nicer?

Thank you

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


Re: [Vala] Nice wrapper around libxml2 for vala?

2012-12-29 Thread mar...@saepia.net
Hey, seems pretty interesting but I need something more mature.

Thank you!

Marcin


2012/12/29 JM interfl...@gmx.net:
 I know there is gxml, which is a vala wrapper around libxml2.
 http://git.gnome.org/browse/gxml/
 Haven't tried it but it seems to be actively developed.



 Am Samstag, den 29.12.2012, 14:36 +0100 schrieb mar...@saepia.net:
 Hey,

 is there any nice library with vala bindings that wraps original ugly
 libxml2 interface into something nicer?

 Thank you

 Marcin
 ___
 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
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Nice wrapper around libxml2 for vala?

2012-12-29 Thread mar...@saepia.net
I've noticed some TODOs in the code related to memory handling and I
cannot risk any memleaks in my app. But it is not a showstopper for
me.

The biggest actual problem in my case is that it is not available in
ubuntu 12.04 repositories. Maybe mature was not the best word to
describe this, but well, even if this code is cool, it lacks some
things around it - being available in the main distros' standard
repositiories or at least having a site with docs. (I was unable to
find any, please correct me if I am wrong).

I am not using XML very often in my app so in my case such adding
extra library to compile/package/distribute/etc. is overkill in
comparision to managing limited amount of pointers.

Marcin

2012/12/29 JM interfl...@gmx.net:
 I don't think it will get much better than this. Or you have to go back
 to normal libxml2 bindings with pointers in the vala code.

 Are you missing something in http://git.gnome.org/browse/gxml/  ?




 Am Samstag, den 29.12.2012, 15:18 +0100 schrieb mar...@saepia.net:
 Hey, seems pretty interesting but I need something more mature.

 Thank you!

 Marcin


 2012/12/29 JM interfl...@gmx.net:
  I know there is gxml, which is a vala wrapper around libxml2.
  http://git.gnome.org/browse/gxml/
  Haven't tried it but it seems to be actively developed.
 
 
 
  Am Samstag, den 29.12.2012, 14:36 +0100 schrieb mar...@saepia.net:
  Hey,
 
  is there any nice library with vala bindings that wraps original ugly
  libxml2 interface into something nicer?
 
  Thank you
 
  Marcin
  ___
  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


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


[Vala] How to create functon that maps to D-Bus a{s(st)}?

2012-12-19 Thread mar...@saepia.net
Hi,

I see that if I create function with signature like

public void f(HashTablestring, Variant arg)

and then export the object over D-Bus, Vala compiler automatically
generates its DBus signature of a{sv}. Great.

I need to achieve a{s(st)}, in other words, I need a hashmap with
strings as keys and structure that contains string and uint64 as a
value.

What signature should have function in vala to map in such way?

Thank you,

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


[Vala] Should I disconnect all signals?

2012-11-08 Thread mar...@saepia.net
Hi all,

short question: should I manually disconnect all signals that I've
connected during object construction or will they be automatically
disconnected during object finalization?

What is correct pattern?

Thank you,

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


Re: [Vala] help with java to vala

2012-10-26 Thread mar...@saepia.net
What exactly do you want to achieve by making it const?


m.

2012/10/26 Calvin Walton calvin.wal...@kepstin.ca:
 On Thu, 2012-10-25 at 13:00 -0700, bsquared wrote:
 I attempted a simple test using this:
 8 
   private static const Setstring STATIC_SET;
   static construct {
   STATIC_SET = new HashSetstring ();
   STATIC_SET.add (Hello);
   STATIC_SET.add (World);
   }
  8

 with this result:
 8 
 valac --pkg gee-1.0 hello_set.vala
 hello_set.vala:5.4-5.47: error: `Gee.Setstring' not supported as type
 for constants
   private static const Setstring STATIC_SET;
   
 hello_set.vala:8.3-8.16: error: The name `add' does not exist in the
 context of `HelloTest.STATIC_SET'
   STATIC_SET.add(Hello);
   ^^
 hello_set.vala:9.3-9.16: error: The name `add' does not exist in the
 context of `HelloTest.STATIC_SET'
   STATIC_SET.add(World);
   ^^
 Compilation failed: 3 error(s), 0 warning(s)
  8


 To my untrained eye this appears to indicate that I cannot use these as
 constants.  If I drop 'const' from the declaration it compiles and runs
 correctly.

 This is the expected result - if the Set is constant, then you can't
 call the add method on it. It looks like the Gee Set type simply doesn't
 support being used as a constant.

 I think that the only types that you can actually use as constants in
 Vala are ones that compile to basic/simple C types, and therefore could
 be created using constant C initializers. If you have to write data to
 the object at run-time to fill it, it's not a compile-time constant,
 after all.

 This limits you to using things like arrays of structures, for example.

 If you really want a run-time initialized Set, then it will have to be
 non-const.

 --
 Calvin Walton calvin.wal...@kepstin.ca

 ___
 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] help with java to vala

2012-10-25 Thread mar...@saepia.net
Have you tried

 static construct {
  ...
}

?

(see https://live.gnome.org/Vala/Tutorial)

m.

2012/10/23 bsquared bwcod...@gmail.com:
 Hello,

 Is it possible to initialize a static const HashSet?
 Similar to this from Java?

 8 
 private static final SetString STATIC_SET;

 static {
 STATIC_SET = new HashSetString();
 STATIC_SET.add(Data One);
 STATIC_SET.add(Data Two);
 }
   - 8

 Thank you.
 --
 Regards,
 Brian

 ___
 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] FileStream not closed after going out of scope

2012-09-24 Thread mar...@saepia.net
try something like this (it is only a demonstration, not working code!)

key to solve problem you've encountered are

  io_stdout = null;
  io_stderr = null;

it unrefs io channel, and releases descriptors




private IOChannel io_stderr;
private IOChannel io_stdout;
private uint  io_stderr_watch_id;
private uint  io_stdout_watch_id;
private Pid   child_pid;
private uint  child_watch_id = 0;

private void run() {
  int child_stdout;
  int child_stderr;

  Process.spawn_async_with_pipes(null, { command }, null,
SpawnFlags.SEARCH_PATH | SpawnFlags.DO_NOT_REAP_CHILD, null, out
child_pid, null, out child_stdout, out child_stderr);

  io_stdout = new IOChannel.unix_new(child_stdout);
  io_stderr = new IOChannel.unix_new(child_stderr);

  io_stdout_watch_id = io_stdout.add_watch(IOCondition.IN,
on_stdout_read);
  io_stderr_watch_id = io_stderr.add_watch(IOCondition.IN,
on_stderr_read);

  child_watch_id = ChildWatch.add(child_pid, on_child_exits);
}

private void on_child_exits(Pid pid, int status) {
  Process.close_pid(pid);

  GLib.Source.remove(io_stdout_watch_id);
  GLib.Source.remove(io_stderr_watch_id);

  try {
io_stdout.shutdown(true);
  } catch(IOChannelError e) {
warning(@Error \$(e.message)\ during shutting down
stdout pipe to the child process);
  }

  try {
io_stderr.shutdown(true);
  } catch(IOChannelError e) {
warning(@Error \$(e.message)\ during shutting down
stderr pipe to the child process);
  }

  io_stdout = null;
  io_stderr = null;

  cancel_child_watch();
}


private string? on_read(IOChannel source)   {
  string line;
  try {
IOStatus ret = source.read_line(out line, null, null);

switch(ret) {
  case IOStatus.ERROR:
warning(Read error);
kill();
return null;

  case IOStatus.EOF:
message(End of File);
return null;

}
  } catch(IOChannelError e) {
warning(@I/O error: $(e.message));
kill();
return null;


  } catch(ConvertError e) {
warning(@Convert error: $(e.message));
return null;
  }

  return line;
}


private bool on_stderr_read(IOChannel source, IOCondition condition) {
  var line = on_read(source);
  if(line != null) {
do_something(line);
  }

  return true;
}

private bool on_stdout_read(IOChannel source, IOCondition condition) {
  var line = on_read(source);
  if(line != null) {
do_something(line);
  }

  return true;
}


2012/9/24 tomw t...@ubilix.com:
 ok, here's a bit more meat. Hopefully this help to tackle the issue:

 currently I'm using Vala 0.17.6. Obviously some files are left open as
 the open file count is increasing (checking with lsof | wc -l ) until I
 get the span error:

 Error spawning Uptime process - Failed to create pipe for communicating
 with child process (Too many open files)

 thanks,



 /* pipetest.vala
 *  valac --pkg gio-2.0 --pkg posix pipetest.vala
 */

 using GLib;


 public class Pipetest.Main : Object {
 public MainLoop main_loop;
 public int counter = 0;


 public  Main () {
 main_loop = new GLib.MainLoop (null, false);
 }



 public void run () {
 Timeout.add_seconds (1, get_uptime);
 }

 public bool get_uptime () {
 string uptime = ;
 int [] pipefd = {0, 0};


 if (Posix.pipe(pipefd)  0) {
 debug (Error - unable to open pipe);
 }

 Posix.close(pipefd[1]); //closing the write end of pipe
 try {
 string[] runme = {/usr/bin/uptime};
 int input;
 int output;
 int error;
 Pid child_pid;
 bool res = Process.spawn_async_with_pipes (null,
runme,
null,

 SpawnFlags.DO_NOT_REAP_CHILD,
null,
out 
 child_pid,
out input,

Re: [Vala] How to access valac version during runtime?

2012-09-06 Thread mar...@saepia.net
Thank you!

m.

2012/9/6 Eric Gregory e...@yorba.org:
 On Wed, Sep 5, 2012 at 3:03 PM, mar...@saepia.net mar...@saepia.net wrote:

 If not, could you recommend any tested solution for adding it to
 config.h during running ./configure?


 We've been using -d for this purpose. As long as your needs aren't too
 complex it's very straightforward -- in Vala, you just declare the symbol as
 an extern in the global namespace.

 For an example look at how we passed through _VERSION, _INSTALL_PREFIX,
 etc. to Geary:
 http://git.yorba.org/cgit.cgi/geary/tree/src/client/geary-application.vala

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


[Vala] How to access valac version during runtime?

2012-09-05 Thread mar...@saepia.net
Hi,

I want to add version of vala compiler used to build sources to debug
log generated by my application. It will simplify debugging.

Is there any preprocessor macro available? I know there's one VALA_X_Y
but it is impossible to use it in this way.

If not, could you recommend any tested solution for adding it to
config.h during running ./configure? I created custom vapi to retreive
information from config.h so if there's any way to add variable there,
I will know what to do next.

Thank you for help,

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


[Vala] Custom export / custom attributes / iterating over object's public methods/parameters/signals/properties

2012-08-24 Thread mar...@saepia.net
Hi,

I want to implement in Vala mechanism for automatic exporting objects
over some protocol.

The concept is basically the same as usage of [DBus ...] Attributes,
but I want to add support for one more protocol.

So my questions are:

a) is there any way to define custom annotations (let's say, with the
same syntax as DBus) in the library and use that in my Vala app?

b) if not, is there any clean way to iterate over object's public
methods (with their parameters and type of returned value), signals
and properties? - that will be enough for me to implement that


Thank you in advance,

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


Re: [Vala] POSIX and Dova profiles

2012-08-03 Thread mar...@saepia.net
Vala is always marketed as being integrated with GObject, which I
think is advantage - IMO to make product consistent team should focus
on Vala/GObject.

m.

2012/8/3 Jürg Billeter j...@bitron.ch:
 Hi,

 valac has had experimental support to build applications without GLib
 for a while now. However, the POSIX profile still supports only a subset
 of the language and there is no indication that this will change anytime
 soon. I'm still working on the experiment that started with Dova, but
 the differences to Vala/GObject have grown to a point that it no longer
 makes sense to maintain both compilers in the same repository.

 Is anyone actively using either of these two profiles despite their
 limitations? If that is not the case, I'd be in favor of dropping them
 from master and keeping the focus on GLib/GObject.

 Any comments?

 Regards,
 Jürg

 ___
 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


[Vala] Why some macros from GLib are missing in vapi?

2012-07-22 Thread mar...@saepia.net
Hi,

why some macros from GLib, like  GLIB_MAJOR_VERSION or GObject, like
G_LIKELY/UNLIKELY are missing in vapi? Is this desired or they are
just forgotten?

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


Re: [Vala] Is there any way to iterate over signal arguments?

2012-07-22 Thread mar...@saepia.net
Could you point this specific issue?

I have to rely on default vala shipped with ubuntu 12.04, so I can
create workaround that implements your patch, but I cannot force users
to use git version.

m.

2012/7/21 Evan Nemerson e...@coeus-group.com:
 On Sat, 2012-07-21 at 20:30 +0200, mar...@saepia.net wrote:
 Hi,

 I need to write an application that catches all signals emitted by
 certain GObjects and forwards it over HTTP.

 Is there any way to do that in vala without manually specyfying all of
 their arguments?

 IIRC you would want to create a GLib.Closure and connect it to the
 signal manually (with GLib.Signal.connect_closure).  The closure would
 just have a custom GLib.ClosureMarshal which would send the data over
 HTTP.

 These aren't commonly used APIs in Vala, so you may run into some
 bugs... if you do please let us know (via bugzilla).  I just pushed a
 small patch for one issue I noticed so you'll need to use Vala from git
 (or copy the updated bindings to your project).


 -Evan

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


[Vala] Is there any way to iterate over signal arguments?

2012-07-21 Thread mar...@saepia.net
Hi,

I need to write an application that catches all signals emitted by
certain GObjects and forwards it over HTTP.

Is there any way to do that in vala without manually specyfying all of
their arguments?

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


[Vala] Contract programming and error messages

2012-07-10 Thread mar...@saepia.net
Hi,

I use vala contract programming features to ensure that several
functions are called from proper thread. I've created helper function
for that to DRY, and the effect is that in case of failure I got error
message like this:

my_function: assertion `_tmp0_' failed

out of

requires(valid_thread())

Error message is not self-explanatory at all, but I understand that it
behaves like that due to C representation of the reqires() code.

It would be nice to have possibility to attach somehow desired error
message to requires() that will be shown instead of current one.

The another problem is that if that function is exported over D-Bus
and requires() constraints are not fulfilled, no error is thrown over
D-Bus, function just returns nothing.

I've tried to throw error from valid_thread, but it is prohibited, I
got error: Field initializers must not throw errors.


Nice solution that solves the issue would be just to change the last
behavior, and allow to throw errors within requires() block. Error
message could be displayed instead of assertion `_tmp0_' failed and
forwarded to D-Bus.

What do you think about that?

I can spend some time on preparing the patch but only if such feature
would be accepted by vala core team.

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


[Vala] How to check if current thread is main thread?

2012-07-06 Thread mar...@saepia.net
Hi

I need to check (for debugging purposes) if current thread is main
thread. How can I do that in Vala?

I know that in GLib exists g_thread_self() and I can  use result of
that function for that purpose but in Vala's vapi it has strange
syntax that I cannot truly understand.

Thank you in advance,

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


[Vala] How to append element to Variant array of tuples?

2012-05-17 Thread mar...@saepia.net
Hi!

In my app I use Settings with key defined in schema as follows:

a(sbsyssby)

I am able to retreive it with

Variant mykey = settings.get_value(mykey);


The question is:

how can I add an element to end of this array and store that value in
the settings?

It could be interpret as a much more general question:

how to add in Vala an element to existing Variant if VariantType is
array of tuples?


Thank you in advance,

your help will be really appreciated.

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


[Vala] How to deal with target attribute in VAPI for C struct?

2012-03-26 Thread mar...@saepia.net
Hi,

I have a part of C code that I need to include in my Vala project.

It contains code +/- like that:


typedef void (*computing_finished_cb) (void *self);

typedef struct computer {
  computing_finished_cb on_finished;
  void* parent;
} computer;

size_t computer_compute(computer *c);




I've created VAPI file like that

namespace MyLib {
  [CCode (cname=computer, cheader_filename=computer.h)]
  public struct Computer {
ComputingFinishedCallback on_finished;
void* parent;

[CCode (cname=computer_compute)]
public compute();
  }
  [CCode (cname=computing_finished_cb, has_target=false)]
  public delegate void ComputingFinishedCallback();
}


Now I can use it like that:

public class Example {
  public MyLib.Computer computer;

  public Example() {
computer = MyLib.Computer();
computer.parent = this; // code in compute() knows that it has to
pass this pointer to the callback when computing is finished
computer.on_finished = on_finished;
  }

  public void compute() {
computer.compute();
  }

  static void on_finished(void* sender) {
MyLib.Computer computer = sender as MyLib.Computer;

computer.do_something_else();
  }

  public void do_something_else() {
//...
  }
}


It works but it breaks encapsulation as if I want to access anything
from on_finished() I have to mark it public.

Could you give me any advise how to modify that to achieve Vala-style
code? Like that...?


public class Example {
  public MyLib.Computer computer;

  public Example() {
computer = MyLib.Computer(this);
computer.on_finished = on_finished;
  }

  public void compute() {
computer.compute();
  }

  private void on_finished() {
do_something_else();
  }

  private void do_something_else() {
//...
  }
}


The problem that I've encountered is that when I remove
has_target=false from VAPI, vala tries to initialize *_target and
*_target_destroy_notify functions per each callback member of the
struct, do a lot of ref  unrefs etc... Is there any clean way to do
that? Preferably without changing struct to full-flavored GObject?

Thank you in advance,

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


Re: [Vala] How to deal with target attribute in VAPI for C struct?

2012-03-26 Thread mar...@saepia.net
Ugh, sorry, obviously that code:

  public delegate void ComputingFinishedCallback();

should be:

 public delegate void ComputingFinishedCallback(void* sender);

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


Re: [Vala] Is there any way to deserialize something into object in vala?

2012-03-22 Thread mar...@saepia.net
Hi Daniel,

thank you for your suggestion. I was considering GDA but as
performance is quite important in my project, I wanted to recreate
minimal subset of functionality of database abstraction layer by
myself and do that in Vala.

GDA is written in C, so it propably uses the same macros that
json-glib does. But I still wonder if it is possible to do that in
pure Vala?

m.

2012/3/22 Daniel Espinosa eso...@gmail.com:
 May you want to test GDA's Vala extensions.

 They provides a Record object that could be used as a base class for your
 objects and save all your properties directly to a database. Check out
 samples/vala code.

 Vala extensions are available from git.gnome.org/libgda

 El mar 20, 2012 7:04 a.m., mar...@saepia.net mar...@saepia.net escribió:

 Hi,

 I need to create a sort of abstraction layer between the database and
 my vala app.

 It would be great if it was possible to interate over my class
 properties, read they type etc. and dynamically map fields from the DB
 to the properties.

 Is there any way to do that?

 I know that it is possible within GObject, as json-glib has that
 functionality, but is it possible without access to low-level C
 GLib/GObject macros? Only in Vala?

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


[Vala] Is there any way to deserialize something into object in vala?

2012-03-20 Thread mar...@saepia.net
Hi,

I need to create a sort of abstraction layer between the database and
my vala app.

It would be great if it was possible to interate over my class
properties, read they type etc. and dynamically map fields from the DB
to the properties.

Is there any way to do that?

I know that it is possible within GObject, as json-glib has that
functionality, but is it possible without access to low-level C
GLib/GObject macros? Only in Vala?

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


[Vala] Why [].resize expects int?

2012-03-10 Thread mar...@saepia.net
Hi,

Why [].resize expects int? Shouldn't it accept

a) some unsigned type
b) tyle that has greater range of possible values?

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