Category Archives: Open Source

Firefox to implement calc() in CSS3

I’ve just read last week that Firefox would implement calc() in their new version of Firefox. It’s not out in any publicly released version yet but it is coming as they talked about it on their developers blog.

Why should you care?

Ever had an element that needed to have a percentage width with padding? Up until now, because of the way the box model works in modern browsers, you had to wrap the content in a container to which you’d apply the padding. That’s because when you define padding to an element the value is added to the width, which is the proper way of doing it.

Now the thing is that percentage width don’t mix well with fixed padding values, that where calc() comes into play.

Lets say you have a box with the following css rules:

#box {
padding: 20px;
width: 60%;

If that box is in a container 1000 pixels wide, the box would be 640 pixels wide total, that’s not what you want, that’s not 60% wide! You coud use calc() to achieve the desired result:

#box {
width: -moz-calc(60% - 40px);

You can even be wild and do basic calculations in there:

#box {
width: -moz-calc(60% - 2 * 20px);

Taking it further

What would be even cooler is if you could get the actual padding values as a variable in calc(). Something like:

#box {
width: -moz-calc(60% - (padding-left + padding-right));

This way you could even forget about updating your width value when you play with your padding.

Oh well, one day maybe, now let’s just see if other browser vendors implement something of the like. Let’s not forget this is not part of the W3C CSS3 specs.

Is it a feature you were waiting for?

Why Thunderbird is the Best Email Client for your Family or Office

Nowadays, most of us have so many email addresses, it’s hard just to keep track of our own, let alone manage those of our family and colleagues as well. Throw newsgroup subscriptions and multiple storage folders into the mix as well, and it’s a management nightmare.

Mozilla Thunderbird, my email client of choice, solves this problem effectively and easily with Profiles.

How do Thunderbird Profiles work?

Thunderbird allows multiple users to set up the email client to suit their own specific needs and tastes, from Themes and Extensions to Email accounts, Inboxes and Newsgroup subscriptions.
Upon startup of Thunderbird, you are able to choose which user profile you would like to use.
So, you can now have a profile for yourself, one for your partner, and even one for the kids (allowing you to increase Thunderbirds’s spam and security measures).
Each profile is independent of the others, so it’s like having a new installation for each user.

How do I activate Thunderbird Profiles?

1. Firstly, find the Thunderbird shortcut on your desktop (or create one from the .exe file).
2. Right-click it, and select properties.
3. Lastly, in the Target box, add ‘ -p’ without the apostrophes to the end of the target line (so that it reads something like ‘C:\Program Files\Mozilla\Thunderbird\thunderbird.exe -p’), and click OK.

Now when you start Thunderbird through this shortcut you will be prompted with the Profiles Manager box (as long as you do not already have Thunderbird open). It’s all self-explanatory from thereon.

For faster start-up, I advise that you keep two shortcuts on your desktop – one to load up Thunderbird as normal, and this new one to execute only when you want to change profile.

Linux Tips And Tricks About SSH And Sockets

Count the number of SSH commands

SSH connections from a local machine to a remote machine. The following command will give you the count:

ss | grep -vE ‘State’ | awk ‘{print $1 “–>” “Local(“$4″)” “to” “Remote(“$5″)”}’ |grep -e ssh |wc -l

And the following command will print out the SSH connections from the local machine to the remote machine.

ss | grep -vE ‘State’ | awk ‘{print $1 “–>” “Local(“$4″)” “to” “Remote(“$5″)”}’ |grep -e ssh

Investigation of sockets

To display the names of the ports that are connected to a remote server we can you this command

ss | grep -vE ‘State’ | awk ‘{print $5}’ | cut -d’:’ -f2 |sort | uniq

This command will print only the established connections port names.

Note: Please type these command do not copy and paste otherwise it will give you error because of the blog format.

What Is SNMP?

In today’s complex network of routers, switches, and servers, it can seem like a daunting task to manage all the devices on your network and make sure they’re not only up and running but performing optimally. This is where the Simple Network Management Protocol (SNMP) can help. SNMP was introduced in 1988 to meet the growing need for a standard for managing Internet Protocol (IP) devices. SNMP provides its users with a “simple” set of operations that allows these devices to be managed remotely.

The core of SNMP is a simple set of operations (and the information these operations gather) that gives administrators the ability to change the state of some SNMP-based device. For example, you can use SNMP to shut down an interface on your router or check the speed at which your Ethernet interface is operating. SNMP can even monitor the temperature on your switch  and warn you when it is too high.

SNMP usually is associated with managing routers, but it’s important to understand that it can be used to manage many types of devices. While SNMP’s predecessor, the Simple Gateway Management Protocol (SGMP), was developed to manage Internet routers, SNMP can be used to manage Unix systems, Windows systems, printers, modem racks, power supplies, and more. Any device running software that allows the retrieval of SNMP information can be managed. This includes not only physical devices but also software, such as web servers and databases.

Another aspect of network management is network monitoring; that is, monitoring an entire network as opposed to individual routers, hosts, and other devices. Remote Network Monitoring (RMON) was developed to help us understand how the network itself is functioning, as well as how individual devices on the network are affecting the network as a whole. It can be used to monitor not only LAN traffic, but WAN interfaces as well.

Let’s say that you have a network of 100 machines running various operating systems. Several machines are file servers, a few others are print servers, another is running software that verifies credit card transactions (presumably from a web-based ordering system), and the rest are personal workstations. In addition, there are various switches and routers that help keep the actual network going. A T1 circuit connects the company to the global Internet, and there is a private connection to the  credit card verification system.

What happens when one of the file servers crashes? If it happens in the middle of the work week, it is likely that the people using it will notice and the appropriate administrator will be called to fix it. But what if it happens after everyone has gone home, including the administrators, or over the

What if the private connection to the credit card verification system goes down at 10 p.m. on Friday and isn’t restored until Monday morning? If the problem was faulty hardware and could have been fixed by swapping out a card or replacing a router, thousands of dollars in web site sales could have been lost for no reason. Likewise, if the T1 circuit to the Internet goes down, it could adversely affect the amount of sales generated by individuals accessing your web site and placing orders.

These are obviously serious problems — problems that can conceivably affect the survival of your business. This is where SNMP comes in. Instead of waiting for someone to notice that something is wrong and locate the person responsible for fixing the problem (which may not happen until Monday morning, if the problem occurs over the weekend), SNMP allows you to monitor your network constantly, even when you’re not there. For example, it will notice if the number of bad packets coming through one of your router’s interfaces is gradually increasing, suggesting that the router is about to fail. You can arrange to be notified automatically when failure seems imminent, so you can fix the router before it actually breaks. You can also arrange to be notified if the credit card processor appears to get hung — you may even be able to fix it from home. And if nothing goes wrong, you can return to the office on Monday morning knowing there won’t be any surprises.

There might not be quite as much glory in fixing problems before they occur, but you and your management will rest more easily. We can’t tell you how to translate that into a higher salary — sometimes it’s better to be the guy who rushes in and fixes things in the middle of a crisis, rather than the guy who makes sure the crisis never occurs. But SNMP does enable you to keep logs that prove your network is running reliably and show when you took action to avert an impending crisis.

Installing and Running WebKit in Linux Using Qt

I’m coming to appreciate more and more all of the hard work software developers perform. I wouldn’t consider myself an open source elitist, but there’s something special about the associated ideologies. When a large community of people band together to work on a project, a lot of fantastic products can be created.

One such product is WebKit, the open source Web browser rendering engine used by Safari (as well as a number of other products). It’s very important to keep in mind that Safari and WebKit are two very different things. Safari is a Web browser that uses WebKit as it’s rendering engine.

The WebKit developers put forth the effort to port WebKit to Qt, which is, as stated by the developers:

Qt is a comprehensive development framework that includes an extensive array of features, capabilities and tools that enable development of high-performance, cross-platform rich-client and server-side applications.

Qt is truly cross-platform and allows deployment on a wide range of hardware configurations, as opposed to other “cross-platform” products that are restricted to Windows and Mac OS X. The fact that the WebKit developers put forth the effort of porting to Qt4 gives users the ability to run their rendering engine on any platform. Thanks to their hard work, it’s quite easy to run a WebKit-based browser in Linux.

Preparing your Linux system for WebKit

I’d like to be explicit in saying that the following instructions are geared towards a fresh install of Ubuntu 7.04, FC8, FC9, OpenSuse 10.3 but should be applicable to a wide variety of other Linux distributions. First and foremost you’ll need to add extra repositories. After you have followed those steps we can begin.

There are a number of packages you’ll need to successfully build a Qt4 Web browser that uses WebKit.

There will be a lot of additional packages to install, so don’t be surprised if the list of packages for installation is significantly large.

Obtaining a nightly build of WebKit

Next, we’ll need to use Subversion to check out the WebKit source. The following command will check out files to a folder titled WebKit within your working directory, so be sure your working directory is appropriate (I used my home directory).

svn checkout WebKit

You will be able to monitor the checkout process as each file is listed in your terminal.

Building your Qt4 WebKit browser

When the checkout is complete, you can initiate the build of your Qt4 WebKit browser using the following command:

QTDIR=/usr/share/qt4/ WebKit/WebKitTools/Scripts/build-webkit

The script will take a minute to prepare the build, and then the process will begin.

This step can take quite a bit of time depending on your hardware configuration, so take a few minutes to have a cup of coffee and relax while your browser is being built. Your terminal will scroll with hundreds of lines of build commands and more, so don’t feel the need to sit and watch it build (unless you’re interested — I was).

Running the browser

A successful build means you can run your Qt4 WebKit browser using the following command:

WebKit/WebKitBuild/Release/WebKitQt/QtLauncher/QtLauncher about:blank

A very basic browser window will appear with limited controls and an address bar. There will be some information scrolling in your terminal, but it can generally be disregarded.

You’ve now got a native WebKit browser to play around with in Linux. I took a second to attach the launch command to an entry in an panel using the WebKit icon. It’s more convenient than keeping the command saved somewhere to copy and paste when I’d like to test in WebKit.

Things to keep in mind

Perhaps the most important thing to keep in mind is that you’re running a nightly build of WebKit, not the build Safari is using. The nightly versions are much more advanced than Safari’s WebKit, so some of the quirks that appear in Safari may be handled in your Qt4 browser.

Due to the version discrepancy, you can’t depend on a nightly build of WebKit sufficing for a legitimate test in Safari. It is useful, however, to take a quick look at overall structural elements of your designs before making the effort of moving to an OS X machine.

and Do export the path variables of QT and the Qt version must be >= 4.3

Happy Rendering