Showing posts with label things i need. Show all posts
Showing posts with label things i need. Show all posts

Wednesday, May 04, 2011

I couldn't open file name `*.aux'

If you have more than one bib file, add them like this:
\bibliography{bibliography_1,bibliography_2,bibliography_3}

Open up the .tex file and compile it using Latex (Shift+Apple+L) then compile it using Bibtex (Shift+Apple+B)

Tuesday, November 23, 2010

Social Engineering and Koobface virus

Koobface, whose name is an anagram of the word "Facebook", is a special worm that spreads through messages in social networking sites like Facebook and myspace. One of the ways it affects users is:

1. One of friends writes a message on your wall with a video link saying "Funniest video ever!" or "My Home Film;)"


2. When you click on the link, it asks you to install the "Adobe flash player" to see the video.
 which is actually the Koobface worm.

3. You download it and become a zombie.

More on KoobFace:
The Real Face of KOOBFACE, analysis by Trend Micro.
Koobface virus hits facebook
Koobface scam by Berkeley researchers
Wiki has some good links

Friday, August 27, 2010

Karhunen-Loeve transform in java

Background knowledge and matlab code here.
The matlab code below is taken from the previous paper.
%number of examples
N=size(X,2);
%dimension of each example
M=size(X,1);
%mean
meanX=mean(X,2);
%centering the data
Xm=X-meanX*ones(1,N);
%covariance matrix
C=(Xm*Xm')/N;
%computing the eigenspace:
[U D]=eig(C);
%projecting the centered data
over the eigenspace
P=U'*Xm;

Helpful lecture video
Download JAMA package
Java code:
import Jama.*;

public class KLTransform {

//Matrix x[i,j]= jth feature in ith example
public Matrix k_lTransform(Matrix x)
{
 
   x = x.transpose();
     
   int nExample = x.getColumnDimension();

  //calculate mean
   Matrix mean = getMean(x);
  
   double[][] oneD = new double[1][nExample];
   for(int i = 0; i < nExample; i++)
       oneD[0][i] = 1;
   Matrix ones = new Matrix(oneD);
  
   //center the data
   Matrix xm = x.minus(mean.times(ones)); 

   //Calculate covariance matrix
   Matrix cov  = xm.times(xm.transpose());
  
   /*
   In the matlab code, the covariance matrix is divided with N (nExample). 
   Now cov and cov/nExample have the same eigenvectors but different eigenvalues. 
   In this code, the division doesn't make any difference as we are only 
   considering the eigenvectors. 
   But there are some cases, like in Kaiser-Guttman stopping rule 
   where only the eigenvectors with eigenvalue > 1 are chosen, 
   division might make a difference.
   */
   cov = cov.times(1.0/nExample);

   //compute eigen vectors
   Matrix eigenVectors = cov.eig().getV();

  //compute pca
   Matrix pca = eigenVectors.transpose().times(xm);
   return pca;
}
 
public Matrix getMean(Matrix x) {
 int nExample = x.getColumnDimension();
 int nFeature = x.getRowDimension();
  
 double[][] meanD = new double[nFeature][1];
 Matrix mean = new Matrix(meanD);
  
 for(int i = 0; i < nFeature; i++)
 {
   double avg = 0.0;
   for(int j = 0; j < nExample; j++)
   {
     avg+=x.get( i,j);
   }
   mean.set(i, 0, avg/nExample);
   
 }
 return mean;
}
//test 
public static void main(String[] args)
{
  KLTransform kl = new KLTransform();

  double [][] d = new double[][]{{1, 2, 3},{4,5,6}};
  Matrix x = new Matrix(d);
  Matrix pc = kl.k_lTransform(x);

  pc.print(pc.getRowDimension(), 2);

 }
}

Note that in the matlab code, number of examples is the number of columns that is each column is an example. But the java code assumes each row is an example. So the matrix X in matlab is the transpose of matrix X in java.
To test the java and matlab code:
run java with :
X=
[1 2 3]
[4 5 6]

run matlab with: X = [1, 4; 2, 5; 3, 6]

syntax highlighting tutorial

Saturday, August 07, 2010

find a file and delete it


Command:
find <where-to-look> -name <name-of-the-file> | xargs /bin/rm -f
Example:
I want to delete .svn folder from every directory
then the command would be
find <main-directory-name> -name .svn | xargs /bin/rm -rf

Source: Unix "find" command

Saturday, May 22, 2010

Resource 'tokenizers/punkt/english.pickle' not found.

Full solution is in here
For Mac, do this
sudo python -m nltk.downloader -d /usr/share/nltk_data all

Tuesday, February 02, 2010

libpng.so.2 error

***: error while loading shared libraries: libpng.so.2:
cannot open shared object file: No such file or directory

To avoid this error:

1. Install libpn3:

sudo apt-get install libpng3


2. And rename it to libpng2:

sudo ln -s /usr/lib/libpng.so.3 /usr/lib/libpng.so.2


Thanks to Jacques for the solution.

Tuesday, January 26, 2010

player/stage/gazebo help

http://yorkroboticist.blogspot.com/2009_11_01_archive.html


and a tutorial Player/stage tutorial

SLAM tutorial : SLAM
Excellent slam example: slam for dummies

didn't find any example for player/stage 3.*, so i installed player 2.0.5, and stage 2.0.3

got the following error

unable to open color database /usr/X11R6/lib/X11/rgb.txt :
No such file or directory (stage.c stg_lookup_color)

To correct this problem, player/stage needs a link to the X11 color map in the place it expects:

sudo ln -s /usr/X11/share/X11/rgb.txt /usr/X11R6/lib/X11/rgb.txt


detailed solution: here

Java client for player/stage: here

--
Sheetal

Wednesday, April 01, 2009

Counting in for loop in dos batch

This is the default behaviour of a FOR loop:



@echo off
setlocal
:: count to 5 storing the results in a variable
set _tst=0
FOR /l %%G in (1,1,5) Do (echo [%_tst%] & set /a _tst+=1)
echo Total = %_tst%
C:>demo_batch.cmd
[0]
[0]
[0]
[0]
[0]
Total = 5

Notice that when the FOR loop finishes we get the correct total, so the variable correctly increments, but during each iteration of the loop the variable is stuck at it's initial value of 0

The same script with EnableDelayedExpansion, gives the same final result but also displays the intermediate values:



@echo off
setlocal EnableDelayedExpansion
:: count to 5 storing the results in a variable
set _tst=0
FOR /l %%G in (1,1,5) Do (echo [!_tst!] & set /a _tst+=1)
echo Total = !_tst!
C:\>demo_batch.cmd
[0]
[1]
[2]
[3]
[4]
Total = 5

Notice that instead of %variable% we use !variable!


http://www.ss64.com/nt/setlocal.html

Sunday, January 11, 2009

Download entire website using wget

wget-tircks-and-tips

If want you save the website exactly the same way a web-browser do, use the following command

wget --no-check-certificate -nd -pHEK -erobots=off  http://www.example.com
    


--
Sheetal

--A journey of a thousand mile begins with a single step --