Ake Koomsin

Thought on Writing a Report With LaTeX

I’m not dead!

I haven’t update my blog for a month becasue I really have no time. I had to study from 8:40 to 17:20 every day due to the great flood. Agh! I hate school time.

I just finished my final exams yesterday. I feel really great now, just like getting out of the jail.

Let’s come back to the story about Latex.

I had to write a software architecture document as an assignment. My teacher provided me a Microsoft Word template but it looks suck. Therefore, I decided to write from scratch with LaTeX.

I had to install MacTeX for Lion. Its size was pretty large in my opinion but that was fine. I downloaded TeXShop 3.04 for Lion to use as a LaTeX editor.

To me, writing a report with LaTeX is like writing a HTML page. I just specify chapters and sections that I am going to have and provide their content. LaTeX will take care of the output for you and it is just beautiful. I see the semantics in my source file.

LaTeX is easy until you want to customize something.

To customize something, I found that I had to use extra packages and had to read its document which was not quite productive at the beginning.

Things became more complicated when I had to deal wtih table layout. I would say that it was very challeging. I took a lot of time to figure out how to get the table layout I want. However, I felt like I was using table the wrong way so that it was complicated.

To be honest, I’m still not be able to remember all the essential commands in LaTeX. I just open the documentation when I need.

Anyway, It was fun and I will continue using it for sure.

Install Outguess on OS X Lion With Homebrew

In my security and cryptography class, My teacher showed me an interesting program called outguess. What it does it hide a plain text into a jpg file. This method is known as steganography.

The program will read an input text file and slightly change pixels color in the image in such the way that it is not going to be visible.

Here is an example of putting some text into an image:

1
outguess -d some_text.txt image.jpg image_result.jpg

Here is how to extract text from the image:

1
outguess -r image_result.jpg hidden_text.txt

Here is how to install outguess with homebrew. Firstly, we need to create a formula.

1
2
brew create http://www.outguess.org/outguess-0.2.tar.gz
brew edit outguess

Then, modify the outguess formula like this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require 'formula'

class Outguess < Formula
  homepage 'http://www.outguess.org/'
  url 'http://www.outguess.org/outguess-0.2.tar.gz'
  mirror 'http://www.mirrors.wiretapped.net/security/steganography/outguess/outguess-0.2.tar.gz'
  md5 '321f23dc0badaba4350fa66b59829064'

  def install

    # Segmentation fault occurs if compiling with clang, use llvm-gcc instead
    ENV.gcc :force => true

    args = ["--disable-debug",
            "--disable-dependency-tracking",
            "--prefix=#{prefix}",
            "--sysconfdir=#{etc}",
            "--mandir=#{man}"
            ]

    system "./configure", *args
    system "make"

    bin.install "outguess"
    man1.install "outguess.1"
  end
end

And that’s it. In order to install:

1
brew install outguess

I actually pull-requested to homebrew main repository. However, the maintainers don’t want a formula that is not clang compatible because llvm-gcc is going away. I agreed with them. Even though there is a successor of llvm-gcc, DragonEgg, we still don’t know its future and keeping clang-incompatible formula away from main repository make the repository clean. If I have time, I think I will take a look at the source code and creating a patch. Noteing that this program seems to be no longer maintained.

Using Date Command in Cron Job

I had to set a cron job to back up mysql database and its format I wanted is like this

1
back_up_YYYY_MM_DD.sql

And here was my first initial configuration that I added to /etc/crontab

1
00 11   * * *   a_user   mysqldump -u root -pSomePass db > /home/a_user/www/sql_backup/back_up_`date +%Y_%d_%m`.sql

Actually, I noticed a strange syntax color at the end of the line in Vim. I thought it is just misparsing so that I ommited it.

And here was the output in /var/log/syslog

1
Jan  4 11:00:01 a_user CRON[3427]: (a_user) CMD (  mysqldump -u root -pSomePass db > /home/a_user/www/sql_backup/back_up_`date +)

Something was wrong as you can see; it was not complete.

In order to fix this, I had to escape the ‘%’ sign

1
00 11   * * *   a_user   mysqldump -u root -pSomePass db > /home/gizmo/www/sql_backup/back_up_`date +\%Y_\%d_\%m`.sql

Now, everything works fine :D

Getting Zyxel NWD-270N Works on Ubuntu 10.04 LTS

I have to install Ubuntu 10.04 LTS on a machine as a sales terminal which will run Ruby on Rails. The problem that I encounter is Zyxel NWD-270N, a wireless adaptor. At the first glance, it looks like it should work out of box. Zyxel NWD-270N supposes to use rt2870sta driver.

Unfortunately, there seems to be something wrong with Ubuntu 10.04 LTS that tries to load rt2800usb and it does not work. So, I google and find this link

Noting that I haven’t updated the Ubuntu after install yet.

Since this thread is about Asus USB-N13, I have to find my vendor and product ID first by run:

1
lsusb

And here is the partial result:

1
2
3
...
Bus 002 Device 003: ID 0586:341a Zyxel Communications Corp.
...

The next step is to tell the OS that it should use rt2870sta driver when it sees this vendor and product ID. There are two files that I have to create

The first one is /etc/udev/rules.d/network_drivers.rules

1
sudo vim /etc/udev/rules.d/network_drivers.rules

and add this line:

1
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0586", ATTR{idProduct}=="341a", RUN+="/sbin/modprobe -qba rt2870sta"

The second one is /etc/modprobe.d/network_drivers.conf

1
sudo vim /etc/modprobe.d/network_drivers.conf

and add this line:

1
install rt2870sta /sbin/modprobe --ignore-install rt2870sta $CMDLINE_OPTS; /bin/echo "0586 341a" > /sys/bus/usb/drivers/rt2870/new_id

After restart, it seems to be able to find wireless access points but it is not able to connect. Therefore, I decide to find an old wireless adaptor as a temporary adaptor in order to connect to the Internet to run update:

1
2
sudo aptitude update
sudo aptitude upgrade

And also install (I don’t know if it is necessary after reading the package description “This empty package allows people to keep their backported wireless modules up-to-date when upgrading their Linux kernel.” I install it anyway)

1
sudo aptitude install linux-backports-modules-wireless-lucid-generic

After restart again, it works! However, it doesn’t seems to run on wireless N, only at 54 Mbps. Anyway it works and I can continue my work.

Greeting

It is a very good time to launch this blog on New Year.

I aim to post everything I learned from school and work as a technical journey. I hope that it might be useful for readers and me someday in the future.

Everything is like a dot. In order to understand things around, it is important to find the way to connect those dots. It is good to have a variety of knowledge and skills. Everything that seems unimportant for now might be useful in the near future.

I do believe that in order to succeed in programming, I need to achieve both theoretical and technical knowledge; to be come pragmatic. I will do; there is no reason not to do.

Happy New Year, This year will be another great year for you :D.