Feeds:
Posts
Comments

My transition from a GNOME user to a developer has been in progress for two months now. I’m enjoying the challenges, but one constant annoyance has been bothering me along my journey:

The transition from user to developer seems to assume that in between I have had time to hack Linux for 10 years.

Well, I had a total of 0 days for that. I have grown up with the pleasure of not needing to know all the mysterious commands in terminal to get my Ubuntu running. Yes, I have memorized a couple of handy ones (killall -9 the programs!) but as a whole I’m a GUI-girl. I love to make small apps for myself to use, I like coding, but still without the OPW I would have given up already. For me the stumbling block is that the leap from user to developer is huge!

The thing that prompted this post was the setup for JHBuild. I felt uncertain and there were many things I wouldn’t have dared to do without the help of a friend. My dream would be to able to concentrate to the main thing itself with necessary information available without the presumption of being a hardcore Linux hacker.

There is need for both kinds of documentation: for those who are familiar with every nook and cranny of GNOME and Linux, and for those who have just had the great idea that they could have something to give to this community. I’m working towards my dream of having the latter, and I hope my documentation efforts will make this path easier for the enthusiastic hackers that come after me!

See you soon in Brno!

Working with small JavaScript apps for GNOME3 has led me to a wild exploration around internet, the quest for knowledge. The quest led me to trying to figure out two things – how to use different files from the same folder in your JavaScript app, and how to make asynchronous HTTP requests. I can tell the quest was a tricky one but now I can present you (queue dramatic music) my findings:

The first problem was brought up by wanting to separate asychronous calls to a different file. How can I reference the other file in my gjs code? The solution ended up being very simple. Just replace the normal gjs yourapp.js with this:
$ GJS_PATH=`pwd` gjs yourapp.js

in terminal in the folder your files are. Then the file can be included simply with:
const SomeClass = imports.myotherfile;

Where SomeClass is the variable that will hold any functions exported by the other file (by having those functions defined into the global namespace there), and myotherfile.js would be the name of the file.

You can see what keys are available through imports by running this JavaScript code through gjs:

for (i in imports) {
  print(i);
}

If you want to distribute your files in different folders the GJS_PATH environment variable must contain the correct path.

As we see, pretty easy but hard to come by amongst all the information of internet. Maybe one more post about it will ease the search for the next person trying to figure this out :)

Then we get onwards with our asynchronous calls. HTTP get, using async libsoup. Yet again a simple thing but hard to find.

first you need to import Soup to your code:

const Soup = imports.gi.Soup;

then prepare one asynchronous soup session

const _httpSession = new Soup.SessionAsync();
Soup.Session.prototype.add_feature.call(_httpSession, new Soup.ProxyResolverDefault());

then you decide what you want to get and where. Here I’m getting weather information for Helsinki Malmi airport (ICAO: EFHF) using the GeoNames web service:

function getWeather(callback) {
  var request = Soup.Message.new('GET',
   'http://api.geonames.org/weatherIcaoJSON?ICAO=EFHF&username=demo');

Once you’ve prepared a request Soup message, you need to queue it, and provide a callback that will fire once the request has been handled.

It is good manners to handle both successful and failed requests. And when the information is in your hands, it is a good idea to parse it to proper JavaScript data structures:


    _httpSession.queue_message(request, function(_httpSession, message) {
      if (message.status_code !== 200) {
        callback(message.status_code, null);
        return;
      }
      var weatherJSON = request.response_body.data;
      var weather = JSON.parse(weatherJSON);
      callback(null, weather);
}

A successful response looks like this:

{
    "weatherObservation": {
        "clouds": "few clouds",
        "weatherCondition": "light snow",
        "observation": "EFHF 101150Z 14002KT 9999 -SN FEW040 BKN050 BKN070 M05/M06 Q1016",
        "windDirection": 140,
        "ICAO": "EFHF",
        "elevation": 28,
        "countryCode": "FI",
        "lng": 25.05,
        "temperature": "-5",
        "dewPoint": "-6",
        "windSpeed": "02",
        "humidity": 92,
        "stationName": "Helsinki-Malmi",
        "datetime": "2012-01-10 11:50:00",
        "lat": 60.25,
        "hectoPascAltimeter": 1016
    }
}

And then it is just the question of how to use the information.

This post has been updated according to Owen’s suggestions in the comments below.

My first reaction to the new GNOME 3.2 was that I hate it! Resistance to anything new lives strong in me, apparently. Then the realization kicked in: I can make it work exactly like I want. Modifying the JavaScript-powered GNOME Shell is as easy as hacking a web page.

And here came the extensions, and then the modified versions of existing extensions!

All of a sudden, after an hour of first whining and then hacking, GNOME 3.2 feels like home and I’m actually liking this ease of modifying my desktop to my preferences. This desktop is mine and I could have pink flying ponies in it if I wanted to. Brilliant!

To get all things going you just need a few easy steps.

  1. Load and install an extension from https://extensions.gnome.org
  2. Fork the extension project that you want to modify from git or wherever
  3. Make it your own
  4. Save your progress
  5. Run $ cp -r file_where_your_extension_is ~/.local/share/gnome-shell/extensions/ on terminal
  6. Reload your desktop with Alt-F2 and to the prompt r. If Alt-F2 doesn’t launch the prompt, fix it with this.
  7. After few iterations enjoy your own modifications to your desktop!

The looking glass debugger is a useful additional tool that can also be launched from command prompt. So, Alt-F2 yet again and then just type lg.

And there you have your tools to hack your browser-like desktop an inspector and a reloader. Happy hacking, everyone!

GNOME and JavaScript

The plans for the JavaScripter’s guide to GNOME 3.  (or the cookbook as I call my project now) are advancing.  The initial roadmap was layed this morning with Cosimo Cecci. Looks like I shall first dive into GNOME, explore the platform, read a lot of code and try to identify some patterns which are more common or important than others. Based on my views I will make a draft of what should be included in the cookbook.

On Tuesday I participated in Helsinki’s first JSmeetup. The thing that suprised me a lot was the fact that nearly no one knew of the possibility to write programs for GNOME with JavaScript. I promised to give a small presentation about the subject in February when my cookbook is looking a bit better.  Making all the different possibilities known to developers out there is an important task we have to deal with.

First week on work is finally happening and I’m happy to work with this project. Taking a plunge to GNOME with a wide smile on my face!

Shots towards GNOME 3.

New and exiting adventures ahead. I got GNOME Outreach Program for Women internship. I’ll be making a “JavaScripter’s Guide to GNOME” starting on December 12. The idea behind the guide is to enable web developers to utilize their skills in GNOME 3. development. I would explain how to structure an app, how to create windows, add content and functionality to them, and how to connect with various services of the platform, and build the necessary project templates to support it.

I believe that with the help of my mentors Cosimo Cecchi and Johannes Schmid I’ll be able to make a guide that will truly ease the way towards GNOME 3.  And as a bonus I’ll have a chance to get to know a new community and make some new friends.

Hello Android

And all of a sudden after Friday my Uni project with Java is much more meaningful: porting my last summer’s GSoC project The Tablet of Adventure to Android. Here is how it looks now:

What works:

  • Getting (and following) user’s location
  • Calculating the day’s geohash for the location
  • Displaying the geohash and user’s location on the map

What is still missing:

  • Social features

You can follow the progress on GitHub.

I have to say testing location based games is more fun in the summer time :)

Sleepless, browsing through the internet. Noticing that someone in  Singapore is on their way home. Joining the adventure just for the fun of it, not moving out from my bedroom :) Wishing the adventurer nice journey to destination.

Whoa. I’m going to Dublin to MeeGo Conference!

This will be my first conference ever. I’m not quite sure what to expect.  One thing is sure. There will be a getaway quest for MeeGons using Tablet of Adventure. When or where, i haven’t decided yet, but there will be one, probably targeting beer :)

A complete Adventure.

That’s it. I claim my GSoC10 project finished.

And what did I actually do? I coded like a mad person at times, slept much too little, found myself in odd places, took some time off and did nothing related to my project, swam in the sea of despair, learned a lot and had fun.

The application is not in all parts what I planned it to be and in some parts it’s more than I expected. Now the version 1.0 is in extras-testing. It would be nice to hear some testing reports, the bug tracker can be found in GitHub . Hopefully soon enough I’ll have the opportunity to just lay back and watch people going on their adventures. A short introduction to the application can be found in the tab the Tablet of Adventure.

Although the GsoC10 project is finished, the work with the Tablet of Adventure is not. I have couple of ideas of how I could make my software more versatile. And then there will be the versions. First an Ubuntu desktop version, so you can watch where your friends are going. And if I get to an agreement with my University I’ll make my software run on Android too. And so on. This was only the beginning.

artwork by Nina Mutik (nina.mutik (a) gmail.com)

no play?

What was I thinking,  all work and no play? It’s a game, it’s fun!

And now some testing. My destination is a nearby beach :D

Older Posts »

Follow

Get every new post delivered to your Inbox.