bzr branch lp:~gustav-hartvigsson/+junk/CVEnglish version here (Updated 2014 04 20)
or Swedish version here (Updated 2014 04 20)
bzr branch lp:~gustav-hartvigsson/+junk/CVEnglish version here (Updated 2014 04 20)
"When life gives you lemons, don’t make lemonade. Make life take the lemons back!"
-- Cave Johnson (Late CEO of Aperture Science)
Has anyone been asked this question? What is the correct answer to it?
This is a question I have pondered many a days, and I have come to the answer "no, I would not hire myself".
I'm rude, I hate most things, I hate you in particular (for no reason), I am not very productive at best of times (I rather not do something than do it), I am not very smart (even if I fake being smart pretty well), and I have dought my own abilities.
When I was younger I tried my hands on drawing (a short lived dream about doing comics), but that only fucking my right hand up (writers hand).
My father always told me to become a politician, but if it weren't for my absolute disdain for almost all political parties's policies/programs, I almost considered it.
I was told to get a degree (decided on Computer Science), but that only led to a big student loan and no degree.
I was told to work in a restaurant, seemed fun, was in reality the worst fucking job ever.
I tried to do graft (working at a company that does fibre installations), got the boot.
Took a course in Java EE/Web Programming, I hated every minute of it. I just don't understand how anyone would like such a job.
I tried my hand at writing (done so for some time, and still do) but I know it is all a pile of shit; every character speaks with the same voice, the dramatic curve has gone out the window, the tempo is all wrong, the disposition is all wrong.
I feel done.
"FML" is probably the best description of my life.
"Mamma, kolla ett spöke."
-- Femåringen som såg en kvinna i heltäckande slöja.
Fan vad osammanhängande jag kan skriva... Hänger inte ens med själv. ^_^
Sverige har endast ansvar för att hjälpa svenska medborgare och de med uppehållstillstånd.
Är de inte medborgare i något EU land så har de inte något att göra här.
Visst vi har en extraordinär situation I Europa och Mellanöstern men det är inte vår skyldighet att hjälpa, men det är nog det mest humana att göra.
Men begår de något brott skall de kastas ut ur EU och bli målade med genetiska markörer så att de inte kan återvånda.
Vi har exempel på våldtäkter på barn på asylboendes som inte rapporteras till polisen utan mörkas av personalen[1]. Sådana här saker måste uppmärksammas.
Och om vi tar en avstickare från Flykting frågan så måste vi nog ta tag i problemen som det multikulturella samhället har skapat. Där vi tillåter de som kommer hit att välja att inte assimileras, där vi ser mellan fingrarna när det gäller den icke acceptabla människosynen som vissa individer har.
Antingen står vi upp för den västliga civilisationen eller så låter vi oss bli överkörda av de som inte delar våra värderingar när det gäller synen på människa liv eller vad som utgör ett samhälle.
Att luta sig tillbaka och tycka bra om oss själva bara för att vi hjälper de som kommer hit och inte hjälpa dem med att komma ur sin egna kulturella bubbla hjälper ingen. Och skapar bara problem framöver.
Vill vi ha ett segregerat samhälle eller ett samhälle som är byggt på rättssäkerhet? Vill vi att den generationen som efterträder oss inte vågar ta tag i problem för att inte de skall råka såra någons känslor. Nej, det tror jag inte. Vi måste stå upp för våra demokratiska ideal till vilket pris som helst. Vi skall inte tro att vi kan vara tillmötesgående till alla, vi måste stå upp för de sekulära idealen som det västerländska civilisationen bygger på! Vi skall inte bry oss om hudfärg, kön, religion, bara om individens välstånd i samhället, trotts vad den regressiva vänstern tycker.
Så... Var var jag? Err... Vad fan? Detta får duga.
Källor:
[1] http://sverigesradio.se/sida/artikel.aspx?programid=106&artikel=6283519
So I have been working on this project that I called "SSTS" or Super Simple Type System. It is neither a "Type System" or "Simple".
I have been working on this on and off for two-three years. I started it on a whim, I wanted to learn what makes GLib and GObject tick, so I set out with the simple goal of implementing something like GObject but without all the nasty type-tracking and what not. It started out well, with a base object type that I could use to implement other stuff and call methods using the base object's interface.
"This is easy!" I thought to my self, it was easy, cus' it was nothing special. Then I wanted to add something like the GObject's notify system. But for that I needed some sort of map structure... But to implement a Map structure I needed a Dynamic Array and a Linked List...
It is now almost two years since I started faffing about with this, and get lots of help from the guys over at the C Programmers community on G+, and now I had hit a road block. I got double frees... And I just could not figure out what was wrong.
I posted a query to the community page, but got told I needed more tests. At this point I just give up. I am sick of this. Not of the people trying to help, but at my self, I have spent two years on some code that no one will ever care about. And I just do not care enough to write test cases, the code is not written in a "test friendly" way.
Sure, I have learned a lot by the experience but I just see no end in sight for the project. If I were to implement the object notify system I would start with the next thing (Streams), which would require something else(an Event Loop).
At this point I see nothing but an other two years till I would be finished, and I just do not want to care about it any more.
I like how I have focused on making the function calls not feel to "C"-y. I wrote wrappers for string functions to return strings, so if feels like something like Java or something. And this philosophy is everywhere. "Make it not feel too much like C."
I did not want any of the internals leaking out like some kind of horror show. I did not want the user to have to deal with checking if a function returns a positive or negative value. That is scuff that the user can be without.
This good intentions makes for code that is harder to test than "normal" C code where you get some error value from a function when it fails. It can not just check "is this negative" over and over again and see it go through. No to test these things I have to go through and write complex tests for edge cases that I never thought of when writing it.
I just no not want to deal with that.
I give up... I have had enough of my ineptitude.
In C we do not have iterators in any sane fashion (C++'s iterators are not sane either, btw 😜 ) nor do we have a standard array_for_each (how would that even work?). So when implementing a C data structure that may need for_each capabilities it is best to do it. Relying on for loops can be problematic if you are not careful.
In these example I will use a DynamicArray as the data structure. With functions to get items at an index and the length of the array. When it comes to LinkedLists you must use linked_list_next, linked_list_prev and linked_list_get_current, but that is outside this discussion.
The signature for a good for each function in any implementation is as follows:
typedef void (ForEachFunc *)(void * self, void * item, void * user_data);
The self here should be a pointer to the data structure you are doing the for
each on. No operations should de done on this structure.
The item is the current item, the item that the for each function should operate.
The user_data is any user data you can think of. It may be used as a out value
or as some other data that is used inside the for each function.
In this example I will not rely on any internals of the data structure, instead I will use
dynamic_array_get() and dynamic_array_len()
this means that you can implement this even if you do not have accesses to the underlying structure.
To begin with you must understand that this relies on a for loop, so it is not more efficient that just writing a for loop your self. It just provides a little bit safer way of coding, where you do not have to keep track of variables to much.
The signature of the function is as follows:
void
dynamic_array_for_each (DynamicArray * self, ForEachFunc func, void * user_data) {}
The self here is the dynamic array to perform the for-each function on.
The func here is the function that we are to execute on each iteration.
The user_data is the data to passed to the function. This may be used as an "output" of sorts.
void
dynamic_array_for_each (DynamicArray * self, ForEachFunc func, void * user_data) {
// First me get the length of the array, This should be the last item in the array.
size_t len = dynamic_array_len (self);
for (size_t i = 0; i <= len; i++) {
// Check if the item is there.
void * item = dynamic_array_get (self, i);
if (item) {
func (self, item, user_data);
}
}
}
And that is it, folks!
So now it is now time to use the this for-each thingy. So lets define a function to use in the for-each.
void
for_each_print (SDynamicArray * self, int item, int * itt) {
fprintf (stdout, "The number is: %d on iteration: %d\n", item, (*itt));
(*itt)++;
}
This function prints the number stored in the array and prints it out. as user data it takes a pointer to an int, this is that is incremented each time the function is called.
Lets now put this into a context:
int
main (int argc, char ** argv, char ** argp) {
/* create the array */
DynamicArray * arr = dynamic_array ();
/* ... Code to fill the array with numbers. */
int itt = 0;
dynamic_array_for_each (arr, (ForEachFunc)for_each_print, &itt);
fprintf (stdout, "The last itt number is: %d", itt);
/* ... Code to free the array and what not ... */
}
As you can see it is not too much work to implement or use.
So as we have seen it is not magic, it is actually easy to use, and it promotes code-re-use. One downside of this is that it does a lot of calls, and thus uses the call stack, this might be problematic if you you already are hitting the maximum call stack size.
But I firmly believe that this is the best way of doing things like this.
"I am sorry, future self."
-- A comment in some code
"What is love? baby don't hurt me, don't hurt me, no more"
-- Haddaway
Reference to this post: https://plus.google.com/u/0/100647702320088380533/posts/4f1DuFuVfoz
After reading that I the article above I started to think about what the people in the article above actually thought about long term relationships. This is my POW on love and sex.
If you ask me, I would rather have a long-term relationship than a one-sight-stand with some stranger. I do like to feel that I am loved rather than something shallow, untrue (as a one-night-stand is).
I do not want children though (for reasons that I am not going to discuss here).
They say that long-term relationships are "Too troublesome" , but I think that this is just an excuse. They rely do want a relationship, it is just that they are afraid of loosing what they have.
It might be by Gaijin-white mindset but the statement that Kishino made seems weird: "I don't earn a huge salary to go on dates and I don't want the responsibility of a woman hoping it might lead to marriage."
I do not think that I have ever heard of anyone here engaging in a relationship because they think they will marry there partner. That is not to say that they will not get married, though.
And this might be due to my cheap-asrsery but if you are in a relationship with someone who loves you, why does the male have to present dough as a token of offering to the female?
Cheeses! I thought that you loved each other! NO! It seems that you are her sugar-daddy now!
Of course I would present gifts to my girl, but I hope that she would not expect me to do so. After all, is she after love or my coin? I want to live in a equal relationship, where we see each other as equals who loves each other, not as a master/slave or provider/user relationship.
It might just be that I have a strange world-view, and that the ideal girl does not exist. Perhaps girl only like dough, and that one-night-stands is what girl rely looking for... What do I know? I am single, have not had a relationship with a girl for many years.
"It is just like inventing the wheel, it has already been done!" -- Someone...
So a few days ago I started thinking about GLib and GObject and wondered how easy -- or hard -- it would be to create my own base object system. So the first thing that every good hacker does when faced with such a question is to do it, from scratch, without looking at others code.
So after a few hours I had written my base object type with every function that
I would ever need. Than the next day I wrote the first object derived from this
base object. (Still not even compiled the code). On the third day I started writing
tests and ironed out some compile errors, and than I wrote more tests (this time with
the derived object type) and tested everything with valgrind and ironed
out every memory leak I could find.
Than, I decided to write a new type, a Map... This is where I found out that all the plane sailing that I have had took an abrupt end, and I was faced with a non-trivial problem:
How do I discern a object that is of the type system from an object that is not? I need to be be able to call the objects destructor if it is, and ordinary free () if it was not.
This lead me -- after some non-help from G+ -- to dig though GLib/GObject C code only to find out that the problem is non-trivial. In GLib/GObject it seems that they use a lookup table to find out if an object is or is not of the type GObject.
There is two ways I could do this:
The first way would be the hardest to implement, and probably course trouble if I were to use GObjects somewhere. But if I do it that way the user of the library would have less work to do.
If I do it the second way it would mean less work, but the end user would probably not be so pleased to have to specify the destruction method for each map. I may even have to have the user specify it for every item in the map.
If I go with Plan A (The Sane, but hard way) it also solves other inheritance related issues: How to know, in large object hierarchies, what object is what type.
The lookup table would contain pointers to every object that is registered with the system (at run-time), during the registration of the object the object must tell the system what types it is (what objects it has inherited from).
The look-up list would have to have two fields per item: a key (the pointer to the object) and a value that is a list of object-types that the object is.
Any way: for those that are interested in this (Super) Simple Type System it can be found on launchpad.
So, I have been trying out different stuff in Vala lately, one of which is the GObject to JSON stuff (more on that in an other post). Today I thought that I would show you some dirty, dirty, dirty things to do with Vala.
So the topic of today is -- as the heading suggests -- nested lambda functions (or closures, if you are so inclined).
using GLib;
using Gtk;
public class MyApp : Gtk.Application {
static int main (string args[]) {
MyApp app = new MyApp ();
return app.run ();
}
Gtk.Label label;
Gtk.Window window;
MyApp () {
Object(application_id: "testing.my.application", flags: ApplicationFlags.FLAGS_NONE);
}
protected override void activate () {
/* Creating a window */
window = new Gtk.ApplicationWindow (this);
this.build_menues ();
window.set_default_size (400,400);
this.label = new Gtk.Label ("Hello GTK!");
window.add (label);
window.title = "Hello GTK!";
window.show_all ();
}
private void build_menues () {
/* Creating the application menu */
GLib.Menu app_menu = new GLib.Menu ();
app_menu.append ("Message", "app.message");
app_menu.append ("About", "app.about");
app_menu.append ("Quit", "app.quit");
this.set_app_menu (app_menu);
GLib.SimpleAction quit_action = new GLib.SimpleAction ("quit", null);
quit_action.activate.connect (() => {
this.quit();
});
this.add_action (quit_action);
GLib.SimpleAction about_action = new GLib.SimpleAction ("about", null);
about_action.activate.connect (() => {
Gtk.AboutDialog dialog = new Gtk.AboutDialog();
dialog.set_destroy_with_parent (true);
dialog.set_transient_for(this.window);
dialog.set_modal (true);
dialog.response.connect((response_id) => {
if (response_id == Gtk.ResponseType.CANCEL ||
response_id == Gtk.ResponseType.DELETE_EVENT) {
//dialog.hide_on_delete ();
dialog.destroy ();
}
});
dialog.authors = {"Gustav Hartvigsson", "Some One Else"};
dialog.program_name = "Hello GTK!";
dialog.present();
});
this.add_action (about_action);
GLib.SimpleAction message_action = new GLib.SimpleAction ("message", null);
message_action.activate.connect (() => {
label.set_text ("I have been clicked!");
});
this.add_action (message_action);
}
}
If you look at the highlighted code (line 49-66) you will see nested lambda functions. This is awesome, and something you would expect from a modern, high abstraction level, object oriented language.
The C code that this produces (using valac-0.20 main.vala --pkg gtk+-3.0 --pkg gio-2.0 -C )
looks like this:
/* main.c generated by valac 0.20.1, the Vala compiler
* generated from main.vala, do not modify */
#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#define TYPE_MY_APP (my_app_get_type ())
#define MY_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MY_APP, MyApp))
#define MY_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MY_APP, MyAppClass))
#define IS_MY_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MY_APP))
#define IS_MY_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MY_APP))
#define MY_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MY_APP, MyAppClass))
typedef struct _MyApp MyApp;
typedef struct _MyAppClass MyAppClass;
typedef struct _MyAppPrivate MyAppPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block1Data Block1Data;
struct _MyApp {
GtkApplication parent_instance;
MyAppPrivate * priv;
};
struct _MyAppClass {
GtkApplicationClass parent_class;
};
struct _MyAppPrivate {
GtkLabel* label;
GtkWindow* window;
};
struct _Block1Data {
int _ref_count_;
MyApp * self;
GtkAboutDialog* dialog;
};
static gpointer my_app_parent_class = NULL;
GType my_app_get_type (void) G_GNUC_CONST;
#define MY_APP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MY_APP, MyAppPrivate))
enum {
MY_APP_DUMMY_PROPERTY
};
static gint my_app_main (const gchar* args, int args_length1);
static MyApp* my_app_new (void);
static MyApp* my_app_construct (GType object_type);
static void my_app_real_activate (GApplication* base);
static void my_app_build_menues (MyApp* self);
static void __lambda2_ (MyApp* self);
static void ___lambda2__g_simple_action_activate (GSimpleAction* _sender, GVariant* parameter, gpointer self);
static void __lambda3_ (MyApp* self);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static void __lambda4_ (Block1Data* _data1_, gint response_id);
static void ___lambda4__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self);
static void ___lambda3__g_simple_action_activate (GSimpleAction* _sender, GVariant* parameter, gpointer self);
static void __lambda5_ (MyApp* self);
static void ___lambda5__g_simple_action_activate (GSimpleAction* _sender, GVariant* parameter, gpointer self);
static void my_app_finalize (GObject* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint my_app_main (const gchar* args, int args_length1) {
gint result = 0;
MyApp* _tmp0_;
MyApp* app;
gint _tmp1_ = 0;
_tmp0_ = my_app_new ();
app = _tmp0_;
_tmp1_ = g_application_run ((GApplication*) app, 0, NULL);
result = _tmp1_;
_g_object_unref0 (app);
return result;
}
int main (int argc, char ** argv) {
g_type_init ();
return my_app_main (argv, argc);
}
static MyApp* my_app_construct (GType object_type) {
MyApp * self = NULL;
self = (MyApp*) g_object_new (object_type, "application-id", "testing.my.application", "flags", G_APPLICATION_FLAGS_NONE, NULL);
return self;
}
static MyApp* my_app_new (void) {
return my_app_construct (TYPE_MY_APP);
}
static void my_app_real_activate (GApplication* base) {
MyApp * self;
GtkApplicationWindow* _tmp0_;
GtkWindow* _tmp1_;
GtkLabel* _tmp2_;
GtkWindow* _tmp3_;
GtkLabel* _tmp4_;
GtkWindow* _tmp5_;
GtkWindow* _tmp6_;
self = (MyApp*) base;
_tmp0_ = (GtkApplicationWindow*) gtk_application_window_new ((GtkApplication*) self);
g_object_ref_sink (_tmp0_);
_g_object_unref0 (self->priv->window);
self->priv->window = (GtkWindow*) _tmp0_;
my_app_build_menues (self);
_tmp1_ = self->priv->window;
gtk_window_set_default_size (_tmp1_, 400, 400);
_tmp2_ = (GtkLabel*) gtk_label_new ("Hello GTK!");
g_object_ref_sink (_tmp2_);
_g_object_unref0 (self->priv->label);
self->priv->label = _tmp2_;
_tmp3_ = self->priv->window;
_tmp4_ = self->priv->label;
gtk_container_add ((GtkContainer*) _tmp3_, (GtkWidget*) _tmp4_);
_tmp5_ = self->priv->window;
gtk_window_set_title (_tmp5_, "Hello GTK!");
_tmp6_ = self->priv->window;
gtk_widget_show_all ((GtkWidget*) _tmp6_);
}
static void __lambda2_ (MyApp* self) {
g_application_quit ((GApplication*) self);
}
static void ___lambda2__g_simple_action_activate (GSimpleAction* _sender, GVariant* parameter, gpointer self) {
__lambda2_ (self);
}
static Block1Data* block1_data_ref (Block1Data* _data1_) {
g_atomic_int_inc (&_data1_->_ref_count_);
return _data1_;
}
static void block1_data_unref (void * _userdata_) {
Block1Data* _data1_;
_data1_ = (Block1Data*) _userdata_;
if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
MyApp * self;
self = _data1_->self;
_g_object_unref0 (_data1_->dialog);
_g_object_unref0 (self);
g_slice_free (Block1Data, _data1_);
}
}
static void __lambda4_ (Block1Data* _data1_, gint response_id) {
MyApp * self;
gboolean _tmp0_ = FALSE;
gint _tmp1_;
gboolean _tmp3_;
self = _data1_->self;
_tmp1_ = response_id;
if (_tmp1_ == ((gint) GTK_RESPONSE_CANCEL)) {
_tmp0_ = TRUE;
} else {
gint _tmp2_;
_tmp2_ = response_id;
_tmp0_ = _tmp2_ == ((gint) GTK_RESPONSE_DELETE_EVENT);
}
_tmp3_ = _tmp0_;
if (_tmp3_) {
gtk_widget_destroy ((GtkWidget*) _data1_->dialog);
}
}
static void ___lambda4__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self) {
__lambda4_ (self, response_id);
}
static void __lambda3_ (MyApp* self) {
Block1Data* _data1_;
GtkAboutDialog* _tmp0_;
GtkWindow* _tmp1_;
gchar* _tmp2_;
gchar* _tmp3_;
gchar** _tmp4_ = NULL;
gchar** _tmp5_;
gint _tmp5__length1;
_data1_ = g_slice_new0 (Block1Data);
_data1_->_ref_count_ = 1;
_data1_->self = g_object_ref (self);
_tmp0_ = (GtkAboutDialog*) gtk_about_dialog_new ();
g_object_ref_sink (_tmp0_);
_data1_->dialog = _tmp0_;
gtk_window_set_destroy_with_parent ((GtkWindow*) _data1_->dialog, TRUE);
_tmp1_ = self->priv->window;
gtk_window_set_transient_for ((GtkWindow*) _data1_->dialog, _tmp1_);
gtk_window_set_modal ((GtkWindow*) _data1_->dialog, TRUE);
g_signal_connect_data ((GtkDialog*) _data1_->dialog, "response", (GCallback) ___lambda4__gtk_dialog_response, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
_tmp2_ = g_strdup ("Gustav Hartvigsson");
_tmp3_ = g_strdup ("Some One Else");
_tmp4_ = g_new0 (gchar*, 2 + 1);
_tmp4_[0] = _tmp2_;
_tmp4_[1] = _tmp3_;
_tmp5_ = _tmp4_;
_tmp5__length1 = 2;
gtk_about_dialog_set_authors (_data1_->dialog, _tmp5_);
_tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_free), NULL);
gtk_about_dialog_set_program_name (_data1_->dialog, "Hello GTK!");
gtk_window_present ((GtkWindow*) _data1_->dialog);
block1_data_unref (_data1_);
_data1_ = NULL;
}
static void ___lambda3__g_simple_action_activate (GSimpleAction* _sender, GVariant* parameter, gpointer self) {
__lambda3_ (self);
}
static void __lambda5_ (MyApp* self) {
GtkLabel* _tmp0_;
_tmp0_ = self->priv->label;
gtk_label_set_text (_tmp0_, "I have been clicked!");
}
static void ___lambda5__g_simple_action_activate (GSimpleAction* _sender, GVariant* parameter, gpointer self) {
__lambda5_ (self);
}
static void my_app_build_menues (MyApp* self) {
GMenu* _tmp0_;
GMenu* app_menu;
GSimpleAction* _tmp1_;
GSimpleAction* quit_action;
GSimpleAction* _tmp2_;
GSimpleAction* about_action;
GSimpleAction* _tmp3_;
GSimpleAction* message_action;
g_return_if_fail (self != NULL);
_tmp0_ = g_menu_new ();
app_menu = _tmp0_;
g_menu_append (app_menu, "Message", "app.message");
g_menu_append (app_menu, "About", "app.about");
g_menu_append (app_menu, "Quit", "app.quit");
gtk_application_set_app_menu ((GtkApplication*) self, (GMenuModel*) app_menu);
_tmp1_ = g_simple_action_new ("quit", NULL);
quit_action = _tmp1_;
g_signal_connect_object (quit_action, "activate", (GCallback) ___lambda2__g_simple_action_activate, self, 0);
g_action_map_add_action ((GActionMap*) self, (GAction*) quit_action);
_tmp2_ = g_simple_action_new ("about", NULL);
about_action = _tmp2_;
g_signal_connect_object (about_action, "activate", (GCallback) ___lambda3__g_simple_action_activate, self, 0);
g_action_map_add_action ((GActionMap*) self, (GAction*) about_action);
_tmp3_ = g_simple_action_new ("message", NULL);
message_action = _tmp3_;
g_signal_connect_object (message_action, "activate", (GCallback) ___lambda5__g_simple_action_activate, self, 0);
g_action_map_add_action ((GActionMap*) self, (GAction*) message_action);
_g_object_unref0 (message_action);
_g_object_unref0 (about_action);
_g_object_unref0 (quit_action);
_g_object_unref0 (app_menu);
}
static void my_app_class_init (MyAppClass * klass) {
my_app_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (MyAppPrivate));
G_APPLICATION_CLASS (klass)->activate = my_app_real_activate;
G_OBJECT_CLASS (klass)->finalize = my_app_finalize;
}
static void my_app_instance_init (MyApp * self) {
self->priv = MY_APP_GET_PRIVATE (self);
}
static void my_app_finalize (GObject* obj) {
MyApp * self;
self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MY_APP, MyApp);
_g_object_unref0 (self->priv->label);
_g_object_unref0 (self->priv->window);
G_OBJECT_CLASS (my_app_parent_class)->finalize (obj);
}
GType my_app_get_type (void) {
static volatile gsize my_app_type_id__volatile = 0;
if (g_once_init_enter (&my_app_type_id__volatile)) {
static const GTypeInfo g_define_type_info = { sizeof (MyAppClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) my_app_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MyApp), 0, (GInstanceInitFunc) my_app_instance_init, NULL };
GType my_app_type_id;
my_app_type_id = g_type_register_static (GTK_TYPE_APPLICATION, "MyApp", &g_define_type_info, 0);
g_once_init_leave (&my_app_type_id__volatile, my_app_type_id);
}
return my_app_type_id__volatile;
}
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
if ((array != NULL) && (destroy_func != NULL)) {
int i;
for (i = 0; i < array_length; i = i + 1) {
if (((gpointer*) array)[i] != NULL) {
destroy_func (((gpointer*) array)[i]);
}
}
}
}
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
_vala_array_destroy (array, array_length, destroy_func);
g_free (array);
}
If we look at the function my_app_build_menues (line 245) you will see that
on line 264 the action is added to the self object (equivilant to this
in the vala code). The action adding just passes a function pointer to the function
___lambda3__g_simple_action_activate, and if we follow the path we will see that that function
on line 228 calls an other function on line 193.
In the function prior mentioned ( __lambda3 () ) we can see that on line 211 there is another
string-up to the function ___lambda4__gtk_dialog_response () on line 187 that runs the function
on line 166.
This is what nested lambdas in Vala look like. it is scary and beautiful at the same time. I have no idea if lambdas are slower than just creating a function and using them as parameters to the action/callback/delegates, I just wanted to show of some of the sexy and dirty internals of Vala.
"I Have a dark secret"
-- Someone
I have not been watching or listening to the news these last few days, I must admit. But I have been on G+ and watched others react: some were horrified some were concerned, not only for those that lost limb and life and the possibility of it happening again, but also of the apparent overreaction of the authorities.
This last point is where I will start.
What was strange with this bombing was that no one claimed responsibility when it happened, so it was not rely an act of terrorism in that sense. That made me think that this was a lone crazy person (or a few).
It turned out that this was the work of an Islamist, young and disillusioned. more on this from ThunderF00t: here .
Any way... If I were the bomber, and I was a lone, crazy person, I would have been trilled to see the reaction of the authorities. A few dead and hurt is one thing, but having the whole city turned into a war-zone like place would have made me exalted because I would have caused fear and a living hell for the people in the city. Not only that but the loss to the economy would be great too. I would have won.
That is the point: the bomber won and the authorities lost, big.
The fact that he was arrested is of little importance here, the bomber won.
The reason why bombs are so widely used by terrorists and other nutters is twofold: 1) confusion and 2) chock and awe.
The confusion caused by a bomb is a bit thrilling for the bomber, it makes it hard for authoresses to gather a comprehensive picture of what happened. And a clever bomber would have placed bombs in such a way that when paramedics arrive they are taken out causing more confusion.
Shock and Awe is something that is at the root of some acts of terror, it is the act of trying to make the target (be it a city, a state or a person) come around to your point of view. This is why Islamist terrorists are use bombs, they see it as a good way to chock (and awe) people into submission.
I think I should make it clear that I think that bombing people is an act of cowardice. I do not condone the killing of others, at all for the matter (well perhaps a few).
So, what is my dark secret? I can put myself in the shoes of a mad man with his mind set on destruction. The colour red for anger, green for envy and black for murder is all they can see.
That is my secret.
Also: The latest Doctor Who was awesome.
"There is always a better way"
-- Someone
Short story long: I was on Youtube to look if anyone had made any tutorials on Vala, I saw none so I decided to make a few.
That is fine and dandy, but I have a problem: no one comments with questions. So here I am asking who ever is reading this to give me a subject to work with, and if anyone wants to collaborate on a set of videos.
The play list so fas can be found here.
And as (not) always, Comments are welcome!
//Gego
Ps. MathJax still work? \[ A_{1} \cup A_{2} \cup A_{3} \cup \ldots \cup A_{n} \Leftrightarrow \displaystyle\bigcup_{i=1}^{n} A i \]
Here are a few of deadpool vala-projects that I think should have been saved and continued:
There are probobly some other projects that need to be revived, and if so past a comment bellow with the project name and what it was suppose to do.
On the subject of vala projects, I have been working on a reimplimentation of javas processing library in vala, I call my project vProcessing (vala Processing). It is written in vala and utilises SDL (Simple Direct Media Layer) for rendering, but my goal is to have the code as backend specific as possible, so it that at a later date there could be a change of backends if needed.
Well I need some help with vProcessing in that I have a general idea but no idea as to what the class structure should look or what is needed.
So today is the infamous Half Tau Day... and as is compulsatory on this day you have to see Vi Harts "Pi is still wrong" video.
It just truck me, that there are not that many people left in the world that can move us to tears over the beauty of nature, that can make us humble to the unimportance of the human species in the grand schema of thing. We are just an eye blink to the universe, not even that.
Carl Sagan has been dead for some time now, he died 1996 CE. Christopher Hitchens died 2011 12 15.
Those who do remain are old, they are, perhaps the last great philosophers of science, The last debaters of reason, the last to give science the place it deserves in popular media. This saddens me.
The rise of extremism and anti science policy around the world is frightening, it is in times like these when we need to stand on the barricades and speak... but what if no one is able to speak in a way that makes people think? -- This is why we NEED these people who can speak, who can move our non-existent soles to what this world is.
I would like the world to listen to the last philosophers of science, debaters and scientists of the era, to give it a thought and do what is right. Not to do what you are told by some desert scribblings.
There are new philosophers of this era, but they are drowning in a sea of the mass media, they drown in the noise of social media. They are drowning, we are drowning in stupidity of the religious.
One last thing: Be good for goodness sake, not out of ph34r.
Look what I found: it is Neil deGrasse Tyson on the subject:
I come from the word "shit" is not considers a swear word.
I was on IRC today, on #ubuntu-offtopic on Freenode to be precise, and I said "shit", Well guess what, some person was like "Watch your language". I am so pissed when people say that SHIT is a swear ward that I always blow a fuse. b/c "shitting" is some thing we do! And why the fuck should they care? "It is in the rules", well, Why? "cus it is..".... WHY?!?!? any normal human above the age of five knows this word! How the fuck are you "protecting"? There are no 4 year olds an fucking IRC! How could there be?
Gawd damn it, English world, You have to make my life so fucking hard. I mean come on, "Shit" is something that is so low on my list of swear words that it is not one.
"Fuck" is a swear word, "shit" is not. Get your facts straight fucking moralist.
Something thot may, or may not help my case:
More on "correctness":
I am so fucking sick of peopel saying "A is X times less then Y"...
If you want to say "Y is X times {more, bigger ,longer} then A" I woulh not have any complaints, but the "A is X times less then Y" has and will always bug me!
It is so extreme that I physically twitch when I hear it.
Now then, That was the last rant on this subject...
So, I have never been a liker of FaceBook, so I tryed this G+ thing... And I must say "I am not impressed".
G+ has a few flaws:
This has to do with the user freedom, and the non-vonrability of the system. Take for example StatusNet, When Identi.ca went down for 3 days, the rest of StatusNet did bearly notice it, exept that there were less posts in the stream, But there instance of it was up and running, and they could make posts to other nodes in the network.
User control of data is an other big thing, when it is Federated you can pull all your posts and push it to a diffrent provider that runs the same software, and you would not notice (much), all your subscriptiions are all ther, all your posts (but not your subscribers). And you would have Control over that data. Hey there is an application for pulling the ActivityStream from your Identi.ca... but back to topic...
And one of the things that make StatusNet better then G+ or any other site: Groups, This is not present on Twitter or G+. Not to talk about that there is no diffrent between Subscriptions and Friennds. And the name "Follow"? am I a facking stalker? No, I want to subscribe to a person, not "follow" them.
Awnser:
Well that is how I feel when I now go to youtube, there is no longer any debates or flame wars on youtube, this is like what I thought youtube was never going to be, large corporate channels and dumb entertainment.
I mean, I basicly now only go to youtube to watch the yogscast play MineCraft. Where are all the heroes of old? Where is edible napalm and the gang now? where is the debate? Has the trolls in us gone to sleep? Tell me.
I loved the old youtube, without all the crap, now the top and featured videos are not by Edward Current or CapnOAwesome (We miss you Kevin <3, and the world needs you).. no now music videos are at the top.
This is saddening to me, it was like when I thought that the Tribes Universe was dead, But now I see hope in Tribes: Ascend and Tribes Universe, but there is no Linux Client as it seems now. (back on track!).
I think that the debate started to die when CapnOAwesome left[1]. The steam went out of the balloon so to say. When two peopel on the same side start to fight, it became uncomfortable.
Then youtube made a redesign, making small channels hard to see, and that is concreted though newer versions of youtube.
So for the love of all that is good, Google fix youtube, have a now system where small channels get pushed to the top in a "new channel" section or have a "Debated videos" section.
Just sayin.
And to round of this post, here is ThunderF00ts take on this: