<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-352389519114866248</id><updated>2012-02-16T17:03:37.161-08:00</updated><title type='text'>littleball</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>50</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-5205616197129217937</id><published>2009-07-26T01:08:00.000-07:00</published><updated>2009-07-26T01:09:12.912-07:00</updated><title type='text'>setup bind on Macbook</title><content type='html'>A few things to remember before we start...&lt;br /&gt;Capitalization is important!&lt;br /&gt;Terminal commands are shown in orange, and preceded by a # prompt character (don't type that!).&lt;br /&gt;Comments are shown below commands, and /* surrounded by comment markers */. Don't type the comments.&lt;br /&gt;Text you should be pasting is in orange italics.&lt;br /&gt;And now, the step-by-step...&lt;br /&gt;Start a root Terminal session&lt;br /&gt;&lt;br /&gt;Open a Terminal session and launch a root shell by typing sudo bash. The rest of the instructions assume every step is done in this root shell!&lt;br /&gt;&lt;br /&gt;Set up your machine to run the BIND server.&lt;br /&gt;# rndc-confgen &gt; /etc/rndc.conf &lt;br /&gt;  /* creates rndc.conf and generates key */&lt;br /&gt;# head -n 6 /etc/rndc.conf &gt; /etc/rndc.key&lt;br /&gt;  /* parses the key into the proper file */&lt;br /&gt;# pico -w /etc/named.conf&lt;br /&gt;  /* opens the BIND configuration file for editing in the text editor */&lt;br /&gt;Add the following into the options section, where x.x.x.x represents the IP addresses of either your ISP, or other DNS servers, known to you (Google for DNS servers if you don't know of any):&lt;br /&gt;forwarders {&lt;br /&gt;x.x.x.x;&lt;br /&gt;x.x.x.x;&lt;br /&gt;};&lt;br /&gt;Save the file and quit the editor. Hit Control-O, Enter, then Control-X.&lt;br /&gt;&lt;br /&gt;Create StartupItem for DNS [10.4 only; otherwise jump to next step]&lt;br /&gt;&lt;br /&gt;It seems as if Tiger has removed the (already disabled in Panther) DNS Server completely from StartupItems. We have to add it if running Tiger.&lt;br /&gt;# cd /System/Library/StartupItems&lt;br /&gt;# mkdir BIND&lt;br /&gt;# cd BIND&lt;br /&gt;# touch BIND; pico -w BIND&lt;br /&gt;  /* Create first of two files, then open it in text editor */&lt;br /&gt;Copy the following into the file, save it, and exit:&lt;br /&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;. /etc/rc.common&lt;br /&gt;&lt;br /&gt;if [ "${DNSSERVER}" = "-YES-" ]; then&lt;br /&gt;  ConsoleMessage "Starting BIND DNS Server"&lt;br /&gt;  /usr/sbin/named&lt;br /&gt;fi&lt;br /&gt; $ touch StartupParameters.plist; pico -w StartupParameters.plist&lt;br /&gt;  /* Create and open second of two files needed */&lt;br /&gt;Copy the following into the file,save it, and exit:&lt;br /&gt;{&lt;br /&gt;  Description = "Local Caching DNS Server";&lt;br /&gt;  Provides = ("DNS Server");&lt;br /&gt;  OrderPreference = "None";&lt;br /&gt;  Messages = &lt;br /&gt;  {&lt;br /&gt;  start = "Starting BIND DNS Server";&lt;br /&gt;  stop = "Stopping BIND DNS Server";&lt;br /&gt;  };&lt;br /&gt;}&lt;br /&gt; $ chmod +x BIND&lt;br /&gt;  /* Make the script executable so it can actually be run */&lt;br /&gt;Enable DNS on boot&lt;br /&gt;# pico -w /etc/hostconfig&lt;br /&gt;  /* Open the file OS X reads to start services */&lt;br /&gt;Change it to make DNSSERVER=-YES-. Here Tiger users will have to add this value; Panther users will simply change it to -YES-. Save the file and exit.&lt;br /&gt;&lt;br /&gt;Finish up with root&lt;br /&gt;# exit&lt;br /&gt;  /* End root shell */&lt;br /&gt;Tell OS X to use your local DNS &lt;br /&gt;&lt;br /&gt;Open System Preferences, then the Network preferences panel. Change your 'DNS Server' setting to 127.0.0.1 for all the connections you use. This step is crucial, as failing to do so will make all your hard work completely useless. &lt;br /&gt;&lt;br /&gt;Finally, either reboot, or issue the following command in the terminal:&lt;br /&gt;$ sudo /System/Library/StartupItems/BIND/BIND&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-5205616197129217937?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/5205616197129217937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=5205616197129217937' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/5205616197129217937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/5205616197129217937'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2009/07/setup-bind-on-macbook.html' title='setup bind on Macbook'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-4117445846212014736</id><published>2009-03-31T08:21:00.000-07:00</published><updated>2009-03-31T08:26:10.971-07:00</updated><title type='text'>libss7 and asterisk</title><content type='html'>(1)svn co http://svn.digium.com/svn/libss7/tags/1.0.2 libss7-1.0.2&lt;br /&gt;(2)svn co http://svn.digium.com/svn/dahdi/linux/tags/2.1.0.4 dahdi-2.1.0.4&lt;br /&gt;(3)svn co http://svn.digium.com/svn/asterisk/branches/1.6.0.6 asterisk-1.6.0.6&lt;br /&gt;(4)svn co http://svn.digium.com/svn/dahdi/tools/tags/2.1.0.2 dahdi-tools-2.1.0.2&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-4117445846212014736?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/4117445846212014736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=4117445846212014736' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/4117445846212014736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/4117445846212014736'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2009/03/libss7-and-asterisk.html' title='libss7 and asterisk'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-2685360766922999512</id><published>2009-03-26T06:10:00.000-07:00</published><updated>2009-03-26T06:11:03.494-07:00</updated><title type='text'>Asterisk LibSS7 Howto</title><content type='html'>Asterisk LibSS7 Howto&lt;br /&gt;&lt;br /&gt;This Howto has been contributed by Matthew Fredrickson - Author of LibSS7 at Digium&lt;br /&gt;&lt;br /&gt;I have received many requests lately for a more current document&lt;br /&gt;describing how to setup Asterisk with SS7 support. The following email&lt;br /&gt;will hopefully suffice. The contents of this are also contained in the&lt;br /&gt;README file in libss7 as well as inside Asterisk-trunk in the&lt;br /&gt;doc/ss7.txt file.&lt;br /&gt;&lt;br /&gt;To Use:&lt;br /&gt;=======&lt;br /&gt;In order to use libss7, you must get at least the following versions of&lt;br /&gt;Zaptel, libss7, and Asterisk (you might also want to get libpri):&lt;br /&gt;Zaptel: 1.4.x&lt;br /&gt;Asterisk: trunk&lt;br /&gt;libss7: trunk (currently, there *only* is a trunk release).&lt;br /&gt;&lt;br /&gt;You must then do a `make; make install` in each of the directories that&lt;br /&gt;you installed in the given order (Zaptel first, libss7 second, and&lt;br /&gt;Asterisk last).&lt;br /&gt;&lt;br /&gt;NOTE: In order to check out the code, you must have the subversion&lt;br /&gt;client installed. This is how to check them out from the public&lt;br /&gt;subversion server.&lt;br /&gt;&lt;br /&gt;These are the commands you would type to install them:&lt;br /&gt;&lt;br /&gt;`svn co http://svn.digium.com/svn/zaptel/branches/1.4 zaptel-1.4`&lt;br /&gt;`cd zaptel-1.4`&lt;br /&gt;`make; make install`&lt;br /&gt;&lt;br /&gt;`svn co http://svn.digium.com/svn/libss7/trunk libss7-trunk`&lt;br /&gt;`cd libss7-trunk`&lt;br /&gt;`make; make install`&lt;br /&gt;&lt;br /&gt;`svn co http://svn.digium.com/svn/asterisk/trunk asterisk-trunk`&lt;br /&gt;`cd asterisk-trunk`&lt;br /&gt;`./configure; make; make install;`&lt;br /&gt;&lt;br /&gt;This should build Zaptel, libss7, and Asterisk with SS7 support.&lt;br /&gt;&lt;br /&gt;In the past, there was a special asterisk-ss7 branch to use which&lt;br /&gt;contained the SS7 code. That code has been merged back into the trunk&lt;br /&gt;version of Asterisk, and the old asterisk-ss7 branch has been deprecated&lt;br /&gt;and removed. If you are still using the asterisk-ss7 branch, it will&lt;br /&gt;not work against the current version of libss7, and you should switch to&lt;br /&gt;asterisk-trunk instead.&lt;br /&gt;&lt;br /&gt;CONFIGURATION:&lt;br /&gt;In zaptel.conf, your signalling channel(s) should be a "dchan" and your&lt;br /&gt;bearers should be set as "bchan".&lt;br /&gt;&lt;br /&gt;In the asterisk-ss7 branch, there is a sample zapata.conf that is&lt;br /&gt;installed which contains sample configuration for setting up an E1 link.&lt;br /&gt;&lt;br /&gt;In brief, here is a simple ss7 linkset setup:&lt;br /&gt;&lt;br /&gt;signalling = ss7&lt;br /&gt;ss7type = itu ; or ansi if you are using an ANSI link&lt;br /&gt;&lt;br /&gt;linkset = 1 ; Pick a number for your linkset identifier in&lt;br /&gt;; zapata.conf&lt;br /&gt;&lt;br /&gt;pointcode = 28 ; The decimal form of your point code. If you&lt;br /&gt;; are using an&lt;br /&gt;; ANSI linkset, you can use the xxx-xxx-xxx&lt;br /&gt;notation for&lt;br /&gt;; specifying your linkset pointcode.&lt;br /&gt;adjpointcode = 2 ; The point code of the switch adjacent to your&lt;br /&gt;; linkset&lt;br /&gt;&lt;br /&gt;defaultdpc = 3 ; The point code of the switch you want to send&lt;br /&gt;; your ISUP&lt;br /&gt;; traffic to. A lot of the time, this is the&lt;br /&gt;; same as your&lt;br /&gt;; adjpointcode.&lt;br /&gt;&lt;br /&gt;; Now we configure our Bearer channels (CICs)&lt;br /&gt;&lt;br /&gt;cicbeginswith = 1 ; Number to start counting the CICs from. So if&lt;br /&gt;; Zap/1 to Zap/15 are CICs 1-15, you would set&lt;br /&gt;; this to 1 before you&lt;br /&gt;; declare channel=1-15&lt;br /&gt;&lt;br /&gt;channel=1-15 ; Use Zap/1-15 and assign them to CICs 1-15&lt;br /&gt;&lt;br /&gt;cicbeginswith = 17 ; Now for Zap/17 to Zap/31, they are CICs 17-31&lt;br /&gt;; so we initialize&lt;br /&gt;; cicbeginswith to 17 before we declare those&lt;br /&gt;; channels&lt;br /&gt;&lt;br /&gt;channel = 17-31 ; This assigns CICs 17-31 to channels 17-31&lt;br /&gt;&lt;br /&gt;signchan = 16 ; This is where you declare which Zap channel is&lt;br /&gt;; your signalling&lt;br /&gt;; channel. In our case it is Zap/16. You can&lt;br /&gt;; add redundant&lt;br /&gt;; signalling channels by adding additional&lt;br /&gt;; sigchan= lines.&lt;br /&gt;&lt;br /&gt;; If we want an alternate redundant signalling channel add this&lt;br /&gt;&lt;br /&gt;sigchan = 48 ; This would put two signalling channels&lt;br /&gt;in our ; linkset, one at Zap/16 and one at Zap/48 which&lt;br /&gt;; both would be used to send/receive&lt;br /&gt;; ISUP traffic.&lt;br /&gt;&lt;br /&gt;; End of zapata.conf&lt;br /&gt;&lt;br /&gt;This is how a basic linkset is setup. For more detailed zapata.conf SS7&lt;br /&gt;config information as well as other options available for that file, see&lt;br /&gt;the default zapata.conf that comes with the samples in asterisk. If you&lt;br /&gt;would like, you can do a `make samples` in your asterisk-trunk directory&lt;br /&gt;and it will install a sample zapata.conf for you that contains more&lt;br /&gt;information about SS7 setup.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-2685360766922999512?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/2685360766922999512/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=2685360766922999512' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/2685360766922999512'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/2685360766922999512'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2009/03/asterisk-libss7-howto.html' title='Asterisk LibSS7 Howto'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-632598788150515678</id><published>2008-10-26T06:32:00.001-07:00</published><updated>2008-10-26T06:32:51.341-07:00</updated><title type='text'>how to configure postgresql for asterisk cdr</title><content type='html'>./configure --with-postgres=/usr/local/pgsql&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-632598788150515678?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/632598788150515678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=632598788150515678' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/632598788150515678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/632598788150515678'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2008/10/how-to-configure-postgresql-for.html' title='how to configure postgresql for asterisk cdr'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-6594489946876666866</id><published>2008-10-12T02:22:00.001-07:00</published><updated>2008-10-12T02:22:55.322-07:00</updated><title type='text'>SIP Strict versus Loose Routing</title><content type='html'>The way how record routing works has evolved. Record routing according to RFC2543 rewrote the Request-URIii. That means the Request-URI always&lt;br /&gt;contained URI of the next hop (which can be either next proxy server which inserted Record-Route header field or destination user agent). Because of that it was necessary to save the original Request-URI as the last Route header field. This approach is called strict routing.&lt;br /&gt;&lt;br /&gt;Loose routing, as specified in RFC3261, works in a little bit different way. The Request-URI is no more overwritten, it always contains URI of the destination user agent. If there are any Route header field in a message, than the message is sent to the URI from the topmost Route header field. This is significant change--Request-URI doesn't necessarily contain URI to which the request will be sent. In fact, loose routing is very similar to IP source routing.&lt;br /&gt;&lt;br /&gt;Because transit from strict routing to loose routing would break backwards compatibility and older user agents wouldn't work, it is necessary to make loose routing backwards compatible. The backwards compatibility unfortunately adds a lot of overhead and is often source of major problems.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-6594489946876666866?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/6594489946876666866/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=6594489946876666866' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/6594489946876666866'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/6594489946876666866'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2008/10/sip-strict-versus-loose-routing.html' title='SIP Strict versus Loose Routing'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-7431126336891842164</id><published>2008-10-11T01:39:00.000-07:00</published><updated>2008-10-11T01:40:44.202-07:00</updated><title type='text'>SIP layered protocol</title><content type='html'>(1)The lowest layer of SIP is its syntax and encoding.  Its encoding is specified using an augmented Backus-Naur Form grammar (BNF).&lt;br /&gt;(2)The second layer is the transport layer.&lt;br /&gt;(3)The third layer is the transaction layer.&lt;br /&gt;(4)The layer above the transaction layer is called the transaction user(TU).  Each of the SIP entities, except the stateless proxy, is a transaction user.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-7431126336891842164?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/7431126336891842164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=7431126336891842164' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/7431126336891842164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/7431126336891842164'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2008/10/sip-layered-protocol.html' title='SIP layered protocol'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-1636882844365939402</id><published>2008-10-10T23:06:00.000-07:00</published><updated>2008-10-11T03:00:27.922-07:00</updated><title type='text'>SIP Record-Route</title><content type='html'>In some cases, it may be useful for proxies in the SIP signaling path to see all the messaging between the endpoints for the duration of the session.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For example, if the biloxi.com proxy server wished to remain in the SIP messaging path beyond the initial INVITE, it would add to the INVITE a required routing header field known as Record-Route that contained a URI resolving to the hostname or IP address of the proxy.&lt;br /&gt;&lt;br /&gt;This capability is frequently used for proxies that are providing mid-call features.&lt;br /&gt;&lt;br /&gt;A route set is a collection of ordered SIP or SIPS URI which represent a list of proxies that must be traversed when sending a particular request.  A route set can be learned, through headers like Record-Route, &lt;span style="font-weight:bold;"&gt;or it can be configured.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-1636882844365939402?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/1636882844365939402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=1636882844365939402' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/1636882844365939402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/1636882844365939402'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2008/10/sip-record-route.html' title='SIP Record-Route'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-7703906037611966424</id><published>2008-10-10T21:26:00.000-07:00</published><updated>2008-10-10T21:27:10.672-07:00</updated><title type='text'>SIP Via vs Contact</title><content type='html'>While the Via header field tells other elements where to send the response, the Contact header field tells other elements where to send future requests.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-7703906037611966424?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/7703906037611966424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=7703906037611966424' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/7703906037611966424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/7703906037611966424'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2008/10/sip-via-vs-contact.html' title='SIP Via vs Contact'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-7442941906340317628</id><published>2008-10-10T21:20:00.000-07:00</published><updated>2008-10-11T02:37:54.270-07:00</updated><title type='text'>SIP dialog</title><content type='html'>http://tools.ietf.org/rfc/rfc3261.txt&lt;br /&gt;&lt;br /&gt;A dialog is a peer-to-peer SIP relationship between two UAs that persists for some time.  A dialog is established by SIP messages, such as a 2xx response to an INVITE request.  A dialog is identified by a call identifier, local tag, and a remote tag.  A dialog was formerly known as a call leg in RFC 2543.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The combination of the To tag, From tag, and Call-ID completely defines a peer-to-peer SIP relationship between caller and callee and is referred to as a dialog.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-7442941906340317628?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/7442941906340317628/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=7442941906340317628' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/7442941906340317628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/7442941906340317628'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2008/10/sip-dialog.html' title='SIP dialog'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-3397759385019688324</id><published>2008-06-06T22:08:00.000-07:00</published><updated>2008-06-06T22:13:38.840-07:00</updated><title type='text'>netbeans java.lang.AbstractMethodError: org. customer .xerces.dom.DeferredDocumentImpl.setDocumentURI(Ljava/lang/String;)V</title><content type='html'>Context:&lt;br /&gt;&lt;br /&gt;when running Netbeans under JDK 1.5.X or later, when one jsp file is opened and being saved, following exception is thrown:&lt;br /&gt;&lt;br /&gt;java.lang.AbstractMethodError: org. customer.xerces.dom.DeferredDocumentImpl.setDocumentURI(Ljava/lang/String;)V&lt;br /&gt;&lt;br /&gt;o make a long story short:&lt;br /&gt;&lt;br /&gt;- Method&lt;br /&gt;     public void setDocumentURI(String documentURI);&lt;br /&gt;   was added to the org.w3c.dom.Document interface&lt;br /&gt;   in J2SE 1.5 (it was not present in J2SE 1.4).&lt;br /&gt;&lt;br /&gt;- The new method is implemented by&lt;br /&gt;     com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl&lt;br /&gt;   (in J2SE 1.5), but not by&lt;br /&gt;     org.apache.xerces.dom.DeferredDocumentImpl&lt;br /&gt;   in xercesImpl.jar&lt;br /&gt;&lt;br /&gt;- javax.xml.parsers.DocumentBuilderFactory in J2SE 1.5 will instantiate&lt;br /&gt;  factories of type "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"&lt;br /&gt;  for webapps bundling xercesImpl.jar, due to the presence of the&lt;br /&gt;  META-INF/services/javax.xml.parsers.DocumentBuilderFactory resource&lt;br /&gt;  in that JAR, which specifies&lt;br /&gt;  "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl" as the factory&lt;br /&gt;  type to be instantiated.&lt;br /&gt;&lt;br /&gt;Instructing the WebappClassLoader to avoid loading any symbols from&lt;br /&gt;"org.apache.xerces" (and hoping it would fallback to &lt;br /&gt;"com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl")&lt;br /&gt;won't solve the problem.&lt;br /&gt;&lt;br /&gt;I've arrived at a fix, which is to define a system property with name&lt;br /&gt;&lt;br /&gt;   javax.xml.parsers.DocumentBuilderFactory&lt;br /&gt;&lt;br /&gt;and specify&lt;br /&gt;&lt;br /&gt;  com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl&lt;br /&gt;&lt;br /&gt;as its value.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-3397759385019688324?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/3397759385019688324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=3397759385019688324' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/3397759385019688324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/3397759385019688324'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2008/06/netbeans-javalangabstractmethoderror.html' title='netbeans java.lang.AbstractMethodError: org. customer .xerces.dom.DeferredDocumentImpl.setDocumentURI(Ljava/lang/String;)V'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-8074972545376827454</id><published>2008-05-25T20:03:00.000-07:00</published><updated>2008-05-25T20:04:11.189-07:00</updated><title type='text'>How to use STUN in applications</title><content type='html'>How to use STUN in applications&lt;br /&gt;&lt;br /&gt;This document has been reviewed for maemo 3.x.&lt;br /&gt;&lt;br /&gt;This tutorial shows how to use the libjingle API to create peer-to-peer connections between parties that are behind NAT routers.&lt;br /&gt;Network Address Translation (NAT)&lt;br /&gt;&lt;br /&gt;NAT routers were born because of the imminent IP address exhaustion. The currently most used Internet address, called IPv4, is 32 bits wide, which means around 4 billion address available.&lt;br /&gt;&lt;br /&gt;4 billion addresses seem to be an abundant resource, but not all addresses can be assigned to hosts, as not all telephone number permutations can be assigned to users, since IP addresses also carry routing information, analog to the prefix of a telephone number that identifies country, region, city...&lt;br /&gt;&lt;br /&gt;The definitive solution for the problem is to increase the address length, that is what IPv6 does, by offering 128-bit addresses. But IPv6 would take (and it is taking) time to be deployed, so an intermediate solution was found: NAT - Network Address Translation.&lt;br /&gt;&lt;br /&gt;A NAT router acts like a switchboard between the public Internet and a private network. The NAT router needs to have at least one valid Internet address in order to be "seen" by the rest of the Internet. The computers in the private network have private address in the ranges 10.0.0.0/8, 192.168.0.0/16 or 172.16.0.0/12, that are not routable in the Internet.&lt;br /&gt;&lt;br /&gt;When a private computer e.g. address 10.0.0.1 tries to connect a public server e.g. 200.215.89.79, the network packet must pass through the NAT router. The NAT router knows that the source address 10.0.0.1 is not routable. So the NAT router replaces 10.0.0.1 with its own valid address (e.g. 64.1.2.3) and sends the packet forward.&lt;br /&gt;&lt;br /&gt;The remote server 200.215.89.79 will "see" a connection coming from the 64.1.2.3 host, and will reply to that host.&lt;br /&gt;&lt;br /&gt;When the response packet comes to NAT router, it must know somehow that this packet is not for itself, it is for the computer in the private network. Once the NAT router relates the packet coming from the blue with the active NAT'ed connections, it can replace the destination address from 64.1.2.3 to 10.0.0.1 and deliver the packet in the private network.&lt;br /&gt;&lt;br /&gt;In more technical depth, NAT is possible because absolutely every network connection in the Internet has a unique tuple built from the following values:&lt;br /&gt;&lt;br /&gt;    * Client address (the host that initiates the connection)&lt;br /&gt;    * Server address (the passive side that receives the initiation packet)&lt;br /&gt;    * Client port number&lt;br /&gt;    * Server port number&lt;br /&gt;    * The transport protocol e.g. TCP, UDP, SCTP...&lt;br /&gt;&lt;br /&gt;If the NAT router replaces the client address by its own, but also replaces the client port number when necessary to avoid clash with another active connection, the uniqueness of each connection is not broken. NAT allows for a virtually unlimited number of computers in a private network to access the Internet via only one NAT router with only one public IP address.&lt;br /&gt;NAT problems&lt;br /&gt;&lt;br /&gt;NAT is not without some disvantages. First, the NAT router needs to keep connection states in memory, which partially denies a cornerstone Internet philosophy ("dumb routers, smart hosts"). If a NAT router is reset, all connections will be terminated, while a regular router could be reset without harming any connection.&lt;br /&gt;&lt;br /&gt;Second, the hosts in private network cannot easily offer a service to the public Internet, that is, these hosts cannot be the "passive" side in connections, since the initiation packet will come to the NAT router and it will have no related connection in its memory.&lt;br /&gt;&lt;br /&gt;A partial solution for that problem is to open a "hole" in the NAT for specific ports, for example any connection to the port 8000 of the NAT router should be redirected to the machine 10.0.0.2 port 80. That works, but it does not scale (the number of ports is limited, and some protocols work only on a very specific port number) and demands configuring the NAT router.&lt;br /&gt;&lt;br /&gt;Since the bulk of the Internet traffic is HTTP and initiated from the private network, NATs are fine for most users.&lt;br /&gt;NAT peer-to-peer circumvention techniques&lt;br /&gt;&lt;br /&gt;The most problematic services to deploy in presence of NATs are of peer-to-peer (P2P) style, when two clients of the service make direct connections to each other, without sending data through an intermediate server. This is the case of SIP-based VoIP, most P2P file sharing networks etc.&lt;br /&gt;&lt;br /&gt;If one of the P2P parties has a routable IP address, the problem is solved: the party behind the NAT router must initate the connection, and that's it. The remaining problematic case (unfortunately the most common one) is when both P2P parties are behind NATs.&lt;br /&gt;&lt;br /&gt;Several techniques have been proposed to solve this case. The most elegant solutions require both software updates in the NAT router itself and explicit support in the client software. It is the case of UPnP IGD (Internet Gateway Device) protocol, where a host can explicitely request a "hole" to be open in the NAT router, so a service is acessible from the Internet.&lt;br /&gt;&lt;br /&gt;IGD is nice and has been enjoying good support from NAT router vendors, but it is still not ubiquitous and has a major flaw: if there are two or more NAT routers in the packet traffic way (a rather common situation), IGD ceases to be effective.&lt;br /&gt;&lt;br /&gt;It is opportune to remember that none of the NAT circumvention techniques, not even the most elegant, solve completely the problem. There still must be a signaling protocol for the parties to exchange the connection parameters. In other words, It does not suffice to be able to open a "hole" in the NAT router; there must be a way to communicate the address and port of the hole to the remote party. A pure P2P service can only be achieved when all parties possess public addresses, which is expected to happen when IPv6 is widely deployed.&lt;br /&gt;&lt;br /&gt;Another way is simply to open a NAT hole via router configuration. Most home/SOHO routers allow this configuration to be easily done. It is a very popular technique among gamers (some routers even label the NAT holes as "game ports"). The main advantage of this technique is no need of explicit NAT-piercing support in the client software itself. The software must only be "well-behaved", not trying to guess the local IP address by itself (which would return a private address instead of the router public address).&lt;br /&gt;&lt;br /&gt;The main disvantage of manual configuration of NAT holes is that they are, well, manual: one explicit administrative intervention is needed for each new protocol. It it not good enough if the user has no access to NAT configuration (the most common case in collective and corporate networks).&lt;br /&gt;STUN, TURN and ICE protocols&lt;br /&gt;&lt;br /&gt;There have been proposed NAT circumvention techniques that do not demand router software updates. STUN (Simple Transversal of UDP through NATs) is the main one. STUN exploits the connectionless nature of UDP, as well as a security weakness of some NAT implementations. The technique is bound to UDP features, so STUN can not be used for e.g. TCP connections.&lt;br /&gt;&lt;br /&gt;The STUN protocol demands a STUN server with a well-known public IP address in the Internet. STUN stores the private address/port in an UDP payload and sends the packet to the STUN server. If packet goes through a NAT router, the address/port will be changed in the IP header -- but not in the payload.&lt;br /&gt;&lt;br /&gt;By comparing the payload with the IP header, and sending back the results to the client, STUN can deduce if there are any NAT routers in the way. If there are none, the host knows that it can directly receive connections from parties behind NATs.&lt;br /&gt;&lt;br /&gt;Some NATs have poor implementations that, in conjunction with STUN, allow for incoming UDP flow. The "full cone" NAT always translates the same source address/source port tuple to the same NAT router port; this relieves the NAT from storing full connection state. Any packet coming from Internet to that router port will be delivered to the host in the private network, no matter it came from.&lt;br /&gt;&lt;br /&gt;This allows for the private host to easily "punch a hole" in the NAT router. The first packet that opens the hole goes to STUN server. In turn, the private host learns from the STUN server which is the IP address and port number of the hole. These parameters are sent to the remote peer via signaling protocol. The remote peer can then send UDP data directly.&lt;br /&gt;&lt;br /&gt;Unfortunately, most NAT routers are not that naive; they are "symmetric", that is, they store full connection state and do not allow incoming packets from anyone but the party that was first contacted (in our case, the STUN server). In this scenario, STUN is not enough to allow P2P communication in presence of NAT.&lt;br /&gt;&lt;br /&gt;TURN (Traversal Using Relay NAT) comes for the rescue. TURN employs the same protocol as STUN, but the TURN server acts as a relayer in which both parties behind NATs can connect to. Since the relay server adds latency and needs to be maintained (and its bandwidth costs money), TURN should be used only as a last resort.&lt;br /&gt;&lt;br /&gt;ICE (Interactive Connectivity Establishment), a draft specification that is employed by Google Talk, is not a protocol by itself; it is a collection of techniques like STUN and TURN that finds all possible ways to establish a P2P connection and selects the best one.&lt;br /&gt;&lt;br /&gt;ICE works by finding all possible P2P connection candidates and sending this data to the remote peer via a signaling protocol (which is not specified by ICE, so the mechanism can be employed by any existing signaling protocol). Both parties do that simultaneously, so there are candidate messages flowing in both directions. When the parties agree on the best way to make the P2P connection, they can begin to exchange data directly.&lt;br /&gt;&lt;br /&gt;The biggest advantage of STUN, TURN and ICE is that they do not depend on specific support by the NAT routers, and ICE will work even if there are several routers in the network path. The downside is the need of public STUN and TURN (relay) servers. This disvantage is dilluted to some extent by the fact that every P2P service demands a signaling server anyway, so the same entity that offers the signaling will certainly offer the auxiliary STUN/TURN services.&lt;br /&gt;&lt;br /&gt;Another minor disvantage of ICE is that the signaling protocol will have to accomodate the "connection candidate" message, either by a explicit provision in the protocol (e.g. XMPP) or by some kludge.&lt;br /&gt;NAT transversal API in maemo&lt;br /&gt;&lt;br /&gt;In maemo platform, the developer does not need to worry about protocols or anything. maemo includes the libjingle library (the same as Google Talk) which offers an API for P2P connections.&lt;br /&gt;&lt;br /&gt;Nothing better than living examples to show how the maemo developer can take advantage on this API. Our example P2P client is very simple: it requests a service at random times and also processes requests from other P2P clients. The "service" is nothing more than adding 2 byte values.&lt;br /&gt;&lt;br /&gt;As already stated, every P2P server must have a signaling protocol over which the parties can exchange initial P2P connection parameters, so we need to build a very simple server as well as the signaling protocol. Since it is just an example, our server architecture does not attribute IDs for the clients, and therefore can handle only two simultaneous clients.&lt;br /&gt;&lt;br /&gt;The signaling protocol is very simple and has only one message: the connection candidate that one peer sends to the other. The message is simply forwarded to the other peer. Apart from encoding/decoding, these messages are completely handled by libjingle, so we don't need to understand them in depth.&lt;br /&gt;&lt;br /&gt;Once the connection parameters have been exchanged via the signaling server, the P2P connection happens and the parties communicate directly without any further signaling. Albeit very simple, this protocol simulates all the basic steps of every real-world P2P service.&lt;br /&gt;&lt;br /&gt;If you are interested in using XMPP/Google Talk as the signaling service, Libjingle source also contains examples of P2P communication that employ XMPP/Google Talk accounts and servers.&lt;br /&gt;Example: P2P client&lt;br /&gt;&lt;br /&gt;Follows a C++ example of P2P client based on Libjingle APIs. It is the smallest possible demonstration of NAT-piercing capability, so it does not handle network errors and overflows very well. A production implementation must improve in these directions.&lt;br /&gt;&lt;br /&gt;First, there is some boilerplate code: includes and prototypes.&lt;br /&gt;&lt;br /&gt;#define POSIX&lt;br /&gt;#define SIGSLOT_USE_POSIX_THREADS&lt;br /&gt;&lt;br /&gt;#include &lt;libjingle/talk/base/thread.h&gt;&lt;br /&gt;&lt;br /&gt;#include &lt;libjingle/talk/base/network.h&gt;&lt;br /&gt;#include &lt;libjingle/talk/base/socketaddress.h&gt;&lt;br /&gt;#include &lt;libjingle/talk/base/physicalsocketserver.h&gt;&lt;br /&gt;#include &lt;libjingle/talk/p2p/base/sessionmanager.h&gt;&lt;br /&gt;#include &lt;libjingle/talk/p2p/base/helpers.h&gt;&lt;br /&gt;#include &lt;libjingle/talk/p2p/client/basicportallocator.h&gt;&lt;br /&gt;&lt;br /&gt;#include &lt;libjingle/talk/p2p/client/socketclient.h&gt;&lt;br /&gt;&lt;br /&gt;#include &lt;string&gt;&lt;br /&gt;#include &lt;vector&gt;&lt;br /&gt;&lt;br /&gt;#include &lt;sys/socket.h&gt;&lt;br /&gt;#include &lt;netinet/in.h&gt;&lt;br /&gt;&lt;br /&gt;#include &lt;arpa/inet.h&gt;&lt;br /&gt;#include &lt;sys/types.h&gt;&lt;br /&gt;#include &lt;sys/socket.h&gt;&lt;br /&gt;#include &lt;sys/select.h&gt;&lt;br /&gt;#include &lt;sys/time.h&gt;&lt;br /&gt;#include &lt;time.h&gt;&lt;br /&gt;&lt;br /&gt;#include &lt;signal.h&gt;&lt;br /&gt;&lt;br /&gt;void signaling_init(const char* ip, unsigned int port);&lt;br /&gt;int signaling_wait(unsigned int timeout);&lt;br /&gt;void signaling_sendall(const char* buffer, unsigned int len);&lt;br /&gt;&lt;br /&gt;SocketClient* socketclient_init(const char *stun_ip, unsigned int stun_port, &lt;br /&gt;    const char *turn_ip, unsigned int turn_port);&lt;br /&gt;&lt;br /&gt;char* socketclient_add_remote_candidates(SocketClient *sc, char* buffer); &lt;br /&gt;void socketclient_add_remote_candidate(SocketClient *sc, const char *candidate);&lt;br /&gt;&lt;br /&gt;bool socketclient_is_writable (SocketClient *sc);&lt;br /&gt;&lt;br /&gt;void socketclient_send(SocketClient *sc, const char *data, unsigned int len);&lt;br /&gt;&lt;br /&gt;void randomize();&lt;br /&gt;&lt;br /&gt;For the sake of simplicity, we keep some data in global variables. A production implementation would probably move those data into objects.&lt;br /&gt;&lt;br /&gt;The p2p_state shows whether the P2P connection is up or down. signaling_socket is a TCP socket that allows data exchange via the signaling server before the P2P connection is up. main_thread contains a libjingle's Thread object; libjingle is itself multithreaded and employs one thread per P2P connection.&lt;br /&gt;&lt;br /&gt;bool p2p_state = false;&lt;br /&gt;int signaling_socket = -1;&lt;br /&gt;&lt;br /&gt;cricket::Thread *main_thread = 0;&lt;br /&gt;&lt;br /&gt;This is the main program loop. It sets up the signaling connection, forwards signaling data to LibJingle until the P2P connection is up. The P2P connection is simply used to send bytes at random intervals. If the P2P connection breaks, the loop returns to signaling phase. The program only stops when killed or when some unexpected error occurs.&lt;br /&gt;&lt;br /&gt;Note that we call main_thread-&gt;Loop(10) from time to time. In a "real" application, we would have this method called on idle time (e.g. via GLib's g_idle_add().&lt;br /&gt;&lt;br /&gt;We have some IP addresses hardcoded: signaling server, STUN server (if any) and TURN server (if any). Please update those addresses for your particular environment.&lt;br /&gt;&lt;br /&gt;int main(int argc, char* argv[])&lt;br /&gt;{&lt;br /&gt; signal(SIGPIPE, SIG_IGN);&lt;br /&gt; randomize();&lt;br /&gt; &lt;br /&gt; // P2P signaling server&lt;br /&gt; const char* signaling_ip = "200.184.118.140";&lt;br /&gt; int signaling_port = 14141;&lt;br /&gt;&lt;br /&gt; // STUN server if any, set to NULL if there are none&lt;br /&gt; const char* stun_ip = "200.184.118.140";&lt;br /&gt; // const char* stun_ip = 0;&lt;br /&gt; unsigned int stun_port = 7000;&lt;br /&gt;&lt;br /&gt; // TURN server if any, set to NULL if there are none&lt;br /&gt; const char* turn_ip = "200.184.118.140";&lt;br /&gt; // const char* turn_ip = 0;&lt;br /&gt; unsigned int turn_port = 5000;&lt;br /&gt;&lt;br /&gt; signaling_init(signaling_ip, signaling_port);&lt;br /&gt;&lt;br /&gt; SocketClient* sc = socketclient_init(stun_ip, stun_port, turn_ip, turn_port);&lt;br /&gt; &lt;br /&gt;        sc-&gt;getSocketManager()-&gt;StartProcessingCandidates();&lt;br /&gt;&lt;br /&gt; while (1) {&lt;br /&gt;  char buffer[10000];&lt;br /&gt;  char *buffer_p = buffer;&lt;br /&gt;  char *buffer_interpreted = buffer;&lt;br /&gt;&lt;br /&gt;  while (! p2p_state) {&lt;br /&gt;   main_thread-&gt;Loop(10);&lt;br /&gt; &lt;br /&gt;   if (! signaling_wait(1)) {&lt;br /&gt;    printf("-- tick --\n");&lt;br /&gt;    continue;&lt;br /&gt;   }&lt;br /&gt; &lt;br /&gt;   int n = recv(signaling_socket, buffer_p, sizeof(buffer) - (buffer_p - buffer), 0);&lt;br /&gt;   if (n &lt; 0) {&lt;br /&gt;    printf("Signaling socket closed with error\n");&lt;br /&gt;    exit(1);&lt;br /&gt;   } else if (n == 0) {&lt;br /&gt;    printf("Signaling socket closed\n");&lt;br /&gt;    exit(1);&lt;br /&gt;   }&lt;br /&gt;   buffer_p += n;&lt;br /&gt;   buffer_interpreted = socketclient_add_remote_candidates(sc, buffer_interpreted);&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  // P2P connection is up by now.&lt;br /&gt;  &lt;br /&gt;  while (p2p_state) {&lt;br /&gt;   // sends a byte via P2P connection&lt;br /&gt;   unsigned char data = random() % 256;&lt;br /&gt;   socketclient_send(sc, (char*) &amp;data, 1);&lt;br /&gt;   sleep(random() % 15 + 1);&lt;br /&gt;   main_thread-&gt;Loop(10);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  // P2P connection is broken, restart handling connection candidates&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Seeds the random() with some "random" value, otherwise the two peers may end up with exactly the same bytes and time intervals during P2P data exchange.&lt;br /&gt;&lt;br /&gt;void randomize()&lt;br /&gt;{&lt;br /&gt; struct timeval tv;&lt;br /&gt; struct timezone tz;&lt;br /&gt; gettimeofday(&amp;tv, &amp;tz);&lt;br /&gt; srandom(tv.tv_usec);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This function creates the signaling socket -- just a boring and ordinary TCP connection to the P2P signaling server.&lt;br /&gt;&lt;br /&gt;void signaling_init(const char* ip, unsigned int port)&lt;br /&gt;{&lt;br /&gt; struct sockaddr_in sa;&lt;br /&gt;&lt;br /&gt; signaling_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);&lt;br /&gt; &lt;br /&gt; bzero(&amp;sa, sizeof(sa));&lt;br /&gt; sa.sin_family = AF_INET;&lt;br /&gt; sa.sin_port = htons(port);&lt;br /&gt; inet_aton(ip, &amp;(sa.sin_addr));&lt;br /&gt;&lt;br /&gt; if (connect(signaling_socket, (struct sockaddr*) &amp;sa, sizeof(sa)) &lt; 0) {&lt;br /&gt;  printf("Error in signaling connect()\n");&lt;br /&gt;  exit(1);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This function waits for something to happen with the singaling socket, until the specified timeout. It is important that the timeout is not too large, since the P2P connection may have been brought up meanwhile.&lt;br /&gt;&lt;br /&gt;int signaling_wait(unsigned int timeout) {&lt;br /&gt; fd_set rfds;&lt;br /&gt; struct timeval tv;&lt;br /&gt; int retval;&lt;br /&gt;&lt;br /&gt; FD_ZERO(&amp;rfds);&lt;br /&gt; FD_SET(signaling_socket, &amp;rfds);&lt;br /&gt;&lt;br /&gt; tv.tv_sec = timeout;&lt;br /&gt; tv.tv_usec = 0;&lt;br /&gt;&lt;br /&gt; retval = select(signaling_socket+1, &amp;rfds, NULL, NULL, &amp;tv);&lt;br /&gt; if (retval == -1)&lt;br /&gt;  printf("error in select()");&lt;br /&gt;&lt;br /&gt; return (retval &gt; 0);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Libjingle is C++ and employs a signal architecture to notify the client application about changes in P2P connection status. These two classes accomodate the methods that will be called back when something happens.&lt;br /&gt;&lt;br /&gt;Since we are not using XMPP as the signaling protocol, we need to provide the signaling protocol handling by ourselves, so all signaling handling is carried out separatedly from those signals.&lt;br /&gt;&lt;br /&gt;class SignalListener1 : public sigslot::has_slots&lt;&gt;&lt;br /&gt;{&lt;br /&gt;private:&lt;br /&gt; SocketClient *sc;&lt;br /&gt;&lt;br /&gt;public:&lt;br /&gt; SignalListener1(SocketClient *psc);&lt;br /&gt; void OnCandidatesReady(const std::vector&lt;Candidate&gt;&amp; candidates);&lt;br /&gt; void OnNetworkError();&lt;br /&gt; void OnSocketState(bool state);&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;class SignalListener2 : public sigslot::has_slots&lt;&gt;&lt;br /&gt;{&lt;br /&gt;private:&lt;br /&gt; SocketClient *sc;&lt;br /&gt;&lt;br /&gt;public:&lt;br /&gt; SignalListener2(SocketClient *psc);&lt;br /&gt; void OnSocketRead(P2PSocket *socket, const char *data, size_t len);&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;SignalListener1::SignalListener1(SocketClient* psc)&lt;br /&gt;{&lt;br /&gt; sc = psc;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;SignalListener2::SignalListener2(SocketClient* psc)&lt;br /&gt;{&lt;br /&gt; sc = psc;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void SignalListener1::OnNetworkError()&lt;br /&gt;{&lt;br /&gt; printf ("Network error encountered at SocketManager");&lt;br /&gt; exit(1);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The first signal callback method. It is called when the P2P socket changes state. We update the p2p_state global variable with the reported state, and this will drive our main loop behavior.&lt;br /&gt;&lt;br /&gt;void SignalListener1::OnSocketState(bool state)&lt;br /&gt;{&lt;br /&gt; printf("Socket state changed to %d\n", state);&lt;br /&gt; p2p_state = state;&lt;br /&gt; if (state) {&lt;br /&gt;  printf("Writable from %s:%d to %s:%d\n", &lt;br /&gt;   sc-&gt;getSocket()-&gt;best_connection()-&gt;local_candidate().address().IPAsString().c_str(),&lt;br /&gt;   sc-&gt;getSocket()-&gt;best_connection()-&gt;local_candidate().address().port(),&lt;br /&gt;   sc-&gt;getSocket()-&gt;best_connection()-&gt;remote_candidate().address().IPAsString().c_str(),&lt;br /&gt;   sc-&gt;getSocket()-&gt;best_connection()-&gt;remote_candidate().address().port());&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This function packages all P2P socket creation bureaucracy. It creates the socket object, the socket listeners (whose classes have been defined above by us) and connects the signal callbacks.&lt;br /&gt;&lt;br /&gt;SocketClient* socketclient_init(const char *stun_ip, unsigned int stun_port, &lt;br /&gt;                                const char *turn_ip, unsigned int turn_port)&lt;br /&gt;{&lt;br /&gt; cricket::SocketAddress *stun_addr = NULL;&lt;br /&gt; if (stun_ip) {&lt;br /&gt;  stun_addr = new cricket::SocketAddress(std::string(stun_ip), stun_port);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; cricket::SocketAddress *turn_addr = NULL;&lt;br /&gt; if (turn_ip) {&lt;br /&gt;  turn_addr = new cricket::SocketAddress(std::string(turn_ip), turn_port);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; cricket::PhysicalSocketServer *ss = new PhysicalSocketServer();&lt;br /&gt; main_thread = new Thread(ss);&lt;br /&gt; cricket::ThreadManager::SetCurrent(main_thread);&lt;br /&gt;&lt;br /&gt; SocketClient *sc = new SocketClient (stun_addr, turn_addr);&lt;br /&gt;&lt;br /&gt; // Note that signal connections pass the SignalListener1 object as well as the&lt;br /&gt; // method. Since a new SocketListener1 is created for every new SocketClient,&lt;br /&gt; // we have the guarantee that each SocketListener1 will be called back only&lt;br /&gt; // in behalf of its related SocketClient.&lt;br /&gt;&lt;br /&gt; sc-&gt;sigl1 = new SignalListener1(sc);&lt;br /&gt; sc-&gt;sigl2 = new SignalListener2(sc);&lt;br /&gt; sc-&gt;getSocketManager()-&gt;SignalNetworkError.connect(sc-&gt;sigl1, &amp;SignalListener1::OnNetworkError);&lt;br /&gt; sc-&gt;getSocketManager()-&gt;SignalState_s.connect(sc-&gt;sigl1, &amp;SignalListener1::OnSocketState);&lt;br /&gt; sc-&gt;getSocketManager()-&gt;SignalCandidatesReady.connect(sc-&gt;sigl1, &amp;SignalListener1::OnCandidatesReady);&lt;br /&gt;   sc-&gt;CreateSocket(std::string("foobar"));&lt;br /&gt; sc-&gt;getSocket()-&gt;SignalReadPacket.connect(sc-&gt;sigl2, &amp;SignalListener2::OnSocketRead); &lt;br /&gt;&lt;br /&gt; return sc;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This method is called back when LibJingle has some local candidates for connection, that should be sent to the remote site via the signaling protocol.&lt;br /&gt;&lt;br /&gt;The beauty of ICE protocol is that parties will be able to agree on a P2P connection without having to exchange request/response messages. They just send connection candidates to each other. Each side selects the "best" way to send data based on received candidades; being both sides able to send data directly to the remote party, we have a P2P bidirectional channel.&lt;br /&gt;&lt;br /&gt;void SignalListener1::OnCandidatesReady(const std::vector&lt;Candidate&gt;&amp; candidates)&lt;br /&gt;{&lt;br /&gt; printf("OnCandidatesReady called with %d candidates in list\n", candidates.size());&lt;br /&gt;   &lt;br /&gt; for(std::vector&lt;Candidate&gt;::const_iterator it = candidates.begin(); it != candidates.end(); ++it) {&lt;br /&gt;  char *marshaled_candidate;&lt;br /&gt;&lt;br /&gt;  asprintf(&amp;marshaled_candidate, "%s %d %s %f %s %s %s\n",&lt;br /&gt;   (*it).address().IPAsString().c_str(), (*it).address().port(), (*it).protocol().c_str(),&lt;br /&gt;       (*it).preference(), (*it).type().c_str(), (*it).username().c_str(), &lt;br /&gt;   (*it).password().c_str() );&lt;br /&gt;&lt;br /&gt;  printf("Candidate being sent: %s", marshaled_candidate);&lt;br /&gt;&lt;br /&gt;  signaling_sendall(marshaled_candidate, strlen(marshaled_candidate));&lt;br /&gt;  &lt;br /&gt;  free(marshaled_candidate);&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;An auxiliary function to send a data buffer through the signaling TCP channel. It does not return until all data has been sent.&lt;br /&gt;&lt;br /&gt;void signaling_sendall(const char* buffer, unsigned int len)&lt;br /&gt;{&lt;br /&gt; unsigned int sent = 0;&lt;br /&gt; while (sent &lt; len) {&lt;br /&gt;  int just_sent;&lt;br /&gt;  just_sent = send(signaling_socket, buffer+sent, len-sent, 0);&lt;br /&gt;  if (just_sent &lt; 0) {&lt;br /&gt;   printf("Signaling socket closed with error.\n");&lt;br /&gt;   exit(1);&lt;br /&gt;  } else if (just_sent == 0) {&lt;br /&gt;   printf("Signaling socket closed.\n");&lt;br /&gt;   exit(1);&lt;br /&gt;  }&lt;br /&gt;  sent += just_sent;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This function is called by the main loop when some signaling data arrives. It will find out if there is a complete P2P connection candidate in the buffer. If there is one, it is decoded.&lt;br /&gt;&lt;br /&gt;// extracts remote candidates from a buffer, returns a pointer to the rest of the buffer&lt;br /&gt;&lt;br /&gt;char* socketclient_add_remote_candidates(SocketClient *sc, char* buffer)&lt;br /&gt;{&lt;br /&gt; char *n;&lt;br /&gt; char candidate[1024];&lt;br /&gt;&lt;br /&gt; while (1) {&lt;br /&gt;  n = strchr(buffer, '\n');&lt;br /&gt;  if (! n) {&lt;br /&gt;   return buffer;&lt;br /&gt;  }&lt;br /&gt;  strncpy(candidate, buffer, n-buffer+1);&lt;br /&gt;  socketclient_add_remote_candidate(sc, candidate);&lt;br /&gt;  buffer = n+1;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Here, the P2P connection candidate is decoded and made known to LibJingle. Since LibJingle has its own thread and sockets, all further processing of P2P candidates is fortunately outside the scope of our code.&lt;br /&gt;&lt;br /&gt;// Inform candidates received from the signaling network to LibJingle&lt;br /&gt;&lt;br /&gt;void socketclient_add_remote_candidate(SocketClient *sc, const char* remote_candidate)&lt;br /&gt;{&lt;br /&gt; std::vector&lt;Candidate&gt; candidates;&lt;br /&gt;&lt;br /&gt; char ip[100];&lt;br /&gt; unsigned int port;&lt;br /&gt; char protocol[100];&lt;br /&gt; float preference;&lt;br /&gt; char type[100];&lt;br /&gt; char username[100];&lt;br /&gt; char password[100];&lt;br /&gt;&lt;br /&gt; // WARNING: using fixed-size buffers and sscanf is utterly unsafe. &lt;br /&gt; // Real implementations must be more robust about data coming from the network!&lt;br /&gt;&lt;br /&gt; sscanf(remote_candidate, "%s %d %s %f %s %s %s\n", ip, &amp;port, protocol, &amp;preference, type, username, password);&lt;br /&gt;&lt;br /&gt; printf("Received new candidate: %s:%d pref %f\n", ip, port, preference);&lt;br /&gt;&lt;br /&gt; Candidate candidate;&lt;br /&gt; candidate.set_name("rtp");&lt;br /&gt; candidate.set_address(SocketAddress(std::string(ip), port));&lt;br /&gt; candidate.set_username(std::string(username));&lt;br /&gt; candidate.set_password(std::string(password));&lt;br /&gt; candidate.set_preference(preference);&lt;br /&gt; candidate.set_protocol(protocol);&lt;br /&gt; candidate.set_type(type);&lt;br /&gt; candidate.set_generation(0);&lt;br /&gt; &lt;br /&gt; candidates.push_back(candidate);&lt;br /&gt;&lt;br /&gt; sc-&gt;getSocketManager()-&gt;AddRemoteCandidates(candidates);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Simple helper function that shows whether a P2P socket is writable (which means that the P2P connection is up).&lt;br /&gt;&lt;br /&gt;bool socketclient_is_writable(SocketClient *sc)&lt;br /&gt;{&lt;br /&gt; return sc-&gt;getSocketManager()-&gt;writable();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Method that is called back when data arrives from the P2P connection. In our example, it is just a byte of data.&lt;br /&gt;&lt;br /&gt;void SignalListener2::OnSocketRead(P2PSocket *socket, const char *data, size_t len)&lt;br /&gt;{&lt;br /&gt; printf("Received byte %d from remote P2P\n", data[0]);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Auxiliary function that sends data via P2P connection. Not really difficult.&lt;br /&gt;&lt;br /&gt;void socketclient_send(SocketClient* sc, const char *data, unsigned int len)&lt;br /&gt;{&lt;br /&gt; sc-&gt;getSocket()-&gt;Send(data, len);&lt;br /&gt; printf("Sent byte %d to remote P2P\n", data[0]);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The signaling server&lt;br /&gt;&lt;br /&gt;As already said, our signaling server is incredibly simple and works more like a network pipe, forwarding data from one side to another. The P2P parties ogree on a P2P connection through this channel.&lt;br /&gt;&lt;br /&gt;from select import select&lt;br /&gt;import socket&lt;br /&gt;import time&lt;br /&gt;&lt;br /&gt;read_socks = []&lt;br /&gt;port = 14141&lt;br /&gt;&lt;br /&gt;server_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  &lt;br /&gt;server_sock.bind(("", port))&lt;br /&gt;server_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)&lt;br /&gt;server_sock.listen(5)&lt;br /&gt;&lt;br /&gt;read_socks.append(server_sock)&lt;br /&gt;&lt;br /&gt;# We accept two parties only&lt;br /&gt;buffer = ""&lt;br /&gt;&lt;br /&gt;while True:&lt;br /&gt; rd, wr_dummy, ex_dummy = select(read_socks, [], [], 10)&lt;br /&gt; &lt;br /&gt; if not rd:&lt;br /&gt;  print "-- tick --"&lt;br /&gt;&lt;br /&gt;  continue&lt;br /&gt;&lt;br /&gt; rd = rd[0]&lt;br /&gt;&lt;br /&gt; if rd is server_sock:&lt;br /&gt;  # incoming new connection&lt;br /&gt;  newsock, address = rd.accept()&lt;br /&gt;  print "New connection from %s" % str(address)&lt;br /&gt;  if len(read_socks) &gt; 3:&lt;br /&gt;   # we only accept two parties at the most&lt;br /&gt;   newsock.close()&lt;br /&gt;   continue&lt;br /&gt;  read_socks.append(newsock)&lt;br /&gt;  if buffer:&lt;br /&gt;   # we already have data to be sent to the new party&lt;br /&gt;   newsock.sendall(buffer)&lt;br /&gt;   print " sent buffered data"&lt;br /&gt;   buffer = ""&lt;br /&gt;  continue&lt;br /&gt;&lt;br /&gt; data = rd.recv(999999)&lt;br /&gt;&lt;br /&gt; if not data:&lt;br /&gt;  # socket closed, remove from list&lt;br /&gt;  print "Connection closed"&lt;br /&gt;&lt;br /&gt;  del read_socks[read_socks.index(rd)]&lt;br /&gt;  buffer = ""&lt;br /&gt;  continue&lt;br /&gt;&lt;br /&gt; if len(read_socks) &lt; 3:&lt;br /&gt;  print "Buffering data"&lt;br /&gt;  # the other party has not connected; bufferize&lt;br /&gt;  buffer += data&lt;br /&gt;  continue&lt;br /&gt;&lt;br /&gt; print "Forwarding data"&lt;br /&gt; for wr in read_socks:&lt;br /&gt;  if wr is not rd and wr is not server_sock:&lt;br /&gt;   wr.sendall(data)&lt;br /&gt;&lt;br /&gt;STUN and relay servers&lt;br /&gt;&lt;br /&gt;The maemo libjingle-utils package includes both a STUN server and a relay server for testing purposes. To run a test server, do the following:&lt;br /&gt;&lt;br /&gt;$ stunserver &amp;&lt;br /&gt;&lt;br /&gt;$ relayserver &amp;&lt;br /&gt;&lt;br /&gt;The relay server will print console messages when a P2P connection is flowing through it. If you need more detailed feedback (e.g. if you are debugging a P2P application), use a network sniffing tool like tcpdump or Ethereal to monitor UDP packets.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-8074972545376827454?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/8074972545376827454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=8074972545376827454' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/8074972545376827454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/8074972545376827454'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2008/05/how-to-use-stun-in-applications.html' title='How to use STUN in applications'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-4830604510249016796</id><published>2008-05-21T07:13:00.000-07:00</published><updated>2008-05-21T07:15:03.883-07:00</updated><title type='text'>reboot linux</title><content type='html'>Context: CentOS 5. Postgresql data directory is locked and cannot reboot the server by $reboot&lt;br /&gt;&lt;br /&gt;Solution:&lt;br /&gt;&lt;br /&gt;$echo 1 &gt; /proc/sys/kernel/sysrq&lt;br /&gt;$echo b &gt; /proc/sysrq-trigger&lt;br /&gt;&lt;br /&gt;Above two commands will reboot the server.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-4830604510249016796?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/4830604510249016796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=4830604510249016796' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/4830604510249016796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/4830604510249016796'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2008/05/reboot-linux.html' title='reboot linux'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-682807546072837297</id><published>2008-04-04T17:55:00.001-07:00</published><updated>2008-04-04T17:55:19.743-07:00</updated><title type='text'>Using NowSMS as an MMSC in CDMA or CDMA2000 Environments</title><content type='html'>Delivering MMSC functionality in an CDMA or CDMA2000 environment can be challenging because the original WAP specifications for CDMA have technical requirements that require additional SMSC functionality.&lt;br /&gt;&lt;br /&gt;(Technical note: CDMA2000 is different from WCDMA. CDMA2000 is an evolutionary upgrade path from CDMA. By contrast, WCDMA is an evolutionary upgrade from GSM/GPRS. CDMA2000 builds upon technical standards already deployed for CDMA, while WCDMA/UMTS builds upon technical standards already deployed for GSM/GPRS.)&lt;br /&gt;&lt;br /&gt;MMS Message Notifications are generally sent via WAP Push over WDP (Wireless Datagram Protocol) over SMS. (It is also possible to deliver WAP Push over WDP over IP, but this is generally not practical unless there is an accessible database lookup for phone number to IP address translation. NowSMS currently can facilitate this IP only scenario, but in a way that is only suitable for test lab environments. This capability is described in a separate technical bulletin, and is outside of the scope of this bulletin.)&lt;br /&gt;&lt;br /&gt;When a WAP Push message is larger than the network size limit for SMS (140 bytes in a GSM environment, and somewhat variable in CDMA environments), the WAP Push message must be segmented to enable it to be sent over multiple SMS messages.&lt;br /&gt;&lt;br /&gt;In GSM environments, User Data Header (UDH) fields have been standardised to support the necessary segmentation, and the UDH parameters for segmentation are well understood and widely supported.&lt;br /&gt;&lt;br /&gt;In CDMA environments, no standard for segmentation exists. Therefore, the WAP Forum defined its own standard for the sending of segmented WDP messages in a CDMA environment.&lt;br /&gt;&lt;br /&gt;A key requirement of this standard is that each segment of the message must use the same CDMA SMS message id. However, the CDMA SMS message id field is a value that is generated by the SMSC, and cannot be set by an application that is submitting messages to the SMSC, such as an MMSC or WAP Push Proxy Gateway.&lt;br /&gt;&lt;br /&gt;The authors of the WAP specification anticipated this limitation and defined a standard for WDP Adaptation over SMPP (WAP-159-WDPWCMPAdapt).&lt;br /&gt;&lt;br /&gt;By default, NowSMS generates WAP Push messages (and MMS Notification messages which are based upon WAP Push) using a format that is specific to GSM (and WCDMA/UMTS) environments. However, there is also a configuration option defined on the "Advanced Settings" page of the SMPP configuration properties titled "Use WDP Adaptation for WAP Push and MMS Notifications (required for CDMA)". This setting is primarily used when connecting to a CDMA based SMSC. When this configuration option is enabled, NowSMS uses a protocol independent format known as "WDP Adaptation". This is usually the only practical option for delivering WAP Push messages in a CDMA environment. In this case, NowSMS will submit messages to the SMPP server using the "WAP" teleservice (SMPP service type), consistent with the WDP and WCMP Adaptation specification.&lt;br /&gt;&lt;br /&gt;By default, even if a WAP push message is longer than 140 bytes, when this option is selected, NowSMS will deliver the complete message in a single submission to the SMSC. NowSMS then expects the SMSC to perform any necessary segmentation for delivering the message over SMS. (This expectation exists because the SMSC must use the same CDMA SMS message id for each segment of the message, and there is no place in the SMPP protocol for NowSMS to specify this message id.)&lt;br /&gt;&lt;br /&gt;It is also possible to configure NowSMS to use segmentation for longer messages, even if WDP Adaptation is enabled by checking the "Use TLV parameters for port numbers and segmentation" option. In this case, NowSMS segments on a 140 byte boundary, the same as in GSM environments.&lt;br /&gt;&lt;br /&gt;When configuring NowSMS in CDMA environments, segmentation issues are usually the biggest problem, because of the WAP protocol requirement that the SMSC use the same CDMA SMS message id for each segment of the message.&lt;br /&gt;&lt;br /&gt;If you experience problems sending WAP Push and/or MMS notifications in a CDMA environment with WDP Adaptation, here are some suggestions:&lt;br /&gt;WDP Adaptation (WAP-159-WDPWCMPAdapt). If you are connecting via an independent SMS provider, it is likely that they are not aware of this protocol option, but it is likely to be supported by the CDMA operator's SMSC.&lt;br /&gt;&lt;br /&gt;Instead of troubleshooting by sending MMS messages, try sending simple WAP push messages first. Send a simple WAP push message via the NowSMS web interface (page 82), keeping the URL and text relatively short to ensure that the message can be delivered in a single segment. If that works, next try increasing the amount of text in the message. If the message delivery fails with longer WAP push messages, then you will want to take steps to limit the size of MMS notification messages that are generated by the NowSMS MMSC. This can be accomplished with the following suggestions:&lt;br /&gt;&lt;br /&gt;   1. Use the shortest possible host name (in number of characters) for the "Local Host Name or IP Address" setting of the MMSC. This host name must be included in the every MMS Notification that is generated by the MMSC. Every byte saved in the host name saves a byte in the size of the resulting notification messages.&lt;br /&gt;   2. If possible, use Port 80 as the "HTTP Port" for the MMSC. If a port other than port 80 is used, it must be appended to the host name when generating the URL.&lt;br /&gt;   3. Edit MMSC.INI, and under the [MMSC] header, add CompactMMSURL=Yes. This setting shortens the length of the dynamic path that is generated when sending MMS messages and will save a few bytes in every MMS notification with no other effect.&lt;br /&gt;   4. Edit MMSC.INI, and under the [MMSC] header, add MMSNotificationNoSubject=Yes. By default, NowSMS will include the message subject in the MMS Notification message. Having the subject present can help someone who has a mobile phone configured for manual message download to determine whether or not they want to download the message. However, the specification does not require the subject to be present in the notification, and omitting it can prevent long MMS notifications.&lt;br /&gt;   5. Edit MMSC.INI, and under the [MMSC] header, add Nokia3510Compatible=No. This setting reduces the size of the MMS notification by approximately 30 bytes, at the expense of compatibility with early model GSM MMS phones (specifically the original Nokia 3510 and Panasonic GD87). These phones did not understand the short form of MMS content type encoding in the MMS header, and required the long form. The MMS specifications do require that the handsets support the short form of this encoding, and technically these early model handsets were non-conformant. While GSM operators may want to maintain compatibility with these early model handsets, this should not be a consideration in CDMA environments.&lt;br /&gt;&lt;br /&gt;NowSMS 2006 has also been extended to provide extensions to the HTTP SMSC interface to facilitate MMS and WAP Push in CDMA environments. This functionality is intended primarily for test lab environments (specifically with Agilent's CDMA test kit), but might also be useful for mobile operators whose SMSCs do not support WDP Adaptation.&lt;br /&gt;&lt;br /&gt;To enable this support, define an HTTP SMSC connection in NowSMS as normal.&lt;br /&gt;&lt;br /&gt;Next, manually edit the SMSGW.INI, and locate the [HTTP – server:port] section for this HTTP SMSC connection. Under this header, add CDMATemplateWAP=, where this is a URL template to be used for submitting WAP Push messages (MMS notifications are a special type of WAP Push). This URL template is similar to the existing text and binary templates, however you should use the @@CDMAWAPPDU@@ replacement parameter for NowSMS to insert the WAP PDU in CDMA format. (Do not use the @@TEXT@@, @@DATA@@, @@DATABIN@@ or @@UDH@@ parameters!)&lt;br /&gt;&lt;br /&gt;By default, NowSMS will segment the CDMA WAP PDU to a size limit of 112 bytes, and issue multiple HTTP requests to submit the message in multiple segments. To change this size limit, specify CDMASizeLimit=### in the same section of the SMSGW.INI file.&lt;br /&gt;&lt;br /&gt;An additional replacement parameter, @@CDMAWAPMMTS@@ is available. This parameter will be set to "1" for all segments except the final segment in a multiple segment WAP Push submission. This parameter will be set to "0" in a single segment WAP Push submission, and also in the final segment of a multiple segment WAP Push submission. ("MMTS" stands for "more messages to send", and is used to indicate that an additional segment will follow. This is necessary because in CDMA, the SMSC must apply the same MESSAGE_ID value to all segments of a multiple segment message.)&lt;br /&gt;&lt;br /&gt;If the HTTP SMSC does not support the MMTS flag, then you should follow the advice that was given earlier in this bulletin regarding how to limit the size of the MMS Notification message.&lt;br /&gt;&lt;br /&gt;Additionally, ensure that the URL template sets whatever flag is necessary to indicate that the CDMA WAP teleservice should be used.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-682807546072837297?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/682807546072837297/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=682807546072837297' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/682807546072837297'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/682807546072837297'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2008/04/using-nowsms-as-mmsc-in-cdma-or.html' title='Using NowSMS as an MMSC in CDMA or CDMA2000 Environments'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-4945653434900511290</id><published>2008-04-01T07:26:00.000-07:00</published><updated>2008-04-04T07:08:59.577-07:00</updated><title type='text'>make Nokia phone E65 as modem for SMS</title><content type='html'>(1)Mac/E65&lt;br /&gt;(2)Bluetooth connectivity &lt;br /&gt;(3)minicom installed on Mac&lt;br /&gt;(4)bluetooth standard provides modem interface. So, Making starting bluetooth makes modem available. The serial port is under /dev/tty....(Computer name)&lt;br /&gt;(5)$minicom -s &lt;br /&gt;setup the modem and save as "e65". Then minirc.e65 will be saved. &lt;br /&gt;(6)$minicom e65, which will connect to E65 phone.&lt;br /&gt;(7)Type AT commands, the phone will response properly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-4945653434900511290?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/4945653434900511290/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=4945653434900511290' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/4945653434900511290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/4945653434900511290'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2008/04/make-nokia-phone-e65-as-modem-for-sms.html' title='make Nokia phone E65 as modem for SMS'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-5213318294556124840</id><published>2008-04-01T06:46:00.000-07:00</published><updated>2008-04-01T06:50:05.870-07:00</updated><title type='text'>pys60 TCP/IP console</title><content type='html'>(1)Mac/E65/Wireless router&lt;br /&gt;(2)Mac IP : 192.168.1.64&lt;br /&gt;(3)on Mac run: $stty raw -echo ; nc -l -p 1025; stty sane&lt;br /&gt;(4)vi btc.py file with following codes:&lt;br /&gt;import btconsole&lt;br /&gt;from socket import *&lt;br /&gt;sock=socket(AF_INET, SOCK_STREAM)&lt;br /&gt;sock.connect(("192.168.1.64",1025))&lt;br /&gt;btconsole.run_with_redirected_io(sock,btconsole.interact,None,None,locals())&lt;br /&gt;sock.close()&lt;br /&gt;&lt;br /&gt;(5)bluetooth btc.py to E:\\Python folder on E65&lt;br /&gt;(6)Run btc.py through pys60 shell. It will search Mac and connect to Mac console.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-5213318294556124840?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/5213318294556124840/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=5213318294556124840' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/5213318294556124840'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/5213318294556124840'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2008/04/pys60-tcpip-console.html' title='pys60 TCP/IP console'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-1362320771657469410</id><published>2007-12-08T00:03:00.000-08:00</published><updated>2007-12-08T00:15:19.447-08:00</updated><title type='text'>javascript removeChild crash IE</title><content type='html'>A web page load a gwt specific javascript file (entry point).&lt;br /&gt;&lt;br /&gt;This javascript insert a javascript (A) dynamically to invoke JSON service.&lt;br /&gt;The callback of the JSON will delete the dynamically inserted javascript (A) for house cleaning.&lt;br /&gt;&lt;br /&gt;Above "Inserting A and deleting A" will be repeated each 5 seconds. &lt;br /&gt;&lt;br /&gt;To removeScript, following code will crash IE.&lt;br /&gt;&lt;blockquote&gt;        var x =document.getElementsByTagName("script");&lt;br /&gt;        for (var i=0;i&lt;x.length;i++){&lt;br /&gt;           var y=x[i];&lt;br /&gt;           var src = y.getAttribute("src");&lt;br /&gt;           if(src!=null &amp;&amp; src.indexOf("callback")&gt;0){&lt;br /&gt;               var head = document.getElementsByTagName('head').item(0);&lt;br /&gt;               head.removeChild(y);&lt;br /&gt;               y.removeNode();&lt;br /&gt;               return;&lt;br /&gt;           }&lt;br /&gt;        }&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;However, following code will work:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;        setTimeout(function() {&lt;br /&gt;        var x =document.getElementsByTagName("script");&lt;br /&gt;        for (var i=0;i&lt;x.length;i++){&lt;br /&gt;           var y=x[i];&lt;br /&gt;           var src = y.getAttribute("src");&lt;br /&gt;           if(src!=null &amp;&amp; src.indexOf("callback")&gt;0){&lt;br /&gt;               var head = document.getElementsByTagName('head').item(0);&lt;br /&gt;               head.removeChild(y);&lt;br /&gt;               y.removeNode();&lt;br /&gt;               return;&lt;br /&gt;           }&lt;br /&gt;        }&lt;br /&gt;         }, 0);&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-1362320771657469410?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/1362320771657469410/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=1362320771657469410' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/1362320771657469410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/1362320771657469410'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/12/javascript-removechild-crash-ie.html' title='javascript removeChild crash IE'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-2872267782739456302</id><published>2007-11-20T19:25:00.000-08:00</published><updated>2007-11-20T19:29:20.923-08:00</updated><title type='text'>Howto: Setup a DNS server with bind</title><content type='html'>Step1: Install bind 9&lt;br /&gt;Step2: vi /etc/bind/named.conf.local&lt;br /&gt;# This is the zone definition. replace example.com with your domain name&lt;br /&gt;zone "example.com" {&lt;br /&gt;        type master;&lt;br /&gt;        file "/etc/bind/zones/example.com.db";&lt;br /&gt;        };&lt;br /&gt;&lt;br /&gt;# This is the zone definition for reverse DNS. replace 0.168.192 with your network address in reverse notation - e.g my network address is 192.168.0&lt;br /&gt;zone "0.168.192.in-addr.arpa" {&lt;br /&gt;     type master;&lt;br /&gt;     file "/etc/bind/zones/rev.0.168.192.in-addr.arpa";&lt;br /&gt;};&lt;br /&gt;And named.conf.local to named.conf&lt;br /&gt;Step3:vi /etc/bind/named.conf.options&lt;br /&gt;forwarders {&lt;br /&gt;      # Replace the address below with the address of your provider's DNS server&lt;br /&gt;      123.123.123.123;&lt;br /&gt;};&lt;br /&gt;Step4:mkdir /etc/bind/zones&lt;br /&gt;Step5:vi /etc/bind/zones/example.com.db&lt;br /&gt;// replace example.com with your domain name. do not forget the . after the domain name!&lt;br /&gt;// Also, replace ns1 with the name of your DNS server&lt;br /&gt;example.com.      IN      SOA     ns1.example.com. admin.example.com. (&lt;br /&gt;// Do not modify the following lines!&lt;br /&gt;                                                        2006081401&lt;br /&gt;                                                        28800&lt;br /&gt;                                                        3600&lt;br /&gt;                                                        604800&lt;br /&gt;                                                        38400&lt;br /&gt; )&lt;br /&gt;&lt;br /&gt;// Replace the following line as necessary:&lt;br /&gt;// ns1 = DNS Server name&lt;br /&gt;// mta = mail server name&lt;br /&gt;// example.com = domain name&lt;br /&gt;example.com.      IN      NS              ns1.example.com.&lt;br /&gt;example.com.      IN      MX     10       mta.example.com.&lt;br /&gt;&lt;br /&gt;// Replace the IP address with the right IP addresses.&lt;br /&gt;www              IN      A       192.168.0.2&lt;br /&gt;mta              IN      A       192.168.0.3&lt;br /&gt;ns1              IN      A       192.168.0.1&lt;br /&gt;Step6: vi /etc/bind/zones/rev.0.168.192.in-addr.arpa&lt;br /&gt;@ IN SOA ns1.example.com. admin.example.com. (&lt;br /&gt;                        2006081401;&lt;br /&gt;                        28800; &lt;br /&gt;                        604800;&lt;br /&gt;                        604800;&lt;br /&gt;                        86400 &lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;                     IN    NS     ns1.example.com.&lt;br /&gt;1                    IN    PTR    example.com&lt;br /&gt;Step7: /etc/init.d/bind9 restart&lt;br /&gt;Step8: change /etc/resolv.conf &lt;br /&gt;search example.com&lt;br /&gt;nameserver 192.168.0.1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-2872267782739456302?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/2872267782739456302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=2872267782739456302' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/2872267782739456302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/2872267782739456302'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/11/howto-setup-dns-server-with-bind.html' title='Howto: Setup a DNS server with bind'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-9063163405134443168</id><published>2007-11-02T22:46:00.000-07:00</published><updated>2007-11-02T22:47:15.970-07:00</updated><title type='text'>centos 5 iptables configure</title><content type='html'>$yum install system-config-securitylevel&lt;br /&gt;$system-config-securitylevel&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-9063163405134443168?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/9063163405134443168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=9063163405134443168' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/9063163405134443168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/9063163405134443168'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/11/centos-5-iptables-configure.html' title='centos 5 iptables configure'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-4278912916817292883</id><published>2007-10-30T08:11:00.000-07:00</published><updated>2007-10-30T08:18:18.198-07:00</updated><title type='text'>asterisk 1.4 on centos 5 "inode diet"</title><content type='html'>/*&lt;br /&gt; * As part of the "inode diet" the private data member of struct inode&lt;br /&gt; * has changed in 2.6.19. However, Fedore Core 6 adopted this change&lt;br /&gt; * a bit earlier (2.6.18). If you use such a kernel, Change the &lt;br /&gt; * following test from 2,6,19 to 2,6,18.&lt;br /&gt; */&lt;br /&gt;#if LINUX_VERSION_CODE &lt; KERNEL_VERSION(2,6,18)&lt;br /&gt;#define I_PRIVATE(inode)        ((inode)-&gt;u.generic_ip)&lt;br /&gt;#else&lt;br /&gt;#define I_PRIVATE(inode)        ((inode)-&gt;i_private)&lt;br /&gt;#endif&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-4278912916817292883?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/4278912916817292883/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=4278912916817292883' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/4278912916817292883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/4278912916817292883'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/10/asterisk-14-on-centos-5-inode-diet.html' title='asterisk 1.4 on centos 5 &quot;inode diet&quot;'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-8640223841774245100</id><published>2007-10-19T07:48:00.000-07:00</published><updated>2007-10-19T07:50:38.654-07:00</updated><title type='text'>Remote UNIX connection(disconnected) and asterisk</title><content type='html'>On CLI which is under verbose output, following message will be generated every 5 seconds.&lt;br /&gt;&lt;br /&gt;It is due to safe_asterisk process, which itself is invoked by asterisk service, that kept connecting!&lt;br /&gt;&lt;br /&gt;&gt; &gt; -- Remote UNIX connection&lt;br /&gt;&gt; &gt; -- Remote UNIX connection disconnected&lt;br /&gt;&gt; &gt; -- Remote UNIX connection&lt;br /&gt;&gt; &gt; -- Remote UNIX connection disconnected&lt;br /&gt;&gt; &gt; -- Remote UNIX connection&lt;br /&gt;&gt; &gt; -- Remote UNIX connection disconnected&lt;br /&gt;&gt; &gt; -- Remote UNIX connection&lt;br /&gt;&gt; &gt; -- Remote UNIX connection disconnected&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-8640223841774245100?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/8640223841774245100/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=8640223841774245100' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/8640223841774245100'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/8640223841774245100'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/10/remote-unix-connectiondisconnected-and.html' title='Remote UNIX connection(disconnected) and asterisk'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-3735241470137005637</id><published>2007-10-13T18:36:00.000-07:00</published><updated>2007-10-13T18:37:05.496-07:00</updated><title type='text'>gcc: installation problem, cannot exec `cc1plus': No such file or directory</title><content type='html'>$yum install gcc-c++&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-3735241470137005637?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/3735241470137005637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=3735241470137005637' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/3735241470137005637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/3735241470137005637'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/10/gcc-installation-problem-cannot-exec.html' title='gcc: installation problem, cannot exec `cc1plus&apos;: No such file or directory'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-6617603759583763067</id><published>2007-10-10T07:41:00.000-07:00</published><updated>2007-10-10T07:42:07.230-07:00</updated><title type='text'>list bios information on linux</title><content type='html'>$dmidecode &lt;br /&gt;&lt;br /&gt;dmidecode  is a tool for dumping a computer’s DMI (some say SMBIOS) table contents in a human-readable format&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-6617603759583763067?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/6617603759583763067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=6617603759583763067' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/6617603759583763067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/6617603759583763067'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/10/list-bios-information-on-linux.html' title='list bios information on linux'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-2986215386466795810</id><published>2007-10-10T07:15:00.001-07:00</published><updated>2007-10-10T07:15:53.527-07:00</updated><title type='text'>pci device profile</title><content type='html'>On linux, &lt;br /&gt;&lt;br /&gt;$lspci -tv show the tree map of the pci device&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-2986215386466795810?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/2986215386466795810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=2986215386466795810' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/2986215386466795810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/2986215386466795810'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/10/pci-device-profile.html' title='pci device profile'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-2834600092287104499</id><published>2007-10-08T06:43:00.000-07:00</published><updated>2007-10-08T06:45:10.876-07:00</updated><title type='text'>Simple Linux network traffic monitor</title><content type='html'>vnStat is a network traffic monitor for Linux that keeps a log of daily network traffic for the selected interface(s). vnStat isn't a packet sniffer. The traffic information is analyzed from the /proc -filesystem, so vnStat can be used without root permissions. &lt;br /&gt;&lt;br /&gt;$vnstat -tr&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-2834600092287104499?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/2834600092287104499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=2834600092287104499' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/2834600092287104499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/2834600092287104499'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/10/simple-linux-network-traffic-monitor.html' title='Simple Linux network traffic monitor'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-644785723413328455</id><published>2007-08-17T01:27:00.000-07:00</published><updated>2007-08-17T01:28:16.147-07:00</updated><title type='text'>Resolving Maven Dependency Conflicts</title><content type='html'>Resolving Dependency Conflicts:&lt;br /&gt;&lt;br /&gt;Using maven, it is inevitable that two or more artifacts will require different versions of a particular dependency.&lt;br /&gt;To manually resolve conflicts, following steps give very useful information:&lt;br /&gt;(1) build the top level deployment by using:&lt;br /&gt;$mvn -o -X test&lt;br /&gt;this command will list all dependence information.&lt;br /&gt;(2)grep the output of step (1) and remove the [DEBUG]     at the beginning of each line&lt;br /&gt;(3)sort the output of step (2), then you can find out easily the version conflicts.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-644785723413328455?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/644785723413328455/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=644785723413328455' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/644785723413328455'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/644785723413328455'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/08/resolving-maven-dependency-conflicts.html' title='Resolving Maven Dependency Conflicts'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-6118907849398421813</id><published>2007-08-04T08:22:00.000-07:00</published><updated>2007-10-19T07:52:09.421-07:00</updated><title type='text'>how to automate postgresql maintainence</title><content type='html'>Assume that postgresql is installed in /usr/local/pgsql directory.&lt;br /&gt;&lt;br /&gt;$crontab -e&lt;br /&gt;22 3 * * * su - postgres -c "/usr/local/pgsql/bin/vacuumdb -a -f" &gt;&gt; /var/log/vacuumdb.log 2&gt;&amp;1&lt;br /&gt;23 3 * * * su - postgres -c "/usr/local/pgsql/bin/pg_dump -Fc -b -f /tmp/db.sql db" &gt; /var/log/dump.log 2&gt;&amp;1&lt;br /&gt;&lt;br /&gt;and then save like under vi editor.&lt;br /&gt;&lt;br /&gt;$crontab -l &lt;br /&gt;to list the task&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-6118907849398421813?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/6118907849398421813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=6118907849398421813' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/6118907849398421813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/6118907849398421813'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/08/how-to-automate-postgresql-maintainence.html' title='how to automate postgresql maintainence'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-9197933967080504513</id><published>2007-08-03T09:50:00.001-07:00</published><updated>2007-08-03T09:50:53.222-07:00</updated><title type='text'>How to Change the Timezone in Linux</title><content type='html'>1. Logged in as root, check which timezone your machine is currently using by executing `date`. You'll see something like "Mon 17 Jan 2005 12:15:08 PM PST -0.461203 seconds", PST in this case is the current timezone.&lt;br /&gt;   2. Change to the directory /usr/share/zoneinfo, here you will find a list of time zone regions. Choose the most appropriate region, if you live in Canada or the US this directory is the "Americas" directory.&lt;br /&gt;   3. If you wish, backup the previous timezone configuration by copying it to a different location. Such as `mv /etc/localtime /etc/localtime-old`.&lt;br /&gt;   4. Create a symbolic link from the appropiate timezone to /etc/localtime. Example: `ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime`.&lt;br /&gt;   5. If you have the utility rdate, update the current system time by executing `/usr/bin/rdate -s time.nist.gov`.&lt;br /&gt;   6. Set the ZONE entry in the file /etc/sysconfig/clock file (e.g. "America/Los_Angeles")&lt;br /&gt;   7. Set the hardware clock by executing: `/sbin/hwclock --systohc`&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-9197933967080504513?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/9197933967080504513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=9197933967080504513' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/9197933967080504513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/9197933967080504513'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/08/how-to-change-timezone-in-linux.html' title='How to Change the Timezone in Linux'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-6799959342871502019</id><published>2007-08-03T01:37:00.000-07:00</published><updated>2007-08-03T01:39:58.750-07:00</updated><title type='text'>How to resolve permission issues when you move a database between servers that are running SQL Server</title><content type='html'>MORE INFORMATION&lt;br /&gt;When you move a database from one server that is running SQL Server to another server that is running SQL Server, a mismatch may occur between the security identification numbers (SIDs) of the logins in the master database and the users in the user database. By default, SQL Server 7.0, SQL Server 2000, and SQL Server 2005 provide the sp_change_users_login system stored procedure to map these mismatched users. However, you can only use the sp_change_users_login stored procedure to map standard SQL Server logins and you must perform these mapping for one user at a time. For more information about the sp_change_users_login stored procedure, see the "sp_change_users_login" topic in SQL Server 7.0,SQL Server 2000, and SQL Server 2005 Books Online.&lt;br /&gt;&lt;br /&gt;Solution:&lt;br /&gt;&lt;br /&gt;Under a specific database name, remove the user. But if there are schemas defined by the user/owner, you cannot delete the user from the security menu (studio). So, you need to change the owner to dbo first. And then you can delete the owner. then recreate the owner/user again.  Finally, change back the schema ownership&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-6799959342871502019?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/6799959342871502019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=6799959342871502019' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/6799959342871502019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/6799959342871502019'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/08/how-to-resolve-permission-issues-when.html' title='How to resolve permission issues when you move a database between servers that are running SQL Server'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-1653994357972282244</id><published>2007-07-25T01:31:00.000-07:00</published><updated>2007-07-25T01:32:43.076-07:00</updated><title type='text'>how to explicit values to be inserted into the identity column of a table.</title><content type='html'>Two conditions are needed:&lt;br /&gt;&lt;br /&gt;1) set identity insert to ON:&lt;br /&gt;&lt;br /&gt;SET IDENTITY_INSERT db1.dbo.table1 ON&lt;br /&gt;&lt;br /&gt;2) specify column list, for example:&lt;br /&gt;INSERT INTO&lt;br /&gt;DB1.dbo.TABLE (column1, column2, column3)&lt;br /&gt;SELECT column1, column2, column3&lt;br /&gt;FROM dbo.TABLE1&lt;br /&gt;dbo.TABLE2 ON dbo.TABLE1.column = dbo.TABLE2.column&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-1653994357972282244?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/1653994357972282244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=1653994357972282244' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/1653994357972282244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/1653994357972282244'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/07/how-to-explicit-values-to-be-inserted.html' title='how to explicit values to be inserted into the identity column of a table.'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-1580371577857010903</id><published>2007-07-06T00:34:00.001-07:00</published><updated>2007-07-06T00:34:27.998-07:00</updated><title type='text'>optimize postgresql</title><content type='html'>Optimizing Postgresql&lt;br /&gt;Ericson Smith&lt;br /&gt;Following Tim Perdue's excellent article on the comparison between MySQL and Postgresql, I decided to take a shot at installing and using this database. For most of our work I use MySQL and will continue to do so, because of its ease of use and unrivaled select query speed, and also because there is no point in trying to mess around with production systems that already work fine.&lt;br /&gt;But some new projects suffered greatly from MySQL's table locking feature when I needed to update data (which I do a lot). Here are my adventures in setting up a Postgresql database server.&lt;br /&gt;Our configuration for a dedicated Postgresql server was:&lt;br /&gt;&lt;br /&gt;    * Redhat 7.1&lt;br /&gt;    * Dual PIII 650Mhz System&lt;br /&gt;    * 512MB RAM&lt;br /&gt;    * 18Gig SCSI drive for the postgresql data partition&lt;br /&gt;&lt;br /&gt;Downloading and Installing&lt;br /&gt;I downloaded and installed the 7.1.2 RPM's from http://postgres.org without any trouble. For a server installation, I only installed: postgresql-server and postgresql-7.1.2 (base).&lt;br /&gt;I then started the server up and running by executing:&lt;br /&gt;/etc/init.d/postgresql start&lt;br /&gt;A small sized database was ported from MySQL (three tables totaling about 5000 records). I created sufficient indexes for postgresql's optimizer to use, and modified our C application to use the postgresql C client interface for a small CGI program that would brutally query this table. This small CGI program receives thousands of queries per minute.&lt;br /&gt;Optimizing&lt;br /&gt;One of the first things I noticed after turning on the CGI program, was that although queries were returned almost as fast as from the previous MySQL based system, the load on the server was much higher -- in fact almost 90-percent! Then I started to go down into the nitty-gritty of things. I had optimized MySQL before by greatly increasing cache and buffer sizes and by throwing more ram towards the problem.&lt;br /&gt;The single biggest thing that you have to do before running Postgresql, is to provide enough shared buffer space. Let me repeat: provide enough buffer space! Let's say you have about 512MB of ram on a dedicated database server, then you need to turn over about 75-percent of it to this shared buffer. Postgresql does best when it can load most or -- even better -- all of a table into its shared memory space. In our case, since our database was fairly small, I decided to allocate 128MB of RAM towards the shared buffer space.&lt;br /&gt;The file /var/lib/pgsql/data/postgresql.conf contains settings for the database server. Postgresql uses system shared memory as a buffer. On a Linux system, you can see how much shared memory was allocated by your system by running the command:&lt;br /&gt;cat /proc/sys/kernel/shmmax&lt;br /&gt;And to view shared memory use on the system:&lt;br /&gt;ipcs&lt;br /&gt;The result will be in bytes. By default RedHat 7.1 allocates 32MB of shared memory, hardly enough for postgresql. I increased this limit to 128MB by doing the command:&lt;br /&gt;echo 128000000 &gt; /proc/sys/kernel/shmmax&lt;br /&gt;Be aware that once you reboot the server, this setting will disappear. You need to place this line in your postgresql startup file, or by editing the /etc/sysctl.conf file for a more permanent setting.&lt;br /&gt;Then in our postgresql.conf I set shared_buffers to 15200. Because Postgresql uses 8K segments, I made a calculation of 128000/8192 plus a 512K overhead. I also set our sort_mem to 32168 (32Megs for a sort memory area). Since connection pooling was in effect, I set max_connections to 64. And fsync was also set to false.&lt;br /&gt;&lt;br /&gt;shared_buffers = 15200&lt;br /&gt;sort_mem = 32168&lt;br /&gt;max_connections=64&lt;br /&gt;fsync=false&lt;br /&gt;&lt;br /&gt;You can read the manual to tweak other settings, but I never had the need to do so. Note that if you set shared_buffers to more than what your shared memory limit is, postgresql will refuse to start. This confused us for a while, since no logging was taking place. You can tweak the startup file in /etc/init.d for the postmaster to write its output to a log file. Change the fragment from:&lt;br /&gt;&lt;br /&gt;/postmaster start &gt; /dev/null 2&gt;&lt;br /&gt;&lt;br /&gt;to&lt;br /&gt;&lt;br /&gt;/postmaster start &gt; /var/lib/pgsql.log 2&gt;&lt;br /&gt;&lt;br /&gt;(or wherever you want to store the log.)&lt;br /&gt;Tailing the log file clearly explained what the problem was.&lt;br /&gt;All sorts of sexy debugging info will show up in this file, which includes SQL syntax errors, the output of EXPLAIN state, emts, connection problems, authentication attempts, and so forth.&lt;br /&gt;I restarted postgresql and brought our CGI online. Our jaws collectively dropped to the floor as postgresql literally flew as soon as it started to use the buffer. Server load by postgresql dropped to just under 10-percent.&lt;br /&gt;One hitch I found with an early version of the system was that it had to build up and tear down a postgresql connection with each request. This was intolerable, so I started to use the connection pooling features of the C library. Server load dropped another few notches with this option. With PHP you will want to use persistent connections (pg_pconnect instead of pg_connect) to fully take advantage of this effect.&lt;br /&gt;Indexes&lt;br /&gt;I cannot emphasize enough the need to have proper indexing in postgresql. One early mistake that I made was to index BIGINT columns. The columns were indexed ok, but postgresql refused to make use them. After two days of tearing out my hair, it came to me that the architecture of the system was 32 bits. Could it be that postgresql refuses to make use of a 64 bit (BIGINT) index? Changing the type to INTEGER quickly solved that problem. Maybe if I had one of those new-fangled 64 bit Itanium processors.&lt;br /&gt;Conclusion&lt;br /&gt;There are many things that you can do with your SQL statements to also improve query response, but these are adequately covered in the interactive postgresql documentation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-1580371577857010903?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/1580371577857010903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=1580371577857010903' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/1580371577857010903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/1580371577857010903'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/07/optimize-postgresql_06.html' title='optimize postgresql'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-2622183091290128028</id><published>2007-07-06T00:25:00.001-07:00</published><updated>2007-07-06T00:25:34.992-07:00</updated><title type='text'>optimize postgresql</title><content type='html'>optimize postgresql server by three things:&lt;br /&gt;&lt;br /&gt;(1)change the max number of file descriptors to 10,000 per process&lt;br /&gt;adding:&lt;br /&gt;* soft nofile 10240&lt;br /&gt;* hard nofile 20000&lt;br /&gt;&lt;br /&gt;into /etc/security/limits.conf file&lt;br /&gt;(2)change linux kernel shared memory to 400M.&lt;br /&gt;adding: kernel.shmmax=400000000 into file /etc/sysctl.conf file and reboot the server&lt;br /&gt;&lt;br /&gt;(3)change postgresql.conf file to modify the shared buffer space to 300M.&lt;br /&gt;&lt;br /&gt;max connection still keep to 100. It should be enough.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-2622183091290128028?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/2622183091290128028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=2622183091290128028' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/2622183091290128028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/2622183091290128028'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/07/optimize-postgresql.html' title='optimize postgresql'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-6805961508866793879</id><published>2007-06-29T05:44:00.000-07:00</published><updated>2007-06-29T05:46:08.042-07:00</updated><title type='text'>sync openvz vps zone with hardware node</title><content type='html'>I am using Singapore time.&lt;br /&gt;&lt;br /&gt;Login into vps,&lt;br /&gt;&lt;br /&gt;and  run &lt;br /&gt;&lt;br /&gt;#ln -sf /etc/localtime /usr/share/zoneinfo/Asia/Singapore&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-6805961508866793879?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/6805961508866793879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=6805961508866793879' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/6805961508866793879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/6805961508866793879'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/06/sync-openvz-vps-zone-with-hardware-node.html' title='sync openvz vps zone with hardware node'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-5606610896969217729</id><published>2007-06-28T02:46:00.000-07:00</published><updated>2007-06-28T02:47:17.631-07:00</updated><title type='text'>java outofmemory in linux</title><content type='html'>Debian is a stable easy to maintain platform for Java Web Applications. However if you start using some caching frameworks, you may need to do some JVM tuning and here's the information you need to know.&lt;br /&gt;&lt;br /&gt;Read this and to the point where you understand that a 32-process on Linux only has 2GB of addressible space. In fact, back in 1999, Linus decreed that 32-bit Linux would never, ever support more than 2GB of memory. "This is not negotiable."&lt;br /&gt;&lt;br /&gt;Stacks are memory chunks used for saving variables and passing parameters when calling functions. It's a low level implementation detail, but the important thing to know is that each thread in each process must have it's own stack. Big stacks add up quickly as in the case of tomcat and most web servers where many threads are used to serve requests. Stacks for threads all come out of the same address space, so if you only used memory for stacks of threads you could have 1024 threads with 2MB stacks. In fact in Debian Sarge, there is no way to reduce the amount of memory allocated for the stack of a thread. [1] [2] [3]. Understand that this is not java specific, the same limitation applies to c programs.&lt;br /&gt;&lt;br /&gt;Now that we have some fundamental stuff down, it's easy from here. Say you have 2G of Memory and want to use as much memory as possible for your cash for performance considerations. The objects in the cash will be stored in the heap memory. I think you should calculate how much memory you should use with the following formula.&lt;br /&gt;&lt;br /&gt;HeapMemory = ProcessAdressSpace - ThreadMemory - PermGen - JVM&lt;br /&gt;&lt;br /&gt;If you're running 32-bit, you can only see 2G max.&lt;br /&gt;&lt;br /&gt;ProcessAdressSpace = 2G&lt;br /&gt;&lt;br /&gt;If you web app is like mine, you'll need 100 threads. Have some librarys that may create threads, tack on another 100 to be safe. 200 threads X 2Mb/Thread = 400M&lt;br /&gt;&lt;br /&gt;ThreadMemory = 400M&lt;br /&gt;&lt;br /&gt;PermGen is where your defined classes go. Since you use alot of frameworks and have lots of classes, you should set this to 128M&lt;br /&gt;&lt;br /&gt;PermGen = 128M&lt;br /&gt;&lt;br /&gt;JVM is relatively small, but you need to give it room so that it can work quickly.&lt;br /&gt;&lt;br /&gt;JVM = 256M&lt;br /&gt;&lt;br /&gt;With those parameters, HeapMemory should not exceed 1264M! Anything more and you're going to slow down your application more than the cache is speeding it up, or you'll introduce nasty a OutOfMemoryException that will drive you crazy. Here's the parameters you want to use.&lt;br /&gt;&lt;br /&gt;java -Xmx1264M -XX:MaxPermSize=128m ...&lt;br /&gt;&lt;br /&gt;If you upgrade to etch, and set the stack size to 1MB (not recommending without extensive testing), then you can reclaim another 200MB for the heap.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-5606610896969217729?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/5606610896969217729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=5606610896969217729' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/5606610896969217729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/5606610896969217729'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/06/java-outofmemory-in-linux.html' title='java outofmemory in linux'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-165464575159114392</id><published>2007-06-23T03:03:00.001-07:00</published><updated>2007-06-23T03:03:26.474-07:00</updated><title type='text'>safe_asterisk</title><content type='html'>#!/bin/bash&lt;br /&gt;&lt;br /&gt;ulimit -c unlimited&lt;br /&gt;&lt;br /&gt;run_asterisk()&lt;br /&gt;{&lt;br /&gt;        while :; do&lt;br /&gt;                cd /tmp&lt;br /&gt;                /usr/sbin/asterisk -c  &gt;&amp; /dev/null &lt; /dev/null&lt;br /&gt;                echo "Automatically restarting Asterisk."&lt;br /&gt;                sleep 4&lt;br /&gt;        done&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;run_asterisk &amp;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-165464575159114392?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/165464575159114392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=165464575159114392' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/165464575159114392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/165464575159114392'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/06/safeasterisk.html' title='safe_asterisk'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-8674697336760823524</id><published>2007-06-18T18:30:00.000-07:00</published><updated>2007-06-18T18:35:40.845-07:00</updated><title type='text'>Tuning file descriptor limits on Linux</title><content type='html'>Tuning file descriptor limits on Linux&lt;br /&gt;&lt;br /&gt;Linux limits the number of file descriptors that any one process may open; the default limits are 1024 per process. These limits can prevent optimum performance of both benchmarking clients (such as httperf and apachebench) and of the web servers themselves (Apache is not affected, since it uses a process per connection, but single process web servers such as Zeus use a file descriptor per connection, and so can easily fall foul of the default limit).&lt;br /&gt;&lt;br /&gt;The open file limit is one of the limits that can be tuned with the ulimit command. The command ulimit -aS displays the current limit, and ulimit -aH displays the hard limit (above which the limit cannot be increased without tuning kernel parameters in /proc).&lt;br /&gt;&lt;br /&gt;The following is an example of the output of ulimit -aH. You can see that the current shell (and its children) is restricted to 1024 open file descriptors.&lt;br /&gt;&lt;br /&gt;core file size (blocks)     unlimited&lt;br /&gt;data seg size (kbytes)      unlimited&lt;br /&gt;file size (blocks)          unlimited&lt;br /&gt;max locked memory (kbytes)  unlimited&lt;br /&gt;max memory size (kbytes)    unlimited&lt;br /&gt;open files                  1024&lt;br /&gt;pipe size (512 bytes)       8&lt;br /&gt;stack size (kbytes)         unlimited&lt;br /&gt;cpu time (seconds)          unlimited&lt;br /&gt;max user processes          4094&lt;br /&gt;virtual memory (kbytes)     unlimited&lt;br /&gt;&lt;br /&gt;Increasing the file descriptor limit&lt;br /&gt;&lt;br /&gt;The file descriptor limit can be increased using the following procedure:&lt;br /&gt;&lt;br /&gt;   1. Edit /etc/security/limits.conf and add the lines:&lt;br /&gt;&lt;br /&gt;      *       soft    nofile  1024&lt;br /&gt;      *       hard    nofile  65535&lt;br /&gt;&lt;br /&gt;   2. Edit /etc/pam.d/login, adding the line:&lt;br /&gt;&lt;br /&gt;      session required /lib/security/pam_limits.so&lt;br /&gt;&lt;br /&gt;   3. The system file descriptor limit is set in /proc/sys/fs/file-max. The following command will increase the limit to 65535:&lt;br /&gt;&lt;br /&gt;      echo 65535 &gt; /proc/sys/fs/file-max&lt;br /&gt;&lt;br /&gt;   4. You should then be able to increase the file descriptor limits using:&lt;br /&gt;&lt;br /&gt;      ulimit -n unlimited&lt;br /&gt;&lt;br /&gt;      The above command will set the limits to the hard limit specified in /etc/security/limits.conf.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;or---&lt;br /&gt;Increase the limit from 64 (default) to 2048 by issuing the command:&lt;br /&gt;&lt;br /&gt;   ulimit -n 2048&lt;br /&gt;&lt;br /&gt;Also, some applications like the SCO JDK require that the virtual memory resource limit be set to unlimited.&lt;br /&gt;&lt;br /&gt;   ulimit -v unlimited&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Note that you may need to log out and back in again before the changes take effect.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-8674697336760823524?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/8674697336760823524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=8674697336760823524' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/8674697336760823524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/8674697336760823524'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/06/tuning-file-descriptor-limits-on-linux.html' title='Tuning file descriptor limits on Linux'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-2711922698009174899</id><published>2007-06-07T00:46:00.001-07:00</published><updated>2007-06-07T00:46:46.790-07:00</updated><title type='text'>Tuning PostgreSQL for performance</title><content type='html'>Tuning PostgreSQL for performance&lt;br /&gt;&lt;br /&gt;Shridhar Daithankar, Josh Berkus&lt;br /&gt;&lt;br /&gt;July 3, 2003 Copyright 2003 Shridhar Daithankar and Josh Berkus.&lt;br /&gt;Authorized for re-distribution only under the PostgreSQL license (see www.postgresql.org/license).&lt;br /&gt;&lt;br /&gt;Table of Contents&lt;br /&gt;&lt;br /&gt;1 Introduction&lt;br /&gt;2 Some basic parameters&lt;br /&gt;    2.1 Shared buffers&lt;br /&gt;    2.2 Sort memory&lt;br /&gt;    2.3 Effective Cache Size&lt;br /&gt;    2.4 Fsync and the WAL files&lt;br /&gt;3 Some less known parameters&lt;br /&gt;    3.1 random_ page_cost&lt;br /&gt;    3.2 Vacuum_ mem&lt;br /&gt;    3.3 max_fsm_pages&lt;br /&gt;    3.4 max  fsm_ relations&lt;br /&gt;    3.5 wal_buffers&lt;br /&gt;4 Other tips&lt;br /&gt;    4.1 Check your file system&lt;br /&gt;    4.2 Try the Auto Vacuum daemon&lt;br /&gt;    4.3 Try FreeBSD&lt;br /&gt;5 The CONF Setting Guide&lt;br /&gt;&lt;br /&gt;1 Introduction&lt;br /&gt;This is a quick start guide for tuning PostgreSQL's settings for performance. This assumes minimal familiarity with PostgreSQL administration. In particular, one should know,&lt;br /&gt;&lt;br /&gt;    * How to start and stop the postmaster service&lt;br /&gt;    * How to tune OS parameters&lt;br /&gt;    * How to test the changes &lt;br /&gt;&lt;br /&gt;It also assumes that you have gone through the PostgreSQL administration manual before starting, and to have set up your PostgreSQL server with at least the default configuration.&lt;br /&gt;&lt;br /&gt;There are two important things for any performance optimization:&lt;br /&gt;&lt;br /&gt;    * Decide what level of performance you want&lt;br /&gt;&lt;br /&gt;          If you don't know your expected level of performance, you will end up chasing a carrot always couple of meters ahead of you. The performance tuning measures give diminishing returns after a certain threshold. If you don't set this threshold beforehand, you will end up spending lot of time for minuscule gains. &lt;br /&gt;&lt;br /&gt;    * Know your load&lt;br /&gt;&lt;br /&gt;          This document focuses entirely tuning postgresql.conf best for your existing setup. This is not the end of performance tuning. After using this document to extract the maximum reasonable performance from your hardware, you should start optimizing your application for efficient data access, which is beyond the scope of this article. &lt;br /&gt;&lt;br /&gt;Please also note that the tuning advices described here are hints. You should not implement them all blindly. Tune one parameter at a time and test its impact and decide whether or not you need more tuning. Testing and benchmarking is an integral part of database tuning.&lt;br /&gt;&lt;br /&gt;Tuning the software settings explored in this article is only about one-third of database performance tuning, but it's a good start since you can experiment with some basic setting changes in an afternoon, whereas some other aspects of tuning can be very time-consuming. The other two-thirds of database application tuning are:&lt;br /&gt;&lt;br /&gt;    * Hardware Selection and Setup&lt;br /&gt;&lt;br /&gt;          Databases are very bound to your system's I/O (disk) access and memory usage. As such, selection and configuration of disks, RAID arrays, RAM, operating system, and competition for these resources will have a profound effect on how fast your database is. We hope to have a later article covering this topic. &lt;br /&gt;&lt;br /&gt;    * Efficient Application Design&lt;br /&gt;&lt;br /&gt;          Your application also needs to be designed to access data efficiently, though careful query writing, planned and tested indexing, good connection management, and avoiding performance pitfalls particular to your version of PostgreSQL. Expect another guide someday helping with this, but really it takes several large books and years of experience to get it right ... or just a lot of time on the mailing lists. &lt;br /&gt;&lt;br /&gt;2 Some basic parameters&lt;br /&gt;2.1 Shared buffers&lt;br /&gt;Shared buffers defines a block of memory that PostgreSQL will use to hold requests that are awaiting attention from the kernel buffer and CPU. The default value is quite low for any real world workload and need to be beefed up. However, unlike databases like Oracle, more is not always better. There is a threshold above which increasing this value can hurt performance.&lt;br /&gt;&lt;br /&gt;This is the area of memory PostgreSQL actually uses to perform work. It should be sufficient enough to handle load on database server. Otherwise PostgreSQL will start pushing data to file and it will hurt the performance overall. Hence this is the most important setting one needs to tune up.&lt;br /&gt;&lt;br /&gt;This value should be set based on the dataset size which the database server is supposed to handle at peak loads and on your available RAM (keep in mind that RAM used by other applications on the server is not available). We recommend following rule of thumb for this parameter:&lt;br /&gt;&lt;br /&gt;    * Start at 4MB (512) for a workstation&lt;br /&gt;    * Medium size data set and 256-512MB available RAM: 16-32MB (2048-4096)&lt;br /&gt;    * Large dataset and lots of available RAM (1-4GB): 64-256MB (8192-32768) &lt;br /&gt;&lt;br /&gt;PLEASE NOTE. PostgreSQL counts a lot on the OS to cache data files and hence does not bother with duplicating its file caching effort. The shared buffers parameter assumes that OS is going to cache a lot of files and hence it is generally very low compared with system RAM. Even for a dataset in excess of 20GB, a setting of 128MB may be too much, if you have only 1GB RAM and an aggressive-at-caching OS like Linux.&lt;br /&gt;&lt;br /&gt;There is one way to decide what is best for you. Set a high value of this parameter and run the database for typical usage. Watch usage of shared memory using ipcs or similar tools. A recommended figure would be between 1.2 to 2 times peak shared memory usage.&lt;br /&gt;&lt;br /&gt;2.2 Sort memory&lt;br /&gt;This parameter sets maximum limit on memory that a database connection can use to perform sorts. If your queries have order-by or group-by clauses that require sorting large data set, increasing this parameter would help. But beware: this parameter is per sort, per connection. Think twice before setting this parameter too high on any database with many users. A recommended approach is to set this parameter per connection as and when required; that is, low for most simple queries and higher for large, complex queries and data dumps.&lt;br /&gt;&lt;br /&gt;2.3 Effective Cache Size&lt;br /&gt;This parameter allows PostgreSQL to make best possible use of RAM available on your server. It tells PostgreSQL the size of OS data cache. So that PostgreSQL can draw different execution plan based on that data.&lt;br /&gt;&lt;br /&gt;Say there is 1.5GB RAM in your machine, shared buffers are set to 32MB and effective cache size is set to 800MB. So if a query needs 700MB of data set, PostgreSQL would estimate that all the data required should be available in memory and would opt for more aggressive plan in terms of optimization, involving heavier index usage and merge joins. But if effective cache is set to only 200MB, the query planner is liable to opt for the more I/O efficient sequential scan.&lt;br /&gt;&lt;br /&gt;While setting this parameter size, leave room for other applications running on the server machine. The objective is to set this value at the highest amount of RAM which will be available to PostgreSQL all the time.&lt;br /&gt;&lt;br /&gt;2.4 Fsync and the WAL files&lt;br /&gt;This parameters sets whether or not write data to disk as soon as it is committed, which is done through Write Ahead Logging (WAL). If you trust your hardware, your power company, and your battery power supply enough, you set this to No for an immediate boost to data write speed. But be very aware that any unexpected database shutdown will force you to restore the database from your last backup.&lt;br /&gt;&lt;br /&gt;If that's not an option for you, you can still have the protection of WAL and better performance. Simply move your WAL files, using either a mount or a symlink to the pg_xlog directory, to a separate disk or array from your main database files. In high-write-activity databases, WAL should have its own disk or array to ensure continuous high-speed access. Very large RAID arrays and SAN/NAS devices frequently handle this for you through their internal management systems.&lt;br /&gt;3 Some less known parameters&lt;br /&gt;3.1 random_page_cost&lt;br /&gt;This parameter sets the cost to fetch a random tuple from the database, which influences the planner's choice of index vs. table scan. This is set to a high value as the default default based on the expectation of slow disk access. If you have reasonably fast disks like SCSI or RAID, you can lower the cost to 2. You need to experiment to find out what works best for your setup by running a variety of queries and comparing execution times.&lt;br /&gt;3.2 Vacuum_mem&lt;br /&gt;This parameter sets the memory allocated to Vacuum. Normally, vacuum is a disk intensive process, but raising this parameter will speed it up by allowing PostgreSQL to copy larger blocks into memory. Just don't set it so high it takes significant memory away from normal database operation. Things between 16-32MB should be good enough for most setups.&lt;br /&gt;3.3 max_fsm_pages&lt;br /&gt;PostgreSQL records free space in each of its data pages. This information is useful for vacuum to find out how many and which pages to look for when it frees up the space.&lt;br /&gt;&lt;br /&gt;If you have a database that does lots of updates and deletes, that is going to generate dead tuples, due to PostgreSQL's MVCC system. The space occupied by dead tuples can be freed with vacuum, unless there is more wasted space than is covered by the Free Space Map, in which case the much less convenient "vacuum full" is required. By expanding the FSM to cover all of those dead tuples, you might never again need to run vacuum full except on holidays.&lt;br /&gt;&lt;br /&gt;The best way to set max _ fsm _ pages is interactive; First, figure out the vacuum (regular) frequency of your database based on write activity; next, run the database under normal production load, and run "vacuum verbose analyze" instead of vacuum, saving the output to a file; finally, calculate the maximum total number of pages reclaimed between vacuums based on the output, and use that.&lt;br /&gt;&lt;br /&gt;Remember, this is a database cluster wide setting. So bump it up enough to cover all databases in your database cluster. Also, each FSM page uses 6 bytes of RAM for administrative overhead, so increasing FSM substantially on systems low on RAM may be counter-productive.&lt;br /&gt;3.4 max _ fsm _ relations&lt;br /&gt;This setting dictates how many number of relations (tables) will be tracked in free space map. Again this is a database cluster-wide setting, so set it accordingly. In version 7.3.3 and later, this parameter should be set correctly as a default. In older versions, bump it up to 300-1000.&lt;br /&gt;3.5 wal_buffers&lt;br /&gt;This setting decides the number of buffers WAL(Write ahead Log) can have. If your database has many write transactions, setting this value bit higher than default could result better usage of disk space. Experiment and decide. A good start would be around 32-64 corresponding to 256-512K memory.&lt;br /&gt;4 Other tips&lt;br /&gt;4.1 Check your file system&lt;br /&gt;On OS like Linux, which offers multiple file systems, one should be careful about choosing the right one from a performance point of view. There is no agreement between PostgreSQL users about which one is best.&lt;br /&gt;&lt;br /&gt;Contrary to popular belief, today's journaling file systems are not necessarily slower compared to non-journaling ones. Ext2 can be faster on some setups but the recovery issues generally make its use prohibitive. Different people have reported widely different experiences with the speed of Ext3, ReiserFS, and XFS; quite possibly this kind of benchmark depends on a combination of file system, disk/array configuration, OS version, and database table size and distribution. As such, you may be better off sticking with the file system best supported by your distribution, such as ReiserFS for SuSE Linux or Ext3 for Red Hat Linux, not to forget XFS known for it's large file support . Of course, if you have time to run comprehensive benchmarks, we would be interested in seeing the results!&lt;br /&gt;&lt;br /&gt;As an easy performance boost with no downside, make sure the file system on which your database is kept is mounted "noatime", which turns off the access time bookkeeping.&lt;br /&gt;4.2 Try the Auto Vacuum daemon&lt;br /&gt;There is a little known module in PostgreSQL contrib directory called as pgavd. It works in conjunction with statistics collector. It periodically connects to a database and checks if it has done enough operations since the last check. If yes, it will vacuum the database.&lt;br /&gt;&lt;br /&gt;Essentially it will vacuum the database when it needs it. It would get rid of playing with cron settings for vacuum frequency. It should result in better database performance by eliminating overdue vacuum issues.&lt;br /&gt;4.3 Try FreeBSD&lt;br /&gt;Large updates, deletes, and vacuum in PostgreSQL are very disk intensive processes. In particular, since vacuum gobbles up IO bandwidth, the rest of the database activities could be affected adversely when vacuuming very large tables.&lt;br /&gt;&lt;br /&gt;OS's from the BSD family, such as FreeBSD, dynamically alter the IO priority of a process. So if you lower the priority of a vacuum process, it should not chew as much bandwidth and will better allow the database to perform normally. Of course this means that vacuum could take longer, which would be problematic for a "vacuum full."&lt;br /&gt;&lt;br /&gt;If you are not done with your choice of OS for your server platform, consider BSD for this reason.&lt;br /&gt;&lt;br /&gt;5 The CONF Setting Guide&lt;br /&gt;Available here is an Annotated Guide to the PostgreSQL configuration file settings, in both OpenOffice.org and PDF format. This guide expands on the official documentation and may eventually be incorporated into it.&lt;br /&gt;&lt;br /&gt;    * The first column of the chart is the GUC setting in the postgresql.conf file.&lt;br /&gt;    * The second is the maximum range of the variable; note that the maximum range is often much larger than the practical range. For example, random_page_cost will accept any number between 0 and several billion, but all practical numbers are between 1 and 5.&lt;br /&gt;    * The third column contains an enumeration of RAM or disk space used by each unit of the parameter.&lt;br /&gt;    * The fourth column indicates whether or not the variable may be SET from the PSQL terminal during an interactive setting. Most settings marked as "no" may only be changed by restarting PostgreSQL.&lt;br /&gt;    * The fifth column quotes the official documentation available from the PostgreSQL web site.&lt;br /&gt;    * The last column is our notes on the setting, how to set it, resources it uses, etc. You'll notice some blank spaces, and should be warned as well that there is still strong disagreement on the value of many settings. &lt;br /&gt;&lt;br /&gt;Users of PostgreSQL 7.3 and earlier will notice that the order of the parameters in this guide do not match the order of the parameters in your postgresql.conf file. This is because this document was generated as part of an effort to re-organize the conf parameters and documentation; starting with 7.4, this document, the official documentation, and the postgresql.conf file are all in the same logical order.&lt;br /&gt;&lt;br /&gt;As noted in the worksheet, it covers PostgreSQL versions 7.3 and 7.4. If you are using an earlier version, you will not have access to all of these settings, and defaults and effects of some settings will be different.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-2711922698009174899?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/2711922698009174899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=2711922698009174899' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/2711922698009174899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/2711922698009174899'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/06/tuning-postgresql-for-performance.html' title='Tuning PostgreSQL for performance'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-1004942932775338483</id><published>2007-06-05T08:25:00.000-07:00</published><updated>2007-06-05T08:26:48.922-07:00</updated><title type='text'>iax2 one-way audio</title><content type='html'>After a while of operation, IAX becomes behaving incorrectly, no audio or 1-way, and no-answer :&lt;br /&gt;&lt;br /&gt;This problem happened on asterisk 2.1.14.&lt;br /&gt;&lt;br /&gt;The solution is configure the &lt;br /&gt;jitterbuffer=no&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-1004942932775338483?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/1004942932775338483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=1004942932775338483' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/1004942932775338483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/1004942932775338483'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/06/iax2-one-way-audio.html' title='iax2 one-way audio'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-4504757688357546237</id><published>2007-05-31T02:03:00.000-07:00</published><updated>2007-05-31T02:08:22.182-07:00</updated><title type='text'>GWT-app does not first show when loading (IE 6)</title><content type='html'>Modules can contain references to external JavaScript and CSS files, causing them to be automatically loaded when the module itself is loaded.&lt;br /&gt;&lt;br /&gt;But when injection of CSS file make the IE does not show the GWT widgits until you click on the page manually.&lt;br /&gt;&lt;br /&gt;To work around this, donot use css injection but using normal way of embed the css file in html template&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-4504757688357546237?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/4504757688357546237/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=4504757688357546237' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/4504757688357546237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/4504757688357546237'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/05/gwt-app-does-not-first-show-when.html' title='GWT-app does not first show when loading (IE 6)'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-5361024954893611817</id><published>2007-05-28T08:45:00.000-07:00</published><updated>2007-05-28T08:49:57.170-07:00</updated><title type='text'>jboss ejb3 and eager loading</title><content type='html'>In case of using annotation @OneToMany(mappedBy="order",cascade=CascadeType.ALL, fetch=FetchType.EAGER), the ear deployment broken.&lt;br /&gt;&lt;br /&gt;To work around this problem, remove the fetch=FetchType.EAGER &lt;br /&gt;&lt;br /&gt;or &lt;br /&gt;&lt;br /&gt;Use either: Set or List with an explicit @IndexColumn, rather than a bag semantic collection like Collection.&lt;br /&gt;&lt;br /&gt;@IndexColumn is an hibernate annotation&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-5361024954893611817?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/5361024954893611817/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=5361024954893611817' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/5361024954893611817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/5361024954893611817'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/05/jboss-ejb3-and-eager-loading.html' title='jboss ejb3 and eager loading'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-8386108010190021743</id><published>2007-05-18T08:11:00.000-07:00</published><updated>2007-05-18T08:13:53.462-07:00</updated><title type='text'>Solaris x86</title><content type='html'>Hardware:&lt;br /&gt;&lt;br /&gt;To setup the server testing enviroment, Sun utral 20 box is used. This box has two harddisks: (1)/dev/dsk/c1d0 and (2)/dev/dsk/c2d0&lt;br /&gt;&lt;br /&gt;During installation of the Solaris 10, the first harddisk is used to install the boot, swap and root partitions. Basically, which likes the normal linux setting up.&lt;br /&gt;&lt;br /&gt;The second harddisk /dev/dsk/c2d0 is left for the "zpool", although zpool can also use the extra space in the first disk.&lt;br /&gt;&lt;br /&gt;After OS installation, the system status is : Solaris OS is installed in the first hardisk (/dev/dsk/c1d0). And the second harddisk is totally not used.&lt;br /&gt;&lt;br /&gt;--------------------------After the installation of OS-------------------------&lt;br /&gt;(1)create resource pool by command zpool&lt;br /&gt;#zpool create spool c2d0&lt;br /&gt;(2)now the pool named "spool" is created. Which can be listed by:&lt;br /&gt;#zpool list&lt;br /&gt;(3)Creating a ZFS File System by allocating space from the pool "spool"&lt;br /&gt;#zfs create spool/z1fs&lt;br /&gt;(4)now, new ZFS file system is created, which can be listed by:&lt;br /&gt;#zfs list&lt;br /&gt;(5)Now, it is time to create the parent directory of all zones: In the following, /zones directory is created.&lt;br /&gt;#mkdir /zones&lt;br /&gt;(6)To create zone "z1", i create directory /zones/z1,&lt;br /&gt;#mkdir /zones/z1&lt;br /&gt;(7)and mount the newly create ZFS spool/z1fs to /zone/z1&lt;br /&gt;#zfs set mountpoint=/zones/z1 spool/z1fs&lt;br /&gt;(8)and set the quato for ZFS spool/z1fs&lt;br /&gt;#zfs set quota=10G spool/z1fs&lt;br /&gt;(9) It is time to create zone z1 now:&lt;br /&gt;#zonecfg -z z1&lt;br /&gt;z1: No such zone configured&lt;br /&gt;     Use 'create' to begin configuring a new zone&lt;br /&gt;     zonecfg:myzone&lt; create&lt;br /&gt;     zonecfg:myzone&lt; set zonepath=/zones/z1&lt;br /&gt;     zonecfg:myzone&lt; verify&lt;br /&gt;     zonecfg:myzone&lt; commit&lt;br /&gt;     zonecfg:myzone&lt; exit&lt;br /&gt;(10)Install the zone by using the zoneadm&lt;br /&gt;#chmod 700 /zones/z1&lt;br /&gt;#zoneadm -z z1 install&lt;br /&gt;(11)Boot the zone to complete the installation, using the zoneadm command.&lt;br /&gt;# zoneadm -z z1 boot&lt;br /&gt;(12)Use the zlogin command to connect to the zone console and answer the initialization questions:&lt;br /&gt;#zlogin -C z1&lt;br /&gt;(13)to shutdown zone&lt;br /&gt;#zlogin z1 init 5&lt;br /&gt;&lt;br /&gt;----------------------------------------------------&lt;br /&gt;&lt;br /&gt;Configure network for the zone&lt;br /&gt;&lt;br /&gt;Context: the Sun utral 20 box has only one physical network interface. To make the zone created network accessable, one logical interface will be assigned to each zone.&lt;br /&gt;&lt;br /&gt;(1)list the physical network interface on Sun utral 20 box:&lt;br /&gt;#ifconfig -a&lt;br /&gt;The result shows that the physical network interface is nge0&lt;br /&gt;(2)create logical interface and assign it to zone z1 and then up the logical interface:&lt;br /&gt;#ifconfig nge0:1 plumb 192.168.1.89 netmask 255.255.255.0 zone z1 up&lt;br /&gt;(3)login into z1:&lt;br /&gt;#zlogin z1&lt;br /&gt;(4)modify /etc/ssh/sshd_config , so that "root" can be used to do remote login&lt;br /&gt;(5)restart sshd:&lt;br /&gt;#svcadm restart ssh&lt;br /&gt;&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;DNS clients configuration:&lt;br /&gt;&lt;br /&gt;After zone is running, it could encount such a problem: When you do ping to other computer, the naming resolving does not work. This is due to the DNS client configuration is not correct.&lt;br /&gt;&lt;br /&gt;All DNS clients require the presence of the /etc/nsswitch.conf and /etc/resolv.conf files. Note that the DNS server must also be configured as a DNS client if it intends to use its own DNS services.&lt;br /&gt;&lt;br /&gt;The /etc/nsswitch.conf file specifies the resolver library routines to be used for resolving host names and addresses. Modify the /etc/nsswitch.conf file by editing the hosts entry and adding the dns keyword. To ensure proper network interface configuration during the boot process, make sure that the files keyword is listed first. The following example shows a hosts entry configured for DNS:&lt;br /&gt;&lt;br /&gt;hosts: files dns&lt;br /&gt;&lt;br /&gt;The /etc/resolv.conf file specifies the name servers that the client must use, the client's domain name, and the search path to use for queries.&lt;br /&gt;&lt;br /&gt;; resolv.conf file for DNS clients of the one.edu domain&lt;br /&gt;domain office1.abc.net&lt;br /&gt;nameserver 192.168.1.119&lt;br /&gt;search office1.abc.net&lt;br /&gt;&lt;br /&gt;Observe that the search keyword specifies domain names to append to queries that were not specified in the FQDN format. The first domain listed following the search keyword designates the client's domain. If both "domain" and "search" keywords are present, then the last one in the file is used and the other one(s) are ignored.&lt;br /&gt;&lt;br /&gt;The nameserver keyword specifies the IP address of the DNS servers to query. Do not specify host names. You can use up to three nameserver keywords to increase your chances of finding a responsive server. In general, list the name servers that are nearer to the local network first. The client attempts to use the loopback address if there is no nameserver keyword or if the /etc/resolv.conf file does not exists.&lt;br /&gt;&lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Configure DHCP client&lt;br /&gt;&lt;br /&gt;After crashing of sun ultra 20 box, a dell box with onboard networking card is used to install solaris.&lt;br /&gt;&lt;br /&gt;Problem 1: solaris doesn't support this on-board networking card.&lt;br /&gt;Solution: a standalone PCI network card is used.&lt;br /&gt;&lt;br /&gt;Problem 2: Solaris cannot detect this PCI card, and what is the interface name of this card?&lt;br /&gt;Solution: Google suggest to try names like le0, iprb0, elxl0 and rtls0 etc.&lt;br /&gt;&lt;br /&gt;Problem3: how to configure the DHCP client?&lt;br /&gt;Solution: for a network interface, to configure it DHCP, create two empty files under /etc directory:&lt;br /&gt;(a)hostname.INTERFACENAME , (b)dhcp.INTERFACENAME&lt;br /&gt;&lt;br /&gt;After trying google suggested interface names, it is found that elxl0 is correct for this card.&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Configure static IP addresses for the solaris box:&lt;br /&gt;&lt;br /&gt;Network Interface Cards are what allow your system to talk to the network. When they don't work, neither do you. I will cover how to configure, troubleshoot, and modify your interfaces. I will not be covering routing issues, that will follow in the next article. My goal here is to get your interface up and properly running.&lt;br /&gt;&lt;br /&gt;The first place to start is installing and testing the hardware. Once you have installed the hardware, SPARC systems can be tested at the EPROM level to verify the network interface cards. Use the manual that accompanies the interface card on how to test that specific card. Solaris x86 is a little different, as there is no true EPROM, and the drivers are different. However, Solaris x86 2.6 is Plug and Play compatible, and I have had fairly good luck adding network interface cards.&lt;br /&gt;&lt;br /&gt;Once you have confirmed at the hardware and driver level that everything works, the fun can begin. The place to start is the ifconfig command. This powerful command allows you configure and modify your interfaces in real time. However, any modifications made with ifconfig are not permanent. When the system reboots, it will default to its previous configuration. I will first show you how to make all modifications with the ifconfig command. The second half of this article will cover making these modifications permanent by modifying the proper configuration files.&lt;br /&gt;ifconfig&lt;br /&gt;&lt;br /&gt;ifconfig -a&lt;br /&gt;&lt;br /&gt;will show you which interfaces are currently installed and active. Remember, just because you added the physical network interface card does NOT mean it is active. If you do an ifconfig before you have configured the device, the interface will not show up. Once configured however, the typical output of the ifconfig -a command would look like this:&lt;br /&gt;&lt;br /&gt;lo0: flags=849&lt;UP,LOOPBACK,RUNNING,MULTICAST&gt; mtu 8232&lt;br /&gt;           inet 127.0.0.1 netmask ff000000&lt;br /&gt;elxl0: flags=863&lt;UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST&gt; mtu 1500&lt;br /&gt;          inet 192.168.1.132 netmask ffffff00 broadcast 192.168.1.255&lt;br /&gt;          ether 8:0:20:9c:6b:2d&lt;br /&gt;&lt;br /&gt;Here we see two interfaces, lo0 and elxl0. lo0 is the standard loopback interface found on all systems. elxl0 is a 10/100 Mbps interface. All hme interfaces are 10/100 Mbps, all le interfaces are 10 Mbps, all qe interface are quad 10 Mbps, and qfe interfaces are quad 10/100 Mbps. There are three lines of information about the interface. The first line is about the TCP/IP stack. For the interface elxl0, we see the system is up, running both broadcast and multicast, with a mtu (maximum transfer unit) of 1500 bytes, standard for an Ethernet LAN. Notrailers is a flag no longer used, but kept for backwards compatibility reasons.&lt;br /&gt;&lt;br /&gt;The second line is about the IP addressing. Here we see the IP address, netmask in hexadecimal format, and the broadcast address. The third line is the MAC address. Unlike most interfaces, Sun Microsystems's interfaces derive the MAC addressing from the NVRAM, not the interface itself. Thus, all the interfaces on a single SPARC system will have the same MAC address. This does not cause a problem in routing, since most NICs are always on a different network. Note, you must be root to see the MAC address with the ifconfig command, any other user will only see the first two lines of information.&lt;br /&gt;&lt;br /&gt;The first step in bringing up an interface is "plumbing" the interface. By plumbing, we are implementing the TCP/IP stack. We will use the above interface, elxl0, as an example. Lets say we had just physically added this network interface card and rebooted, now what? First, we plumb the device with the plumb command.&lt;br /&gt;&lt;br /&gt;ifconfig elxl0 plumb&lt;br /&gt;&lt;br /&gt;This sets up the streams needed for TCP/IP to use the device. However, the stack has not been configured as you can see below.&lt;br /&gt;&lt;br /&gt;elxl0: flags=842&lt;BROADCAST,RUNNING,MULTICAST&gt; mtu 1500&lt;br /&gt;           inet 0.0.0.0 netmask 0&lt;br /&gt;           ether 8:0:20:9c:6b:2d&lt;br /&gt;&lt;br /&gt;The next step is to configure the TCP/IP stack. We configure the stack by adding the IP address, netmask, and then telling the device it is up. All this can be down in one command, as seen below.&lt;br /&gt;&lt;br /&gt;  ifconfig elxl0 192.168.1.132 netmask 255.255.255.0 up&lt;br /&gt;&lt;br /&gt;This single command configures the entire device. Notice the up command, which initializes the interface. The interface can be in one of two states, up or down. When an interface is down, the system does not attempt to transmit messages through that interface. A down interface will still show with the ifconfig command, however it will not have the word "up" on the first line.&lt;br /&gt;Virtual interfaces&lt;br /&gt;&lt;br /&gt;Before moving on to the configuration files, I would first like to cover virtual interfaces. A virtual interface is one or more logical interfaces assigned to an already existing interface. Solaris can have up to 255 virtual interfaces assigned to a single interface.&lt;br /&gt;&lt;br /&gt;Once again, lets take the interface elxl0 as an example. We have already covered how to configure this device. However, lets say the device is on a VLAN (virtual LAN) with several networks sharing the same wire. We can configure the device elxl0 to answer to another IP address, say 172.20.15.4. To do so, the command would be the same as used for elxl0, except the virtual interface is called elxl0:*, where * is the number you assign to the virtual interface. For example, virtual interface one would be elxl0:1. The command to configure it looks as follows.&lt;br /&gt;&lt;br /&gt;ifconfig elxl0:1 172.20.15.4 netmask 255.255.0.0 up&lt;br /&gt;&lt;br /&gt;Once you have configured the virtual interface, you can compare elxl0 and elxl0:1 with the ifconfig command.&lt;br /&gt;&lt;br /&gt;elxl0: flags=843&lt;UP,BROADCAST,RUNNING,MULTICAST&gt; mtu 1500&lt;br /&gt;          inet 192.168.1.132 netmask ffffff00 broadcast 192.168.1.255&lt;br /&gt;          ether 8:0:20:9c:6b:2d&lt;br /&gt;elxl0:1: flags=842&lt;BROADCAST,RUNNING,MULTICAST&gt; mtu 1500&lt;br /&gt;          inet 172.20.15.4 netmask ffff0000 broadcast 172.20.255.255&lt;br /&gt;&lt;br /&gt;Here you see the two devices, both of which are on the same physical device. Notice how the virtual interface elxl0:1 has no MAC address, as this is the same device as elxl0. We can repeat this process all the way up to elxl0:255. The operating system and most applications will treat these virtual devices as totally independent devices.&lt;br /&gt;&lt;br /&gt;Note, Matthew A. Domurat has identified a "bug" with Solaris 2.6. When working with virtual interfaces, Solaris 2.6 will randomly select one of the interfaces as its source address for every packet sent. These are the patches to fix this:&lt;br /&gt;&lt;br /&gt;    * 105786-05: SunOS 5.6: /kernel/drv/ip patch&lt;br /&gt;    * 105787-04: SunOS 5.6_x86: /kernel/drv/ip patch&lt;br /&gt;&lt;br /&gt;Configuration files&lt;br /&gt;&lt;br /&gt;Now you know how to configure your network interface cards. Unfortunately, any modifications, additions, or deletions you make with ifconfig are only temporary, you will lose these configurations when you reboot. I will now discuss what files you have to configure to make these changes permanent.&lt;br /&gt;&lt;br /&gt;The place to start is the file /etc/hostname.*, where * is the name of the interface. In the case of elxl0, the file name is /etc/hostname.elxl0. The virtual interface elxl0:1 would have the file name /etc/hostname.elxl0:1. This file has a single entry, the name of the interface. This name is used in the /etc/hosts file to resolve name to IP address.&lt;br /&gt;&lt;br /&gt;The file /etc/hostname.* is critical, this is what causes the device to be plumbed. During the boot process, the /etc/rcS.d/S30network.sh file reads all the /etc/hostname.* files and plumbs the devices. Once plumbed, the devices are configured by reading the /etc/hosts and the /etc/netmasks file. By reading these two files, the device is configured for the proper IP and netmask, and brought to an up state. Lets take the device elxl0 as an example. During the boot process, /etc/rcS.d/S30network.sh looks for any /etc/hostname.* files. It finds /etc/hostname.elxl0, which contains the following entry.&lt;br /&gt;&lt;br /&gt;  homer&lt;br /&gt;&lt;br /&gt;/etc/rcS.d/S30network.sh looks in /etc/hosts and resolves the name homer with an IP address of 192.168.1.132. The device elxl0 is now assigned this IP address. The script then looks at /etc/netmasks to find the netmask for that IP address. With this information, the startup script brings up interface elxl0 with an IP address of 192.168.1.132 and a netmask of 255.255.255.0. It may seem redundant having the script review the netmask of a class C address. However, do not forget that, starting with 2.6, Solaris supports both classless routing and VLSM (Variable Length Subnet Masks), both of which I will discuss in my next article.&lt;br /&gt;&lt;br /&gt;As you have seen in this example, there are three files that must be modified for every interface. The first is /etc/hostname.*, this is the file you create to designate the interface's name. The second file is /etc/hosts, here you resolve the IP to the interface name. Last is /etc/netmasks, this is where you define the netmask of the IP address.&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------------&lt;br /&gt;Install Solaris OS and partition on Dell Box&lt;br /&gt;&lt;br /&gt;The Dell Box has one IDE harddisk with about 120G capacity. Solaris identifies this disk to be c0d0.&lt;br /&gt;&lt;br /&gt;During installation, fdisk partition it as&lt;br /&gt;c0d0s0 which mount on /&lt;br /&gt;c0d0s1 ----swap&lt;br /&gt;c0d0s7 ----/export/home&lt;br /&gt;c0d0s3,4,5,6 all not used but with 20G space. they will be used as the resources of the resource pool created by zpool.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;----------------------------------------------------&lt;br /&gt;&lt;br /&gt;create harddisk resource pool&lt;br /&gt;&lt;br /&gt;(1)#zpool create spool c0d0s3&lt;br /&gt;(2)#zpool add spool c0d0s4&lt;br /&gt;(4)#zpool list&lt;br /&gt;NAME SIZE USED AVAIL CAP HEALTH ALTROOT&lt;br /&gt;spool 39G 196K 39.0G 0% ONLINE&lt;br /&gt;&lt;br /&gt;-----------------------------------------------------------&lt;br /&gt;&lt;br /&gt;set static IP for global zone:&lt;br /&gt;&lt;br /&gt;refer to the doc on above comments....&lt;br /&gt;&lt;br /&gt;To set static IP for global zone:&lt;br /&gt;&lt;br /&gt;(1)create /etc/hosts file. so that:&lt;br /&gt;#less hosts&lt;br /&gt;#&lt;br /&gt;# Internet host table&lt;br /&gt;#&lt;br /&gt;192.168.1.23 benchmark1&lt;br /&gt;(2)create /etc/hostname.elxl0 so that:&lt;br /&gt;#less hostname.elxl0&lt;br /&gt;benchmark1&lt;br /&gt;&lt;br /&gt;After these two files created, global zone are network enabled.&lt;br /&gt;&lt;br /&gt;-----------------------------------------------------------------&lt;br /&gt;setup static ip for zone benchmark2 (non-global zone)&lt;br /&gt;&lt;br /&gt;After login into global zone,&lt;br /&gt;&lt;br /&gt;if doing #ifconfig -a,&lt;br /&gt;lo0: flags=2001000849&lt;UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL&gt; mtu 8232 index 1&lt;br /&gt;        inet 127.0.0.1 netmask ff000000&lt;br /&gt;elxl0: flags=1000843&lt;UP,BROADCAST,RUNNING,MULTICAST,IPv4&gt; mtu 1500 index 2&lt;br /&gt;        inet 192.168.1.23 netmask ffffff00 broadcast 192.168.1.255&lt;br /&gt;        ether 0:1:2:12:67:53&lt;br /&gt;&lt;br /&gt;#zonecfg -z benchmark2&lt;br /&gt;&lt;br /&gt;=&gt;add net&lt;br /&gt; ==&gt;set ip=192.168.1.23&lt;br /&gt; ==&gt;set physical=elxl0&lt;br /&gt;...&lt;br /&gt;and commit&lt;br /&gt;&lt;br /&gt;After boot zone benchmark2, Now, do #ifconfig -a again:&lt;br /&gt;lo0: flags=2001000849&lt;UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL&gt; mtu 8232 index 1&lt;br /&gt;        inet 127.0.0.1 netmask ff000000&lt;br /&gt;lo0:1: flags=2001000849&lt;UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL&gt; mtu 8232 index 1&lt;br /&gt;        zone benchmark2&lt;br /&gt;        inet 127.0.0.1 netmask ff000000&lt;br /&gt;elxl0: flags=1000843&lt;UP,BROADCAST,RUNNING,MULTICAST,IPv4&gt; mtu 1500 index 2&lt;br /&gt;        inet 192.168.1.23 netmask ffffff00 broadcast 192.168.1.255&lt;br /&gt;        ether 0:1:2:12:67:53&lt;br /&gt;elxl0:1: flags=1000843&lt;UP,BROADCAST,RUNNING,MULTICAST,IPv4&gt; mtu 1500 index 2&lt;br /&gt;        zone benchmark2&lt;br /&gt;        inet 192.168.1.22 netmask ffffff00 broadcast 192.168.1.255&lt;br /&gt;&lt;br /&gt;It indicates that non-global zone is already network enabled.&lt;br /&gt;&lt;br /&gt;-----------------------------------------------&lt;br /&gt;&lt;br /&gt;JBOSS setup&lt;br /&gt;&lt;br /&gt;Copy jboss from zpeter4:&lt;br /&gt;&lt;br /&gt;Including:&lt;br /&gt;(1)/opt/jboss-4.0.4.GA&lt;br /&gt;(2)/var/jboss&lt;br /&gt;(3)/opt/bin/myip (this is used in jboss's run.sh file)&lt;br /&gt;(4)if java security manager is included in the java parameter, make sure the corresponding policy file also there&lt;br /&gt;&lt;br /&gt;---------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;JBOSS user&lt;br /&gt;&lt;br /&gt;(1)user jboss must be created&lt;br /&gt;(2)group jboss must be created&lt;br /&gt;(3)home directory of user jboss must be /var/jboss&lt;br /&gt;&lt;br /&gt;[ Show » ]&lt;br /&gt;Peter Yang [16/May/07 12:27 PM] JBOSS user (1)user jboss must be created (2)group jboss must be created (3)home directory of user jboss must be /var/jboss&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Setup SMF for jboss:&lt;br /&gt;&lt;br /&gt;(1)export smf script from zpeter4&lt;br /&gt;#svccfg export jboss &gt;/tmp/jboss.xml&lt;br /&gt;&lt;br /&gt;and copy this exported file to new zone benchmark2.&lt;br /&gt;&lt;br /&gt;(2)Copy /opt/lib/svc/method/svc-jboss from zpeter4 to benchmark2 zone in the corresponding directory&lt;br /&gt;&lt;br /&gt;(3)import manifect file jboss.xml in benchmark2 zone.&lt;br /&gt;/usr/sbin/svccfg -v import /tmp/jboss.xml&lt;br /&gt;&lt;br /&gt;(4)enable jboss&lt;br /&gt;#svcadm enable jboss&lt;br /&gt;&lt;br /&gt;(5)monitoring the status of jboss service&lt;br /&gt;#svcs -xv jboss&lt;br /&gt;&lt;br /&gt;------------------------------------------------&lt;br /&gt;&lt;br /&gt;how to remove service or edit manifest file&lt;br /&gt;&lt;br /&gt;svcadm -v disable svc:/network/jboss&lt;br /&gt;svccfg -v delete svc:/network/jboss&lt;br /&gt;svccfg -v import /var/svc/manifest/jboss.xml&lt;br /&gt;&lt;br /&gt;----------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;How to run NFS file server and mount NFS client&lt;br /&gt;&lt;br /&gt;Problem:&lt;br /&gt;&lt;br /&gt;For the development enviroment, there are four JBOSS servers. To enable the web log feature of the portal, it is required for all these JBOSS server to send their log files to a central NFS server, on which jbossportal server is running.&lt;br /&gt;&lt;br /&gt;Parameters:&lt;br /&gt;(1)JBOSS servers:&lt;br /&gt;zpeter2, zpeter3, zpeter4 and benchmark2 (dell computer)&lt;br /&gt;&lt;br /&gt;(2)NFS file server is running on storm, on which zroland3 zone is running. JBossPortal is running with zroland3 zone.&lt;br /&gt;&lt;br /&gt;Steps:&lt;br /&gt;(1)edit /etc/dfs/dfstab on storm to include following lines:&lt;br /&gt;share -F nfs -o rw -d "zpeter2:/var/jboss/log" /zones/zroland3/root/nfsd/zpeter2&lt;br /&gt;share -F nfs -o rw -d "zpeter3:/var/jboss/log" /zones/zroland3/root/nfsd/zpeter3&lt;br /&gt;share -F nfs -o rw -d "zpeter4:/var/jboss/log" /zones/zroland3/root/nfsd/zpeter4&lt;br /&gt;share -F nfs -o rw -d "benchmark2:/var/jboss/log" /zones/zroland3/root/nfsd/benchmark2&lt;br /&gt;(2)make sure the mode of /zones/zroland3/root/nfsd/zpeter2, /zones/zroland3/root/nfsd/zpeter3, /zones/zroland3/root/nfsd/zpeter3 and /zones/zroland3/root/nfs/benchmark2 are 777. So that files can be written in these directories.&lt;br /&gt;&lt;br /&gt;(3)restart NFS server&lt;br /&gt;&lt;br /&gt;(4)on zone zpeter2, edit /etc/vfstab to include line:&lt;br /&gt;storm:/zones/zroland3/root/nfsd/zpeter2 - /log nfs - yes rw&lt;br /&gt;and do the same thing for zones zpeter3, zpeter4 and benchmark2&lt;br /&gt;&lt;br /&gt;(5)restart these zones&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-8386108010190021743?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/8386108010190021743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=8386108010190021743' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/8386108010190021743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/8386108010190021743'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/05/solaris-x86.html' title='Solaris x86'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-7812073483168772890</id><published>2007-05-18T08:10:00.000-07:00</published><updated>2007-05-18T08:11:26.296-07:00</updated><title type='text'>Java VM Tuning - GC selection</title><content type='html'>GC collector selection:&lt;br /&gt;&lt;br /&gt;(1)default collector(serial collector).&lt;br /&gt;(2)throughput collector,which try to maximum CPU usage (minimize the CPU&lt;br /&gt;usage by GC). But it could introduce big pause. So, this collector&lt;br /&gt;cannot be used for RTS game server.&lt;br /&gt;(3)Concurrent Low Pause Collector. On uniprocessor, this collector will&lt;br /&gt;have worse performance than the default GC collector (serial collector).&lt;br /&gt;On Two CPU machine, this collector will not pause the running&lt;br /&gt;application, but it consume too much percentage of CPU. But for more CPU&lt;br /&gt;(like 3 or 4), this collector is better than the default collector.&lt;br /&gt;&lt;br /&gt;Currently, it is assumed that 2 processors machine will be used.&lt;br /&gt;So, the default GC will be used.&lt;br /&gt;&lt;br /&gt;The two main factors for JVM optimization are :&lt;br /&gt;&lt;br /&gt;(1)Heap Size (-Xms and -Xmx)&lt;br /&gt;(2)The second most influential knob is the proportion of the heap&lt;br /&gt;dedicated to the young generation. By default, the young generation size&lt;br /&gt;is controlled by NewRatio. For example, setting -XX:NewRatio=3 means&lt;br /&gt;that the ratio between the young and tenured generation is 1:3. In other&lt;br /&gt;words, the combined size of the eden and survivor spaces will be one&lt;br /&gt;fourth of the total heap size. The bigger this ratio, the less pause.&lt;br /&gt;However, more frequently the GC runs. This can be logged by another&lt;br /&gt;command line options: -verbose:gc -XX:+PrintGCDetails.&lt;br /&gt;&lt;br /&gt;If this ratio set to 15, you will see the GC runs very with less pause&lt;br /&gt;each time.&lt;br /&gt;&lt;br /&gt;Have no idea about the default value of this ratio.&lt;br /&gt;&lt;br /&gt;Total Heap Size:&lt;br /&gt;&lt;br /&gt;Since collections occur when generations fill up, throughput is&lt;br /&gt;inversely proportional to the amount of memory available. Total&lt;br /&gt;available memory is the most important factor affecting garbage&lt;br /&gt;collection performance.&lt;br /&gt;&lt;br /&gt;Unless having problems with pauses, try granting as much memory as&lt;br /&gt;possible to the virtual machine. The default size (64MB) is often too&lt;br /&gt;small.&lt;br /&gt;&lt;br /&gt;To make sure the pause is not too big, adjust the NewRatio accordingly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-7812073483168772890?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/7812073483168772890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=7812073483168772890' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/7812073483168772890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/7812073483168772890'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/05/java-vm-tuning-gc-selection.html' title='Java VM Tuning - GC selection'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-5587489339662590469</id><published>2007-04-13T20:03:00.001-07:00</published><updated>2007-04-13T20:03:47.735-07:00</updated><title type='text'>T1/E1 jumper on TE11xP, TE2xxP, and TE4xxP</title><content type='html'>These cards have a physical jumper for selecting whether the ports are T1 (open) or E1 (closed).&lt;br /&gt;But there is also a software override for the jumper in the wct4xxp and wct11xp drivers. (See http://kb.digium.com/entry/1/121/)&lt;br /&gt;&lt;br /&gt;To set all spans to E1 mode, use:&lt;br /&gt;&lt;br /&gt;    insmod wct4xxp t1e1override=0xFF&lt;br /&gt;&lt;br /&gt;To set all spans to T1 mode, use:&lt;br /&gt;&lt;br /&gt;    insmod wct4xxp t1e1override=0x00&lt;br /&gt;&lt;br /&gt;An even easier way is to add this to your /etc/modprobe.d/zaptel file:&lt;br /&gt;&lt;br /&gt;    options wct4xxp t1e1override=0xFF&lt;br /&gt;&lt;br /&gt;The argument is a bitmask, which can be used to set each span separately, if that is needed for some reason. Span 1 is 0x01, span 2 is 0x02, span 3 is 0x04, and span 4 is 0x08. For example, "t1e1override=0x0B" would set spans 1, 2, and 4 to E1 mode, and leave span 3 in T1 mode.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-5587489339662590469?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/5587489339662590469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=5587489339662590469' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/5587489339662590469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/5587489339662590469'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/04/t1e1-jumper-on-te11xp-te2xxp-and-te4xxp.html' title='T1/E1 jumper on TE11xP, TE2xxP, and TE4xxP'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-3530441584000211547</id><published>2007-04-13T08:18:00.000-07:00</published><updated>2007-04-13T08:23:33.451-07:00</updated><title type='text'>custom log4j appender for jboss</title><content type='html'>it is very interesting to customize a log4j append, through which the jboss can send log to google talk IM. &lt;br /&gt;&lt;br /&gt;To deploying the gtalklogger(written by myself) and its dependent jar files, you cannot put them simplily into jboss../server/default/lib directory. &lt;br /&gt;&lt;br /&gt;Instead, you need to create a directory to Set the boot patch directory, which Must be absolute or url.&lt;br /&gt;&lt;br /&gt;./run.sh -d absolute-path-to-the-boot-batch-directory &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;refer to the output of:&lt;br /&gt;$./run.sh --help&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-3530441584000211547?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/3530441584000211547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=3530441584000211547' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/3530441584000211547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/3530441584000211547'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/04/custom-log4j-appender-and-jboss.html' title='custom log4j appender for jboss'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-6188952929623000140</id><published>2007-04-12T08:10:00.000-07:00</published><updated>2007-04-12T08:23:57.428-07:00</updated><title type='text'>TE412P and centos 4.4</title><content type='html'>i am struggling with the TE412P and cent os 4.4.&lt;br /&gt;&lt;br /&gt;(1)libpri-1.2.2&lt;br /&gt;(2)zaptel-1.2.3&lt;br /&gt;(3)zaptel-1.2.3&lt;br /&gt;&lt;br /&gt;These packages are a bit old because i am trying to duplicate an old system.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;when i run /sbin/ztcfg, i always got the following error:&lt;br /&gt;-----------------------&lt;br /&gt;Notice: Configuration file is /etc/zaptel.conf&lt;br /&gt;line 0: Unable to open master device '/dev/zap/ctl'&lt;br /&gt;&lt;br /&gt;1 error(s) detected&lt;br /&gt;-----------------------&lt;br /&gt;&lt;br /&gt;I know it is related to udev of linux kernel 2.6.* . And also i read README.udev in zaptel-1.2.3 directory. &lt;br /&gt;&lt;br /&gt;Unless i run following modprobe manually, the /dev/zap/.... files get created. But these files should be created automatically when rebooting (udev system's function)&lt;br /&gt;&lt;br /&gt;$modprobe zaptel&lt;br /&gt;$modprobe wct4xxp&lt;br /&gt;&lt;br /&gt;Only after above manually loaded module, the os will create the /dev/zap/xxxx .&lt;br /&gt;&lt;br /&gt;.... BAD experience.....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-6188952929623000140?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/6188952929623000140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=6188952929623000140' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/6188952929623000140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/6188952929623000140'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/04/te412p-and-centos-44.html' title='TE412P and centos 4.4'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-2165296002318391705</id><published>2007-04-07T20:39:00.000-07:00</published><updated>2007-04-07T21:53:13.190-07:00</updated><title type='text'>asterisk &lt;---IAX2---&gt; asterisk</title><content type='html'>i have two asterisk Boxes: &lt;br /&gt;&lt;br /&gt;mobile users&lt;--ISDN/PRI-&gt;BOX A&lt;--IAX2--&gt;BOX B.&lt;br /&gt;&lt;br /&gt;(1)CALLERID(dnid) issue&lt;br /&gt;When mobile users dial DDI number assigned to BOX A, the CALLERID(dnid) is available. But when Box A forward the call to BOX B, the CALLERID(dnid) is empty within Box B dialplan. &lt;br /&gt;&lt;br /&gt;To work around this problem, i make an agreement between Box A and Box B. When Box A dial Box B, it specifies the IAX2/peer/extensionnumber, where extension number is the CALLER(dnid) of BOX A. And in dialplan of Box B, add Set(CALLERID(dnid)=${EXTEN}) to reset the CALLERID(dnid).&lt;br /&gt;&lt;br /&gt;(2)CALLERID(num) issue:&lt;br /&gt;To send the caller ID to box B, sendani=yes, need to be configured in the box A peer configuration&lt;br /&gt;&lt;br /&gt;(3)Native transfer&lt;br /&gt;To control the media path, notransfer=yes, need to be configured in the Box B.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-2165296002318391705?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/2165296002318391705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=2165296002318391705' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/2165296002318391705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/2165296002318391705'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/04/asterisk-iax2-and-calleriddnid-issue.html' title='asterisk &lt;---IAX2---&gt; asterisk'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-3063537796404383494</id><published>2007-04-05T21:05:00.000-07:00</published><updated>2007-04-05T21:08:51.468-07:00</updated><title type='text'>IP traffic monitoring</title><content type='html'>I want to monitor the network usage between two servers. After researching, i recommended following two tools:&lt;br /&gt;&lt;br /&gt;(1)&lt;a href="http://www.ntop.org/"&gt;ntop&lt;/a&gt;&lt;br /&gt;(2)&lt;a href="http://iptraf.seul.org"&gt;iptraf&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-3063537796404383494?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/3063537796404383494/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=3063537796404383494' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/3063537796404383494'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/3063537796404383494'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/04/ip-traffic-monitoring.html' title='IP traffic monitoring'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-3799418863473264007</id><published>2007-04-01T05:44:00.000-07:00</published><updated>2007-04-01T05:51:50.901-07:00</updated><title type='text'>Java and OpenVZ VPS</title><content type='html'>After installation of openvz VPS by following its user guide, i cannot even run $java -version within the VPS.&lt;br /&gt;&lt;br /&gt;After discovering, i found that the default VPS configuration cannot be used to run java application. &lt;br /&gt;&lt;br /&gt;(1)Example, VPS 101 is running the vps.basic configuration profile. I run the following command: $vzcalc 101 and the result show that my hardware can support about 80 VPS. But if these VPSes are used to run java application, it is obviously not correct. &lt;br /&gt;&lt;br /&gt;(2)So, i need to create/calcualte the profile myself. Fortunately, OpenVZ has command :&lt;br /&gt;$vzsplit -n 10 -f vps.java&lt;br /&gt;This means that i want to create 10 VPSes for java application in the hardware node.&lt;br /&gt;&lt;br /&gt;(3)Finally, i apply this new configuration profile to VPS 101. &lt;br /&gt;$vzctl set 101 --applyconfig vps.java  --save&lt;br /&gt;&lt;br /&gt;(4)Login into VPS 101 again. It is very happy to run java.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-3799418863473264007?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/3799418863473264007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=3799418863473264007' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/3799418863473264007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/3799418863473264007'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/04/java-and-vps.html' title='Java and OpenVZ VPS'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-3721724263742263387</id><published>2007-03-31T02:22:00.000-07:00</published><updated>2007-03-31T02:31:39.835-07:00</updated><title type='text'>update OpenVZ VPS</title><content type='html'>After searching, i found that there are no information about how to update a open VZ VPS. It is worth to write it down for other people's reference.&lt;br /&gt;&lt;br /&gt;Why do i need to update VPS? Because i need to compile code in VPS. With the prepackaged VPS template, it does not include glibc-devel, gcc etc development tools.&lt;br /&gt;&lt;br /&gt;I have CentOS 4.4 CDs in hand. So, following is what i did.&lt;br /&gt;&lt;br /&gt;My first VPS ID is 101. &lt;br /&gt;&lt;br /&gt;At the very begining, i tried: root$vzyum 101 update. It just failed. I think it could be due to the slow internet connection or the yum repository is not available....&lt;br /&gt;&lt;br /&gt;So, i man yum and find that it could be update or install local packages. So i did the following: (cd current directory to the CD mounted directory)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$vzyum 101 update glibc-common-2.3.4-2.25.i386.rpm&lt;br /&gt;$vzyum 101 install gcc&lt;br /&gt;&lt;br /&gt;It works.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-3721724263742263387?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/3721724263742263387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=3721724263742263387' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/3721724263742263387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/3721724263742263387'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/03/update-vz-ops.html' title='update OpenVZ VPS'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-7763938559735066608</id><published>2007-03-30T07:47:00.000-07:00</published><updated>2007-03-30T07:51:56.743-07:00</updated><title type='text'>cd ripper</title><content type='html'>Cdparanoia is a Compact Disc Digital Audio (CDDA) extraction tool, commonly known on the net as a 'ripper'.  The application is built on top of the Paranoia library, which is doing the real work (the Paranoia source is included in the cdparanoia source distribution). Like the original cdda2wav, cdparanoia package reads audio from the CDROM directly as data, with no analog step between, and writes the data to a file or pipe in WAV, AIFC or raw 16 bit linear PCM.&lt;br /&gt;&lt;br /&gt;It only works on Linux.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-7763938559735066608?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/7763938559735066608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=7763938559735066608' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/7763938559735066608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/7763938559735066608'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/03/cd-ripper.html' title='cd ripper'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-352389519114866248.post-2268450787951894126</id><published>2007-03-28T23:24:00.000-07:00</published><updated>2007-03-28T23:54:19.178-07:00</updated><title type='text'>connect openoffice to postgresql database</title><content type='html'>OpenOffice is useful to view remote database server.&lt;br /&gt;&lt;br /&gt;First, create a database role to only view the remote database:&lt;br /&gt;(1)#create role peter login;&lt;br /&gt;(2)#alter role peter with password '12345';&lt;br /&gt;(3)#grant select on table tablename to peter;&lt;br /&gt;(4)modify pg_hba.conf file so that it includes line: (this line must be positioned so that it is the first to match for the connection request).&lt;br /&gt;   host    dbname      peter2     192.168.1.0/24          password&lt;br /&gt;(5)reload the configuration&lt;br /&gt;(6)test with psql -U peter -h hostip -W dbname&lt;br /&gt;&lt;br /&gt;Second, OpenOffice configuration:&lt;br /&gt;(1)Make sure Java (http://java.sun.com) is installed in the computer&lt;br /&gt;(2)Download &amp;amp; Install OpenOffice 2.x.&lt;br /&gt;(3)Download jdbc driver for PostgreSQL. (http://jdbc.postgresql.org)&lt;br /&gt;(4)Run OpenOffice. Navigate to: Tools--&gt;Options--&gt;Java. Select Java and set the CLASSPATH so that the CLASSPATH include the downloaded JDBC driver file. And ok.&lt;br /&gt;(5)Navigate: File--&gt;New--&gt;Database. Select :Connecting to an existing database by JDBC. And use jdbc:postgresql://databasehostip:5432/databasename as databaseURL and org.postgresql.Driver as JDBC driver class. And then type your database username and select "Password required".&lt;br /&gt;&lt;br /&gt;That is all.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/352389519114866248-2268450787951894126?l=littleball1.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://littleball1.blogspot.com/feeds/2268450787951894126/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=352389519114866248&amp;postID=2268450787951894126' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/2268450787951894126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/352389519114866248/posts/default/2268450787951894126'/><link rel='alternate' type='text/html' href='http://littleball1.blogspot.com/2007/03/connect-openoffice-to-postgresql.html' title='connect openoffice to postgresql database'/><author><name>Peter</name><uri>http://www.blogger.com/profile/12897993631310778918</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
