Tuesday, March 17, 2009

Sending simple email using python

Source http://snippets.dzone.com/posts/show/658

In my case, I can send simple email using smtplib but the I received empty/blank email which is without From/To/Body appeared on my email client (Thunderbird).

So you need to wrap your email with email.MIMEText as sample codes bellow:

import smtplib
from email.MIMEText import MIMEText

def sendTextMail(to,sujet,text,server="localhost"):
fro = "Expediteur "
mail = MIMEText(text)
mail['From'] = fro
mail['Subject'] =sujet
mail['To'] = to
smtp = smtplib.SMTP(server)
smtp.sendmail(fro, [to], mail.as_string())
smtp.close()

sendTextMail("toto@titi.com","hello","cheers")


Warning: mkdir() [function.mkdir]: Permission denied on Fedora

Source http://gallery.menalto.com/node/42302#comment-176477

The problem in my case was that I had the SELinux's security features enabled in my Fedora Core 4 setup. I switched SELinux to permissive mode by editing /etc/sysconfig/selinux -
putting SELINUX=permissive.

There's probably a nicer way than just disabling the security but I was after a simple solution. SELinux FAQ is here.

You need to reboot to make it effective.

Friday, January 16, 2009

IBM Lotus Symphony

One more alternative for free Office Suite on Ubuntu Linux is IBM Lotus Symphony.
We can get it on http://symphony.lotus.com/ .

Thursday, January 15, 2009

Setting up Bridged Network

I need to set up bridged network for my VirtualBox guess OS to have a network connection attached to host interface.

So I install bridge-utils package :

$ sudo apt-get install bridge-utils 

I need to add some lines in /etc/network/interfaces

auto br0
iface br0 inet static
address 192.168.10.102
netmask 255.255.255.0
bridge_ports eth0

You have to bring up br0 manually for now.


sudo /etc/init.d/networking restart
sudo ifup br0


I think, that's it. VirtualBox 2.1.0 doesn't need TAP or TUN interface.
br0 will recognized in the Host Interface list in network setting part for guess OS.
Due to I set my br0 to static IP, I also need to set my network interface in guess OS to static IP (e.g 192.168.10.101) .

Wednesday, January 07, 2009

Disable Touchpad on Gnome

It's annoying when you typing some thing suddenly your pointer fly-away somewhere else coz you inadvertently touch the touch-pad with part of your hand.

There are two way to disable/enable thouchpad in Gnome :
1. Go to menu on "System" -> "Preferences" -> "Mouse"
Click on "Touchpad" tab and [un]check "enable Touchpad" below "General" section.

2. Open Terminal [Command line box / console].
To disable, execute :
gconftool -t bool -s /desktop/gnome/peripherals/mouse/touchpad_enabled "f"


To enable, execute :
gconftool -t bool -s /desktop/gnome/peripherals/mouse/touchpad_enabled "t"

Friday, August 08, 2008

Cingular 3G LaptopConnect Card Option GT Max(R) 3.6

Update for Ubuntu 8.10

It's a great discovery that 8.10 can handle Cingular 3G LaptopConnect Card Option GT Max(R) 3.6 out of the box. You don't need to use application from forge.betavine.net .

You just need to fill out the form that pop-ups.
Great jobs for Ubuntu 8.10 team, two thumbs up !!

__________________________
If you have Cingular 3G LaptopConnect Card Option GT Max(R) 3.6 then you need the driver and application to use it on Ubuntu Hardy Heron.
You can get it at :
https://forge.betavine.net/projects/vodafonemobilec/

And then follow the Download link.
In my case I use vodafone-mobile-connect-card-driver-for-linux-2.0.beta3-ALL-i386-installer.run one. You may find newer version.
You just run it and enjoy the HSDPA connection.

Thursday, July 31, 2008

To change the default application to open a certain file type

In my case, I want to change the default application to open my PDF file with Adobe Reader 9 instead of Evince Document Viewer (default from clean Ubuntu installer).

First, open the folder where your file (my PDF file) is reside. Then, right click on the file. And then select the "Properties" menu.
A new window will pop-up, and you need to select the "Open with" tab.
Then select the application you want to open the file by default of double click it.

Monday, June 02, 2008

Modem Conexant HSF di Ubuntu 8.04

UPDATE :
Dell has the driver that easy to install at
http://linux.dell.com/files/ubuntu/hardy/modem-drivers/hsf/

To install should be as easy as :
sudo dpkg -i hsfmodem_7.68.00.09oem_i386.deb
___________________________________________
This
link is in Bahasa.
I translate it a little bit.

To install the Conexant Modem Driver you need to do these steps :

sudo apt-get update

sudo apt-get install build-essential

wget http://www.linuxant.com/alsa-driver/alsa-driver-linuxant_1.0.16.1-1_all.deb

sudo dpkg -i alsa-driver-linuxant_1.0.16.1-1_all.deb

wget http://www.linuxant.com/drivers/hsf/full/archive/hsfmodem-7.68.00.09full/hsfmodem_7.68.00.09full_i386.deb.zip

unzip hsfmodem_7.68.00.09full_i386.deb.zip

sudo dpkg -i hsfmodem_7.68.00.09full_i386.deb

Done. And restart your Ubuntu box.

Web page screenshot grabber for Firefox

Do you need a screen shot to grab the whole page in an important website ?
You only need to get a add-on module for your Firefox. It's a Screengrab!

Enjoy it.

Wednesday, May 14, 2008

Invalid MIME gxine.desktop

On Ubuntu 8.04 I try to install opera
opera_9.27-20080331.6-shared-qt_en_i386.deb
At the end of installation there is a message like below:

File '/usr/share/applications/gxine.desktop' contains invalid MIME type 'x-content/video-vcdx-content/video-vcd' that has more than one slash

I open the file and insert a semi-colon, so it become like this :
x-content/video-vcd;x-content/video-vcd

Sunday, May 11, 2008

Ubuntu 8.04 broken Intel ProWireless 3945 driver

It is a great disappointment that Ubuntu 8.04 has a broken driver. It is only for the first time installed, the driver is working. But after I pushed the wireless button to disable the wireless it never get up again.

So, I search for the workaround and I found it.
But the way is not good enough for me. The wireless button light is always off although the wireless is on.
You can run these command :
sudo rmmod iwl3945; sudo modprobe iwl3945

Then I use ndiswrapper to use win32 driver for Intel ProWireless 3945.
It's OK then.
-------------------------------
Update

Install ndiswrapper.

$ sudo apt-get install ndiswrapper-utils-1.9

Get the win32 driver. I got it from www.intel.com. Search the driver for "Intel ProWireless 3945". Unpack the package.

Run the ndiswrapper, from "System" -> "Administration" -> "Windows wireless driver".
Select the one *.INF file. For me it was the "NETw4x32.INF" .

If there is no error then it should be OK.
Have fun with your wireless.

----------------------------------
More update

From : http://moustafaemara.wordpress.com/2008/06/09/fixing-intel-wireless-card-3945abg-defination-in-ubuntu-804-hardy/

When i First Installed Ubuntu 8.04 i was really happy , but i got shocked when i found that my intel wireless card is not working , The system appears to see it but i cant connect nor search for networks .

After a lot of search in the ubuntu , I found that this was a formal ubuntu 8.04 Bug… Here It is

So I found a Solution Here , I tried making it more usable , Here it is , Open up your lovely Terminal

* sudo bash ( Just to make it more easy )
* modprobe -r iwl3945
* Navigate to /etc/modprobe.d command ::: cd /etc/modprobe.d
* Create file named iwl3945 command ::: touch iwl3945
* Open The File command : gedit iwl3945
* Add The Following To the File
o alias wlan0 iwl3945
o options iwl3945 disable_hw_scan=1
* Save The File and exit
* modprobe iwl3945
* sudo ifconfig wlan0 up

Now You will find networks jumping into your wireless networks list
---------------------------
Update for 8.10

In my case, it still can not work properly.
The workaround I use is the last update I wrote.
I add a shortcut to run "sudo ifconfig wlan0 up".
So, after I click the wireless button to turn-off the wireless I still can not to turn-on by clicking it again. But I can turn the wireless on by running this shortcut.

Thursday, March 06, 2008

openSUSE

I just tried openSUSE with the main feature is KDE4 ...


Quite cool ... but one thing make me drop it. It didn't include bluetooth stack by default. So I can't connect to internet due to my main connection is via bluetooth + GPRS mobile phone.


Wednesday, March 05, 2008

Oracle Environment shell script on Ubuntu

I install Oracle 10g Express edition in my Ubuntu machine from oracle-xe_10.2.0.1-1.0_i386.deb
Before that you need to install a library : libaio1 .

To run sqlplus you need to run a shell script first to update your environment variables. The script is at /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh .
But I got this error line twice each time I run the script.

/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh: 114: [[: not found


You need to edit the /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh
at these lines :

if [[ -n "$LC_ALL" ]]; then
locale=$LC_ALL
elif [[ -n "$LANG" ]]; then

Edit [[ to [ and ]] to ] , so it will be like these :

if [ -n "$LC_ALL" ]; then
locale=$LC_ALL
elif [ -n "$LANG" ]; then


Actually I don't know is there any side effect but as long as I use it there is no problem with my revised nls_lang.sh .
So, if you have any better solusion please comment this post. Thank you.

Blank Netbeans 5.5 on Ubuntu

Did your netbeans 5.5 can not start ?
After I installed netbeans5.5 and netbeans5.5-platform in my Ubuntu machine. I started the netbeans from menu but only shown a blank window.
I found the solution for this issue from ubuntu forum article .
It's due to the Swing is not compatible with Beryl. You need to set your desktop visual effect to "None".
You do that from the Desktop menu "System" >> "Preferences" >> "Appearence" >> "Visual Effects" tab , and select "None" .
Other choices will activate Beryl, so Netbeans can not display anything inside the window.

Blogged with Flock

Tuesday, February 19, 2008

WordpressMU with wp-phpmailer and WP e-Commerce plugins



First install WordPressMU from here.
+ Open the package file
+ I placed the files in /var/www/wpmu
+ sudo chown -R www-data:www-data /var/www/wpmu
+ Create/edit /etc/apache2/site-available/wpmu

<virtualhost>
ServerName wpmu.localhost.localdomain
DocumentRoot /var/www/wpmu
<directory>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</directory>
</virtualhost>


+ sudo a2ensite wpmu
+ sudo /etc/init.d/apache2 reload
+ sudo vi /etc/hosts, add wpmu.localhost.localdomain on 127.0.0.1

127.0.0.1 localhost localhost.localdomain wpmu.localhost.localdomain



+ Create MySQL user & database name it both : wpmu
+ open-up http://wpmu.localhost.localdomain
+ just fill-up the fields
+ OK. wpmu should be up and running

I try to create a new blog.
Somehow wpmu send activation/password via email but I don't remember I ever setting some SMTP or else in wpmu. No wonder the email never come.
I search this issue and I got this link .
You need to download this plugin.
After you extract the plugin to /var/www/wpmu/wp-content/plugins/, you need to activate it via plugins menu with admin user.
And set the SMTP server under Options menu.

Other plugin you may have interested as I need to search a shopping cart with multiple store support is WP e-Commerce.

Some issues with wordpress :
- the mail notification didn't report any error even when there is no mailer installed.
- cannot delete user before the user is active. I need to wait until 2 days when automatic removal removed the user that did not confirm the activation.

Friday, February 15, 2008

Conexant Modem driver for Ubuntu 7.10

As my previous problem with my modem on HP 520 Intel Core Duo.
I found this driver at DELL support wiki.

Please check above link and follow the installation instruction.


Sunday, February 03, 2008

Windows Vista installer partition tool screwed my linux part


Last weekend I need to install Win Vista on my notebook as a second OS after my Ubuntu 7.10 .
Of course I select to manually setup the partition for it. I have 1 empty partition on the end of my disk. After I select my last partition, and recreate NTFS then the nightmare is begun (it was literally in the middle of the night).
I lost my home partition (partition where my /home folder reside).
I think it's because the partition number is bigger than the new created NTFS partition.
Do you got it ? OK, let me list my partitions :
1. FAT32 /dev/sda1
2. Linux ext3 / (root) /dev/sda2 <<< Ubuntu
3. Linux swap /dev/sda3
4. Logical part /dev/sda4
5. Linux ext3 /home /dev/sda8 <<<<< look, the number is not sequenced
6. Linux ext3 (public) /dev/sda5 <<< I mounted somewhere as shared public
7. Linux ext3 / (root) /dev/sda6 <<< Mandriva (I planned to remove it later)
8. Linux ext3 (spared space) /dev/sda7 <<< this was the part that I changed to NTFS

After I boot from Windows Vista CD then I select to manually setup my partition.
The process should be as simple as to delete /dev/sda7 and create the NTFS partition. But, then I saw that my number of partition is wrong. Somehow the tool screwed up my disk.
So, I lost my /dev/sda8 .....
After I installed Windows Vista I looked for Linux partition recovery tool. I found 2 tools that is free. First is the DiskInternal Linux recovery version 1 (don't use the last version coz it somehow hanged-up when I want to save the recovered folder). But it can only recovered the tree structure and filename. When I check the content of the file, it just a mess of bytes.
So, I use R-Linux from R-Tools. Yes, it can be use to recover ext3 FS not just ext2. ... It was quite confusing how to use it. But finally I got it. Then my files was comeback to me again ....

Friday, February 01, 2008

Ubuntu 7.10 + gprs Nokia E61 + internet sharing with WiFi

We can have peer to peer (ad-hoc) WiFi for sharing internet connection with another PC/Laptop.
In my notebook HP 520 Intel Core Duo, I create couple files for this purpose :
Also I use wvdial to dial Nokia E61 modem.

1. Bash script file, you can name it as 'internet_sharing.sh'.

#!/bin/sh
#########internet_sharing.sh#############

# released old rfcomm0 connection
sudo rfcomm release 0
sleep 3
# bind my E61 via bluetooth, provided you already paired it
sudo rfcomm bind 0 00:12:D2:6B:1F:4F 2
sleep 5
wvdial -C btcentrin.wvdialconf &

## eth1 is my WiFi
sudo iwconfig eth1 mode Ad-hoc channel 1 ESSID migenet

## sharing the WiFi
sudo modprobe iptable_nat

## You may need one of these lines to set the ip_forward
# sudo echo 1 > /proc/sys/net/ipv4/ip_forward
# sudo systcl -W net.ipv4.ip_forward=1

sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

sudo iptables -A FORWARD -i eth1 -j ACCEPT

#########internet_sharing.sh#############


2. btcentrin.wvdialconf file . Centrin is my gprs provider .

[Dialer Defaults]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","centrin.net.id"
Modem Type = Analog Modem
Phone = *99#
ISDN = 0
Username = johndoe
Init1 = ATZ
Password = thesecret
Modem = /dev/rfcomm0
Baud = 115200


Then you just run the internet_sharing.sh file.
And your partner PC/Laptop just need to set the appropriate WiFi ESSID and key.

Wednesday, January 30, 2008

Another problem with HP 520 Intel Core Duo notebook with Ubuntu 7.10 GG.

I can not use the modem.
How can I check what is the modem type ?
Or somebody already success to dialup ?

Tuesday, January 29, 2008

Hi Folks ...

Since last October '07 I use Nokia 3500c (classic).
I tried to connect with Wammu on Ubuntu 7.10 GG but can't connect at that time.
I don't know what the system updates but currently It can communicate with the mobile using bluetooth.
Wammu can retrieve Info, Contacts and Calls records. Still can not retrieve Messages, Todos and Calendar.
The Wammu version is 0.22 running on Python 2.5.2 using wxPython 2.6.3.2 , python-gammu 0.22 and Gammu 1.13.0.