Displaying PDF In Our Website

Displaying PDF In Our Website

Ingredients:

Download both software

# yum -y install swftools
# wget http://flexpaper.googlecode.com/files/FlexPaper_1.3.1_flash.zip

Go to http DocumentRoot, then unzip FlexPaper_1.3.1_flash.zip

# cd /var/www/html/
# unzip /path/to/FlexPaper_1.3.1_flash.zip

There’s example in FlexPaper_1.3.1_flash.zip distribution, We need to create our own swf file from existing pdf

# pdf2swf DNSSEC_in_6_minutes.pdf -o DNSSEC_in_6_minutes.swf -T 9 -f

Lots of NOTICE output there…

NOTICE  Adding /usr/share/swftools/fonts to font directories
Title:        Slide 1
Author:       Alan Clegg
Creator:      Impress
Producer:     OpenOffice.org 2.4
CreationDate: 20080715091448-04'00'
Pages:        79
Linearized:   no
Encrypted:    no
NOTICE  processing PDF page 1 (720x540:0:0) (move:0:0)
NOTICE  file contains jpeg pictures
NOTICE  file contains pbm pictures 
NOTICE  processing PDF page 2 (720x540:0:0) (move:0:0)
NOTICE  processing PDF page 3 (720x540:0:0) (move:0:0)
NOTICE  File contains links
NOTICE  processing PDF page 4 (720x540:0:0) (move:0:0)
NOTICE  processing PDF page 5 (720x540:0:0) (move:0:0)
NOTICE  processing PDF page 6 (720x540:0:0) (move:0:0)
NOTICE  processing PDF page 7 (720x540:0:0) (move:0:0)
NOTICE  processing PDF page 8 (720x540:0:0) (move:0:0)
NOTICE  processing PDF page 9 (720x540:0:0) (move:0:0)
NOTICE  processing PDF page 10 (720x540:0:0) (move:0:0)
NOTICE  processing PDF page 11 (720x540:0:0) (move:0:0)
NOTICE  processing PDF page 12 (720x540:0:0) (move:0:0)
NOTICE  processing PDF page 13 (720x540:0:0) (move:0:0)
NOTICE  processing PDF page 14 (720x540:0:0) (move:0:0)
NOTICE  processing PDF page 15 (720x540:0:0) (move:0:0)
NOTICE  processing PDF page 16 (720x540:0:0) (move:0:0)
--- cut ---
NOTICE  SWF written

Fedora Build xtables-addons1-1.24 RPM Package With Build Options

Continuing previous article about Building xtables-addons1-1.24 RPM Package, Now added feature which allow us to build the package with options
for example:

$ rpmbuild -ta xtables-addons-1.24.tar.bz2 --with ACCOUNT --with ipset --with geoip

With this command, only ACCOUNT,ipset,geoip modules would be built, other xtables-addons modules are not built(discarded)

Availble options:

--with ACCOUNT
--with CHAOS
--with DELUDE
--with DHCPMAC
--with ECHO
--with IPMARK
--with LOGMARK
--with RAWNAT
--with STEAL
--with SYSRQ
--with TARPIT
--with TEE
--with condition
--with fuzzy
--with geoip
--with iface
--with ipp2p
--with ipset
--with ipv4options
--with length2
--with lscan
--with pknock
--with psd
--with quota2

Fedora Build xtables-addons1-1.24 RPM Package

This tutorial was tested on fedora 12 system, it might be worked on onthers redhat base system, I’ve modified rpm spec file as generic as possible. it was shamelessly stolen 😀 from Jan Engelhardt xtables rpm source file.i slightly modified it a bit

Download xtables-addons 1.24 source

$ wget http://downloads.sourceforge.net/project/xtables-addons/Xtables-addons/1.24/xtables-addons-1.24.tar.bz2?use_mirror=nchc

prepare your .rpmmacros environment, rpmbuild directories, if not exist yet

$ mkdir rpmbuild
$ mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS,tmp}

Create .rpmmacros file

$ vi  .rpmmacros
%_topdir                %(echo $HOME)/rpmbuild
%_tmppath               %(echo $HOME)/rpmbuild/tmp

[p>Extract xtables-addons-1.24.tar.bz2, cd to xtables-addons-1.24 directory

$ tar xjf xtables-addons-1.24.tar.bz2
$ cd xtables-addons-1.24

Hosting Your Own Git Repository on fedora 12

This tutorial will covering common feature in git repository

  • commiting via ssh
  • Enable gitweb for web access
  • cloning anonymously using the Git protocol

Install git, git-daemon

# yum -y install git git-daemon gitweb

Create a git user/group

# useradd -U -d /var/cache/git -s /usr/libexec/git-core/git-shell git

Make sure the permissions of the directory are correct

# cd /var/cache
# chown -R git:git git
# chmod 755 git

We’ll be using SSH keys for authenication, so collect the public keys of all the users who need commit access. Then, put the public keys into the right place

# cd /var/cache/git
# mkdir .ssh
# chmod 700 .ssh
# touch .ssh/authorized_keys
# chmod 600 .ssh/authorized_keys
(Put the public keys into authorized_keys, one per line)
# chown -R git:git .ssh/

Compile Postfix 2.7.0 from simon j. mudd git repository

First, we need to clone Simon J. Mudd postfix repository at github

$ git clone git://github.com/sjmudd/postfix-rpm.git

Switch to (also create local) POSTFIX_2_7 branch

$ cd postfix-rpm
$ git checkout --track -b POSTFIX_2_7 origin/POSTFIX_2_7

Copy postfix-rpm, which contain POSTFIX_2_7 branch

$ cd ..
$ cp -rp postfix-rpm postfix-2.7

Create .rpmmacros on your homedir if you don’t have one

$ make setup

postfix 2.8-20100213 postscreen

I've been experimenting with postfix 2.8-20100213 "postscreen" feature on my development server.this feature is very usefull for detecting/dropping misbehavior smtp client. Configuration : main.cf [text] postscreen_greet_action = drop postscreen_dnsbl_sites = zen.spamhaus.org, spam.ipv6.kutukupret.com postscreen_hangup_action = drop postscreen_dnsbl_action = drop [/text] master.cf [text] smtp inet n - n - 1 postscreen smtpd…

postfix-2.8.0.src.rpm

I’ve Built SRPM package for postfix 2.8.0 on my spare time today, based on Simon J. Mudd’s template of course :) The Hardest parts was testing and applies the right patches, but it seems okay when it compiled Here’s the srpm file: This how to rebuild the source : [bash]…

Compiling Postfix-2.7.0 As RPM Package

I used to have Simon J. Mudd when building postfix rpm package, but seems he’s not releasing official postfix 2.7.0 yet, here’s a way for impatient one

First make RedHat Linux the standard directory structure in our homedir

$ mkdir rpmbuild
$ mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS,tmp}

Create .rpmmacros file

$ vi .rpmmacros
%_topdir                %(echo $HOME)/rpmbuild
%_tmppath               %(echo $HOME)/rpmbuild/tmp

Create tempoerary working directory for postfix

$ mkdir postfix
$ cd postfix

Counting Directory Size Recursively Using C Part 2

Even there’s an easier way calculating directory size ftw syscall/API

NAME
ftw, nftw - file tree walk

DESCRIPTION
ftw() walks through the directory tree that is located under the directory dirpath, and calls fn() once for each entry in the tree.
By default, directories are handled before the files and subdirectories they contain (pre-order traversal).

CONFORMING TO
POSIX.1-2001, SVr4, SUSv1.

example code size.c

Counting Directory Size Recursively Using C

I’ve just found this great articles at Jim Plank website. I know, it was lots easier using linux du command

Without any further nonsense talk, here we go. First we need download some source code at Jim Plank website

# mkdir prsize
# cd prsize
# wget http://www.cs.utk.edu/~plank/plank/classes/cs360/360/notes/Prsize/prsize8.c
# wget http://www.cs.utk.edu/~plank/plank/classes/cs360/360/src/dllist.c
# wget http://www.cs.utk.edu/~plank/plank/classes/cs360/360/notes/Dllists/dllist.h
# wget http://www.cs.utk.edu/~plank/plank/classes/cs360/360/src/jrb.c
# wget http://www.cs.utk.edu/~plank/plank/classes/cs360/360/include/jrb.h
# wget http://www.cs.utk.edu/~plank/plank/classes/cs360/360/src/jval.c
# wget http://www.cs.utk.edu/~plank/plank/classes/cs360/360/include/jval.h

prsize8.c is the main program, while dllist.c/h jrb.c/h jval.c/h is library that prsize8 statically linked in.

Now we need to create some static library.(Original website doesn’t explain how to create the libs)

# gcc -c dllist.c -o dllist.o
# gcc -c jrb.c -o jrb.o
# gcc -c jval.c -o jval.o

# ar rcs libdllist.a dllist.o
# ar rcs libjrb.a jrb.o
# ar rcs libjval.a jval.o