Warning: include_once(/home/nullvoid/blog.mikezhang.com/wp-content/plugins/wordpress-support/wordpress-support.php): failed to open stream: Permission denied in /home/nullvoid/blog.mikezhang.com/wp-settings.php on line 217

Warning: include_once(): Failed opening '/home/nullvoid/blog.mikezhang.com/wp-content/plugins/wordpress-support/wordpress-support.php' for inclusion (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/nullvoid/blog.mikezhang.com/wp-settings.php on line 217
NullVoid » 2008 » September NullVoid » 2008 » September

Archive for September, 2008

Pic-A-Day: Roof

Friday, September 19th, 2008 -- By ET

km_building

Decimal Point Alignment in Latex

Monday, September 8th, 2008 -- By ET

UPDATE: A web-based version is available. You don’t need to upload the whole file to do the conversion now.

Check out the new version at: http://blog.mikezhang.com/dcolumn/processtable.cgi.


It has been a headache to do decimal point alignment in latex.

Fortunately, there is a package called dcolumn that helps with this problem.

This dcolumn package “defines a system for defining columns of entries in an array or tabular which are to be aligned on a ‘decimal point’.”

Unfortunately, it is very hard to make the modifications manually on the tables to align the decimal points of numbers.  I searched online and could not find a solution.  So I created a web service that does this:

Basically, just visit the webpage: http://blog.mikezhang.com/dcolumn/.

screen-capture-21

There is only one field for you to browse a latex file.  Make sure it has extension .tex, otherwise, the system would not accept the file.

Click Submit, you will obtain the converted file with correctly aligned numbers in your tables.

See the screen shot of the finished page:

screen-capture-3

Now clicking “FILE” will bring you the new file, in txt format.  You need to change the extension to .tex to try it out.  This intended trouble helps you to avoid overwriting your original file.

Here is how it worked on a paper:

Before:

screen-capture6

and After:

screen-capture-11

PERL Load MySQL Query Results into an Array

Saturday, September 6th, 2008 -- By ET

It’s that simple:

use DBI;
my $conn = DBI->connect
("DBI:mysql:db","owner","ownerpass") or die("Cannot connect: $DBI::errstr");
$sql=qq(select field from table where id=$id);
@array=@{$conn->selectcol_arrayref($sql)};

Passing Array as a Parameter in PERL

Saturday, September 6th, 2008 -- By ET

There are more than two ways to do it. I just put down two quick ways.

  1. using reference to array
  2. not using reference to array

Method 1:

In program:
processarray(\@array);
In sub processarray:
my $arrayref=shift;
my @array=@$arrayref;

Method 2:

In program:
processarray(@array);
In sub processarray:
my @array=@_;

Overhead: WISE vs. SMART

Friday, September 5th, 2008 -- By ET

The difference between a smart person and a wise person is that a wise person knows how not to get into situations that a smart person knows how to get out of.

Pic-A-Day: Palace Museum

Tuesday, September 2nd, 2008 -- By ET

It is renovated when I visited. But I could manage to get a picture like this.

taihedianhdr


BlogTimer
You are visitor number several since September 1, 2001

Copyright Xiaoquan (Michael) Zhang, 2004-2020. All rights reserved.
All trademarks property of their owners.