If you want your router to assign a static IP on a specific Linux Machice you just have to edit /etc/network/interfaces to look like below.
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface allow-hotplug eth0 iface eth0 inet static address 192.168.1.120 # The static IP netmask 255.255.255.0 broadcast 18.104.22.168 gateway 192.168.1.1
Χθες κατάφερα να παρευρεθώ στη πρώτη για φέτος συνάντηση της ελληνικής κοινότητας προγραμματιστών Java.
Το ξέρω μπορεί να ακούγεται κάπως καθώς δηλώνω fan της Python… 😛
Επρόκειτο για ένα καφεδάκι μεταξύ είκοσι και πλέον ατόμων με στόχο να συζητηθεί το μέλλον της κοινότητας και οι μελλοντικές της δράσεις. Τα άτομα ήταν κυρίως επαγγελματίες αλλά υπήρχαν και μερικοί φοιτητές… όπως εγώ άλλωστε! Αυτό που μου άρεσε, είναι ότι η κοινότητα έχει σαν στόχο πέρα από την ανταλλαγή γνώσεων πάνω στα σχετικά με Java και software engineering θέματα, και την καλύτερη δικτύωσή των developer σε θέματα εργασιακά! Πράγμα που σπάνια βλέπει κανείς στις ελληνικές κοινότητες, είτε επειδή αυτές στεγάζονται στα Πανεπιστήμια και όλοι ξέρουμε τα προβλήματα που υπάρχουν, είτε επειδή αποτελούνται κυρίως από φοιτητές.
Ακόμα να σημειώσω ότι γίνεται η προσπάθεια εκτός από τα κλασσικά meeting να διοργανώνονται και κάποιες ημερίδες μία στο τόσο, με πραγματικά πολύ καλούς ομιλητές (από ότι μου δόθηκε να καταλάβω) πολλοί από τους οποίους μάλιστα είναι από μεγάλες εταιρίες του εξωτερικού!!! Προσωπικά πιστεύω ότι αξίζει να αφιερώσετε το χρόνο σας σε τυχών μελλοντική συνάντηση.
Κλείνοντας αυτά τα ολίγα… παραθέτω το link με τα αποτελέσματα της συνάντησης όπως αυτά γράφτηκαν στην mailing-list.
In this post I am not going to analyse the positive or negative (there is nothing negative :P) aspects of Debian.
I suppose that you know why Debian is such a good distro (number of packages, stability, rolling distro) and you want to install Debian but you are scared of the process. Actually it isn’t as difficult as it may sound. There is the easy way that you just install everything that the installation CD tells you or you can do something like the followings. My way of installing the Debian may be a little more ( 😯 ) complex but after understanding it, the whole process will be quite automated and quick.
Today a corporation send me an email that had a really weird attachment.
The attachment’s name was winmail.dat (it can be named also as win.dat) and the weird part was that I couldn’t open it.
So, I started searching for this type of file and I found out that this was something common. It was actually a proprietary E-mail attachment format, used by Microsoft Outlook and Microsoft Exchange Server named Transport Neutral Encapsulation Format, for information packaging. I hadn’t ever came across with it because me and most of my friends and colleagues are using programs with more open formats…
There are programs that can decode those files and hopefully for me, for my Thunderbird, there was the LookOut extension. I must say that many of the mail clients make this decoding by default.
So why am I telling this story?
Because I just can’t understand, which is the potential profit from something like that… I am sure that something will be there… Am I? Nowadays?!
Anyway, for all of you that are using Outlook, you can overpass this encoding when you are sending mails with attachments, by sending them in plain text instead of rich text format.
If you have time and you are not bored, check this out.
Ok this is a very bad bug…
In the past, I was searching for a whole day to find out what was going wrong with a program (SUN SPOT Manager) that I wanted to run and now again for another two!
And all that, just because I had lost the link with the solution.
The problem turns up with java programs, running on Debian (squeeze), that have to access IPv4 addresses and the network, for some reasons, seems to be unreachable.
The “solution” is simple. You just have to run the following command:
sudo sed -i 's/net.ipv6.bindv6only\ =\ 1/net.ipv6.bindv6only\ =\ 0/' \ /etc/sysctl.d/bindv6only.conf && sudo invoke-rc.d procps restart
If you want to see more about this bug, have a look at this.
Also, if you are not bored, check this out… and you ‘ll understand the use of this kernel variable (net.ipv6.bindv6only), that creates the problem.
Today I was searching for a way to run a bash command, that needed superuser’s permissions, from a python program that I had made… The problem was that I had to find a way to interact with the bash and when I would be asked for the password, the python program would answer with it.
So after some googling I found that awesome module called Pexpect , tested in Python 2.5, that allows to your python program to control and automate other programs.
As mentioned in its official site, Pexpect is basically a pattern matching system. It runs programs and watches output. When output matches a given pattern Pexpect can respond as if a human were typing responses. So it is very useful to automate some procedures, and others like testing and screen scraping. Also Pexpect is pure Python so it works on any platform that supports the standard Python pty module.
But enough with that!
Here is the code that I was talking about:
# This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # Author : Aravanis Konstantinos # Author's url : http://AravanisKostas.com # Author's email : email@example.com # # Tested in Python 2.5.5! import pexpect import getpass class suError(Exception): """ A new exception. It is used from the su function, if there is a problem. """ def __init__(self, value): self.value = value def __str__(self): return repr(self.value) def su(command, password = None, prompt = "Enter SuperUser Password: ",\ attempts = None): """ Function that ran a command with superuser's permissions. @command : the command that must be ran with superuser's permissions @password : the superuser's password. @prompt : the message that will be printed to inform that will ask for the password, if it wasn't set. @attempts : the number of attempts. If it is not set then the program will attempt for ever to gain the superuser's permissions. If the attempts were set to zero, the program will still run for a time. """ # decrease the number of the remaining attempts if attempts: attempts = attempts - 1 # if the password hadn't been given then ask for it (from the # command line) if not password: password = getpass.getpass(prompt) # the command must be ran with superuser's permissions child = pexpect.spawn('su -c "' + command + '"') # when the password is asked, send it choice = child.expect(['Password:']) child.sendline(password) # check to see if there was an Authentication failure or else that # there was no problem choice = child.expect(['su: Authentication failure' ,pexpect.EOF]) # if there was an Authentication failure, ask again for the password if choice == 0: # if the max number of attempts was reached if attempts < 1: raise suError("Too Many Attempts!") su(command, attempts = attempts) # return success return True
And if you want to test it:
############ # test it! # ############ try: su("echo su_test_text > su_test_file", attempts = 3) except suError: print "No other attempts left!"
I have written a tutorial (in Greek) for the TasPython.eu about the Mercurial, which is a version control system, that can help you to work in your code and documents. Actually it helps you to get releases of your work easily and merge it with other patches! It is also a very good way to be more productive and to work faster with your colleagues. There is no developer, who doesn’t use a version control system in his work. In my opinion, Mercurial is one of the best options and that’s because it offers you, a de-centralized solution!
In this tutorial you will find:
- Repository Creation
- Add/Delete/Rename files at the Repository
- Commit to Repository
- Desultoriness between the releases
- Multiple repositories in order to administrate projects in which many developers may work. Issues like pull, push and merge
- A little about Diffs – Patches
- And many other introductory subjects