Category Archives: Linux

C/C++ library programming on Linux - Part one: Static libraries

Background

One of the most important aspects of modern programming is concept of reuse of code. Even C programming language allows us to reuse our code using concepts like simple functions and structures. C++ programming language goes one step further and allows us to group related variables and functions into classes with the same purpose - the reuse of our valuable code. By using libraries we can go even further from sharing code inside one process - we can share code between completely different programs.

What changes when using libraries? Answer to that question is: "link phase" of your program. In this phase GNU linker links all code modules in fully functional program. When it comes to libraries on Linux operating system we have two basic concepts: static and dynamic (often called "shared"). In this article series I will do my best to explain both Linux libraries concepts using simple C language examples.

Continue reading

Firefox 4.0 on Ubuntu 10.04 Lucid and Ubuntu 10.10 Maverick

Mozilla Firefox 4.0 Screenshot

Firefox 4 is here as you might have already heard. I've noticed that not many people had updated their Firefox installations cause Firefox 4 won't be in official repositories until Ubuntu 11.04 Natty arrives. But fear not, "Mozilla Team" maintains Firefox Stable PPA for all of you waiting to update their favorite Firefox browser on Ubuntu 10.04 and 10.10. So here's the procedure for updating to Firefox 4.0:

sudo add-apt-repository ppa:mozillateam/firefox-stable
sudo apt-get update && sudo apt-get upgrade

Enjoy!

Ubuntu / Debian environment variables and starting scripts at boot

Love your environmentEnvironment variables are very important aspect of Linux based operating systems. They are used by system to adjust its own behavior according to what you have specified during operating system installation and after that you can use it to tweak you system even more. Environment variables take form of name=value and you can view list of current environment variables by issuing following command on your favorite Linux terminal:

printenv

Some environment variables are set by the root user for all users on one PC, but every one of those users can have its own environment variables. Now lets see how should we assign lets say "en_US.UTF-8" value to environment variable named "LC_ALL" (by the way this is the way to tweak you environment locale setting for things like time and date format and things like that). Typically you will assign environment variable like this:

export LC_ALL=en_US.UTF-8
Continue reading

Start shell script on Network Manager successful connection

The other day I was writing a script that needed to do its job only when specific network interface is triggered (wireless broadband ppp0 in my case). Pinging Google every 10 seconds to detect Internet access was out of the question. There is a more elegant way to do this. If you are interested please proceed.

Do you know that authors of Network Manager built option to trigger scripts right into this great application. To use this option you need to write bash script with some specific bash variables and put it to "/etc/NetworkManager/dispatcher.d/" directory. Specific variables are necessary to receive instructions from Network Manager about network interface that triggers execution of your script and should it be executed on "up" or "down" operation on that interface.

Continue reading

Remote CLI access to Ubuntu Linux PC using web browser through authenticated HTTPS

Shellinabox

Lets say you need to access your Ubuntu Linux PC at your home from the other PC behind very restrictive firewall. Lets also say that all you have access to is port 80 (http) and port 443 (https). Lets unlock this situation. Ill show you how to setup Shell In A Box with additional layer of security with Apache2 SSL. Prerequisite for the following guide is that you have fully working Apache 2 installation on you Ubuntu system. If you need instructions for this, you can find them on one of my older posts:

Ubuntu Netbeans and LAMP server with Xdebug as non-root user

In this post I'll mostly give you CLI commands without to much explanation so it is up to you to go trough the procedure and adjust it according to your own setup. Reason for this approach is that the procedure is a bit longer and there could be 10 pages explanation for all of this. Of course I'll give basic explanation for most important commands. So lets get down to business...

Continue reading