Just to complete all colourings for CUDA files, I added the missing __*__-specifiers. Builtin types like uint4 will be now coloured too. The magic variables blockIdx, threadIdx, … and the function syncthreads() will all be handled as something specific but I think the most are only interested in the nanorc-file for colouring CUDA code in GNU Nano.
Archive for the 'Gerneral' Category
Since GNU Nano is my favorite editor on the commandline and I am developing things with CUDA at the moment, I wanted to have the comfort of coloured code code. Since CUDA is just C/C++ with some minimal synatx additions, I modifed the C-syntax file which is loacted in /usr/share/nano/c.nanorc in my system.
First we need to tell nano to colour .cu-files too, not only .c, .cpp and … This is done through adding a u| in front of pp|xx in the line starting with syntax, normally line 3. After that the line should look as following:
syntax “c” “\.(c(c|u|pp|xx)?|C)$” “\.(h(h|pp|xx)?|H)$” “\.ii?$”
For the beginning I included the colouring of the __*__-specifiers and the <<<…>>> blocks. I hope this block is self-expalining (if there are some problems look at `man nanorc`), you could add this to the end of the file:
## CUDA Syntax
color cyan “\<(__shared__|__global__|__device__|__host__)\>”
color red,yellow start=”<<<” end=”>>>”
Of course you need not to use the colours I’ve choosen, feel free to choose your favourite ones, all available colours are listed in `man nanorc`.
Coming up with Schoorbs 1.1 we introduce a new translation system which is object-oriented, more portable and needs less code. One major thing I wanted to have, is to be independent from the operating system’s locales, so that we do not need anymore those large language code conversation arrays and as wished by users the translations of dates will now ne done by Schoorbs itself and not by the OS, so you do not depend anymore that the locale the users needs is installed on your system, e.g. on an fresh linux installation with only English as the one and only available language in Schoorbs 1.0 the dates where only available in English on the web interface, even if there was a translation file available for the user’s language, now dates are translated into the user’s language if they were already translated in Schoorbs and not if the locale is installed on the system. This fact has many positive sides, the Schoorbs user/administrator does not depend anymore on his webmaster/provider that he installed all the needed locales and the webmaster/provider needs not to install a big amount of locales to satisfy all users of a certain Schoorbs installation which keeps the system clean and nobody has to care of the differences of operating system if one wants to install a different locale.
After the theoratical part we now move on the practical usage of this new system. The “endusers” of this new translation system do not really see a change. In Schoorbs 1.0 a string was translated by calling “get_vocab(’string’)“ now this done with “Lang::_(’string’)“. The only outwardly remarkable change is that ’string’ is returned directly as a translation if no suitable translation was found, before nothing was returned which led to empty buttons in some cases. Under the hood the system completely changed. I will explain the new architecture by doing an example call on “Lang::_(’Time’)“: At first Lang::_() fetches the best available language for the user via Lang::getUserLanguage(). Lang::getUserLanguage analyzes the HTTP_ACCEPT_LANGUAGE strings and search based on the priority for the best fitting language for which a translation exists. If it found a suitable language it gets an instance of it via Lang::getLanguage() and returns it to Lang::_(), if no suitable language was found English is used. If a new language instance is created, the translations are read from a XML-file from schoorbs-includes/lang/schoorbs-<langcode>.po-xml, the format of these files is simple and should be self-explaining. I used this format insted of using directly po-files because it didn’t wanted to include a complete po-parser in Schoorbs and on various sites people disadvise from using PHP’s gettext-functions. Still po-files are used as translation storage since its a common format and I included a rake task that automatically converts the po-files to XML ones. Using po-files as storage during the development enabled me to use launchpad.net as a GUI to translate Schoorbs.
Because it’s a complete new class and could be used in other projects too I duallicensed this translation system under the terms of the GPL 2.1 and a MIT/X11-style license.
Links:
To give you a short look into the Schoorbs 1.1 development, here is a screenshot of the week-view. There is generally a new structure in the Schoorbs layout but now day, week and month view will be very different from each other, so you can’t expect that the day view or the month view will structured like the week view which wouldn’t make really sense if you look at it. I’ve already gathered a lot of critics about the new layout but you’re still free to comment and I’ll try to work your comments into the new layout.
I think quite many people already have seen it (46 million views), but it is so good that I have to mention it in my blog. It’s really enjoying to watch this 2 minute video, there is not a really sense in it, it is just the ironic and happy behaviour that makes this video a have-to-watch. I think it is impossible to explain the style of the video, you just have to watch it!