ownCloud and News application for FirefoxOS

Its really been a while. I huge while! 🙂 Almost a year man.

The news are I got full time job working as a Linux sys admin and in RND. Also, my master thesis is still waiting to be finished. I can’t stress out how much full time job takes up your energy and will to do anything similar off job. Almost none. That is why I took some time saving it for time that has come and now I’m hopefully going to finish it until next year 😀 lol.

Anyway, I just wanted to say that I have been involved in open source project (YEY), which was my goal in early geek days 😛 Main project is called ownCloud and is a cloud platform for commercial and private use. One part of it is News application, which is like a RSS aggregator. This year Google Summer Of Code accepted some ownCloud ideas, which included making News application for mobile platforms, specifically for Firefox OS. Technologies involved are JavaScript framework AngularJS for developing frontend (which will basically be a application in FF OS), JSON as a form of communication stream between FF application and ownCloud News API, which is RESTful btw. Technologies involved below the frontend, are node.js for testing frameworks, test runners, task runners and package maintainers (Jasmine, Karma, Grunt, Bowl).

This is my github profile, so you can check the development phase and get involved… maybe? 🙂


Have a nice day, and take care! Bye!

Imgur album image downloader pt.2

Hello dear reader 🙂

I was bothered by the way I wrote script for imgur downloader, cuz there are more sophisticated ways to do it. That is why I decided to use more Python system function, which made the script more readable, and customizable. This script uses urllib, urllib2, urlparse libraries for work with image and page URLs.

The thing I added to the previous version is fullscreen option, and directory where to download album.

Anyone interested can ask for source, and I’ll be glad to share it.


Imgur album image downloader

Hey hey, here I am with a new cool thing. It is imgur album downloader.

Now, I know there are some imgur album downloaders, but I could not run the Windows version, and I did not bother with any other. I have decided to write my own imgur album downloader. There are some constraints, which are:

  • it works in only two conditions (if you specify album link, containing /a/ in link, or link to group of albums, with imgur.com within link),
  • there is only one page of albums thumbnails (maybe imgur displays all albums thumbnails on one page, I’m not sure),
  • you have to make dir, enter the dir in console and run the script in it (then script makes dirs with albums names, and puts pictures in those dirs).

Regardless of constraints, script can be easily changed to support various links, and parsing techniques. I encourage everybody who is interested in having a nice imgur album downloader, to try and change it, so we can all benefit from it. Here is the Python 2.7 script. Sorry for no comments in code, I did it quickly, and I think that functions names are very intuitive, if that is of any help 🙂

Things that could be done:

  • implement string matching through regex
  • add support for galleries,
  • add support for multiple pages,
  • add nitty GUI (gtk or maybe PyQt).

Cheerz. Bye!

Holidays are gone, tiredness not

It’s been a while, since last post…

A lot of work through holidays, if I could call it that way. Holidays for people around me, and for me, it was like a extended school period.

Anyway, I’ve been doing some rather neat things regarding my point of interest. Since I’m about to finish master studies at my faculty, or I hope I will asap, I’ve been wasting my time on couple of last exams. To make it short, there was a subject called Internet Programming, about JAVA web technologies, and for the project I did something I firstly doubled I could.

Main goal was to connect my idea of programming XMPP client, with GlassFish application server. It was very frustrating experience, since there is no systematic documentation about various Java technologies online. So, I had to use forums, and strongly rely on my intuition about some things. I have used GlassFish 3.1.2 server, with NetBeans 7.2 IDE and Jabberwocky framework for implementing XMPP components. It took me about two weeks to make it work, since CDI has been bugging me for a week. Like I said, documentation was very poor, and community very small. I’d like to thank to a man/team developing this framework, since they tried to help me. In the end, I did full install on virtual machine with java 7 jdk packages, and it worked without any problems. For developing console based client, I have used Smack Java library, and developing the client was a peace of cake, in comparing to the Jabberwocky component. But, it worked splendid at project presentation. Not to mention that professor did not even look at the code 🙂

Thing I’ve been working for a couple of days now is Python/PyGame simulation for another subject, which exam I’m going to take tomorrow. Simulation is about satellite/space ship orbiting a planet. Since that subject lectures finished in January, I did first satisfying version in February, but it had some peculiar errors in calculations (numerical), so I’ve abandoned it for some time. This is the video of it:

The second version, which I completed couple of days ago, had those errors fixed, but I did remove all eye cookie, just for the sake of debugging speed. This is the second version:

As you can see, there are no fancy panels, but having fixed all the errors, I’ve “repaired all system panels, and restore it to it full capacity” 🙂 and added some eye cookie, like velocity vector, gravitational force vector and radius vector. I hope it is finished, for good 🙂 Here is the final version:

Since this is based on numeric calculations, there is some calculation error, based on how short time period is. In this case, time period is 10^-2. To make things more serious, I’ve made some tests, without graphic interface and exported them and draw some charts in PyPlot. In, lets say, first 300 steps of iteration, error is slight, and you can see even on graphic representation. If you make 1000 iterations, and take 300 steps at the end, you can see how numeric orbit is changed through time, in comparing to a orbit which is drawn regarding analytic formula. Here is the chart for 300 steps, form 699th until 999th.

Blue line is orbit drawn by coordinates based on iterative process. Green one is based on 100% correct coordinates based on analytic formula of ellipse. Reducing time period to 10^-4, errors are slight even for 20 000 iteration steps. Of course, you have to find balance between wanted precision and time needed to finish calculations.

This is what I’ve been doing lately. Maybe its interesting?

Computer simulation in pygame

Today, we are going to … I’m going to talk about … I’m going to present you a computer simulation. It’s not just any simulation, it is a simulation of body acceleration in gravitational field. Wow, physics! Yes! 😎

In particular, it simulates how space shuttle should be accelerating near planet, and use it’s gravitational field to accelerate. I’m not a physician, so I won’t talk about physics theory, but it is good to know something about Newton’s three laws, Newton’s gravitation law (or formula of gravity),  Kepler’s laws, and conservation of energy. Ok, the last would be nice to know for analytic solution of body’s trajectory in gravitational field of a planet. Unless you are physician, or mathematician, you should use numerical solution for solving simulation problems, because it can be good enough 🙂 Enough, it you do your best do reduce error. In this simulation, that could be done reducing time step for numerical formula. Since reducing time step would shorten the path that object traverses, animation would be veeeery slow. I guess I could overcome this problem, but it is very appealing right now, or  appealing enough 🙂

The simulation lets you set body’s initial coordinates and initial velocity, when dragging mouse. When you release the left mouse button, body starts to move, by numerical formula, and you get yourself an animation 🙂 Real eye cookie 😎 You can turn on statistics monitor, and also a body’s velocity vector in it’s little coordinate system in down right place of the simulation. You can also change planets. All 9. You can say, well Pluto is no longer a planet. Ok, that’s true, but I have found a png images of a planets and Pluto’s was there, so I added it in 🙂 Yey, my simulation has 9 planets! Anyway, simulation has configuration file, where you can change masses of planets, since my masses are not very realistic, not even for comparing between two planets in solar system.

Software used for this simulation is Python 2.7 and PyGame library.

You can download it here.


Using python and pygame

Have you ever heard about Jaql and Jackal Queenston? Very nice electronic music 🙂 Here’s one:

Anyway, now that you are listening and maybe enjoying, we can continue. Reason why I have started to make game in python using pygame module is because some homework. More precisely, I gave a introductory lecture on pygame module at one of my faculty subjects. It is about computer simulations. Final goal, is, I guess, to make some nice computer simulation using python with numpy module. Of course making it visually attractive by drawing it with pygame module. Viewing from the physics point of view, I think the simplest and attractive is simulation of a trajectory of a projectile. That is what I took and made this pocket tanks clone in python/pygame. I won’t go in physics about calculating positions of a projectile, you can read about it on http://en.wikipedia.org/wiki/Trajectory_of_a_projectile. The thing I’m about to speak, is how to make functional, or fairly functional game by your hands.

Now, lets get techy 😎

You will have to make sprites using pygame.sprite module. Sprites have update method and be added in sprites group, but we won’t do that, because it is not necessary. Simple sprite will be just fine.

Events. Pygame has a couple of ways to give you access to events. One way is through pygame.events.get() which returns a list of events. If you put that in a for in loop, you can access one and each event, and scan for mouse button down, key down etc. Of course, scanning for events has to be in engine loop, which can be simulated with a while true loop. Now, making a really simple graphics will do just fine with all introductory python/pygame tutorials. Initializing pygame module, setting up screen size, objects (sprites), while true loop for events scanning and making all visible. But, if your game needs something like modes, where you will be drawing different things according to the current mode, you will either put all that in while loop and make it very, very bad looking, or you can divide modes (scenarios) in methods. I did the second. Game has start, play and pause mode.

Start mode draws welcome text and there is not much in it.

Play mode is where you get all the fun. Drawing stats, rotating cannons, cannonball and terrain line, and above all scanning for events. Yep, the Q is now, how did I scan events, right? Or maybe not… 😐 But I’ll tell you anyway. I did scanning in while true loop and then call method for play mode with events list as it argument. Something like this:

while True:

events = pygame.events.get()
if mode == ‘play’:

I did try to make for in loop for event scanning in the each of mode functions, but it kind of bugged. Really bugged and very unstable. So I did as I showed you.

This may not be the smartest way, though, because some events can be lost while interpreting all that code in play_mode function, for example. Luck with this game is that it is not very intense in user input and this way of event scanning is doing the job. I guess some user input intense game, like collaborative shooting for 2 player will really need better way of getting all input events.

As I said, it is manageable to do it by your bare hands, but I did use some already programmed functions for collisions for example. There is one fine written class for animated sprite, which I used for all sprites, cannon and cannonball.

The links are:

I think you’ll find them very helpful, if you are new to pygame.

That’s it, I wish you to enjoy making games in python/pygame 🙂 Bye!

Ganglia HDD plugin

Hey hey,

Like I said, it was lot going on. One of things was my first ganglia plugin. Let’s cut to the meat! 🙂

Plugin is developed for Debian like and Red Hat like systems (deb and rpm package). It is for personal use on grid cluster. Private in sense I did not write all documentation for packages, like for example man pages.

How I did this? I have used gmetric ganglia set tool, for making my custom metrics. Main tool is of course binary made by HD Sentinel, for listing hard disk info, like temperature, health, hours of work etc. Part of the package is script that is extracting basic data from HD Sentinel output and sending it to gmetad by gmetric script. To be precise, I used extended gmetric script written in Python. Reason was I needed grouping option, which default gmetric tool doesn’t have. GmetricP (P from Python) does grouping and sends it to gmetad daemon on main node with ganglia web page, displaying it under custom metrics.

Ganglia HDD Plugin

This is not very clean and pretty way of doing it, but it does the job. Better way would be to write ganglia plugin in Python, like described in ganglia documentation.