Published on March 23, 2015 by Alex Palcuie
Tagged: algorithms, ROSEdu, write-up, JSON

The Community and Development Lab is a traditional yearly ROSEdu project where we teach students how to start contributing to open source software. This year we had 117 applicants and had to select only 19 of them. To do this, we gave them an algorithms problem to filter 60 potential candidates which were invited to an interview.

Published on March 30, 2014 by Mihai Maruseac
Tagged: floating point, numerical methods, approximate algorithms, fast transcedental functions, fast inverse square root

In every programmer’s life there comes a time when he has to leave the realm of integers and tread into the dangerous land of rational numbers. He/she might do some scientific computation, or work on a financial application or a game rendering pipeline or even in some artificial intelligence or data-mining algorithm – in all of these cases and many others, restricting oneself to using only integers is no longer feasible.

And, as soon as one starts using floating point a lot of interesting things happen, starting from results which don’t show up nicely and bad equality testing and going towards subtler and subtler bugs.

e to pi
minus pi (xkcd)

Even experts and common-sense is at fault in this realm. For example, did you know that always comparing two floating points like in the following code is bad?

if (fabs(a - b) < 0.0001)
    do_something_with_equal_numbers(a);

Without being a complete guide, this article shows some of the beauties and dangers of the floating-point realm.

Published on March 23, 2014 by Matei Oprea
Tagged: C, daemon, fork, setsid, nohup, disown

A special category of processes in Linux is that formed by daemon processes.

Published on March 8, 2014 by Alexandru Goia
Tagged: Unix, C, portable code, autoconf, automake, libtool

The purpose of this article is to generally present the utilities Autoconf, Automake and Libtool, which ease very much the process of installation from sources of software packages or libraries, from the point of view of users. It is assumed that the user uses any Unix/Unix-like system, and the purpose of the developer, who chooses to use these GNU tools, is to make the installation, on the user’s system, as easy as possible.

Published on March 2, 2014 by Dan Șerban
Tagged: haskell

Haskell uses lazy evaluation by default, but what does that mean exactly?

We’re going to state the abstract definition of laziness, behold its nonsensical beauty for a few seconds, and then conclude that a concrete example is necessary in order to understand the concept:

Laziness is the separation of equation from execution.

Published on February 2, 2014 by Alexandru Goia
Tagged: Unix, C, portable code, POSIX, SUS, libc

The purpose of this article is to present in a general way the Unix standards and how can we write portable code on Unix systems, not only on Linux ones.

Published on January 28, 2014 by Mădălina-Andreea Grosu, Matei Oprea
Tagged: lambda, higher-order functions, c++

The C++ 2011 standard introduced the lambda expression syntax element causing some people ask why it was needed. In reality, it was not a new use case, people have been using this under different names since C was created. You had functors (C++ terminology) and pointer to functions for example. A basic use case was in applying the same transform over all elements of a collection (the functor’s widely shared example) or sorting elements of a vector (via qsort in C). But, in reality, all of these cases can be reduced to using higher-order functions.

Published on January 18, 2014 by Mihai Maruseac
Tagged: trace, ltrace, strace, ptrace, debugging

Two years ago this blog had a series of articles on debugging tools. We have presented tools like Valgrind and GDB and we stopped with an introduction to strace. At the end of that article we mentioned that there are other tools useful for debugging beyond these three already mentioned. After two years of silence, the debugging series is on with an article on ltrace.

Published on January 7, 2014 by Dan Șerban
Tagged: haskell

This series of blog posts is aimed at experienced programmers who have heard that Haskell is an interesting programming language, but have not had the chance to invest any time in researching it.

In this series I am going to highlight a few remarkable things at a high level, while glossing over some implementation details that would take too long to explain properly. Therefore, expect a lot of “here’s a practical application of Haskell and here’s some sample code, but don’t ask to see the gory details” hand-waving.

For the purposes of this series, I will simply assume that it’s easy for the experienced reader to jump into a new imperative programming language after a few hours or days of becoming familiar with its syntax. And I’ll start with an example that illustrates how you have to adopt a completely different mindset when you start learning Haskell.

Part 1 of this series covers:

  • Mutability
  • Upside Down Maps
  • Tokenizing Kernel Code
Published on October 19, 2013 by Alex Palcuie, Marius Ungureanu
Tagged: facebook, hackathon, live, blogging, coders

3:30PM

Ladies and gentlemen, fast hackers and coder perfectionists, web developers and mobile app creators, we present you the first edition of the Facebook hackathon in Romania. Organized by your favorite open-source community ROSEdu, the volunteers have been busy all morning preparing the workspace for the 15 participating teams. We have pizza, beer and a mountain of bean bags for people who move fast and break things.

Published on June 20, 2013 by Alexandru Juncu
Tagged: CLI, bash, shell, files, text, truncate, tee, tail, follow

Here are are some small things you might find useful when you need to deal with text files. In the Linux/Unix world, a lot of things are text files, so you need to know how to efficiently handle them. If you are a sysadmin, you need to look at log files for most of your work time and the following might come in handy.

Published on March 26, 2013 by Răzvan Deaconescu, Mihai Maruseac
Tagged: git

Finally, the third article on advanced git topics will focus on things that many will use only in some very special cases.

Published on March 22, 2013 by Răzvan Deaconescu, Mihai Maruseac
Tagged: git

The second article on advanced git topics is focused on cases where multiple branches are involved.

Published on March 18, 2013 by Răzvan Deaconescu, Mihai Maruseac
Tagged: git

We focus again on git. This time, we will present some real-world scenarios where knoweldge of advance git topics helps. In order to keep down the length of the article, our presentation is divided in 3 parts, this being the first one of these.

Published on February 19, 2013 by Lucian Cojocar
Tagged: exploit, ctf, return-to-libc, strace, debugging, gdb, write-up

Introduction

This is a write-up for Pwnable 250 level from Ghost in the Shellcode capture the flag competition. Basically a return-to-libc attack will be described; we will also describe the steps for solving the mentioned CTF level using the original binary from the competition.

Published on October 25, 2012 by Alexandru Juncu
Tagged: grub2, bootloader, linux, kernel, iso, image

Note: This article focuses on Debian based Linux distributions.

Grub2 is the next generation Linux bootloader that is trying to replace the “Legacy” Grub version. It is a complete rewrite of Grub 1 and only lately becoming fully featured compared to the old version and even comes with some new interesting features.

Published on October 5, 2012 by Dan Șerban
Tagged: SQL, RDBMS

Rather than relying on dry explanations of mathematical set theory, this tutorial is organized as a survey of SQL statements and techniques. It is designed to let you infer from examples what SQL is all about as well as the kinds of problems it can help you solve.

Published on September 18, 2012 by Tiberiu Barbu
Tagged: cryptography, encryption, security, rsa, gpg

This guide is designed to explain why you need to hide information and how can you do this when you do not trust the channel through which messages are conveyed. We will discuss about cryptographic system, encryption, decryption, one-way function, asymmetric keys and more. You may think of cryptography as the thing that keeps you untouchable inside of a soap bubble travelling by air around the world.

Do you think it is safer by plane?

Published on September 10, 2012 by Silviu-Mihai Popescu
Tagged: SSH, security, remote access

This is an article aiming to familiarize the reader with the features and benefits of using Secure Shell (SSH), particularly with the OpenSSH implementation. SSH is an application level protocol used for secure data communication, whether that means remote shell access, command execution, file transfer and some other aspects described in this article. It was meant to be a replacement for existing insecure remote shell protocols such as telnet, rsh and rexec which send information in plaintext, including usernames and passwords.

Published on August 18, 2012 by Mihai Maruseac
Tagged: trace, strace, ptrace, debugging

After talking about Valgrind and GDB, it is time to present another useful program for developers and system administrators.

Often-overlooked, though common on most of the GNU/Linux systems, strace is a tool which traces system calls done by a process during its execution. However, this is only a simplistic point of view: using strace, you can filter by a group of system calls, you can profile your application from the syscalls point of view and you can trace signals sent to a process.

Published on July 29, 2012 by Mihai Maruseac
Tagged: C, undefined behaviour, sequence points

Let us start from a common mistake made by programmers learning simple data structures in C. The following code is an implementation for simple linked lists of integers in C.

Published on June 23, 2012 by Mihai Maruseac
Tagged: SCM, git, tip, good practice, alias

This is the third article about git on this blog. It is highly recommended to read the other two as well: there is one about some good practices in using git and another one about some aliases which will speed up your interaction with the commit history.

The series of articles about git continues with a short presentation about two other aliases and the reason why they should be used in order to create better commits.

Published on May 8, 2012 by Mihai Tiriplică
Tagged: make, makefile

In working with large projects it is necessary to compile from multiple sources. Since this is quite difficult, different tools have been developed to make this task easier. One such tool is GNU Make and the associated executable is make. Make solves compilation from multiple sources problem using the dependency relationships between them, described in a special file usually called Makefile.

Published on April 30, 2012 by Alexandru Juncu
Tagged: CLI, bash, shell, terminal, tmux, screen, jobs, fg, pushd, popd

Most Linux users prefer to use the CLI because of its efficiency. But the days of the single terminal in which you had your shell are long gone. Users take advantage of the GUI and use graphical terminals like gnome-terminal, konsole or similar utilities, to start several shell instances. For example if you are a programmer, you might want to have one instance for the editor (with the code you are working on), another one to test and debug the compiled executable and – maybe – another for the documentation (man pages). If you are a system administrator you might have a shell with the configuration file of a service, one you use to test the running service, and maybe one shell connected to another server. But, having a lot of windows (or tabs) can get confusing.

Published on April 29, 2012 by Mihai Maruseac
Tagged: valgrind, debugging

A good programmer has a variety of tools to help him in developing good applications. We talked about gdb in an article at the beginning of April. Now, it is time for a crash introduction to Valgrind.

See Archive for more posts.