tag:blogger.com,1999:blog-79540552024-03-13T16:20:21.394+06:00Open Source & FreedomUnknownnoreply@blogger.comBlogger80125tag:blogger.com,1999:blog-7954055.post-88701961538120945982011-08-04T04:27:00.011+06:002011-08-04T19:40:56.393+06:00Exim in Debian<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-F9M_hzxDnRM/Tjpe3MPqrBI/AAAAAAAAA_o/zVcWKnUiTvc/s1600/exim-blue-ld-87x65.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-F9M_hzxDnRM/Tjpe3MPqrBI/AAAAAAAAA_o/zVcWKnUiTvc/s1600/exim-blue-ld-87x65.png" /></a><a href="http://2.bp.blogspot.com/-pxP82ISwDfQ/TXnkkLiKOqI/AAAAAAAAA_E/RLNHhqKW834/s1600/deban_logo_wikipedia.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-pxP82ISwDfQ/TXnkkLiKOqI/AAAAAAAAA_E/RLNHhqKW834/s1600/deban_logo_wikipedia.png" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-F9M_hzxDnRM/Tjpe3MPqrBI/AAAAAAAAA_o/zVcWKnUiTvc/s1600/exim-blue-ld-87x65.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br />
</a></div><br />
I was trying to configure Exim4 in debian for receiving and sending email occasionally.<br />
<br />
First I have setup account in dyndns.com for my dynamic public IP.<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">#dpkg-reconfigure exim4-config</div></blockquote><div style="font-family: "Courier New",Courier,monospace;">General type of mail configuration: <i>internet site; mail is sent and received directly using SMTP.</i></div><div style="font-family: "Courier New",Courier,monospace;">System mail name: <i>yourdomain.com</i></div><div style="font-family: "Courier New",Courier,monospace;">IP-addresses to listen on for incomming SMTP connections:<i> // leave blank </i></div><div style="font-family: "Courier New",Courier,monospace;">Other destinations for which mail is accepted: <i>yourdomain.com</i></div><div style="font-family: "Courier New",Courier,monospace;">Domains to relay mail for: <i>// leave blank</i></div><div style="font-family: "Courier New",Courier,monospace;">Machines to relay mail for: <i>// leave blank</i></div><div style="font-family: "Courier New",Courier,monospace;">Keep number of DNS-queries minimal (Dial-on-Demand) ?: <i>No</i></div><div style="font-family: "Courier New",Courier,monospace;">Delivery method for local mail: <i>Maildir format in home directory</i></div><span style="font-family: "Courier New",Courier,monospace;">Split configuration into small files ? : </span><i style="font-family: "Courier New",Courier,monospace;">No</i><br />
<br />
You can add new account in Evolution mail as "<b>maildir</b>", sending SMTP localhost. done.....<br />
<br />
If you face problem while sending mail, you might be interested to configure SMTP relay:<br />
<a href="http://wiki.debian.org/GmailAndExim4">http://wiki.debian.org/GmailAndExim4</a><br />
<br />
<br />
<b>TLS and Authentication</b><br />
<br />
Generate a certificate using:<br />
<span style="font-family: "Courier New",Courier,monospace;">#bash /usr/share/doc/exim4-base/examples/exim-gencert </span><br />
<br />
It will generate <span style="font-family: "Courier New",Courier,monospace;">exim.crt</span> and <span style="font-family: "Courier New",Courier,monospace;">exim.key</span> in <span style="font-family: "Courier New",Courier,monospace;">/etc/exim4/</span><br />
You may simply copy certificates if you have bought it earlier.<br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">#cd /etc/exim4</div><div style="font-family: "Courier New",Courier,monospace;">#vi exim4.conf.template </div><br />
add the following line <br />
<span style="font-family: "Courier New",Courier,monospace;">MAIN_TLS_ENABLE = yes</span><br />
<br />
before<br />
<span style="font-family: "Courier New",Courier,monospace;">.ifdef MAIN_TLS_ENABLE </span><br />
<br />
<br />
To verify TLS we are installing diagnostic tool:<br />
<blockquote><span style="font-family: "Courier New",Courier,monospace;"># apt-get install swaks libnet-ssleay-perl</span></blockquote>Test the connection:<br />
<blockquote><span style="font-family: "Courier New",Courier,monospace;">$ swaks -a -tls -q HELO -s localhost -au your_user -ap '<>'</span><br />
<span style="font-family: "Courier New",Courier,monospace; font-size: x-small;">=== Trying localhost:25...<br />
=== Connected to localhost.<br />
<- 220 debianwb ESMTP Exim 4.76 Thu, 04 Aug 2011 14:22:02 +0600<br />
-> EHLO debianwb<br />
<- 250-debianwb Hello localhost [127.0.0.1]<br />
<- 250-SIZE 52428800<br />
<- 250-PIPELINING<br />
<- 250-STARTTLS<br />
<- 250 HELP<br />
-> STARTTLS<br />
<- 220 TLS go ahead<br />
=== TLS started w/ cipher DHE-RSA-AES256-SHA<br />
~> EHLO debianwb<br />
<~ 250-debianwb Hello localhost [127.0.0.1]<br />
<~ 250-SIZE 52428800<br />
<~ 250-PIPELINING<br />
<~ 250 HELP<br />
~> QUIT<br />
<~ 221 evie closing connection</span></blockquote>We were sending an empty pass while testing <span style="font-family: "Courier New",Courier,monospace;">swaks</span>.<br />
Now, we will add authentication schema.<br />
For the shell users we are using <span style="font-family: "Courier New",Courier,monospace;">SASL</span>, which uses <span style="font-family: "Courier New",Courier,monospace;">PAM</span> for password authentication.<br />
<br />
#apt-get install sasl2-bin<br />
<br />
To enable: <br />
#vi /etc/default/saslauthd <br />
<blockquote>START=yes</blockquote>start the deamon<br />
#/etc/init.d/saslauthd start<br />
<br />
#vi /etc/exim4/exim4.conf<br />
Un-comment the following line authentication via saslauthd:<br />
<blockquote><span style="font-family: "Courier New",Courier,monospace; font-size: x-small;">plain_saslauthd_server:<br />
driver = plaintext<br />
public_name = PLAIN<br />
server_condition = ${if saslauthd{{$auth2}{$auth3}}{1}{0}}<br />
server_set_id = $auth2<br />
server_prompts = :<br />
.ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS<br />
server_advertise_condition = ${if eq{$tls_cipher}{}{}{*}}<br />
.endif</span></blockquote><br />
Add exim to sasl group<br />
<div style="font-family: "Courier New",Courier,monospace;">#adduser Debian-exim sasl</div><br />
Test the connection using your username:<br />
<span style="font-family: "Courier New",Courier,monospace;">#swaks -a -tls -q AUTH -s localhost -au your_user</span><br />
<span style="font-family: "Courier New",Courier,monospace;">Password:</span><br />
<br />
you may need to add<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">#vi /etc/hosts</div><div style="font-family: "Courier New",Courier,monospace;">127.0.0.1 your_domain</div></blockquote><br />
Enableing IMAP access:<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">#apt-get install courier-imap courier-imap-ssl</div><span style="font-family: "Courier New",Courier,monospace;"> Create directories for web-based administration -> No</span></blockquote>You may install "File Access Monitor" daemon to check other folders beside Inbox:<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;"># apt-get install fam</div></blockquote> Check <a href="http://blog.edseek.com/%7Ejasonb/articles/exim4_courier/courierimap.html">this link</a> for details information. <br />
<br />
Optionally you can check for X.509 Certificate: <br />
<div style="font-family: "Courier New",Courier,monospace;"># vi /etc/courier/imapd.cnf</div><br />
If you do not want to use the default certificate, after edit the imapd.cnf, you may generate using:<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;"># mkimapdcert</div></blockquote><br />
If you are behind a router, forward port 25, 143, 706, 993 to your server.<br />
<br />
source:<br />
<a href="http://blog.edseek.com/%7Ejasonb/articles/exim4_courier/index.html">http://blog.edseek.com/~jasonb/articles/exim4_courier/index.html</a><br />
<a href="http://pkg-exim4.alioth.debian.org/README/README.Debian.html">http://pkg-exim4.alioth.debian.org/README/README.Debian.html </a><br />
<a href="http://library.linode.com/email/exim/send-only-mta-debian-6-squeeze">http://library.linode.com/email/exim/send-only-mta-debian-6-squeeze</a><br />
<a href="http://koivi.com/exim4-config/">http://koivi.com/exim4-config/</a>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-7954055.post-48131705300023649402011-08-03T13:38:00.000+06:002011-09-04T13:39:50.980+06:00secure wipe<div style="font-family: "Courier New",Courier,monospace;">#apt-get install secure-delete</div><br />
It will provide the following tools for secure wiping:<br />
<blockquote style="font-family: "Courier New",Courier,monospace;"><div>/usr/bin/srm</div><div>/usr/bin/sfill</div><div>/usr/bin/sswap</div><div>/usr/bin/sdmem</div></blockquote><br />
<b>srm - secure remove (secure_deletion toolkit)</b><br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">$srm file_name</div><div style="font-family: "Courier New",Courier,monospace;">$srm -r folder_name</div></blockquote><span style="font-size: x-small;"><span style="color: red;"></span><span style="color: red;"> </span></span><br />
There is already another tool "<i>shred</i>" comes with "<i>coreutils</i>" package in Debian: <br />
<b>coreutils</b> - GNU core utilities<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">/usr/bin/shred</div></blockquote><b>shred - overwrite a file to hide its contents, and optionally delete it</b><br />
<blockquote><span style="font-family: "Courier New",Courier,monospace;">$shred file_name</span></blockquote><br />
<br />
<b>sfill - secure free disk and inode space wiper (secure_deletion toolkit)</b><br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">#sfill /mount_point/</div></blockquote><br />
<b>sswap - secure swap wiper (secure_deletion toolkit)</b><br />
<br />
<i>Turn off swap first :</i><br />
<blockquote> <span style="font-family: "Courier New",Courier,monospace;">#swapoff /dev/sdaX</span><br />
or <br />
<span style="font-family: "Courier New",Courier,monospace;">#swapoff -a </span> //to turn off all swap </blockquote><i>Now run sswap:</i><br />
<blockquote>#sswap /dev/sdaX<b> </b></blockquote><b>sdmem - secure memory wiper (secure_deletion toolkit)</b><br />
<br />
<br />
There is some limitation of these tools.<br />
Please use manual pages of individual package for details information.<br />
<br />
<b></b>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7954055.post-19250404279938425482011-03-17T15:52:00.004+06:002011-03-18T13:27:58.030+06:00Bandwidth Control in LinuxThere are several ways to control / shape / manage bandwidth in Linux.<br />
<br />
<br />
Simple approach. Install <a href="http://lartc.org/wondershaper/">wondershaper</a>:<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">#apt-get install wondershaper</div></blockquote><br />
Configure it using kilobits (change eth1 according to yours):<br />
from manual "wondershaper [ interface ] [ downlink ] [ uplink ]" <br />
<blockquote><span style="font-family: "Courier New",Courier,monospace;">#wondershaper eth1 2048 2048</span> </blockquote>If you want to clear simply run:<br />
<blockquote><blockquote><span style="font-family: "Courier New",Courier,monospace;">#wondershaper clear eth1</span></blockquote></blockquote><br />
<br />
We will control the bandwidth using a tool "<span style="font-family: "Courier New",Courier,monospace;">tc</span>", which is a part of "<span style="font-family: "Courier New",Courier,monospace;">iproute</span>" package in Debian.<br />
<blockquote><span style="font-family: "Courier New",Courier,monospace;">tc - show / manipulate traffic control settings</span></blockquote><br />
<u><b>Simple, classless Queueing Disciplines:</b></u><br />
<br />
<i>The Token Bucket Filter (TBF)</i> - Simple and easy, for slowing an interface down.<i> </i><br />
<i> </i><br />
<span style="font-size: x-small;"><i><b>qdisc</b> - queuing discipline </i></span><br />
<span style="font-size: x-small;"><i><b>latency </b>- number of bytes that can be queued waiting for tokens to become available.<br />
<b>burst</b> - Size of the bucket, in bytes.<br />
<b>rate</b> - speedknob</i></span><br />
<blockquote><span style="font-family: "Courier New",Courier,monospace;">#tc qdisc add dev eth1 root tbf rate 220kbit latency 50ms burst 1540 </span></blockquote><a href="http://lartc.org/howto/lartc.qdisc.classless.html#AEN691">click here </a>for more information on TBF.<br />
<br />
<br />
<i>Stochastic Fairness Queueing (SFQ)</i> - round robin type, provide each session the chance to send data in turn. It changes its hashing algorithm within an interval.<br />
<i> </i><br />
<span style="font-size: x-small;"><i><b>qdisc</b> - queuing discipline </i></span><br />
<span style="font-size: x-small;"><i><b>perturb</b> - Reconfigure hashing once this many seconds.</i></span><br />
<blockquote><span style="font-family: "Courier New",Courier,monospace;">#tc qdisc add dev eth1 root sfq perturb 10</span></blockquote><a href="http://lartc.org/howto/lartc.qdisc.classless.html#LARTC.SFQ">click here </a>for more information on SFQ.<br />
<br />
<br />
<br />
<i>To check the status run:</i><br />
<blockquote><span style="font-family: "Courier New",Courier,monospace;">#tc -s -d qdisc show dev eth1</span></blockquote><i>To remove it:</i><br />
<blockquote><span style="font-family: "Courier New",Courier,monospace;">#tc qdisc del dev eth1 root</span></blockquote><br />
<br />
<br />
<u><b>Classful Queueing Disciplines:</b></u><br />
<br />
<i>CBQ (Class Based Queueing) </i>- A Classful Queueing<i></i><br />
<i>HTB - </i>Another classful Queueing. (we will use it.)<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://lh4.googleusercontent.com/-F0CHW93EVSY/TYETfKCqBeI/AAAAAAAAA_I/gfrrUm-fjiM/s1600/qdisc_example.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="298" src="https://lh4.googleusercontent.com/-F0CHW93EVSY/TYETfKCqBeI/AAAAAAAAA_I/gfrrUm-fjiM/s320/qdisc_example.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Example classful qdisc</td></tr>
</tbody></table><br />
<i><br />
</i><br />
<i><b>Let assume we want to create some rules for a small office using HTB.</b></i><br />
<i><b>eth0 - </b>external interface - </i><b>PUBLIC_IP</b><i><b> </b></i><br />
<i><b>eth1 - </b>internal interface - </i><b>LOCAL_IP</b><i> </i><br />
<i>Email</i> will get the <i>highest</i> priority<br />
<i>General/Other</i> will get the <i>medium</i> priority.<br />
<i>Video streaming</i> will get the <i>lowest</i> priority.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh4.googleusercontent.com/-NS0x89M9KoQ/TYEY3tFcxMI/AAAAAAAAA_M/P5lnfa7oBpw/s1600/qdisc_example_implement.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="281" src="https://lh4.googleusercontent.com/-NS0x89M9KoQ/TYEY3tFcxMI/AAAAAAAAA_M/P5lnfa7oBpw/s400/qdisc_example_implement.png" width="400" /> </a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><i>Creating root 1: and 1:1 using HTB (default 6 means follow 1:6 if no rule matched)</i><br />
<blockquote style="font-family: "Courier New",Courier,monospace;">#tc qdisc add dev eth1 root handle 1: htb default 6<br />
#tc class add dev eth1 parent 1: classid 1:1 htb rate 2mbit ceil 2mbit</blockquote><br />
<i>Creating leaf class 1:5 (prio represents priority, and 0 means high priority)</i><br />
<blockquote style="font-family: "Courier New",Courier,monospace;">#tc class add dev eth1 parent 1:1 classid 1:5 htb rate 1mbit ceil 1.5mbit<br />
#tc filter add dev eth1 protocol ip parent 1:0 prio 0 u32 match ip src YOUR_MAIL_SERVER_IP/32 flowid 1:5<br />
#tc filter add dev eth1 protocol ip parent 1:0 prio 0 u32 match ip sport 22 0xffff flowid 1:5</blockquote><br />
<i>Creating leaf class 1:6 (It is set as default in root qdisc, so we are not setting any rules)</i><br />
<blockquote style="font-family: "Courier New",Courier,monospace;">#tc class add dev eth1 parent 1:1 classid 1:6 htb rate 0.5mbit ceil 1.5mbit</blockquote><br />
<i>Creating leaf class 1:7 (use /32 for specific IP, /24 for that series. Priority low - prio 5. You can get the IP address using "iptraf" tool)</i><br />
<blockquote style="font-family: "Courier New",Courier,monospace;">#tc class add dev eth1 parent 1:1 classid 1:7 htb rate 0.2mbit ceil 1mbit<br />
#tc filter add dev eth1 protocol ip parent 1:0 prio 5 u32 match ip src VIDEO_STREAM_IP/32 flowid 1:7</blockquote><br />
<br />
<i>Optionally we can also add discipline with leaf (for an example we are adding SFQ with leaf class 1:5)</i><br />
<blockquote style="font-family: "Courier New",Courier,monospace;">#tc qdisc add dev eth1 parent 1:5 handle 20: sfq perturb 10</blockquote><br />
<i>To remove it:</i><br />
<blockquote><span style="font-family: "Courier New",Courier,monospace;">#tc qdisc del dev eth1 root handle 1: htb </span></blockquote><br />
<a href="http://www.blogger.com/goog_898463790"> </a><br />
<a href="http://luxik.cdi.cz/%7Edevik/qos/htb/manual/userg.htm">Click here</a> for more information on HTB.<br />
<br />
<br />
<i>This document is written to describe a basic of bandwidth controlling/shaping for the new users. Please check the details documentation for advance options.</i><br />
<br />
source:<br />
<a href="http://lartc.org/howto/index.html">http://lartc.org/howto/index.html</a><br />
<a href="http://www.opalsoft.net/qos/DS.htm">http://www.opalsoft.net/qos/DS.htm</a><br />
<a href="http://blog.edseek.com/%7Ejasonb/articles/traffic_shaping/index.html">http://blog.edseek.com/~jasonb/articles/traffic_shaping/index.html</a><br />
HTB user guide:<br />
<a href="http://luxik.cdi.cz/%7Edevik/qos/htb/manual/userg.htm">http://luxik.cdi.cz/~devik/qos/htb/manual/userg.htm</a><br />
Filter:<br />
<a href="http://lartc.org/howto/lartc.qdisc.filters.html">http://lartc.org/howto/lartc.qdisc.filters.html</a><br />
<a href="http://linux-ip.net/articles/Traffic-Control-HOWTO/index.html">http://linux-ip.net/articles/Traffic-Control-HOWTO/index.html</a>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-7954055.post-39732908004005373112011-03-11T20:53:00.000+06:002011-03-11T20:53:43.284+06:00FreeBSD with Debian GRUB<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="https://lh4.googleusercontent.com/-pxP82ISwDfQ/TXnkkLiKOqI/AAAAAAAAA_E/RLNHhqKW834/s1600/deban_logo_wikipedia.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://lh4.googleusercontent.com/-pxP82ISwDfQ/TXnkkLiKOqI/AAAAAAAAA_E/RLNHhqKW834/s1600/deban_logo_wikipedia.png" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="https://lh4.googleusercontent.com/-BVF1fda6Avw/TXnkgXHd3gI/AAAAAAAAA_A/Xmb0muIHYA4/s1600/freebsd_logo_wikipedia.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://lh4.googleusercontent.com/-BVF1fda6Avw/TXnkgXHd3gI/AAAAAAAAA_A/Xmb0muIHYA4/s1600/freebsd_logo_wikipedia.png" /></a></div><br />
I have installed FreeBSD 8.2 amd64 in my PC for testing.<br />
<br />
If you want to boot FreeBSD using GRUB, simply edit <br />
<blockquote style="font-family: "Courier New",Courier,monospace;">/etc/grub.d/40_customized</blockquote><br />
In the other section add the following line:<br />
<span style="font-size: x-small;">(change the partition according to yours)</span> <br />
<blockquote style="font-family: "Courier New",Courier,monospace;">menuentry 'FreeBSD 8.2 amd64' {<br />
set root='(hd0,X)'<br />
chainloader +1<br />
}</blockquote><br />
Update the grub.cfg<br />
<blockquote style="font-family: "Courier New",Courier,monospace;">#update-grub</blockquote><br />
FreeBSD should appear in your grub menu while booting...Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7954055.post-63982154469348925792011-03-04T03:04:00.002+06:002011-03-04T12:10:59.816+06:00Encrypted folder in LinuxWe are using EncFS. It provides an encrypted filesystem in user-space.<br />
<br />
You may need to load fuse module:<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">#modprobe fuse</div></blockquote><br />
Install encfs:<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">#apt-get install encfs</div></blockquote><br />
Optionally you may install (EncFS system tray applet for GNOME):<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">#apt-get install cryptkeeper</div></blockquote><br />
<i>encfs [options] rootDir mountPoint</i><br />
Here I am creating a root folder name encrypt for storing encrypted files.<br />
Also creating a mount point folder named decrypt, which we will use to read/write files.<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">$encfs ~/.encrypt ~/decrypt</div></blockquote><br />
It will ask permission for creating the directory - <b>type y here</b>.<br />
Now, it will ask for expert or pre-configured mode - use pre-configured - <b>type p here</b>.<br />
<br />
It will ask for a password. Use a secure password here.<br />
<br />
done! now you can use <i>decrypt</i> folder as an <b>encrypted</b> folder.<br />
<br />
The actual data will be <b>stored</b> under <i>.encrypt</i> folder, and will be available via <i>decrypt</i> folder after mounting via encfs.<br />
<br />
<br />
You may unmount it using:<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">$fusermount -u ~/decrypt</div></blockquote><br />
source:<br />
<a href="http://www.debian-administration.org/articles/204">http://www.debian-administration.org/articles/204</a><br />
<a href="http://ubuntuforums.org/showthread.php?t=148600">http://ubuntuforums.org/showthread.php?t=148600</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7954055.post-23686713314673512582011-03-04T01:38:00.000+06:002011-03-04T01:38:28.282+06:00Encrypted partition in LinuxTo create encrypted disks we are using <a href="http://code.google.com/p/cryptsetup/">cryptsetup</a><br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">#apt-get install cryptsetup</div></blockquote><br />
<b>Backup</b> your data and optionally clean it:<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">#shred -n1 -v /dev/sdaX</div></blockquote><br />
Initializes a <b>LUKS</b> partition (<b>warning!</b>):<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">#cryptsetup luksFormat /dev/sdaX</div></blockquote><br />
Type "YES". It will ask for a <b>password</b> for filesystem. Use a secure password, otherwise encryption wont help you.<br />
There is other options for securing. Check the cryptsetup manual for details.<br />
<br />
<br />
Open and sets up a <b>mapping</b> for LUKS partition: <br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">#cryptsetup luksOpen /dev/sdaX your_map_name</div></blockquote><br />
Format the LUKS partition using the mapping:<br />
<blockquote><span style="font-family: "Courier New",Courier,monospace;">#mkfs.ext3 /dev/mapper/your_map_name</span></blockquote><br />
Now you can mount it:<br />
<blockquote><span style="font-family: "Courier New",Courier,monospace;">#mount /dev/mapper/your_map_name /mnt/your_mount_name</span></blockquote><br />
<br />
Optionally you can umount and (removes mapping) lock the LUKS again:<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">#umount /mnt/your_mount_name</div><div style="font-family: "Courier New",Courier,monospace;">#cryptsetup luksClose your_map_name</div></blockquote><br />
I have tested this in Debian 6.0.0.<br />
You may need to load module (optionally you may add in <i>/etc/modules</i>):<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;"><b>modprobe dm_mod</b></div></blockquote><br />
<br />
<b>Edit /etc/crypttab</b><br />
<blockquote><span style="font-family: "Courier New",Courier,monospace;"># <target name=""> <source device=""> <key file=""> <options></span><br />
<span style="font-family: "Courier New",Courier,monospace;">your_map_name /dev/sdaX none luks</span><br />
<br />
</blockquote><br />
<b>Edit /etc/fstab</b><br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;"># <file system=""> <mount point="">nbsp; <type> <options> <dump> <pass></div><span style="font-family: "Courier New",Courier,monospace;">/dev/mapper/your_map_name /mnt/your_mount_name ext3 user,auto 0 0</span></blockquote><br />
<br />
You can reboot. It will ask for the password while booting.<br />
<br />
<br />
<b>source:</b><br />
<a href="http://www.debian-administration.org/article/Encrypting_an_existing_Debian_lenny_installation">http://www.debian-administration.org/article/Encrypting_an_existing_Debian_lenny_installation</a><br />
<a href="http://www.enterprisenetworkingplanet.com/netsecur/article.php/3683011/Protect-Your-Stuff-With-Encrypted-Linux-Partitions.htm">http://www.enterprisenetworkingplanet.com/netsecur/article.php/3683011/Protect-Your-Stuff-With-Encrypted-Linux-Partitions.htm</a><br />
<a href="http://www.linuxconfig.org/Partition_Encryption">http://www.linuxconfig.org/Partition_Encryption</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7954055.post-37614277076010398332011-02-19T14:32:00.015+06:002011-02-21T14:02:59.062+06:00MoinMoin in DreamHost<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-9A5fkJ9KbdA/TV98U01nY1I/AAAAAAAAA-8/itOza6mgiUM/s1600/moinmoin.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-9A5fkJ9KbdA/TV98U01nY1I/AAAAAAAAA-8/itOza6mgiUM/s1600/moinmoin.png" /></a></div><br />
I have tested using moin-1.9.3.tar.gz in DreamHost.<br />
You have to enable <i>Passenger</i> in your domain.<br />
<br />
Download MoinMoin from:<br />
<a href="http://moinmo.in/">http://moinmo.in/</a><br />
<br />
Documentation (specially check the Server Installation part):<br />
<a href="http://master19.moinmo.in/InstallDocs">http://master19.moinmo.in/InstallDocs</a><br />
<br />
<br />
1. ssh to your server, and download moin using wget.<br />
<br />
2. Extract it:<br />
<blockquote><span style="font-family: "Courier New",Courier,monospace;">tar -zxvf moin-1.9.3.tar.gz</span></blockquote><br />
3. Run setup script <br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">cd moin-1.9.3</div><div style="font-family: "Courier New",Courier,monospace;">python setup.py --quiet install --prefix=$HOME --record=install.log</div></blockquote><br />
4. Check the install.log using emacs or nano for the python version it is using.<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">emacs install.log </div><div style="font-family: "Courier New",Courier,monospace;">...</div><div style="font-family: "Courier New",Courier,monospace;">/home/youraccount/lib/python2.5/site-packages/...</div><div style="font-family: "Courier New",Courier,monospace;">...</div></blockquote><br />
5. Edit the moin.cgi (it would be easy, if you start another ssh shell in the server)<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">find -name moin.cgi //if you want to find it yourself.</div><div style="font-family: "Courier New",Courier,monospace;">$HOME/share/moin/server/moin.cgi</div></blockquote><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;">emacs $HOME/share/moin/server/moin.cgi</div><br />
Make the following changes<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;"># a1) Path of the directory where the MoinMoin code package is located.<br />
# Needed if you installed with --prefix=PREFIX or you didn't use setup.py.<br />
<strike><b>#sys.path.insert(0, 'PREFIX/lib/python2.3/site-packages')</b></strike></div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;"># a2) Path of the directory where wikiconfig.py / farmconfig.py is located.<br />
# See wiki/config/... for some sample config files.<br />
<b><strike>#sys.path.insert(0, '/path/to/wikiconfigdir')</strike></b><br />
===================================================<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"># a1) Path of the directory where the MoinMoin code package is located.</span><br />
<span style="font-family: "Courier New",Courier,monospace;"># Needed if you installed with --prefix=PREFIX or you didn't use setup.py.</span><br />
<b><span style="font-family: "Courier New",Courier,monospace;">sys.path.insert(0, '/home/youraccount/lib/python2.5/site-packages')</span></b><br />
<br />
# a2) Path of the directory where wikiconfig.py / farmconfig.py is located.<br />
# See wiki/config/... for some sample config files.<br />
<b>sys.path.insert(0, '/home/youraccount/moin/config')</b></div></blockquote><div style="font-family: "Courier New",Courier,monospace;"></div><br />
you can verify this location using another shell while editing.<br />
<br />
<br />
6. This example is designed for single wiki<br />
create this directory <span style="font-family: "Courier New",Courier,monospace;">$HOME/moin/config/ </span><br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">cd $HOME/moin/config</div><div style="font-family: "Courier New",Courier,monospace;">cp $HOME/share/moin/config/wikiconfig.py .</div><div style="font-family: "Courier New",Courier,monospace;">cp -r $HOME/share/moin/data/ .</div><div style="font-family: "Courier New",Courier,monospace;">cp -r $HOME/share/moin/underlay/ .</div></blockquote><br />
7. Edit <span style="font-family: "Courier New",Courier,monospace;">wikiconfig.py</span> in <span style="font-family: "Courier New",Courier,monospace;">$HOME/moin/config/</span><br />
<div style="font-family: "Courier New",Courier,monospace;">emacs wikiconfig.py</div><br />
maka the following changes<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;"># If that's not true, feel free to just set instance_dir to the real path</div><div style="font-family: "Courier New",Courier,monospace;"># where data/ and underlay/ is located:</div><div style="font-family: "Courier New",Courier,monospace;"><b><strike>#instance_dir = '/where/ever/your/instance/is'</strike></b></div><div style="font-family: "Courier New",Courier,monospace;"><b><strike>instance_dir = wikiconfig_dir</strike></b></div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;"># If that's not true, feel free to just set instance_dir to the real path</div><div style="font-family: "Courier New",Courier,monospace;"># where data/ and underlay/ is located:</div><div style="font-family: "Courier New",Courier,monospace;"><b>instance_dir = '/home/youraccount/moin/config'</b></div><div style="font-family: "Courier New",Courier,monospace;"><b>#instance_dir = wikiconfig_dir</b></div></blockquote><br />
Change the <span style="font-family: "Courier New",Courier,monospace;">sitename</span> if you want to change your wiki name.<br />
<br />
8. Copy <b>/home/youraccount/share/moin/server/moin.cgi</b> to your public folder, and rename it to <b>wiki.cgi</b><br />
or<br />
create a file <b>wiki.cgi</b> in your public folder. Softlink did not work for me, so lets call the moin.cgi using another python script.<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">#!/usr/bin/python</div><div style="font-family: "Courier New",Courier,monospace;">import os</div><div style="font-family: "Courier New",Courier,monospace;">os.system('python /home/youraccount/share/moin/server/moin.cgi')</div></blockquote><br />
9. now you need to link the htdocs for css and images.<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">cd $HOME </div><div style="font-family: "Courier New",Courier,monospace;">find -name htdocs //if you want to find it yourself</div><div style="font-family: "Courier New",Courier,monospace;">(I have found in the following location.)</div><div style="font-family: "Courier New",Courier,monospace;">./lib/python2.5/site-packages/MoinMoin/web/static/htdocs</div></blockquote><br />
change directory to your public folder.<br />
create a symbolic link of htdocs in your public folder. <br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">ln -s $HOME/lib/python2.5/site-packages/MoinMoin/web/static/htdocs .</div><div style="font-family: "Courier New",Courier,monospace;">mv htdocs moin_static193 //change the softlink name. This is important</div></blockquote><br />
You can always use your custom directory names, but in that case you have to edit the configuration file. This example is written for a simple installation of MoinMoin. <br />
<br />
Using a browser open:<br />
<b>http://yourdomain.com/wiki.cgi</b><br />
<br />
If you can see the wiki, you have successfully setup the MoinMoin.<br />
Now, start customizing it by editing the config files.<br />
<br />
To avoid the *.cgi you may add the following lines in your .htaccess file<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;">ReWriteEngine on<br />
ReWriteRule ^wiki$ wiki/<br />
ReWriteRule ^wiki(/.*) wiki.cgi$1<br />
RequestHeader set X-Moin-Location /wiki</div></blockquote><br />
Now use it as:<br />
<b>http://yourdomain.com/wiki/</b><br />
<br />
<br />
<br />
10. Optional mail configuration:<br />
<div style="font-family: "Courier New",Courier,monospace;">emacs $HOME/moin/config/wikiconfig.py</div><blockquote><span style="font-family: "Courier New",Courier,monospace;"># Mail --------------------------------------------------------------</span><br />
<span style="font-family: "Courier New",Courier,monospace;">...</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> mail_smarthost = "mail.yourdomain.com"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> mail_from = u"Your Wiki <noreplay@yourdomain.com>"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> mail_login = "auth-email@yourdomain.com email-pass"</span><br />
<span style="font-family: "Courier New",Courier,monospace;">...</span></blockquote>optionally you may add <i><span style="font-family: "Courier New",Courier,monospace;">noreplay@yourdomain.com</span></i> as "Garbage Email" from dreamhost panel. It will delete mail without bounce.<br />
<br />
src:<br />
<a href="http://wiki.dreamhost.com/MoinMoin">http://wiki.dreamhost.com/MoinMoin</a><br />
<a href="http://mitch.contlafamily.com/wiki/HOWTO/Install_MoinMoin_On_Dreamhost">http://mitch.contlafamily.com/wiki/HOWTO/Install_MoinMoin_On_Dreamhost</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7954055.post-56055152455626128662010-11-09T18:47:00.000+06:002011-01-05T15:01:54.132+06:00Samsung ML-1666 printer in Linux<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><img border="0" height="320" src="http://3.bp.blogspot.com/_g-q7zXM0b-c/TNk-pJU2QLI/AAAAAAAAA8c/JJNcFEACMNA/s320/01_large.jpg" style="margin-left: auto; margin-right: auto;" width="320" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Samsung ML-1666</td></tr>
</tbody></table><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><br />
</div>Unfortunately, <a href="http://splix.sourceforge.net/">splix</a> does not support this model. So, you have to download Linux driver from: <a href="http://www.samsung.com/in/consumer/pc-peripherals-printer/laser-printer-multifunction/mono-laser-printer/ML-1666/XIP/index.idx?pagetype=prd_detail&tab=support">Samsung Website</a><br />
<br />
You can either run their automated installer or install it manually.<br />
I prefer manual installation because, automated installer install many unnecessary tools in my system.<br />
<br />
1. locate the ML-1660 from the Unified driver PPD while adding printer:<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;">/cdroot/Linux/noarch/at_opt/share/ppd/ML-1660spl.ppd</span></div></blockquote><br />
2.Copy the filter, depending on your system (32bit or 64bit):<br />
<blockquote><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> /cdroot/Linux/x86_64/at_root/usr/lib64/cups/filter/rastertosamsungspl --> /usr/lib/cups/filter/ </span></div></blockquote><br />
3. You may need to install libtiff and splix or may try to modify the ML-1660.ppd for splix support. But, be inform that, from <a href="http://splix.sourceforge.net/">splix website</a> "Splix won't support old SPL(1) printers."Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-7954055.post-13548440675062533082010-08-09T03:39:00.028+06:002010-08-09T18:16:39.948+06:00Multiple Internet connection in LinuxI was facing trouble to use EDGE/GPRS (ppp) with another Ethernet connection together.<br />
Ethernet connection was used for local network.<br />
<blockquote><b># ip route show</b><br />
10.64.64.64 dev ppp0 proto kernel scope link src 10.130.4.218 <br />
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.2 metric 1<br />
default via 192.168.1.1 dev eth0 proto static </blockquote><br />
ppp connected but still default route is eth0. To use the ppp connection as default <br />
<blockquote><b># ip route change default via 10.64.64.64 dev ppp0</b></blockquote><br />
You will find<br />
<blockquote><b># ip route show</b><br />
10.64.64.64 dev ppp0 proto kernel scope link src 10.130.4.218 <br />
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.2 metric 1<br />
default via 10.64.64.64 dev ppp0 </blockquote><i>remember you may need to set the nameserver (edit the /etc/resolv.conf).</i><br />
<br />
<br />
On the other hand you may have 2 default connection settings:<br />
<blockquote><b># ip route show</b> <br />
10.64.64.64 dev ppp0 proto kernel scope link src 10.130.130.252 <br />
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.1 <br />
172.16.0.0/16 dev eth1 proto kernel scope link src 172.16.8.69<br />
default via 172.16.8.1 dev eth1 <br />
default via 10.64.64.64 dev ppp0 proto static </blockquote><br />
I mainly want to use ppp0, so I am removing the eth1 from default list:<br />
<blockquote><b>#ip route del default via 172.16.8.1</b></blockquote><br />
<br />
If you want to use multiple uplinks/providers:<br />
<a href="http://tldp.org/HOWTO/Adv-Routing-HOWTO/lartc.rpdb.multiple-links.html">http://tldp.org/HOWTO/Adv-Routing-HOWTO/lartc.rpdb.multiple-links.html</a><br />
<a href="http://lartc.org/howto/lartc.rpdb.multiple-links.html">http://lartc.org/howto/lartc.rpdb.multiple-links.html</a><br />
<br />
example:<br />
<blockquote>#ip route change default scope global nexthop via 10.64.64.64 dev ppp0 weight 2 nexthop via 192.168.1.1 dev eth0 weight 1</blockquote><br />
Install "iptraf", which is an useful tool for analysis:<br />
<blockquote><b>#apt-get install iptraf</b></blockquote><br />
You can also define any IP address to use specific connection.<br />
This might helpful if you want to listen on-line radio without interrupting your main work.<br />
<br />
I am specifying an IP address for listening an on-line radio station by using a backup slow connection via eth1:<br />
<blockquote><b>#ip route add 85.xx.174.181 via 172.16.8.1 dev eth1</b></blockquote><br />
-enjoyUnknownnoreply@blogger.com1tag:blogger.com,1999:blog-7954055.post-10870667497112985952010-06-19T22:43:00.015+06:002010-06-20T00:09:00.510+06:00Antiderivative to find Area<i>"Why should I apply Antiderivative to find area of a function ?"</i><br />
<br />
It might seems a very silly question, but I was searching for a solution. <br />
I got some idea from <a href="http://en.wikipedia.org/wiki/Fundamental_theorem_of_calculus#Geometric_intuition">Wikipedia Fundamental theorem of calculus</a> , but still I was looking for example.<br />
<br />
At last, I have found answer from these:<br />
<br />
<i>1. Area function f(x) = 2 within interval [a,x] = [-1,x]</i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_g-q7zXM0b-c/TBxoidDvW7I/AAAAAAAAA6M/-CApB4-c1Ck/s1600/rectangle.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://3.bp.blogspot.com/_g-q7zXM0b-c/TBxoidDvW7I/AAAAAAAAA6M/-CApB4-c1Ck/s320/rectangle.png" width="320" /></a></div><div class="separator" style="clear: both; text-align: center;"></div><br />
Let assume, the distance of the rectangle from 0 is x.<br />
Total Length of the rectangle will be x+1 over x-axis and width is 2.<br />
<br />
Area = length * width <br />
<br />
A(x) = 2(x+1) = 2x + 2<br />
<br />
Derivative of A(x) is:<br />
A<sup>/</sup>(x) = 2 = f(x)<br />
<br />
<br />
<i>2. Area function f(x) =x+1</i><i> within interval [a,x] = [-1,x]</i><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_g-q7zXM0b-c/TBvhzHgwGRI/AAAAAAAAA5s/gNXlRFW8FSw/s1600/triangle.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://2.bp.blogspot.com/_g-q7zXM0b-c/TBvhzHgwGRI/AAAAAAAAA5s/gNXlRFW8FSw/s320/triangle.png" width="320" /></a></div><br />
Triangle Area = 1/2 * base * height <br />
<br />
A(x) = 1/2 (x+1)(x+1) = x<sup>2</sup>/2 + x + 1/2<br />
<br />
Derivative of A(x) is:<br />
A<sup>/</sup>(x) = x + 1 = f(x)<br />
<br />
<br />
<i>3. Area function f(x) = 2x+3</i><i> within interval [a,x] = [-1,x]</i><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_g-q7zXM0b-c/TBvkiAhMoaI/AAAAAAAAA50/KIKxSq8f9m0/s1600/triangle2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://2.bp.blogspot.com/_g-q7zXM0b-c/TBvkiAhMoaI/AAAAAAAAA50/KIKxSq8f9m0/s320/triangle2.png" width="320" /></a></div><br />
Trapezoid Area = 1/2 * h * (a+b)<br />
<br />
h = heigh<br />
a,b is the parallel sides lengths.<br />
<br />
A(x) = 1/2 (x+1)((2x+3)+1) = x<sup>2</sup> + 3x + 2<br />
<br />
Derivative of A(x) is:<br />
A<sup>/</sup>(x) = 2x + 3 = f(x)<br />
<br />
<br />
<b><i>Result:</i></b><br />
This is not only valid for linear function, but also for continuous function.<br />
To find the area of a function we can simply apply antidifferentiation. <br />
<br />
A(x) representing the area<br />
A<sup>/</sup>(x) representing the area function.<br />
<br />
If we know the area function A<sup>/</sup>(x) we can get the area by antidifferentiation which will provide us A(x) (area of the function).<br />
<br />
<br />
Powered by <a href="http://www.gnuplot.info/">gnuplot</a><br />
<br />
<b>Source:</b><br />
<a href="http://www.amazon.com/Calculus-Early-Transcendentals-Howard-Anton/dp/047138156X">Calculus - Early Transcendentals by Anton, Bivens, Davis.</a><br />
<a href="http://en.wikipedia.org/wiki/Fundamental_theorem_of_calculus#Geometric_intuition">http://en.wikipedia.org/wiki/Fundamental_theorem_of_calculus#Geometric_intuition </a><br />
<a href="http://en.wikipedia.org/wiki/Rectangle">http://en.wikipedia.org/wiki/Rectangle</a><br />
<a href="http://en.wikipedia.org/wiki/Triangle">http://en.wikipedia.org/wiki/Triangle</a><br />
<a href="http://en.wikipedia.org/wiki/Trapezoid">http://en.wikipedia.org/wiki/Trapezoid</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7954055.post-62703455157518323592010-04-12T14:02:00.001+06:002010-04-13T16:19:29.328+06:00Debian KioskI have configured a <b>kiosk</b> using <b>Debian GNU/Linux</b> with <b>blackbox window manager</b>.<br />
<br />
<i>The challenges:</i><br />
1. Touchscreen configuration.<br />
2. Autometic login and start X server.<br />
3. Start desired application for kiosk.<br />
4. A boot splash for booting and shutdown.<br />
<br />
<b>1. Touchscreen configuration:</b> <br />
First, setup touchscreen driver and configure it according to your device specification.<br />
I was using eGalax driver, which I have downloaded from<br />
source: <a href="http://home.eeti.com.tw/web20/eg/drivers.htm">http://home.eeti.com.tw/web20/eg/drivers.htm </a><br />
<br />
<b>2. Automatic login:</b> <br />
Edit <b>/etc/inittab</b> and comment the following line:<br />
<blockquote>#1:2345:respawn:/sbin/getty 38400 tty1</blockquote>add the following line below:<br />
<div style="text-align: center;">1:2345:respawn:/bin/login -f USER_LOGIN tty1 /dev/tty1 2>&1 </div><br />
Edit <b>.bash_profile</b> (create if require) and add the following line at bottom:<br />
<blockquote>startx</blockquote>source: <a href="http://www.debianadmin.com/how-to-auto-login-and-startx-without-a-display-manager-in-debian.html">http://www.debianadmin.com/how-to-auto-login-and-startx-without-a-display-manager-in-debian.html</a><br />
<br />
<b>Blackbox window manager:</b><br />
Edit ~/.xinitrc (or <i>~/.Xsessio</i>n), create if require, and add the following line:<br />
<blockquote>exec blackbox</blockquote><b>3. Autostart application:</b> <br />
To autostart <i>iceweasel/firefox</i>:<br />
Again edit <i>~/.xinitrc</i> (or <i>~/.Xsessio</i>n) and add the following line:<br />
<blockquote>firefox &<br />
exec blackbox</blockquote>source: <a href="http://blackboxwm.sourceforge.net/BlackboxFAQ/StartupAndShutdown">http://blackboxwm.sourceforge.net/BlackboxFAQ/StartupAndShutdown</a><br />
<br />
Install <i>iceweasel/firefox</i> plugin <b>"R-kiosk"</b> from <a href="https://addons.mozilla.org/en-US/firefox/addon/1659">https://addons.mozilla.org/en-US/firefox/addon/1659</a><br />
<br />
<b>3. Bootsplash:</b> <br />
Install a bootsplash<br />
<blockquote>apt-get install splashy</blockquote>Create your own bootsplash and set it<br />
<blockquote># splashy_config -c</blockquote>To enable splashy, you may need to edit grub.config and add the following after "kernel...ro quiet"<br />
<blockquote>vga=791 splash</blockquote>source: <a href="http://splashy.alioth.debian.org/wiki/faq">http://splashy.alioth.debian.org/wiki/faq</a><br />
<br />
<b>Tips and tricks:</b><br />
<i>"X: user not authorized to run the X server"</i><br />
You can allow the user to use run startx by:<br />
<blockquote>#dpkg-reconfigure x11-common</blockquote>or edit /etc/X11/Xwrapper.config<br />
<blockquote><pre class="message" style="border-top-width: 0px; font-family: monospace; margin-top: 0px; padding-top: 0px;">allowed_users=anybody </pre></blockquote><i>"Auto login problem"</i><br />
If you have setup GDM (XDM) earlier, then you need to disable it for automatic log in<br />
<blockquote>#update-rc.d -f gdm remove</blockquote>If you want to enable it simply run (experiment purpose):<br />
<blockquote>#update-rc.d -f gdm defaults</blockquote>source: <a href="http://www.debianadmin.com/howto-boot-debian-in-text-mode-instead-of-graphical-mode-gui.html">http://www.debianadmin.com/howto-boot-debian-in-text-mode-instead-of-graphical-mode-gui.html</a><br />
<br />
<b>Kiosk performance tuning:</b><br />
Install the CPU frequency related tools and configure it.<br />
details: <a href="http://wiki.debian.org/HowTo/CpuFrequencyScaling">http://wiki.debian.org/HowTo/CpuFrequencyScaling</a><br />
<br />
resources:<br />
<a href="http://www.debianadmin.com/debirf-build-a-kernel-and-initrd-to-run-debian-from-ram.html">http://www.debianadmin.com/debirf-build-a-kernel-and-initrd-to-run-debian-from-ram.html</a><br />
<a href="http://cmrg.fifthhorseman.net/wiki/debirf">http://cmrg.fifthhorseman.net/wiki/debirf</a>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-7954055.post-31236348245331708252010-04-02T21:49:00.007+06:002010-04-02T22:10:26.950+06:00Custom Font Example iPhoneAn example for using custom font in iPhone.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_g-q7zXM0b-c/S7YPXYTt8UI/AAAAAAAAA3I/K1x3JqEycGg/s1600/custom_font_iphone.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_g-q7zXM0b-c/S7YPXYTt8UI/AAAAAAAAA3I/K1x3JqEycGg/s320/custom_font_iphone.png" /></a></div><br />
<br />
<br />
<br />
Initially, I have tried with <b>UIFont</b> for using custom font, but it seems not possible.<br />
<br />
Documents from apple:<br />
<a href="http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Reference/CGFont/Reference/reference.html">http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Reference/CGFont/Reference/reference.html</a><br />
<br />
Create custom font using CGDataProvider:<br />
<br />
<div style="color: #480085; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #7e11ad;">NSString</span><span style="color: black;"> *fontPath = [[</span><span style="color: #7e11ad;">NSBundle</span><span style="color: black;"> </span>mainBundle<span style="color: black;">] </span>pathForResource<span style="color: black;">:</span><span style="color: #e90000;">@"CUSTOM_FONT"</span><span style="color: black;"> </span>ofType<span style="color: black;">:</span><span style="color: #e90000;">@"ttf"</span><span style="color: black;">];</span></div><div style="color: #480085; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #7e11ad;">CGDataProviderRef</span><span style="color: black;"> fontDataProvider = </span>CGDataProviderCreateWithFilename<span style="color: black;">([fontPath </span>UTF8String<span style="color: black;">]); </span><span style="color: #7e11ad;">CGFontRef</span><span style="color: black;"> </span><span style="color: #368288;">customFont</span><span style="color: black;"> = </span>CGFontCreateWithDataProvider<span style="color: black;">(fontDataProvider);</span></div><div><span class="Apple-style-span" style="font-family: Menlo; font-size: small;"><span class="Apple-style-span" style="font-size: 11px;"><br />
</span></span></div><br />
Use the font:<br />
<br />
<div style="color: #480085; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>CGContextSetFont<span style="color: black;">(context, </span><span style="color: #368288;">customFont</span><span style="color: black;">);</span></div><div style="color: #480085; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>CGContextSetFontSize<span style="color: black;">(context, </span><span style="color: #3900de;">34.0</span><span style="color: black;">);</span></div><div style="color: #480085; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>CGContextSetTextDrawingMode<span style="color: black;">(context, </span>kCGTextFill<span style="color: black;">);</span></div><div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></div><div style="color: #3000ff; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #008d00;">//<a href="http://forums.macrumors.com/showthread.php?t=569311"><span style="color: #3000ff;">http://forums.macrumors.com/showthread.php?t=569311</span></a></span></div><div style="color: #3000ff; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #008d00;">//<a href="http://www.waterworld.com.hk/en/node/157"><span style="color: #3000ff;">http://www.waterworld.com.hk/en/node/157</span></a></span></div><div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #7e11ad;">CGGlyph</span> textToPrint[[<span style="color: #368288;">mainString</span> <span style="color: #480085;">length</span>]];</div><div style="color: #008d00; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>// Loop through the entire length of the text.</div><div style="color: #008d00; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #d200a5;">for</span><span style="color: black;"> (</span><span style="color: #d200a5;">int</span><span style="color: black;"> i = </span><span style="color: #3900de;">0</span><span style="color: black;">; i < [</span><span style="color: #368288;">mainString</span><span style="color: black;"> </span><span style="color: #480085;">length</span><span style="color: black;">]; ++i) { </span>// Store each letter in a Glyph and subtract the MagicNumber to get appropriate value.</div><div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>textToPrint[i] = [[<span style="color: #368288;">mainString</span> <span style="color: #480085;">uppercaseString</span>] <span style="color: #480085;">characterAtIndex</span>:i] + <span style="color: #3900de;">3</span> - <span style="color: #3900de;">32</span>;</div><div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</div><div><span class="Apple-style-span" style="font-family: Menlo; font-size: small;"><span class="Apple-style-span" style="font-size: 11px;"></span></span><br />
<span class="Apple-style-span" style="font-family: Menlo; font-size: small;"><span class="Apple-style-span" style="font-size: 11px;"><div style="color: #008d00; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>//to understand the MagicNumber, I open the font file using FontForge</div><div style="color: #008d00; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>//found that the font I am using started from location 32</div><div style="color: #008d00; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>//after I changed the "Encoding->Reencode" to "Glyph Order"</div><div style="color: #008d00; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>//I found that the "U+0020 space" started from location 3</div><div style="color: #008d00; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"><span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>//</div></span></span></div><br />
<div><span class="Apple-style-span" style="color: black;"></span><br />
<span class="Apple-style-span" style="color: black;"><div><b>download sample code:</b></div><div><a href="http://www.mymacbd.com/forum/viewtopic.php?id=29">http://www.mymacbd.com/forum/viewtopic.php?id=29</a></div><div><br />
</div><div><b>reference:</b></div><div><a href="http://forums.macrumors.com/showthread.php?t=569311">http://forums.macrumors.com/showthread.php?t=569311</a></div><div><div><a href="http://www.waterworld.com.hk/en/node/157">http://www.waterworld.com.hk/en/node/157</a></div><div><br />
</div></div></span></div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-7954055.post-32337741449288643962010-03-02T18:24:00.014+06:002010-03-03T12:47:36.511+06:00Speech detection example iPhoneThis is an example, how to start working on speech detection application for iPhone.<br />
<br />
<span style="font-weight: bold;">We have two major task:</span><br />
1. Access the audio data.<br />
2. Implement the logic part.<br />
<br />
<span style="font-weight: bold;">Task1:</span> Access the audio data:<br />
Download SpeakHere Example code from Apple:<br />
http://developer.apple.com/iphone/library/samplecode/SpeakHere/index.html<br />
<br />
Open "Classes->Play & Record->AQRecorder.mm" and edit the folloding function:<pre><blockquote>// AudioQueue callback function, called when an input buffers has been filled.
void AQRecorder::MyInputBufferHandler(...)</blockquote></pre>Add the following code to access the audio data:<br />
<br />
<pre> //for signed 16-bit little-endian
SInt16 *buf = (SInt16 *)inBuffer->mAudioData;
for(int i=0; i< inBuffer->mAudioDataByteSize / 2; i=i+2) {
printf("\n%d\n%d ", buf[i], buf[i+1]);
}
</pre><br />
<br />
<span style="font-size:85%;">(Please feel free to let me know if I am doing anything wrong...)</span><br />
<br />
Run the application. You will get the raw data in gdb/console/log.<br />
Copy the data in a text file and plot it.<br />
<br />
Download <a href="http://www.gnuplot.info/">gnuplot</a> and <a href="http://aquaterm.sourceforge.net/">AquaTerm</a><br />
<br />
I have copied the data in a text file name "hello.txt" and saved it in my home directory.<br />
Plot this, in gnuplot using the following command:<br />
<br />
gnuplot>plot "hello.txt"<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_g-q7zXM0b-c/S417s8-L1CI/AAAAAAAAA2Q/FZ63gOCYB0Q/s1600-h/hello_speak_here.png"><br />
</a><br />
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_g-q7zXM0b-c/S417s8-L1CI/AAAAAAAAA2Q/FZ63gOCYB0Q/s1600-h/hello_speak_here.png"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 291px;" src="http://2.bp.blogspot.com/_g-q7zXM0b-c/S417s8-L1CI/AAAAAAAAA2Q/FZ63gOCYB0Q/s400/hello_speak_here.png" alt="" id="BLOGGER_PHOTO_ID_5444143536772207650" border="0" /></a><br />
<br />
<span style="font-weight: bold;">Task2</span>: Implement the logic part:<br />
<br />
For speech detection purpose we do not need to check all the data. Set some filter to check the data within some range. You can also try with the maximum and minimum value.<br />
<br />
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_g-q7zXM0b-c/S4362qn4NnI/AAAAAAAAA2Y/VTPDT94B2Cg/s1600-h/filtered_speak_here.png"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 291px;" src="http://2.bp.blogspot.com/_g-q7zXM0b-c/S4362qn4NnI/AAAAAAAAA2Y/VTPDT94B2Cg/s400/filtered_speak_here.png" alt="" id="BLOGGER_PHOTO_ID_5444283341622228594" border="0" /></a><br />
As the maximum and minumum value is similar, you can simply check one part.<br />
<br />
If you want to detect specific type of speech or sound, analyze the graph by taking some sample.<br />
Understand the logic and implement a coded logic to detect it.<br />
<br />
For normal detection purpose take many sample and do R&D youself.<br />
<br />
Please note that the mic <span style="font-weight: bold;">"Input Volume"</span> may affect your data.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7954055.post-89069503754336954142010-02-16T00:21:00.011+06:002010-02-17T20:20:55.362+06:00Radio App Example iPhoneI was working on an application to play audio stream from an online radio. Here is some hints for the developers who want to do similar types of work.<br /><br />Initially we have two major task:<br />1. Read stream data.<br />2. Play the stream data.<br /><br />From apple developer documentation:<br /><blockquote><span style="font-size:85%;">http://developer.apple.com/iphone/library/codinghowtos/AudioAndVideo/index.html#STREAMING<br /><br /><span style="font-style: italic;">How do I play streamed audio?</span><br /><br /><span style="font-style: italic;">To play streamed audio, you connect to a network stream using the CFNetwork interfaces from Core Foundation, such as those in CFHTTPMessage. You then parse the network packets into audio packets using Audio File Stream Services (AudioToolbox/AudioFileStream.h). Finally, you play the audio packets using Audio Queue Services (AudioToolbox/AudioQueue.h). You can also use Audio File Stream Services to parse audio packets from an on-disk file.</span></span></blockquote><br /><span style="font-weight: bold;">Task 1:</span> Working with HTTP stream<br /><br />Read <span style="font-style: italic;">"CFNetwork Programming Guide"</span> specially the <span style="font-style: italic;">"Communicating with HTTP Servers"</span> part.<br /><br />Use the callback<br /><blockquote style="font-style: italic;"><span style="font-size:85%;"><pre>if (CFReadStreamSetClient(myReadStream, registeredEvents, myCallBack, &myContext) {...}</pre> </span></blockquote><br /><br />A sample callback:<br /><blockquote><span style="font-size:85%;"><pre>static void <span style="font-weight: bold;">myCallBack</span><br />(CFReadStreamRef stream, CFStreamEventType type, void *clientCallBackInfo) {<br /> if(type == kCFStreamEventHasBytesAvailable) {<br /> UInt8 buffer[2048];<br /> CFIndex bytesRead = CFReadStreamRead(stream, buffer, sizeof(buffer));<br /> <br /> if (bytesRead > 0) {<br /> //nothing<br /> }<br /> else if (bytesRead) {<br /> NSString* to_add = [NSString stringWithCString: (char*)buffer length: bytesRead];<br /> NSLog(@"%@", to_add);<br /> }<br /> }<br />}<br /></pre></span></blockquote><br /><br />Run the application. If you can see the HTML tag in your debug console, then your network stream reading is working fine.<br /><br /><br /><span style="font-weight: bold;">Task 2:</span> Working with audio<br /><br />Read <span style="font-style: italic;">"Audio File Stream Services Reference" </span>to get basic idea about the streaming audio.<br /><br />Check the <span style="font-style: italic;">"AudioFileStreamExample"</span> from:<br /><span style="font-size:85%;">http://developer.apple.com/Mac/library/samplecode/AudioFileStreamExample/index.html</span><br /><br />Merge the "AudioFileStreamParseBytes" with the "myCallBack" method.<br /><br /><span style="font-weight: bold;">Download Sample Code:</span><br /><a href="http://www.mymacbd.com/forum/viewtopic.php?id=26">http://www.mymacbd.com/forum/viewtopic.php?id=26</a>Unknownnoreply@blogger.com16tag:blogger.com,1999:blog-7954055.post-24600339724113028352009-08-07T13:24:00.003+07:002009-08-07T14:29:08.814+07:00nasm in Mac OS XI was trying to compile a simple assembly program in Mac OS X (Leopard).<br /><br />I was getting an error message<br /><blockquote><span style="font-size:85%;">ld: could not find entry point "_start" (perhaps missing crt1.o) for inferred architecture i386</span></blockquote><br />A simple asm program for FreeBSD and MacOS<br /><span style="font-size:85%;">(we have to use the stack for system call, from <span style="text-decoration: underline;">http://asm.sourceforge.net//howto/Assembly-HOWTO.rtf)</span></span><br /><br /><blockquote><span style="font-size:85%;"><pre>section .text<br /> global _start ;must be declared for linker (ld)<br /><br />_syscall: <br /> int 0x80 ;system call<br /> ret<br /><br />_start: ;tell linker entry point<br /><br /> push dword len ;message length<br /> push dword msg ;message to write<br /> push dword 1 ;file descriptor (stdout)<br /> mov eax,0x4 ;system call number (sys_write)<br /> call _syscall ;call kernel<br /><br /> ;the alternate way to call kernel:<br /> ;push eax<br /> ;call 7:0<br /><br /> add esp,12 ;clean stack (3 arguments * 4)<br /><br /> push dword 0 ;exit code<br /> mov eax,0x1 ;system call number (sys_exit)<br /> call _syscall ;call kernel<br /><br /> ;we do not return from sys_exit,<br /> ;there's no need to clean stack<br />section .data<br /><br />msg db "Hello, world!",0xa ;our dear string<br />len equ $ - msg ;length of our dear string</pre></span></blockquote><br />In Mac OS X we should use format <span style="font-weight: bold;">macho</span><br /><blockquote>nasm -f macho hello.asm</blockquote><br />and for the linker (we need to specify the entry point)<br /><blockquote>ld -e _start -o hello hello.o</blockquote><br /><br /><br />resources:<br /><a href="http://asm.sourceforge.net//howto/Assembly-HOWTO.rtf">http://asm.sourceforge.net//howto/Assembly-HOWTO.rtf</a><br /><a href="http://zathras.de/angelweb/blog-intel-assembler-on-mac-os-x.htm">http://zathras.de/angelweb/blog-intel-assembler-on-mac-os-x.htm</a>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-7954055.post-88442268589374117772009-04-18T02:08:00.002+06:002009-04-18T02:23:13.275+06:00recover kopete passwordI was trying to recover a password from a kopeterc file.<br /><br />Open the <span style="font-style: italic;">kopeterc</span> file in a hex editor<br />In the password location you will find three-byte chunks: [EF][BE][XX]. The first two bytes stay most of the time same.<br />Just subtract each third byte from 0x1001F then you will get the character value from ASCII table.<br /><br />everything was working fine as mentioned in <a href="http://my.opera.com/raphman/blog/2008/02/01/kde-pasword-obfuscation?cid=7484288">Raphman's blog</a><br /><br />But I had a little problem with numeric value. My combination was "EF BE XX" but before the numeric value it was "EF BF XX".<br /><br />For the numeric value I have to subtract 0x40 again to get the original value.<br /><br />It worked for me at last...<br /><br /><span style="font-size:85%;">src: <a href="http://my.opera.com/raphman/blog/2008/02/01/kde-pasword-obfuscation?cid=7484288">http://my.opera.com/raphman/blog/2008/02/01/kde-pasword-obfuscation?cid=7484288</a></span>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7954055.post-34141044846728465282008-12-13T18:26:00.017+06:002008-12-13T20:12:48.552+06:00Bengali in LaTeX in Mac OS XI have installed LaTeX for Mac OS from <a href="http://www.tug.org/mactex/">http://www.tug.org/mactex/</a><br /><br />I was trying to write Bangla in LaTex. Found two ways to write bangla in LaTeX.<br /><br /><br /><span style="font-weight: bold;font-size:130%;" ><a href="http://methopath.wordpress.com/2008/06/26/writing-unicode-bengali-in-latex/">Unicode Standard</a></span><br /><br />written by <a href="http://www.math.unb.ca/%7Eghossain/">Golam Mortuza Hossain</a>. Here I am just writing how to do this in Mac OS.<br /><br />First download freefont-ttf-xyz.tar.gz from<br /><a href="http://savannah.nongnu.org/download/freefont/"><br /><span style="font-size:85%;">http://savannah.nongnu.org/download/freefont/</span></a><span style="font-size:85%;"><br />or<br /><a href="ftp://ftp.gnu.org/pub/gnu/freefont/">ftp://ftp.gnu.org/pub/gnu/freefont/</a></span><br /><br />which containing<span style="font-size:85%;"><br />-------------------------<br />FreeSerif.ttf<br />FreeSerifBold.ttf<br />FreeSerifItalic.ttf<br />FreeSerifBoldItalic.ttf</span><br /><br />Paste these fonts in your "Macintosh HD/Library/Fonts/"<br /><br />Now try sample document in TeXShop<br /><span style="font-size:85%;"><br />\documentclass{article}<br />\usepackage{fontspec}<br />%<br />% This file is a based on the sample tex file to illustrate use of<br />% XeTeX in typesetting Bengali document.<br />% License under GNU FDL by Golam Mortuza Hossain, 2008<br />%<br />%url: http://methopath.wordpress.com/2008/06/26/writing-unicode-bengali-in-latex/<br />%<br />\font\serif="FreeSerif:script=beng"<br />\font\serifbb="FreeSerif:script=beng" at 24pt<br />\font\deffont="FreeSerif:script=beng" at 14pt<br /><br />\title{\bf\serifbb সত্যজিৎ রায়}<br />\author{\bf\serif উইকিপিডিয়া, মুক্ত বিশ্বকোষ থেকে}<br />\date{}<br />\begin{document}<br />\deffont %Default font used for the document<br />\maketitle<br />সত্যজিৎ রায় (২রা মে, ১৯২১ – ২৩শে এপ্রিল, ১৯৯২) একজন বাঙালী চলচ্চিত্র নির্মাতা ও বিংশ শতাব্দীর অন্যতম শ্রেষ্ঠ চলচ্চিত্র পরিচালক। কলকাতা শহরে সাহিত্য ও শিল্পের জগতে খ্যাতনামা এক বাঙালী পরিবারে তাঁর জন্ম হয়। তিনি কলকাতার প্রেসিডেন্সি কলেজ ও শান্তিনিকেতনে রবীন্দ্রনাথ ঠাকুরের প্রতিষ্ঠিত বিশ্বভারতী বিশ্ববিদ্যালয়ে পড়াশোনা করেন। সত্যজিতের কর্মজীবন একজন বাণিজ্যিক চিত্রকর হিসেবে শুরু হলেও প্রথমে কলকাতায় ফরাসি চলচ্চিত্র নির্মাতা জঁ রনোয়ারের সাথে সাক্ষাৎ ও পরে লন্ডন শহরে সফররত অবস্থায় ইতালীয় নব্য বাস্তবতাবাদী ছবি লাদ্রি দি বিচিক্লেত্তে (ইতালীয় ভাষায় Ladri di biciclette, "সাইকেল চোর") দেখার পর তিনি চলচ্চিত্র নির্মাণে উদ্বুদ্ধ হন।<br />\end{document}</span><br /><br /><br />Select "XeLaTeX" from drop down menu and click "Typeset" button for Output in TeXShop.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_g-q7zXM0b-c/SUO2fTsssMI/AAAAAAAAArA/ILB806l0C50/s1600-h/LaTeX_bangla.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 297px;" src="http://3.bp.blogspot.com/_g-q7zXM0b-c/SUO2fTsssMI/AAAAAAAAArA/ILB806l0C50/s400/LaTeX_bangla.png" alt="" id="BLOGGER_PHOTO_ID_5279263837188305090" border="0" /></a><br /><br /><br /><span style="font-weight: bold;font-size:85%;" >reference:</span><span style="font-size:85%;"> <a href="http://methopath.wordpress.com/2008/06/26/writing-unicode-bengali-in-latex/">http://methopath.wordpress.com/2008/06/26/writing-unicode-bengali-in-latex/</a><br /><br /></span><br /><br /><br /><br /><br /><span style="font-weight: bold;font-size:130%;" ><a href="http://www.saha.ac.in/theory/palashbaran.pal/bangtex/bangtex.html">Bangtex </a></span><br /><br />First Bengali typesetting system using LaTeX. Which use a non-standard approach to write bangla.<br /><br />example:<br /><br /><span style="font-size:85%;">\centerline{\bngxxv ra\*g*er OShudh}<br />\centerline{\bngxviii sukumar ray}</span><br />-----------------------------------<br />which give output<br />-----------------------------------<br />রোগের ওষুধ<br />সুকুমার রায়<br /><br /><span style="font-size:85%;">download bfonts.tar.gz, bsty.tar.gz, bsample.tar.gz from<br /><a href="http://www.saha.ac.in/theory/palashbaran.pal/bangtex/bangtex.html">http://www.saha.ac.in/theory/palashbaran.pal/bangtex/bangtex.html</a></span><br /><br /><span style="font-size:85%;"><span style="font-weight: bold;">Installing the font files</span><br />cd /usr/local/texlive/2008/texmf-dist/fonts/source<br />sudo mkdir bangla<br /><span style="font-style: italic;">extract bfonts.tar.gz in /usr/local/texlive/2008/texmf-dist/fonts/source/bangla/</span><br /><span style="font-weight: bold;">Installing the macro files for LaTeX</span><br />cd /usr/local/texlive/2008/texmf-dist/tex/latex<br />sudo mkdir bangla<br /><span style="font-style: italic;">extract bsty.tar.gz /usr/local/texlive/2008/texmf-dist/tex/latex/bangla/</span><br /><span style="font-weight: bold;">Initializing the files</span><br />sudo texhash<br /><br /><span style="font-weight: bold;">reference:</span> <a href="http://www.saha.ac.in/theory/palashbaran.pal/bangtex/install.html#linux">http://www.saha.ac.in/theory/palashbaran.pal/bangtex/install.html#linux</a></span>Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-7954055.post-78396701864262521462008-11-06T22:17:00.002+06:002008-11-06T22:26:35.368+06:00Probhat Installer for MacOS<div>I have created Probhat installer for MacOS.</div><div><br /></div><div>You can download it from Ankur website <a href="http://www.ankur.org.bd/downloads/probhat/probhat_mac_os_1.0.dmg">click here</a>.</div><div><br /></div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_g-q7zXM0b-c/SRMXY43ilJI/AAAAAAAAAj0/uP8e0ovRiMI/s1600-h/probhat_macos_1.jpg" style="text-decoration: none;"><span class="Apple-style-span" style="color: rgb(0, 0, 0);"></span><img style="text-align: left; display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 284px; " src="http://3.bp.blogspot.com/_g-q7zXM0b-c/SRMXY43ilJI/AAAAAAAAAj0/uP8e0ovRiMI/s400/probhat_macos_1.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5265578105675879570" /><br /></a></div><div><span class="Apple-style-span" style="color: rgb(0, 0, 238);"><br /></span>Details on <a href="http://www.ankur.org.bd/wiki/Documentation#Mac_OS_X_2">Ankur Wiki</a><br /></div><div><br /></div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-7954055.post-33731222663456192872008-09-20T19:18:00.007+06:002008-09-20T21:06:33.327+06:00get database structure using PHPI was facing problem to connect a mysql host, as it was only accepting connection from a specific server. But I need to know the database structure to design some report.<br /><br />At last I have written a simple php code to print the table name along with the structure.<br /><br /><code><pre><br /><?php<br /> <br /> mysql_connect("host_name","user","password") or die(mysql_error());<br /> mysql_select_db("database_name") or die(mysql_error());<br /><br /><br /> $result = mysql_query("SHOW TABLES;") or die(mysql_error()); <br /><br /> while($row = mysql_fetch_array($result)){<br /> <br /> echo $row[0]; //print the table name<br /> <br /> $result2 = mysql_query("DESCRIBE ".$row[0].";") or die(mysql_error()); //get details schema for each table<br /> <br /> echo "<table border='1' width='70%'>";<br /> echo "<tr><td>Field</td><td>Type</td><td>Null</td><td>Key</td><td>Default</td><td>Extra</td>";<br /> <br /> while($row2 = mysql_fetch_array($result2)){<br /> <br /> for($i=0; $i<6; $i++){ <br /> if($row2[$i] == "" || $row2[$i] == NULL){<br /> $row2[$i] = " ";<br /> }<br /> } <br /> <br /> echo "<tr>";<br /> echo "<td>".$row2[0]."</td><td>".$row2[1]."</td><td>".$row2[2]."</td><td>".$row2[3]."</td><td>".$row2[4]."</td><td>".$row2[5];<br /> echo "</tr>";<br /> }<br /> <br /> echo "</table>"; <br /> echo "<br/>";<br />}<br /><br />?><br /></pre></code><br /><br />Just change your database configuration then upload in your server. Browse the url and you must delete the file from server after get the structure. Be safe...Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-7954055.post-87488720349117384132008-08-31T02:45:00.003+06:002008-08-31T02:57:36.914+06:00function call in javascriptI was studying <a href="http://russkey.mozdev.org/">russkey.mozdev.org</a> source code to learn how to write Firefox extension.<br /><br />Found this style of function call in javascript.<br /><pre><br />var collection = {<br /><br /> hello : function() {<br /> document.write("Hello World!");<br /> },<br /> <br /> understand : function() {<br /> document.write("<br/>Understand!");<br /> },<br /> <br /> bye : function() {<br /> document.write("<br/>bye!");<br /> }<br /> <br />};<br /><br /><br />var m = new collection.hello();<br />var n = new collection.understand();<br />var o = new collection.bye();<br /></pre><br /><br /><br />The output will<br /><pre><br />Hello World!<br />Understand!<br />bye!<br /></pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7954055.post-75395564632976461122008-08-30T13:20:00.004+06:002008-08-31T03:32:46.338+06:00My Facebook application<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_g-q7zXM0b-c/SLj40_1bNZI/AAAAAAAAAjs/MsZ3g3seG-0/s1600-h/circle_of_blood.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_g-q7zXM0b-c/SLj40_1bNZI/AAAAAAAAAjs/MsZ3g3seG-0/s400/circle_of_blood.png" alt="" id="BLOGGER_PHOTO_ID_5240211755817973138" border="0" /></a><br /><br /><a href="http://apps.new.facebook.com/circle_of_blood/">apps.new.facebook.com/circle_of_blood/</a><br />or<br /><a href="http://apps.facebook.com/circle_of_blood/">apps.facebook.com/circle_of_blood/</a><br /><br /><br />Special thanks to <a href="http://hamza.neoxero.com/">Dr. Hamza</a> for joining in this project and sponsor the hosting.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7954055.post-37493840482658947912008-08-27T03:53:00.005+06:002008-08-27T04:09:09.556+06:00flash/swf height width in CodeIgniter 1.6In libraries/Upload.php<br /><br />Edit the function is_image().<br /><br />add the 'application/x-shockwave-flash' in $img_mimes<br /><br /><pre><br />$img_mimes = array(<br /> 'image/gif',<br /> 'image/jpeg',<br /> 'image/png',<br /> 'application/x-shockwave-flash',<br />);<br /></pre><br /><br /><br />It simply allow <span style="font-weight:bold;">set_image_properties</span> function to read the height & width for flash.<br /><br />//now this will not call for flash<br />if ( ! $this->is_image())<br />{<br /> return;<br />}Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-7954055.post-78857832090618648392008-08-26T00:23:00.001+06:002008-08-26T00:24:21.977+06:00Which user remove my facebook applicationTo remove the user who remove your application from facebook automatically.<br /><br />In the settings of the application,<br />"Can your application be added on Facebook?" set it <span style="font-weight: bold;">yes</span>.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_g-q7zXM0b-c/SLJgM7DSBAI/AAAAAAAAAi4/ldId8hPEUzQ/s1600-h/app_add_fb.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_g-q7zXM0b-c/SLJgM7DSBAI/AAAAAAAAAi4/ldId8hPEUzQ/s400/app_add_fb.png" alt="" id="BLOGGER_PHOTO_ID_5238355091711460354" border="0" /></a><br />Scroll down, you will get a Post-Remove URL input box.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_g-q7zXM0b-c/SLJgv_-cEHI/AAAAAAAAAjA/5BX91Gzsg2s/s1600-h/post_remove_fb.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_g-q7zXM0b-c/SLJgv_-cEHI/AAAAAAAAAjA/5BX91Gzsg2s/s400/post_remove_fb.png" alt="" id="BLOGGER_PHOTO_ID_5238355694328746098" border="0" /></a><br /><br />Facebook will send data to the post remove url page about the user removing the application.<br />The post_remove.php example from my server.<br /><br /><pre><br /><?php<br /><br />//facebook lib<br />require_once 'fbclient/facebook.php';<br /><br />//my database config<br />require_once 'config/config.php';<br /><br />$appapikey = 'you_app_api_key';<br />$appsecret = 'your_app_secret_key';<br /><br />$facebook = new Facebook($appapikey, $appsecret);<br />$user_id = $facebook->require_login();<br /><br />$user = $facebook->get_loggedin_user();<br /><br />if ($user != NULL && $facebook->fb_params['uninstall'] == 1)<br />{<br /> //The user has removed your app<br /> mysql_query("DELETE FROM users WHERE userid='$user_id'") or die(mysql_error());<br />}<br /><br />?><br /></pre><br /><br />Reference:<br /><a href="http://wiki.developers.facebook.com/index.php/Creating_Your_First_Application">Creating Your First Application Facebook wiki</a><br /><a href="http://wiki.developers.facebook.com/index.php/Post-Remove_URL">Post-Remove URL Facebook wiki</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7954055.post-19836837930890654602008-08-13T13:34:00.015+06:002008-08-13T15:34:31.742+06:00Matrix in OpenGL<pre><br />[0 4 8 12]<br />[1 5 9 13]<br />[2 6 10 14]<br />[3 7 11 15]<br /><br />4x4 matrix in memory.<br /><br />[R0 R3 R6 Tx]<br />[R1 R4 R7 Ty]<br />[R2 R5 R8 Tz]<br />[ 0 0 0 1]<br /></pre><br />'R' represents rotations and scaling (and shearing)<br />'T' translation<br /><br /><br />First, I read the matrix and print it.<br /><br /><pre><br />float x[16];<br />int i;<br /><br />//read the 4x4 matrix and store in x<br />glGetFloatv (GL_MODELVIEW_MATRIX, (float*)x);<br /><br />//print the matrix<br />for(i=0; i<4; i++){<br /> printf("%f\t%f\t%f\t%f", x[i], x[i+4], x[i+8], x[i+12]); <br /> printf("\n");<br />}<br /><br />glTranslatef(2, 0.0, 0.0);<br /><br /><br />//print the matrix after translate<br /><br />glGetFloatv (GL_MODELVIEW_MATRIX, (float*)x);<br /><br />printf("\n-----------------------\n");<br /><br />for(i=0; i<4; i++){<br /> printf("%f\t%f\t%f\t%f", x[i], x[i+4], x[i+8], x[i+12]); <br /> printf("\n");<br />}<br /><br /></pre><br /><br />Run the program.<br /><br />After translate our matrix changes in "Tx" -2.000000<br /><pre><br />-1.000000 0.000000 0.000000 0.000000<br /> 0.000000 -0.196116 0.980581 0.000000<br /> 0.000000 0.980581 0.196116 -10.198039<br /> 0.000000 0.000000 0.000000 1.000000<br />-----------------------------------------<br />-1.000000 0.000000 0.000000 -2.000000<br /> 0.000000 -0.196116 0.980581 0.000000<br /> 0.000000 0.980581 0.196116 -10.198039<br /> 0.000000 0.000000 0.000000 1.000000<br /></pre><br /><br /><br />Instead of translate if we use rotation<br /><pre><br />glRotatef(45, 0.0, 1.0, 1.0);<br /></pre><br />After rotation our matrix changes in "R"<br /><pre><br />-1.000000 0.000000 0.000000 0.000000<br /> 0.000000 -0.196116 0.980581 0.000000<br /> 0.000000 0.980581 0.196116 -10.198039<br /> 0.000000 0.000000 0.000000 1.000000<br />-----------------------------------------<br />-0.707107 0.500000 -0.500000 0.000000<br />-0.588348 -0.023793 0.808257 0.000000<br /> 0.392232 0.865699 0.310998 -10.198039<br /> 0.000000 0.000000 0.000000 1.000000<br /><br /></pre><br /><br /><br />Reference: <a href="http://www.gamedev.net/community/forums/topic.asp?topic_id=441698">www.gamedev.net Forum</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7954055.post-48545735442657541382008-07-19T23:37:00.007+06:002008-07-20T19:45:45.503+06:00Simple Solar System in OpenGL<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_g-q7zXM0b-c/SIInLYMbF2I/AAAAAAAAAiM/wL1tVbMHpHk/s1600-h/OpenGL_SolarSystem.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_g-q7zXM0b-c/SIInLYMbF2I/AAAAAAAAAiM/wL1tVbMHpHk/s320/OpenGL_SolarSystem.png" alt="" id="BLOGGER_PHOTO_ID_5224781594129799010" border="0" /></a><br /><br /><br />I have created a simple Solar System using OpenGL<br /><blockquote><br /><span style="font-size:85%;"><br /><pre><br />#include <stdlib.h><br />#include <GLUT/glut.h><br />#include <math.h><br />#include <stdio.h><br /><br />static float Xvalue = 0.0, Yvalue = 0.0, Angle = 0.0;<br /><br />int MoveX = 0;<br />int MoveY = 0;<br /><br />void myInit(void) {<br /> glClearColor (0.0, 0.0, 0.0, 0.0);<br />}<br /><br /><br />static float x1[360][2];<br />static float x2[360][2];<br />static float x3[720][2];<br /><br /><br />void generateCircle()<br />{<br /> int i = 0;<br /> <br /> for(i=0; i <= 360; i++)<br /> {<br /> x1[i][0] = sin(i*3.1416/180)*3;<br /> x1[i][1] = cos(i*3.1416/180)*3;<br /> }<br /> <br /> for(i=0; i <= 360; i++)<br /> {<br /> x2[i][0] = sin(i*3.1416/180)*1;<br /> x2[i][1] = cos(i*3.1416/180)*1;<br /> }<br /> <br /> for(i=0; i <= 720; i++)<br /> {<br /> x3[i][0] = sin(i*3.1416/180)*5;<br /> x3[i][1] = cos(i*3.1416/180)*5;<br /> }<br /> <br />}<br /><br /><br /><br /><br />void myDisplay(void) {<br /> <br /> glClear (GL_COLOR_BUFFER_BIT);<br /> glColor3f (1.0, 1.0, 1.0);<br /> <br /> //sun<br /> glPushMatrix();<br /> gluLookAt (0.0, 10.0, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0);<br /> glTranslatef(Xvalue, 0.0, Yvalue);<br /> glRotatef(Angle, 0.0, 0.0, 1.0);<br /> glutWireSphere (0.5, 15, 15);<br /> glPopMatrix();<br /> <br /> glPushMatrix();<br /> gluLookAt (0.0, 10.0, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0);<br /> if(MoveX==360)<br /> MoveX = 0;<br /> glTranslatef(x1[MoveX][1], x1[MoveX][0], 0.0);<br /> glRotatef(Angle, 0.0, 0.0, 1.0);<br /> glutWireSphere (0.4, 15, 15);<br /> glTranslatef(x2[MoveX][0], x2[MoveX][1], 0.0);<br /> glutWireSphere (0.2, 15, 15);<br /> glPopMatrix();<br /> <br /> glPushMatrix();<br /> gluLookAt (0.0, 10.0, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0);<br /> if(MoveY==720)<br /> MoveY = 0;<br /> glTranslatef(x3[MoveY/2][1], x3[MoveY/2][0], 0.0);<br /> glRotatef(Angle, 0.0, 0.0, 1.0);<br /> glutWireSphere (0.4, 15, 15);<br /> int i = 0;<br /> //glBegin(GL_LINE_STRIP);<br /> glBegin(GL_QUAD_STRIP);<br /> for(i=0; i <= 360; i++)<br /> {<br /> glVertex3f(sin(i*3.1416/180)*0.5, cos(i*3.1416/180)*0.5, 0 );<br /> glVertex3f(sin(i*3.1416/180)*0.7, cos(i*3.1416/180)*0.7, 0 );<br /> }<br /> glEnd();<br /> glRotatef(Angle, 0.0, 0.0, 1.0);<br /> glPopMatrix();<br /> <br /> glFlush ();<br />}<br /><br /><br />void resize(int w, int h)<br />{<br /> glViewport (0, 0, (GLsizei) w, (GLsizei) h); <br /> glMatrixMode (GL_PROJECTION);<br /> glLoadIdentity ();<br /> glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);<br /> glMatrixMode (GL_MODELVIEW);<br /> glLoadIdentity ();<br />}<br /><br /><br />void animation()<br />{<br /> Angle += 15.0;<br /> glutPostRedisplay();<br /> MoveX +=1;<br /> MoveY +=1;<br /> glutPostRedisplay();<br /> glutTimerFunc(100, animation, 0);<br /> <br />}<br /><br /><br />int main(int argc, char ** argv){<br /> <br /> glutInit(&argc, argv);<br /> glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);<br /> glutInitWindowSize(1024, 768);<br /> glutInitWindowPosition(100, 150);<br /> glutCreateWindow("OpenGL");<br /> myInit();<br /> glutDisplayFunc(myDisplay);<br /> glutReshapeFunc(resize); <br /> generateCircle();<br /> glutTimerFunc(100, animation, 0);<br /> glutMainLoop();<br />}<br /></blockquote><br /></span><br /></pre>Unknownnoreply@blogger.com11