Hari's Corner

Humour, comics, tech, law, software, reviews, essays, articles and HOWTOs intermingled with random philosophy now and then

Go - how to use glade files as resources

Filed under: Tutorials and HOWTOs by Hari
Posted on Wed, Oct 24, 2018 at 22:40 IST (last updated: Wed, Oct 24, 2018 @ 22:57 IST)

Of late I've been learning the Go programming and I am building a small Resume builder using it. I decided to use GTK for the project and used Glade to design the interface. However, if you want to "cook" the .glade file into the project as a resource and not keep it as a separate file, here are the steps to be followed. It's not blindingly obvious, but reasonably straightforward.

Though there are a number of ways to get static resources into a Go project, I chose go-bindata.

Here are the steps:

Enjoy! Here's the code snippet which shows how to load from resource (where the original resource file is resumebuilder.glade inside the resources folder). This approach can be used for any other kind of resource as well.

    ui, err := gtk.BuilderNew()
    if err !=nil {
        fmt.Println(err.Error())
        os.Exit(1)
    }
    asset, err2 := Asset("resources/resumebuilder.glade")
    if err2 !=nil {
        fmt.Println(err2.Error())
        os.Exit(1)
    }
    ui.AddFromString(string(asset))
 
Comments (0)  

Musings on learning a language

Filed under: Life and Leisure by Hari
Posted on Wed, Aug 22, 2018 at 21:49 IST (last updated: Wed, Aug 22, 2018 @ 21:49 IST)

Grammar and vocabulary are fundamental to learning any language. Recently I have made good progress in learning Hindi, through this excellent book. I don't believe in the popular notion that you can simply learn a language by following television dramas or movies in that language. It's all about context, and simply hearing is not equivalent to listening and understanding.

But I also think that learning a language becomes progressively more difficult as you age, since you need to internalize a lot of stuff that otherwise comes naturally during childhood. Luckily I had some basic grounding in Hindi since my school days, so that process was easier. Also having a solid footing in two languages since childhood makes learning a third language much easier, since you have internalized two different sets of grammar and vocabulary already.  In my case, Tamil grammar rules are closer to their Hindi equivalents which makes my learning smoother. I think learning Hindi through English alone is tougher than through another Indian language.

Now I plan to follow the lessons in this book to solidify my knowledge and eventually become adept at everyday conversation and also reading/writing.

Finally, इसे पढने के लिए बहुत धन्यवाद!

Comments (0)  

Caricature of a colleague - 5

Filed under: Artwork/Portraits/Caricatures by Hari
Posted on Tue, May 29, 2018 at 22:11 IST (last updated: Tue, May 29, 2018 @ 22:11 IST)

Caricature of another colleague. Painted in Krita with my XP-Pen Artist 10s tablet.

Caricature of a colleague 5

Comments (0)  

I hardly watch TV these days

Filed under: Life and Leisure by Hari
Posted on Tue, Mar 20, 2018 at 21:26 IST (last updated: Tue, Mar 20, 2018 @ 21:54 IST)

I realized that my TV viewing time has drastically reduced these last four years or so. I've not kept track but I suspect that my average viewing time has come down to a couple of hours a week and that, mostly on weekends. Though I was never a big TV viewer in any case, this change in habit has been subtle but noticeable.

I used to watch News channels quite a bit especially back in 2008-09 when the 2G scam hit the headlines in a big way and redefined the manner of reporting on mega scams, but now it's come down drastically since I find all the shouting and slanging matches quite tiresome and increasingly boring. I hardly watch any live cricket matches these days due to paucity of time and also the fact that I'm at work on weekdays and otherwise busy on weekends with personal work. I've stopped watching TV serials/soaps too - for reasons too numerous to quote here, but covered in another article. It's another matter that the quality of TV programming has drastically reduced these days, with drab, uncreative reality shows taking prime time slots. I never developed any taste or interest for reality shows and I am glad I didn't bother to. I find that I no longer have the patience to watch movies on TV, since the ad breaks become increasingly annoying and disturbing the flow of the movie. Rarely on weekends I view a movie or two on Hotstar, on the mobile. I watch Cricket highlights only when India is involved, but my overall interest in cricket has come down quite a lot these days.

My next target is to cut down time spent on social media (not that I post much, but I sometimes inadvertently end up browsing a heck of a lot on my Facebook phone app, viewing baby and cat videos, memes and other random funnies, sometimes for hours on end). It is simply mind-numbingly unproductive; a waste of time. Luckily I have BSNL as my service provider, which means that the data speeds are abysmal for watching videos (and I have a limited data plan anyway) and so I watch videos only when at home with the WiFi connection. Just to avoid spending too much time on social media, I don't plan to get a 4G connection with high internet speeds on my phone.

I suspect that these days, social media addiction has replaced TV addiction for a lot of people, and not much has really changed in terms of the actual passive content consumption. I'm hoping to break even my relatively limited addiction to social media and slowly phase it out completely.

Comments (2)  

Caricature of Rahul Shivshankar

Filed under: Artwork/Portraits/Caricatures by Hari
Posted on Sun, Mar 11, 2018 at 21:55 IST (last updated: Thu, Mar 15, 2018 @ 21:52 IST)

Caricature of Rahul Shivshankar, news anchor and editor. Krita with my XP-Pen Artist 10S.

Rahul Shivshankar

Comments (0)  

Portrait of a colleague

Filed under: Artwork/Portraits/Caricatures by Hari
Posted on Mon, Feb 12, 2018 at 15:13 IST (last updated: Mon, Feb 12, 2018 @ 15:13 IST)

Another portrait of a colleague. Painted using Krita with my XP-Pen Artist 10S tablet.

Colleague

Comments (0)