Vala

Mysterious byte after TLS-Package

半腔热情 提交于 2019-12-03 21:58:49
I am trying to create a SSL TCP Connection from Java to a Vala Server. Everything works fine until I send a second package to the server. (also the first package sends fine). The server only receives the first byte (in this case the "1") of the second package, nothing else, but if I connect to the server without SSL everything works fine. I think that the server isn't the problem, because every other connection from another Vala client works pretty well. I'm using an unstrusted Certificate, so I created a custom TrustManager and I'm using OpenJDK 7 (Elementary OS - Linux). Here's my code: /

Vala: Gotchas, Tips and Tricks

醉酒当歌 提交于 2019-12-03 01:51:58
问题 As a programmer who is new to Vala, what is your number one piece of advice to someone who is new to the language? 回答1: It largely depends on what background you are coming from. If you're coming from C/C++/Java, the best bit of advice is to learn functional programming. Vala supports true closures, and so you should learn (deeply) how to use lambda expressions. The best resource for this is Structure and Interpretation of Computer Programs by Abelson and Sussman. It was the introductory

How to tweak the variables, which a Lambda expression in Vala captures?

≡放荡痞女 提交于 2019-12-02 16:51:54
问题 How to capture this only weakly in a anonymous function? I couldn't find anything in the docs regarding whether (or how) the variables captured by a anonymous function / lambda expression could be tweaked. The problem is that these functions seem to capture all variables from the stack frame, they are created in, at least by default. Particularly, they always capture this , which is problematic when using them for signal handlers, because the handlers turn into hard references to this then,

Vala: Gotchas, Tips and Tricks

早过忘川 提交于 2019-12-02 15:27:37
As a programmer who is new to Vala, what is your number one piece of advice to someone who is new to the language? user274045 It largely depends on what background you are coming from. If you're coming from C/C++/Java, the best bit of advice is to learn functional programming. Vala supports true closures, and so you should learn (deeply) how to use lambda expressions. The best resource for this is Structure and Interpretation of Computer Programs by Abelson and Sussman. It was the introductory textbook for CS at MIT for many years. It is available free on-line at http://mitpress.mit.edu/sicp

Regex using Vala and GLib

不想你离开。 提交于 2019-12-02 15:16:29
问题 Is there a function, something like http://php.net/manual/en/function.preg-match-all.php ? Using GLib http://references.valadoc.org/#!api=glib-2.0/GLib.MatchInfo, all i'v found is : public bool match_all_full (string str, ssize_t string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, out MatchInfo match_info = null) throws RegexError Using the standard algorithm for regular expression matching only the longest match in the string is retrieved, it is not possible to obtain

How to pack a button in a HeaderBar using Genie?

有些话、适合烂在心里 提交于 2019-12-02 10:14:28
问题 Background My aim is to improve a little text editor as an exercise. It is running fine after the HeaderBar was added, however I can't find a way to pack buttons in it. Code uses Granite.Widgets Gtk init Gtk.init (ref args) var app = new Application () app.show_all () Gtk.main () // This class holds all the elements from the GUI class Application : Gtk.Window _view:Gtk.TextView construct () // Prepare Gtk.Window: this.window_position = Gtk.WindowPosition.CENTER this.destroy.connect (Gtk.main

How to tweak the variables, which a Lambda expression in Vala captures?

我是研究僧i 提交于 2019-12-02 09:49:06
How to capture this only weakly in a anonymous function? I couldn't find anything in the docs regarding whether (or how) the variables captured by a anonymous function / lambda expression could be tweaked. The problem is that these functions seem to capture all variables from the stack frame, they are created in, at least by default. Particularly, they always capture this , which is problematic when using them for signal handlers, because the handlers turn into hard references to this then, probably causing reference cycles. Does Vala have some mechanism on how to prevent lambdas from

How to pack a button in a HeaderBar using Genie?

ぐ巨炮叔叔 提交于 2019-12-02 05:48:44
Background My aim is to improve a little text editor as an exercise. It is running fine after the HeaderBar was added, however I can't find a way to pack buttons in it. Code uses Granite.Widgets Gtk init Gtk.init (ref args) var app = new Application () app.show_all () Gtk.main () // This class holds all the elements from the GUI class Application : Gtk.Window _view:Gtk.TextView construct () // Prepare Gtk.Window: this.window_position = Gtk.WindowPosition.CENTER this.destroy.connect (Gtk.main_quit) this.set_default_size (400, 400) // Headerbar definition headerbar:Gtk.HeaderBar = new Gtk

Is OS detection possible with GLib?

試著忘記壹切 提交于 2019-12-02 02:25:17
Is it possible to determine on which platform (GNU/Linux, Win32, OS X) my Vala app is running? Jens Mühlenhoff As Vala is a compiled language (as opposed to intermediate or interpreted) you can determine the platform using your favorite build tool and use conditional compilation . Something like: #if WINDOWS message ("Running on Windows"); #elif OSX message ("Running on OS X"); #elif LINUX message ("Running on GNU/Linux"); #elif POSIX message ("Running on other POSIX system"); #else message ("Running on unknown OS"); #endif The build tool would have to pass -D LINUX , etc to the compiler. I

Why this function return an (owned) value?

旧时模样 提交于 2019-12-01 22:50:06
问题 the code from: Genie howto repeat a string N times as an string arrayGenie howto repeat a string N times as an string array def repeatwithsep (e: string, n: int, separator: string): string var elen = e.length; var slen = separator.length; var a = new StringBuilder.sized ((elen * n) + (slen * (n - 1)) + 1); for var i = 0 to (n - 1) if i != 0 a.append_len (separator, slen) a.append_len (e, elen) return (owned) a.str var a is a local variable, when a goes out of scope, it will be destroyed. why