Cleaning yaourt old files

I have a habit to backup the files. As a result, using the yaourt (Arch Linux pacman helper), I have saved a lot of files in a directory. From time to time I need to clean up the directory manually by deleting old files, because the size is increasing gradually.

So, I finally wrote a script to clean the old files in the directory.

It is available here.

Programming languages re-visit

C

After many years of experience in programming, gradually I have newer perspective towards the programming languages. Previously, I was fervent in C language, which I assumed as a low level, powerful programming language. The OS kernel such as Linux is written in C language. To use C language, we need a lot of computer science knowledge, such as pointer, memory buffer, linked list, and so on. Furthermore, there are a lot of libraries supported in C, and C libraries can be ported to C++. That is why I liked C so much. Moreover, the library such as “glib” can make C written in object-oriented. By the knowledge of C language, learning other programming languages will be easier.

C++

However, writing programs in C language is exhaustive. They are difficult to maintain, and writing the functions with the parameter “struct” pointer is troublesome. Creating linked list, stack, queue, tree, and other abstract data type (ADT) are time consuming. That is why I finally adopt the object-oriented paradigm (OOP), C++ language. With the C++ standard libraries, C++ development is far easier than C. Creating the objects and also the templates allows to re-use the source code easily. Exception handling makes the debugging process easier. It is better use for the application development. Furthermore, most of the C programming codes are compatible to C++, since C can be considered as a subset of C++ (though not totally subset).

Command-line compilation

Since I like C and C++, I preferred to use command-line compilation. The best way to perform command-line compilation is using GCC and autotools (automake, autoconf, and libtool). By learning to use these tools, this make me gain the profound knowledge about compiler, linker, libraries, compiled object (object code), binary, and binary executable.

PHP and Perl

However, different programming languages should be used in different situation. It is possible to develop web applications or interactive webpages using C and C++ through CGI, yet this is slower than other programming languages targeted on web development, such as PHP. Besides that, the applications which highly requires text processing should use the language such as Perl. I like these languages, but less fervent as C and C++.

Python

Similar to PHP and Perl, Python is another interpreted programming language (though it can be compiled in bytecode like Java). This programming language becomes my favourite since it is used in rapid application development (RAD). Without compilation, I can test my code (algorithm) easily. Without compilation, using Python is time saving. It is used in general purpose including developing GUI applications, command-line applications, text processing using regular expression, reading CSV file, read-write SQLite file, processing JSON file, preforming complex mathematical calculations, implementing computer vision (using OpenCV libraries), or even creating web applications (though I have not use it in this purpose). It is especially good for me to test the AI (Artificial Intelligence) algorithms, such as Genetic Algorithms, Artificial Neural Network, etc.

Android application development

Previously, I had done a little Android mobile development. Since I prefer C and C++, and Android provides NDK (native development kit), it was interesting for me to create Android applications with C and C++ through command-line. However, I found that it was too exhaustive and time consuming. This is because Android is not designed to use C/C++. Though the NDK is provided and it uses GCC and autotools, building the application is not same as the conventional way in GCC in normal desktop. That is why it recommends to use Apache Ant, run the “ndk-build” command, and even create the project from the sample project.

Java is the primary programming language use in Android. It is used with Eclipse installed with ADT plugin as the main IDE (integrated development environment). Developing Android application using these default tools are far easier than using NDK.

Microsoft Windows and Linux

As a result, now I accept the GUI development using IDE. Previously, I had bad experiences using Microsoft Visual C++. This was because linking the libraries are difficult (because lacked of the knowledge during that time); compiling open source libraries did not work well (due to the C and C++ standard differences between Visual C++ compiler and GCC).

Therefore, cross platform source code without modification for target OS is not working also. Then I used Cygwin and MinGW. Both work fine, yet not the best. Cygwin has the license issue and MinGW has a lot of compilation problems. That is why I abandoned Windows and focused on Linux.

Yes, Linux is the best for development, since there are a lot of development tools: GCC for C language, C++ language, Haskell compiler, interpreters for PHP, Perl, Python, Ruby, Lua, OpenJDK for Java, Mono for C#, and thousands of libraries.

OS, IDE, compiler

Therefore, now I understand that, just like different programming languages are chosen to solve different problems, the OS is also a factor to decide the programming languages to be used. Such as developing Windows application, .NET Framework related programming language is a better choice. Android application development should use Java language. Linux developers can use wide range of programming languages.

Furthermore, developing the Java applications, the IDE such as Eclipse or NetBean can be chosen. They are useful in creating GUI components. The applications involves Qt can use Qt Designer; applications that involves Gtk+/GNOME can use Anjuta DevStudio. By using IDE, debugging becomes much more easier than using GDB (command-line debugging).

Compiler and the OS are also related. Just like the case in Windows, the compiler such as MinGW or Cygwin has its own issues/problems, Visual C++ compiler has its own limitation also. Besides that, FreeBSD has adopted LLVM/Clang as the default compiler instead of GCC (though I does not use it and does not know what is the major differences).

Conclusion

Programming languages and software development are interesting. Knowing one language can only develop limited areas of application. Knowing one OS can only target on the audience of the particular OS. Using one type of IDE can only limited the knowledge within the IDE. Using command-line compiler will limit the productivity of software development (as what I did).

Lastly, knowing one type of programming paradigm only, such as procedural paradigm or OOP, will limit our perspective to solve the problem. Learning other paradigm such as functional programming will make us think differently to solve the same problem.

Arch Linux upgrade, downgrade, and rollback

One of the reasons, I recently consider to switch from Arch Linux to Debian which is famous in stability. However, I am very reluctant to do so, because of the greatness of simplicity in package management of Arch Linux, especially creating packages in AUR. Debian, though famous, there is much manual work in packaging such as preparing the “control” file (may be there are some other tools I not yet explored, because I used Ubuntu and Linux Mint before for only a short period). Besides that, Debian does not have the repository like AUR. Installing the packages such as TrueCrypt and XnViewMP in Debian is not as easy as Arch Linux. That is why I am hesitated to migrate.

Today, upgrading Arch Linux causes me fail to run Java applications, such as Eclipse. This is possibly caused by upgrading the dependent libraries, which results the runtime library cannot load the functions properly. This is troublesome, because I need to use the application in urgent, I cannot wait for the next update of the related packages which will solve the library dependencies problem.

Normally, whenever there is such problem, I will solve it with a tool, “downgrade“. If “downgrade” cannot solve, and if the application is not that important, I may wait until the application next update. Since this is emergency, I can only do a manual downgrade. The problem of the tool “downgrade” is that it cannot solve the dependency properly. Such as to downgrade “gcc”, “gcc-lib” cannot be resolved; but to downgrade “gcc-lib”, it is required by “gcc”. As a result, I found a manual solution. That is to solve it by “pacman -U” manually. If the older files not exist, “downgrade” can help to download the packages from the server. Using pacman to install older packages can solve the dependency problem.

If there is a built-in rollback system in Arch Linux and also other distribution, this will be great.