### Archive

Posts Tagged ‘tips’

## How to Install Eclipse and Android SDK on Ubuntu 10.04 LTS

January 17, 2012 1 comment

Before walking you through the installation process in details, it’s good to know a big picture:

1. Since Android development needs Java, so we are going to need Java installed on Ubuntu
• If you are using 64-bit Linux machine (e.g. 64-bit Ubuntu), you may need to install ia32-libs.
2. You will also need Java Development Tools (JDK), and Eclipse is recommended
3. The last thing is to install Android Development Tools (ADT) on Eclipse

All the information regarding the installation can be found at the Android developer website

http://developer.android.com

Here is the installation in details:

1. Install Java
1. If you are using 64-bit Ubuntu, you will need to install ia32-libs package:
sudo apt-get ia32-libs
2. Next, install Javasudo apt-get install sun-java6-jdk

A tricky part is that when the Java installation almost done, you will need to click <Ok>, which can be done by click in the terminal and press Tab until the <Ok> is highlighted.

2. Next, you will need to install Java Development Tools (JDK). Eclipse is recommended because there is an Android Development Tools (ADT) plugin available.
1. Go to http://www.eclipse.org/downloads/
2. I download Eclipse IDE for Java Developers (both 32- and 64-bit are available)
3. Extract the downloaded file eclipse-java-indigo-SR1-linux-gtk-x86_64.tar.gz, and you will get the folder called eclipse, containing all necessary files
4. Since Eclipse is built to be portable, you can move the extracted eclipse folder to any location you want. It is recommended to move the file to your home directory /home/yourusername/
5. You might want to add the launch icon on the menu, please follow the process here.
3. Launch Eclipse, we will now install the ADT plugin
1. go to Help>Install New Software..
2. According to the ADT plugin page, we will put the URL
https://dl-ssl.google.com/android/eclipse/
and click Add
3. Tick the newly added plugin, and click Next until done
4. Next, we will install Android software development kit (Android SDK)
1. Download the Android SDK from
http://developer.android.com/sdk/index.html
For (both 32- and 64-bit) Ubuntu, you will download android-sdk_r16-linux.tgz
2. Extract android-sdk_r16-linux.tgz in the home folder (/home/yourusername/)
3. The extracted folder is android-sdk-linux
4. Now go back to Windows>Preferences
5. On the left panel, click Android
6. In the SDK Location, select your extracted SDK location, which is
/home/yourusername/android-sdk-linux
7. Click Apply and OK, wait a few minutes for the program to update
5. Retrieve all necessary files for SDK
1. Go to Window>Android SDK Manager
2. Tick all the Android versions that apply, and click Install packages
6. Done, So now you may proceed to build a new project!!!

Additional reading can be found from http://developer.android.com/sdk/installing.html#troubleshooting

Categories: iDo, Tutorials

## Solved: pdfExpress verification gives some errors

August 5, 2011 Leave a comment

My paper did not pass the pdfExpress verification due to the error:

Error Font Helvetica is not embedded (111x)

Here we follow the process from the submission homepage:

If you are using the conference template in its Winword version and still get errors (or no answers) from pdfExpress, try this procedure:
1) Please check the top margin of the the first page. it MUST be 2.5 cm; for OTHER pages it must be 1.9 (cm)
2) Generate the pdf file
3) Then you have to embed the fonts. You can do that either
3.1) by using acrobat professional or
3.2) using the line command

gs -dSAFER -dNOPLATFONTS -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=letter -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -sOutputFile=OUTPUT.pdf -f INPUT.pdf

where INPUT.pdf is the pdf source file, OUTPUT.pdf is the output file to be submitted with the fonts embedded and gs is the ghost-script executable command.
If this does not work, or you have other pdfExpress problems, please contact Dr. Romolo Camplani at camplani@elet.polimi.it

However, after trying such a method, the pdf is rejected from the submission website. So, we still have to put the output file to pdfExpress to verify again, and of course you can now expect no error. Then you can proceed to submit the pdfExpress-verified pdf to IJCNN, and the file is PID1839743.pdf whose content is identically the same as ClosedFormDcsGMM_IJCNN_final_added2.tex.

Categories: Academics, Tutorials

## How to remove white-border from a figure?

August 5, 2011 Leave a comment

When adding a figure to your publication, you might want to remove the undesired white-border off your figures. I believe that the best way is to create figures without the border if it is possible. In MATLAB, I think you can do so. However, if you have the figures already, you might want to have a program to remove the borders automatically, wisely and controllably. I developed a toolbox in MATLAB for this purpose. Please refer to the URL below.

https://sites.google.com/site/kittipat/bot_silly_tools

The overview of white-border removal toolbox

Categories: iDea, iDo, Research

## Plot 3D ellipsoid

August 4, 2011 1 comment

Plot 3D Gaussian distribution? The harder part is to plot the 3D ellipsoid which can be done by calculating the axes (radii) of the ellipsoid from its eigenvalues. Simultaneously, We will get its corresponding eigenvectors which tells how to rotate the ellipsoid. The function ellipsoid(.) can plot canonical ellipsoid, and hence we need to rotate the canonical ellipsoid using the eigenvectors. That is it. Here are some codes adapted from Rajiv Singh’s version.

```% plot 3D ellipsoid
% developed from the original demo by Rajiv Singh
% http://www.mathworks.com/matlabcentral/newsreader/view_thread/42966
% 5 Dec, 2002 13:44:34
% Example data (Cov=covariance,mu=mean) is included.

Cov = [1 0.5 0.3
0.5 2 0
0.3 0 3];
mu = [1 2 3]';

[U,L] = eig(Cov);
% L: eigenvalue diagonal matrix
% U: eigen vector matrix, each column is an eigenvector

% For N standard deviations spread of data, the radii of the eliipsoid will
% be given by N*SQRT(eigenvalues).

N = 1; % choose your own N
radii = N*sqrt(diag(L));

% generate data for "unrotated" ellipsoid
[xc,yc,zc] = ellipsoid(0,0,0,radii(1),radii(2),radii(3));

% rotate data with orientation matrix U and center mu
a = kron(U(:,1),xc);
b = kron(U(:,2),yc);
c = kron(U(:,3),zc);

data = a+b+c; n = size(data,2);

x = data(1:n,:)+mu(1);
y = data(n+1:2*n,:)+mu(2);
z = data(2*n+1:end,:)+mu(3);

% now plot the rotated ellipse
% sc = surf(x,y,z); shading interp; colormap copper
h = surfl(x, y, z); colormap copper
title('actual ellipsoid represented by mu and Cov')
axis equal
alpha(0.7)```
Categories: Tutorials

## Effects of adding loading factors to a covariance matrix

July 29, 2011 Leave a comment

From my previous post, we know that the update equation for covariance matrix might not be numerically stable because of the matrix not being positive definite. An easy way to stabilize the algorithm is to add a relatively small positive number a.k.a. loading factor to the diagonal entries of the covariance matrix. But, Does the factor loading affect the likelihood or the convergence of the EM algorithm?

Apparently, adding the loading factor to the covariance matrix does impact the log-likelihood value. I made some experiments on the issue, and let me share the results with you as seen in the learning curve (log-likelihood curve) of ITSBN with EM algorithm below. The factor is applied to the matrix only when the determinant of the covariance matrix is smaller than $10^{-6}$. There are 5 different factors used in this experiment listed as follows; $10^{-8}, 10^{-6}, 10^{-4}, 10^{-3}, 10^{-2}$. The results show that the learning curves are still monotonically increasing* and level off near the end. Furthermore, we found that the level-off value are highly associated with the value of the factor. The bigger the factor, the smaller the level-off value. This suggested that we should pick smallest value of factor as possible in order to stay as close as the ideal learning curve as possible. Note that the loading factor is not added to the covariance matrix until the second iteration.

log-likelihood curve with different loading factors

* Though I don’t think this is always the case because the factor is not consistently added to the matrix, and hence when it is added, it might pull the log-likelihood up to a low value. However, it is empirically shown that the log-likelihood is still monotonically increasing when the factor is big.

Categories: Academics, Research, Tutorials

## Often-used LaTeX techniques

How to add/change text color in LaTeX? [link]

How to make figure spanning 2 columns in your 2-column paper? [link]

How to convert figures from .eps to .pdf?

• single figure: epstopdf figure.eps –> this works both on Linux [link] and Windows
• multiple figures on Ubuntu–this will run epstopdf on all .eps files in current directory and all subdirectories:

blahblah\$ find . -name “*.eps” -exec epstopdf {} \;
for more information please refer to [link]

• multiple figures on Windows–[link]
Categories: iDea, Tutorials Tags: , , ,

## Gmail’s status: POP is enabled for all mail that has arrived since 8/26/06

April 21, 2011 1 comment

This is pretty funny. I don’t know how it happened nor why this can solve it. All I know is this will work out somehow.

Brief descriptions: POP did not download e-mails from Gmail account before a specific date.

Symptoms: I set up POP in Thunderbird and download e-mails from Gmail account. All went well except that e-mails arrived before  8/26/06 were not downloaded to my computer. No matter what I did the emails wouldn’t get downloaded. So I revisited the setting in the Gmail account >mail setting>Forwarding and POP/IMAP>POP Download and I found that it showed “POP is enabled for all mail that has arrived since 8/26/06” which corresponding exactly with the not-downloaded emails in the gmail account. However, I don’t know how to change the date. I ticked at “Enable POP for all mail (even mail that’s already been downloaded)” and saved the changes, but that did not help.

Here is the trickery…I don’t know how or why though. I ticked on “Enable POP for mail that arrives from now on” then save the changes. After that I ticked “Enable POP for all mail (even mail that’s already been downloaded)” then save the changes. Now it works!

Here they discussed the same problems too

http://www.google.com/support/forum/p/gmail/thread?tid=279f64a3240921b4&hl=en

Categories: Uncategorized Tags: , , ,