Lyx IEEE Journal and Conference layout

These are the steps I followed to use IEEE formatting in Lyx:

  • Create IEEEtran directory
  • Download the latex file IEEEtran2.tar.gz from IEEE site and extract
  • Create a subdirectory named “bibtex”
  • Download the bibtex file IEEEtranBST1.tar.gz from the same IEEE site to this directory and extract
  • For Ubuntu, move IEEEtran directory to /usr/share/texmf-texlive/tex/latex/ and run texhash (requires sudo)
  • Run Lyx->Tools->Reconfigure and restart Lyx.
  • You should be able to select IEEEtran from Document Settings.

References

phpmyadmin access problem

All of a sudden I started to get the following error:

#1045 - Access denied for user 'root'@'localhost' (using password: NO)

whenever I tried to access to mysql database through phpmyadmin. I have been using it flawless for very long time.

I modified the following file:

/var/lib/phpmyadmin/config.inc.php

by changing

$cfg['Servers'][$i]['auth_type'] = 'config';

to

$cfg['Servers'][$i]['auth_type'] = 'cookie';

and everything is working fine now.

Perl DBI – Some usefull commands

Return a reference to column names

$name = $sth->{NAME};

Number of affected rows

$sth->rows();

New auto-incremented id

$latestId = $dbh->{‘mysql_insertid’}

Uploading large data. ‘INSERT INTO’ command takes long amount of time. Use ‘LOAD DATA’ command to upload bulk data from a text file.

  • Be careful. If the file to be uploaded resides on the server, it still needs to be accessible by the mysql server. E.g. you can place them under /tmp
  • You can specify NULL characters by ‘\N’, e.g. “9,\N,276,John…”

Perl: Some usefull tips

Some handy Perl commands that is not used as much.

Use ‘-‘ to refer to STDOUT & STDIN.

open(INP, ‘-‘) —> STDIN
open(OUT, ‘>-) —> STDOUT
$fh = IO::File->new(‘-‘,’w’) —> STDOUT

Following the filehandle with ‘-|’ opens the output of a shell command as a file.

open($fh, ‘-|’, ‘ls -l’);
open($fh, ‘-|’, ‘cat tmp.txt | sort’);

Similarly IO::Pipe can be used to get the same affect:

$fh = new IO::Pipe;
$fh->reader(qw(ls -l));

Then you can print the output

while (<$fh>) { print; }

Open a zipped file

open(INP, ‘-|’, ‘gunzip < tmp.txt.gz’);

Print the output of a subroutine inside a string

print “3+4 is @{ [addTwoNumbers(3,4)] }\n”;

Use IO::File to store filehandles into a hash array.

$fh{‘infile’} = IO:File->new(“tmp.txt”, “r”);
while (my $line = $fh{‘infile’}->getline) {
print $line;
}
$fh{‘infile’}->close;

How to switch desktops on Ubuntu

This is how I switched my desktop from Xubuntu to Ubuntu. Different combinations are done with a similar approach. See the reference below for a detailed explanation.

  • sudo apt-get update
  • sudo apt-get install ubuntu
  • sudo update-alternatives --config usplash-artwork.so
    • Select artwork for the boot and shutdown screens, enter the following two commands in a Terminal window:
  • sudo update-initramfs -u
  • sudo dpkg-reconfigure gdm
    • However both Ubuntu & Xubuntu uses gdm, following step will resolve this problem
  • sudo gdmsetup
    • If this fails to launch a GUI window, first run sudo su and then type gdmsetup
    • Go to “Local” tab and select the Ubuntu theme

When you logon next time do not forget to select the “gnome” as the current session.

In my case compiz caused Ubuntu to consume a lot of CPU power so I uninstalled it:

sudo apt-get –purge remove compiz* libcompizconfig*

Reference

Secure VNC with SSL

A detailed explanation of how to make VNC work over SSL can be found here. Reading that and the e-mail discussions here, I’d like to summarize the procedure:

SERVER

  • Create the certificate stunnel.pem (Follow the instructions given at the link above)
  • Run VNC server: vncserver :5
  • Create a secure tunnel: stunnel -d 5950 -r 5905 -p /path/to/stunnel.pem
  • Download the source code of x11vnc. Copy the VncViewer.jar and SignedVncViewer.jar into a folder accessible by the webserver, e.g. “/vnc
  • Create an index.html file with the following content (replace YOUR-HOSTNAME with your hostname):
    <html>
    <body>
    <applet code="VncViewer.class" archive="VncViewer.jar" width="800" height="600">
    <param name="PORT" value="5950" />
    <param name="HOST" value="YOUR-HOSTNAME" />
    <param name="Open New Window" value="no" />
    <!-- the following helps in Opera:
    <param name="Cursor shape updates" value="Disable" />
    -->
    </applet>
    </body>
    </html>

CLIENT

From a web browser you can access to the following address:

http://YOUR-HOSTNAME/vnc

Even better, if you setup the directory under SSL domain:

https://YOUR-HOSTNAME/vnc

Remote access to your parents’ computer

You can’t always be there for your parents when they need your help desperately for their computer problems. I resolved this issue with some basic software that I’d like to share. I’d like to give the basics first and I will provide more details when I have more time.

What is the problem?

  • Remote computer (Possibly Windows PC) do not have a public address.
  • You have a Linux server with a public IP address.
  • You want to be able to securely access the remote computer.

What software?

  • Putty
  • TightVNC

How?

  1. Install TightVNC and launch TightVNC server
    1. Set a password
    2. Optional: Only allow connections from localhost for security
  2. Install Putty
    1. Create a session to connect to your Linux server
    2. In the SSH options click on the tunnel and create a remote port forwarding. (Source: 5900, Destination: localhost:5911, Remote option selected)
    3. Save and connect to your server
    4. Optional: You can create keys to login to your server without a password. One less password to remember for them.
  3. At the Linux server, launch vncviewer to port 5911, i.e. vncviewer localhost:11

Some security tips

  • We are using putty because tunneling VNC over SSH makes it secure. You can also setup VNC over SSL and access their computer from any browser. Check out this post.
  • Allowing only local access makes it more secure against external attacks. TightVNC server only responds if the Putty is running.