Home » Archive

Articles Archive for March 2011

Featured, Linux »

[27 Mar 2011 | No Comment | ]
Find and Replace with SED

The power of search and replace is prevalent all over Linux. Whether you are using a text editor or on the command line, regular expressions come in handy.

When you are using a text editor such as vi, you are probably familiar with the search and replace feature. From the command line, the find and replace feature is also available if you use sed.

Web »

[21 Mar 2011 | No Comment | ]
How to use *args and **kwargs in Python

Are there times when you want to specify a variable argument list in Python?
This is possible by using *args and **kwargs.
The special syntax, *args and **kwargs, in a function definition is used to pass a variable number of arguments to a function.
The single asterisk (*args) is used to pass a non-keyword, variable length argument list. The double asterisk (**kwargs) is used to pass a keyword, variable length argument list.

Incoming search terms:python kwargspython **kwargspython kwargs example

Linux »

[20 Mar 2011 | No Comment | ]
Boot to single user mode in Ubuntu 10.04 Lucid Lynx

There are occasions when the single user mode comes in handy. Take for example last week. I was messing around with iptables and I added to much restriction on my deny rules. As such, I could not log in to the network and get myself authenticated.
At first, it was very disheartening to find out that you locked yourself out of your own system. On the other hand, it becomes a challenge and you find it a valuable experience. What you find is that whatever you may have done with your …

Programming, Web »

[13 Mar 2011 | No Comment | ]
Python Date and Time

Adding a date or time to your program is really easy with Python. All you have to do is import date or import time and then use the available method calls.

Most likely though, you are here because you need something more than that. You probably need to convert epoch seconds to a date format. You may want to know how to get the difference between two dates.