Re: [Vala] offscreen bitmap example.

2020-05-01 Thread Nor Jaidi Tuah


> Any example on how to use an offscreen bitmap in vala gtk ?
> I need to show an image generated via 3d rendering but I cannot
> recreate it
> on every draw request.

I suggest you look at pixbuf:

https://valadoc.org/gdk-pixbuf-2.0/Gdk.Pixbuf.html

First create an off-screen pixbuf using one of its
creation methods.

Then create a cairo context to write onto the
pixbuf using:

https://valadoc.org/gdk-3.0/Gdk.cairo_surface_create_from_pixbuf.html

You can copy the pixbuf onto another cairo surface
(the visible widget) using:

https://valadoc.org/gdk-3.0/Gdk.cairo_set_source_pixbuf.html

My vala project at https://sourceforge.net/projects/pasang-emas/
uses pixbuf, but I don't have any conveniently distilled example.

Nice day
Nor Jaidi Tuah




[https://drive.google.com/uc?id=1b4cWTCBfgIRVuVv9iDUuHkscey4c5Ug9]

PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Returning subclass objects from superclass, or type synonyms

2020-04-28 Thread Nor Jaidi Tuah


> > Point p_result = p.add(p_other);// compiler error

How about
Point p_result = p.add(p_other) as Point;

Nice day
Nor Jaidi Tuah




[https://drive.google.com/uc?id=1b4cWTCBfgIRVuVv9iDUuHkscey4c5Ug9]

PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] General Information about this list & Vala

2020-01-12 Thread Nor Jaidi Tuah


> In the last few days there has been a fair amount of activity in the
> Vala GitLab instance. An example of fixing a problem is:
> https://gitlab.gnome.org/GNOME/vala/merge_requests/98https://gitlab.gnome.org/GNOME/vala/issues/534

The second link has a discussion that includes this bit:

\snip
In my previous patch for null-conditional operator such as ?. or ?[
\endsnip

I searched for those features in the Vala tutorial but couldn't
find them. Are those operators already accepted into Vala?

Nice day
Nor Jaidi Tuah




[https://drive.google.com/uc?id=1b4cWTCBfgIRVuVv9iDUuHkscey4c5Ug9]

PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Posix.strerror_r and immutable Vala strings

2019-12-03 Thread Nor Jaidi Tuah


> > Strings
> > The data type for strings is string. Vala strings are UTF-8 encoded
> and *immutable*.

A convenient lie. Vala can do anything.
Personally, I wouldn't use _strip and family
unless string processing is really the bottleneck.

As for thread safety, you shouldn't be having multiple
threads doing UI stuff without mutex (converting errno
to a string is UI stuff).

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Modifying a Gtk.Entry's value on the fly

2019-09-11 Thread Nor Jaidi Tuah


> And here's my signal handler:
> [GtkCallback]
> private void on_birthday_insert_text(Gtk.Editable widget,
> string
> text, int length, ref int position)
> {
> GLib.SignalHandler.block_by_func(widget, (void *)
> on_birthday_insert_text, (void *) this);
> widget.insert_text(text, length, ref position);
> GLib.SignalHandler.unblock_by_func(widget, (void *)
> on_birthday_insert_text, (void *) this);
> GLib.Signal.stop_emission_by_name(widget, "insert_text");
> }

on_birthday_insert_text is passing a reference to itself.
That looks suspiciously buggy.

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Some thoughts aloud about improving syntax in Vala.

2019-08-13 Thread Nor Jaidi Tuah
That's a flood of suggestions. It would be better
to suggest a small change at a time. Vala is already
pretty "stable".

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Confusing closure behavior

2019-04-09 Thread Nor Jaidi Tuah
On Tue, 2019-04-09 at 08:25 +0200, Vivien Kraus wrote:
> Digging a little deeper, I have some more confusion.  This makes the
> for-loop and the foreach-loop behave differently.  What do you think
> of:
>
> // capturing the for variable should capture a copy if the variable
> is
> // local to the for loop
>
> public delegate void Thunk();
>
> int main() {
>   Thunk thunk = () => {};
>   for (int i = 0; i < 1; i++) {
>   thunk = () => {
>   stderr.printf ("%d = 0, right?\n", i);
>   };
>   }
>   thunk ();
>   int[] indices = { 0 };
>   foreach (var i in indices) {
>   thunk = () => {
>   stderr.printf ("%d = 0, right?\n", i);
>   };
>   }
>   thunk ();
>   return 0;
> }

I believe foreach pass the values inside the array.
e.g.,

   foreach (var i in indices) {
  i = 999;
   }

will not change indices[0] at all. A more strict language
will even forbid that "i = 999".


Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] valaDevelop

2019-03-23 Thread Nor Jaidi Tuah


>
> Remember that libvala is distributed under LGPL license, so although
> you
> can link it dinamically without problems with any code, free or
> privative, if you do it statically you must allow the users to
> recompile
> it against any version, which means to distribute the source code or,
> at
> least, the object files.

LGPL allows static LINKING with non-free software.

However, if you CHANGE libvala itself then you must distribute
the source code for the changes to libvala.

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] How to use Gtk.GestureDrag?

2018-10-25 Thread Nor Jaidi Tuah
I'm migrating from gtk motion and button events to
gtk gestures. I tried this:

var gesture = new Gtk.GestureDrag (widget);
gesture.drag_begin.connect ((x, y) => { // also tried (s,x,y)
GLib.message ("start drag");
});
gesture.drag_update.connect ((x, y) => {
GLib.message ("update");
});
gesture.drag_end.connect ((x, y) => {
GLib.message ("end drag");
});
gesture.set_propagation_phase (Gtk.PropagationPhase.BUBBLE);
gesture.set_button (1);

That didn't work (though the old style motion and
button events worked). What did I miss?

Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] How to use Gtk.GestureDrag?

2018-10-25 Thread Nor Jaidi Tuah
Oh, never mind. Found solution already.
`gesture` cannot be a local var. I thought `widget`
in `new Gtk.GestureDrag (widget)` would keep
it alive.

> I'm migrating from gtk motion and button events to
> gtk gestures. I tried this:
>
> var gesture = new Gtk.GestureDrag (widget);
> gesture.drag_begin.connect ((x, y) => { // also tried (s,x,y)
> GLib.message ("start drag");
> });
> gesture.drag_update.connect ((x, y) => {
> GLib.message ("update");
> });
> gesture.drag_end.connect ((x, y) => {
> GLib.message ("end drag");
> });
> gesture.set_propagation_phase (Gtk.PropagationPhase.BUBBLE);
> gesture.set_button (1);

Feeling stupid
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] valadoc gtk widget gallery link not working

2018-08-26 Thread Nor Jaidi Tuah
The valadoc page "https://valadoc.org/gtk+-3.0/index.htm";
has links that are not working: "Widget Gallery" and
"Example listing".

Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] No vala release notes for 0.40.x

2018-04-21 Thread Nor Jaidi Tuah
>From vala "home" page https://wiki.gnome.org/Projects/Vala,
I cannot find any release notes for 0.40.x when I follow
this news link:

https://wiki.gnome.org/Projects/Vala/Release#Vala_0.40.4

(I already tried refreshing my browser).

If this is not going to be updated anymore, perhaps
a direct link to the git repository is more appropriate.

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Date format

2018-03-27 Thread Nor Jaidi Tuah

> Is it possible to print from a GLib.Date only the date, without the
> day
> of week, neither the time, nor timezone?

https://valadoc.org/glib-2.0/GLib.Date.strftime.html

Pass "%x" for the format string.

Nice day
Nor Jaidi Tuah



PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] A couple of Vala questions

2018-01-28 Thread Nor Jaidi Tuah

> b) I can't make out any difference between GTK.Window and
>
> GTK.ApplicationWindow. Should an application's window derive from
>
> GTK.Window or from GTK.ApplicationWindow? They both seem to work
>
> perfectly same.

If you're using Gtk.Application, the official doc recommends
Gtk.ApplicationWindow even though Gtk.Window also works.

https://developer.gnome.org/gtk3/stable/GtkApplicationWindow.html


Nice day
Nor Jaidi Tuah



PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Application Menu

2018-01-21 Thread Nor Jaidi Tuah

>  var menu = builder.get_object ("appmenu") as MenuModel ;
>  set_app_menu (menu) ;

Have you set the scope as in

  "app.quit"

Nice day
Nor Jaidi Tuah

ps. Sorry for the previous empty message. Don't know
what went wrong.




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Application Menu

2018-01-21 Thread Nor Jaidi Tuah



PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Newbie help needed for Vala delegates/lambda expressions

2017-08-30 Thread Nor Jaidi Tuah
Sorry for the noise. Didn't notice
that the message was already replied.

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Newbie help needed for Vala delegates/lambda expressions

2017-08-30 Thread Nor Jaidi Tuah

> int c1 = f_add(a)(b);
> int c2 = f_add2(a, b);  //Problem here
>

try f_add2(a,b)()


Nice day
Nor Jaidi Tuah



PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] State of the Vala union

2017-04-05 Thread Nor Jaidi Tuah

> Well, I suppose I have higher requirements than they have. From a
> production-ready
> compiler I would expect
> – no (or at best very obscure) type errors to get through
> – no compiler crashes
> – no broken code generated

Possibly you have eliminated every compiler :-)

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Vala++

2017-04-02 Thread Nor Jaidi Tuah
It looks like Vala is going to have
a parallel life:

https://blogs.gnome.org/chergert/2017/03/31/rustic-gnome-day-3/

I hope the gnome+rust people succeed in
recreating the Vala awesomeness in Rust
(even if they don't name it after Vala).

Nice day
Nor Jaidi Tuah


PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] .me cast resurrection on "Re: The future of Vala"

2017-03-01 Thread Nor Jaidi Tuah

> I've read on HN (https://news.ycombinator.com/item?id=13752770), in a
> thread about Delphi, this :
>
> > insertnickname 21 hours ago [-]
> >  Note that Vala is apparently more or less dead.
> > pjmlp 21 hours ago [-]
> >  Yep, GNOME seems to be adopting Rust, with librsvg and
>
> GNOME Builder being the first places to spot it.
>
> Do you have more informations about state of vala and rust ?

Vala is still maintained. Vala is still used.

Thank you for keeping Vala alive.

Nice day
Nor Jaidi Tuah



PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] realloc fails on large inputs

2017-02-26 Thread Nor Jaidi Tuah

> Thank you, now it does not crash anymore on calculating the factorial
> :)
> Nonetheless size - 1 should equal to old_length. Because I call the
> function using old_length + 1 so the new size should equal to the
> old
> one - 1. Anyway, now it works :)

new size is not necessarily old_length+1, unless
n happens to have the same number of digits as self.

Furthermore, your add function:

fill(_data.length + 1);
n.fill(_data.length);

should have been:

newSize = int.max(_data.length, n._data.length) + 1
fill(newSize)
n.fill(newSize)

Otherwise, the following won't work:

x = new Number(1)
y = new Number()
x.add(y)<--- only room for 2-digit result


> Unfortunately the error with the double free or corruption still
> exists.

The to_string function should put a null terminator.

Nice day
Nor Jaidi Tuah



PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] realloc fails on large inputs

2017-02-24 Thread Nor Jaidi Tuah
Check this:

private void fill(int size){
int old_length = _data.length;

_data.resize(size);
_data.move(0, size - old_length, size - 1);
}

Shouldn't "size - 1" be old_length?

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Invalid cast Warnings

2017-02-05 Thread Nor Jaidi Tuah

>
> void main () {
> var a = new TestBase ();
> TestSubType b = (TestSubType)a;
> }
>
> class TestBase {
> }
>
> class TestSubType:TestBase {
  // Imagine more stuff here such as
  int x;
  int y;
  int z;
> }

Now the runtime error upon (a as TestSubType)
should make sense because object a isn't big
enough.

Nice day



PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [Announcement] Vala will use GTask for async code instead of GSimpleAsyncResult if --target-glib=2.36 or greater is selected

2016-11-22 Thread Nor Jaidi Tuah

> 1. Treat it as a documentation bug and make it clear async code
> requires a GMainContext and to be used asynchronously to work
> reliably in all cases
>

Totally confused here. I checked gtask.c and apparently
it is designed to handle synchronous task too.

 * SECTION:gtask
 * @short_description: Cancellable synchronous or asynchronous task
 * and result

Here I'm not objecting to option 1. After all, using async
for sync is dubious. I'm just confused why gtask cannot be
used for sync task when its own description specifically
indicates that possibility.

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
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-09-24 Thread Nor Jaidi Tuah

> now,
>
> _state_in_progress_ is assigned to -1 at beginning
> the check if
>
> _state_in_progress_ == _state_ is move before the switch to work in
> any state.
> 

That won't work either.

The fundamental problem is that the caller
that calls the callback (the mainloop or
whatever alternative you have in mind) must
be able to detect when the async method has
progressed to the next state. For the mainloop
solution, this is trivial. The alternative
you have in mind (that calls before yield)
must look at _state_ and _state_in_progress_;
otherwise, it may livelock.

There is no way you can solve this by tweaking
async only[1]; you must also tweak the callback caller.
I don't think the Vala community would accept that.



[1] Of course I may be wrong in this assertion.

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
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-09-23 Thread Nor Jaidi Tuah
If I understand your patch correctly, it would generate
something like this:


   if (_data_->_state_ != 1) {
  _data_->_state = 1;
  return FALSE;
   }
   else {
  // callback already called
   }
   etc. etc.


I don't think that's going to work with your use case.
_data_->_state_ would be stuck at 0 if you call the
callback before yield.

_state_in_progress_ simply doesn't help.



Nice day
Nor Jaidi Tuah



PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
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-09-22 Thread Nor Jaidi Tuah

> Idle.add(myfunc.callback) is not good for 2 reason:
> 1. performance. you go back to the mainloop
> 2. Idle.add has to have less priority that the function that you have
> to wakeup.
> 

Is the mainloop dispatch performance really
inefficient? Just wondering here because I
honestly do not know.

If your patch changes or completely remove
the async "barriers" then you might as well
use multi-threading.

Nice day
Nor Jaidi Tuah



PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] spawn like a terminal

2016-09-19 Thread Nor Jaidi Tuah

> It seems that pipetty from https://github.com/kilobyte/kbtin does
> what
> you want, take a look and try to port it to vala.
>

If you found the solution, please share it.
I have looked at ktbin but failed to locate where
the magic happens. I know there is an ANSI-to-HTML
function (the source filename is so obvious), but I
cannot find the function to capture the ANSI outputs.


Nice day
Nor Jaidi Tuah



PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] add check lifetime

2016-09-16 Thread Nor Jaidi Tuah
On Sat, 2016-09-17 at 05:56 +, michele.dioni...@gmail.com wrote:
> Parameter is unowned by default. So when you print a it point to an
> object aleady free.

You are right. Thank you for pointing out
this trap.

I agree with you that the compiler should warn
about this. I thought that 'unowned' is like
bare pointers; if you use them, you take care of
memory, not the compiler. But this default
unowned means that the compiler must be
responsible, not the programmer.


Nice day
Nor Jaidi Tuah


PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] How to draw on a pixbuf

2016-09-16 Thread Nor Jaidi Tuah
Doing this

> Gdk.Pixbuf result= Gdk.pixbuf_get_from_surface(
> surface, 0, 0, 100, 100);

and then this

> Gdk.cairo_set_source_pixbuf (context, result, 0, 0);
> context.paint ();

can be replaced with the more direct code:

   context.set_source_surface (surface, ...)
   context.paint ();


hand
Nor Jaidi Tuah



PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] add check lifetime

2016-09-16 Thread Nor Jaidi Tuah

> string lifetime(string a) {
> {
> string b = "pippo";
> a = b;
> }
> stdout.printf (a + "\n");
> return a;
> }

I don't think the above is an error. Otherwise, we
won't be able to do even this:

string x() {
   string b = "pippo";
   return b;
}

I suspect you have an error somewhere else in your
program and mistakenly identify the above as the
culprit.

Nice day
Nor Jaidi Tuah



PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] how to remove_by_data?

2016-02-11 Thread Nor Jaidi Tuah
I'm wondering how to use GLib.Idle.remove_by_data
in vala.


Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Reference to "this pointer" ?

2016-01-25 Thread Nor Jaidi Tuah

> Isn't this a pointer to actual instance of a class (reference) ?
>
> What I want is to add the instance of a class do a GenericArray, but
> not a copy.
>
> And is what the actually the function does, and works ok, except by
> the part of pass the "this".

A ref argument is a pointer to the pointer of the instance!
If you just want a pointer, remove 'ref'.

   void test(objtype t) {...}

t is a pointer to the original instance, NOT a copy.

Similarly, in

   objtype x = t;

x is NOT a copy of t. x and t refer to the same instance.


Nice day
Nor Jaidi Tuah



PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Reference to "this pointer" ?

2016-01-25 Thread Nor Jaidi Tuah

To clarify my earlier reply.

'this' is a constant in the sense that
you cannot change it, for example with

this = someOtherRef;  // <-- error

Nice day
Nor Jaidi Tuah



PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Reference to "this pointer" ?

2016-01-25 Thread Nor Jaidi Tuah

> void test(ref objtype t) {...}
>
> // ... class and method declaration
> {
> test(ref this);
> }
>

That doesn't make sense. 'this' is
a constant. This is very much like
having:

void bla(ref int x) {...}

// ... somewhere
bla(ref 42);


Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] vapi for libpng

2015-06-23 Thread Nor Jaidi Tuah
> Not that I know. You cannot use gdkpixbuf?

I don't see any file output function in
gdkpixbuf, or at the very least in-memory
serialization.

I glanced through libpng manual and found out
that error handling is done by setting a setjmp
destination (continuation rather than callback
or error-flag). I wonder how to wrap that in
vala.

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] vapi for libpng

2015-06-22 Thread Nor Jaidi Tuah
Are there any vapi for libpng (hidden somehow
from google)?

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Gdk.RGBA in text tag - possible leak?

2015-05-19 Thread Nor Jaidi Tuah
You have found a Vala bug.

> g_object_get (_tmp26_, "foreground-rgba", &_tmp27_, NULL);

From
https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-get

--snip
void
g_object_get (gpointer object,
  const gchar *first_property_name,
  ...);

Gets properties of an object.

In general, a copy is made of the property contents and the caller is
responsible for freeing the memory in the appropriate manner for the
type, for instance by calling g_free() or g_object_unref().
--endsnip----


Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Research project on the Vala compiler

2015-04-03 Thread Nor Jaidi Tuah

> My goal is to confirm the relevance of metrics measured in the
> generated C code to evaluate the quality of the sources. This is
> important considering the impressive amount of tools that have been
> developed to measure the quality of C/C++ sources.

There is a list of projects written in vala in
https://wiki.gnome.org/Projects/Vala/Documentation

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] How to add an icon into the StackSwitcher

2015-03-20 Thread Nor Jaidi Tuah
StackSwitcher is a Box. So, you can
use add.

Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Named argument expected

2015-02-13 Thread Nor Jaidi Tuah
Vala allows fn(name:"value"). Is it possible
to have a compile-time enforcement for this?

For example, the code

object(xx)

will produce "Named argument expected" compile
error. Is this compile-time check a special
case or generally available to any function
appropriately declared?


Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] GLib delegate error

2015-02-11 Thread Nor Jaidi Tuah
The following is accepted by vala:

public SimpleActionActivateFunc func;

but rejected by c with the following error:

error: unknown type name ‘GSimpleActionActivateFunc’

Any workaround?

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] glib resource linked to executable file

2015-02-01 Thread Nor Jaidi Tuah
Hi,

Are there any vala project (preferably
using automake) that links its data
(icon, picture, xml, etc) and accesses them
as GLib.Resource. I want to learn the proper
way to do this.

Reason: I want my app to run properly even
without "make install".

Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] How to implement gtk textview auto scroll?

2015-01-23 Thread Nor Jaidi Tuah

> right now, my solution is :
>
> 1.when serialport data coming, insert the data at the end of the
> textbuffer
>
> public void data_report(uint8[] data, int size)
> {
> Gtk.TextIter iter;
>
> textbuffer_output.get_end_iter(out iter);
>
> textbuffer_output.insert(ref iter, (string)data, size);
> }

Make sure the above is running on the gui thread.

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] not null 'this' in constructors

2014-11-11 Thread Nor Jaidi Tuah

> public class Foo
> {
> int i;
>
> public Foo.from(int i)
> {
> this.i = i;
> }
> }
>
> public class Bar
> {
> Foo f;
>
> public Bar()
> {
> assert( this != null );
> f.from(1); // this line causes the trouble
> }
> }

I think you have found a compiler bug.
f.from(1) should be a compile error.


Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] not null 'this' in constructors

2014-11-10 Thread Nor Jaidi Tuah

> Is 'this' always null in constructors? The following code produces a
> run-time error:
>
> public class Foo
> {
> Foo()
> {
> assert( this != null );
> }
> }

Are you sure about this? Perhaps you should
provide a small program that triggers this error.

> Is there a way to get the true value of this in the constructor? I guess,
> probably not. As far as I understand references in vala are somewhat
> similar to shared_ptr<> pointers in C++ and vala classes to
> enable_shared_from_this<> C++ subclasses. If the reasons are also similar,
> it would be sad.

Vala references are like C pointers -- raw,
unwrapped, direct and optimizer friendly (though
I notice that the vala compiler puts an
additional indirection for private variables,
incurring performance penalty in object construction
and subsequent accesses).

C++ shared_ptr is an ugly wart. Its only similarity
with Vala references is ref counting.

Do not let your experience with shared_ptr
discourage you from Vala.

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] GLib List.append sometimes fails when called from a different class

2014-10-09 Thread Nor Jaidi Tuah
Interesting find. I looked at the generated C code.
It seems that an empty GLib.List is simply NULL.
i.e. you might have simply put

public List some_list = null;

to initialize some_list.

A GLib.List is not your typical vala object.

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Signals not being called back

2014-09-03 Thread Nor Jaidi Tuah
I suspect your connect was done before a
main loop was created and libbamf doesn't
automatically create one. Timeout, on the
other hand, will cause a default main loop
to be created.

Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] cairo binding bug?

2014-06-27 Thread Nor Jaidi Tuah
The way I understand the documentation at

http://www.cairographics.org/manual/cairo-Paths.html

is that a Path can either be constructed through a cairo
context, i.e., using

   new_path
   move_to
   line_to
   arc_to
   etc

and such a path can be read using either

   copy_path
   copy_path_flat

But a path can also constructed manually, i.e.
not through a cairo context.

I think I understand now why the binding does
not allow "new Cairo.Path". (I may be wrong
here, so please correct me). This is due to
a limitation in vapi. According to the cairo documentation,
a path obtained using copy_path and copy_path_flat
must be disposed using cairo_path_destroy, hence
the following lines in cairo.vapi:

[Compact]
[CCode (free_function = "cairo_path_destroy", etc]
public class Path { etc }

But, the cairo documentation also states that a
manually constructed path must also be destroyed
manually (i.e., not using cairo_path_destroy).
Hence the vapi cannot provide "new Cairo.Path"
because of the inappropirate free_function.

If alternative free_function is a common expectation
in the commonly used libraries, vala should
address this issue.

Please correct me if I'm wrong.

Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] cairo binding bug?

2014-06-25 Thread Nor Jaidi Tuah
According to http://www.cairographics.org/manual/cairo-Paths.html,

   The path may be either the return value from one of cairo_copy_path()
   or cairo_copy_path_flat() or it may be constructed manually.

But, trying to construct a path manually, i.e.,

  var path = new Cairo.Path ();

gives a compiler error:

  error: `Cairo.Path' does not have a default constructor

Am I doing this the wrong way, or is this a binding bug?


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] volatile variable

2014-06-16 Thread Nor Jaidi Tuah
Thank you for all the feedback and discussion.
I now realize that my app, which seems to work
perfectly, is a time bomb that would blow
my brain away because I'm using a "pipeline"
where a finished job is indicated by setting
a flag as the final instruction. Like this:

.
// do stuff
.
// and finally
flag = flag_val;
// WRONG. Can be reordered even if
// atomicity can be assumed

I have to put a barrier to ensure that the flag
setting is REALLY the final instruction. Can
I do this?

.
// do stuff
.
// and finally
AtomicInt.@set (ref flag, flag_val);
// Safe

What's the correct way to do this in vala?


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] volatile variable

2014-06-15 Thread Nor Jaidi Tuah

> [1] Note that because the libgee deals with pointers it needs to
> implement a bit more. If you need a guide see
> http://blog.piechotka.com.pl/2014/03/01/lock-free-collection-in-libgee-hazard-pointer/
>  (even more self-promotion)
>

Thanks for the link. That eventually leads me to
ConcurrentList. I can't use ConcurrentList directly
because I need these:

   void insert_after (G ref_item, G item)
   G get_after (G ref_item)

In non-threaded code, the above can be implemented using

   insert (index_of (ref_item) + 1, G);
   get (index_of (ref_item) + 1)

In multithreaded code, these won't work without locks.

Even though I cannot use ConcurrentList directly,
I hope I can learn something useful from it.


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] volatile variable

2014-06-15 Thread Nor Jaidi Tuah
Summary: byte access (read/write) is atomic on
MOST architectures. Dang! I thought ALL.

> [1] Synchronized means if x and y are set to 0 and thread 1 sets first x
> and then y to 1 then thread 2 might read y == 1 and then x == 0. Atomic
> means that state of x and y are either 0 or 1. Note that x86 is rather
> strongly order architecture so you won't notice it in _most_
> circumstances on that platform but you can get the reordering on for
> example  arm. Programmers manual from processors should have a few pages
> in them stating the exact rules.

Don't forget the compiler. It too can reorder.


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] volatile variable

2014-06-15 Thread Nor Jaidi Tuah

> True - there is a few cases where volatile can be used (I know too
> little about security to say if using just volatile is ok from standard
> POV).  I guess you could reformulate my question into - "in most you
> don't need volatile and many programmers use volatile as atomic despite
> it does not mean that. Are you sure that your use case is legitimate?".

I have one use case which may not be legitimate
academically (whatever that means), but in
practice should be ok. I assume that access to
a byte is always atomic and so I don't have to
use a lock or other sync mechanisms. I think
this is reasonable if my routine can tolerate
cache delay (one thread already updating, another
thread still using the old value). But I still need
to tell the compiler to suppress its optimization,
hence volatile.

I think my use case is valid unless 4-bit processors
are coming back. Or, unless cache delays are
indefinitely long.


Nice day
Nor Jaidi Tuah







PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] volatile variable

2014-06-15 Thread Nor Jaidi Tuah

> /* Need to register types with the glib type system for dynamic
>  * construction with gtkbuilder. Need to figure out a better way
>  * to ensure the calls to typeof() are not optimized out.
>  */
>
> stdout.printf("Registering %s\n", typeof(AboutDialog).name());
> stdout.printf("Registering %s\n", typeof(AddSimulationDialog).name());

Thanks for the tip. I'm still using the --debug flag
and so this issue is still dormant in my code.
But I am changing it right now so it won't bite me
later.

Nice day
Nor Jaidi Tuah






PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] volatile variable

2014-06-15 Thread Nor Jaidi Tuah

> As a side question - why do you need volatile? In most cases it's not
> needed (unless you write kernel/driver and do memory based I/O).

My multithreaded code didn't work and I thought
may be gcc is making a wrong optimization.
Turns out to be my own fault.

But still, I'm curious, can gcc make a wrong
optimization not knowing that a variable may
be changed by another thread?

I notice that both glib and vala use volatile ref_count.
So, if we were to do our own application-specific
memory management, shouldn't we have volatile
somewhere?


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] volatile variable

2014-06-11 Thread Nor Jaidi Tuah
Is there any way to declare a volatile?
Gedit highlighting indicates that it is a keyword in vala.
But trying

  volatile int xx;

gives a compiler error.


Nice day
Nor Jaidi Tuah






PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Parallel programming in Vala?

2014-06-01 Thread Nor Jaidi Tuah
On Sun, 2014-06-01 at 23:32 -0700, Charles Hixson wrote:

I don't think you are refering to the
> http://dlang.org/phobos/std_concurrency.html library that I indicated.
> When I searched the documentation I found no reference to the term "in
> process".
>
>

Consider changing your search term to "in-process" (with a hyphen).


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Parallel programming in Vala?

2014-05-28 Thread Nor Jaidi Tuah

> Since it's been suggested that Vala won't work, and you want to avoid
> scripting languages, you might look into D ( http://dlang.org/index.html
> ) and, in particular http://dlang.org/phobos/std_concurrency.html
>

According to the website:

 Right now, only in-process threads are supported

This is no better than vala+glib threads, except
for the convenient inter-thread communication (which
a future version of vala will surely have :-)

Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] This is a bug or part of my ignorance?

2014-03-08 Thread Nor Jaidi Tuah

On Sat, 2014-03-08 at 03:52 -0200, Flavio Danesse wrote:
> public static int main (string[] args) {
> int x = 0;
> x++;
> return 0;
> }

Runs fine on my machine using vala 0.22.0


Nice day
Nor Jaidi Tuah







PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] This is a bug or part of my ignorance?

2014-03-07 Thread Nor Jaidi Tuah
On Sat, 2014-03-08 at 00:10 -0200, Flavio Danesse wrote:
> int x = 0;
> x += 1;
> Violation segment (`core 'generated)
>
> int x = 0;
> x ++;
> Violation segment (`core 'generated)
>
> int x = 0;
> x = x + 1;

I don't think you will get useful answers
unless you provide more context.

Those statements by themselves are harmless.
But if, say, they are executed within the
context of an object that is already
freed, then... boom, you get a core.


Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] question Gtk 3 + gstreamer 1.0

2014-03-06 Thread Nor Jaidi Tuah

On Wed, 2014-03-05 at 23:53 -0800, Evan Nemerson wrote:
    a very long and illuminating answer.

Thanks for the reply. Your time makes
vala not just a great language, but
a great community as well.


Nice day
Nor Jaidi Tuah






PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] question Gtk 3 + gstreamer 1.0

2014-03-05 Thread Nor Jaidi Tuah
>
> *I would clean the following warning in my application, but not how to do
> it:*
>
>
> /home/flavio/Documentos/JAMediaSuite/UbuntuRadio/vala/UbuntuRadio.vala.c:164:2:
> warning: 'gtk_window_set_opacity' is deprecated (declared at
> /usr/include/gtk-3.0/gtk/gtkwindow.h:142): Use 'gtk_widget_set_opacity'
> instead [-Wdeprecated-declarations]
>   gtk_window_set_opacity ((GtkWindow*) self, 0.5);
>   ^
> /home/flavio/Documentos/JAMediaSuite/UbuntuRadio/vala/UbuntuRadio.vala.c:
> In function 'main':
>
> /home/flavio/Documentos/JAMediaSuite/UbuntuRadio/vala/UbuntuRadio.vala.c:377:2:
> warning: 'g_type_init' is deprecated (declared at
> /usr/include/glib-2.0/gobject/gtype.h:669) [-Wdeprecated-declarations]
>   g_type_init ();
>   ^

I would also appreciate it if anyone can offer
a solution to remove these spurious warnings.

Or even better, a fix to vala or perhaps the
vapi generator to suppress deprecated overriding
methods.


Nice day
Nor Jaidi Tuah






PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] array memory leak?

2014-03-05 Thread Nor Jaidi Tuah
Most probably it's the optimizing behaviour
of the memory allocator and has got nothing
to do with the vala compiler.

You should worry only if the "leak" grows
and grows when the program is running.
Any "leak" reported by a profiler at the
end of a run shouldn't be trusted.


Nice day
Nor Jaidi Tuah






PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Initial array size

2014-01-28 Thread Nor Jaidi Tuah
Is there any way to set/change the
size of an array? resize doesn't
work because that change the length
as well.

   int[] x = {};
   x.resize(10);  // Not this
   x += 8;  // <- this is x[10], not x[0]

Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] "vala friendly" atomic pointer

2013-12-22 Thread Nor Jaidi Tuah

> Not the simplest solution, but works well.

After thinking more about my problem, I don't
think any reliable efficient solution is going
to be simple. Thanks for the input.


Nice day
Nor Jaidi Tuah






PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] "vala friendly" atomic pointer

2013-12-20 Thread Nor Jaidi Tuah
Thank you for the clarification and the link
on HazardPointer.


Nice day
Nor Jaidi Tuah






PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] "vala friendly" atomic pointer

2013-12-20 Thread Nor Jaidi Tuah
Thanks for the replies.

It seems that WeakRef doesn't help with the granularity:
multiple readers will lock out each other (I hope I'm
wrong here). Besides, from
https://bugzilla.gnome.org/show_bug.cgi?id=703996
it appears that WeakRef is totally broken.

As for HazardPointers, according to the documentation:
 HazardPointers are not thread-safe (unless documentation
 states otherwise)

I wish vala has "lockread" in addition to lock.


Nice day
Nor Jaidi Tuah






PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] "vala friendly" atomic pointer

2013-12-18 Thread Nor Jaidi Tuah
Dear all,

I want to implement something like these:
   *  x = AtomicPointer.@get (ref atomicRef)   // reader

   *  AtomicPointer.@set (ref atomicRef, newref)  // writer

   *  return AtomicPointer.@get (ref atomicRef)  // reader

but have the benefit of vala ref counting.

The best I can think of is:

   *  lock (atomicRef) { x = atomicRef; }

   *  lock (atomicRef) { atomicRef = newref; }

   *  lock (atomicRef) { return atomicRef; }

But lock is too course.
e.g., lock (atomicRef) {x = atomicRef;} will also lock
out other readers, whereas AtomicPointer.get won't.

I realise that the exclusive region is small.
But if you have a lot of readers, the effect
may be significant.

Any suggestions?


Nice day
Nor Jaidi Tuah






PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] delegate variable "feature" or vala bug

2013-12-13 Thread Nor Jaidi Tuah
Dear all,

I had a memory leak in my app that I traced to
a delegate variable. Something like this:

   class X {
  delegate void Delegate ();
  Delegate d;

  public void xx () {
 d = () => { do_stuff ();};
  }
   }

Given the above, the following will leak memory:

   {
  new X(). xx ();
   }

I think this is because there is an unavoidable
reference cycle between d and the X object. Is
this correct? If not, then it may be a vala bug.

I can fix the memory leak by setting d to null
before the X object gets unreffed (this makes
it sound like a vala bug).


Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Feature request: cascade operator

2013-11-19 Thread Nor Jaidi Tuah
> For example, say ".." is the operator, this:
>
> var object = new Object();
> object.method_one(arg);
> object.method_two(arg);
> object.method_three(arg);
>
> Can be written as this:
>
> new Object()
> ..method_one(arg)
> ..method_two(arg)
> ..method_three(arg);

Good idea. But

> Another good example is object creation, here's a window being created:
>
> var window = new Window ();
> window.title = "Hello, World!";
> window.border_width = 10;
> window.window_position = WindowPosition.CENTER;
> window.set_default_size(350, 70);
>
> This can be simplified to:
>
> var window = new Window ()
> ..title = "Hello, World!"
> ..border_width = 10
> ..window_position = WindowPosition.CENTER
> ..set_default_size(350, 70);

... the above is troublesome.

Consider this:
var x = new X()
   ..y = new Y()
   ..z = new Z();

'z' is ambiguous.
Is that x.z (still cascading the X)
or x.y.z (cascading the Y)


Nice day
Nor Jaidi Tuah






PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Printfing an object

2013-11-19 Thread Nor Jaidi Tuah
On Tue, 2013-11-19 at 11:07 +0200, Donn wrote:
> On 19/11/2013 10:50, Nor Jaidi Tuah wrote:
> > The answer will be obvious if you try this:
> >var b = new Obj();
> >var b1 = b;
> >print ("%p %p %p %p", b, b1, &b, &b1);
>
> Obvious might be a little bold :)
>
> I get these numbers:
>
> 0xffa0c0 0xffa0c0 0x7fffbbedcfe0 0x7fffbbedcfe8
>
> I read the first two as "address of the instance" with b and b1 being
> pointers to that address.
>
> The next two ... are they the addresses of the variables "b" and "b1"
> which each *contain* the 0xffa0c0 address of the instance?

Exactly. Told you it's obvious :-)


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Printfing an object

2013-11-19 Thread Nor Jaidi Tuah

> For interest's sake, why is the output from &o different to o? Which
> would you use as a unique key?

The answer will be obvious if you try this:
  var b = new Obj();
  var b1 = b;
  print ("%p %p %p %p", b, b1, &b, &b1);


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] libsoup Session.Async does not send stuff

2013-11-02 Thread Nor Jaidi Tuah
> > Perhaps this is not a vapi bug.
> > Perhaps in vala a closure cannot
> > live longer than the scope wherein
> > it is created. Is that the case?
>
> It can, the argument just needs to be owned.  Perhaps you're using and
> old version of Vala, because unless I'm mistaken this should be fixed
> with 0.22... see bug #704176.

Was on 0.21. Now upgraded to 0.22.
It works!


The call is now compiled to:

soup_session_queue_message ((SoupSession*) session, _tmp22_,
___lambda2__soup_session_callback, block1_data_ref (_data1_));


_data1_ got freed when the lamda is executed, like so:

static void ___lambda2__soup_session_callback (SoupSession* session,
SoupMessage* msg, gpointer self) {
__lambda2_ (self, session, msg);
block1_data_unref (self);
}


Apparently the live of "session" is taken care of by
soup_session_queue_message itself. So "session" doesn't need
to be "global".


Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] RCU synchronization

2013-11-01 Thread Nor Jaidi Tuah
Dear all,

I would like to use RCU in vala
(https://en.wikipedia.org/wiki/Read-copy-update).

Are there any rcu library with vala binding?


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] libsoup Session.Async does not send stuff

2013-11-01 Thread Nor Jaidi Tuah
On Sat, 2013-11-02 at 11:24 +0800, Nor Jaidi Tuah wrote:
> I think I got it now. It looks like
> a libsoup vapi bug.

Sorry, I keep tripping myself.
Perhaps this is not a vapi bug.
Perhaps in vala a closure cannot
live longer than the scope wherein
it is created. Is that the case?


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] libsoup Session.Async does not send stuff

2013-11-01 Thread Nor Jaidi Tuah
I think I got it now. It looks like
a libsoup vapi bug.

After looking at the generated C more carefully,
I find that closure doesn't work with queue_message
at all!

The closure is created like this:

_data1_ = g_slice_new0 (Block1Data);
_data1_->_ref_count_ = 1;

the call to queue_message is compiled to this:

soup_session_queue_message ((SoupSession*) session, _tmp22_,
___lambda2__soup_session_callback, _data1_);

   /* Note: there is NO g_object_ref(_data1_) before the call,
  and soup_session_queue_message simply treat
  _data1_ as typeless blob.

  Hence, refcount is still 1 */

at the end of the scope, the entire closure
is destroyed like this:

block1_data_unref (_data1_);  // recursively unref everything
_data1_ = NULL;

Hence, by the time the lambda executes, the closure has
already gone.


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] libsoup Session.Async does not send stuff

2013-11-01 Thread Nor Jaidi Tuah
On Fri, 2013-11-01 at 03:04 +0100, Daniel Brendle wrote:
> On Thu, 2013-10-31 at 20:03 +0100, Luca Bruno wrote:
> > Keep the session alive here: Soup.SessionSync session = new
> > Soup.SessionSync ();
> > Add that as a server instance. Also, keep the server itself alive
> > somewhere.
> >
> Acutally this worked. Now i think i understand. The lifetime of the
> SessionAsync ended, when it left the scope of the closure, this triggers
> the real_cancel_message-method on all queued messages through some kind
> of destructor.

Glad that worked. But there are some loose
ends.

It didn't work before because the lambda doesn't
contain "session", and hence session got destroyed.

But...

(A) it doesn't explain why the proxy works (in a
non-reentrant manner) when "server" and "msg"
are static, but not "session". Shouldn't
"session" be destroyed?

(B) it doesn't explain why the original post
didn't work. The lambda increases the refcounts
of "server" and "msg" and hence they should
still be alive. But apparently not. Why?

(A) and (B) should both work, or both fail,
because their difference is simply this:

   keep server and msg alive using static
 vs
   keep server and msg alive by incrementing
   their refcounts


Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] libsoup Session.Async does not send stuff

2013-10-31 Thread Nor Jaidi Tuah
On Thu, 2013-10-31 at 16:56 +0800, Nor Jaidi Tuah wrote:
> Perhaps this is a manifestation of the async+closure
> bug: https://bugzilla.gnome.org/show_bug.cgi?id=653143

Please ignore my previous remark. That bug report
was about vala async. I don't think that is relevant here.

The strange thing about the Session.Async bug is that,
as noted by the original post, the example in valadoc
works!


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] libsoup Session.Async does not send stuff

2013-10-31 Thread Nor Jaidi Tuah
Perhaps this is a manifestation of the async+closure
bug: https://bugzilla.gnome.org/show_bug.cgi?id=653143


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] libsoup Session.Async does not send stuff

2013-10-30 Thread Nor Jaidi Tuah
There seems to be a bug in the vala compiler, but I
cannot isolate it even after looking at the generated
C code.

To make the default_handler "work", do this:

 * Somewhere, declare these statics:
static ProxyServer server;
static Soup.Message msg;

 * Then change the handler to:

  private void default_handler (Soup.Server _server, Soup.Message
_msg, string path, GLib.HashTable? query, Soup.ClientContext client) {

   msg = _msg;
   server = _server;
 ... etc ...
  }

Of course it won't be reentrant anymore, and multiple
requests to the proxy will trample each other. But the
point is that libsoup works and the handler should is
correctly written; the fault is with vala. But as I said,
I cannot locate the fault. Perhaps its vala+libsoup
interaction because I rarely have problems with closure.

Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] libsoup Session.Async does not send stuff

2013-10-28 Thread Nor Jaidi Tuah
On Mon, 2013-10-28 at 21:39 +0100, Daniel Brendle wrote:
> > Perhaps this is the offending line:
> > unowned ProxyServer self = server as ProxyServer;
> >
> > Try removing "unowned" unless you are sure that
> > the Server is never freed.
>
> I tried it, but it did not do the trick, i also tried to compile the
> code with the newest vala-compiler (0.22), but it did not make a
> difference (i used 0.16 before). Could the Problem be the two nested
> asynchronous contexts? I am not exactly sure how those closures work.

Have you tried running from command line and
see what those printfs have to say? I doubt
there is any problem with the nested closures.

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] libsoup Session.Async does not send stuff

2013-10-27 Thread Nor Jaidi Tuah
Perhaps this is the offending line:
unowned ProxyServer self = server as ProxyServer;

Try removing "unowned" unless you are sure that
the Server is never freed.

Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Gee ArrayList item question

2013-10-26 Thread Nor Jaidi Tuah

> The remarks show the mystery. What *is* the "i" variable (declared in
> the foreach)? It looks like an "int", but there's that L.index_of
> method that takes an "item". So, I added that "int x" just to test it;
> and it does break things.
>
> What is coming out of that foreach? What type is "i" really?

Concerning L.index_of(x):
L.index_of(0) => -1  because 0 is not in L.
L.index_of(1) => -1  because 1 is not in L.

Concerning L.index_of(i):
L.index_of(10) => 0  because L[0] is 10.
L.index_of(20) => 1  because L[1] is 20.


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Possible but in string.index_of, index_of_char and contains

2013-10-16 Thread Nor Jaidi Tuah
On Wed, 2013-10-16 at 19:45 -0700, Evan Nemerson wrote:
> On Thu, 2013-10-17 at 09:19 +0800, Nor Jaidi Tuah wrote:
> > > "ABC".index_of_char('\x00'):  0
> >
> > This looks like a bug. But why should
> > you want to search for \x00 ?
>
> string.index_of_char is basically a wrapper around g_utf8_strchr.  I
> guess g_utf8_strchr could return null if c==0, but it does feel a bit
> ridiculous.  If you feel strongly about it you can file a bug against
> glib.
>

I thought it should return -1.
But this is a very very very minor bug.
I can't think of a reason to search for \x00
(Any program searching for \0 in a string
must have a serious bug somewhere)
So, getting this fixed really gains nothing.

Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Possible but in string.index_of, index_of_char and contains

2013-10-16 Thread Nor Jaidi Tuah

> "ABC".index_of_char('\x00'):  0

This looks like a bug. But why should
you want to search for \x00 ?


> "ABC".index_of("\x00"):  0
> "ABC".contains("\x00"):  true

These 2 lines should be okay because vala
strings are really C strings.
Thus, "\x00" is equivalent to "".
(Or, I have just revealed my ignorance
concerning vala strings).

Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] How to bitwise math and implement a jagged array in Vala?

2013-07-04 Thread Nor Jaidi Tuah
On Thu, 2013-07-04 at 00:29 -0500, Thomas F Steinhauer wrote:
> Ok, you lost me some how
> > checkImage = makeCheckImage()

checkImage is declared twice. The global
one is not initialized to anything.

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Help with Memory Leak

2013-05-17 Thread Nor Jaidi Tuah
On Fri, 2013-05-17 at 07:23 -0400, Bruce Reidenbach wrote:
> As they like to say, "old thread is old".
>
> I never was able to get a satisfactory answer from the gtk-app-devel list,
> the only response being that the memory allocation/destruction model for
> gtk was considered good enough.
>
> But then something curious happened.  I compiled the code for the latest
> Ubuntu (13.04) and the problem went away!  The memory footprint is solid as
> a rock, after several days of running.  I know there's way too many
> variables to figure out what happened (new kernal, new gtk, new valac), but
> it appears the problem somehow was cured.  I really doubt that the new
> version of valac had anything to do with it since previously I could cause
> the heap fragmentation to disappear if I commented out the command to
> update the menu label.

That's too bad; we don't know whom to compliment.
Any way, thanks for sharing the good news.

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] [ANNOUNCE] Vala 0.19.0 - Compiler for the GObject type system

2013-02-20 Thread Nor Jaidi Tuah
> Changes since 0.18.1
>  * Support scope = "async" attribute for parameters.

Async parameters? Is that for delegate parameters?
Any pointers to further explanation?

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Setting and getting properties at the same time

2012-11-11 Thread Nor Jaidi Tuah

> >   * Semantic A is really confusing. e.g.,
> >   var1.myproperty = var2.myproperty = y;
> > who would have thought that var1.myproperty
> > is different from var2.myproperty ?!
>
> It's only confusing for non well-behaving properties. The right solution
> is to fix the property.

Ok. I concur. The confusing part is not really the chained
assignment, but the abuse of property.

For a confusingly defined property, even a simple assignment
such as this

   var1.myproperty = var2.myproperty;

can be nasty. Who would have expected
(var1.myproperty == var2.myproperty) to be false
after that assignment?

So, I change my mind and go for Semantics A now.
To be consistent, if a simple assignment is nasty,
putting it into a chain shouldn't remove the
nastiness.

(Sorry for the nasty English)

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Setting and getting properties at the same time

2012-11-02 Thread Nor Jaidi Tuah
Not surprisingly, the very subtle point raised by
the original poster has been misunderstood.

The OP complained that this

   int x = (myclass.myproperty = y);

should behave like this

   // Semantic A
   myclass.myproperty = y;
   int x = myclass.property;

rather than this

   // Semantic B
   myclass.myproperty = y;
   int x = y;

The subtle point is that myclass.myproperty
does not necessarily evaluate to y.
To repeat the OP's example, a property can
be defined like this

 private int _number;
 public int number {
set { _number = value * 2; }
get { return _number; }
 }

I think chained assignment should have
Semantic B, for the following reasons:

  * A well designed property should give
the same result for both semantics

  * Semantic A is not possible for a
write only property.

  * Semantic A is really confusing. e.g.,
  var1.myproperty = var2.myproperty = y;
who would have thought that var1.myproperty
is different from var2.myproperty ?!


hand
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
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 Nor Jaidi Tuah
>   bool res = Process.spawn_async_with_pipes (null,
>  runme,
>  null,
>  
> SpawnFlags.DO_NOT_REAP_CHILD,
>  null,
>  out 
> child_pid,
>  out input,
>  out 
> pipefd[0],
>  out error );

My guess:

Since you are calling an async method, the out parameters may still
be uninitialized and the pipes still uncreated when you close them.

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] GTK+ Tutorial

2012-08-29 Thread Nor Jaidi Tuah
May I suggest that you go a bit beyond the classic
and include short chapters on gtk+opengl and
gtk+clutter. Gtk feels incomplete without them.

I wonder when gtk will officially include them
as official friends.

Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Getting corrupted results when returning array of strings

2012-08-29 Thread Nor Jaidi Tuah
> Anyway, I've removed every weak/un/owned keyword from the code to start
> from the beginning. Since I only use GObject based classes, strings and
> arrays of strings, shouldn't the worst case scenario be that I end up
> with circular references that don't get freed? Instead the TreeNode's
> add method now adds "empty" nodes (invalid string references I suppose).

If you're not expecting null node.value, I suggest putting
assert(value != null) before adding to the LinkedList, and
putting assert(node.value != null) after reading from it.

Personally, there are many times when assert reveals my own
lapses after 100% sure that the Vala compiler must be buggy :-)


> I've made the generic TreeNode's add-method virtual and overrode it in
> Variable so that I can print out the values. Now however, the Node
> actually stores the values properly (for a while). Why? All I did was
> copy and paste the generic's code and fill in the types, which is the
> same Vala would do, right?

C++ would do that. I don't think that is the Vala's way.
Vala's generics are not "instantiated" into specifics.
They remain generics in the compiled version. (Unless
I've totally misunderstood Vala's generics).

Nice day
Nor Jaidi Tuah



PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Getting corrupted results when returning array of strings

2012-08-28 Thread Nor Jaidi Tuah
> Scope is supposed to hold "variables" (strings) and "arrays of
> variables" and provide capability to try and fetch these from parent
> scopes if the variable is not defined in the current scope. It doesn't
> even have to do that in the error case below.
> Dumping "result" before return is reached yields corrupted strings.
>
> public class Scope: Object {
>
> protected weak Scopeparent;
> protected Variable  local;
> (...)
> public string?[]? get_array(string uri) {
>
> string?[]? result = this.local.get_array(uri);
>
> if (result == null && this.parent != null) { //! result != null here
>
> result = this.parent.get_array(uri);
> }
>
> //! at this point result values appear to be invalid
>
> return result;
> }
> (...)
> }

Perhaps "parent", being weak, is no longer referring
to a valid object. Remove "weak" and see.

Nice day
Nor Jaidi Tuah




PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you 
are neither the addressee (intended recipient) nor an authorised recipient of 
the addressee, and have received this message in error, please destroy this 
message (including attachments) and notify the sender immediately. STRICT 
PROHIBITION: This message, whether in part or in whole, should not be reviewed, 
retained, copied, reused, disclosed, distributed or used for any purpose 
whatsoever. Such unauthorised use may be unlawful and may contain material 
protected by the Official Secrets Act (Cap 153) of the Laws of Brunei 
Darussalam. DISCLAIMER: We/This Department/The Government of Brunei Darussalam, 
accept[s] no responsibility for loss or damage arising from the use of this 
message in any manner whatsoever. Our messages are checked for viruses but we 
do not accept liability for any viruses which may be transmitted in or with 
this message.
___
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 Nor Jaidi Tuah
I'm not sure what gaps in gobject that
Dova is supposed to fill in. But is it
possible to improve gobject to incorporate
those features? Perhaps the vala team
can make suggestion to the glib team.

Sorry if my suggestion is naive.

Nice day
Nor Jaidi Tuah


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


Re: [Vala] vala+automake bug?

2012-08-01 Thread Nor Jaidi Tuah
> > * Why it works on my computer? I check my Makefile,
> >   and there is no -lm.
> 
> I seem to remember that on certain platforms math functions are included
> in libc and adding libm isn't necessary.  It's probably not a good idea
> to rely on that and either always pass -lm or use AC_CHECK_LIB (or
> something similar) to find out whether or not you need it.

Thank you for the explanation.

Nice day
Nor Jaidi Tuah


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


[Vala] vala+automake bug?

2012-07-30 Thread Nor Jaidi Tuah
Dear all,

My project (pasang-emas.sourceforge.net) uses automake,
using AM_PROG_VALAC macro in the configure.ac file.
It uses functions from Math (Math.sin, Math.hypot etc).

Recently, one user complains that upon issuing
'./configure' and 'make', he got the following error:

/usr/bin/ld: note: 'hypot@@GLIBC_2.2.5' is defined in
DSO /lib64/libm.so.6 so try adding it to the linker command line
/lib64/libm.so.6: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[2]: *** [pasang-emas] Error 1

He has to manually add -lm to the Makefile to
make 'make' work.

My questions:
* Shouldn't AM_PROG_VALAC take care of adding -lm?

* Why it works on my computer? I check my Makefile,
  and there is no -lm.

I'm scratching my head now. Please help me save my hair.

Nice day,
Nor Jaidi Tuah






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


Re: [Vala] Question about foreach and pointers.

2012-07-25 Thread Nor Jaidi Tuah
> How I can make array to info.list[iterators] if I want use "foreach"?

You can't.

foreach always takes values.

e.g. you can't do this to initialize an array:

int[] x = new int[10];
foreach (int y in x) {
   y = 1000;  // x is not changed
}


hand
Nor Jaidi Tuah


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


  1   2   >