Blog is moving

My blog is moving to http://victormendonca.com/blog/. If you are looking for a specific or older post you are in the right place Otherwise check out my new page for more up to date content.

Wednesday, January 23, 2008

Is OSS and GNU killings its own chance due to “extreme” users?


I'm not one to really discuss political views and ideals, also am not good at it. But I would like to share something I experienced at work that made me think about my ideals in regards to Linux against Microsoft.

I have used Microsoft my whole life. I've also started in the IT industry about 2-3 years ago, so I don't consider my self a very experienced person. Around November 2006 I came across a live CD of Ubuntu and decided to give it a try. That's was when I felt in love with the operating system, and I have been using it since them. I've also fallen into the category of Linux users that like to brag that M$ sucks and Linux is the best.

I'm at the moment working for a company that makes proprietary software, but for Windows environment only. I have to tell that I was amazed at how professional they are at this place and how much importance they put into making things right. It really makes it a better of a place to work for. There's no where to grow in the company if I want to invest in Linux, but at least I can continue with my self paced studies for when I consider myself ready.

The main problems happened a while ago. A customer that runs his backbone servers in Linux was having some problems with our software. Our software needs full access to the folders to be able to work, and he was not aware of that. My boss (extremely smart person and a MAC user) knowing that I was a Linux fanboy asked me for help with some testing, and we discovered that all they had to do was change “directory mask” and “create mask” to 777 on his smb.conf, and that should resolve the problem. Again, we do not support Linux for our software, this was just an unofficial help (I'm sure that there could be better ways like using 770, but again I'm not a Linux sys admin).

The person in charge of the IT department (outsourced) made a huge deal about this. Stated that our software was the problem and that we should fix the basic I/O settings of our software. Stated that if not, they would have to look for solutions that would better fit their requirements.

This “IT” person also made fun of my testing stating that they were not using a simple home toy distro like Ubuntu, but a high portable Linux distro.

Our software is the best in the market. The people who use that software on their company also agree, but they'll end up suffering because of an Open Source fanatic that does not want to see the good part of both worlds. He will change the company needs because they don't meet his open source requirements. Shouldn't this be the other way around?

After that I had to hear funny comments, that were somewhat true. Is open source really free after all? On this case, I think it's actually increasing costs than actually help decreasing it. All due to fanaticism.


More info: Post on Ubuntu Forum

Vic.

Monday, January 14, 2008

Google Search Regex


Well, they are not really the same regex as we can use on Linux or programming. But some of the “tags” are pretty good and can help you on a lot of searches.

I've organized them in a manner that I thought made the best sense. But the sites where I got the information from do have them in different others, as well as some other tags that I did not find as important. The links are at the end of the post.


Basic
- "+" - Result must contain word
- "-" - Result must not contain word
- "OR" and "|" - Applied between two words, it will find "this or that", or both. The "OR" operator must be uppercase and have a space between the 2 words on each side. The "|" operator does not need a space between the words
- " "" " - Finds an exact match of the word or phrase
- "~" - Looks for synonyms or similar items. Eg: "~run" will match runner's and marathon
- ".." - Indicates that there's a range between number. Eg: 100..200 or $100..$200
- "*" - Matches a word or more. Eg: "Advanced * Form" finds "Advanced Search Form"
- "word-word" - All forms (spelled, singe word, phrase and hyphenated

Important
- "site:" - Search only one website or domain. Eg: "PC site:wazem.org" will find PC within wazem.org
- "filetype:" or "ext:" - Search for docs in the file type. Eg: "Linux tutorial filetype:pdf" will find Linux tutorial in the pdf format
- "link:" - Find linked pages (pages that point to the URL)
- "define:" - Provides definition for a word or a phrase
- "cache:" - Display Google's cached version of a web page.
- "info:" - Info about a page
- "related:" - Websites related to the URL
- "allinurl:" - All words must be in the URL
- "allintitle:" - All words must be in the title of the page
- "intittle:" - Match words in the title of the page
- "source:" - News articles from a specific source

Calculations
- "+ - * /" - Normal math signs. Eg: 12 * 4 + 2 - 1 /2
- "% of" - Percentage. Eg:10% of 100
- "^" or "**" - Raise to a power
- units "in" units - Convert Units (currency, measurements, weight). Eg: 300 lbs in Kg, 40 in hex

Others
- "book" or "books" - Search books. Eg: book "LPI Linux Certification in a Nutshell"

Links used:
GoogleGuide.com
GoogleGuide.com Advanced Operators
Wikipedia Regex

Friday, January 11, 2008

How to Masquerade Your PC When Connecting to an Unknown Network


Let's say you want to connect to an untrusted network, like school, library or other. All your packets could be traced by a proxy and your computer information as well.

There are many ways to avoid this from happening. The one I'll be describing here will involves connecting to a server on your home running a proxy daemon (like squid) via a secure tunnel (like SSH).

First we need to get squid and SSH server installed on your home server and make sure that your router is open for SSH (or another WAN port that can be forwarded to the SSH server port on your LAN).

You can get more info on this process here, and more info on SSH auto login here. These posts should get you connected to your home server and browsing the web without the proxy on the untrusted network knowing you packets (or what you are browsing).

Next step will be to mask your computer info. I'm not sure how well this would work as far as digital signatures, but it may help with some privacy.

I've created 3 files on my PC to use for a quick connection:
. MAC1 - Changes my MAC address, my hostname and my proxy configuration to 127.0.0.1:80
. MAC2 - Changes my MAC and my hostname to original and disables the usage of proxy
. File3 - A ssh script that binds local port 80 to the ssh tunnel

MAC1
#!/bin/bash

sudo ifconfig eth0 down
sudo ifconfig eth0 hw ether bogus-MAC
sudo ifconfig eth0 up
sudo bogus-hostname
xauth add bogus-hostname/unix:0 MIT-MAGIC-COOKIE-1 `xauth list | grep original-hostname | cut -f5 -d" "`
gconftool -s /system/proxy/mode -t string manual


MAC2
#!/bin/bash

sudo ifconfig eth0 down
sudo ifconfig eth0 hw ether original-MAC
sudo ifconfig eth0 up
sudo original-hostname
xauth remove bogus-hostname/unix:0 MIT-MAGIC-COOKIE-1
gconftool -s /system/proxy/mode -t string none


File3
#!/bin/bash

sudo ssh -v -L 80:squid-server-IP:3128 user@homeIP



Other Links:
- http://sourceforge.net/projects/anonym-os/


Vic

Thursday, January 10, 2008

How to change multiple files into a progressive number order


I'm a big collector of pictures. I usually download pictures that my friends may post on Facebook or other sites for events that I was part of. For Facebook I use a Firefox add-on called Facebook Album Downloader. It will download all pictures for a specific album into your PC. But the problem is, that most of the times these pictures get renamed when uploaded. So you'll end up getting a really weird name for the pictures, which for me, being a freak at organizing my files just doesn't cut.

It's in times like this that I'm glad I use Linux. Here's a little script that will help me to change this.

Let's say I have the following files in my folder:

$ ls -1
fgthnt.txt
sadfasd.txt
sdfsdf.txt
tyhy.txt
ujtyuj.txt
ujyunyum.txt
wdfaw.txt
wertet.txt
werwert.txt
yjmyu.txt
yujjuj.txt


I would like to rename all these files to an organized manner. My pictures are usually named with numbers. I started doing this when I was learning web-design with my brother in law many years ago (never went trough with it thou).

To achieve such task we would run the following code:

E=1; for i in `ls *txt` ; do mv $i $E.txt ; E=$((E+1)); done
$ ls -1
10.txt
11.txt
1.txt
2.txt
3.txt
4.txt
5.txt
6.txt
7.txt
8.txt
9.txt


Breakdown of code:
E=1 - Set a variable of value 1
for i in `ls *.jpg` - Creates variable “i” with individual lines from the output of the command 'ls *.jpg'
do mv $i $E.jpg - Moves value from variable “i” to “E”
E=$((E+1)) - Adds a count of 1 to E, so next file with be E
done - Finalizes it

Another way of renaming files is using the “rename” program. Some Linux distros have it installed by default. The program can be used in similar way to sed. For example, the command below would remove all dashes from all mp3 files in the working folder:

rename 's/-//g' *mp3


Vic.

Wednesday, January 9, 2008

How to change Gnome Proxy Settings on a Terminal window


This document will show how to change proxy settings for Gnome from a terminal window (not from gnome-network-preferences).

The configuration information is saved under .gconf (front end GconfEdior), which is a system for storing application preference in Gnome (think Registry for Windows PC).

Keys can be accessed in terminal under “/home/user/.gconf/*”. The command below will display current proxy configuration loaded by gconf:

$ cat .gconf/system/http_proxy/%gconf.xml


This will be the same as:


The proxy configuration can be divided into two parts:
. /system/proxy/ - Configures SOCKS Proxy
. /system/http_proxy/ - Configures HTTP proxy

We can use gconftool -R to view the options within the subkeys. For the screenshot above we would get something similar to this:

$ gconftool -R /system/proxy
old_ftp_port = 0
socks_host = 127.0.0.1
mode = manual
old_socks_port = 0
secure_host = 127.0.0.1
ftp_host = 127.0.0.1
socks_port = 80
old_secure_host =
secure_port = 80
ftp_port = 80
old_ftp_host =
autoconfig_url =
old_secure_port = 0
old_socks_host =

$ gconftool -R /system/http_proxy
use_http_proxy = true
use_authentication = false
host = 127.0.0.1
authentication_user =
ignore_hosts = [localhost,127.0.0.0/8,*.local]
use_same_proxy = true
authentication_password =
port = 80


So, to edit the proxy to the same settings as the one shown on the screenshot, we would do the following:

$ gconftool -s /system/http_proxy/use_http_proxy -t bool true
$ gconftool -s /system/http_proxy/host -t int 127.0.0.1
$ gconftool -s /system/http_proxy/port -t int 80
$ gconftool -s /system/http_proxy/use_same_proxy -t bool true

$ gconf -s /system/proxy/mode -t string manual



Vic.

Wednesday, January 2, 2008

Step by Step Installation of Slackware with Screenshots


I've heard that the installation of Slackware is hard, mostly due to the fact that its via CLI. I myself am not an expert on CLI, even thou I like using it, and I try to as much as I can. But I decided to give it a try on my VirtualBox as my Gutsy install on my laptop has been a little “flaky”, and Slackware is famous due to it's speed and stability.

I've divided into steps, according to the screenshots I took.

Download the first two CDs from Slackware website here.

1- Pop it in your machine and reboot it, or start it. You will get a prompt like the one bellow (click on the picture for a bigger size), asking you for boot options. You can usually leave this blank and just hit enter.



2- If you want to enable special characters for your language, you can do it here (this can also be done after the installation)



3- Logon to the CD as root



4- Now the partitioning part. This what most people are afraid off, and it's really quite simple. Type “fdisk ” to start the utility. Device name will most likely be /dev/hda if you are using your first hard drive. I always create a minimum of 3 partitions (one for /, one for swap and one for /home). The commands we can use are:
- n - New partition
- t - Filesystem type (we will use type 82 for the swap partition)
- p - Lists changes
- q - In case you want to quit without saving it
- w - Saves changes and exits

The commands I used were
- First Partition - n, p, 1, Enter, +5000M.
- Second Partition (swap) - n, p, 2, Enter, +256M
- Third Partition - n, p, 3, Enter, Enter
- Second Partition - t, 2, 82
- Enter “w” to save the changes



5- Type “setup” to enter the setup utility



6- This is the main setup menu



7- There are a couple of things we need to take care first. If you try clicking on install, you'll get a msg reminding you so



8- Click on target and we will be able to setup the partitions and mount points. On this picture I've already done “/”, but we can still do the next partition



9- Select if you want to format it



10- Select the filesystem format for the partition



11- This confirms that it's formating the partition



12- Name the mount point



13- This screen confirms the selections



14- Go back to the main menu and select Addswap to configure the swap partition



15- Say yes if you want to check the swap partition for bad bocks. Not really required



16- Summary of changes to the swap partition



17- Select the partition to install the system (/)



18- Select the source to install from (in our case CD)



19- Select packages categories that you want to install. I left all packages, except games



20- Select packages that you want to install. I used the “full” selection



21- The install will displays the packages being installed



22- Insert the second CD when you see this prompt



23- Option to create a boot USB or not. It's useful but not necessary. You can also use the CD to boot into the system (I had to do this due to a LILO problem)



24- Setup a modem. I'm not using one, so I did not set it up



25- LILO Installation. I used the simple, which is the recommended, but I still had some (minor) problems



26- Select boot splash screen resolution. Again, better be safe than sorry, so I used the standard



27- Enter boot parameter if required for your machine to boot



28- Choose the location to install LILO. I chose the first, or root, partition and had a problem due to the 1024 cylinder rule. I would advise using MBR if you are not dual booting.



29- This is what I got due to LILO installation error. Not to worry, I will show how to resolve it



30- Setting up a mouse. Choose the type of mouse you will be using in the machine



31- Say yes to load an application that will allow you to copy and paste between virtual consoles using the mouse (usually the middle click)



32- Configure Network. I'd choose yes and get it over with. It's fairly simple



33- Give the computer a hostname on the network



34- Enter a domain name. Not really necessary



35- IP configuration (pretty basic)



36- This is only used if you chose DHCP and your DHCP server requires you to use a pre-set hostname



37- Summary of your choices



38- Select services that will start on boot. I've set my machine to basics (like no HTTP or MySQL)



39- Option to configure console fonts. Again, I went for the defaults to make it simple



40- This will sync the time on your OS with the time on your BIOS. I'm using local time



41- And here is my location



42- Choose your Window Manager. KDE which is usually the default, has it's own Window Manager, also called KDE. You can get more info on the difference between Window Managers, Desktop Environments and X Server on these links:
Window Manager vs Desktop Environment vs X Window
Desktop Environments



43- Set root password



44- Setup is complete




Now, we'll go into setting up LILO, in case you also got an error

1- Place CD 1 in the machine and enter the parameters shown on top “hugesmp.s root=/dev/hda1 rdinitd= ro”. This will use the CD to boot into your new installed system



2- Once it finishes the boot process, logon as root with the password you set during the install and run “liloconfig”



3- Installing LILO



4- Once done, type “lilo” to write to the lilo.conf file



5- Restart the computer by typing “shutdown -r now” and remove the CD



6- You are done. Here's your LILO boot prompt




Remember that Slackware will not start the X server by default. To do so, logon at the CLI prompt and type “startx”.


Vic.