Wednesday, November 17, 2010

Installing Stata 10

This post is a summary of the way I installed Stata 10 in my computer. However, the first thing I did was to check a couple of places to get an idea of how to start the process (the best site where I found info is Andrew Dyck's blog). As a consequence, the info presented in this post is not original at all, but summarizes step by step what I had to do to get Stata working on my system.

  • In order to use the GUI, Stata will call two libraries: libtiff.so.3 and libgtksourceview1.0.so.0 (these libraries are not needed if you want to run Stata on a terminal mode). 
    • Go to System -> Administration -> Synaptic Package Manager and checked whether the package libgtksourceview1.0 is installed. If not, mark it (it automatically installed all required dependencies) and install it.
    • For some reason, Ubuntu 10.10 has the libtiff.so.4 installed, which at first glance should not create any problem, but it does. The solution is to create a symbolic link, which you do by running the following command (in the terminal): sudo ln -s /usr/lib/libtiff.so.4 /usr/local/lib/libtiff.so.3 
  • Now your system should be ready to correctly execute Stata (GUI), so all we have to do is to install the software. 
    • Create the directory whether Stata will be installed. I recommend to follow Stata's instruction and create a folde in the /usr/local folder. This is done by running on a terminal: sudo mkdir /usr/local/stata10 . Move to this foloder: cd /usr/local/stata10.
    • Go to the folder where you have the software (usually the CD unit) and run the install script: sudo /media/cdrom/install . Follow the instructions in this script.
    • After the installation has ended, run the licence script: sudo ./stinit Here you'll have to enter the licence info that came with the software.
  • You're done! All you have to do now is to run ./stata to have Stata on the command line or ./xstata to lunch the GUI. If you want you can add Stata to the Menu right-click on Ubuntu Menu and select Edit Menus. Click on the submenu you want Stata to appear (I out it on Office) and click New Item. Complete the required info. To change the default icon (and use Stata's), go to the CD and click open stata10.ico with some graphic program (I used Inkscape) and save it as svg in the /usr/local/stata10 folder. You should now be able to select this icon as your default icon by clicking on the icon image in the create launcher window.

Wednesday, March 25, 2009

How to modify an application icon

Have you ever tried to change an application icon such that all files associated with that application show this same icon? If you have but have been unsuccessful, you may be interested in this post. I will show how to change the icon associated with pdf applications, though it'll be clear you can do the same with whatever other application.

1) Locate the desired icon you want to use as default for your pdf files (I took mine from this website).

2) It is advisable that you generate a svg file using the png icon image found above. You can do this by opening the icon file with Inkscape Vector Graphic Editor.

3) Go to /usr/share/icons/gnome/scalable/mimetypes directory and do a ls -l gnome-mime-application-pdf.svg. In my case, this symbolic link was pointing toward x-office-document.svg, which means that pdf files were using the oo generic icon as default.

4) Create a new symbolic link:
ln -s pdf_icon.svg /usr/share/icons/gnome/scalable/mimetypes/gnome-mime-application-pdf.svg

where pdf_icon.svg is the name of the icon I created in step 2.

5) Go to /usr/share/mime/packages and type (to create a backup just in case):

sudo cp freedesktop.org.xml freedesktop.org.xml_backup


6) Edit the freedesktop.org.xml file (type sudo gedit freedesktop.org.xml)

7) In the entry corresponding to the mime type you want to modify (in this case application/pdf), change the line that says generic-icon name="...." so it looks like generic-icon name="pdf_icon.svg"

8) Save the file.

9) In a terminal, type gconf-editor

10) Go to apps-->nautilus-->preferences. Look for the entry: show_image_thumbnails and change it to never.

11) In the terminal, type run killall nautilus

You should now see all pdf files with your new icon.

Enjoy!

Wednesday, February 4, 2009

Mail-Notification with SSL/TSL support

The idea with Mail Notification is to run a small application that alerts you about new emails. This is a very desirable thing because almost all email applications (such as thunderbird) are heavy in the use of computer resources. Moreover, the ones that have an email notification built in (evolution for instance) may just not be counted among your preferred ones. Mail Notification avoids having to keep your email application always open in order to get alerted of the arrival of new emails.

One problem with Mail Notification is its lack of support for secure protocols, such as SSL/TSL (it appears to be a problem with the license, see this forum for more on this). However, it is not difficult to enable SSL/TSL support, though you'll have to compile Mail Notification from source. The following procedure illustrates how to get MAil Notification with SSL/TSL support enabled in Ubuntu Intrepid (I modified/adapted the steps that follow from this nice post).

0. If you want to save some time, get sudo access by typing sudo su followed by your passwd. If you do this, you won't have to write sudo everytime you want to run apt-get. In what follows, I assume you've done this so I'll save the sudo in front of every command line I type below.

1. Move to the /tmp directory.

2. Get the source packages for mail-notification package. In a terminal, run:

apt-get source mail-notification

This will give you a subdirectory (and other packages) with the sources to build mail-notification (in my case I got the directory /tmp/mail-notification-5.4.dfsg.1).

3. Now you need to get all the development packages needed to compile the mail-notification package by running:

apt-get build-dep mail-notification

This command line can be used whenever you want to build something from source and are unsure about the 'development packages' that particular application needs. It will download a lot of stuff but later you can delete the unnecessary things by running sudo atp-get autoremove.

4. Get the development package necessary to compile mail-notification with SSL support:

apt-get install libssl-dev

5. Move to the mail-notification-5.4.dfsg.1 directory (cd mail-notification-5.4.dfsg.1 will do the trick since you already are at /tmp). Within the mail-notification-5.4.dfsg.1 directory, go to debian (so you end up at /tmp/mail-notification-5.4.dfsg.1/debian) and type

gedit rules

You should get a file with lots of stuff. Look for the following section:

configure: configure-stamp
configure-stamp:
dh_testdir
./jb configure ssl=no sysconfdir=/etc destdir=$(DEBIAN_DIR)/tmp/
touch $@

Change the line that ./jb configure ssl=no to ./jb configure ssl=yes. Save and close this file.

6. Modify the changelog file to let eveyone who uses your compiled package know what this change is about. Do this by editing the changelog file (gedit changelog). I wrote something like this at the beginning of the file:

mail-notification (5.4.dfsg.1-1build1a) intrepid; urgency=low

* Enable SSl/TSL support.

-- Cristian Troncoso-Valverde Wed, 04 Feb 2009 11:43:18 +1100


7. Finally, come back to the /tmp/mail-notification-5.4.dfsg.1 directory and issue the following command::

dpkg-buildpackage -uc -b

(type dpkg-buildpackage --help to see what the role of -uc and -b is).

8. Type cd .. to get back to the /tmp directory. Now type ls. You should see a file with .deb extension (something like mail-notification-evolution_5.4.dfsg.1-1build1a_amd64.deb). This is your mail-notification package ready to be installed in your system. To install it you can open nautilus and click directly on this file or you can issue the following command:

dpkg -i mail-notification_3.0.dfsg.1-3ubuntu8a_i386.deb


9. Once installed, go to System -> Preferences and click on Mail Notification. When you add a new account, you should see that SSL/TSL support is now enable so you can set it up for your email account.

10. Enjoy!

Sunday, February 1, 2009

SSHFS on Ubuntu Intrepid

SSHFS is a protocol based on ssh that can be used to mount a folder remotely on your local machine. It's a very effective way to treat folders located on remote machines as if they were part of your local machine folder. For instance, you can use the DVD burner on your laptop to burn nice DVD's without having to actually download all those pictures you have on your old home's desktop computer.

In what follows, I will assume you have ssh already installed in both machines (the remote and the local one). Here are the steps I followed to get SSHFS working on my laptop:

1. Install sshfs by running on a terminal the following:

sudo apt-get install sshfs

(some dependencies will also be installed here).

2. Create a local mount directory. You can create this folder wherever you like but make sure that you're the owner of the directory. For instance, I create the folder remote on my media directory and then change the ownership of the folder:

sudo mkdir /media/remote
sudo chown your-username /media/remote

The folder 'remote' will be used to locally mount the remote folder in your computer.

3. Make sure you belong to the group 'fuse'. To do this, go to System->Administration->Users and Groups, and there select 'fuse' and add yourself to this group.


Now you're ready to mount your remote folder. The way we do this is as follows. Say I want to access the folder 'pictures' that is situated in my home-desktop computer whose domain name is desktop-pc. Then, if the full path is /home/myuser/pictures we have to run the following command to mount this folder on my laptop (local machine):

sshfs desktop-pc:/home/myuser/pictures /media/remote

Go to /media/remote and check that all files in the folder picture on desktop-pc are available in your local machine. You can now do whatever you want with this files as if they were a local folder (for instance, you can burn a DVD with all the pictures in this folder).

In case you've set ssh access to your remote machine through a port different from port 22 (say port 23) and/or only to some users (say only to the user called nameuser), you can modify sshfs the same way you'd do it when you run ssh. In my example, this can achieved as follows:

sshfs -p 23 nameuser@desktop-pc:/home/myuser/pictures /media/remote

Finally, once you're done you can unmount this directory by issuing the following command:

fusermount -u /media/remote

Enjoy!