Fly away, little bird

Featured image: a-shuhani | Unsplash (photo)

The last day of July happened to be the day that Domagoj Margan, a former student teaching assistant and a great friend of mine, set up his own DigitalOcean (note: affiliate link) droplet running a web server and serving his professional website on his own domain domargan.net. For a few years, I was helping him by providing space on the server I owned and maintained, and I was always glad to do so. To understand why, let’s start the story a little before those times.

During the early years of Mozilla (video recording of my 2015 talk in Croatian, a really nice article at ExtremeTech), I would follow Planet Mozilla to be up to date with the happenings in the community. Over time I became aware of the fact that, while some people hosted their pages or blogs on free services or their company/university domains and servers, others owned their domain names and servers used for the same purpose.

At that time (and for a while after that) I wasn’t aware of the value of owning a domain name, but I roughly understood the main argument for self-hosting your website, which is independence from a particular organization you might cease to be affiliated with. In addition, with social networks centralizing interactions on the web and creating walled gardens of content, having your own domain and setting up your own communication services (be it web, e-mail, or XMPP) is a good way to contribute to Internet remaining decentralized.

It still took me until late 2014 to bite the bullet and move from Department of Informatics‘s www.inf.uniri.hr/~vmiletic to my own domain (vedran.miletic.net at the moment) and my own hosting. At the time, I already had some experience with setting up and troubleshooting Apache. It was mostly coming from a few years of maintaining the Department’s inf2 server, where MoinMoin used to be the prime tenant, but a number of PHP applications also found their home.

Despite being lazy about registering my own domain and setting up my own web server, I must mention that I did keep my page reasonably up to date, i.e. at least once a year I would make sure that all the content (courses, scientific work, interests, software etc.) is still correct. (It’s not the only instance where I work hard not to repeat the mistakes of my professors observed while being their student.)

I mentioned my decision to Domagoj, suggested to him to do the same, and offered my help and support if he would decide to register his own domain and set up his own website. (I also wished my professors would have explained to me the value of the domain names and encouraged me to get one, so there is that trying to improve on what they did.) To my pleasant surprise, he was convinced by the arguments about decentralization and independence that I brought up at the time and also detailed above.

From that moment I knew that a day will come when a little bird will grow up and decide to leave the nest and create their own, i.e. Domagoj will want to set up his own hosting that he will have complete control of, and in the future use it to help others walk the same path. That’s precisely how things should be, that’s exactly how new Internet nodes should appear, and that’s exactly how Internet should grow towards becoming more decentralized.

Fly away, little bird, the world is awaiting you.

Why use reStructuredText and Sphinx static site generator for maintaining teaching materials

Featured image: Les Anderson | Unsplash (photo)

Yesterday I was asked by Edvin Močibob, a friend and a former student teaching assistant of mine, the following question:

You seem to be using Sphinx for your teaching materials, right? As far as I can see, it doesn’t have an online WYSIWYG editor. I would be interested in comparison of your solution with e.g. MediaWiki.

While the advantages and disadvantages of static site generators when compared to content management systems have been written about and discussed already, I will outline our reasons for the choice of Sphinx below. Many of the points have probably already been presented elsewhere.

Starting with MoinMoin

Teaching materials for the courses some of my colleagues and I used to teach at InfUniRi and RiTeh, including laboratory exercises for the Computer Networks 2 course developed during early 2012, were initially put online using MoinMoin. I personally liked MoinMoin because it used flat text files and required no database and also because it was Python-based and I happen to know Python better than PHP.

During the summer of 2014, the decision was made to replace MoinMoin with something better because version 1.9 was lacking features compared to MediaWiki and also evolving slowly. Most of the development effort was put in MoinMoin version 2.0, which, quite unfortunately, still isn’t released as of 2017. My colleagues and I especially cared about mobile device support (we wanted responsive design), as it was requested by students quite often and, by that time, every other relevant actor on the internet had it.

The search for alternatives begins

DokuWiki was a nice alternative and it offered responsive design, but I wasn’t particularly impressed by it and was also slightly worried it might go the way of MoinMoin (as of 2017, this does not seem to be the case). It also used a custom markup/syntax, while I would have much preferred something Markdown/reStructuredText-based.

We really wanted to go open with the teaching materials and release them under a Creative Commons license. Legally, that can be done with any wiki or similar software. Ideally, however, a user should not be tied to your running instance of the materials to contribute improvements and should not be required to invest a lot of effort to set up a personal instance where changes can be made.

MediaWiki was another option. Thanks to Wikipedia, MediaWiki’s markup is widely understood, and WYSIWYG editor was at the time being created. I have set up a MediaWiki instance in BioSFLab (where I also participated in research projects for almost two years) and can say that setting up such an instance presents a number of challenges:

When migrating from a server to a server, this means you have to dump/restore database, adjust the config files (if you’re lucky it won’t be required to convert Apache configuration directives to Nginx ones or vice versa), etc. None of this is especially complicated, but it’s extra work compared to flat file wikis and static websites.

Finally, my favorite MediaWiki theme (skin in its terminology) is Vector, so my potential wiki with teaching materials would look exactly like Wikipedia. While nice and trendy, it is not very original to look like Wikipedia.

Going static, going reStructured

Therefore, we opted to use Sphinx and reStructuredText, as it was and still is a more powerful format than Markdown. We specifically cared about the built-in admonitions, which made it easier for us to convert the existing contents (Python socket module lecture is a decent example). The advantages of Sphinx were and still are the following:

There is a number of issues which affected us:

  • time to deployment after change, varies depending on the change but it’s order of tens of seconds in the worst case,
  • need to automate the deployment on git push (note that this does not increase attack surface, since git uses SSH or HTTPS for authentication and transfer).
  • learning curve to add content: MediaWiki’s WYSIWYG editor beats using git and reStructuredText in terms of simplicity.

Conclusion

A rule of thumb here would be:

  • if many people inside of an organization are going to edit content a lot and the content is more like notes than a proper documentation, then MediaWiki (or DokuWiki) is the choice,
  • if the content has an obvious hierarchy of parts, chapters, sections etc. and/or it is evolving like a piece documentation changes with software it documents, then Sphinx (or any of Markdown-based generators, e.g. HotDoc) will do a better job.

Enabling HTTP/2, HTTPS, and going HTTPS-only on inf2

Featured image: John Moore | Unsplash (photo)

Inf2 is a web server at University of Rijeka Department of Informatics, hosting Sphinx-produced static HTML course materials (mirrored elsewhere), some big files, a WordPress instance, and an internal instance of Moodle.

HTTPS was enabled on inf2 for a long time, using a self-signed certificate. However, with Let’s Encrpyt coming into public beta, we decided to join the movement:

HTTPS was optional. Almost a year and a half later, we also enabled HTTP/2 for the users who access the site using HTTPS. This was very straightforward.

Mozilla has a long-term plan to deprecate non-secure HTTP. The likes of NCBI (and the rest of the US Federal Government), Wired, and StackOverflow have already moved to HTTPS-only. We decided to do the same.

Configuring nginx to redirect to https:// is very easy, but configuring particular web applications at the same time can be tricky. Let’s go through them one by one.

Sphinx-produced static content does not hardcode local URLs, and the resources loaded from CDNs in Sphinx Bootstrap Theme are already loaded via HTTPS. No changes were needed.

WordPress requires you to set the https:// URL in Admin, Settings/General. If you forget to do so before you go HTTPS only, you can still use the config file to adjust the URL.

Moodle requires you to set $CFG->wwwroot in the config file to https:// URL of your website.

And that’s it! Since there is a dedicated IP address used just for the inf2.uniri.hr domain, we can afford to not require SNI support from the clients (I’m sure that both of our Android 2.3 users are happy for it).

How to watch Russia Today RT Live On Air without Flash

Featured image: Gianpaolo La Paglia | Unsplash (photo)

What is RT?

RT (formerly Russia Today) is an international TV network operated by the Russian government. Right now, it fits among a number of alternative media sources which are on the rise given the falling trust in the mainstream media among the western world (as an example, here is 2015 data for the USA).

RT’s content has been criticized from multiple angles. Regardless, I find it to be a valuable source of news; among other things, I particularly like that they frequently feature commentators like Ron Paul (for nearly 8 years already!) and John McAfee.

RT requires Flash Player plugin for watching their live audio/video streams

(Update 25th of May 2017: RT Live does not require Flash anymore! Just open it in any HTML5-compliant browser and the video stream will start playing.)

However, RT Live (so called On Air) requires you to use Flash Player plugin and does not offer HTML5 video, which is sub-optimal at best. RT uses HTTP Live Streaming (HLS) in JW Player for 5 channels (News, USA, UK, Arabic, and Documentary) and YouTube for one (Spanish). Knowing how JW Player HLS configuration looks allows us to use some hackery to dig up the stream URL.

On Air page embeds the player from another page and the URLs are in variable streams.hls which is set in static/libs/octoshape/js/streams/news.js. Digging through the same file for each of the other channels will uncover their URLs as well (I have listed all of the URLs below). A simpler solution would be to have Flash Player plugin installed (yuck, proprietary software!) and use Video DownloadHelper, which can uncover the URLs accessed by Flash Player plugin while the video is playing.

To play the streams from URLs listed, you can use an open source media player such as mpv, MPlayer, or VLC. I have tested and confirmed all three work with the URLs listed below. If you don’t like those three, there are plenty more options.

RT News

RT News, as well as RT America and RT UK, are served using a CDN from Level 3 Communications. Unfortunately, we are limited to receiving the stream over the unencrypted HTTP.

HD: http://rt-eng-live.hls.adaptive.level3.net/rt/eng/index2500.m3u8
Hi: http://rt-eng-live.hls.adaptive.level3.net/rt/eng/index1600.m3u8
Medium: http://rt-eng-live.hls.adaptive.level3.net/rt/eng/index800.m3u8
Low: http://rt-eng-live.hls.adaptive.level3.net/rt/eng/index400.m3u8
Audio: http://rt-eng-live.hls.adaptive.level3.net/rt/eng/indexaudio.m3u8

RT America

HD: http://rt-usa-live.hls.adaptive.level3.net/rt/usa/index2500.m3u8
Hi: http://rt-usa-live.hls.adaptive.level3.net/rt/usa/index1600.m3u8
Medium: http://rt-usa-live.hls.adaptive.level3.net/rt/usa/index800.m3u8
Low: http://rt-usa-live.hls.adaptive.level3.net/rt/usa/index400.m3u8
Audio: http://rt-usa-live.hls.adaptive.level3.net/rt/usa/indexaudio.m3u8

RT UK

HD: http://rt-uk-live.hls.adaptive.level3.net/rt/uk/index2500.m3u8
Hi: http://rt-uk-live.hls.adaptive.level3.net/rt/uk/index1600.m3u8
Medium: http://rt-uk-live.hls.adaptive.level3.net/rt/uk/index800.m3u8
Low: http://rt-uk-live.hls.adaptive.level3.net/rt/uk/index400.m3u8
Audio: http://rt-uk-live.hls.adaptive.level3.net/rt/uk/indexaudio.m3u8

RT Arabic

RT Arabic and RT Documentary use a different CDN (though operated by Level 3 Communications, just like the CDN for the first three channels). This CDN offers HTTPS in addition to the unencrypted HTTP.

HD: https://rt-ara-live-hls.secure.footprint.net/rt/ara/index2500.m3u8
Hi: https://rt-ara-live-hls.secure.footprint.net/rt/ara/index1600.m3u8
Medium: https://rt-ara-live-hls.secure.footprint.net/rt/ara/index800.m3u8
Low: https://rt-ara-live-hls.secure.footprint.net/rt/ara/index400.m3u8
Audio: https://rt-ara-live-hls.secure.footprint.net/rt/ara/indexaudio.m3u8

RT Documentary

HD: https://rt-doc-live-hls.secure.footprint.net/rt/doc/index2500.m3u8
Hi: https://rt-doc-live-hls.secure.footprint.net/rt/doc/index1600.m3u8
Medium: https://rt-doc-live-hls.secure.footprint.net/rt/doc/index800.m3u8
Low: https://rt-doc-live-hls.secure.footprint.net/rt/doc/index400.m3u8
Audio: https://rt-doc-live-hls.secure.footprint.net/rt/doc/indexaudio.m3u8

RT Spanish

RT Spanish is broadcasted live via YouTube, therefore it already does not require Flash Player plugin. If you want to watch it outside the browser, the players mentioned above should be able to do that.

And that’s it. No Flash Player plugin required! Hopefully, RT will start offering HTML5 video at some point and allow watching live content without requiring Flash Player plugin. You can try bugging them about it, as I did over Twitter.

(Update: added the note regarding RT Spanish.)

Guest post: celebrating Graphics and Compute Freedom Day

Featured image: Wesley Caribe | Unsplash (photo)

Hobbyists, activists, geeks, designers, engineers, etc have always tinkered with technologies for their own purposes (in early personal computing, for example). And social activists have long advocated the power of giving tools to people. An open hardware movement driven by these restless innovators is creating ingenious versions of all sorts of technologies, and freely sharing the know-how through the Internet and more recently through the social media. Open source software and more recently hardware is also encroaching upon centers of manufacturing and can empower serious business opportunities and projects.

The free software movement is cited as both an inspiration and a model for open hardware. Free software practices have transformed our culture by making it easier for people to become involved in producing things from magazines to music, movies to games, communities to services. With advances in digital fabrication making it easier to manipulate materials, some now anticipate an analogous opening up of manufacturing to mass participation.

It is important to keep sharp open hardware’s more transformational edges, on agendas such as dismantling intellectual property and releasing investment for alternative business models. Only through a mix of craft, politics, and the support of social movements, will open hardware fully realise its potential to democratise technology.

There are numerous organizations and initiatives voiced and supported by the Open Source Hardware Association and a vast thriving community of supporters and technological enthusiasts that are doing to advance this core value. The Open Source Hardware Association aims to be the voice of the open hardware community, ensuring that technological knowledge is accessible to everyone, and encouraging the collaborative development of technology that serves education, environmental sustainability, and human welfare.

Technology and culture ought to respect user freedom. A year ago, AMD made a giant leap towards a fully open source Linux graphics and compute stack driver stack. While still offering proprietary hardware running proprietary firmware, having the driver and the libraries as open source opens potential for modification and performance optimization. In addition, it gives other GPU manufacturers, including NVIDIA and Intel, a standard to aim for. Finally, it gives hope that there will be further openness in the future.

This is why we celebrate Graphics and Compute Freedom Day, GCFD. We want to take one day every year to remember all the open standards, open source software, and open hardware that have made it into the mainstream in the field of computer graphics and GPU computing. It has been exactly one year since AMD has unveiled GPUOpen on 15th December 2015; let’s celebrate GCFD and let’s hope that this year is just a start of many more successful years of graphics and compute freedom.

GCFD will be hosting a livestream starting at 14:30 in Central European Time. Join at www.gcfd.stream.