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.

Friday, November 28, 2008

How to install flash on Linux (the manual and safe way)


Ever had problem installing flash plugin on your Linux machine? Ubuntu has all these different packages that can be used, but I always opted for using the simple manual install.

Here's what you do:

1- Download flash player for Linux (.tar):
http://get.adobe.com/flashplayer/

2- Uncompress the folder and cd into it:
tar -xzvf install_flash_player*linux.tar.gz
cd install_flash_player*linux

3- Add flash the proper folder:
# Firefox 3
sudo cp libflashplayer.so /usr/lib/firefox-3*/plugins/

Open (or restart) Firefox and test your flash player (youtube.com is a good idea).

Acer Aspire One Review


So, a couple of weeks ago I was checking the price of a Aspire One and I could not believe how low it was. At one of the top computer stores here in Canada (canadacomputers.com), a 120GB model was going for about $325.00.

I already have an EeePc 701 (4GB) which is very handy. But the limitation of HD space and size of the monitor was something that kept bothering me (even giving me red eyes).

The AA1 is incredible. My model came with 120BG of disk space, a 8.9 screen with up to 1024x600 resolution (which beats the EeePc's 800x600 resolutions by far), dual core Atom processor and 512MB of RAM. The battery life is actually pretty good for my opinion, but I've read a lot of complaints. I can get close to 2 hours.

I don't have much to say about the original OS. As soon as I got home I attached a USB CD and booted into the Ubuntu install. Followed guides from here, which were pretty easy. I also decided on using Hardy instead of Intrepid. I don't usually keep my OS installs with the latest releases anyways.

Overall it's a great buy for the price. I've heard that some of the new models will allow you the option between 3G and WiMax built-in.

Here are some pics of the unit.

Unit by itself

Compared to EeePC



Box and Packages

Booting on Live CD

Live CD Booted

After installed and customized

More customization

How to Install Script Highlight on vim


Using script highlight is one of the things that will help a “programmer” avoid making mistakes on his script, at the same allowing a quicker and better understanding of the same.

Vim is a great program when it comes to that. A lot of new users are reluctant to use VI (or vim), I was one of them. However after being forced to learn it for my Unix course, I've found that it's a lot better than most other shell text editors. It gives you a wide range of options and commands, at the same time allowing a user who only knows a few commands to use the program.

Like most Linux programs, vim keeps a hidden config file on the users home directory (~/.vimrc). This file can be edited with options to the program. For example, adding the string “set number” will make vim show line numbers.

=> Getting syntax highlight to work.

First thing we need is a .vim file. This file includes a lot of the options on how to highlight the documents. This is fully customizable (you could create one on your own), and you can have one for each type of script. In my case I only use it for bash scripts, so I downloaded bash.vim from here, them saved the file under ~/.vim/syntax/

Now we need to point vim to the syntax file when opening bash scripts. The following lines will do that, as well as enable line numbering:

$ vim .vimrc
set number
syntax on

let X = getline(1)
let y = match(X, "#/bin/bash" )
if (y != -1)
so ~/.vim/syntax/bash.vim
endif
unlet X
unlet y

Last we need to install vim-full as the version of vim included in Ubuntu is a stripped down version.

sudo apt-get install vim-full

Now open one of your scripts and see if it worked.

Thursday, November 27, 2008

Installing Picasa 3 on Ubuntu


If you have been using Picasa on Ubuntu via Wine, I have good news for you. Google has finally released a Linux version (which is at number 3 right now).

Picasa itself has a nice interface (see screenshot bellow), and even allows you to edit some of the pictures.


I use it for very basic tasks; they include viewing a bulk of pictures (or showing them to someone), uploading multiple pictures at the same time to my web Picasa albums, and now a new feature I like that allows you to upload pictures to your FaceBook account.

Enough talking, let's do some installing:

1- Download and install Picasa:
cd downloads ## or any other source or downloads folder
wget http://dl.google.com/linux/deb/pool/non-free/p/picasa/picasa_3.0-current_i386.deb
sudo dpkg -i picasa_3.0-current_i386.deb

2- Now let's setup a button for uploading your pics to FaceBook
picasa picasa://importbutton/?url=http://www.webkinesis.com/fbpicasa/facebook.pbf

You should see the FaceBook button from inside Picasa:


Enjoy!!

Vic.

My List of Aliases


I had a post a while ago that showed how to create aliases on bash to save time on repetitive commands. After a few months I find myself collecting more and more of these shortcuts, so I though I'd share it with you.

## Welcome note
cat $HOME/documents/ascii/welcome_victor

########################
### personal aliases ###
########################

# Basics
alias utar='tar -xvf'
alias utarz='tar -xzvf'
alias tarz='tar -czvf'
alias lss='ls -lh'
alias lssl='ls -lAh'
alias fproces='ps x | grep '
alias datef='date +%Y-%m-%d'
alias datev='date +%V'
alias sano='sudo nano'
alias renpic='e="1"; for i in `ls` ; do mv "$i" "$e.jpg" ; e=$(( e + 1 )) ; done'
alias rezpic50='for i in `ls` ; do convert "$i" -resize 50% "$i" ; done'
alias rezpic75='for i in `ls` ; do convert "$i" -resize 75% "$i" ; done'
alias rezpic20='for i in `ls` ; do convert "$i" -resize 20% "$i" ; done'
alias updatetime='sudo ntpdate ntp.ubuntu.com'
alias playm='mplayer -vo xv '
alias playmrt='mplayer -vo xv -vf rotate '
alias chcalendar='vim ~/.calendar/calendar'
alias lscreen='screen -ls'
alias duchm='du -ch | egrep '[0-9]*M' | sort -n'
alias duchg='du -ch | egrep '[0-9]*G' | sort -n'
alias dfh='df -hT'

# Software Management
alias aptl='sudo apt-get update && sudo apt-get install'
alias update='sudo apt-get update'
alias upgrade='sudo apt-get upgrade'
alias inst='sudo apt-get install'
alias apts='sudo apt-cache search'
alias updupg='sudo apt-get update && sudo apt-get upgrade'

## Networking ##
# WAN IP
alias my-ip='wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -f7 -d"<" | cut -f2 -d">" '
# APs info
alias aps='sudo iwlist wlan0 scanning | egrep "ESSID|Channel|Frequency|Encryption|Quality"'

Monday, November 10, 2008

How to add True Type Fonts to Ubuntu


Ever wanted to add true type fonts to your Ubuntu machine? It's actually fairly simple.

1- Download the .ttf file to your machine
2- Create a new folder for your fonts under /usr/share/fonts/truetype/:
$ sudo mkdir /usr/share/fonts/truetype/myfonts

3- Move the .ttf file to the new created folder:
$ mv [ttf_file] /usr/share/fonts/truetype/myfonts

4- Use fc-cache to add the new fonts to the system
$ sudo fc-cache -f -v

More info on fc-cache:
NAME
fc-cache - build font information cache files

DESCRIPTION
fc-cache scans the font directories on the system and builds font information cache files for applications using fontconfig for their font handling.