<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Mintact: Building Secure Software Application</title>
	<atom:link href="http://www.mintact.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.mintact.com</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Fri, 16 Oct 2009 18:52:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Upgrading a hard drive of my Fedora laptop</title>
		<link>http://www.mintact.com/?p=28</link>
		<comments>http://www.mintact.com/?p=28#comments</comments>
		<pubDate>Fri, 16 Oct 2009 18:50:52 +0000</pubDate>
		<dc:creator>Min Chen</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[clone]]></category>

		<category><![CDATA[hard_drive]]></category>

		<category><![CDATA[LVM]]></category>

		<category><![CDATA[partition]]></category>

		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://www.mintact.com/?p=28</guid>
		<description><![CDATA[I bought a 500G SATA hard drive to replace the 160G one in my HP laptop. I then managed to clone all partitions from the old disk to the new one, and resized (increased) the file system. Here&#8217;s how I did it.
What I needed:

A computer with two SATA interfaces. I have a Windows desktop that [...]]]></description>
			<content:encoded><![CDATA[<p>I bought a 500G SATA hard drive to replace the 160G one in my HP laptop. I then managed to clone all partitions from the old disk to the new one, and resized (increased) the file system. Here&#8217;s how I did it.</p>
<p>What I needed:</p>
<ol>
<li>A computer with two SATA interfaces. I have a Windows desktop that has 4 SATA ports and 2 cables. I then pulled out the data cables and power cables from the existing 3.5&#8243; desktop hard drives in the Windows box in order to hook up the 2.5&#8243; laptop hard drives</li>
<li>A Fedora 11 installation DVD</li>
<li>Screw drivers</li>
</ol>
<p>First I unscrewed the 160G hard drive from my laptop, and then took both new and old hard drives to my Windows desktop. I then plugged the data cables and power cables to both 2.5&#8243; drives, the new one was on SATA 1 and the 160G old one was on SATA 2.</p>
<p>Powered on the box and booted from Fedora installation DVD. By entering &#8220;rescue mode&#8221;, I was able to <code>ls /dev</code> and saw <code>/dev/sda</code> and <code>/dev/sdb, /dev/sdb1, /dev/sdb2, /dev/sdb3</code>. Obviously the new 500G hard drive was <code>/dev/sda</code> and the old one was <code>/dev/sdb</code>.</p>
<p>To check the partition table of the old drive, I run <code>fdisk -l /dev/sdb</code>.<br />
The output was</p>
<hr />
Disk /dev/sdb: 160.0 GB, 160041885696 bytes<br />
255 heads, 63 sectors/track, 19457 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes<br />
Disk identifier: 0&#215;95aa95aa</p>
<p>   Device         Boot             Start                  End                   Blocks         Id         System<br />
/dev/sdb1        *                     1                    25                   200781       83         Linux<br />
/dev/sdb2                        18197               19457                10128982+      7          HPFS/NTFS<br />
/dev/sdb3                             26               18196             145958557+      8e         Linux LVM</p>
<hr />
/dev/sdb1 was the <code>grub</code><br />
/dev/sdb2 was the HP&#8217;s system recovery image<br />
/dev/sdb3 was the most important, it had all my Linux system and data</p>
<p>Based on this partition table, I run <code>fdisk /dev/sda</code> to setup 2 primary partitions on the new drive. Use <code>n</code> to create partition, and <code>t</code> to change the Id for 2nd partition from the default 83 to 8e, <code>w</code> to save the partition table. I made the sizes of new partitions identical to the old ones. The partition table of new hard drive look like this</p>
<hr />
   Device         Boot             Start                  End                   Blocks         Id         System<br />
/dev/sda1        *                     1                    25                   200781       83         Linux<br />
/dev/sda2                             26               18196             145958557+      8e         Linux LVM</p>
<hr />
<p>The size of /dev/sda1 was identical to the size of /dev/sdb1, and /dev/sda2 was identical to /dev/sdb3.</p>
<p>Restarting the machine, booted from Fedora DVD, and entered into rescue mode, and I was ready to clone the partitions. Simply run the <code>dd</code> command<br />
<code>dd if=/dev/sdb1 of=/dev/sda1 bs=1M</code> to clone the <code>/boot</code> and<br />
<code>dd if=/dev/sdb3 of=/dev/sda2 bs=1M</code> to clone the Linux system</p>
<p>It took about 10 seconds to clone the 200M grub partition, and about 2 hours to clone 140G Linux partition.</p>
<p>I then shut down the machine, unplugged all cables from laptop hard drives, and screwed the new 500G hard drive into my HP laptop. I had to insert the Fedora DVD into laptop and entered into rescue mode to setup grub. I run these commands</p>
<hr />
grub<br />
root (hd0,0)<br />
setup (hd0)</p>
<hr />
<p>After these, I removed the DVD and booted from hard drive. I was able to use the new hard drive now. Everything was saved, the laptop works exactly the same as if I&#8217;d never changed the hard drive.</p>
<p>My next task is to increase the file system size. As shown in the <code>fdisk</code> output, my Linux is using LVM, so I need to increase the size of LVM partition, and then increase the size of virtual group and logical volume. Before I did any changes, I run <code>pvdisplay</code>, <code>vgdisplay</code>, and <code>lvdisplay</code>, and saved the output to a file. I have two logical volumes, <code>/dev/VolGroup00/LogVol00</code> for my Linux file system, and <code>/dev/VolGroup00/LogVol01</code> for swap.</p>
<p>First step was to increase the partition size. It was easily done by <code>fdisk</code>, by using <code>d</code> to delete the partition, and then <code>n</code> to recreate the partition with bigger size, and <code>w</code> to save the changes. I had to reboot the laptop to apply the changes.</p>
<p>This is the output of my partition table (<code>fdisk -l /dev/sda</code>) after increasing the size:</p>
<hr />
Disk /dev/sda: 500.1 GB, 500107862016 bytes<br />
255 heads, 63 sectors/track, 60801 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes<br />
Disk identifier: 0&#215;000ba110</p>
<p>   Device Boot      Start         End      Blocks   Id  System<br />
/dev/sda1   *           1          25      200781   83  Linux<br />
/dev/sda2              26       36392   292117927+  8e  Linux LVM</p>
<hr />
<p>I doubled the size of /dev/sda2 from the original 146G to now 292G.</p>
<p>The rest would be dealing with LVM.</p>
<ol>
<li>run <code>pvresize /dev/sda2</code> to update the physical volume size</li>
<li>run <code>lvresize -L +1G /dev/VolGroup00/LogVol01</code> to add 1G bytes to my swap</li>
<li>run <code>lvresize -l +100%FREE /dev/VolGroup00/LogVol00</code> to add all free space to my Linux system</li>
<li>run <code>resize2fs -p /dev/VolGroup00/LogVol00</code> to resize the ext3 file system</li>
<li>run <code>swapoff -a</code> to turn off swap</li>
<li>cat /etc/fstab to get the swap UUID, in my case it&#8217;s 52841e8a-2b3d-4a9d-92bc-1b5af50e4b8a</li>
<li>run <code>mkswap -U 52841e8a-2b3d-4a9d-92bc-1b5af50e4b8a /dev/VolGroup00/LogVol01</code> to rebuild swap</li>
<li>run <code>swapon -a</code> to turn on swap</li>
<li>run e2fsck to check the file system if necessary</li>
</ol>
<p>After these steps, <code>dh -h</code> shows that I have successfully increased the size of my file system.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mintact.com/?feed=rss2&amp;p=28</wfw:commentRss>
		</item>
		<item>
		<title>Using external monitors on my Linux laptops</title>
		<link>http://www.mintact.com/?p=27</link>
		<comments>http://www.mintact.com/?p=27#comments</comments>
		<pubDate>Thu, 09 Jul 2009 17:41:09 +0000</pubDate>
		<dc:creator>Min Chen</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[xrandr linux external monitor]]></category>

		<guid isPermaLink="false">http://www.mintact.com/?p=27</guid>
		<description><![CDATA[Using xrandr to switch between laptop monitor and external monitor with shell script attached.]]></description>
			<content:encoded><![CDATA[<p>I have one HP laptop (with Intel graphic chips) with Fedora 10 installed and I had never made the external monitor hotkey fn+f4 working. I have another HP laptop (also using Intel graphic chips) with Fedora 11 installed, fn+f4 hotkey works but not as flexible as what I wanted. so I had to find a solution with the xrandr extension.</p>
<p>First step is to get the external monitor&#8217;s modeline. Running <code>cvt h_resolution v_resolution</code> will usually display the modeline that can be used directly. I have to make sure the refresh rates displayed by <code>cvt</code> is within the range of my monitor&#8217;s specification. My experience is that the modeline displayed by <code>cvt</code> needs to be fine tuned to get the best result. I have an LCD with 1680&#215;1050 max resolution, the output of <code>cvt 1680 1050</code> is</p>
<p><code><br />
# 1680x1050 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz<br />
Modeline "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync<br />
</code>
</p>
<p>Using the same command, I get the modeline for my LCD TV</p>
<p>
<code><br />
# 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz<br />
Modeline "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync<br />
</code>
</p>
<p>After running <code>cvt</code>, I modify the <code>Xorg.conf</code> for <code>xrandr</code>. Here&#8217;s how I set it up:</p>
<ol>
<li>Hook up my LCD to my laptop, turn on the LCD, restart X by press ctrl+alt+backspace to have a clean Xorg log</li>
<li>run <br /><code>xrandr --query</code></li>
<li><code>vi /var/log/Xorg.0.log</code></li>
<li>search
<p><code>Using config file:</code></p>
<p> I will need to edit this file later. I have
<p><code>(==) Using config file: "/etc/X11/xorg.conf"</code></p>
<p> in Xorg log, so I&#8217;ll edit <code>/etc/X11/xorg.conf</code> later</li>
<li>search <code>ServerLayout</code> in Xorg log to find out what screen is used.<br />
I see
<p>
<code><br />
(==) ServerLayout "single head configuration"<br />
(**) |--&gt;Screen "Screen0" (0)<br />
(**) |   |--&gt;Monitor "Monitor0"<br />
(**) |   |--&gt;Device "Videocard0"<br />
(**) |--&gt;Input Device "Keyboard0"<br />
(**) |--&gt;Input Device "Synaptics"<br />
</code></p>
<p>So I know I am using <code>Screen0</code></li>
<li>Optionally search
<p><code>Output VGA using monitor section</code></p>
<p>and I get
<p>
<code>(II) intel(0): Output VGA using monitor section Monitor0</code></p>
<p> so I&#8217;ll edit <code>Monitor0</code> in <code>xorg.conf</code>. This message might be <code>Intel</code> driver specific</li>
<li>Optionally get the maximum sync rate from my monitor&#8217;s specification, which is 75.0 Hz (V)x 81.0 KHz (H), or by reading the detail message in <code>Xorg.0.log</code></li>
<li>Optionally edit <code>xorg.conf</code> mentioned in previous step. search <code>Identifier   "Monitor0"</code>, make sure the max of <code>HorizSync</code> and <code>VertRefresh</code> are larger than or equal to the numbers in monitor&#8217;s specification.This is my monitor section after changing <code>HorizSync</code> and <code>VertRefresh</code><br />
<blockquote><p>
<code><br />
Section "Monitor"<br />
&nbsp;&nbsp;Identifier   "Monitor0"<br />
&nbsp;&nbsp;ModelName    "LCD Panel 1280x800"<br />
&nbsp;&nbsp;HorizSync    31.5 - 75.0<br />
&nbsp;&nbsp;VertRefresh  30.0 - 81.0<br />
&nbsp;&nbsp;Option      "dpms"<br />
EndSection</p>
<p></code>
</p></blockquote>
<p>These 3 steps are optional. Without this step, the driver may show <code>hsync out of range</code> or <code>vrefresh out of range</code> message.</p>
</li>
<li>In above steps, I know I am using &#8220;Screen0&#8243;. Now in xorg.conf, search
<p><code>Identifier "Screen0"</code></p>
<p> in <code>Section "Screen"</code>, add <code>Virtual</code> in <code>SubSection "Display"</code> to specify the virtual screen size. The virtual screen size must be big enough to hold the laptop monitor and an external monitor. My laptop resolution is 1280&#215;800, and my LCD TV resolution is 1920&#215;1080, I want these monitors aligning from left to right, so the virtual screen size is (1280+1920) x Max(800, 1080), so I put 3200 1080 to xorg.conf.<br />
Here&#8217;s what the screen section looks</p>
<blockquote><p>
<code><br />
Section "Screen"<br />
&nbsp;&nbsp;Identifier "Screen0"<br />
&nbsp;&nbsp;Device     "Videocard0"<br />
&nbsp;&nbsp;Monitor    "Monitor0"<br />
&nbsp;&nbsp;DefaultDepth     24<br />
&nbsp;&nbsp;SubSection "Display"<br />
&nbsp;&nbsp;&nbsp;&nbsp;Viewport   0 0<br />
&nbsp;&nbsp;&nbsp;&nbsp;Depth     24<br />
&nbsp;&nbsp;&nbsp;&nbsp;Modes    "1280x800" "1280x720" "1024x768" "800x600" "640x480"<br />
&nbsp;&nbsp;&nbsp;&nbsp;Virtual 3200 1080<br />
&nbsp;&nbsp;EndSubSection<br />
EndSection</code></p></blockquote>
</li>
</ol>
<p>Then I created a shell script to use <code>xrandr</code> to control my monitors.</p>
<blockquote><p>
#!/bin/sh<br />
# This script is to switch monitors because the fn+f4 hotkey doesn&#8217;t work<br />
#<br />
# Author: Min Gang Chen<br />
# Make sure &#8220;Virtual&#8221; in SubSection &#8220;Display&#8221; in Section &#8220;Screen&#8221; is big<br />
# enough to cover all monitors</p>
<p>LCD_MODELINE=&#8221;1680&#215;1050 146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync&#8221;</p>
<p>TV_MODELINE=&#8221;1920X1080 173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync&#8221;</p>
<p># this is the modeline for my HP laptop<br />
LAPTOP_MODELINE=&#8221;1280&#215;800 69.30 1280 1328 1360 1415 800 803 809 816 -hsync -vsync&#8221;</p>
<p>SVIDEO_MODELINE=&#8221;"<br />
# rung xrandr -q to get the output names<br />
# use VGA for Fedora 10 and VGA1 for Fedora 11<br />
EXTERNAL_OUTPUT_NAME=&#8221;VGA&#8221;<br />
# use LVDS for Fedora 10 and LVDS1 for Fedora 11<br />
LAPTOP_OUTPUT_NAME=&#8221;LVDS&#8221;<br />
# use TV for Fedora 10 and TV1 for Fedora 11<br />
SVIDEO_OUTPUT_NAME=&#8221;TV&#8221;</p>
<p>XRANDR=/usr/bin/xrandr</p>
<p># Set the resolution for external display<br />
set_external_mode()<br />
{<br />
&nbsp;&nbsp;case $1 in<br />
&nbsp;&nbsp;&nbsp;&nbsp;lcd) EXTERNAL_MODELINE=&#8221;$LCD_MODELINE&#8221;;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;tv) EXTERNAL_MODELINE=&#8221;$TV_MODELINE&#8221;;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;*) EXTERNAL_MODELINE=&#8221;$LCD_MODELINE&#8221;;;<br />
&nbsp;&nbsp;esac<br />
&nbsp;&nbsp;$XRANDR &#8211;newmode $EXTERNAL_MODELINE &gt;/dev/null 2&gt;&amp;1<br />
&nbsp;&nbsp;$XRANDR &#8211;addmode $EXTERNAL_OUTPUT_NAME `echo &#8220;$EXTERNAL_MODELINE&#8221; | cut -f1 -d &#8221; &#8220;` &gt; /dev/null 2&gt;&amp;1<br />
}</p>
<p># Use LAPTOP monitor<br />
laptop()<br />
{<br />
&nbsp;&nbsp;if [ "x$EXTERNAL_ON" = "xfalse" ]<br />
&nbsp;&nbsp;then<br />
&nbsp;&nbsp;&nbsp;&nbsp;# turning off external monitors in case they were on<br />
&nbsp;&nbsp;&nbsp;&nbsp;$XRANDR &#8211;output $EXTERNAL_OUTPUT_NAME &#8211;off<br />
&nbsp;&nbsp;&nbsp;&nbsp;$XRANDR &#8211;output $SVIDEO_OUTPUT_NAME &#8211;off<br />
&nbsp;&nbsp;&nbsp;&nbsp;# Positioning LAPTOP monitor at x:0 y:0<br />
&nbsp;&nbsp;&nbsp;&nbsp;$XRANDR &#8211;output $LAPTOP_OUTPUT_NAME &#8211;pos 0&#215;0 &#8211;auto<br />
&nbsp;&nbsp;elif [ "x$EXTERNAL_ON" = "xtrue" ]<br />
&nbsp;&nbsp;then<br />
&nbsp;&nbsp;&nbsp;&nbsp;# external is alreay on, align the new monitor to the right<br />
&nbsp;&nbsp;&nbsp;&nbsp;RIGHT=`echo &#8220;$EXTERNAL_MODELINE&#8221; | cut -f3 -d &#8221; &#8220;`<br />
&nbsp;&nbsp;&nbsp;&nbsp;$XRANDR &#8211;output $LAPTOP_OUTPUT_NAME &#8211;pos ${RIGHT}x0 &#8211;auto<br />
&nbsp;&nbsp;fi<br />
}</p>
<p># Use External monitor<br />
external()<br />
{<br />
&nbsp;&nbsp;set_external_mode $1<br />
&nbsp;&nbsp;MODE=`echo &#8220;$EXTERNAL_MODELINE&#8221; | cut -f1 -d &#8221; &#8220;`<br />
&nbsp;&nbsp;if [ "x$LAPTOP_ON" = "xfalse" ]<br />
&nbsp;&nbsp;then<br />
&nbsp;&nbsp;&nbsp;&nbsp;# turning off LAPTOP and S_Video monitors in case they were on<br />
&nbsp;&nbsp;&nbsp;&nbsp;$XRANDR &#8211;output $LAPTOP_OUTPUT_NAME &#8211;off<br />
&nbsp;&nbsp;&nbsp;&nbsp;$XRANDR &#8211;output $SVIDEO_OUTPUT_NAME &#8211;off<br />
&nbsp;&nbsp;&nbsp;&nbsp;# positioning external monitor at x:0 y:0<br />
&nbsp;&nbsp;&nbsp;&nbsp;$XRANDR &#8211;output $EXTERNAL_OUTPUT_NAME &#8211;pos 0&#215;0 &#8211;mode &#8220;$MODE&#8221;<br />
&nbsp;&nbsp;elif [ "x$LAPTOP_ON" = "xtrue" ]<br />
&nbsp;&nbsp;then<br />
&nbsp;&nbsp;&nbsp;&nbsp;# laptop monitor is on, align to the right<br />
&nbsp;&nbsp;&nbsp;&nbsp;RIGHT=`echo &#8220;$LAPTOP_MODELINE&#8221; | cut -f3 -d &#8221; &#8220;`<br />
&nbsp;&nbsp;&nbsp;&nbsp;$XRANDR &#8211;output $EXTERNAL_OUTPUT_NAME &#8211;pos ${RIGHT}x0 &#8211;mode &#8220;$MODE&#8221;<br />
&nbsp;&nbsp;fi<br />
}</p>
<p># User both LAPTOP and External, external at the right of Laptop<br />
use_both()<br />
{<br />
&nbsp;&nbsp;set_external_mode<br />
&nbsp;&nbsp;$XRANDR &#8211;output $LAPTOP_OUTPUT_NAME &#8211;pos 0&#215;0 &#8211;auto</p>
<p>&nbsp;&nbsp;MODE=`echo &#8220;$EXTERNAL_MODELINE&#8221; | cut -f1 -d &#8221; &#8220;`<br />
&nbsp;&nbsp;RIGHT=`echo &#8220;$LAPTOP_MODELINE&#8221; | cut -f3 -d &#8221; &#8220;`<br />
&nbsp;&nbsp;$XRANDR &#8211;output $EXTERNAL_OUTPUT_NAME &#8211;pos ${RIGHT}x0 &#8211;mode &#8220;$MODE&#8221;<br />
}</p>
<p>print_usage()<br />
{<br />
&nbsp;&nbsp;echo &#8220;Usage: $0 [options]&#8221;<br />
&nbsp;&nbsp;echo &#8220;options:&#8221;<br />
&nbsp;&nbsp;echo -e &#8220;\t-l use Laptop monitor&#8221;<br />
&nbsp;&nbsp;echo -e &#8220;\t-e[lcd|tv] use external monitor&#8221;<br />
#echo -e &#8220;\t-b use both monitor, the laptop on left and external monitor on right&#8221;<br />
&nbsp;&nbsp;echo &#8220;&#8221;<br />
&nbsp;&nbsp;echo &#8220;The order of options DOES matter. The monitors will be aligned from \<br />
left to right, based upon the order. For example, running $0 -l -e lcd will \<br />
align external monitor to the right border of the laptop monitor.&#8221;<br />
&nbsp;&nbsp;echo &#8220;If only one option is given, only that specific monitor will be turned \<br />
on. For example, running $0 -l will turn off external monitor if it was already on, and then turn on laptop monitor.&#8221;<br />
&nbsp;&nbsp;exit 1<br />
}</p>
<p>if [ "$#" -eq "0" ]<br />
then<br />
&nbsp;&nbsp;print_usage<br />
fi</p>
<p>LAPTOP_ON=false<br />
EXTERNAL_ON=false</p>
<p>while getopts le: FLAG<br />
do<br />
case $FLAG in<br />
&nbsp;&nbsp;l)  LAPTOP_ON=true<br />
&nbsp;&nbsp;&nbsp;&nbsp;laptop;;<br />
&nbsp;&nbsp;e)  EXTERNAL_ON=true<br />
&nbsp;&nbsp;&nbsp;&nbsp;external $OPTARG;;<br />
&nbsp;&nbsp;?)  print_usage<br />
&nbsp;&nbsp;&nbsp;&nbsp;exit 2;;<br />
esac<br />
done
</p></blockquote>
<p>By adding a new modeline to the script, I could support more monitor models and switch between laptop monitor and external monitor, or use both monitors easily.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mintact.com/?feed=rss2&amp;p=27</wfw:commentRss>
		</item>
		<item>
		<title>Editing PDF on Linux</title>
		<link>http://www.mintact.com/?p=26</link>
		<comments>http://www.mintact.com/?p=26#comments</comments>
		<pubDate>Fri, 19 Jun 2009 02:16:10 +0000</pubDate>
		<dc:creator>Min Chen</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[edit]]></category>

		<category><![CDATA[pdf]]></category>

		<guid isPermaLink="false">http://www.mintact.com/?p=26</guid>
		<description><![CDATA[OpenOffice and PDFedit are two good tools for editing text in the pdf file. However, if you need to change the layout, add a picture etc, you need to find a new approach.
Here&#8217;s what I usually do:

using ghostscript to generate TIFF files using this command
gs -sDEVICE=tiff24nc -r150&#215;150 -sPAPERSIZE=letter -sOutputFile=&#60;output dir&#62;/&#60;base filename&#62;%03d.tif -dNOPAUSE -dBATCH &#8212; &#60;pdf [...]]]></description>
			<content:encoded><![CDATA[<p>OpenOffice and PDFedit are two good tools for editing text in the pdf file. However, if you need to change the layout, add a picture etc, you need to find a new approach.</p>
<p>Here&#8217;s what I usually do:</p>
<ol>
<li>using ghostscript to generate TIFF files using this command<br />
gs -sDEVICE=tiff24nc -r150&#215;150 -sPAPERSIZE=letter -sOutputFile=&lt;output dir&gt;/&lt;base filename&gt;%03d.tif -dNOPAUSE -dBATCH &#8212; &lt;pdf filename&gt;</p>
<p>This command will create 24bit colour 150&#215;150 resolution TIFF files to &lt;output dir&gt; using the filename pattern as &lt;base filename&gt;001.tif to maximum &lt;base filename&gt;999.tif using letter size. For example, a 5 page PDF file will generate 5 tif files</li>
<li>editing tiff page by page using gimp, then explicitly saving each page as tiff, compressed with JPEG</li>
<li>combining each tiff into one multi-page tiff using tiffcp<br />
tiffcp -c jpeg src001.tif src002.tif &#8230;. src999.tif dst.tif</li>
<li>using tiff2pdf to generate PDF file from dst.tif<br />
tiff2pdf -p letter -j -q75 -t &#8220;new PDF title&#8221; -o output.pdf dst.tif<br />
Using this command I will get a letter size pdf file, the tiff is JPEG compressed with 75% quality and the pdf title will be &#8220;new PDF title&#8221;</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.mintact.com/?feed=rss2&amp;p=26</wfw:commentRss>
		</item>
		<item>
		<title>A quick note in installing JDK on Fedora 8</title>
		<link>http://www.mintact.com/?p=24</link>
		<comments>http://www.mintact.com/?p=24#comments</comments>
		<pubDate>Wed, 11 Jun 2008 21:39:49 +0000</pubDate>
		<dc:creator>Min Chen</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Fedora JDK]]></category>

		<guid isPermaLink="false">http://www.mintact.com/?p=24</guid>
		<description><![CDATA[There are only gcj and icedtea java in Fedora repository, but I need JDK from Sun, IBM, BEA installed. What I&#8217;ve done was to download rpm packages and install them. Then I added these JDKs to the alternatives by running
sudo /usr/sbin/alternatives &#8211;install /usr/bin/java java /usr/java/jdk1.5.0_15/bin/java 3
Then by running
sudo /usr/bin/alternatives &#8211;config java
I configured the defaut JDK [...]]]></description>
			<content:encoded><![CDATA[<p>There are only gcj and icedtea java in Fedora repository, but I need JDK from Sun, IBM, BEA installed. What I&#8217;ve done was to download rpm packages and install them. Then I added these JDKs to the alternatives by running</p>
<p>sudo /usr/sbin/alternatives &#8211;install /usr/bin/java java /usr/java/jdk1.5.0_15/bin/java 3</p>
<p>Then by running</p>
<p>sudo /usr/bin/alternatives &#8211;config java</p>
<p>I configured the defaut JDK in my environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mintact.com/?feed=rss2&amp;p=24</wfw:commentRss>
		</item>
		<item>
		<title>LDAP injection</title>
		<link>http://www.mintact.com/?p=23</link>
		<comments>http://www.mintact.com/?p=23#comments</comments>
		<pubDate>Tue, 10 Jun 2008 22:01:54 +0000</pubDate>
		<dc:creator>Min Chen</dc:creator>
		
		<category><![CDATA[Application Security]]></category>

		<category><![CDATA[LDAP Data Injection]]></category>

		<guid isPermaLink="false">http://www.mintact.com/?p=23</guid>
		<description><![CDATA[Examples of LDAP Injection]]></description>
			<content:encoded><![CDATA[<p>Today I joined the SecureToronto meeting. When the presenter Nish Bhalla was talking about SQL injection, an audience rasied a question about LDAP injection. Nish explained the theory, but because of the tight schedule he didn&#8217;t show any examples.</p>
<p>I may add some examples to this LDAP injection topic.</p>
<p>LDAP v3 clearly defines the SEARCH operation. LDAP client has to provide a search FILTER for the LDAP server to locate the LDAP Entry (similar to the row in a relational database table). The syntax of the filter is also defined in the protocols. For example, to search an entry of user with userid=foo, and password=bar, the filter is<br />
(&amp;(uid=foo)(userPassword=bar)). The LDAP search returns all entries that match this condition, or nothing (some LDAP may return an exception) if there&#8217;s no match.</p>
<p>In this example, if someone uses userid=* and password=*, the filter would be (&amp;(uid=*)(userPassword=*)) and this would match all entries that have both &#8216;uid&#8217; and &#8216;userPassword&#8217; attributes present.</p>
<p>Another example, if someone uses userid=foo)(!, and password=bar), the filter would be (&amp;(uid=foo)(!(userPassword=bar))), this would match all entries with uid=foo and password != bar.</p>
<p>It&#8217;s very dangerous to verify userid and password by just checking the number of returned entries.</p>
<p>Generally there are two approaches to authenticate a user using LDAP:</p>
<ol>
<li>Direct LDAP authentication. The application manages to get the user Distinguished Name and the password, then calls LDAP BIND operation to let the LDAP server verify the DN and password.</li>
<li>The application searches LDAP for the user id. If there&#8217;s a match, the application gets the LDAP entry, and then compares the password in the LDAP entry with the user provided one.</li>
</ol>
<p>Unlike SQL injection, in either case, unless the application does something wrong in password comparison, it&#8217;s pretty hard to bypass the authentication by manipulated the user id and password.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mintact.com/?feed=rss2&amp;p=23</wfw:commentRss>
		</item>
		<item>
		<title>Using USB devices in VirtualBox</title>
		<link>http://www.mintact.com/?p=22</link>
		<comments>http://www.mintact.com/?p=22#comments</comments>
		<pubDate>Mon, 02 Jun 2008 21:06:01 +0000</pubDate>
		<dc:creator>Min Chen</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Fedora]]></category>

		<category><![CDATA[USB]]></category>

		<category><![CDATA[VirtualBox]]></category>

		<guid isPermaLink="false">http://www.mintact.com/?p=22</guid>
		<description><![CDATA[I had problem using USB devices in VirtualBox 1.6.0 on my Fedora 8 laptop. All USB devices were grayed out in VirtualBox. By following the VirtualBox online help &#8220;11.5.7. USB not working&#8221;, I managed to get all USB devices working.
Steps:

Make sure your uid is in &#8220;vboxusers&#8221; group. You can do this using the &#8220;System-&#62;Administration-&#62;Users and [...]]]></description>
			<content:encoded><![CDATA[<p>I had problem using USB devices in VirtualBox 1.6.0 on my Fedora 8 laptop. All USB devices were grayed out in VirtualBox. By following the VirtualBox online help &#8220;11.5.7. USB not working&#8221;, I managed to get all USB devices working.</p>
<p>Steps:</p>
<ol>
<li>Make sure your uid is in &#8220;vboxusers&#8221; group. You can do this using the &#8220;System-&gt;Administration-&gt;Users and Groups&#8221;, or edit the /etc/group directly, etc. My /etc/group has this line &#8220;vboxusers:x:501:mchen,root&#8221; where mchen is my uid</li>
<li>Edit /etc/rc.sysinit, search for &#8220;mount - n -t usbfs /proc/bus/usb&#8221;, append &#8220;-o devgid=501,devmode=664&#8243; at the end . Of course you need to change 501 to your vboxusers gid. In my situation, I changed<br />
if [ ! -d /proc/bus/usb ]; then<br />
modprobe usbcore &gt;/dev/null 2&gt;&amp;1 &amp;&amp; mount -n -t usbfs /proc/bus/usb /proc/bus/usb<br />
else<br />
mount -n -t usbfs /proc/bus/usb /proc/bus/usb<br />
fi</p>
<p>To</p>
<p>if [ ! -d /proc/bus/usb ]; then<br />
modprobe usbcore &gt;/dev/null 2&gt;&amp;1 &amp;&amp; mount -n -t usbfs /proc/bus/usb /proc/bus/usb -o devgid=501,devmode=664<br />
else<br />
mount -n -t usbfs /proc/bus/usb /proc/bus/usb -o devgid=501,devmode=664<br />
fi</li>
<li>Reboot the Fedora box and now all USB devices should be available for VirtualBox</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.mintact.com/?feed=rss2&amp;p=22</wfw:commentRss>
		</item>
	</channel>
</rss>
