Posts

Showing posts from 2016

How to fix the Unbound module Graphics in an ocaml project

Image
From ~/pr/gitl/ocaml-gol In a constant effort to learn new programming languages, I'm currently trying to use ocaml , a free and open-source general-purpose, multi-paradigm programming language maintained at the Inria . It's basically an extension of Caml with object-oriented features. I'm mostly interested by its functionnal and pattern matching features but the module part of the language can be a bit difficult to understand for someone with little to none ML (Meta Language) background.   The error When trying to use the graphics module to create a graphical window and go just a little further than the simplest helloworld program, here is the result : If the project uses dune : (executable (name ocaml_project) (libraries lwt.unix graphics) ) with this code : let () = Printf.printf "Hello, world!\n";; Lwt_io.printf "Hello, world!\n";; Graphics.open_graph " 800x600";; The first times I built this project running the du

How to make a map of variant in C++

Image
This code is used by RainbruRPG to store any scalar types in a single class instance. It's already in use since  revision 254  to save game states values when switching fullscreen or changing screen resolution. The map class It's basically a map of boost::variant using std::string as map key. I decided to use function template setter and getter to have a standardized exception-based error handling, but you could have multiple parameter-based specialized getter/setter ( void set(bool) , void set(int) ...).

RainbruRPG switched to revision 254

Image
RainbruRPG v0.0.5-253 is over, a client-only work. Since the last release announcement , two revisions later, many client improvements have been implemented : We added a FPS-related statistics geometry buffer to the MainMenu ; The Alt+Enter key binding adds a real time full screen switch feature; You can take a .png screenshot using the F11 key. Original Nov. 2016 news All these improvements are possible thanks to the game state handling of the client. You can download this release at github . Next release will focus on new client improvements and a better Ogre3D reconfiguration mechanism. This will let us handle new keybindings for real time resolution change and maybe start to implement the Options game state. Sep. 2022 update As I already announced in others updated news about this project, it is not hosted at github anymore but in bitbucket instead. Here is its new homepage . As a direct result, all links from this news are now dead. I only keep it for his

List items conversion to string in python

Image
My last post about string handling was written in ruby. This time it's a one-liner I use for a private python-powered project. It is inspired by two StackOverflow answers :  how to convert all items in a list to floats and how to change any data type into a string in python . If you mix the two answers, the result code is [str(i) for i in <list name>] . Now let's see how to use in an interactive shell and in a PyQt4 example.

How RainbruRPG will handle game states

Image
This design-related post will try to explain how we're implementing RainbruRPG 's game states. As stated in the  last announcement , we now have to handle multiple states : main menu and local test . The game states will allow us to have multiple screens, one at a time.

RainbruRPG switched to revision 252

Image
RainbruRPG officially switched to revision 252, closing and releasing the revision 251. This post follows the revision 251 announcement . RainbruRPG is a GPLv3-licensed free and open suruce 3D MMORPG project mainly written in C++. The announcement With this new revision, we added a (ugly) logo, a version overlay and started to implement a Not Yet Implemented dialog. This version also fixes several client segfaults. The next revision will have to fully handle the NyiDialog (based on the brand new CeguiDialog  class) and maybe start to implement local test , a way to test the game without an external server. You can download this release here . Dead links update As of 2022, this project is no more hosted at github. Tags are lost and the development is not halted but very slow as I'm currently on another projects. The full repo is now hosted at bitbucket and can be found here . RainbruRPG , as its sub-projects and reimplementation, is licensed under GPLv3 so you ca

How to generate a pkg-config file with cmake

Image
pkg-config is a great way to get compiler flags for a given library. Since I'm currently implementing the rainbrurpg's meta as a library (see  libwsmeta's annoucement  and repository ) I would like to generate a pkg-config file using cmake .

Introducing libwsmeta

Image
I would like to speak about a new project :  libwsmeta , a C metaserver library intended to be used for several projects including rainbrurpg and rainbrurph . This library will have to search for a server list. I've designed it to be included in cmake -based project. The design The library will use a   peer to peer  approach to find and propagate new game servers. The server download the entry-point and contact it. The entry-point is the main server(s) of the game. Its IP:port pair is publicly available from a public URL; The server directly contact the entry-point server and add itself to the server list before it returns the new list; It will then contact next server in the list with the same effects. Using libwsmeta as a git submodule As a developper If you want to add this library in the ext/ directory : mkdir ext cd ext git submodule add https://github.com/rainbru/libwsmeta and add this line to the top-level CMakeFiles.txt include("${PROJECT_SOURCE_D

RainbruRPG switched to revision 251

Image
RainbruRPG's revision 250  is over and the CEGUI  part of the client is back. The main change in this revision is a dependency upgrade : the client now depends on CEGUI 0.8, not 0.7. That's a major dependency upgrade and unfortunately this version isn't available as official Debian package, so you have to manually build it. CEGUI (Crazy Eddie's GUI) is a fully themable free and open source graphical user interface ( GUI ) library written in C++ licensed under GNU LGPL . It is used to draw the client's GUI using its Ogre3D backend. On arch-based distributions, CEGUI can be found in the AUR and the package itself is the definition of dependency hell. For more informations on how to install packages from AUR , see the official documentation . The next revision will have to handle GUI events from layout files and fix some segfaults, especially due to the OGRE  configuration. You can download this release here . 2022 update RainbruRPG is no longer h

Using a JQuery datepicker in meteorjs

Image
Today's work on mrt-manager was to add a JQuery datepicker widget to the news addition modal dialog.

Introducting the todoSummarizer's help viewer

Image
Today's commit was about a help viewer for todoSummarizer . All this code resides in the  lib/MainWindow.rb Since this project uses GTK , I decided to use an external help viewer : yelp . The project already have a texinfo manual, so it's all about generating HTML from info and pass the corrcet URI to yelp. Generating HTML manual To generate HTML from an info file you only need to run the following command : makeinfo --html todoSummarizer.texinfo It will create a new directory containing some HTML files. Calling yelp from ruby I also have some issues with Dir.pwd() so I didn't use it. Instead I used the __dir__ ruby function. Appart for the error checking code, calling yelp from ruby is only three lines away : yelp = find_executable("yelp") uri = "file://#{dir.to_path}/../doc/todoSummarizer/index.html" Thread.new { cmd = system("#{yelp} #{uri}") } Result You now have a great manual/help viewer for your GTK-based GUI appl

How to make a clickable label in Gtk2/ruby

Image
Sometimes, you need a Gtk label, styled like a web link that opens an URL when you click. I need this widget for the  todo-summarizer  Gtk2 GUI and I don't like the look and feel of the Gtk LinkButton widget. So, I wrote a custom ClickableLabel widget that handle the URL, opens your system's default web browser, shows the destination URL either in a tooltip or a status label and change the mouse cursor change when you hover it.

RainbruRPG switched to revision 250

Image
The rainbrurpg's revision 249 is over and the building part of the transition to cmake is done. Original news During this revision, all sources moved to a single top-level src/ directory. The build process is now cmake -powered and after configuration, building only takes a 'make'. Next revision will also be focused on the switch to git / cmake . For example, the translation files aren't correctly handled at this time (the msgmerge step is missing) and the continuous integration builds are still failing on clang compiler. We also have to build unit tests using  cmake. You can download this release here . 2022 Update As said in other news, RainbruRPG is not hosted at github anymore. The new repository can be found here . Even if the last commit is a bit old, the project receives regular updates and it should correctly build on any modern linux-based systems.

How to use sdl2 on travis-ci

Image
If you're using Continuous Integration to improve your code quality, maybe you're using  travis-ci.org  to test each commit and report errors. To build  rainbrurph , I need SDL2 libraries and headers, unfortunately, the build fail with the following error message : E: Unable to locate package libsd2-dev

How to search for the readline library with cmake

Image
I'm currently using GNU readline for a RainbruRPG's server tool . Unfortunately, this library isn't shipped with a pkg-config file. We have to create our own cmake file.  

How to remove the first character of a ruby string

Image
Recently, I had to remove the first character of string in a private nanoc -powered project.    I easily found a quick and elegant way to achieve this and according to this stackoverflow answer  it seems the fastest. path="_theString" path[1..-1] # => "theString" And to complete this post, if you plan to use this often and you want to remove one or more leading letters, you may want to override the String class to remove the first n characters : class String def removeFirstChars!(how_many = 1) self.replace self[how_many..-1] end end And you can use it on every String variable : str="Aze" str.removeFirstChars! # => ze # or str.removeFirstChars! 2 # => e The stackoverflow answer also gives the code and benchmark results to achieve this with an Array In this initial post, the function is called eat and it shows several other useful utility functions.

RainbruRPG's client is now in src/

Image
Like in this previous post , today's commit  #826  is also on source code reorganization. This time, the client source code was moved from the client/ subdirectory to the new  src/ development tree. Original news This change includes C++ source code and   Ogre3D configuration files templates (. cfg.in files) , used  by cmake  to generate plugins.cfg and resources.cfg . The m4-based  autotools   files were deleted while the remaining files, including TODO and ChangeLog, were moved to the  OLD/client  directory. To make the whole project consistent, the last to-be-moved directory is services/ . 2022 update Article's links are now dead since RainbruRPG 's now hosted at bitbucket . To be complete, the current directories from src are : client : the game client source code; examples : some code example for the main project libraries; logger : the logger library used both by client and server; server : the so-called server; services : a module han

Rainbrurph switch to revision 9

Image
The revision 8 of rainbrurph is over : today, I switched to revision 9. It's not a major switch, the way I'm handling revision makes it even less than a minor version. Here is the changelog of this revision. The whole revision was about segfault fixing and I failed. Issues are in the module handling and I can't fix these for instance so I postponed for further informations. I  decided to publish it at github , so it becomes a free project, free as in publicly available. I enabled Continuous Integration via travis-ci.org .  This should help me with code quality and regressions. The next revision's goal is to have at least one working client's launcher with options/renderer selection. 2022 Update This project is not hosted at github anymore. It moved to bitbucket . It also do not use continuous integration anymore but unit tests are always locally used to impove code quality. The project hasn't any working client as of december 2022 and some later

Introducing rainbrurph

Today, I'm freeing another private project :  rainbrurph . It's a side project of  RainbruRPG  and a complete rewrite in ANSI C.

RainbruRPG's logger moved to OLD/ directory

Original news Today's work (commits #821  and  #822 ) is about code reorganization and the logger library. Since I decided to switch to cmake  and run integration tests, the multi-project layout was a mess. Before the switch, every single binary/library has its own sub-directory and build system. The result is a bunch of different autotools scritps, each whith its own dependencies.

Building rigs of rods on Debian

Today, I tried to build  Rigs Of Rods  from sources.While building dependencies with the official wiki  documentation worked but I had a strange issue with the cmake . command :

Building openmw on Debian Jessie

openmw  is an open source project rewritting Morrowind 's engine, you'll need the original game to play. It's difficult to build openmw on Debian because we can't find all dependencies in official apt-get repositories. Here is my solution. I'll not list all depndencies needed to manually build openmw, many of these libraries ( Qt4 ,...) can be found using official packages manager ( aptitude , synaptic ). But some libraries can't be found.

How to use syntax highlighting with Blogger

Here is a development-themed blog, so I need a way to show you code fragments. The solution I would to test is  code-prettify . Before you modify the blogger's template, go to the template tab and download a complete backup of the current one. Modify the HTML code and add this line just before the </head> tag. You have to choose options before inserting loader code, because you'll have to change the URL. The base URL is  https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js then, if you want to change the skin you have tp append  ?skin=sons-of-obsidian to the URL. Please read  official documentation  for more informations and examples.

Adding a screenshot in a github's README.md

Today's work is about a ruby project hosted at github.com :  todo-summarizer , a tool I use to compute weekly statistics on my development tree, and the task is to enhance project documentation. The github -flavored markdown -based README is already quite explicit but it tends to show this tool only has a terminal output, but since todo-summarizer also offers a GTK -based GUI, I'd like to add some screenshots of the running application.

Mrt-manager and the meteor update process

Image
This day was finally lost; dedicated to a side project called  mrt-manager , my first public project written in meteor , a javascript framework. The first thing in a meteor day is to see if it need an update using the meteor list command. If some packages version are followed by an asterisk (*), I generally issue a   meteor update one. Today, this command failed.