<?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-8137501636033288931</id><updated>2011-11-23T03:16:51.289-08:00</updated><category term='ruby'/><category term='linux'/><category term='scanner'/><category term='tools'/><category term='java'/><category term='commandos'/><category term='derby'/><category term='php'/><category term='Modell'/><category term='stuff'/><category term='perl'/><category term='tutorial'/><category term='ping'/><category term='hacking'/><category term='jface'/><category term='bash'/><category term='golang'/><category term='go'/><category term='book'/><category term='c'/><category term='regex'/><category term='socket'/><category term='base64'/><category term='Scala'/><category term='anonymous'/><category term='osgi'/><category term='RCP'/><category term='sql'/><category term='shell'/><category term='python'/><category term='kernel'/><category term='eclipse'/><category term='onestroke'/><category term='rcpciscat'/><category term='rcplinadmin'/><title type='text'>ComputingStuff</title><subtitle type='html'>all about go, ruby, python, perl, java, scala, osgi, RCP computing, network, hacking, security, encryption.  and other interesting stuff</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>87</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-4160062232582970424</id><published>2011-07-13T07:40:00.000-07:00</published><updated>2011-07-13T07:41:13.886-07:00</updated><title type='text'>moved to new name</title><content type='html'>hello this blog will be moved to &lt;br /&gt;&lt;br /&gt;&lt;a href="http://zombiecoding.blogspot.com"&gt;zombiecoding.blogspot.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-4160062232582970424?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/4160062232582970424/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2011/07/moved-to-new-name.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4160062232582970424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4160062232582970424'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2011/07/moved-to-new-name.html' title='moved to new name'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-5374502718322922377</id><published>2011-03-24T01:51:00.000-07:00</published><updated>2011-03-24T01:58:48.139-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hacking'/><title type='text'>HACKING: disable security</title><content type='html'>for testing some security stuff aka buffer overflows, you must disable security such as address randomization and stack execuation deactivation.&lt;br /&gt;&lt;br /&gt;simple as root do:&lt;br /&gt;&lt;br /&gt;echo "0" &gt; /proc/sys/kernel/randomize_va_space&lt;br /&gt;echo "0" &gt; /proc/sys/kernel/exec-shield&lt;br /&gt;echo "0" &gt; /proc/sys/kernel/exec-shield-randomize&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;next you must compile the application without stack execution dissable and stack protection for example. example for a gcc compilation flags (that help me to learn hacking):&lt;br /&gt;&lt;br /&gt;gcc -m32 -w -fno-pie -z norelro -fno-stack-protector -ggdb -z execstack -o myprog myprog.c&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;see my last article (the same stuff, but older)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://raycompstuff.blogspot.com/2010/09/hacks-tutorial-zero.html"&gt;http://raycompstuff.blogspot.com/2010/09/hacks-tutorial-zero.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;have fun&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-5374502718322922377?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/5374502718322922377/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2011/03/hacking-disable-security.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5374502718322922377'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5374502718322922377'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2011/03/hacking-disable-security.html' title='HACKING: disable security'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-186593802953974114</id><published>2011-03-24T01:42:00.000-07:00</published><updated>2011-03-24T01:43:54.231-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tools'/><title type='text'>CMD: import</title><content type='html'>schnell ein Screenshot von einem Fenster erstellen.&lt;br /&gt;&lt;br /&gt;import bild.png&lt;br /&gt;&lt;br /&gt;dann den Bereich mit Maus markieren, voila&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-186593802953974114?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/186593802953974114/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2011/03/cmd-import.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/186593802953974114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/186593802953974114'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2011/03/cmd-import.html' title='CMD: import'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-2235440988738217592</id><published>2011-01-14T06:39:00.000-08:00</published><updated>2011-01-14T06:41:08.456-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='onestroke'/><title type='text'>OneStroke One Stroke</title><content type='html'>Meine Schwester beschaeftigt sich mit One Stroke, OneStroke&lt;br /&gt;&lt;br /&gt;ist eine Maltechnik,  hier mache ich kleine Werbung auf ihre Homepage&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.onestrokegermany.de/"&gt;onestrokegermany&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.citegrenys.de/onestrokegermany/"&gt;one stroke germany&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-2235440988738217592?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/2235440988738217592/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2011/01/onestroke-one-stroke.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2235440988738217592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2235440988738217592'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2011/01/onestroke-one-stroke.html' title='OneStroke One Stroke'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-6606671770292232504</id><published>2010-12-09T00:08:00.001-08:00</published><updated>2010-12-09T00:09:02.608-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='anonymous'/><title type='text'>A Letter from Anonymous</title><content type='html'>"Those who deny freedom to others deserve it not for themselves."&lt;br /&gt;- Abraham Lincoln&lt;br /&gt;&lt;br /&gt;"He who sacrifices freedom for security deserves neither."&lt;br /&gt;– Benjamin Franklin&lt;br /&gt;&lt;br /&gt;Hello World. We are Anonymous. What you do or do not know about us is irrelevant. We have decided to write to you, the media, and all citizens of the free world at large to inform you of the message, our intentions, potential targets, and our ongoing peaceful campaign for freedom.&lt;br /&gt;&lt;br /&gt;"True, This! —&lt;br /&gt;Beneath the rule of men entirely great,&lt;br /&gt;The pen is mightier than the sword. Behold&lt;br /&gt;The arch-enchanters wand! — itself a nothing! —&lt;br /&gt;But taking sorcery from the master-hand&lt;br /&gt;To paralyse the Cæsars, and to strike&lt;br /&gt;The loud earth breathless! — Take away the sword —&lt;br /&gt;States can be saved without it!"&lt;br /&gt;&lt;br /&gt;- The Cardinal&lt;br /&gt;Richelieu; Or the Conspiracy by: Edward Bulwer-Lytton&lt;br /&gt;&lt;br /&gt;The message is simple: Freedom of Speech. Anonymous is peacefully campaigning for Freedom of Speech everywhere in all forms. Freedom of Speech for: The Internet, for journalism and journalists, and citizens of the world at large. Regardless of what you think or have to say; Anonymous is campaigning for you.&lt;br /&gt;The recent news of our campaigns has been, at best, misinformed. Anonymous is not always the same group of people. The Constitution of the United States is said to be a living document, because it can be edited, amended; changed at the will of the people to suit the peoples' needs. In that same vein, Anonymous is a living idea. Anonymous is an idea that can be edited, updated, remanded, changed on a whim. We are living consciousness. We are not a terrorist organization as governments, demagogues, and the media would have you believe. At this time Anonymous is a consciousness focused on campaigning peacefully for Freedom of Speech. We ask the world to support us, not for our sake, but for your own. When governments control freedom they control you. The Internet is the last bastion of freedom in this evolving technical world. The Internet is capable of connecting us all. When we are connected we are strong. When we are strong we have power. When we have power we are able to do the impossible. This is why the government is moving on Wikileaks. This is what they fear. They fear our power when we unite. Do not forget this.&lt;br /&gt;&lt;br /&gt;"...Now, we must all fear evil men. But there is another kind of evil which we must fear most, and that is the indifference of good men."&lt;br /&gt;- Monsignor, Boondock Saints&lt;br /&gt;&lt;br /&gt;Anonymous' intentions are very clear. We are not vigilantes, regardless of the sentiment of quoting Boondock Saints, we are people on a campaign for freedom. Anonymous' intentions are to change the current way the governments of the world and the people view true Freedom of Speech and The Internet. Anonymous is willing, ready, and able to campaign for the freedom for all. We are campaigning right now as you read the news, watch the television, fight with your&lt;br /&gt;significant other, love your children, hate your neighbor, criticize the man or woman next to you. We are campaigning. The goal is simple: Win the right to keep the Internet free of any control from any entity, corporation, or government. We will do this until our, proverbial, dying breath. We do this not only for our selves, but for the world and its people at large.&lt;br /&gt;&lt;br /&gt;"Truth is treason in the empire of lies."&lt;br /&gt;- Ron Paul&lt;br /&gt;&lt;br /&gt;Pay attention citizens, governments, and the world. Anonymous' peaceful campaign will focus on any organization, corporation, government, or entity until the Internet is truly free.&lt;br /&gt;Anonymous is doing what many successful campaigns have done in the past; a sit-in. It may be hard to comprehend, but a digital sit-in is our most effective method to show that all of us deserve Freedom of Speech and a free Internet. Our methods may appear, on the outside, to be cruel to those the entities that we are campaigning against, but remember buy supporting censorship they are denying everyone a basic human right. Any person, corporation, government, or miscellaneous entity that stops supporting censorship and starts promoting Freedom of Speech and a free Internet will become our allies. Anonymous, at this time, wants to persuade our counterparts rather than hurt them. We are campaigning for freedom for everyone, even the opposing side.&lt;br /&gt;Do not fear us. Anonymous' campaign does not intend to harm the individual citizen, any organizations, any websites, or government, that supports true freedom of speech. Anonymous' past is not our present. We are here for all of you; to campaign for all of you. Where others have made this promise and failed; we make this promise and aim to keep it for everyone.&lt;br /&gt;Anything attributed, credited, or tagged to Anonymous is not always what we do. We arenot always the same consciousness on a yearly, monthly, or even hourly basis. Do not believe everything you hear or read on the news. Anonymous is often credited with actions that are not campaigned for by Anonymous. The true core of Anonymous is here to help the free world for now. Anonymous wishes to represent the truth and ask that you as a citizen, media organization, or government do the same.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-6606671770292232504?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/6606671770292232504/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2010/12/letter-from-anonymous.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6606671770292232504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6606671770292232504'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2010/12/letter-from-anonymous.html' title='A Letter from Anonymous'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-8130098506184498942</id><published>2010-11-26T05:09:00.001-08:00</published><updated>2010-11-26T05:09:38.106-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='base64'/><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>GO BASE64: small stdin to stdout copy</title><content type='html'>&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt;  "encoding/base64";&lt;br /&gt;  "io";&lt;br /&gt;  "os";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;    e := base64.NewEncoder(base64.StdEncoding, os.Stdout)&lt;br /&gt;    io.Copy(e, os.Stdin)&lt;br /&gt;    e.Close()&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-8130098506184498942?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/8130098506184498942/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2010/11/go-base64-small-stdin-to-stdout-copy.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8130098506184498942'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8130098506184498942'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2010/11/go-base64-small-stdin-to-stdout-copy.html' title='GO BASE64: small stdin to stdout copy'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-7773073842734464786</id><published>2010-11-26T04:33:00.000-08:00</published><updated>2010-11-26T04:35:53.151-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>Go: GoClipse</title><content type='html'>GoClipse is an Eclipse plugin that adds IDE functionality to the Eclipse platform for the Go programming language. The purpose of GoClipse is to create an environment in which development of Go is easy for a beginner and has enough rich features to be attractive to an expert. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/goclipse/"&gt;GoClipse&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-7773073842734464786?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/7773073842734464786/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2010/11/go-goclipse.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7773073842734464786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7773073842734464786'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2010/11/go-goclipse.html' title='Go: GoClipse'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-2060552978916669676</id><published>2010-11-22T01:18:00.000-08:00</published><updated>2010-11-22T01:42:23.070-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tools'/><title type='text'>TOOLS: interesting tools</title><content type='html'>&lt;a href="http://freeworld.thc.org/thc-rut/"&gt;THC-RUT&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;is a tool for monitoring networks. It offers a wide range of network discovery utilities like arp lookup on an IP range, spoofed DHCP request, RARP, BOOTP, ICMP-ping, ICMP address mask request, OS fingerprinting, high-speed host discovery, ...&lt;br /&gt;&lt;br /&gt;thcrut arp 10.10.10.1-10.10.10.20 &lt;br /&gt;&lt;br /&gt;scan a network with arp-discovery.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://freshmeat.net/projects/arpalert/"&gt;ArpAlert&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;is a discovery tool for unauthorized request on MAC address. Some more info &lt;a href="http://linux.die.net/man/8/arpalert"&gt;manpage&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.earth.li/projectpurple/progs/sendip.html"&gt;SendIP&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;a packet generator (IPv4, IPv6, NTP, BGP, RIP, TCP, UDP, ICMP, ...). Some complex, but very usefull packet genrator (see &lt;a href="http://linux.die.net/man/1/sendip"&gt;manpage&lt;/a&gt;)&lt;br /&gt;Attention: the order of parameter is important to build correct packet ;) &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.torproject.org/"&gt;Tor&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;is an anonymous proxy. &lt;span style="font-style:italic;"&gt;Tor is a network of virtual tunnels that allows people and groups to improve their privacy and security on the Internet. It also enables software developers to create new communication tools with built-in privacy features. Tor provides the foundation for a range of applications that allow organizations and individuals to share information over public networks without compromising their privacy. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.zeroflux.org/projects/knock"&gt;Knock&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;knockd is a &lt;a href="http://en.wikipedia.org/wiki/Port_knocking"&gt;port-knock&lt;/a&gt; server. It listens to all traffic on an ethernet (or PPP) interface, looking for special "knock" sequences of port-hits. A client makes these port-hits by sending a TCP (or UDP) packet to a port on the server. This port need not be open -- since knockd listens at the link-layer level, it sees all traffic even if it's destined for a closed port. When the server detects a specific sequence of port-hits, it runs a command defined in its configuration file. This can be used to open up holes in a firewall for quick access.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-2060552978916669676?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/2060552978916669676/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2010/11/tools-interesting-tools.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2060552978916669676'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2060552978916669676'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2010/11/tools-interesting-tools.html' title='TOOLS: interesting tools'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-5603708627638762555</id><published>2010-11-19T07:37:00.000-08:00</published><updated>2010-11-19T07:51:34.103-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Modell'/><title type='text'>Qualitätskriterien für eine Theorie.</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Eleganz&lt;/span&gt;: Ein Modell sollte so möglich wie einfach sein.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Sparsamkeit&lt;/span&gt;: nur wenig willkürliche Elemente enthalten (nur die sich an Beobachtung anpassen)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Erklärungskraft&lt;/span&gt;: Daten und Beobachtungen sollten übereinstimmen und verständlich sein.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Vorhersagefähigkeit&lt;/span&gt;: Beobachtungen vorhersagen können.&lt;br /&gt;&lt;br /&gt;Das letzte trifft zurzeit nicht auf String Theorie. Aber abwarten.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-5603708627638762555?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/5603708627638762555/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2010/11/qualitatskriterien-fur-eine-theorie.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5603708627638762555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5603708627638762555'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2010/11/qualitatskriterien-fur-eine-theorie.html' title='Qualitätskriterien für eine Theorie.'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-8766694176348708821</id><published>2010-09-23T08:00:00.000-07:00</published><updated>2010-09-23T09:02:48.180-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hacking'/><title type='text'>HACKS: Tutorial Zero</title><content type='html'>The problem nowadays to learn buffer overflow is: &lt;br /&gt;- linux kernel has protection (va_randomize, exec_shield,...)&lt;br /&gt;- distribution has protection (armor, selinux, ...)&lt;br /&gt;- gcc has protection (stack canary, ...&lt;br /&gt;&lt;br /&gt;That is good, because it protect us. But bad for learning.&lt;br /&gt;&lt;br /&gt;To learn "buffer overflows" you must deactivate the protection&lt;br /&gt;&lt;br /&gt;some tips:&lt;br /&gt;&lt;br /&gt;to deactivate gcc protection:&lt;br /&gt;-fno-stack-protector&lt;br /&gt;-fnomudflap&lt;br /&gt;-D_FORTIFY_SOURCE=0&lt;br /&gt;gcc overflow.c -o overflow -fno-stack-protector&lt;br /&gt;gcc -fno-stack-protector -z execstack -o bug bug.c &lt;br /&gt;&lt;br /&gt;to deactivate kernel protection:&lt;br /&gt;echo "0" &gt; /proc/sys/kernel/randomize_va_space&lt;br /&gt;echo "0" &gt; /proc/sys/kernel/exec-shield&lt;br /&gt;echo "0" &gt; /proc/sys/kernel/exec-shield-randomize&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;info about &lt;a href="http://linux.die.net/man/8/execstack"&gt;execstack&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you look at the programm with objdump (objdump -x cmd):&lt;br /&gt;   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**3&lt;br /&gt;         filesz 0x0000000000000000 memsz 0x0000000000000000 flags&lt;span style="font-weight:bold;"&gt; rw-&lt;/span&gt;&lt;br /&gt;The stack is not executable!&lt;br /&gt;&lt;br /&gt;you can do it executable with&lt;br /&gt;gcc -fno-stack-protector -z execstack -o bug bug.c &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you want to learn heap or bss overflow you must do them executable too.&lt;br /&gt; DYNAMIC off    0x0000000000000e40 vaddr 0x0000000000600e40 paddr 0x0000000000600e40 align 2**3&lt;br /&gt;         filesz 0x00000000000001a0 memsz 0x00000000000001a0 flags &lt;span style="font-weight:bold;"&gt;rw-&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-8766694176348708821?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/8766694176348708821/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2010/09/hacks-tutorial-zero.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8766694176348708821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8766694176348708821'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2010/09/hacks-tutorial-zero.html' title='HACKS: Tutorial Zero'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-292696781648014814</id><published>2010-09-15T01:49:00.000-07:00</published><updated>2010-09-15T01:53:18.413-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>run Linux in Windows</title><content type='html'>there is a possibility to run Linux in a Windows environment. No partition, no extra linux on disk. You can install your linux in windows partition (ntfs, fat?) and start it running windows. No reboot anymore. Ok I virtually don't need it, because I use only linux (have any windows).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;But here are the link:  &lt;a href="http://www.andlinux.org/"&gt;andLinux&lt;/a&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;andLinux based on coLinux.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.colinux.org/"&gt;coLinux&lt;/a&gt;,   &lt;a href="http://www.ulteo.com/home/de/download"&gt;ulteo Desktop&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-292696781648014814?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/292696781648014814/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2010/09/run-linux-in-windows.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/292696781648014814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/292696781648014814'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2010/09/run-linux-in-windows.html' title='run Linux in Windows'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-2067979623362505687</id><published>2009-12-14T05:39:00.001-08:00</published><updated>2009-12-14T06:10:50.475-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>simpler chat server and client in golang</title><content type='html'>&lt;span style="font-weight:bold;"&gt;server:&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt;    "fmt";&lt;br /&gt;    "net";&lt;br /&gt;    "log";&lt;br /&gt;    "os";&lt;br /&gt;    "container/list";&lt;br /&gt;    "strings";&lt;br /&gt;    "bytes";&lt;br /&gt;    "flag";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;// flag for debuging info. or a simple log&lt;br /&gt;var debug = flag.Bool("d", false, "set the debug modus( print informations )")&lt;br /&gt;&lt;br /&gt;type ClientChat struct {&lt;br /&gt;    Name string;        // name of user&lt;br /&gt;    IN chan string;     // input channel for to send to user&lt;br /&gt;    OUT chan string;    // input channel from user to all&lt;br /&gt;    Con *net.Conn;      // connection of client&lt;br /&gt;    Quit chan bool;     // quit channel for all goroutines&lt;br /&gt;    ListChain *list.List;    // reference to list&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// read from connection and return true if ok&lt;br /&gt;func (c *ClientChat) Read(buf []byte) bool{&lt;br /&gt;    nr, err := c.Con.Read(buf);&lt;br /&gt;    if err!=nil {&lt;br /&gt;        c.Close();&lt;br /&gt;        return false;&lt;br /&gt;    }&lt;br /&gt;    Log("Read():  ", nr, " bytes");&lt;br /&gt;    return true;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// close the connection and send quit to sender&lt;br /&gt;func (c *ClientChat) Close() {&lt;br /&gt;    c.Quit&lt;-true;&lt;br /&gt;    c.Con.Close();&lt;br /&gt;    c.deleteFromList();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// compare two clients: name and network connection&lt;br /&gt;func (c *ClientChat) Equal(cl *ClientChat) bool {&lt;br /&gt;    if bytes.Equal(strings.Bytes(c.Name), strings.Bytes(cl.Name)) {&lt;br /&gt;        if c.Con == cl.Con {&lt;br /&gt;            return true;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    return false;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// delete the client from list&lt;br /&gt;func (c *ClientChat) deleteFromList() {&lt;br /&gt;    for e := c.ListChain.Front(); e != nil; e = e.Next() {&lt;br /&gt;        client := e.Value.(ClientChat);&lt;br /&gt;        if c.Equal(&amp;client) {&lt;br /&gt;            Log("deleteFromList(): ", c.Name);&lt;br /&gt;            c.ListChain.Remove(e);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// func Log(v ...): loging. give log information if debug is true&lt;br /&gt;func Log(v ...) {&lt;br /&gt;    if *debug == true {&lt;br /&gt;        ret := fmt.Sprint(v);&lt;br /&gt;        log.Stdoutf("SERVER: %s", ret);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// func test(): testing for error&lt;br /&gt;func test(err os.Error, mesg string) {&lt;br /&gt;    if err!=nil {&lt;br /&gt;        log.Stderr("SERVER: ERROR: ", mesg);&lt;br /&gt;         os.Exit(-1);&lt;br /&gt;    } else&lt;br /&gt;        Log("Ok: ", mesg);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// handlingINOUT(): handle inputs from client, and send it to all other client via channels.&lt;br /&gt;func handlingINOUT(IN &lt;-chan string, lst *list.List) {&lt;br /&gt;    for {&lt;br /&gt;        Log("handlingINOUT(): wait for input");&lt;br /&gt;        input := &lt;-IN;  // input, get from client&lt;br /&gt;        // send to all client back&lt;br /&gt;        Log("handlingINOUT(): handling input: ", input);&lt;br /&gt;        for value := range lst.Iter() {&lt;br /&gt;            client := value.(ClientChat);&lt;br /&gt;            Log("handlingINOUT(): send to client: ", client.Name);&lt;br /&gt;            client.IN&lt;- input;&lt;br /&gt;        }  &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// clientreceiver wait for an input from network, after geting data it send to&lt;br /&gt;// handlingINOUT via a channel.&lt;br /&gt;func clientreceiver(client *ClientChat) {&lt;br /&gt;    buf := make([]byte, 2048);&lt;br /&gt;&lt;br /&gt;    Log("clientreceiver(): start for: ", client.Name);&lt;br /&gt;    for client.Read(buf) {&lt;br /&gt;        &lt;br /&gt;        if bytes.Equal(buf, strings.Bytes("/quit")) {&lt;br /&gt;            client.Close();&lt;br /&gt;            break;&lt;br /&gt;        }&lt;br /&gt;        Log("clientreceiver(): received from ",client.Name, " (", string(buf), ")");&lt;br /&gt;        send := client.Name+"&gt; "+string(buf);&lt;br /&gt;        client.OUT&lt;- send;&lt;br /&gt;        for i:=0; i&lt;2048;i++ {&lt;br /&gt;            buf[i]=0x00;&lt;br /&gt;        }&lt;br /&gt;    }    &lt;br /&gt;&lt;br /&gt;    client.OUT &lt;- client.Name+" has left chat";&lt;br /&gt;    Log("clientreceiver(): stop for: ", client.Name);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// clientsender(): get the data from handlingINOUT via channel (or quit signal from&lt;br /&gt;// clientreceiver) and send it via network&lt;br /&gt;func clientsender(client *ClientChat) {&lt;br /&gt;    Log("clientsender(): start for: ", client.Name);&lt;br /&gt;    for {&lt;br /&gt;        Log("clientsender(): wait for input to send");&lt;br /&gt;        select {&lt;br /&gt;            case buf := &lt;- client.IN:&lt;br /&gt;                Log("clientsender(): send to \"", client.Name, "\": ", string(buf));&lt;br /&gt;                client.Con.Write(strings.Bytes(buf));&lt;br /&gt;            case &lt;-client.Quit:&lt;br /&gt;                Log("clientsender(): client want to quit");&lt;br /&gt;                client.Con.Close();&lt;br /&gt;                break;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    Log("clientsender(): stop for: ", client.Name);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// clientHandling(): get the username and create the clientsturct&lt;br /&gt;// start the clientsender/receiver, add client to list.&lt;br /&gt;func clientHandling(con *net.Conn, ch chan string, lst *list.List) {&lt;br /&gt;    buf := make([]byte, 1024);&lt;br /&gt;    con.Read(buf);&lt;br /&gt;    name := string(buf);&lt;br /&gt;    newclient := &amp;ClientChat{name, make(chan string), ch, con, make(chan bool), lst};&lt;br /&gt;&lt;br /&gt;    Log("clientHandling(): for ", name);&lt;br /&gt;    go clientsender(newclient);&lt;br /&gt;    go clientreceiver(newclient);&lt;br /&gt;    lst.PushBack(*newclient);&lt;br /&gt;    ch&lt;- name+" has joinet the chat";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;    flag.Parse();&lt;br /&gt;    Log("main(): start");&lt;br /&gt;&lt;br /&gt;    // create the list of clients&lt;br /&gt;    clientlist := list.New();&lt;br /&gt;    in := make(chan string);&lt;br /&gt;    Log("main(): start handlingINOUT()");&lt;br /&gt;    go handlingINOUT(in, clientlist);&lt;br /&gt;    &lt;br /&gt;    // create the connection&lt;br /&gt;    netlisten, err := net.Listen("tcp", "127.0.0.1:9988");&lt;br /&gt;    test(err, "main Listen");&lt;br /&gt;    defer netlisten.Close();&lt;br /&gt;&lt;br /&gt;    for {&lt;br /&gt;        // wait for clients&lt;br /&gt;        Log("main(): wait for client ...");&lt;br /&gt;        conn, err := netlisten.Accept();&lt;br /&gt;        test(err, "main: Accept for client");&lt;br /&gt;        go clientHandling(&amp;conn, in, clientlist);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Server has three part which are running as goroutines and communicate via channels.&lt;br /&gt;1) handlingINOUT() simple wait for input of clientreceiver() and send to all clientsender() which are in the list.&lt;br /&gt;2) clientreceiver() wait for his data from client via networkconnection and send it to a inputchannel to handlingINOUT&lt;br /&gt;3) clientsender() wait for data from channel and send it to client&lt;br /&gt;&lt;br /&gt;every client connection get a his own clientreceiver/sender and a list entry. on disconnection the list entry will be deleted.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;client:&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt;    "fmt";&lt;br /&gt;    "net";&lt;br /&gt;    "log";&lt;br /&gt;    "os";&lt;br /&gt;    "bytes";&lt;br /&gt;    "bufio";&lt;br /&gt;    "strings";&lt;br /&gt;    "time";&lt;br /&gt;    "flag";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;var running bool;  // global variable if client is running&lt;br /&gt;&lt;br /&gt;var debug = flag.Bool("d", false, "set the debug modus( print informations )")&lt;br /&gt;&lt;br /&gt;// func Log(v ...): loging. give log information if debug is true&lt;br /&gt;func Log(v ...) {&lt;br /&gt;    if *debug == true {&lt;br /&gt;        ret := fmt.Sprint(v);&lt;br /&gt;        log.Stdoutf("CLIENT: %s", ret);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// func test(): testing for error&lt;br /&gt;func test(err os.Error, mesg string) {&lt;br /&gt;    if err!=nil {&lt;br /&gt;        log.Stderr("CLIENT: ERROR: ", mesg);&lt;br /&gt;         os.Exit(-1);&lt;br /&gt;    } else&lt;br /&gt;        Log("Ok: ", mesg);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// read from connection and return true if ok&lt;br /&gt;func Read(con *net.Conn) string{&lt;br /&gt;    var buf [4048]byte;&lt;br /&gt;    _, err := con.Read(&amp;buf);&lt;br /&gt;    if err!=nil {&lt;br /&gt;        con.Close();&lt;br /&gt;        running=false;&lt;br /&gt;        return "Error in reading!";&lt;br /&gt;    }&lt;br /&gt;    str := string(&amp;buf);&lt;br /&gt;    fmt.Println();&lt;br /&gt;    return string(str);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// clientsender(): read from stdin and send it via network&lt;br /&gt;func clientsender(cn *net.Conn) {&lt;br /&gt;    reader := bufio.NewReader(os.Stdin);&lt;br /&gt;    for {&lt;br /&gt;        fmt.Print("you&gt; ");&lt;br /&gt;        input, _ := reader.ReadBytes('\n');&lt;br /&gt;        if bytes.Equal(input, strings.Bytes("/quit\n")) {&lt;br /&gt;            cn.Write(strings.Bytes("/quit"));&lt;br /&gt;            running = false;&lt;br /&gt;            break;&lt;br /&gt;        }&lt;br /&gt;        Log("clientsender(): send: ", string(input[0:len(input)-1]));&lt;br /&gt;        cn.Write(input[0:len(input)-1]);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// clientreceiver(): wait for input from network and print it out&lt;br /&gt;func clientreceiver(cn *net.Conn) {&lt;br /&gt;    for running {&lt;br /&gt;        fmt.Println(Read(cn));&lt;br /&gt;        fmt.Print("you&gt; ");&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;    flag.Parse();&lt;br /&gt;    running = true;&lt;br /&gt;    Log("main(): start ");&lt;br /&gt;    &lt;br /&gt;    // connect&lt;br /&gt;    destination := "127.0.0.1:9988";&lt;br /&gt;    Log("main(): connecto to ", destination);&lt;br /&gt;    cn, err := net.Dial("tcp", "", destination);&lt;br /&gt;    test(err, "dialing");&lt;br /&gt;    defer cn.Close();&lt;br /&gt;    Log("main(): connected ");&lt;br /&gt;&lt;br /&gt;    // get the user name&lt;br /&gt;    fmt.Print("Please give you name: ");&lt;br /&gt;    reader := bufio.NewReader(os.Stdin);&lt;br /&gt;    name, _ := reader.ReadBytes('\n');&lt;br /&gt;&lt;br /&gt;    //cn.Write(strings.Bytes("User: "));&lt;br /&gt;    cn.Write(name[0:len(name)-1]);&lt;br /&gt;&lt;br /&gt;    // start receiver and sender&lt;br /&gt;    Log("main(): start receiver");&lt;br /&gt;    go clientreceiver(&amp;cn);&lt;br /&gt;    Log("main(): start sender");&lt;br /&gt;    go clientsender(&amp;cn);&lt;br /&gt;    &lt;br /&gt;    // wait for quiting (/quit). run until running is true&lt;br /&gt;    for ;running; {&lt;br /&gt;        time.Sleep(1*1e9);&lt;br /&gt;    }&lt;br /&gt;    Log("main(): stoped");&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;client start two goroutines: for getting input from stdin and send it to network. and get from network and print it out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-2067979623362505687?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/2067979623362505687/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/12/simpler-chat-server-and-client-in.html#comment-form' title='3 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2067979623362505687'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2067979623362505687'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/12/simpler-chat-server-and-client-in.html' title='simpler chat server and client in golang'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-2331386633299357182</id><published>2009-12-11T06:15:00.000-08:00</published><updated>2009-12-11T06:46:31.883-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>simple server/client</title><content type='html'>a simple server and client in golang.&lt;br /&gt;&lt;br /&gt;server wait for a client and handle him, simple read and write, then close.&lt;br /&gt;&lt;br /&gt;client connect to server, write then read to/from server.&lt;br /&gt;&lt;br /&gt;server:&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt;    . "fmt";&lt;br /&gt;    "net";&lt;br /&gt;    "os"; "log";&lt;br /&gt;    "strings";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;func test(err os.Error, mesg string) {&lt;br /&gt;    if err!=nil {&lt;br /&gt;        log.Stderr("SERVER: ERROR: ", mesg);&lt;br /&gt;         os.Exit(-1);&lt;br /&gt;    } else&lt;br /&gt;        log.Stdout("SERVER: OK: ", mesg);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;    buf := make([] byte, 1500);&lt;br /&gt;&lt;br /&gt;    Println("starting server...");&lt;br /&gt;&lt;br /&gt;    netlisten, err := net.Listen("tcp", "127.0.0.1:9988");&lt;br /&gt;    test(err, "Listen");&lt;br /&gt;    defer netlisten.Close();&lt;br /&gt;    &lt;br /&gt;    for{&lt;br /&gt;        Println("server wait for client ...");&lt;br /&gt;        con, err := netlisten.Accept();&lt;br /&gt;        test(err, "Accept for client");&lt;br /&gt;        Println("client has connect to server");&lt;br /&gt;&lt;br /&gt;        con.Read(buf);&lt;br /&gt;           &lt;br /&gt;        Println("readed: ", string(buf));&lt;br /&gt;&lt;br /&gt;        con.Write(strings.Bytes("response from server"));&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;client: &lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt;    . "fmt";&lt;br /&gt;    "net";&lt;br /&gt;    "os"; "log";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;func test(err os.Error, mesg string) {&lt;br /&gt;    if err!=nil {&lt;br /&gt;        log.Stderr("CLIENT: ERROR: ", mesg);&lt;br /&gt;         os.Exit(-1);&lt;br /&gt;    } else&lt;br /&gt;        log.Stdout("CLIENT: OK: ", mesg);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;    buf := make([] byte, 1500);&lt;br /&gt;&lt;br /&gt;    Println("starting client");&lt;br /&gt;    con, err := net.Dial("tcp", "", "127.0.0.1:9988");&lt;br /&gt;    test(err, "dialing");&lt;br /&gt;    defer con.Close();&lt;br /&gt;    Println("client has connected to server");&lt;br /&gt;    &lt;br /&gt;    con.Write(strings.Bytes("das ist ein test"));&lt;br /&gt;&lt;br /&gt;    con.Read(buf);&lt;br /&gt;           &lt;br /&gt;    Println("readed: ", string(buf));&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-2331386633299357182?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/2331386633299357182/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/12/simple-serverclient.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2331386633299357182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2331386633299357182'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/12/simple-serverclient.html' title='simple server/client'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-3726153523860071325</id><published>2009-12-10T02:15:00.001-08:00</published><updated>2009-12-10T02:15:26.286-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>Golang: crypto/aes</title><content type='html'>Here we test the golang aes encryption decryption. We simple encrypt and decrypt a text message with AES-128. That is a key with 16 byte length.&lt;br /&gt;&lt;br /&gt;"NewCipher creates and returns a new Cipher. The key argument should be the AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256."&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt;    "crypto/aes";&lt;br /&gt;    . "fmt";&lt;br /&gt;    "os";&lt;br /&gt;    "strings";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;    // a 32 byte long message&lt;br /&gt;    msg := "This is long message text. len32";&lt;br /&gt;    // some key, 16 Byte long&lt;br /&gt;    key := []byte{0x2c, 0x88, 0x25, 0x1a, 0xaa, 0xae, 0xc2, 0xa2, 0xaf, 0xe7, 0x84, 0x8a, 0x10, 0xcf, 0xe3, 0x2a};&lt;br /&gt;&lt;br /&gt;    Println("len of message: ", len(msg));&lt;br /&gt;    Println("len of key: ", len(key));&lt;br /&gt;    // create the new cipher&lt;br /&gt;    c, err := aes.NewCipher(key);&lt;br /&gt;    if err != nil {&lt;br /&gt;   Println("Error: NewCipher(%d bytes) = %s", len(key), err);&lt;br /&gt;   os.Exit(-1);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;    // now we convert our string into 32 long byte array&lt;br /&gt;    msgbuf := strings.Bytes(msg);&lt;br /&gt;    out := make([]byte, len(msg));&lt;br /&gt;     &lt;br /&gt;    c.Encrypt(msgbuf[0:16], out[0:16]);   // encrypt the first half&lt;br /&gt;    c.Encrypt(msgbuf[16:32], out[16:32]); // encrypt the second half&lt;br /&gt;&lt;br /&gt;    Println("len of encrypted: ", len(out));&lt;br /&gt;    Println("&gt;&gt; ", out);&lt;br /&gt;&lt;br /&gt;    // now we decrypt our encrypted text&lt;br /&gt;    plain := make([]byte, len(out));&lt;br /&gt;    c.Decrypt(out[0:16], plain[0:16]);   // decrypt the first half&lt;br /&gt;    c.Decrypt(out[16:32], plain[16:32]); // decrypt the second half&lt;br /&gt;&lt;br /&gt;    Println("msg: ", string(plain));&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;output:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;len of message:  32&lt;br /&gt;len of key:  16&lt;br /&gt;len of encrypted:  32&lt;br /&gt;&gt;&gt;  [0 173 125 174 152 165 226 181 32 25 196 177 81 243 134 79 55 152 215 72 239 85 123 219 82 30 231 89 185 194 67 203]&lt;br /&gt;msg:  This is long message text. len32&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-3726153523860071325?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/3726153523860071325/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/12/golang-cryptoaes.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/3726153523860071325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/3726153523860071325'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/12/golang-cryptoaes.html' title='Golang: crypto/aes'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-8759670984793715884</id><published>2009-12-09T01:10:00.001-08:00</published><updated>2009-12-09T03:28:44.221-08:00</updated><title type='text'>Container in Go: ring</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Ring:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A Ring is an element of a circular list, or ring. Rings do not have a beginning or end; a pointer to any ring element serves as reference to the entire ring. Empty rings are represented as nil Ring pointers. The zero value for a Ring is a one-element ring with a nil Value.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt;  . "fmt";&lt;br /&gt;  "container/ring";&lt;br /&gt;  "strings";&lt;br /&gt;  "bytes";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;// print the elements of the ring &lt;br /&gt;func PrintRing(r *ring.Ring) {&lt;br /&gt;  Println("------------------------------");&lt;br /&gt;  for value := range r.Iter() {&lt;br /&gt;    Println("value: ", value);&lt;br /&gt;  }&lt;br /&gt;  Println("------------------------------");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;  // create a new ring with 10 items&lt;br /&gt;  r := ring.New(10);&lt;br /&gt;&lt;br /&gt;  Println("len of ring: ", r.Len());&lt;br /&gt;  PrintRing(r);&lt;br /&gt;&lt;br /&gt;  // set some value&lt;br /&gt;  r.Value = "value 1";&lt;br /&gt;  // take the next&lt;br /&gt;  &lt;br /&gt;  r = r.Next();&lt;br /&gt;  r.Value = "value 2";&lt;br /&gt;&lt;br /&gt;  r = r.Next();&lt;br /&gt;  r.Value = "value 3";&lt;br /&gt;&lt;br /&gt;  r = r.Next();&lt;br /&gt;  r.Value = "value 4";&lt;br /&gt;&lt;br /&gt;  PrintRing(r);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  // create a second ring with 3 item and set his value&lt;br /&gt;  r2 := ring.New(3);&lt;br /&gt;  r2.Value = "r2 value 1";&lt;br /&gt;  r2 = r2.Next();&lt;br /&gt;  r2.Value = "r2 value 2";&lt;br /&gt;  r2 = r2.Next();&lt;br /&gt;  r2.Value = "r2 value 3";&lt;br /&gt;  PrintRing(r2);&lt;br /&gt;&lt;br /&gt;  // merge ring2 into ring 1&lt;br /&gt;  r = r.Link(r2);&lt;br /&gt;  PrintRing(r);&lt;br /&gt;&lt;br /&gt;  // remove a value in ring&lt;br /&gt;  for p:=r.Next(); p!=r; p=p.Next() {&lt;br /&gt;    if p.Value != nil {&lt;br /&gt;      value := p.Value.(string);&lt;br /&gt;      if bytes.Equal(strings.Bytes(value),strings.Bytes("r2 value 2")) {&lt;br /&gt;        p.Value=nil;&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  PrintRing(r);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;output:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;len of ring:  10&lt;br /&gt;------------------------------&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;------------------------------&lt;br /&gt;------------------------------&lt;br /&gt;value:  value 4&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  value 1&lt;br /&gt;value:  value 2&lt;br /&gt;value:  value 3&lt;br /&gt;------------------------------&lt;br /&gt;------------------------------&lt;br /&gt;value:  r2 value 3&lt;br /&gt;value:  r2 value 1&lt;br /&gt;value:  r2 value 2&lt;br /&gt;------------------------------&lt;br /&gt;------------------------------&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  value 1&lt;br /&gt;value:  value 2&lt;br /&gt;value:  value 3&lt;br /&gt;value:  value 4&lt;br /&gt;value:  r2 value 3&lt;br /&gt;value:  r2 value 1&lt;br /&gt;value:  r2 value 2&lt;br /&gt;------------------------------&lt;br /&gt;------------------------------&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;value:  value 1&lt;br /&gt;value:  value 2&lt;br /&gt;value:  value 3&lt;br /&gt;value:  value 4&lt;br /&gt;value:  r2 value 3&lt;br /&gt;value:  r2 value 1&lt;br /&gt;value:  &lt;nil&gt;&lt;br /&gt;------------------------------&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-8759670984793715884?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/8759670984793715884/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/12/container-in-go-ring.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8759670984793715884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8759670984793715884'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/12/container-in-go-ring.html' title='Container in Go: ring'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-3269786167397978951</id><published>2009-12-07T01:32:00.000-08:00</published><updated>2009-12-09T01:10:14.969-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>Container in Go: list</title><content type='html'>&lt;span style="font-weight:bold;"&gt;List&lt;/span&gt;: (a doubly linked list)&lt;br /&gt;&lt;br /&gt;The list is a double linked list of Elements. Element is an element in the linked list with Next() and Prev() pointer to other elements. Begining and ending of Elements are nil. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt;  . "fmt";&lt;br /&gt;  "container/list";&lt;br /&gt;  "strings";&lt;br /&gt;  "bytes";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;// print the elements of the list &lt;br /&gt;func PrintList(l *list.List) {&lt;br /&gt;  Println("------------------------------");&lt;br /&gt;  for value := range l.Iter() {&lt;br /&gt;    Println("element: ", value);&lt;br /&gt;  }&lt;br /&gt;  Println("------------------------------");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;  // create a new list&lt;br /&gt;  li := list.New();&lt;br /&gt;&lt;br /&gt;  // add elements at end&lt;br /&gt;  li.PushBack("list1");&lt;br /&gt;  li.PushBack("list2");&lt;br /&gt;&lt;br /&gt;  // add elements at begining&lt;br /&gt;  li.PushFront("list3");&lt;br /&gt;  &lt;br /&gt;  PrintList(li);&lt;br /&gt;&lt;br /&gt;  // get the first element from the list&lt;br /&gt;  element := li.Front();&lt;br /&gt;  str := element.Value;&lt;br /&gt;  Println("value: ", str);&lt;br /&gt;&lt;br /&gt;  // add a element before the first element&lt;br /&gt;  li.InsertBefore("list4", element);&lt;br /&gt;&lt;br /&gt;  // add after the element&lt;br /&gt;  li.InsertAfter("list5", element);&lt;br /&gt;&lt;br /&gt;  PrintList(li);&lt;br /&gt;&lt;br /&gt;  // get the next element&lt;br /&gt;  element = element.Next();&lt;br /&gt;  Println("value: ", element.Value);&lt;br /&gt;&lt;br /&gt;  // move the first element to back&lt;br /&gt;  element = li.Front();&lt;br /&gt;  li.MoveToBack(element);&lt;br /&gt;&lt;br /&gt;  PrintList(li);&lt;br /&gt;&lt;br /&gt;  // remove the first element&lt;br /&gt;  element = li.Front();&lt;br /&gt;  li.Remove(element);&lt;br /&gt;&lt;br /&gt;  PrintList(li);&lt;br /&gt;  &lt;br /&gt;  // find the element with "list2" and remove it&lt;br /&gt;  for element := li.Front(); element != nil; element = element.Next() {&lt;br /&gt;  // don't use li.Iter(), because the interface chanel &lt;br /&gt;  // is geting the Value from the element back. not the element.&lt;br /&gt;    value := element.Value.(string);&lt;br /&gt;&lt;br /&gt;    if bytes.Equal(strings.Bytes(value),strings.Bytes("list2")) {&lt;br /&gt;      li.Remove(element);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  PrintList(li);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;the output is:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;------------------------------&lt;br /&gt;element:  list3&lt;br /&gt;element:  list1&lt;br /&gt;element:  list2&lt;br /&gt;------------------------------&lt;br /&gt;value:  list3&lt;br /&gt;------------------------------&lt;br /&gt;element:  list4&lt;br /&gt;element:  list3&lt;br /&gt;element:  list5&lt;br /&gt;element:  list1&lt;br /&gt;element:  list2&lt;br /&gt;------------------------------&lt;br /&gt;value:  list5&lt;br /&gt;------------------------------&lt;br /&gt;element:  list3&lt;br /&gt;element:  list5&lt;br /&gt;element:  list1&lt;br /&gt;element:  list2&lt;br /&gt;element:  list4&lt;br /&gt;------------------------------&lt;br /&gt;------------------------------&lt;br /&gt;element:  list5&lt;br /&gt;element:  list1&lt;br /&gt;element:  list2&lt;br /&gt;element:  list4&lt;br /&gt;------------------------------&lt;br /&gt;------------------------------&lt;br /&gt;element:  list5&lt;br /&gt;element:  list1&lt;br /&gt;element:  list4&lt;br /&gt;------------------------------&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-3269786167397978951?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/3269786167397978951/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/12/container-in-go-heap-list-ring-vector.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/3269786167397978951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/3269786167397978951'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/12/container-in-go-heap-list-ring-vector.html' title='Container in Go: list'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-2200831585279497099</id><published>2009-11-30T06:57:00.000-08:00</published><updated>2009-11-30T07:01:03.647-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>misunderstanding on casting in go</title><content type='html'>huch, have needed one day to understand that a function is in really was a cast.&lt;br /&gt;look:&lt;br /&gt;path.Walk(p.String(), pathIter(c), nil);&lt;br /&gt;&lt;br /&gt;you can think pathIter(c) is a function. but:&lt;br /&gt;&lt;br /&gt;type pathIter chan&lt;- Path&lt;br /&gt;&lt;br /&gt;pathIter is a typedefinition. Therefore is pathIter(c) not a function with parameter c, rahter a casting from c (is a Path channel) to pathIter.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-2200831585279497099?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/2200831585279497099/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/misunderstanding-on-casting-in-go.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2200831585279497099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2200831585279497099'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/misunderstanding-on-casting-in-go.html' title='misunderstanding on casting in go'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-6667349372288879324</id><published>2009-11-29T14:18:00.001-08:00</published><updated>2009-11-30T06:10:13.757-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>input from stdion in go</title><content type='html'>&lt;pre&gt;&lt;code&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt;    "os"; "fmt"; "bufio";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;&lt;br /&gt;    fmt.Print("input your name: ");&lt;br /&gt;&lt;br /&gt;    br := bufio.NewReader(os.Stdin);&lt;br /&gt;&lt;br /&gt;    name, _ := br.ReadString('\n');&lt;br /&gt;&lt;br /&gt;    fmt.Println();&lt;br /&gt;    fmt.Println("your name is: ", name);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;func NewReader(rd io.Reader) *Reader&lt;/i&gt; NewReader returns a new Reader whose buffer has the default size. &lt;br /&gt;&lt;br /&gt;&lt;i&gt;func (b *Reader) ReadString(delim byte) (line string, err os.Error)&lt;/i&gt; read until delim byte.&lt;br /&gt;here we read until enter.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-6667349372288879324?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/6667349372288879324/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/input-from-stdion-in-go.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6667349372288879324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6667349372288879324'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/input-from-stdion-in-go.html' title='input from stdion in go'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-6115905415456378072</id><published>2009-11-28T04:00:00.000-08:00</published><updated>2009-11-28T04:05:06.631-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>urlescap in http</title><content type='html'>&lt;pre&gt;&lt;br /&gt;  url := "http://blub.org/b.html?v1=23&amp;v2=bla&amp;v=sdl+sdo";&lt;br /&gt;  surl := http.URLEscape(url);&lt;br /&gt;&lt;br /&gt;  fmt.Println(url);&lt;br /&gt;  fmt.Println(surl);&lt;br /&gt;&lt;br /&gt;  url2 := "http://это.порусс.ки/здесь.хтмл";&lt;br /&gt;  surl2 := http.URLEscape(url2);&lt;br /&gt;&lt;br /&gt;  fmt.Println(url2);&lt;br /&gt;  fmt.Println(surl2);&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;output:&lt;br /&gt;&lt;pre&gt;http://blub.org/b.html?v1=23&amp;v2=bla&amp;v=sdl+sdo&lt;br /&gt;http://blub.org/b.html%3fv1%3d23%26v2%3dbla%26v%3dsdl%2bsdo&lt;br /&gt;&lt;br /&gt;http://это.порусс.ки/здесь.хтмл&lt;br /&gt;http://%d1%8d%d1%82%d0%be.%d0%bf%d0%be%d1%80%d1%83%d1%81%d1%81.%d0%ba%d0%b8/%d0%b7%d0%b4%d0%b5%d1%81%d1%8c.%d1%85%d1%82%d0%bc%d0%bb&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;http.URLUnescape(url string) do it back.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-6115905415456378072?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/6115905415456378072/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/urlescap-in-http.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6115905415456378072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6115905415456378072'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/urlescap-in-http.html' title='urlescap in http'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-5503283475003924156</id><published>2009-11-28T03:23:00.001-08:00</published><updated>2009-11-28T03:23:49.027-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>read a file and print the count of lines</title><content type='html'>&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt;  "io";&lt;br /&gt;  "fmt";&lt;br /&gt;  "os";&lt;br /&gt;  "strings";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;  // read the file in bytes array&lt;br /&gt;  b, err := io.ReadFile("readfile.go");&lt;br /&gt;  if err!=nil {&lt;br /&gt;    fmt.Println("error on read file");&lt;br /&gt;    os.Exit(-1);&lt;br /&gt;  } &lt;br /&gt;  &lt;br /&gt;  // convert from bytes to string&lt;br /&gt;  strbuffer := string(b);&lt;br /&gt;&lt;br /&gt;  // split into lines&lt;br /&gt;  lines := strings.Split(strbuffer, "\n", 0);&lt;br /&gt;&lt;br /&gt;  // iterate each&lt;br /&gt;  for i, line := range lines {&lt;br /&gt;    fmt.Printf("%d:  %s\n", i, line);&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-5503283475003924156?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/5503283475003924156/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/read-file-and-print-count-of-lines.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5503283475003924156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5503283475003924156'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/read-file-and-print-count-of-lines.html' title='read a file and print the count of lines'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-2431324676177725848</id><published>2009-11-27T08:16:00.000-08:00</published><updated>2009-11-27T08:18:17.048-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>strings package in golang</title><content type='html'>&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt;  "strings";&lt;br /&gt;  "fmt";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;  data := "bla blu blub";&lt;br /&gt;  fmt.Println(data);&lt;br /&gt;  // return: bla blu blub&lt;br /&gt;  &lt;br /&gt;  // convert string in bytes &lt;br /&gt;  b := strings.Bytes(data);&lt;br /&gt;  fmt.Println(b);  // print every byte as array&lt;br /&gt;  // return: [98 108 97 32 98 108 117 32 98 108 117 98]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  // test if the string begin with the prefix&lt;br /&gt;  if strings.HasPrefix(data, "bl") {&lt;br /&gt;    fmt.Println("data: \"", data, "\" begin with the prefix \"bl\"");&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  // test if the string end with the suffix&lt;br /&gt;  if strings.HasSuffix(data, "blub") {&lt;br /&gt;    fmt.Println("data: \"", data, "\" end with \"blub\"");&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  // Index returns the index of the first instance of sep in s, &lt;br /&gt;  // or -1 if sep is not present in s. &lt;br /&gt;  fmt.Println("index: ", strings.Index(data, "blu"));&lt;br /&gt;  // return: index:  4&lt;br /&gt;&lt;br /&gt;  fmt.Println("index: ", strings.Index(data, "b"));&lt;br /&gt;  // return: index:  0&lt;br /&gt;  fmt.Println("last index: ", strings.LastIndex(data, "b"));&lt;br /&gt;  // return: last index:  11&lt;br /&gt;  // LastIndex return the last occurency of seeking string&lt;br /&gt;&lt;br /&gt;  // with Repeat you can repeat ;)&lt;br /&gt;  fmt.Println("r: ", strings.Repeat("x", 10));&lt;br /&gt;  // return: r:  xxxxxxxxxx&lt;br /&gt;&lt;br /&gt;  // split the string in array of string&lt;br /&gt;  as := strings.Split("root:alsdfjl:230:/blub/blub:lalalala", ":", 0);&lt;br /&gt;&lt;br /&gt;  fmt.Println(as);&lt;br /&gt;  // return: [root alsdfjl 230 /blub/blub lalalala]&lt;br /&gt;&lt;br /&gt;  fmt.Println(strings.Join(as, "|"));&lt;br /&gt;  // return: root|alsdfjl|230|/blub/blub|lalalala&lt;br /&gt;&lt;br /&gt;  fmt.Println(strings.ToLower("UASFalsdfuADSFWE$$"));&lt;br /&gt;  // return: uasfalsdfuadsfwe$$&lt;br /&gt;&lt;br /&gt;  fmt.Println(strings.ToUpper("owenadsfoadsfj"));&lt;br /&gt;  // return: OWENADSFOADSFJ&lt;br /&gt;&lt;br /&gt;  fmt.Println("&lt;", strings.TrimSpace("  asdf sdowe   "), "&gt;");&lt;br /&gt;  // return: &lt; asdf sdowe &gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-2431324676177725848?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/2431324676177725848/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/strings-package-in-golang.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2431324676177725848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2431324676177725848'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/strings-package-in-golang.html' title='strings package in golang'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-3723768876862921888</id><published>2009-11-27T07:21:00.000-08:00</published><updated>2010-11-26T04:58:56.391-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='base64'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>base64 in golang</title><content type='html'>&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt;  "encoding/base64";&lt;br /&gt;  "bytes";&lt;br /&gt;  "fmt";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;  // create the buffer&lt;br /&gt;  bb := &amp;bytes.Buffer{};&lt;br /&gt;  bbURL := &amp;bytes.Buffer{};&lt;br /&gt;&lt;br /&gt;  // create two base64 encoder (standard and for url)&lt;br /&gt;  encoder := base64.NewEncoder(base64.StdEncoding, bb);&lt;br /&gt;  encoderURL := base64.NewEncoder(base64.URLEncoding, bbURL);&lt;br /&gt;&lt;br /&gt;  data := "hallo this is a test, a=23&amp;var2=blabla+-?!%$/\\";&lt;br /&gt;  fmt.Println("data       : ", data);&lt;br /&gt;&lt;br /&gt;  // to encode data, use Write([]bytes),&lt;br /&gt;  // therefore you must convert string to bytes &lt;br /&gt;  // with string.Bytes(d string)&lt;br /&gt;  encoder.Write([]byte(data));&lt;br /&gt;  encoder.Close();&lt;br /&gt;&lt;br /&gt;  encoderURL.Write([]byte(data));&lt;br /&gt;  encoderURL.Close();&lt;br /&gt;&lt;br /&gt;  // voila&lt;br /&gt;  fmt.Println("encoded Std: ", bb.String());&lt;br /&gt;  fmt.Println("encoded URL: ", bbURL.String());&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-3723768876862921888?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/3723768876862921888/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/base64-in-golang.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/3723768876862921888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/3723768876862921888'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/base64-in-golang.html' title='base64 in golang'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-2699011029358220948</id><published>2009-11-25T13:32:00.000-08:00</published><updated>2009-11-27T08:18:32.693-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>time in go</title><content type='html'>&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import "fmt"&lt;br /&gt;import "time"&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;    &lt;br /&gt;    fmt.Println("time in seconds    : ", time.Seconds());&lt;br /&gt;    fmt.Println("time in nanoseconds: ", time.Nanoseconds());&lt;br /&gt;    &lt;br /&gt;    fmt.Println("sleep 1 second.");&lt;br /&gt;&lt;br /&gt;    time.Sleep(1*1000*1000*1000);&lt;br /&gt;&lt;br /&gt;    fmt.Println("time in seconds    : ", time.Seconds());&lt;br /&gt;    fmt.Println("time in nanoseconds: ", time.Nanoseconds());&lt;br /&gt;&lt;br /&gt;    fmt.Println("wait sleep 1 second.");&lt;br /&gt;    before := time.Nanoseconds();&lt;br /&gt;    time.Sleep(1*1000*1000*1000);&lt;br /&gt;    after := time.Nanoseconds();&lt;br /&gt;    fmt.Println("difference of nanoseconds: ", (after-before));&lt;br /&gt;    &lt;br /&gt;    t:=time.LocalTime();&lt;br /&gt;    fmt.Println("time.String(): ", t.String());&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;time.Seconds() get the time as unix time in seconds&lt;br /&gt;time.Nanoseconds() dito&lt;br /&gt;time.Sleep(x)  sleep for x nanoseconds&lt;br /&gt;to sleep 1 second do time.Sleep(1e9) &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;to get any type back from function&lt;/b&gt;&lt;br /&gt;let look:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import "fmt"&lt;br /&gt;import "rand"&lt;br /&gt;import "time"&lt;br /&gt;&lt;br /&gt;func my() interface{} {&lt;br /&gt;&lt;br /&gt;    rand.Seed(time.Nanoseconds()/1000000);&lt;br /&gt;&lt;br /&gt;    switch rand.Intn(3) {&lt;br /&gt;        case 0: var i int; i=4; return i;&lt;br /&gt;        case 1: var f float; f=2.3; return f;&lt;br /&gt;        case 2: var s string; s="blub"; return s;&lt;br /&gt;    }&lt;br /&gt;    var b byte;&lt;br /&gt;    b='c';&lt;br /&gt;    return b;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;    fmt.Println(my());&lt;br /&gt;    time.Sleep(1e9);&lt;br /&gt;    fmt.Println(my());&lt;br /&gt;    time.Sleep(1e9);&lt;br /&gt;    fmt.Println(my());&lt;br /&gt;    time.Sleep(1e9);&lt;br /&gt;    fmt.Println(my());&lt;br /&gt;    time.Sleep(1e9);&lt;br /&gt;    fmt.Println(my());&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt; &lt;br /&gt;&lt;br /&gt;with &lt;i&gt;func my() &lt;b&gt;interface{}&lt;/b&gt; {...}&lt;/i&gt; we declare a function which return an interface. This is a void interface, which can implement all types. Thus we can back every typ back. The my() function simple init the rand and get randomly different types back.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-2699011029358220948?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/2699011029358220948/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/time-in-go.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2699011029358220948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2699011029358220948'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/time-in-go.html' title='time in go'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-8189750217707152670</id><published>2009-11-24T07:57:00.000-08:00</published><updated>2009-11-27T08:18:55.023-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>golang networking</title><content type='html'>a simple get for http:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt; "io";&lt;br /&gt; "strings";&lt;br /&gt;  "log";&lt;br /&gt;  "http";&lt;br /&gt;  "fmt";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt; r, _, err := http.Get("http://www.google.com/robots.txt");&lt;br /&gt; var b []byte;&lt;br /&gt; if err == nil {&lt;br /&gt;  b, err = io.ReadAll(r.Body);&lt;br /&gt;  r.Body.Close();&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; if err != nil {&lt;br /&gt;  log.Stderr(err)&lt;br /&gt; } else {&lt;br /&gt;    fmt.Println(string(b));&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;ok, it was not very simple.  &lt;br /&gt;&lt;i&gt;r, _, err := http.Get("http://www.google.com/robots.txt");&lt;/i&gt;&lt;br /&gt;get the Response in r. Response has: a StatusCode, Body and Header.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;type Response struct {&lt;br /&gt;    Status     string; // e.g. "200 OK"&lt;br /&gt;    StatusCode int;    // e.g. 200&lt;br /&gt;    Header map[string]string;&lt;br /&gt;    Body io.ReadCloser;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Header is a simple string hash. Body is an interface to ReadCloser: all structures with Read and Close.  &lt;br /&gt;&lt;i&gt;func Get(url string) (r *Response, finalURL string, err os.Error)&lt;/i&gt; is doing followings:&lt;br /&gt;- do a redirection loop (maximal 10 times)&lt;br /&gt;- parse the url&lt;br /&gt;- send the request&lt;br /&gt;- if should redirect, get the new location in header&lt;br /&gt;- if should not redirect: return the result from send()&lt;br /&gt;&lt;br /&gt;&lt;i&gt;b, err = io.ReadAll(r.Body);&lt;/i&gt;&lt;br /&gt;read the data from response body (which has a reader from connection) in a byte array. &lt;br /&gt;&lt;i&gt;fmt.Println(string(b));&lt;/i&gt;&lt;br /&gt;printout the bytes as string&lt;br /&gt;&lt;br /&gt;&lt;b&gt;create a simple webserver&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt; "http";&lt;br /&gt; "io";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;// hello world, the web server&lt;br /&gt;func HelloServer(c *http.Conn, req *http.Request) {&lt;br /&gt; io.WriteString(c, "hello, world!\n");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// call a html page&lt;br /&gt;func MyServerPage(c *http.Conn, req *http.Request) {&lt;br /&gt; http.ServeFile(c, req, "myhtml.html");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt; http.Handle("/hello", http.HandlerFunc(HelloServer));&lt;br /&gt; http.Handle("/my.html", http.HandlerFunc(MyServerPage));&lt;br /&gt; err := http.ListenAndServe(":8080", nil);&lt;br /&gt; if err != nil {&lt;br /&gt;  panic("ListenAndServe: ", err.String())&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;i&gt;http.Handle("/hello", http.HandlerFunc(HelloServer));&lt;/i&gt;&lt;br /&gt;set the hadler function HelloServer with "/hello".&lt;br /&gt;&lt;br /&gt;&lt;i&gt;err := http.ListenAndServe(":8080", nil);&lt;/i&gt;&lt;br /&gt;start the TCP server on port 8080, that handle the registered handler.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;io.WriteString(c, "hello, world!\n");&lt;/i&gt; write a simple string.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;http.ServeFile(c, req, "myhtml.html");&lt;/i&gt; read the file and print it out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-8189750217707152670?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/8189750217707152670/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/golang-networking.html#comment-form' title='2 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8189750217707152670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8189750217707152670'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/golang-networking.html' title='golang networking'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-8159373007265666067</id><published>2009-11-21T02:57:00.000-08:00</published><updated>2009-11-27T08:18:41.390-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>learning go</title><content type='html'>so there will be some golang tips.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt; &lt;br /&gt;type My struct {&lt;br /&gt;    a, b int;&lt;br /&gt;    name string;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;create a struct with three variables, a and b are integers. name is a string. The struct name is My.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;m := My{1,2,"ray"};&lt;br /&gt;fmt.Println(m);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;m:= XXX{inputs} create and initialize the struct to variable m.&lt;br /&gt;Println(m) print out: {1 2 ray}.&lt;br /&gt;&lt;br /&gt;to create you own methods for the stuct do: func (v *Mystruct) method(...) returntyps { ... }&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;func (m *My) String() string {&lt;br /&gt;    ret := fmt.Sprintf("a: %d, b: %d, name: %s\n", m.a, m.b, m.name);&lt;br /&gt;    return ret;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;here we create the String() method for printing our struct as a string. Access variables are done through m.var.&lt;br /&gt;&lt;br /&gt;to define a simple array of integers:  a:=[3]int{1,2,3}&lt;br /&gt;if you don't know the length:  a:=[]int{1,2,3,4,5,1,2,3}&lt;br /&gt;&lt;br /&gt;create an assoziative array or dictionary or hash:  hash := map[string]int{"eins":1, "zwei":2, "drei":3};  where map[keytyp]valuetyp.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;    hash2 := map[string]string{"blub":"aodu", "a":"ousdf", "ouew":"gofdu"};&lt;br /&gt;&lt;br /&gt;    // iterate through the hash, range return the key and value of the hash.&lt;br /&gt;    for k, v := range hash2 {&lt;br /&gt;        fmt.Println("key: ",k,"   value: ",v);&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;print out:&lt;br /&gt;key:  blub    value:  aodu&lt;br /&gt;key:  ouew    value:  gofdu&lt;br /&gt;key:  a    value:  ousdf&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Read a directory:&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt;    "io";&lt;br /&gt;    "fmt";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;    dir, err := io.ReadDir("/home/ray/daten");&lt;br /&gt;&lt;br /&gt;    fmt.Println("err: ", err);&lt;br /&gt;    fmt.Println(dir);&lt;br /&gt;&lt;br /&gt;    for _, v := range dir {&lt;br /&gt;        fmt.Println("&gt;&gt;", v);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;let look the source on src/pkg/io/utils.go:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// ReadDir reads the directory named by dirname and returns&lt;br /&gt;// a list of sorted directory entries.&lt;br /&gt;func ReadDir(dirname string) ([]*os.Dir, os.Error) {&lt;br /&gt;    f, err := os.Open(dirname, os.O_RDONLY, 0);  // open you directory&lt;br /&gt;    if err != nil {&lt;br /&gt;        return nil, err&lt;br /&gt;    }&lt;br /&gt;    list, err := f.Readdir(-1);    // f is a file handler&lt;br /&gt;    f.Close();&lt;br /&gt;    if err != nil {&lt;br /&gt;        return nil, err&lt;br /&gt;    }&lt;br /&gt;    dirs := make(dirList, len(list));&lt;br /&gt;    for i := range list {&lt;br /&gt;        dirs[i] = &amp;list[i]&lt;br /&gt;    }&lt;br /&gt;    sort.Sort(dirs);&lt;br /&gt;    return dirs, nil;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;func ReadDir(dirname string) ([]*os.Dir, os.Error) &lt;/b&gt;: ReadDir reads the directory named by dirname and returns a list of sorted directory entries. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;func Open(name string, flag int, perm int) (file *File, err Error)&lt;/b&gt;: Open opens the named file with specified flag (O_RDONLY etc.) and perm, (0666 etc.) if applicable. If successful, methods on the returned File can be used for I/O. It returns the File and an Error, if any. &lt;br /&gt;&lt;br /&gt;Open return a File pointer. internal Open called a syscall to open&lt;br /&gt;&lt;br /&gt;&lt;b&gt;func (file *File) Readdir(count int) (dirs []Dir, err Error)&lt;/b&gt;: Readdir reads the contents of the directory associated with file and returns an array of up to count Dir structures, as would be returned by Stat, in directory order. Subsequent calls on the same file will yield further Dirs. A negative count means to read until EOF. Readdir returns the array and an Error, if any. &lt;br /&gt;&lt;br /&gt;our io.ReadDir() open the dir, read it through the file, create a list, sort and return the dir list. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;    for _, v := range dir {&lt;br /&gt;        if v.IsDirectory() {&lt;br /&gt;            fmt.Println(v.Name," is directory");&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;print out all direcotries name.&lt;br /&gt;&lt;br /&gt;more info about dir is in: src/pkg/os/types.go or &lt;a href="http://golang.org/pkg/os/#Dir"&gt;http://golang.org/pkg/os/#Dir&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Read a file&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;    fileObj, err := os.Open( "echo.go", os.O_RDONLY, 0666 );&lt;br /&gt;    if err != nil {&lt;br /&gt;        log.Stderr( err );&lt;br /&gt;        return;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;  //open the file and test for errors. log.Stderr print the message with a timestamp as a log.&lt;br /&gt;&lt;br /&gt;  // create a buffered reader&lt;br /&gt;  r := bufio.NewReader( fileObj );&lt;br /&gt;&lt;br /&gt;  // read each line &lt;br /&gt;  for {&lt;br /&gt;      line, err := r.ReadString('\n');&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-8159373007265666067?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/8159373007265666067/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/learning-go.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8159373007265666067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8159373007265666067'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/learning-go.html' title='learning go'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-2152993900418333628</id><published>2009-11-17T05:11:00.000-08:00</published><updated>2009-11-27T08:19:04.083-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>some go libraries</title><content type='html'>&lt;table border="1"&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;Package&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Purpose&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Examples&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;   &lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;fmt&lt;/td&gt;&lt;td&gt;formatted I/O&lt;/td&gt;&lt;td&gt;Printf, Sprintf&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;os&lt;/td&gt;&lt;td&gt;OS interface&lt;/td&gt;&lt;td&gt; Open, Read, Write&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;strconv&lt;/td&gt;&lt;td&gt;numbers &lt;-&gt; strings&lt;/td&gt;&lt;td&gt;Atoi, Atof, Itoa&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;io&lt;/td&gt;&lt;td&gt;generic I/O &lt;/td&gt;&lt;td&gt;Copy, Pipe&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;flag&lt;/td&gt;&lt;td&gt;flags: --help etc.&lt;/td&gt;&lt;td&gt;Bool, String&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;log&lt;/td&gt;&lt;td&gt;event logging &lt;/td&gt;&lt;td&gt;Log, Logf, Stderr&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;regexp&lt;/td&gt;&lt;td&gt;regular expressions&lt;/td&gt; &lt;td&gt; Compile, Match&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;template&lt;/td&gt;&lt;td&gt;HTML, etc.&lt;/td&gt;&lt;td&gt;Parse, Execute&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;bytes&lt;/td&gt;&lt;td&gt;byte arrays&lt;/td&gt;&lt;td&gt;Compare, Buffer&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;further libs: bignum, crypto, encoding, exec, hash, http, image, json, net, math, rand, regexp, sort, syscall, xml, time, unicode,&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-2152993900418333628?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/2152993900418333628/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/some-go-libraries.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2152993900418333628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2152993900418333628'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/some-go-libraries.html' title='some go libraries'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-4802916945897517119</id><published>2009-11-17T04:42:00.000-08:00</published><updated>2009-11-27T08:19:13.106-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>go pakcages</title><content type='html'>package is a collection of source files begining with "package nameofpackage".&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import "fmt"&lt;br /&gt;// now useable fmt outputs&lt;br /&gt;fmt.Print(...)&lt;br /&gt;&lt;br /&gt;import my "fmt"  // with my own name. (for purpose if namespace coliders ;)&lt;br /&gt;my.Print(...)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;each package can have an init() for initalization data (single threaded).&lt;br /&gt;&lt;br /&gt;let see:&lt;br /&gt;a.go&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package a&lt;br /&gt;&lt;br /&gt;import "fmt"&lt;br /&gt;&lt;br /&gt;var A int&lt;br /&gt;&lt;br /&gt;func init() {&lt;br /&gt;    A = 4;&lt;br /&gt;  fmt.Print("A init\n");&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;b.go&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package b&lt;br /&gt;&lt;br /&gt;import "fmt"&lt;br /&gt;&lt;br /&gt;var B int&lt;br /&gt;&lt;br /&gt;func init() {&lt;br /&gt;  B=15;&lt;br /&gt;  fmt.Print("B init\n");&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;mainab.go&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt;  "fmt";&lt;br /&gt;  "./a";&lt;br /&gt;  "./b";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;  fmt.Print("call main()\n");&lt;br /&gt;  var x= a.A;&lt;br /&gt;  var y= b.B;&lt;br /&gt;  var z = x + y;&lt;br /&gt;  fmt.Print(z);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;output:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;./6.out &lt;br /&gt;B init&lt;br /&gt;A init&lt;br /&gt;call main()&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt; &lt;br /&gt;at first there will be called init. later the main.&lt;br /&gt;&lt;br /&gt;"To build a program, the packages, and the files within them, must be compiled in the correct order.&lt;br /&gt;Package dependencies determine the order in which to build packages. "&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-4802916945897517119?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/4802916945897517119/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/go-pakcages.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4802916945897517119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4802916945897517119'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/go-pakcages.html' title='go pakcages'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-1374578865071922451</id><published>2009-11-17T03:56:00.000-08:00</published><updated>2009-11-27T08:19:56.315-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>defer in go</title><content type='html'>"The defer statement executes a function (or method)&lt;br /&gt;when the enclosing function returns. The arguments&lt;br /&gt;are evaluated at the point of the defer; the function&lt;br /&gt;call happens upon return." GocourseDay1.pdf&lt;br /&gt;&lt;br /&gt;leet look folowing programm:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import "fmt"&lt;br /&gt;&lt;br /&gt;func b() {&lt;br /&gt;  fmt.Printf("called b()\n");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;func a() int {&lt;br /&gt;  fmt.Printf("start a()\n");&lt;br /&gt;  defer b();&lt;br /&gt;  fmt.Printf("ended a()\n");&lt;br /&gt;  return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;  fmt.Printf("start main\n");&lt;br /&gt;  fmt.Printf("call a()\n");&lt;br /&gt;  a();&lt;br /&gt;  fmt.Printf("after a()\n");&lt;br /&gt;  fmt.Printf("\n");&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;a() call with defer b(). But the outprint show:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;./6.out &lt;br /&gt;start main&lt;br /&gt;call a()&lt;br /&gt;start a()&lt;br /&gt;ended a()&lt;br /&gt;called b()&lt;br /&gt;after a()&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;we can see that b() will be called before a() return.&lt;br /&gt;&lt;br /&gt;=&gt; defer is useful for closing fds, unlocking mutexes, etc.&lt;br /&gt;&lt;br /&gt;defer is simmilar to atexit() for main() in C.&lt;br /&gt;&lt;br /&gt;futher example:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import "fmt"&lt;br /&gt;&lt;br /&gt;func trace(s string) string {&lt;br /&gt;&lt;br /&gt; fmt.Print("entering:", s, "\n");&lt;br /&gt;  return s&lt;br /&gt;}&lt;br /&gt;func un(s string) {&lt;br /&gt;  fmt.Print("leaving:", s, "\n")&lt;br /&gt;}&lt;br /&gt;func a() {&lt;br /&gt;&lt;br /&gt; defer un(trace("a"));&lt;br /&gt;  fmt.Print("in a\n")&lt;br /&gt;}&lt;br /&gt;func b() {&lt;br /&gt;&lt;br /&gt; defer un(trace("b"));&lt;br /&gt;  fmt.Print("in b\n");&lt;br /&gt;  a()&lt;br /&gt;}&lt;br /&gt;func main() { b() }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;the output is: &lt;br /&gt;&lt;pre&gt;&lt;br /&gt;./6.out &lt;br /&gt;entering:b&lt;br /&gt;in b&lt;br /&gt;entering:a&lt;br /&gt;in a&lt;br /&gt;leaving:a&lt;br /&gt;leaving:b&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;as we can see: defer f1(f2())    f2() is called immediately but f1() is called at ending.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-1374578865071922451?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/1374578865071922451/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/defer-in-go.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/1374578865071922451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/1374578865071922451'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/defer-in-go.html' title='defer in go'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-6761327984200982569</id><published>2009-11-17T02:13:00.000-08:00</published><updated>2009-11-27T08:19:45.311-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>further go</title><content type='html'>Go doesn't have references. &lt;br /&gt;&lt;br /&gt;all private functions begin with small character.&lt;br /&gt;all public functions begin with big character.&lt;br /&gt;&lt;br /&gt;To generate some Unit test:&lt;br /&gt;name:  mylib_test.go   ( xxx_test.go )&lt;br /&gt;the function must be called: TestXXX(t *testing.T) { ...&lt;br /&gt;and import: "testing"&lt;br /&gt;&lt;br /&gt;send Fatal error&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;if err != nil {&lt;br /&gt;  t.Fatalf("Myerror %q: %s", path, err)&lt;br /&gt;}&lt;br /&gt;// or &lt;br /&gt;t.Errorf("bla bla %q ", path)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The T struct is:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;type T struct {&lt;br /&gt; errors string;&lt;br /&gt; failed bool;&lt;br /&gt; ch chan *T;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;There are some functions  XXXf are with  format string&lt;br /&gt;&lt;br /&gt;Fail(), Failed(): set the failed variable or ask them. (don't exit)&lt;br /&gt;FailNow() set the fail and exit.&lt;br /&gt;&lt;br /&gt;Log()/Logf(): set the errors string.&lt;br /&gt;Error()/Errorf(): Log with Fail&lt;br /&gt;Fatal()/Fatalf(): Log with FailNow&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To test a package, write a set of Go source files&lt;br /&gt;within the same package; give the files names of the&lt;br /&gt;form *_test.go.&lt;br /&gt;&lt;br /&gt;testing tool: gotest&lt;br /&gt;&lt;br /&gt;func TestXxxx(t *testing.T)&lt;br /&gt;&lt;br /&gt;create the file. later call gotest my_test.go&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-6761327984200982569?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/6761327984200982569/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/further-go.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6761327984200982569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6761327984200982569'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/further-go.html' title='further go'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-7672859952888735804</id><published>2009-11-16T08:37:00.000-08:00</published><updated>2009-11-27T08:19:38.741-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>trapped go</title><content type='html'>we create first a file (package) Person&lt;br /&gt;Person.go:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package Person&lt;br /&gt;&lt;br /&gt;type Person struct { &lt;br /&gt;  vorname string;&lt;br /&gt;  name string;&lt;br /&gt;  alter int;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;func NewPerson(v string, n string, a int) *Person {&lt;br /&gt;  return &amp;Person{v, n, a}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;func (pers *Person) String() string {&lt;br /&gt;  return "Name: "+pers.name+"  Vorname: "+pers.vorname;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;then the main package with main()&lt;br /&gt;&lt;br /&gt;Main.go&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import (&lt;br /&gt;  prs "./Person";&lt;br /&gt;  "fmt";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;&lt;br /&gt;  person := prs.NewPerson("blue", "blub", 42);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  fmt.Printf("person is: \n");&lt;br /&gt;  fmt.Printf(person.String());&lt;br /&gt;  fmt.Printf("\n");&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;compile and link:  &lt;br /&gt;  6g Person.go&lt;br /&gt;  6g Main.go&lt;br /&gt;  6l -o Main Main.6&lt;br /&gt;&lt;br /&gt;execute: ./Main&lt;br /&gt;&gt;person is:&lt;br /&gt;&gt;Name: blub  Vorname: blue&lt;br /&gt;&lt;br /&gt;At first we must import our file as "./Person"&lt;br /&gt;&lt;br /&gt;At second the function that are created for outside must begin with Capitalized Character.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package Person&lt;br /&gt;&lt;br /&gt;type Person struct { &lt;br /&gt;  vorname string;&lt;br /&gt;  name string;&lt;br /&gt;  alter int;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;func newPerson(v string, n string, a int) *Person {&lt;br /&gt;  return &amp;Person{v, n, a}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Person.newPerson(...)  doesnot work.&lt;br /&gt;&lt;br /&gt;"For clients (importers) of the package, names must&lt;br /&gt;be upper case to be visible: global variables,&lt;br /&gt;functions, types, constants, plus methods and&lt;br /&gt;structure fields for global variables and types.&lt;br /&gt;&lt;br /&gt;const hello = "you smell"          // package visible&lt;br /&gt;const Hello = "you smell nice"     // globally visible&lt;br /&gt;const _Bye = "stinko!"             // _ is not upper&lt;br /&gt;"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-7672859952888735804?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/7672859952888735804/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/trapped-go.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7672859952888735804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7672859952888735804'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/trapped-go.html' title='trapped go'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-6660113321122528524</id><published>2009-11-15T14:06:00.000-08:00</published><updated>2009-11-27T08:19:30.930-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>Go</title><content type='html'>Here is some introduction to new Google programing language.&lt;br /&gt;&lt;br /&gt;At first go has his design to build a fast compiling system programming language for fast application. There is no mess with Java or C#/C++. go has no inheritance, but interfaces. &lt;br /&gt;&lt;br /&gt;simple tutorial can be found on golang.org&lt;br /&gt;&lt;br /&gt;At first the question: why yet another language?&lt;br /&gt;google need a language which is fast in compiling and runing. Has the advantages of typing but not overloaded wiht oop stuff.&lt;br /&gt;&lt;br /&gt;simple example:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// define the namespace&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;// import the formated print package&lt;br /&gt;// import fmt "fmt";&lt;br /&gt;&lt;br /&gt;// import a couple of packages&lt;br /&gt;import (&lt;br /&gt;    "flag";      // flag package is a good replacament for main(int argc, char **args) and &lt;br /&gt;                 // replace the argument calculation with getopt() and switch. then create&lt;br /&gt;                 // a help function automatic.&lt;br /&gt;    "fmt";&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;// create a boolean variable from package flag and set the values &lt;br /&gt;var blub = flag.Bool("g", false, "blub lubn blub")&lt;br /&gt;&lt;br /&gt;// g =&gt; -g&lt;br /&gt;// false =&gt; set it at first to false&lt;br /&gt;// "blub..." =&gt; description in help switch&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt;  flag.Parse();  &lt;br /&gt;  // parse the arguments&lt;br /&gt;&lt;br /&gt;  // ask if the &lt;br /&gt;  if  *blub {&lt;br /&gt;    fmt.Printf("blub was setted\n");&lt;br /&gt;  } else {&lt;br /&gt;    fmt.Printf("blub was not setted\n");&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;as you has see variables are defined with var&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;var v1 int;&lt;br /&gt;var v2 string;&lt;br /&gt;var v3 float;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;for printing is there the package fmt: fmt.Printf(..)&lt;br /&gt;then exists other methods as in C.&lt;br /&gt;&lt;br /&gt;to compile:&lt;br /&gt;x64:  &lt;br /&gt;6g file.go &lt;br /&gt;6l file.6 -o file&lt;br /&gt;&lt;br /&gt;for x86&lt;br /&gt;8g file.go&lt;br /&gt;8l file.8 -o file&lt;br /&gt;&lt;br /&gt;to be continued ...&lt;br /&gt;&lt;br /&gt;...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-6660113321122528524?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/6660113321122528524/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/go.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6660113321122528524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6660113321122528524'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/go.html' title='Go'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-3314926607076291431</id><published>2009-11-11T02:24:00.000-08:00</published><updated>2009-11-28T05:55:18.092-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='go'/><category scheme='http://www.blogger.com/atom/ns#' term='golang'/><title type='text'>cools news</title><content type='html'>Google new language Go  &lt;a href="http://golang.org/"&gt;link&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;coole eclipse code highstyling plugin: &lt;a href="http://editbox.sourceforge.net/"&gt;link&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-3314926607076291431?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/3314926607076291431/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/cools-news.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/3314926607076291431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/3314926607076291431'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/cools-news.html' title='cools news'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-8748059240115901607</id><published>2009-11-10T01:07:00.000-08:00</published><updated>2009-11-28T05:53:49.533-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jface'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><title type='text'>JFace snippets and Images</title><content type='html'>some information about Eclipse (3.3) images can be found here: &lt;a href="http://shinych.blogspot.com/2007/05/eclipse-shared-images.html"&gt;shinkarenko&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://wiki.eclipse.org/index.php/JFaceSnippets"&gt;JFaceSnippets&lt;/a&gt; is a collection of code snippets for JFace.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-8748059240115901607?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/8748059240115901607/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/jface-snippets-and-images.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8748059240115901607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8748059240115901607'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/jface-snippets-and-images.html' title='JFace snippets and Images'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-5485140724407349918</id><published>2009-11-05T08:23:00.000-08:00</published><updated>2009-11-28T05:54:06.145-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RCP'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><title type='text'>Eclipse RCP Forms part one</title><content type='html'>Eclipse Forms allow you to achieve the Web look. Eclipse Editors for Manifest files (f.e) are coded in Forms.&lt;br /&gt;&lt;br /&gt;tutorials links:&lt;br /&gt;&lt;a href="http://www.vogella.de/articles/EclipseForms/article.html"&gt;vogella tutorial about forms&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.eclipse.org/articles/Article-Forms/article.html"&gt;forms tutorial 2&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.jdg2e.com/forms/EclipseForms.html"&gt;forms tutorial 3&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Forms use Views:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class FormView extends ViewPart {&lt;br /&gt;public void createPartControl(Composite parent) {&lt;br /&gt;  toolkit = new FormToolkit(parent.getDisplay());&lt;br /&gt;  form = toolkit.createForm(parent);&lt;br /&gt;  form.setText("Hello, Eclipse Forms");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;it create the form where you can set other widgets.&lt;br /&gt;&lt;br /&gt;Therefore forms use GridLayot, GridData, Buttons and other similar as SWT.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; GridLayout layout = new GridLayout();&lt;br /&gt; form.getBody().setLayout(layout);&lt;br /&gt;&lt;br /&gt; layout.numColumns = 2;&lt;br /&gt; GridData gd = new GridData();&lt;br /&gt; gd.horizontalSpan = 2;&lt;br /&gt; link.setLayoutData(gd);&lt;br /&gt; Label label = new Label(form.getBody(), SWT.NULL);&lt;br /&gt; label.setText("Text field label:");&lt;br /&gt; Text text = new Text(form.getBody(), SWT.BORDER);&lt;br /&gt; text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));&lt;br /&gt; Button button = new Button(form.getBody(), SWT.CHECK);&lt;br /&gt; button.setText("An example of a checkbox in a form");&lt;br /&gt; gd = new GridData();&lt;br /&gt; gd.horizontalSpan = 2;&lt;br /&gt; button.setLayoutData(gd);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; Hyperlink link = toolkit.createHyperlink(form.getBody(), "Click here.", SWT.WRAP);&lt;br /&gt; link.addHyperlinkListener(new HyperlinkAdapter() {&lt;br /&gt;   public void linkActivated(HyperlinkEvent e) {&lt;br /&gt;     System.out.println("Link activated!");&lt;br /&gt;   }&lt;br /&gt; });&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;create  a hyperlink as a HTML hyperlink.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for more information look tutorials&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-5485140724407349918?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/5485140724407349918/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/eclipse-rcp-forms-part-one.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5485140724407349918'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5485140724407349918'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/eclipse-rcp-forms-part-one.html' title='Eclipse RCP Forms part one'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-294673612728247605</id><published>2009-11-02T05:15:00.000-08:00</published><updated>2009-11-28T05:54:16.802-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RCP'/><title type='text'>RCP Tree Viewer  part 2</title><content type='html'>here is the continuation of part one.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.eclipse.org/articles/Article-TreeViewer/TreeViewerArticle.htm"&gt;tutorial to JFace TreeViewer&lt;/a&gt; very good details.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;At first we change our staticaly views and root objects.&lt;br /&gt;change in ViewPart1 (thus was it called my TreeViewer ViewPart)&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;private TreeViewer viewer;&lt;br /&gt;private RootNames root;&lt;br /&gt;&lt;br /&gt;        public RootNames getTreeRoot() {&lt;br /&gt;  return root;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public TreeViewer getTreeViewer() {&lt;br /&gt;  return viewer;&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;now change the create the Command Add and Del and add them to menu. (see &lt;a href="http://www.vogella.de/articles/RichClientPlatform/article.html#commands"&gt;Vogella&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class CommandAdd extends AbstractHandler {&lt;br /&gt;&lt;br /&gt; @Override&lt;br /&gt; public Object execute(ExecutionEvent event) throws ExecutionException {&lt;br /&gt;&lt;br /&gt;  System.out.println("start");&lt;br /&gt;  ViewPart1 view = (ViewPart1) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().findView(ViewPart1.ID);&lt;br /&gt;&lt;br /&gt;  RootNames root = view.getTreeRoot();&lt;br /&gt;  &lt;br /&gt;  HostsNames hn = new HostsNames("212.40.32.55", "212.40.32.55");&lt;br /&gt;  root.addChild(hn);&lt;br /&gt;  hn.addChild(new Commandos("syslog", "syslog"));&lt;br /&gt;  hn.addChild(new Commandos("top", "top -d 1"));&lt;br /&gt;  hn.addChild(new Commandos("network", "network"));&lt;br /&gt;&lt;br /&gt;  view.getTreeViewer().refresh();&lt;br /&gt;  return null;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class CommandDel extends AbstractHandler {&lt;br /&gt;&lt;br /&gt; @Override&lt;br /&gt; public Object execute(ExecutionEvent event) throws ExecutionException {&lt;br /&gt;  &lt;br /&gt;  ViewPart1 view = (ViewPart1) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().findView(ViewPart1.ID);&lt;br /&gt;  &lt;br /&gt;  RootNames root = view.getTreeRoot();&lt;br /&gt;  &lt;br /&gt;  HostsNames hn = root.getChildren()[0];&lt;br /&gt;  &lt;br /&gt;  Commandos c = hn.children.get(0);&lt;br /&gt;  &lt;br /&gt;  hn.removeChild(c);&lt;br /&gt;  &lt;br /&gt;  view.getTreeViewer().refresh();&lt;br /&gt;  return null;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now we create a second View where we simple put some text.&lt;br /&gt;&lt;br /&gt;The commands simple add and del some item of tree.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class OutputView extends ViewPart {&lt;br /&gt; public static final String ID = "zzz.zmytest.Tree.Views.OutputView";&lt;br /&gt; public Text text;&lt;br /&gt; &lt;br /&gt; @Override&lt;br /&gt; public void createPartControl(Composite parent) {&lt;br /&gt;  text = new Text(parent, SWT.BORDER);&lt;br /&gt;  text.setText("Imagine a fantastic user interface here");&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @Override&lt;br /&gt; public void setFocus() {&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;we will simple alter the text.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ibm.com/developerworks/opensource/library/os-ecllink/?ca=dgr-lnxw03EclipseGUIviews"&gt;selection Listener&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.eclipse.org/articles/Article-WorkbenchSelections/article.html"&gt;selection Listener&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;we implement ISelectionListener:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class OutputView extends ViewPart implements  ISelectionListener{&lt;br /&gt;&lt;br /&gt; @Override&lt;br /&gt; public void createPartControl(Composite parent) {&lt;br /&gt;  ...&lt;br /&gt;&lt;br /&gt;  getSite().getPage().addSelectionListener((ISelectionListener) this);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @Override&lt;br /&gt; public void selectionChanged(IWorkbenchPart part, ISelection selection) {&lt;br /&gt;  text.setText(selection.toString());&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;add the view in the perspective:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class Perspective implements IPerspectiveFactory {&lt;br /&gt;&lt;br /&gt; public void createInitialLayout(IPageLayout layout) {&lt;br /&gt;  String editorArea = layout.getEditorArea();&lt;br /&gt;  layout.setEditorAreaVisible(false);&lt;br /&gt;  &lt;br /&gt;  layout.addStandaloneView(ViewPart1.ID,  false, IPageLayout.LEFT, 0.25f, editorArea);&lt;br /&gt;  IFolderLayout folder = layout.createFolder("outputs", IPageLayout.TOP, 0.5f, editorArea);&lt;br /&gt;  folder.addPlaceholder(OutputView.ID + ":*");&lt;br /&gt;  folder.addView(OutputView.ID);&lt;br /&gt;  &lt;br /&gt;  layout.getViewLayout(ViewPart1.ID).setCloseable(false);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;set the tree view to selection provider:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class ViewPart1 extends ViewPart {&lt;br /&gt; ...&lt;br /&gt;&lt;br /&gt; public void createPartControl(Composite parent) {&lt;br /&gt;  ...&lt;br /&gt;&lt;br /&gt;  // add to selection provider&lt;br /&gt;  getSite().setSelectionProvider(viewer);&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;improve the listener:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; @Override&lt;br /&gt; public void selectionChanged(IWorkbenchPart part, ISelection selection) {&lt;br /&gt;  if (selection instanceof IStructuredSelection) {&lt;br /&gt;   Object obj = ((IStructuredSelection) selection).getFirstElement();&lt;br /&gt;   if (obj != null) {&lt;br /&gt;    if (obj instanceof HostsNames) {&lt;br /&gt;     HostsNames hn = (HostsNames)obj;&lt;br /&gt;     text.setText("hostname: "+hn.name);&lt;br /&gt;    } else if (obj instanceof Commandos) {&lt;br /&gt;     Commandos co = (Commandos)obj;&lt;br /&gt;     HostsNames hn = co.parent;&lt;br /&gt;     text.setText("commando: "+co.name+ " von host: "+hn.name);&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;the listener look for IStructuredSelection, get the object and test the object for our class instances.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now we can add further views provider and listener without to handle the wired code.s&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-294673612728247605?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/294673612728247605/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/rcp-tree-viewer-part-2.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/294673612728247605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/294673612728247605'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/rcp-tree-viewer-part-2.html' title='RCP Tree Viewer  part 2'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-8998548983974810259</id><published>2009-11-02T01:07:00.000-08:00</published><updated>2009-11-28T05:54:26.590-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RCP'/><title type='text'>RCP Tree Viewer</title><content type='html'>here is some info about JFace TreeViewer.&lt;br /&gt;&lt;br /&gt;The Model is worked with MVC&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Viewer: TreeViewer, LabelProvider&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Model: Your own model, ContentProvider. The Objects should be Singleton&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Control: create the Model, change the Model, refresh Viewer&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt; &lt;br /&gt;&lt;br /&gt;Create a RCP Application (for tutorials see: &lt;a href="http://www.vogella.de/articles/RichClientPlatform/article.html"&gt;Vogella&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;Add a view: Manifest -&gt; Extensions -&gt; All Extensions -&gt; Add ( views)&lt;br /&gt;give an ID, name and create a class.&lt;br /&gt;&lt;br /&gt;At first create the Model. The Model is a tree with root and nodes.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;root&lt;br /&gt;\&lt;br /&gt; node&lt;br /&gt; \node&lt;br /&gt;\&lt;br /&gt;node&lt;br /&gt;\node&lt;br /&gt;\node&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This example create a tree of hosts an commands for each host.&lt;br /&gt;&lt;br /&gt;The root class. This object should be a singleton and have access to hostnames objects.&lt;br /&gt;The hostnames object should have access to commands objects.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;            RootNames&lt;br /&gt;         /      |       \&lt;br /&gt;    /           |           \&lt;br /&gt;  host1       host2        host3&lt;br /&gt; /  |  \       |   \          |&lt;br /&gt;c1  c2  c3    c1   c2         command1&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;create package: xxx.model&lt;br /&gt;&lt;br /&gt;The model package will be have: RootNames, HostsNames and Commands class models.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class RootNames {&lt;br /&gt; private static RootNames root=null;&lt;br /&gt; public String name;&lt;br /&gt; public ArrayList&lt;hostsnames&gt; children;&lt;br /&gt;&lt;br /&gt; private RootNames(String name) {&lt;br /&gt;  this.name=name;&lt;br /&gt;  children = new ArrayList&lt;hostsnames&gt;();&lt;br /&gt;  &lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public static RootNames getRootNames(String name) {&lt;br /&gt;  if(root!=null)&lt;br /&gt;   return root;&lt;br /&gt;  RootNames r = new RootNames(name);&lt;br /&gt;  root=r;&lt;br /&gt;  return root;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;        public String toString() {&lt;br /&gt;  return name;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/hostsnames&gt;&lt;/hostsnames&gt;&lt;/pre&gt;&lt;br /&gt;RootNames is a singleton, has only a name and children of HostsNames. For simplicity we do the access public. Thus we don't need implement setter or getter.&lt;br /&gt;&lt;br /&gt;Then we implement following help methods in RootNames:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; public void addChild(HostsNames child) {&lt;br /&gt;  children.add(child);&lt;br /&gt;  child.parent = this;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public void removeChild(HostsNames child) {&lt;br /&gt;  children.remove(child);&lt;br /&gt;  child.parent = null;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public HostsNames[] getChildren() {&lt;br /&gt;  return (HostsNames[]) children.toArray(new HostsNames[children.size()]);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public boolean hasChildren() {&lt;br /&gt;  return children.size()&gt;0;&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;- add/removeChild() add/remove a child in a list and set/unset the parent of child.&lt;br /&gt;- getChildren() return an array of objects of children. Here a HostsNames array.&lt;br /&gt;&lt;br /&gt;HostsNames:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class HostsNames {&lt;br /&gt; public String name;&lt;br /&gt; public String host;&lt;br /&gt; public RootNames parent;&lt;br /&gt; public ArrayList&lt;commandos&gt; children;&lt;br /&gt; &lt;br /&gt; public HostsNames(String name, String host) {&lt;br /&gt;  this.name = name;&lt;br /&gt;  this.host = host;&lt;br /&gt;  children = new ArrayList&lt;commandos&gt;();&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public void addChild(Commandos child) {&lt;br /&gt;  children.add(child);&lt;br /&gt;  child.parent = this;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public void removeChild(Commandos child) {&lt;br /&gt;  children.remove(child);&lt;br /&gt;  child.parent = null;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public Commandos[] getChildren() {&lt;br /&gt;  return (Commandos[]) children.toArray(new Commandos[children.size()]);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public boolean hasChildren() {&lt;br /&gt;  return children.size()&gt;0;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;        public String toString() {&lt;br /&gt;  return name;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/commandos&gt;&lt;/commandos&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;HostsNames: have a name, hostname, parent to root and children of Commandos. And helpers for Children.&lt;br /&gt;&lt;br /&gt;Commandos:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class Commandos {&lt;br /&gt; public String name;&lt;br /&gt; public String commando;&lt;br /&gt; public HostsNames parent;&lt;br /&gt; &lt;br /&gt; public Commandos(String name, String commando)  {&lt;br /&gt;  this.name = name;&lt;br /&gt;  this.commando = commando;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;        public String toString() {&lt;br /&gt;  return name;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Commandos have name, commando and reference to HostsNames via parent.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Implement Provider:&lt;br /&gt;&lt;br /&gt;create package xxx.provider&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class ViewLabelProvider extends LabelProvider {&lt;br /&gt; &lt;br /&gt; public String getText(Object obj) {&lt;br /&gt;  return obj.toString();&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public Image getImage(Object obj) {&lt;br /&gt;  String imageKey = ISharedImages.IMG_OBJ_ELEMENT;&lt;br /&gt;  if (obj instanceof HostsNames)&lt;br /&gt;     imageKey = ISharedImages.IMG_OBJ_FOLDER;&lt;br /&gt;  return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The Label Provider is a View in MVC. it give the name and the image of the Tree back, based on model.&lt;br /&gt;&lt;br /&gt;Create a View Content Provider with implemented Interfaces: IStructuredContentProvider and ITreeContentProvider.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class ViewContentProvider implements IStructuredContentProvider, ITreeContentProvider {&lt;br /&gt;&lt;br /&gt; @Override&lt;br /&gt; public Object[] getElements(Object inputElement) {&lt;br /&gt;  return null;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @Override&lt;br /&gt; public void dispose() {  &lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @Override&lt;br /&gt; public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @Override&lt;br /&gt; public Object[] getChildren(Object parentElement) {&lt;br /&gt;  return null;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @Override&lt;br /&gt; public Object getParent(Object element) {&lt;br /&gt;  return null;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @Override&lt;br /&gt; public boolean hasChildren(Object element) {&lt;br /&gt;  return false;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The Content Provider is the model part of MVC. It provide how the TreeViewer can access the model.&lt;br /&gt;following methods must be implemented: getElements(), getParent(), getChildren(), hasChildren().&lt;br /&gt;&lt;br /&gt;Implementation:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; @Override&lt;br /&gt; public Object[] getElements(Object parent) {&lt;br /&gt;  return getChildren(parent);&lt;br /&gt; }&lt;br /&gt; @Override&lt;br /&gt; public Object[] getChildren(Object parent) {&lt;br /&gt;  if (parent instanceof RootNames) {&lt;br /&gt;   return ((RootNames)parent).getChildren();&lt;br /&gt;  }&lt;br /&gt;  if (parent instanceof HostsNames) {&lt;br /&gt;   return ((HostsNames)parent).getChildren();&lt;br /&gt;  }&lt;br /&gt;  return new Object[0];&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @Override&lt;br /&gt; public Object getParent(Object child) {&lt;br /&gt;  if (child instanceof HostsNames) {&lt;br /&gt;   return ((HostsNames)child).parent;&lt;br /&gt;  }&lt;br /&gt;  if (child instanceof Commandos) {&lt;br /&gt;   return ((Commandos)child).parent;&lt;br /&gt;  }&lt;br /&gt;  return null;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @Override&lt;br /&gt; public boolean hasChildren(Object element) {&lt;br /&gt;  if (element instanceof RootNames)&lt;br /&gt;   return ((RootNames)element).hasChildren();&lt;br /&gt;  if (element instanceof HostsNames)&lt;br /&gt;   return ((HostsNames)element).hasChildren();&lt;br /&gt;  return false;&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;getElements and getChildren is here the same.&lt;br /&gt;&lt;br /&gt;getChildren() return for RootNames or HostsNames his children list as an array. The same is do getParent() and hasChildren().&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now set the ViewPart:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; private TreeViewer viewer;&lt;br /&gt; private RootNames root;&lt;br /&gt; &lt;br /&gt; @Override&lt;br /&gt; public void createPartControl(Composite parent) {&lt;br /&gt;  viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);&lt;br /&gt;  viewer.setContentProvider(new ViewContentProvider());&lt;br /&gt;  viewer.setLabelProvider(new ViewLabelProvider());&lt;br /&gt;  root=ModelCreator.createModel();&lt;br /&gt;  viewer.setInput(root);&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Create the TreeViewer.&lt;br /&gt;Set our Content and Label Provider. Call the Model Creator.&lt;br /&gt;&lt;br /&gt;ModelCreator:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class ModelCreator {&lt;br /&gt; &lt;br /&gt; public static RootNames createModel() {&lt;br /&gt;  RootNames root = RootNames.getRootNames("root");&lt;br /&gt;  &lt;br /&gt;  HostsNames hn = new HostsNames("localhost", "localhost");&lt;br /&gt;  root.addChild(hn);&lt;br /&gt;  hn.addChild(new Commandos("syslog", "syslog"));&lt;br /&gt;  hn.addChild(new Commandos("top", "top -d 1"));&lt;br /&gt;  &lt;br /&gt;  hn = new HostsNames("134.108.68.107", "134.108.68.107");&lt;br /&gt;  root.addChild(hn);&lt;br /&gt;  hn.addChild(new Commandos("syslog", "syslog"));&lt;br /&gt;  hn.addChild(new Commandos("top", "top -d 1"));&lt;br /&gt;  &lt;br /&gt;  return root;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;createModel() create a root with two hostnames and his commandos.&lt;br /&gt;&lt;br /&gt;Then we must set the view in perspective&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;String editorArea = layout.getEditorArea();&lt;br /&gt;  layout.setEditorAreaVisible(false);&lt;br /&gt;  &lt;br /&gt;  layout.addStandaloneView(ViewPart1.ID,  false, IPageLayout.LEFT, 0.95f, editorArea);&lt;br /&gt;  &lt;br /&gt;  layout.getViewLayout(ViewPart1.ID).setCloseable(false);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;to add some context to the tree (here an example with a Command:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class CommandAdd extends AbstractHandler {&lt;br /&gt;&lt;br /&gt; @Override&lt;br /&gt; public Object execute(ExecutionEvent event) throws ExecutionException {&lt;br /&gt;  System.out.println("blub");&lt;br /&gt;  RootNames root = ViewPart1.getTreeRoot();&lt;br /&gt;  System.out.println("blub: "+root);&lt;br /&gt;  &lt;br /&gt;  HostsNames hn = new HostsNames("212.40.32.55", "212.40.32.55");&lt;br /&gt;  root.addChild(hn);&lt;br /&gt;  hn.addChild(new Commandos("syslog", "syslog"));&lt;br /&gt;  hn.addChild(new Commandos("top", "top -d 1"));&lt;br /&gt;  hn.addChild(new Commandos("network", "network"));&lt;br /&gt;&lt;br /&gt;  ViewPart1.getTreeViewer().refresh();&lt;br /&gt;  &lt;br /&gt;  return null;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;simple get the singleton and add some childs. Then refresh the view.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-8998548983974810259?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/8998548983974810259/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/rcp-tree-viewer.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8998548983974810259'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8998548983974810259'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/11/rcp-tree-viewer.html' title='RCP Tree Viewer'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-2523526259208214830</id><published>2009-10-14T05:58:00.000-07:00</published><updated>2009-10-14T07:11:17.281-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osgi'/><category scheme='http://www.blogger.com/atom/ns#' term='book'/><title type='text'>OSGi book summary part one</title><content type='html'>Summary for book "Die OSGI Service Platform-Eine Einführung mit Eclipse Equinox" &lt;a href="http://www.amazon.de/Service-Platform-Eine-Einf%C3%BChrung-Eclipse-Equinox/dp/389864457X"&gt;link&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The book is a good introduction to OSGi. It has 24 chapters, from OSGi introduction to OSGi and Equinox Standard Services. The book is divided in three part: part one: OSGi Framework, part two: OSGi Standard Services, part three: Equinox Services(Extensions)&lt;br /&gt;&lt;br /&gt;Following chapters are discused in first part:&lt;br /&gt;Bundles, Bundles lifcycles, Packages dependencies, OSGi Services, dynamic Services, Fragment Bundles, Security, Management of OSGi Service Platform, Packaging and Deployment&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;this blog summary the summary of the book:&lt;br /&gt;&lt;br /&gt;* how to install Eclipse PDE (download eclipse-equinox-SDK-3.xxxx.zip)&lt;br /&gt;&lt;br /&gt;* describe how OSGi work: bundles, layers, lifecycles, deployment, services, avaiable implementations(felix, equinox), example to start a http game services.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;* Bundle Manifest have descriptive information about bundles, the manifest will be readed and interpreted by OSGi platform.&lt;br /&gt;* Bundle-Classpath have locale paths &lt;br /&gt;* Bundle-Activator is the start and stop point of a bundle with org.osgi.framework.BundleActivator&lt;br /&gt;* BundleContext (parameter on start()/stop()), allow access to OSGi framework. Through context you can install new bundles, register listener, register and ask for services.&lt;br /&gt;&lt;br /&gt;* Equinox console is a simpler Management Agent. You can ask for state of bundles and OSGi environment. A bundle has different states (installed, uninstalled, running, stoped)&lt;br /&gt;* Activator Policies can change the behavior of bundles starts. (time, sequence, ressources). Lazy Activator set the bundle only start if other required him.&lt;br /&gt;* It exists change of states with code too. (not only manifest-file)&lt;br /&gt;* Bundle listener can notify you about state changes. Listener are registered with BundleContext.&lt;br /&gt;* Bundle Cache save the states for persistence beyound the start()/stop() borders.&lt;br /&gt;&lt;br /&gt;* For using other bundles you must explizit import/export you bundles in manifest-file.&lt;br /&gt;* That is done with Export-Package and Import-Package labels.&lt;br /&gt;* Required-Bundle specific the whole bundle. Import-Package only classes/packages. '*' import all class in a package.&lt;br /&gt;* With Versioning you can specify which version of a same bundle the other bundle should use.&lt;br /&gt;* With DynamicImport-Package you can import packages which doesn't exists yet.&lt;br /&gt;&lt;br /&gt;* OSGi services are simple java objects (POJO Plain Old Java Objects). The services are registered to Service Registry with theirs class names. The services could quered by other bundles. &lt;br /&gt;* The access to Services happen with ServiceReference and BundleContext&lt;br /&gt;* On registry you can send some properties (which is a simple hash map)&lt;br /&gt;* To get a reference: BundleContext.getServiceReferences() and the class name of service. Then you can use filter.&lt;br /&gt;* With start leveln you can affect the start sequence of bundles.&lt;br /&gt;&lt;br /&gt;* Sercice Tracker  help you to work with one interface, independent from runtime/lifecycle. Tracker help dynamic react to services in/outgoing.&lt;br /&gt;* ServiceTrackerCustomizer help you to react to different changes with call-back methods. &lt;br /&gt;* Central OSGi Service Registry is the Whiteboard-Pattern and allow simple way the traditional listener-patern to replace.&lt;br /&gt;&lt;br /&gt;* Fragments bundles expand the classpath of others bundles ( to avoid overloading of code/info for one bundle). It is a simple way to divide logic part from presentation(templates, languages).&lt;br /&gt;* Fragmenst have no lifecycles (no Activators). manifest: Fragment-Host&lt;br /&gt;* The Import/Export/Requirement information from Fragment Bundle will transfer to Host Bundle (which use the Fragment Bundle)&lt;br /&gt;* Extension Bundles you can change the boot-classpath and expand it with additional features.&lt;br /&gt;&lt;br /&gt;* Security in OSGi: local access can be setted to avoid execution in OSGI-INF/permissions.perm&lt;br /&gt;* You can run only signed bundles or with certificates&lt;br /&gt;* Conditional Permission Admin Service asign global authorization (Conditions)&lt;br /&gt;&lt;br /&gt;* Management Agent implement an access to OSGi framework. For administrate framework from outside.&lt;br /&gt;* It can be done by shell. or with programmatic. &lt;br /&gt;* You can code your own commands with implement a CommandProvider with org.eclipse.osgi.framework.console.CommandProvider and register it to OSGi Service Registry.&lt;br /&gt;&lt;br /&gt;* Plug-in Export Wizard is a simple facility to build bundles for extern world (and not only work with eclipse)&lt;br /&gt;* For automatic build: ant4eclipse, Maven&lt;br /&gt;* To start Eclipse Equinox: use org.eclipse.osgi_version.jar. Or start org.eclipse.core.runtime.adapptor.EclipseStarter from an Java application.&lt;br /&gt;* With System properties or config.ini you can manipulate Equinox&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-2523526259208214830?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/2523526259208214830/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/osgi-book-summary-part-one.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2523526259208214830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2523526259208214830'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/osgi-book-summary-part-one.html' title='OSGi book summary part one'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-2970676352562336474</id><published>2009-10-13T00:35:00.003-07:00</published><updated>2009-10-13T00:35:46.787-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scala'/><title type='text'>Scala test</title><content type='html'>http://www.scalatest.org/getting_started_with_feature_spec&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-2970676352562336474?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/2970676352562336474/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/scala-test_13.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2970676352562336474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2970676352562336474'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/scala-test_13.html' title='Scala test'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-6447718302430840159</id><published>2009-10-11T03:33:00.000-07:00</published><updated>2009-10-11T04:40:51.100-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python stuff</title><content type='html'>&lt;span style="font-weight:bold;"&gt;functions numbers&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;int(), long8), float(), round(), hex(), oct(), pow(), cmp()&lt;br /&gt;&lt;br /&gt;s1+s2  merge&lt;br /&gt;s1*n  s1+s1+s1+s1+...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;functions strings:&lt;/span&gt;&lt;br /&gt;org(), chr(),  str(), repr(), unicode(), len()&lt;br /&gt;&lt;br /&gt;s.count(), s.encode(), s.endswith(), s.find(), s.isalnum(), s.iksalpha(), s.isdigi(), s.islower(), s.isspace(), s.join(), s.lstrip(), s.replace(), s.rfind(), s.rstrip(), s.split(), s.startswith(), s.strip(), s.swapcase()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;List&lt;/span&gt;:&lt;br /&gt;array=[1,2,3,4]&lt;br /&gt;len(array)&lt;br /&gt;array[1]="blub"&lt;br /&gt;array[2]=["bla", [1,2,3], 'ups']&lt;br /&gt;&lt;br /&gt;append(), extend(), count(), index(), insert(), remove(), pop(), reverse(), sort()&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;range()&lt;/span&gt;&lt;br /&gt;range(4) &lt;br /&gt;[0,1,2,3]&lt;br /&gt;range(5,10,2]&lt;br /&gt;[5,7,9]&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Tuples&lt;/span&gt;&lt;br /&gt;same as list but imutable&lt;br /&gt;&lt;br /&gt;t1=(1,2,3)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;indicies and slices&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;s[4:]&lt;br /&gt;s[4:7]&lt;br /&gt;s[:-7]&lt;br /&gt;s[-4:]&lt;br /&gt;s[:]&lt;br /&gt;max(), min(), len()&lt;br /&gt;&lt;br /&gt;a,b,c = [ 1, 2, 3 ]&lt;br /&gt;&lt;br /&gt;del delete a varaible &lt;br /&gt;&lt;br /&gt;a= 1&lt;br /&gt;del a&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;assoziative lists, hash&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;h = { k:v, k2:v2, k3:v3 }&lt;br /&gt;t={"peter":23450, "anna":39454, "blub":439549}&lt;br /&gt;t["blub"]&lt;br /&gt;items(), keys(), values(), has_key(), update()&lt;br /&gt;t.has_key("anna")&lt;br /&gt;len(), del()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;None, type(), in-operator&lt;br /&gt;&lt;br /&gt;if 2 in lists: &lt;br /&gt;...&lt;br /&gt;if not "a" in string: &lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Functions:&lt;br /&gt;&lt;br /&gt;def p(n):&lt;br /&gt;  "bla bla, describe function for help"&lt;br /&gt;  for a in range(2,n):&lt;br /&gt;    ...&lt;br /&gt;&lt;br /&gt;p(3)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;def fct(a, b="bla"):&lt;br /&gt;  ...&lt;br /&gt;&lt;br /&gt;fct(3, "lala")&lt;br /&gt;fct(3)&lt;br /&gt;&lt;br /&gt;several arguments with *&lt;br /&gt;&lt;br /&gt;def h(g, *args):&lt;br /&gt;  for m in args:&lt;br /&gt;     ...&lt;br /&gt;&lt;br /&gt;h("bl", "blub", "abc", "dbc")&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;def h(**args):&lt;br /&gt;  if len(args==0): return &lt;br /&gt;  for n in args.keys():&lt;br /&gt;    print args[n]+" : "+ n&lt;br /&gt;&lt;br /&gt;h(v1="blub", v2="aga")&lt;br /&gt;&lt;br /&gt;def complexparameters(firma, delim="-", *address, **inventars):&lt;br /&gt;&lt;br /&gt;def doNothing():&lt;br /&gt;  pass&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;functionale coding&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;add = lambda x,y: x+y&lt;br /&gt;add(2,3)&lt;br /&gt;&lt;br /&gt;map(ord, "string")&lt;br /&gt;[115,116,114,...]&lt;br /&gt;&lt;br /&gt;[ord(a) for a in "string"]&lt;br /&gt;&lt;br /&gt;map(lambda x:x+1,(1,2,3))&lt;br /&gt;map for tuple (1,2,3) x+1&lt;br /&gt;&lt;br /&gt;def p(n):&lt;br /&gt;  for a in range(2,n):&lt;br /&gt;    if n%a == 0:&lt;br /&gt;      return 0&lt;br /&gt;  else:&lt;br /&gt;    return 1&lt;br /&gt;&lt;br /&gt;filter(p, range(100))&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;reduce(function, collection)&lt;br /&gt;&lt;br /&gt;a=5&lt;br /&gt;exec("var" +str(a)+"="+str(a))&lt;br /&gt;=&gt; var5=5&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;docstrings:&lt;/span&gt; &lt;br /&gt;def bla():&lt;br /&gt;  """ blal bla"""&lt;br /&gt;  ...&lt;br /&gt;&lt;br /&gt;bla.__doc__&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Modules&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-6447718302430840159?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/6447718302430840159/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/python-stuff.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6447718302430840159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6447718302430840159'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/python-stuff.html' title='Python stuff'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-684642324421043124</id><published>2009-10-11T02:15:00.000-07:00</published><updated>2009-10-11T03:01:04.272-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>JAVA stuff</title><content type='html'>read from input:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;BufferedReader br = new BufferedReader(new InputStreamReader(System.in));&lt;br /&gt;String name = br.readLine();&lt;br /&gt;int age = new Integer( br.readLine() ).intValue();&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-684642324421043124?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/684642324421043124/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/java-stuff.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/684642324421043124'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/684642324421043124'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/java-stuff.html' title='JAVA stuff'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-7076311309928070961</id><published>2009-10-11T01:41:00.000-07:00</published><updated>2009-10-11T01:52:54.818-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><title type='text'>RUBY codes: code blocks and iterations</title><content type='html'>from "Ruby Cookbook" O'Reilly&lt;br /&gt;for detailed information, look this book &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[1,2,3].each { |i| puts i }&lt;br /&gt;&lt;br /&gt;[1,2,3].each do |i|&lt;br /&gt;  if i%2 == 0&lt;br /&gt;    puts "="&lt;br /&gt;  else&lt;br /&gt;    puts "!"&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;1.upto 3 do |x|   # same 1.upto(3)&lt;br /&gt;&lt;br /&gt;1.upto(3) { |x| ... }   # ok&lt;br /&gt;1.upto 3 { |x| ... }    # error&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;log = lambda { |str| puts "[LOG] #{str}" }&lt;br /&gt;log.call("A test log message.")&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;{1=&gt;2, 2=&gt;4}.each { |k,v| puts "Key #{k}, value #{v}" }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;def times_n(n)&lt;br /&gt;  lambda { |x| x * n }&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;times_ten = times_n(10)&lt;br /&gt;times_ten.call(5)        # =&gt; 50&lt;br /&gt;&lt;br /&gt;circumference = times_n(2*Math::PI)&lt;br /&gt;[1, 2, 3].collect(&amp;circumference)&lt;br /&gt;# =&gt; [6.28318530717959, 12.5663706143592, 18.8495559215388]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Clousure:&lt;br /&gt;Every Ruby block is also a closure.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;ceiling = 50&lt;br /&gt;[1, 10, 49, 50.1, 200].select { |x| x &lt;  ceiling }&lt;br /&gt;# =&gt; [1, 10, 49]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;the var celing is context depended.&lt;br /&gt;&lt;br /&gt;Lambda and Proc&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;block = { |x| puts x }                  # error&lt;br /&gt;block = lambda { |x| puts x }           # ok&lt;br /&gt;block.call "bla bla!"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;def my_lambda(&amp;aBlock)   # a block in function parameters&lt;br /&gt;  aBlock&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;b = my_lambda { puts "Hello World My Way!" }&lt;br /&gt;b.call&lt;br /&gt;b.class   # =&gt; Proc&lt;br /&gt;&lt;br /&gt;aBlock = Proc.new { |x| puts x }&lt;br /&gt;aBlock = proc { |x| puts x }&lt;br /&gt;aBlock = lambda { |x| puts x }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;add_lambda = lambda { |x,y| x + y }&lt;br /&gt;add_lambda.call(4,5,6)  # ArgumentError: wrong number of arguments (3 for 2)&lt;br /&gt;&lt;br /&gt;add_procnew = Proc.new { |x,y| x + y }&lt;br /&gt;add_procnew.call(4,5,6)     # =&gt; 9&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Yielding&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;def myfunc&lt;br /&gt;  puts "1"&lt;br /&gt;  yield&lt;br /&gt;  puts "2"&lt;br /&gt;  yield&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;myfunc("3")&lt;br /&gt;# 1&lt;br /&gt;# 3&lt;br /&gt;# 2&lt;br /&gt;# 3&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;def repeat(n)&lt;br /&gt;  if block_given?&lt;br /&gt;    n.times { yield }&lt;br /&gt;  else&lt;br /&gt;    raise ArgumentError.new("I can't repeat a block you don't give me!")&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;repeat(4) { puts "Hello." }&lt;br /&gt;# Hello.&lt;br /&gt;# Hello.&lt;br /&gt;# Hello.&lt;br /&gt;# Hello.&lt;br /&gt;&lt;br /&gt;repeat(4)&lt;br /&gt;# ArgumentError: I can't repeat a block you don't give me!&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-7076311309928070961?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/7076311309928070961/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/ruby-codes-code-blocks-and-iterations.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7076311309928070961'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7076311309928070961'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/ruby-codes-code-blocks-and-iterations.html' title='RUBY codes: code blocks and iterations'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-5629838436817133409</id><published>2009-10-09T07:03:00.000-07:00</published><updated>2009-10-09T07:38:29.435-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scala'/><title type='text'>read file in Scala</title><content type='html'>read file in scala:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;for (file &lt;- new File("/var/log/").listFiles) {&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;list a directory &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;if (!file.isDirectory) {&lt;/pre&gt;&lt;br /&gt;ask is file not a directory&lt;br /&gt;&lt;br /&gt;simple print out of a file&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import scala.io.Source  &lt;br /&gt;  &lt;br /&gt;for {  &lt;br /&gt;  (line) &lt;- Source.fromFile("bla.txt").getLines  &lt;br /&gt;} print(line)  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;read a file in an iterator&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;scala&gt; val lines = scala.io.Source.fromFile("/var/log/syslog")&lt;br /&gt;lines: scala.io.Source = non-empty iterator&lt;br /&gt;&lt;br /&gt;scala&gt; lines&lt;br /&gt;res5: scala.io.Source = non-empty iterator&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;read a file in a string &lt;br /&gt;&lt;pre&gt;&lt;br /&gt;val lines = scala.io.Source.fromFile("/var/log/syslog").mkString&lt;br /&gt;&lt;br /&gt;// for utf-8 encoding&lt;br /&gt;val lines = scala.io.Source.fromFile("file.txt", "utf-8").getLines.mkString&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;or you can use Java API&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;val os = new BufferedOutputStream(new FileOutputStream("gen/" + file.getName))&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-5629838436817133409?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/5629838436817133409/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/read-file-in-scala.html#comment-form' title='1 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5629838436817133409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5629838436817133409'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/read-file-in-scala.html' title='read file in Scala'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-2339136939105183183</id><published>2009-10-08T08:38:00.001-07:00</published><updated>2009-10-09T04:46:22.005-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scala'/><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><title type='text'>Challenge: pattern syslog</title><content type='html'>Challenge:&lt;br /&gt;&lt;br /&gt;filtern some patern in file /var/log/syslog&lt;br /&gt;and print it out&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Shell:&lt;br /&gt;&lt;pre name="code" class="bash"&gt;fgrep usb /var/log/syslog&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Java:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;import java.io.BufferedReader;&lt;br /&gt;import java.io.FileNotFoundException;&lt;br /&gt;import java.io.FileReader;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.util.regex.Matcher;&lt;br /&gt;import java.util.regex.Pattern;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class JavaFilters {&lt;br /&gt; public static void main(String[] args) {&lt;br /&gt;  String path="/var/log/syslog";&lt;br /&gt;  try {&lt;br /&gt;   BufferedReader input =  new BufferedReader(new FileReader(path));&lt;br /&gt;   &lt;br /&gt;   String line;&lt;br /&gt;   try {&lt;br /&gt;    Pattern p = Pattern.compile("dhclient");&lt;br /&gt;    while (( line = input.readLine()) != null){&lt;br /&gt;     Matcher m = p.matcher(line);&lt;br /&gt;     if(m.find())&lt;br /&gt;      System.out.println("found:: "+line);&lt;br /&gt;    }&lt;br /&gt;   } catch (IOException e) {&lt;br /&gt;    e.printStackTrace();&lt;br /&gt;   }&lt;br /&gt;  } catch (FileNotFoundException e) {&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Scala:&lt;br /&gt;&lt;pre name="code" class="scala"&gt;&lt;br /&gt;import scala.io.Source&lt;br /&gt;import java.util.regex._&lt;br /&gt;&lt;br /&gt;var p = Pattern.compile("usb")&lt;br /&gt;&lt;br /&gt;for ( line &lt;- Source.fromFile("/var/log/syslog").getLines ){  &lt;br /&gt;  var m = p.matcher(line);&lt;br /&gt;  if( m.find ) &lt;br /&gt;    print("found::" + line)&lt;br /&gt;} &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Perl:&lt;br /&gt;&lt;pre name="code" class="perl"&gt;&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;&lt;br /&gt;open(IN, "/var/log/syslog") or die "canot open file: $!";&lt;br /&gt;&lt;br /&gt;@lines = &amp;lt;IN&amp;gt;;&lt;br /&gt;close IN;&lt;br /&gt;&lt;br /&gt;foreach $line(@lines) {&lt;br /&gt;  if( $line =~ /dhclient/) {&lt;br /&gt;    print "found:: $line";&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Ruby:&lt;br /&gt;&lt;pre name="code" class="ruby"&gt;&lt;br /&gt;#!/usr/bin/ruby&lt;br /&gt;&lt;br /&gt;file = File.new("/var/log/syslog", "r") or die "canot open file"&lt;br /&gt;&lt;br /&gt;while (line = file.gets)&lt;br /&gt;  if ( line =~ /usb/ )&lt;br /&gt;    print "found:: "+line&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Python:&lt;br /&gt;&lt;pre name="code" class="python"&gt;&lt;br /&gt;#!/usr/bin/python&lt;br /&gt;&lt;br /&gt;try: &lt;br /&gt;  f = open('/var/log/syslog', 'r')&lt;br /&gt;&lt;br /&gt;  for line in f.readlines():&lt;br /&gt;    if( "usb" in line ): &lt;br /&gt;      print("found:: %s"%line)&lt;br /&gt;&lt;br /&gt;except: &lt;br /&gt;  print "error in file"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;PHP:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;?php&lt;br /&gt;$file = "/var/log/syslog";&lt;br /&gt;if (file_exists($file)) {&lt;br /&gt;  $lines = file($file);&lt;br /&gt;  foreach ($lines as $line_num =&amp;gt; $line) &lt;br /&gt;    if( preg_match("/usb/", $line) ) &lt;br /&gt;      echo "$line";&lt;br /&gt;}&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;C: &lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#include &lt;stdio.h&gt;&lt;br /&gt;#include &lt;stdlib.h&gt;&lt;br /&gt;#include &lt;string.h&gt;&lt;br /&gt;#include &lt;regex.h&gt;&lt;br /&gt;#include &lt;sys/types.h&gt;&lt;br /&gt;&lt;br /&gt;FILE *file = NULL; &lt;br /&gt;&lt;br /&gt;int main(int argc, char **argv)&lt;br /&gt;{&lt;br /&gt;  char line[1024];&lt;br /&gt;  int err;&lt;br /&gt;  char err_str[200];&lt;br /&gt;  char results[500];&lt;br /&gt;  &lt;br /&gt;  regex_t preg;&lt;br /&gt;  regmatch_t pmatch[100];&lt;br /&gt;  &lt;br /&gt;  if( (regcomp(&amp;preg, argv[1], 0)) != 0)  {&lt;br /&gt;    printf("regcomp error\n");&lt;br /&gt;    return -1;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  if((file = fopen("/var/log/syslog", "r")) != NULL) {&lt;br /&gt;    while (!feof(file)){&lt;br /&gt;      fgets(line, 1024, file);&lt;br /&gt;&lt;br /&gt;      if( regexec(&amp;preg, line, preg.re_nsub, pmatch, 0) == 0)  {&lt;br /&gt;          printf("found:: %s", line);&lt;br /&gt;      }  &lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  regfree(&amp;preg);&lt;br /&gt;  return 0;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-2339136939105183183?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/2339136939105183183/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/challenge-pattern-syslog.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2339136939105183183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2339136939105183183'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/challenge-pattern-syslog.html' title='Challenge: pattern syslog'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-389551111335770519</id><published>2009-10-06T08:36:00.001-07:00</published><updated>2009-10-06T08:36:50.880-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scala'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>learning Scala 3</title><content type='html'>this tutorial based on:&lt;br /&gt;http://www.artima.com/scalazine/articles/steps.html&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;def max(x: Int, y: Int): Int = if (x &lt; y) y else x&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;def max(x: Int, y: Int) -&gt; define a function, with 2 parameters (integer)&lt;br /&gt;: Int -&gt; return is integer.&lt;br /&gt;if (x &lt; y) y else x  -&gt; function body&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;scala&gt; def greet() = println("Hello, world!")&lt;br /&gt;greet: ()Unit&lt;br /&gt;&lt;br /&gt;scala&gt; greet()&lt;br /&gt;Hello, world!&lt;br /&gt;&lt;br /&gt;scala&gt; greet&lt;br /&gt;Hello, world!&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;greet save a Unit -&gt; a function&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;args.foreach(arg =&gt; println(arg))&lt;br /&gt;args.foreach((arg: String) =&gt; println(arg))&lt;br /&gt;args.foreach(println)&lt;br /&gt;&lt;br /&gt;for (arg &lt;- args)&lt;br /&gt;  println(arg)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;scala&gt; for (i &lt;- 0 to 5)&lt;br /&gt;     | println(i)&lt;br /&gt;0&lt;br /&gt;1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;5&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;val greetStrings: Array[String] = new Array[String](3)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;create an array with 3 strings&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;greetStrings(0) = "Hello"&lt;br /&gt;greetStrings(1) = ", "&lt;br /&gt;greetStrings(2) = "world!\n"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;important&lt;/b&gt; indexes are in brakes () not square brackets[]&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;for (i &lt;- 0 to 2)&lt;br /&gt;  print(greetStrings(i))&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-389551111335770519?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/389551111335770519/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/learning-scala-3.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/389551111335770519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/389551111335770519'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/learning-scala-3.html' title='learning Scala 3'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-628444175213798203</id><published>2009-10-06T03:01:00.000-07:00</published><updated>2009-10-06T04:21:39.320-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scala'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>learning Scala 2</title><content type='html'>this tutorial based on:&lt;br /&gt;http://www.thomasknierim.com/104/scala/scala-tutorial-1/&lt;br /&gt;http://www.thomasknierim.com/104/scala/scala-tutorial-2/&lt;br /&gt;http://www.thomasknierim.com/104/scala/scala-tutorial-3/&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="scala"&gt;&lt;br /&gt;object Hello {&lt;br /&gt;  def main(args: Array[String]) {&lt;br /&gt;    for(val arg: String &lt;- args)&lt;br /&gt;      System.out.println("Hello, " + arg + "!");&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;for(val arg: String &lt;- args) -&gt; an array into each arg as String&lt;br /&gt;&lt;br /&gt;similar: args.foreach(arg =&gt; println("Hello" + arg + "!"))&lt;br /&gt;"=&gt;" that can be read “with a given argument this do that”&lt;br /&gt;&lt;br /&gt;args.foreach(println)&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="scala"&gt;&lt;br /&gt;var decrease = (x: Int) =&gt; x - 1&lt;br /&gt;decrease(11)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;(x: Int) =&gt; x - 1  -&gt; anonymous function declaration&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;var decrease = (x: Int) =&gt; x – something&lt;br /&gt;&lt;br /&gt;something is not defined yet. decrease is depend on context -&gt; clousure&lt;br /&gt;&lt;br /&gt;In terms of computer science, a closure is a function that is evaluated and whose result depend on an outer context.&lt;br /&gt;&lt;br /&gt;something = 10&lt;br /&gt;decrease(100)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;some examples for higher-order functions&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;scala&gt; List("alpha", "beta", "crash").map(&lt;br /&gt;  p =&gt; p.substring(0,1))&lt;br /&gt;res0: List[java.lang.String] = List(a, b, c)&lt;br /&gt; &lt;br /&gt;scala&gt; List(1, 2, 3) map (_ * 2)&lt;br /&gt;res1: List[Int] = List(2, 4, 6)&lt;br /&gt; &lt;br /&gt;scala&gt; List("Tango", "Mango", "Bobo", "Gogo")&lt;br /&gt;    map (_.endsWith("go"))&lt;br /&gt;res2: List[Boolean] = List(true, true, false, true)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;List("alpha", "beta", "crash")  -&gt; create a list&lt;br /&gt;&lt;br /&gt;map() -&gt; map each list element to some condition/function&lt;br /&gt;&lt;br /&gt;p =&gt; p.substring(0,1)  p is the element p.substring(0,1) is the function&lt;br /&gt;&lt;br /&gt;_ -&gt; ist the element (similar to perl $_ )  &lt;br /&gt;(_*2) is equivalent to (i =&gt; i * 2)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="scala"&gt;&lt;br /&gt;object FileMatcher {&lt;br /&gt; &lt;br /&gt;  private val filesHere=(new java.io.File(".")).listFiles&lt;br /&gt; &lt;br /&gt;  private def filesMatching(matcher: String =&gt; Boolean)=&lt;br /&gt;    for (file &lt;- filesHere; if matcher(file.getName))&lt;br /&gt;      yield file&lt;br /&gt; &lt;br /&gt;  def filesEnding(query: String)=&lt;br /&gt;    filesMatching(_.endsWith(query))&lt;br /&gt;  def filesContaining(query: String)=&lt;br /&gt;    filesMatching(_.contains(query))&lt;br /&gt;  def filesRegex(query: String)=&lt;br /&gt;    filesMatching(_.matches(query))&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;object Main {&lt;br /&gt;  def main(args: Array[String]) {&lt;br /&gt;    val query = args(0);&lt;br /&gt;    var matchingFiles = FileMatcher.filesEnding(query)&lt;br /&gt;    matchingFiles = FileMatcher.filesContaining(query)&lt;br /&gt;    matchingFiles = FileMatcher.filesRegex(query)&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;let look:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;scala&gt; (new java.io.File(".")).listFiles&lt;br /&gt;res2: Array[java.io.File] = Array(./FrenchDate$.class, ./FrenchDate.class, ./Complex.scala, ./s1.class, ./s1$.class, ./FrenchDate.scala, ./Timer$$anonfun$main$1.class, ./s1.scala, ./Timer$.class, ./Hello.class, ./ComplexNumbers.class, ./Hello.scala, ./Hello$$anonfun$main$1.class, ./blog_scala2.txt, ./Timer.class, ./Hello$.class, ./Complex.class, ./blog_scala1.txt, ./ComplexNumbers.sca...&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;new java.io.File(".") use the java api and create a file object File.&lt;br /&gt;listFiles is the same as listFiles() in java. in scala you don't need brakes.&lt;br /&gt;&lt;br /&gt;for (file &lt;- filesHere; if matcher(file.getName))&lt;br /&gt;      yield file&lt;br /&gt;&lt;br /&gt;iterate all filesHere (files in path "."). if name match to query, yield the file. the file get in an array.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;scala&gt; var matchingFiles = FileMatcher.filesEnding(query)&lt;br /&gt;matchingFiles: Array[java.io.File] = Array(./Complex.scala, ./FrenchDate.scala, ./s1.scala, ./Hello.scala, ./Main.scala, ./ComplexNumbers.scala, ./Timer.scala)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;def filesEnding(query: String)=&lt;br /&gt;    filesMatching(_.endsWith(query))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;define different functions&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;filesMatching(matcher: String =&gt; Boolean)&lt;br /&gt;&lt;br /&gt;define the function with a matcher(String) which return Boolean&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-628444175213798203?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/628444175213798203/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/learning-scala-2.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/628444175213798203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/628444175213798203'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/learning-scala-2.html' title='learning Scala 2'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-5240248657157621243</id><published>2009-10-06T00:32:00.000-07:00</published><updated>2009-10-06T03:00:54.191-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scala'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>learning Scala</title><content type='html'>This tutorial based on:&lt;br /&gt;http://www.scala-lang.org/docu/files/ScalaTutorial.pdf&lt;br /&gt;http://www.thomasknierim.com/77/scala/scala-tutorial-2/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;write a file s1.scala&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;object HelloWorld {&lt;br /&gt;  def main(args: Array[String]) {&lt;br /&gt;    println("Hello, world!")&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;object -&gt; declare a static singleton object &lt;br /&gt;args: Array[String] -&gt; a variable args as Array of Strings&lt;br /&gt;&lt;br /&gt;compile and execute&lt;br /&gt;&lt;pre name="code" class="shell"&gt;&lt;br /&gt;$ scalac s1.scala &lt;br /&gt;$ ls&lt;br /&gt;s1.class  s1$.class  s1.scala&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;you get created standard java class files, but you must use java interpreter with setted parameters.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="shell"&gt;&lt;br /&gt;$ java s1&lt;br /&gt;Exception in thread "main" java.lang.NoClassDefFoundError: scala/ScalaObject&lt;br /&gt; at java.lang.ClassLoader.defineClass1(Native Method)&lt;br /&gt;....&lt;br /&gt;&lt;br /&gt;$ file /usr/bin/scala&lt;br /&gt;$ /usr/bin/scala: POSIX shell script text executable&lt;br /&gt;$ cat /usr/bin/scala&lt;br /&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;JAVA_DIR=/usr/share/java&lt;br /&gt;LIB_CLASSPATH=$JAVA_DIR/scala-library.jar:$JAVA_DIR/scala-compiler.jar:$JAVA_DIR/jline.jar&lt;br /&gt;&lt;br /&gt;exec ${JAVACMD:=java} ${JAVA_OPTS:=-Xmx256M -Xms16M} \&lt;br /&gt;  -Xbootclasspath/a:$LIB_CLASSPATH \&lt;br /&gt;  -classpath .:$CLASSPATH:$LIB_CLASSPATH \&lt;br /&gt;  scala.tools.nsc.MainGenericRunner \&lt;br /&gt;  "$@"&lt;br /&gt;&lt;br /&gt;$ scala s1&lt;br /&gt;hallo&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As you can see, the scala executable is a simple shell script, which start the java virtual machine with specific parameters and the scala library.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Create Date.scala&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;import java.util.{Date, Locale}&lt;br /&gt;import java.text.DateFormat&lt;br /&gt;import java.text.DateFormat._&lt;br /&gt;object FrenchDate {&lt;br /&gt;  def main(args: Array[String]) {&lt;br /&gt;    val now = new Date&lt;br /&gt;    val df = getDateInstance(LONG, Locale.FRANCE)&lt;br /&gt;    println(df format now)&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;import java.util.{Date, Locale} &lt;/td&gt;&lt;td&gt; import Date and Locale from java.util&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;import java.text.DateFormat._   &lt;/td&gt;&lt;td&gt; DateFormat._ is similar to DateFormat.* in java&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;val &lt;/td&gt;&lt;td&gt; declare an inmutable variable&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;val now = new Date  &lt;/td&gt;&lt;td&gt; simmilar to "Date now = new Date();" in java&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;println(df format now) &lt;/td&gt;&lt;td&gt; "df format now" is similar to "df.format(now)"&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;In scala is everything an object. There is no primitive datatypes (that is similar to ruby).&lt;br /&gt;&lt;br /&gt;Because scala based on &lt;b&gt;functional programming&lt;/b&gt; functions are objects too.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;object Timer {&lt;br /&gt;&lt;br /&gt;  def oncePerSecond(callback: () =&gt; Unit) {&lt;br /&gt;    while (true) { callback(); Thread sleep 1000 }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  def timeFlies() {&lt;br /&gt;    println("time flies like an arrow...")&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  def main(args: Array[String]) {&lt;br /&gt;    oncePerSecond(timeFlies)&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;with functions as object you can very simple code a callback.&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;timeFlies() &lt;/td&gt;&lt;td&gt; our callback function.&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;callback: () =&gt; Unit  &lt;/td&gt;&lt;td&gt; parameter for a function. ()=&gt;Unit is the type of all functions which take no arguments and return nothing.&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;Thread sleep 1000 &lt;/td&gt;&lt;td&gt; is similar to Thread.sleep(1000) &lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;rather the function timeFlies() you can use anonymous functions ala:&lt;br /&gt;&lt;br /&gt;oncePerSecond(() =&gt; println("time flies like an arrow..."))&lt;br /&gt;&lt;br /&gt;"() =&gt; code" declare an anonymous function&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;Clases:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;class Complex(real: Double, imaginary: Double) {&lt;br /&gt;   def re() = real&lt;br /&gt;   def im() = imaginary&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;define class Complex with two arguments, &lt;br /&gt;def re() and im() are getters. return type of these two methods is not given explicitly&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="scala"&gt;&lt;br /&gt;object ComplexNumbers {&lt;br /&gt;  def main(args: Array[String]) {&lt;br /&gt;    val c = new Complex(1.2, 3.4)&lt;br /&gt;    println("imaginary part: " + c.im())&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;if you have no arguments in function, write: def re = real&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="scala"&gt;&lt;br /&gt;class Complex(real: Double, imaginary: Double) {&lt;br /&gt;  def re = real&lt;br /&gt;  def im = imaginary&lt;br /&gt;  override def toString() =&lt;br /&gt;    "" + re + (if (im &lt; 0) "" else "+") + im + "i"&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;class Complex(real: Double, imaginary: Double) -&gt; primary constructor, which is part of the class declaration&lt;br /&gt;override -&gt; for overriding functions&lt;br /&gt;&lt;br /&gt;(if (im &lt; 0) "" else "+") have you see it ;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="scala"&gt;&lt;br /&gt;class Rational(numerator: Int, denominator: Int) {&lt;br /&gt; &lt;br /&gt;  require(denominator != 0)&lt;br /&gt; &lt;br /&gt;  private val gcd = greatestCommonDivisor(numerator.abs,&lt;br /&gt;    denominator.abs)&lt;br /&gt;  val n = numerator / gcd&lt;br /&gt;  val d = denominator / gcd&lt;br /&gt; &lt;br /&gt;  def this(n: Int) = this(n, 1)&lt;br /&gt; &lt;br /&gt;  private def greatestCommonDivisor(a: Int, b: Int): Int =&lt;br /&gt;  if (b == 0) a else greatestCommonDivisor(b, a % b)&lt;br /&gt; &lt;br /&gt;  def + (that: Rational): Rational =&lt;br /&gt;  new Rational(n * that.d + d * that.n, d * that.d)&lt;br /&gt; &lt;br /&gt;  def - (that: Rational): Rational =&lt;br /&gt;  new Rational(n * that.d - d * that.n, d * that.d)&lt;br /&gt; &lt;br /&gt;  def * (that: Rational): Rational =&lt;br /&gt;  new Rational(n * that.n, d * that.d)&lt;br /&gt; &lt;br /&gt;  def / (that: Rational): Rational =&lt;br /&gt;  new Rational(n * that.d, d * that.n)&lt;br /&gt; &lt;br /&gt;  override def toString = n + "/" + d&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;require(denominator != 0)  -&gt; look that variable is not null, throw exception&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;def this(n: Int) = this(n, 1)  -&gt; create from Rational(2) -&gt; Rational(2,1)&lt;br /&gt;&lt;br /&gt;you can see +-*/ are objects functions, which can be simple overrided&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-5240248657157621243?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/5240248657157621243/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/learning-scala.html#comment-form' title='1 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5240248657157621243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5240248657157621243'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/learning-scala.html' title='learning Scala'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-7840423479299214023</id><published>2009-10-04T09:10:00.001-07:00</published><updated>2009-11-28T05:56:34.523-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bash'/><title type='text'>bashing</title><content type='html'>test -x $BLA || exit 5&lt;br /&gt;&lt;br /&gt;find /proc -type s &lt;br /&gt;ls -Rl /proc/[0-9]* | grep ^s&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-7840423479299214023?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/7840423479299214023/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/bashing.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7840423479299214023'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7840423479299214023'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/bashing.html' title='bashing'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-7738331642952426001</id><published>2009-10-04T09:09:00.000-07:00</published><updated>2009-11-28T05:56:57.399-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='stuff'/><title type='text'>some commands</title><content type='html'>lpr -Plp Datei   # datei ausdrucken&lt;br /&gt;&lt;br /&gt;fuser -k /dev/lp0   # alle dienste die den /dev/lp0 benutzen toeten&lt;br /&gt;#/dev/usb/lp0&lt;br /&gt;&lt;br /&gt;scsi-scanner  /dev/sg0&lt;br /&gt;&lt;br /&gt;set -o nochlobber&lt;br /&gt;&lt;br /&gt;git-rev-tree --bisect ^good1 ^good2 bad &gt; git/refs/headers/tryN&lt;br /&gt;git checkout tryN&lt;br /&gt;^goodx &gt; v2.6.12  bad &gt; master&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;movw%bx, (%rsi) &lt;-&gt; recvfrom()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/usr/sbin/snort -b -m 027 -D -N -c /etc/snort/snort.conf -d -u snort -g snort -i eth1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;iptables -A INPUT -ptcp -s PVT_IP_HERE -d 0/0&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;wget -p    nur inhalt,   &lt;br /&gt;wget -r -np  nur unterverzeichniss, nicht von root an&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-7738331642952426001?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/7738331642952426001/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/some-commands.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7738331642952426001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7738331642952426001'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/some-commands.html' title='some commands'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-7812009495272503347</id><published>2009-10-04T08:46:00.000-07:00</published><updated>2009-11-28T05:57:12.011-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='kernel'/><title type='text'>make kpkg, create a linux kernel image</title><content type='html'>export CONCURRENCY_LEVEL=6&lt;br /&gt;&lt;br /&gt;time make-kpkg --initrd --append-to-version 1 --revision 1 kernel_image modules&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-7812009495272503347?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/7812009495272503347/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/make-kpkg-create-linux-kernel-image.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7812009495272503347'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7812009495272503347'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/make-kpkg-create-linux-kernel-image.html' title='make kpkg, create a linux kernel image'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-2873653655132931959</id><published>2009-10-03T03:50:00.000-07:00</published><updated>2009-10-09T06:56:06.717-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scala'/><title type='text'>trying Scala  ... 3</title><content type='html'>List:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;scala&gt; var lst = List(1, 7, 2, 8, 5, 6, 3, 9, 14, 12, 4, 10)&lt;br /&gt;res29: List[Int] = List(1, 7, 2, 8, 5, 6, 3, 9, 14, 12, 4, 10)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;scala&gt; def odd(inLst:List[Int]):List[Int]={&lt;br /&gt;     |   if(inLst==Nil) Nil&lt;br /&gt;     |   else if(inLst.head%2==1) inLst.head::odd(inLst.tail)&lt;br /&gt;     |   else odd(inLst.tail)&lt;br /&gt;     | }&lt;br /&gt;odd: (List[Int])List[Int]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;def&lt;/span&gt;  define a function/method&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;od()&lt;/span&gt; name&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;inLst:List[Int]&lt;/span&gt; =&gt; inLst parameter name with a List type of Integers&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;span style="font-weight:bold;"&gt;:List[Int]&lt;/span&gt;  return a List of Integers&lt;br /&gt;Nil&lt;/span&gt; similar to none, None, null, void&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;inLst.head&lt;/span&gt;  first element&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;inLst.tail&lt;/span&gt;  all other elements after first element&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;scala&gt; odd(lst)&lt;br /&gt;res32: List[Int] = List(1, 7, 5, 3, 9)&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-2873653655132931959?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/2873653655132931959/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/trying-scala-3.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2873653655132931959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2873653655132931959'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/trying-scala-3.html' title='trying Scala  ... 3'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-4201862367670408824</id><published>2009-10-03T02:28:00.000-07:00</published><updated>2009-10-09T06:56:16.622-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scala'/><title type='text'>trying Scala  ... 2</title><content type='html'>&lt;code&gt;&lt;br /&gt;scala&gt; val try1=if (1==2) 8 else 9&lt;br /&gt;try1: Int = 9&lt;br /&gt;&lt;br /&gt;scala&gt; var total=18&lt;br /&gt;total: Int = 18&lt;br /&gt;scala&gt; while(total &lt; 17) total+=3&lt;br /&gt;scala&gt; total&lt;br /&gt;res15: Int = 18&lt;br /&gt;&lt;br /&gt;scala&gt; for(i &lt;- 1 to 4) println("hi five")&lt;br /&gt;hi five&lt;br /&gt;hi five&lt;br /&gt;hi five&lt;br /&gt;hi five&lt;br /&gt;&lt;br /&gt;scala&gt; for(i &lt;- 1 until 5 ; j &lt;- 1 to 3) println(i,j)&lt;br /&gt;(1,1)&lt;br /&gt;(1,2)&lt;br /&gt;(1,3)&lt;br /&gt;(2,1)&lt;br /&gt;(2,2)&lt;br /&gt;(2,3)&lt;br /&gt;(3,1)&lt;br /&gt;(3,2)&lt;br /&gt;(3,3)&lt;br /&gt;(4,1)&lt;br /&gt;(4,2)&lt;br /&gt;(4,3)&lt;br /&gt;&lt;br /&gt;scala&gt; for(c&lt;-"hello")println(c)&lt;br /&gt;h&lt;br /&gt;e&lt;br /&gt;l&lt;br /&gt;l&lt;br /&gt;o&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;hex, octal, bin is the same as in java&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;scala&gt; val abyte: Byte = 27&lt;br /&gt;abyte: Byte = 27&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;scala&gt; var chr='A'&lt;br /&gt;chr: Char = A&lt;br /&gt;scala&gt; chr=5&lt;br /&gt;chr: Char = &lt;br /&gt;scala&gt; chr=66&lt;br /&gt;chr: Char = B&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;define functions:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;scala&gt; def max(x: Int, y: Int): Int = {&lt;br /&gt;     | if (x &gt; y) x&lt;br /&gt;     | else y&lt;br /&gt;     | }&lt;br /&gt;max: (Int,Int)Int&lt;br /&gt;&lt;br /&gt;scala&gt; max(6,7) &lt;br /&gt;res22: Int = 7&lt;br /&gt;&lt;br /&gt;scala&gt; max(3.6, 4)&lt;br /&gt;&lt;console&gt;:6: error: type mismatch;&lt;br /&gt; found   : Double(3.6)&lt;br /&gt; required: Int&lt;br /&gt;       max(3.6, 4)&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;define a class&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;scala&gt; class Point {&lt;br /&gt;     | var x=0&lt;br /&gt;     | var y=0&lt;br /&gt;     | }&lt;br /&gt;defined class Point&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;scala&gt; val p=new Point&lt;br /&gt;p: Point = Point@18b62e0&lt;br /&gt;&lt;br /&gt;scala&gt; p.x=3&lt;br /&gt;scala&gt; p.y=4&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;scala&gt; class Point( ix:Int,iy:Int){&lt;br /&gt;     | var x=ix&lt;br /&gt;     | var y=iy&lt;br /&gt;     | def vectorAdd(newpt:Point):Point={&lt;br /&gt;     |   new Point(x+newpt.x,y+newpt.y)&lt;br /&gt;     |   }&lt;br /&gt;     | }&lt;br /&gt;defined class Point&lt;br /&gt;&lt;br /&gt;scala&gt; val p1=new Point(3,4)&lt;br /&gt;p1: Point = Point@75455c&lt;br /&gt;scala&gt; val p2=new Point(7,2)&lt;br /&gt;p2: Point = Point@1ba3523&lt;br /&gt;scala&gt; val p3=p1.vectorAdd(p2)&lt;br /&gt;p3: Point = Point@1095c6c&lt;br /&gt;scala&gt; println(p3.x,p3.y)&lt;br /&gt;(10,6)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;scala&gt; class Point( ix:Int,iy:Int){&lt;br /&gt;     | var x=ix&lt;br /&gt;     | var y=iy&lt;br /&gt;     | def +(newpt:Point):Point={&lt;br /&gt;     |   new Point(x+newpt.x,y+newpt.y)&lt;br /&gt;     |   }&lt;br /&gt;     | def -(newpt:Point):Point={&lt;br /&gt;     |   new Point(x-newpt.x,y-newpt.y)&lt;br /&gt;     |   }&lt;br /&gt;     | override def toString="Point("+x+","+y+")"&lt;br /&gt;     | }&lt;br /&gt;defined class Point&lt;br /&gt;&lt;br /&gt;scala&gt; val p1=new Point(3,4)&lt;br /&gt;p1: Point = Point(3,4)&lt;br /&gt;scala&gt; val p2=new Point(7,2)&lt;br /&gt;p2: Point = Point(7,2)&lt;br /&gt;scala&gt; val p3=new Point(-2,2)&lt;br /&gt;p3: Point = Point(-2,2)&lt;br /&gt;&lt;br /&gt;scala&gt; val p4=p1+p2-p3&lt;br /&gt;p4: Point = Point(12,4)&lt;br /&gt;scala&gt; println(p4.x,p4.y)&lt;br /&gt;(12,4)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;there is no switch -&gt; use match&lt;br /&gt;&lt;code&gt;&lt;br /&gt;scala&gt; def  decode(n:Int){&lt;br /&gt;     |   n match {&lt;br /&gt;     |     case 1 =&gt; println("One")&lt;br /&gt;     |     case 2 =&gt; println("Two")&lt;br /&gt;     |     case 5 =&gt; println("Five")&lt;br /&gt;     |     case _ =&gt; println("Error")&lt;br /&gt;     |   }&lt;br /&gt;     | }&lt;br /&gt;decode: (Int)Unit&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-4201862367670408824?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/4201862367670408824/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/trying-scala-2.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4201862367670408824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4201862367670408824'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/trying-scala-2.html' title='trying Scala  ... 2'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-8791126816227646211</id><published>2009-10-03T02:21:00.000-07:00</published><updated>2009-10-09T06:56:26.121-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scala'/><title type='text'>trying Scala  ...</title><content type='html'>install scala,  and type scala in console ;)&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;scala&gt; 4/3.0&lt;br /&gt;res5: Double = 1.3333333333333333&lt;br /&gt;&lt;br /&gt;scala&gt; 4/0&lt;br /&gt;java.lang.ArithmeticException: / by zero&lt;br /&gt; at .&lt;init&gt;(&lt;console&gt;:5)&lt;br /&gt; at .&lt;clinit&gt;(&lt;console&gt;)&lt;br /&gt; at RequestResult$.&lt;init&gt;(&lt;console&gt;:3)&lt;br /&gt; at RequestResult$.&lt;clinit&gt;(&lt;console&gt;)&lt;br /&gt; at RequestResult$result(&lt;console&gt;)&lt;br /&gt; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;br /&gt; at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)&lt;br /&gt; at sun.reflect.DelegatingMethodAcce...&lt;br /&gt;&lt;br /&gt;scala&gt; var a=3&lt;br /&gt;a: Int = 3&lt;br /&gt;&lt;br /&gt;scala&gt; a&lt;br /&gt;res7: Int = 3&lt;br /&gt;&lt;br /&gt;scala&gt; a=5&lt;br /&gt;a: Int = 5&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;scala&gt; val b=3&lt;br /&gt;b: Int = 3&lt;br /&gt;&lt;br /&gt;scala&gt; b&lt;br /&gt;res10: Int = 3&lt;br /&gt;&lt;br /&gt;scala&gt; b=5&lt;br /&gt;&amp;lt;console&amp;gt;:5: error: reassignment to val&lt;br /&gt;       b=5&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;var and val define variables, val is immutable&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For printing is here &lt;br /&gt;&lt;code&gt;Ascala&gt; println(b)&lt;br /&gt;3&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;operators and control sturctures (if, else, ...) are the same as in java.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;scala&gt; val isBook = 6&gt;=3&lt;br /&gt;isBook: Boolean = true&lt;br /&gt;&lt;br /&gt;scala&gt; val price=16&lt;br /&gt;price: Int = 16&lt;br /&gt;&lt;br /&gt;scala&gt; val vol=10&lt;br /&gt;vol: Int = 10&lt;br /&gt;&lt;br /&gt;scala&gt; val sale=if (isBook)price*vol else price/vol&lt;br /&gt;sale: Int = 160&lt;br /&gt;&lt;br /&gt;scala&gt; sale&lt;br /&gt;res13: Int = 160&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-8791126816227646211?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/8791126816227646211/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/trying-scala_03.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8791126816227646211'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8791126816227646211'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/trying-scala_03.html' title='trying Scala  ...'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-5789932244542965562</id><published>2009-10-03T02:18:00.000-07:00</published><updated>2009-10-09T06:56:35.904-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scala'/><title type='text'>trying Scala</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Tutorials:&lt;/span&gt; &lt;a href="http://www.simplyscala.com/"&gt;http://www.simplyscala.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Book:&lt;/span&gt; &lt;a href="http://programming-scala.labs.oreilly.com/"&gt;http://programming-scala.labs.oreilly.com/&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;further info from &lt;a href="http://www.scala-lang.org/"&gt;http://www.scala-lang.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.scala-lang.org/node/1305"&gt;http://www.scala-lang.org/node/1305&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-5789932244542965562?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/5789932244542965562/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/trying-scala.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5789932244542965562'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5789932244542965562'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/trying-scala.html' title='trying Scala'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-6205475981647378838</id><published>2009-10-03T02:15:00.000-07:00</published><updated>2009-11-28T05:55:54.589-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RCP'/><category scheme='http://www.blogger.com/atom/ns#' term='rcplinadmin'/><title type='text'>RCPLinAdmin</title><content type='html'>RCPLinAdmin is in planing, &lt;br /&gt;&lt;br /&gt;should be an universal admin management tool for linux local/ssh writed in RCP/Eclipse.&lt;br /&gt;&lt;br /&gt;http://sites.google.com/site/rcplinadmin&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-6205475981647378838?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/6205475981647378838/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/rcplinadmin.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6205475981647378838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6205475981647378838'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/10/rcplinadmin.html' title='RCPLinAdmin'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-2540783579625681122</id><published>2009-09-23T06:38:00.001-07:00</published><updated>2009-11-28T05:56:05.124-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RCP'/><category scheme='http://www.blogger.com/atom/ns#' term='rcpciscat'/><title type='text'>RCPCisCat</title><content type='html'>RCPCisCat is in planning.&lt;br /&gt;&lt;br /&gt;http://sites.google.com/site/rcpciscat/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-2540783579625681122?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/2540783579625681122/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/09/rcpciscat.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2540783579625681122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2540783579625681122'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/09/rcpciscat.html' title='RCPCisCat'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-8552940981816539268</id><published>2009-09-23T06:37:00.000-07:00</published><updated>2009-10-09T06:56:47.133-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RCP'/><title type='text'>RCPWire</title><content type='html'>RCPWire alpha is out.&lt;br /&gt;&lt;br /&gt;http://sites.google.com/site/rcpwire/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-8552940981816539268?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/8552940981816539268/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/09/rcpwire.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8552940981816539268'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8552940981816539268'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/09/rcpwire.html' title='RCPWire'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-9030279733498462322</id><published>2009-09-22T07:29:00.001-07:00</published><updated>2009-09-22T07:29:52.559-07:00</updated><title type='text'>CODE: neon</title><content type='html'>neon is an HTTP and WebDAV client library, with a C interface.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.webdav.org/neon/"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-9030279733498462322?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/9030279733498462322/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/09/code-neon.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/9030279733498462322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/9030279733498462322'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/09/code-neon.html' title='CODE: neon'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-8043001395693387312</id><published>2009-07-05T15:31:00.001-07:00</published><updated>2009-07-06T02:28:26.145-07:00</updated><title type='text'>SHELL: get server</title><content type='html'>&lt;pre name="code" class="bash"&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;#&lt;br /&gt;[ $# -lt 1 ] &amp;&amp; echo $0 server &amp;&amp; exit 1&lt;br /&gt;&lt;br /&gt;echo 'GET / HTTP/1.0\n' | nc $1 80 | egrep '^Server:'&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-8043001395693387312?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/8043001395693387312/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/shell-get-server.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8043001395693387312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8043001395693387312'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/shell-get-server.html' title='SHELL: get server'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-1009890204030019011</id><published>2009-07-05T15:08:00.000-07:00</published><updated>2009-07-05T15:09:10.133-07:00</updated><title type='text'>SHELL: some commandos</title><content type='html'>found free loop device:&lt;br /&gt;losetup -f&lt;br /&gt;&lt;br /&gt;encryption with losetup:&lt;br /&gt;insmod loop.o&lt;br /&gt;insmod des.o &lt;br /&gt;insmod cryptoloop.o&lt;br /&gt;dd if=/dev/urandom of=crypto.img bs=1M count=50&lt;br /&gt;losetup -e blowfish /dev/loop0 crypto.img&lt;br /&gt;mkfs -t ext2 /dev/loop0&lt;br /&gt;losetup -d /dev/loop0 # delete&lt;br /&gt;mount -o encryption=aes256 crypto.img crypto_home&lt;br /&gt;&lt;br /&gt;encryption with bind drive:&lt;br /&gt;losetup -e aes256 /dev/loop0 /dev/sda1&lt;br /&gt;losetup -d /dev/loop0&lt;br /&gt;mount -o encryption=aes256 /dev/sda1 crypto_home&lt;br /&gt;&lt;br /&gt;resizing the image:&lt;br /&gt;dd if=/dev/urandom bs=1M count=20 &gt;&gt; crypto.img&lt;br /&gt;losetup -e aes256 /dev/loop0 crypto.img&lt;br /&gt;ext2resize /dev/loop0&lt;br /&gt;&lt;br /&gt;encrypt/decrypt with openssl:&lt;br /&gt;openssl enc -aes-256-cbc -salt -in password.txt -out password.txt.enc&lt;br /&gt;openssl enc -d -aes-256-cbc -in password.txt.enc -out password.txt&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;echo "put /bla/bl/das.log.gz /bls/bl2/dies.log.bz2" &gt;&gt; $TFTPSCRIPT&lt;br /&gt;tftp $TFTPSRV &lt; $TFTPSCRIPT&lt;br /&gt;&lt;br /&gt;uuencode $FWLOG/old/$BLA.log.gz $BLA.log.gz | mail -s "FWEXPORT $EXPORTNAME.log.gz" $MAILRECPT&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-1009890204030019011?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/1009890204030019011/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/shell-some-commandos.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/1009890204030019011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/1009890204030019011'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/shell-some-commandos.html' title='SHELL: some commandos'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-7879176117678807231</id><published>2009-07-05T14:34:00.000-07:00</published><updated>2009-11-28T05:58:19.366-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>PERL: some perl stuff 2</title><content type='html'>&lt;pre name="code" class="perl"&gt;&lt;br /&gt;$arg=shift(@ARGV);&lt;br /&gt;while(defined $arg) { ... }&lt;br /&gt;&lt;br /&gt;$h{"bla"}="bla";&lt;br /&gt;@val=values(%h);&lt;br /&gt;&lt;br /&gt;&lt;=&gt; cmp -1 less 0 equal 1 greater&lt;br /&gt;&lt;br /&gt;while(true) {}   until(false){}&lt;br /&gt;&lt;br /&gt;if()  unless()&lt;br /&gt;&lt;br /&gt;local($v)  are local for temporary value of a gloabal variable&lt;br /&gt;&lt;br /&gt;# modifying parameters&lt;br /&gt;$a=1;&lt;br /&gt;inc($a);  # 2&lt;br /&gt;sub inc {&lt;br /&gt; $_[0]+=1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;@a=(1,2,3..);&lt;br /&gt;mod(*a);&lt;br /&gt;sub mod {&lt;br /&gt;  local (*la)=@_;&lt;br /&gt;  @la=reverse(@la);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;print((split " ",$_)[0]."\n") while(&lt;&gt;);&lt;br /&gt;# split im listenkontext, erster element&lt;br /&gt;&lt;br /&gt;perl -ane 'print $F[0];'  # analog&lt;br /&gt;# -a autosplit, (split $_ into @F&lt;br /&gt;# -n while loop&lt;br /&gt;&lt;br /&gt;while(&lt;&gt;) { print if /head/; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# cgi html&lt;br /&gt;#!/usr/bin/perl -wT&lt;br /&gt;print "Content-type: text/plain \n\n";&lt;br /&gt;# -T taint Modus, Benutzereingaben in Quarantaene&lt;br /&gt;&lt;br /&gt;HTML::Template;&lt;br /&gt;use strict;&lt;br /&gt;use warnings;&lt;br /&gt;HTML::Embperl;&lt;br /&gt;HTML::Mason;&lt;br /&gt;&lt;br /&gt;Template;&lt;br /&gt;HTML::Template;&lt;br /&gt;DBI;&lt;br /&gt;CGI;&lt;br /&gt;CGI::Carp qw(fatalsToBrowser);&lt;br /&gt;&lt;br /&gt;$q=new CGI;&lt;br /&gt;foreach($q-&gt;param) { .. # param GET/POST parameters&lt;br /&gt;&lt;br /&gt;$template=new HTML::Template(filename=&gt;'addressbuch_kontakt.html');&lt;br /&gt;$template-&gt;param(personen=&gt;\@_pers)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#db &lt;br /&gt;$dbh-&gt;selectrow_hashref('SELECT ..');&lt;br /&gt;      selectrow_array( .... );&lt;br /&gt;&lt;br /&gt;if(exists $bla)&lt;br /&gt;if( not exiss $bla)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#splice: removes and replaces elements in an array&lt;br /&gt;splice(ARRAY, OFFSET, LENGTH, LIST);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;%SIG  # signal handles hash&lt;br /&gt;sub handler { ... }&lt;br /&gt;$SIG{'INT'}='handler';&lt;br /&gt;$SIG{'INT'}='DEFAULT';&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;srand(time() | $$);   # zeit doer pid einlesen&lt;br /&gt;$l=int(rand(10));&lt;br /&gt;&lt;br /&gt;if/ [^123]0 /  # 10 20 30&lt;br /&gt;&lt;br /&gt;x?? schaltet greedinessaus&lt;br /&gt;\b word bounding&lt;br /&gt;alternation /Ab|cd/   /(ma|pa)+/&lt;br /&gt;&lt;br /&gt;$1 $2 ergebnisse der gruppierung&lt;br /&gt;\1 \2  suchmuster&lt;br /&gt;(?: ..) turn off capturing -&gt; $1  void&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;V  filehandle&lt;br /&gt;$v scalar&lt;br /&gt;@v array&lt;br /&gt;%v hash&lt;br /&gt;&amp;v  subroutine&lt;br /&gt;*v everything named v&lt;br /&gt;&lt;br /&gt;$s.$s2;&lt;br /&gt;$s.=$s2; #concate&lt;br /&gt;$sx4; #4 mal&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;s::mp('bla');&lt;br /&gt;packages s;&lt;br /&gt;sub mp {&lt;br /&gt;  print ("@_\n");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;use File::Basename;&lt;br /&gt;#look for File/Basename.pm&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;jeder Modul muss mit 1; beenden&lt;br /&gt;&lt;br /&gt;BEGIN { require "bla.p"; }&lt;br /&gt;&lt;br /&gt;pragmas: use integer;  no integer;&lt;br /&gt;&lt;br /&gt;calling methods (OOP)&lt;br /&gt;$obj-&gt;meth($param);&lt;br /&gt;meth $obj $param;&lt;br /&gt;&lt;br /&gt;sub meth {&lt;br /&gt;  my $self=shift;  # refernz auf obj&lt;br /&gt;  ...&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;# constructor&lt;br /&gt;sub new {&lt;br /&gt;  my $self={}; # hash anonymous referenz&lt;br /&gt;  $self-&gt;{ATTRIB1}=undef;&lt;br /&gt;  ...&lt;br /&gt;  # make Referenz&lt;br /&gt;  bless($self);&lt;br /&gt;  return $self;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Destructor&lt;br /&gt;sub DESTROY {&lt;br /&gt; ...&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;###&lt;br /&gt;sub u {&lt;br /&gt;  my $self=shift;&lt;br /&gt;  if(@_) {&lt;br /&gt;    $self-&gt;{U}=shift; &lt;br /&gt;  }&lt;br /&gt;  return $self-&gt;{U};&lt;br /&gt;}&lt;br /&gt;$o-&gt;('bla');&lt;br /&gt;print $o-&gt;u,"\n";&lt;br /&gt;&lt;br /&gt;#!!not &lt;br /&gt;print "$o-&gt;u\n";&lt;br /&gt;###&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;use Cwd;&lt;br /&gt;$cur_dir=cwd;&lt;br /&gt;&lt;br /&gt;use File::Basename;&lt;br /&gt;(...)=fileparse(..);&lt;br /&gt;&lt;br /&gt;use Config; &lt;br /&gt;%Config&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;$perldoc -l copy  &lt;br /&gt;druckt den Pfad aus File::Find&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;www.pewrl.com/CPAN&lt;br /&gt;HTML::LinkExtor, URI::URL&lt;br /&gt;head()            links()&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-7879176117678807231?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/7879176117678807231/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/perl-some-perl-stuff-2.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7879176117678807231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7879176117678807231'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/perl-some-perl-stuff-2.html' title='PERL: some perl stuff 2'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-4471682146417200722</id><published>2009-07-05T14:32:00.000-07:00</published><updated>2009-11-28T05:58:12.415-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>PERL: some perl stuff</title><content type='html'>&lt;code&gt;&lt;br /&gt;($sec, $min, $hour, $day, $mon, $year, $wday, $yday, $isdst)=localtime(time());&lt;br /&gt;print scalar(localtime()); # &gt; Fri Dec 21 11:11:30 2006&lt;br /&gt;&lt;br /&gt;# gibt keine leezreilen und zeilen mit "---" oder mehr aus&lt;br /&gt;print unless ( /^\s+$/ or /-{3,}/ );&lt;br /&gt;&lt;br /&gt;# sucht nach kapazietaet&lt;br /&gt;$pfad="/proc/acpi/battery/BAT0/state";&lt;br /&gt;if(/remaining capacity: *?(\d*?) mAh/) {&lt;br /&gt;   print $1;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# eine mail senden&lt;br /&gt;&lt;br /&gt;use Email::Send;&lt;br /&gt;send SMTP=&gt; &lt;&lt;'__MESSAGE__', $host;&lt;br /&gt;To: anfrit00@fht-esslingen.de&lt;br /&gt;From: foo@example.com&lt;br /&gt;&lt;br /&gt;bla bla&lt;br /&gt;__MESSAGE__&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;perl -e 'print "$_\n" foreach(@INC);'&lt;br /&gt;/etc/perl&lt;br /&gt;/usr/local/lib/perl/5.8.8&lt;br /&gt;/usr/local/share/perl/5.8.8&lt;br /&gt;/usr/lib/perl5&lt;br /&gt;/usr/share/perl5&lt;br /&gt;/usr/lib/perl/5.8&lt;br /&gt;/usr/share/perl/5.8&lt;br /&gt;/usr/local/lib/site_perl&lt;br /&gt;&lt;br /&gt;#  formatprobe&lt;br /&gt;open (CON_LIST, '&gt;-') or die " open error\n";&lt;br /&gt;$i=1; $key="klasst"; $result=0.23; $erg=23;&lt;br /&gt;&lt;br /&gt;write CON_LIST;&lt;br /&gt;&lt;br /&gt;close CON_LIST;&lt;br /&gt;&lt;br /&gt;format CON_LIST =&lt;br /&gt;@&gt;  @&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; @&gt;&gt;&gt;&gt; = @&lt;&lt;&lt;&lt;&lt;&lt;&lt;br /&gt;$i, $key, $result, $erg&lt;br /&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# zu datenbank verbinden (mysql)&lt;br /&gt;use DBI();&lt;br /&gt;&lt;br /&gt;$dbhost="localhost";&lt;br /&gt;$dbname="mysql";&lt;br /&gt;$dbuser="root";&lt;br /&gt;$dbpass="";&lt;br /&gt;&lt;br /&gt;# verbinden&lt;br /&gt;my $dbh = DBI-&gt;connect("DBI:mysql:database=$dbname;host=$dbhost", &lt;br /&gt;                        $dbuser, $dbpass, {'RaiseError' =&gt; 1});&lt;br /&gt;my $sth = $dbh-&gt;prepare("SELECT host, user, Password FROM user"); # anfrage&lt;br /&gt;$sth-&gt;execute();  # anfrage senden&lt;br /&gt;&lt;br /&gt;while (my $user = $sth-&gt;fetchrow_hashref()) {  # daten als hash holen&lt;br /&gt;    # $user ist eine hash referenz&lt;br /&gt;    print "HOST: ".$user-&gt;{'host'}."\nUSER: ".$user-&gt;{'user'}."\nPASS: ".$user-&gt;{'Password'}."\n\n";&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;$dbh-&gt;disconnect();  # verbindung zu db schliessen&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# einfaches parameter options&lt;br /&gt;use Getopt::Std;&lt;br /&gt;getopts("vr:", \%options);&lt;br /&gt;print "v-&gt; ".$options{'v'}."\n";&lt;br /&gt;print "r-&gt; ".$options{r}."\n";&lt;br /&gt;#./test.pl -v -r bla&lt;br /&gt;#v-&gt; 1&lt;br /&gt;#r-&gt; bla&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# dateien globen&lt;br /&gt;$path=".";&lt;br /&gt;while (&lt;$path/*.pl&gt;) {&lt;br /&gt;  print $_."\n";&lt;br /&gt;}&lt;br /&gt;# gibt alle dateinamen *.pl aus&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# socket &lt;br /&gt;my $sock = new IO::Socket::UNIX (Peer =&gt; $ARGV[0], Type =&gt; SOCK_STREAM); # socket&lt;br /&gt;print $sock $query;     # senden&lt;br /&gt;my $response = &lt;$sock&gt;; # empfangen&lt;br /&gt;close $sock;&lt;br /&gt;&lt;br /&gt;# einfacher server&lt;br /&gt;use IO::Socket;&lt;br /&gt;$socket=new IO::Socket::INET (LocalHost=&gt;$ARGV[0],&lt;br /&gt;    LocalPort=&gt;6677,&lt;br /&gt;    Proto=&gt;'tcp',&lt;br /&gt;    Listen=&gt;5, Reuse=&gt;1,); &lt;br /&gt;# max 5 stueck,  reuse=1 benutze den port wieder&lt;br /&gt;die "new socket error: $!" unless $socket;&lt;br /&gt;&lt;br /&gt;while($cli=$socket-&gt;accept()) {  # client verbindet&lt;br /&gt; print $cli "Hallo, \n"; &lt;br /&gt; $cli-&gt;flush();   # flushen&lt;br /&gt;    close($cli);     # und tschuess&lt;br /&gt;}&lt;br /&gt;close($socket);&lt;br /&gt;&lt;br /&gt;# server&lt;br /&gt;user IO::Socket;&lt;br /&gt;$ss=new IO::Socket::INET(LocalPort=&gt;2345, Listen=&gt;$SOMAXCONN, Proto=&gt;'tcp', Reuse=&gt;1);&lt;br /&gt;# loop on incomming connections&lt;br /&gt;while($sc=$ss-&gt;accept()) {&lt;br /&gt;  $data=&lt;$sc&gt;;     # empfang&lt;br /&gt;  print $sc "bla"; # senden&lt;br /&gt;  $sc-&gt;close();&lt;br /&gt;}&lt;br /&gt;close($ss);&lt;br /&gt;&lt;br /&gt;# client&lt;br /&gt;$sc=new IO::Socket::INET(PeerAddr=&gt;$hostname, PeerPort=&gt;2345, Type=&gt;SOCK_STREAM, Proto=&gt;'tcp');&lt;br /&gt;# .. aehnlich server &lt;br /&gt;&lt;br /&gt;# donot use IO::Socket::INET this package is defined in IO::Socket&lt;br /&gt;&lt;br /&gt;# pack unpack&lt;br /&gt;my $query = pack("L L N N S S", 0x2343defe, 0x12345678,&lt;br /&gt;                 2343343, 1111323, $ARGV[2], $ARGV[4]);&lt;br /&gt;my ($magic, $id, $type, $genre, $detail, $dist, $link, $tos, $fw,&lt;br /&gt;    $nat, $real, $score, $mflags, $uptime) =&lt;br /&gt;  unpack ("L L C Z20 Z40 c Z30 Z30 C C C s S N", $response);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# alle modulen *.pm ausgeben&lt;br /&gt;perl -e 'print "$_\n" foreach(@INC);' | while read f; do find $f -name \*.pm ; done&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# inplace editieren, scritpname:pr2.orig&lt;br /&gt;@ARGV=("pr2.orig");&lt;br /&gt;$^I=".bak";    # backup name&lt;br /&gt;$n=0;&lt;br /&gt;while(&lt;&gt;) {&lt;br /&gt;        print "$n: $_";&lt;br /&gt;        $n++;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# pipe&lt;br /&gt;open IN, "cat mail.pl |" or die "cat??";&lt;br /&gt;print while(&lt;IN&gt;);&lt;br /&gt;close IN;&lt;br /&gt;$cmd1="wc";&lt;br /&gt;$cmd0='tr -s " " " " ';&lt;br /&gt;open SEND, "| $cmd0 | $cmd1" or die "bla";&lt;br /&gt;print SEND "daasa sdfklasdf        jkaldskjfaslkdj ";&lt;br /&gt;close SEND;&lt;br /&gt;open SEND, "| tr '[a-z]' '[A-Z]'";&lt;br /&gt;print SEND "hello"; # leitet die ausgabe ueber pipe nach tr&lt;br /&gt;close SEND;&lt;br /&gt;$encoder="/usr/bin/uuencode";&lt;br /&gt;open SEND, "| $encoder stdout" or die "encoder";&lt;br /&gt;print SEND "dies ist eine probe";&lt;br /&gt;close SEND;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# cgi&lt;br /&gt;use CGI qw/:standard/;&lt;br /&gt;print header, &lt;br /&gt; start_html('-title'=&gt;"Statistik"),&lt;br /&gt; p("Die letzten Tagen"),&lt;br /&gt; h1("Blabla bla");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# datei locken&lt;br /&gt;use IO::File;&lt;br /&gt;use Fcntl qw(:flock);&lt;br /&gt;&lt;br /&gt;my $fh=new IO::File("&gt;probe.txt") or die "IO::File\n";&lt;br /&gt;&lt;br /&gt;flock $fh, LOCK_EX;&lt;br /&gt;print "get flock datei\n";&lt;br /&gt;print $fh "bla bla";&lt;br /&gt;&lt;br /&gt;$eing=&lt;&gt;;&lt;br /&gt;&lt;br /&gt;flock $fh, LOCK_UN;&lt;br /&gt;$fh-&gt;close;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# ftp benutzen&lt;br /&gt;use Net::FTP;&lt;br /&gt;&lt;br /&gt;$host="dx40";&lt;br /&gt;$user="ray";&lt;br /&gt;$pass='';&lt;br /&gt;&lt;br /&gt;$ftp=Net::FTP-&gt;new($host) or die "Net::FTP-&gt;new error:$!\n";&lt;br /&gt;$ftp-&gt;login($user, $pass) or die "login error: $!\n",$ftp-&gt;message;&lt;br /&gt;$ftp-&gt;binary();&lt;br /&gt;$ftp-&gt;cwd("/home/ray/daten") or die "cwd error\n";&lt;br /&gt;&lt;br /&gt;@alle=$ftp-&gt;ls();&lt;br /&gt;#print foreach(@alle);&lt;br /&gt;$ftp-&gt;get($_) foreach(@alle);&lt;br /&gt;&lt;br /&gt;$ftp-&gt;quit();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# holt n-mails von gmx.net ab&lt;br /&gt;use Net::POP3;&lt;br /&gt;$host='pop.gmx.net';&lt;br /&gt;$user='userbla@gmx.net';&lt;br /&gt;$pass='passbla23';&lt;br /&gt;$ort='/home/ray/daten/popmails/mail';&lt;br /&gt;&lt;br /&gt;$datum=time();&lt;br /&gt;open OUT, "&gt;&gt;$ort$datum" or die "kann nicht mail oeffnen: $! \n";&lt;br /&gt;&lt;br /&gt;($mail=Net::POP3-&gt;new($host)) or die "error open $host: $!\n";&lt;br /&gt;&lt;br /&gt;$lo=$mail-&gt;login($user, $pass);&lt;br /&gt;die "login error: $!\n" unless defined $lo;&lt;br /&gt;print "Login: $user OK\n";&lt;br /&gt;if($lo) {&lt;br /&gt; foreach $nr (1..10) {&lt;br /&gt;  print "Mail nr $nr\n";&lt;br /&gt;  $inhalt=$mail-&gt;get($nr);&lt;br /&gt;  print OUT @$inhalt;&lt;br /&gt;  $mail-&gt;delete($nr);&lt;br /&gt; } &lt;br /&gt;} &lt;br /&gt;close(OUT);&lt;br /&gt;$mail-&gt;quit();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# wandelt ip in int um&lt;br /&gt;use Net::IP;&lt;br /&gt;my $src = new Net::IP ("127.0.0.1") or die (Net::IP::Error());&lt;br /&gt;print $src-&gt;intip()."\n";&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# read a gif file&lt;br /&gt;$A="latest.gif"; &lt;br /&gt;open A or die "$A: $!";&lt;br /&gt;read A, $b, 1024;&lt;br /&gt;@c=unpack "C4A40(A/A)4", $b;&lt;br /&gt;open OUT, "&gt;gifinfo.txt";&lt;br /&gt;print OUT  for(@c);&lt;br /&gt;close OUT;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# zeit&lt;br /&gt;@monat=qw(jan feb mar apr mai jul jun aug sep okt nov dec);&lt;br /&gt;my ($s,$m,$h,$d,$mo,$y,@r)=localtime();&lt;br /&gt;print "$h:$m:$s\n";&lt;br /&gt;print "$d ".$monat[$mo]." ", 1900+$y,"\n";&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$|=1; # ausgabe nicht puffern&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# persistente variablen(hash)&lt;br /&gt;use GDBM_File;   # persistenter hash&lt;br /&gt;use Fcntl;    # O_CREAT, O_RDWR usw&lt;br /&gt;# persistenten hash oeffnen&lt;br /&gt;tie(%MEM, GDBM_File, $pfile, O_CREAT|O_RDWR, 0644) or&lt;br /&gt; die "cannot open $pfile";&lt;br /&gt;# binden den hash MEM an die Datei pfile, ueber GDBM Interface&lt;br /&gt;# der hash MEM erscheint als normaler hash im speicher, liegt aber auf der platte&lt;br /&gt;$MEM($url)="bla";  # schreiben&lt;br /&gt;$d=$MEM('pla');    # lesen&lt;br /&gt;untie(%MEM);  # pers. hash schliessen&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# web&lt;br /&gt;use LWP::UserAgent; &lt;br /&gt;$ua=LWP::UserAgent-&gt;new();  # user agent erzeugen&lt;br /&gt;$request=HTTP::Request-&gt;new('GET', $url); # url festlegen&lt;br /&gt;$response=$ua-&gt;request($request); # netzzugriff ausfuehren&lt;br /&gt;if($response-&gt;is_error()) { ... }  # $response-&gt;is-success&lt;br /&gt;$response-&gt;content()&lt;br /&gt;&lt;br /&gt;use LWP::Simple;&lt;br /&gt;$doc=get 'http://www.google.de';&lt;br /&gt;&lt;br /&gt;perl -MLWP::Simple -e 'getprint "ftp://...";'&lt;br /&gt;&lt;br /&gt;use LWP::Simple;&lt;br /&gt;mirror($url, $localfile);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;use HTML::Parse;&lt;br /&gt;use HTML::FormatText;&lt;br /&gt;$html=parse_htmlfile($htmlfile);&lt;br /&gt;$formatter=new HTML::FormatText(leftmargin=&gt;0, rightmargin=&gt;70);&lt;br /&gt;print OUT $formater-&gt;format($html);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# checksume berechnen&lt;br /&gt;$chksum=unpack("%16C*", $dat); &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# Ping&lt;br /&gt;user Net::Ping;&lt;br /&gt;$po=Net::Ping-&gt;new();&lt;br /&gt;if($po-&gt;ping($hostname)) {&lt;br /&gt;    print "$hostname da";&lt;br /&gt;}&lt;br /&gt;$po-&gt;close();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# FTP&lt;br /&gt;use Net::FTP;&lt;br /&gt;login($servername, $passwort);&lt;br /&gt;#ascii, binary&lt;br /&gt;cwd($dir); # dir($dir) pwd quit &lt;br /&gt;$dir=$ftp-&gt;dir(); # return a refernce&lt;br /&gt;foreach(@$dir) print "$_\n";&lt;br /&gt;#&lt;br /&gt;$ftp = Net::FTP-&gt;new("some.host.name", Debug =&gt; 0)&lt;br /&gt;             or die "Cannot connect to some.host.name: $@";&lt;br /&gt;$ftp-&gt;login("anonymous",’\-anonymous@’)&lt;br /&gt;             or die "Cannot login ", $ftp-&gt;message;&lt;br /&gt; $ftp-&gt;cwd("/pub")&lt;br /&gt;             or die "Cannot change working directory ", $ftp-&gt;message;&lt;br /&gt;$ftp-&gt;get("that.file")&lt;br /&gt;             or die "get failed ", $ftp-&gt;message;&lt;br /&gt; $ftp-&gt;quit;&lt;br /&gt;# SEE perldoc Net::FTP&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# mail&lt;br /&gt;use Mail::Send;&lt;br /&gt;$mail=Mail::Send-&gt;new();&lt;br /&gt;$mail-&gt;to($addr);&lt;br /&gt;$mail-&gt;cc($copy_to_addr);&lt;br /&gt;$mail-&gt;bcc($blind_copy);&lt;br /&gt;$mailhandle=$mail-&gt;open();&lt;br /&gt;print $mailhandle &lt;&lt; END;&lt;br /&gt;bla bla&lt;br /&gt;....&lt;br /&gt;END;&lt;br /&gt;$mailhandle-&gt;close();  # send mail&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# MIME&lt;br /&gt;use MIME::Lite;&lt;br /&gt;$msg=MIME::Lite-&gt;new(From=&gt;$fromaddr, To=&gt;$toaddr, Subject=&gt;'bla',&lt;br /&gt;                Type=&gt;'multipart/mixed');&lt;br /&gt;$msg-&gt;attach(Type=&gt;'TEXT', Encoding=&gt;'7bit', Data=&gt;'bla bla');&lt;br /&gt;$msg-&gt;attach(Type=&gt;'image/gif', Encoding=&gt;'base64', Path=&gt;'bild.gif', Filename=&gt;'bild.gif');&lt;br /&gt;# convert message to string&lt;br /&gt;$str=$msg-&gt;as_string();&lt;br /&gt;$msg-&gt;send();&lt;br /&gt;&lt;br /&gt;# decoding MIME&lt;br /&gt;use MIME::Parser;&lt;br /&gt;$mime=new MIME::Parser;&lt;br /&gt;$mime-&gt;read(\*INPUT); # geoffnete Datei&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# SMTP&lt;br /&gt;use Net::SMTP;&lt;br /&gt;$ms=new Net::SMTP($hostname, Debug=&gt;1,);&lt;br /&gt;$ms-&gt;mail($from_addr);&lt;br /&gt;$ms-&gt;to($addr);&lt;br /&gt;$ms-&gt;data($data); # in data steht auch der subject&lt;br /&gt;&lt;br /&gt;# POP3&lt;br /&gt;use Net::POP3;&lt;br /&gt;$ms=new Net::POP3($hostname);&lt;br /&gt;$msg_cnt=$ms-&gt;login($usrename, $passwd);&lt;br /&gt;$headers=$ms-&gt;list();  # reference&lt;br /&gt;foreach $message(keys(%$headers)) {&lt;br /&gt;  $header=$ms-&gt;top($message);&lt;br /&gt;}&lt;br /&gt;$message=$ms-&gt;last();&lt;br /&gt;$contents=$ms-&gt;get($message);&lt;br /&gt;$ms-&gt;quit();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# DBM&lt;br /&gt;dbmopen(%dbhash, "filename", 0666);&lt;br /&gt;$dbhash{'name'}="bla bla";&lt;br /&gt;print $dbhash{'any'};&lt;br /&gt;dbmclose(%dbhash);&lt;br /&gt;&lt;br /&gt;while(($key, $val)=each(%dbhash)) {&lt;br /&gt;  print ...&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;use Fcntl; &lt;br /&gt;use SDBM_File;&lt;br /&gt;use Config;&lt;br /&gt;$flags=O_CREAT|O_RDWR;&lt;br /&gt;tie(%dbhash, 'SDBM_File', 'sdmtest', $flags, 0666) or die "cannot open database $!";&lt;br /&gt;$dbhas{localtime()}="bla..";&lt;br /&gt;untie(%dbhash);&lt;br /&gt;# tie bindet eine variable zu etwas, hier zu einer datenbank klasse&lt;br /&gt;# tie(var, classname, file, flags, mode)&lt;br /&gt;# var: %hash, @array, $scalar, HANDLE&lt;br /&gt;&lt;br /&gt;tying scalar, array, filehandle, hash when call 'tie', perl execute proper constructor&lt;br /&gt;array -&gt;TIEARRAY&lt;br /&gt;handle-&gt;TIEHANDLE&lt;br /&gt;hash  -&gt;TIEHASH&lt;br /&gt;scalar-&gt;TIESCALAR&lt;br /&gt;&lt;br /&gt;TIESCALAR classname, list&lt;br /&gt;FETCH this&lt;br /&gt;STORE this, val&lt;br /&gt;DESTROY this&lt;br /&gt;&lt;br /&gt;package Myscalar;&lt;br /&gt;&lt;br /&gt;sub TIESCALAR {&lt;br /&gt;  my ($class)=$_[0];&lt;br /&gt;  my ($self)=0;&lt;br /&gt;  return (bless(\$self, $class));&lt;br /&gt;}&lt;br /&gt;sub FETCH {&lt;br /&gt;  my($reference_to_self)=$_[0];&lt;br /&gt;  return ($$reference_to_self);&lt;br /&gt;}&lt;br /&gt;...&lt;br /&gt;1;&lt;br /&gt;&lt;br /&gt;# an object is a reference&lt;br /&gt;&lt;br /&gt;tie($myscalar, 'Myscalar');&lt;br /&gt;$myscalar=55;&lt;br /&gt;untie($myscalar);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;TIEARRAY classname, list&lt;br /&gt;FETCH this, index&lt;br /&gt;STORE this, index, value&lt;br /&gt;DESTROY this&lt;br /&gt;&lt;br /&gt;TIEHANDLE classname, list&lt;br /&gt;PRINT this, list&lt;br /&gt;PRINTF this, list&lt;br /&gt;READLINE this  # called by &lt;&gt;&lt;br /&gt;GETC this&lt;br /&gt;READ this, list&lt;br /&gt;DESTROY this&lt;br /&gt;&lt;br /&gt;TIEHASH classname, list&lt;br /&gt;FETCH this, key&lt;br /&gt;STORE this, key, value&lt;br /&gt;EXISTS this, key&lt;br /&gt;DELETE this, key&lt;br /&gt;CLEAR this&lt;br /&gt;FIRSTKEY this&lt;br /&gt;NEXTKEY this, lastkey&lt;br /&gt;DESTROY this&lt;br /&gt;&lt;br /&gt;store  $v=$hash{'key'};&lt;br /&gt;exists if(exists($hash{'key'})) { ..&lt;br /&gt;delete delete $hash{'key'};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Tie::Hash, Tie::StatHash&lt;br /&gt;&lt;br /&gt;sub STORE{ $_[0]-&gt;{$_[1]}=$_[2]; }&lt;br /&gt;sub FIRSTKEY{ my $a=scalar keys%{$_[0]};&lt;br /&gt;  each%{$_[0]} }&lt;br /&gt;sub CLEAR{ %{$_[0]}=() }&lt;br /&gt;# %{..}  anonyme hash&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;package Tie::Stdhash;&lt;br /&gt;@ISA=qw(Tie::Hash);  # used to speify which baseclass a new class inherits from&lt;br /&gt;# Tie::StdHash inherits from Tie::Hash&lt;br /&gt;sub STORE { ... }  # override the STORE method&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#Databases&lt;br /&gt;use DBI;&lt;br /&gt;@drivers=DBI-&gt;available_drivers();&lt;br /&gt;$db=DBI-&gt;connect('dbi:mSQL:test:localhost);&lt;br /&gt;$db-&gt;disconnect();&lt;br /&gt;$cursor-&gt;execute();&lt;br /&gt;if($DBI::err) { .. error }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;perldoc DBI::FAQ&lt;br /&gt;# extract the data    &lt;br /&gt;while(@val=$cursor-&gt;fetchrow()) { .. }&lt;br /&gt;&lt;br /&gt;use vars qw(@ISA);  # pragma to predeclare global variable names (obsolete)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# Zlib&lt;br /&gt;use Compress::Zlib;&lt;br /&gt;binmode STDOUT;&lt;br /&gt;my $gz=gzopen(\*STDOUT, "wb");&lt;br /&gt;while(&lt;&gt;) {&lt;br /&gt;  $gz-&gt;gzwrite($_); &lt;br /&gt;}&lt;br /&gt;$gz-&gt;gzclose();&lt;br /&gt;&lt;br /&gt;$gzerrno!=Z_STREAM_END;  Z_OK&lt;br /&gt;&lt;br /&gt;$gz-&gt;gzreadline($_);&lt;br /&gt;$gz-&gt;gzread($buffer);&lt;br /&gt;&lt;br /&gt;my $x=inflateinit();&lt;br /&gt;($output, $status)=$x-&gt;inflate(\$input);&lt;br /&gt;my $x=deflateinit();&lt;br /&gt;($o, $s)=$x-&gt;deflate($_);&lt;br /&gt;$x-&gt;flush();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;use Bla;&lt;br /&gt;$o=Bla::funct()  # oder&lt;br /&gt;use Bla qw(funct);&lt;br /&gt;$o=funct();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;push @arr, $var; # append $var to @arr&lt;br /&gt;pop @arr; # get the latest element and remove it&lt;br /&gt;&lt;br /&gt;use File::Basename;&lt;br /&gt;$path="/usr/lib/perl5/Net/Ping.pm";&lt;br /&gt;@suf=".pm";&lt;br /&gt;($basename, $dir, $suffix)=fileparse($path, @suf);&lt;br /&gt;# Ping     /usr/lib...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;use Config;&lt;br /&gt;%Config; # -which include a lot of inormation about the configuration of Perl&lt;br /&gt;if($Config{osname}=~/^Windows/) ..&lt;br /&gt;&lt;br /&gt;use File::Compare;  # compare 2 files&lt;br /&gt;$result=compare($file1, $file2); # 0 equal  1 diff  -1 errror&lt;br /&gt;&lt;br /&gt;use File::Copy;&lt;br /&gt;copy($sourcefile, $destfile);&lt;br /&gt;move($srcfile, $dstfile);&lt;br /&gt;&lt;br /&gt;#Installing new Module&lt;br /&gt;perl Makefile.PL&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# Image with GD&lt;br /&gt;use GD;&lt;br /&gt;$im=new GD::Image(100,100);&lt;br /&gt;$back=$im-&gt;colorAllocate(100,150,255);&lt;br /&gt;$im-&gt;fill(1,1,$back);&lt;br /&gt;$outfile="&gt;"."name.gif";&lt;br /&gt;print OUT $im-&gt;gif;&lt;br /&gt;$black=$im-&gt;colorAllocate(0,0,0);&lt;br /&gt;$im-&gt;string(gdLargeFont, 30,40, $message);&lt;br /&gt;#  stringUp(..)  rotate 90° &lt;br /&gt;$font=gdMediumBoldFont;&lt;br /&gt;$char_width=$font-&gt;width;&lt;br /&gt;$char_height=$font-&gt;height;&lt;br /&gt;$len=length($message);&lt;br /&gt;$im-&gt;line($x, $y, $x2, $y2, $color);&lt;br /&gt;$im-&gt;transparent($back);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/\binder\b/  # wortgrenze 'inder' aber kein 'rinder'&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-4471682146417200722?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/4471682146417200722/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/perl-some-perl-stuff.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4471682146417200722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4471682146417200722'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/perl-some-perl-stuff.html' title='PERL: some perl stuff'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-8982407093296435488</id><published>2009-07-05T06:10:00.000-07:00</published><updated>2009-10-06T00:50:01.991-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>PHP: some stuff</title><content type='html'>&lt;pre&gt;&lt;br /&gt;$in = fopen("php://stdin","r");&lt;br /&gt;&lt;br /&gt;while ($l =$fgets($in, 1024)) {&lt;br /&gt;  $a = preg_split('/\s+/', $l);&lt;br /&gt;  while(list($k, $v) = each($a)) {&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;foreach($c as $k=&gt; $v) ...&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-8982407093296435488?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/8982407093296435488/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/php-some-stuff.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8982407093296435488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8982407093296435488'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/php-some-stuff.html' title='PHP: some stuff'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-7021701286489463401</id><published>2009-07-05T06:08:00.001-07:00</published><updated>2009-07-05T06:10:02.895-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='commandos'/><title type='text'>CMDs: some shell commandos, linux</title><content type='html'>lpr -Plp Datei   # datei ausdrucken&lt;br /&gt;&lt;br /&gt;fuser -k /dev/lp0   # alle dienste die den /dev/lp0 benutzen toeten&lt;br /&gt;#/dev/usb/lp0&lt;br /&gt;&lt;br /&gt;scsi-scanner  /dev/sg0&lt;br /&gt;&lt;br /&gt;set -o nochlobber&lt;br /&gt;&lt;br /&gt;git-rev-tree --bisect ^good1 ^good2 bad &gt; git/refs/headers/tryN&lt;br /&gt;git checkout tryN&lt;br /&gt;^goodx &gt; v2.6.12  bad &gt; master&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;movw%bx, (%rsi) &lt;-&gt; recvfrom()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/usr/sbin/snort -b -m 027 -D -N -c /etc/snort/snort.conf -d -u snort -g snort -i eth1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;iptables -A INPUT -ptcp -s PVT_IP_HERE -d 0/0&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;wget -p    nur inhalt,   &lt;br /&gt;wget -r -np  nur unterverzeichniss, nicht von root an&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;test -x $1 || exit 5&lt;br /&gt;&lt;br /&gt;find /proc -type s&lt;br /&gt;&lt;br /&gt;ls  -Rr /proc/[0-9]* | fgrep ^s&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-7021701286489463401?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/7021701286489463401/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/cmds-some-shell-commandos-linux.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7021701286489463401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7021701286489463401'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/cmds-some-shell-commandos-linux.html' title='CMDs: some shell commandos, linux'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-7029336257504617108</id><published>2009-07-03T05:58:00.000-07:00</published><updated>2009-11-28T05:58:06.653-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>PYTHON: get your own exception catcher</title><content type='html'>you can set your own exception handler, this is done by&lt;br /&gt;&lt;pre&gt;sys.excepthook = your_func&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;for that you must define a function, with following parameters:&lt;br /&gt;&lt;pre name="code" class="python"&gt;&lt;br /&gt;def your_func(exc_type, exc_obj, exc_tb):&lt;br /&gt;    print "whoaaa my exception"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;then you can call an exception&lt;br /&gt;&lt;br /&gt;5/0&lt;br /&gt;=&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;whoaaa my exception&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="python"&gt;&lt;br /&gt;def your_func(exc_type, exc_obj, exc_tb):&lt;br /&gt;    import traceback&lt;br /&gt;    l = traceback.format_exception(exc_type, exc_obj, exc_tb)&lt;br /&gt;    print type(l)&lt;br /&gt;    print l&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;=&gt;&lt;br /&gt;&lt;type 'list'&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;['Traceback (most recent call last):\n', '  File "./t1.py", line 37, in &lt;module&gt;\n    5/0\n', 'ZeroDivisionError: integer division or modulo by zero\n']&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;traceback.format_exception(...) return us a list of information&lt;br /&gt;as a normal exception traceback&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://docs.python.org/library/sys.html"&gt;info about sys.xxx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-7029336257504617108?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/7029336257504617108/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/python-get-your-own-exception-catcher.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7029336257504617108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7029336257504617108'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/python-get-your-own-exception-catcher.html' title='PYTHON: get your own exception catcher'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-5824482925312155838</id><published>2009-07-02T02:20:00.000-07:00</published><updated>2009-07-02T03:19:57.091-07:00</updated><title type='text'>OSGi: ogsi or wtf?</title><content type='html'>small info about OSGi&lt;br /&gt;&lt;br /&gt;first we have OGSI and OSGi:&lt;br /&gt;1) OGSI: Open Grid Services Infrastructure&lt;br /&gt;2) OSGi: a framework for component based programming&lt;br /&gt;&lt;br /&gt;here I talk about OSGi&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/OSGi"&gt;Wiki&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.osgi.org/About/WhyOSGi"&gt;Why OSGI&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;OGSi Equinox: &lt;a href="http://www.eclipse.org/equinox/"&gt;http://www.eclipse.org/equinox/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.osgi.org"&gt;OSGi page&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.osgi.org/Specifications/HomePage?section=2#Release4"&gt;specifications v4&lt;/a&gt;&lt;br /&gt;&lt;a href="http://aneeshkumarkb.blogspot.com/"&gt;simple tutorial&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-5824482925312155838?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/5824482925312155838/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/osgi-ogsi-or-wtf.html#comment-form' title='1 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5824482925312155838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5824482925312155838'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/osgi-ogsi-or-wtf.html' title='OSGi: ogsi or wtf?'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-933899693834657785</id><published>2009-07-02T02:12:00.000-07:00</published><updated>2009-07-02T02:16:39.617-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ping'/><category scheme='http://www.blogger.com/atom/ns#' term='scanner'/><category scheme='http://www.blogger.com/atom/ns#' term='socket'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>PYTHON: simple scanner in python</title><content type='html'>this is a simple scanner in python.&lt;br /&gt;&lt;br /&gt;work:  call a system ping (with popen() ) and look for ttl count.&lt;br /&gt;if count ~64 -&gt; linux,  count ~128 -&gt; windows,  count  ~255 -&gt; BSD/Router&lt;br /&gt;&lt;br /&gt;then it connect to well known ports and look for respond.&lt;br /&gt;&lt;br /&gt;limits: only certain ports and only TCP&lt;br /&gt;&lt;br /&gt;trace2.py&lt;br /&gt;################################################################### &lt;pre&gt;&lt;br /&gt;#!/usr/bin/python&lt;br /&gt;&lt;br /&gt;import sys, os, socket, re&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;class Scan:&lt;br /&gt;  def __init__(self):&lt;br /&gt;    #print "create socket ..."&lt;br /&gt;    self.scanNew=None&lt;br /&gt;    self.allPorts={"ftp-data":20, "ftp":21,"smtp":25, "http":80, "pop3":110, "imap3":220,  "https":443,&lt;br /&gt;                    "ldap":389 }&lt;br /&gt;    self.linuxPorts={"ssh":22, "dns":53, "snmp":161, "snmp-trap":162}&lt;br /&gt;    self.windowPorts={"netbios-ns":137, "netbios-dgm":138, "netbios-ssn":139,"microsoft-ds":445 }&lt;br /&gt;&lt;br /&gt;  def ping(self, ip):&lt;br /&gt;    findttl = re.compile(r"ttl=(\d{1,3}) ")&lt;br /&gt;    pingpipe = os.popen("ping -W 1 -c 1 "+ip,"r")&lt;br /&gt;    for line in pingpipe.readlines():&lt;br /&gt;      if "ttl" in line:&lt;br /&gt;        result = re.findall(findttl,line)&lt;br /&gt;        return int(result[0])&lt;br /&gt;    return -1  &lt;br /&gt;&lt;br /&gt;  def connectTCP(self, ip, port, portname):&lt;br /&gt;    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)&lt;br /&gt;    s.settimeout(1)&lt;br /&gt;    try:&lt;br /&gt;      s.connect((ip, port))&lt;br /&gt;      print "connect to %s : %d (%s) was succesfull"%(ip, port, portname)&lt;br /&gt;    except:&lt;br /&gt;      pass&lt;br /&gt;      #print "failing to connect %s : %d (%s)"%(ip, port, portname)&lt;br /&gt;    s.close()&lt;br /&gt;&lt;br /&gt;  def scann(self, ip):&lt;br /&gt;    ttl=self.ping(ip)&lt;br /&gt;    if( ttl==-1):&lt;br /&gt;      print "IP %s not reachable"%ip&lt;br /&gt;    elif( ttl==0 ):&lt;br /&gt;      print "huch, ttl is zero"&lt;br /&gt;    elif( ttl&gt;0 and ttl&lt;65 ):&lt;br /&gt;      print " %s possible LINUX and is Alive"%ip&lt;br /&gt;      for port in self.allPorts.keys():&lt;br /&gt;        self.connectTCP(ip, self.allPorts[port], port)&lt;br /&gt;      for port in self.linuxPorts.keys():&lt;br /&gt;        self.connectTCP(ip, self.linuxPorts[port], port)&lt;br /&gt;    elif( ttl&gt;64 and ttl&lt;129 ):&lt;br /&gt;      print " %s possible WINDOWS and is Alive"%ip&lt;br /&gt;      for port in self.allPorts.keys():&lt;br /&gt;        self.connectTCP(ip, self.allPorts[port], port)&lt;br /&gt;      for port in self.windowPorts.keys():&lt;br /&gt;        self.connectTCP(ip, self.windowPorts[port], port)&lt;br /&gt;    else:&lt;br /&gt;      print " %s possible BSD or Router and is Alive"%ip&lt;br /&gt;      for port in self.allPorts.keys():&lt;br /&gt;        self.connectTCP(ip, self.allPorts[port], port)&lt;br /&gt;      for port in self.linuxPorts.keys():&lt;br /&gt;        self.connectTCP(ip, self.linuxPorts[port], port)&lt;br /&gt;&lt;br /&gt;if( len(sys.argv) != 4):&lt;br /&gt;  print "%s ip(first triple) begin end"%sys.argv[0]&lt;br /&gt;  print "  example:"&lt;br /&gt;  print "  %s 123.45.67  10 20"%sys.argv[0]&lt;br /&gt;  sys.exit(2)&lt;br /&gt;&lt;br /&gt;iptriple=sys.argv[1]&lt;br /&gt;begin=int(sys.argv[2])&lt;br /&gt;end=int(sys.argv[3])&lt;br /&gt;&lt;br /&gt;scan=Scan()&lt;br /&gt;&lt;br /&gt;for ip4 in range(begin, end):&lt;br /&gt;  ip="%s.%d"%(iptriple,ip4)&lt;br /&gt;  scan.scann(ip)&lt;/pre&gt;&lt;br /&gt;###################################################################&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-933899693834657785?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/933899693834657785/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/python-simple-scanner-in-python.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/933899693834657785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/933899693834657785'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/python-simple-scanner-in-python.html' title='PYTHON: simple scanner in python'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-6483962583248535901</id><published>2009-07-01T05:34:00.000-07:00</published><updated>2009-07-01T05:45:18.757-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='regex'/><category scheme='http://www.blogger.com/atom/ns#' term='c'/><title type='text'>C, REGEX</title><content type='html'>&lt;span style="font-weight: bold;"&gt;learn regular expression in C&lt;/span&gt;&lt;br /&gt;info:&lt;br /&gt;http://www.opengroup.org/onlinepubs/007908799/xsh/regex.h.html&lt;br /&gt;&lt;pre&gt;#include &amp;lt;regex.h&amp;gt;&lt;/pre&gt;&lt;br /&gt;structuren:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;regex_t preg;&lt;br /&gt;regmatch_t pmatch[100];&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;example: regex1.c&lt;br /&gt;#################################################&lt;pre&gt;&lt;br /&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include &amp;lt;string.h&amp;gt;&lt;br /&gt;#include &amp;lt;sys/types.h&amp;gt;&lt;br /&gt;#include &amp;lt;fcntl.h&amp;gt;&lt;br /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;#include &amp;lt;regex.h&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int main() {&lt;br /&gt;&lt;br /&gt;  int err;&lt;br /&gt;  char err_str[200];&lt;br /&gt;  char results[500];&lt;br /&gt;&lt;br /&gt;  int i,j,k=0;&lt;br /&gt;&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;regex_t preg;&lt;br /&gt;  regmatch_t pmatch[100];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  char *buf=&lt;span style="font-style:italic;"&gt;"blub blub blub@googlemail.com adslfku asdf@gmail.com oasduf";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  if( (err = &lt;span style="font-weight:bold;"&gt;regcomp(&amp;preg, "\\b[A-Za-z0-9._%+-]+@(gmail|googlemail)+\\.[a-zA-Z]{2,4}\\b", REG_EXTENDED)&lt;/span&gt;) != 0)  {&lt;br /&gt;    printf("regcomp error\n");&lt;br /&gt;    return -1;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  if( (err =&lt;span style="font-weight:bold;"&gt; regexec(&amp;preg, buf, preg.re_nsub, pmatch, 0)&lt;/span&gt;) != 0)  {&lt;br /&gt;   &lt;span style="font-weight:bold;"&gt; regerror(err, &amp;preg, err_str, 200);&lt;/span&gt;&lt;br /&gt;    printf("%s\n",err_str);&lt;br /&gt;    return -1;&lt;br /&gt;  } else {&lt;br /&gt;    for(i = 0; i &lt; &lt;span style="font-weight:bold;"&gt;preg.re_nsub&lt;/span&gt;; i++) {&lt;br /&gt;      if(pmatch[i].rm_so == -1) continue;&lt;br /&gt;      for(j = pmatch[i].rm_so; j &lt; pmatch[i].rm_eo; j++) &lt;br /&gt;        results[k++] = buf[j];&lt;br /&gt;      results[k] = '|';&lt;br /&gt;      results[++k] = '\0';&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;  printf("&gt;&gt; results: %s\n", results);&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;regfree(&amp;preg);&lt;/span&gt;&lt;br /&gt;return 0;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;#################################################&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;"\\b[A-Za-z0-9._%+-]+@(gmail|googlemail)+\\.[a-zA-Z]{2,4}\\b"&lt;/span&gt;: example pattern&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;regcomp()&lt;/span&gt;:  compile the seek string (pattern)&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;regexec()&lt;/span&gt;:  seek for a pattern in string&lt;br /&gt;&lt;br /&gt;struct &lt;span style="font-weight:bold;"&gt;regmatch_t&lt;/span&gt;&lt;pre&gt;&lt;br /&gt;typedef struct&lt;br /&gt;{&lt;br /&gt;  regoff_t rm_so;  /* Byte offset from string's start to substring's start.  */&lt;br /&gt;  regoff_t rm_eo;  /* Byte offset from string's start to substring's end.  */&lt;br /&gt;} regmatch_t; &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;further functions:&lt;br /&gt;regerror(): error handling&lt;br /&gt;regfree (): free buffers&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-6483962583248535901?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/6483962583248535901/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/c-regex.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6483962583248535901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6483962583248535901'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/c-regex.html' title='C, REGEX'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-6886483803691152061</id><published>2009-07-01T04:30:00.000-07:00</published><updated>2009-07-01T04:41:22.543-07:00</updated><title type='text'>C, CURL: simple tutorial: libcurl with C</title><content type='html'>&lt;span style="font-weight:bold;"&gt;coding libcurl in C&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;homepage: http://curl.haxx.se/&lt;br /&gt;&lt;br /&gt;download: http://curl.haxx.se/download.html&lt;br /&gt;latest version: latest:curl-7.19.5&lt;br /&gt;&lt;br /&gt;libcurl: http://curl.haxx.se/libcurl/&lt;br /&gt;all about libcurl with C: http://curl.haxx.se/libcurl/c/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You must include:  &lt;pre&gt;&amp;lt;curl/curl.h&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;compile&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;gcc libcurl1.c -o libcurl1 -lcurl&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;important structures:&lt;br /&gt;&lt;span style="font-style:italic;"&gt; &lt;br /&gt;CURL *curl;&lt;br /&gt;CURLcode curl_res;&lt;br /&gt;CURLINFO info;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Start a libcurl easy session &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;curl = curl_easy_init();&lt;/span&gt;&lt;br /&gt;see more info: http://curl.haxx.se/libcurl/c/curl_easy_init.html&lt;br /&gt;&lt;br /&gt;set options for a curl easy handle &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;curl_easy_setopt(CURL *handle, CURLoption option, parameter); &lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt; CURLOPT_WRITEDATA&lt;/span&gt;  Data pointer to pass to the file write function&lt;br /&gt;    &lt;span style="font-weight:bold;"&gt;curl_easy_setopt(curl, CURLOPT_WRITEDATA,  tmp);&lt;/span&gt;&lt;br /&gt;      tmp: FILE handle&lt;br /&gt;&lt;br /&gt;set proxy&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;curl_easy_setopt(curl, CURLOPT_PROXY, pxy);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Perform a file transfer &lt;br /&gt; &lt;span style="font-weight:bold;"&gt; curl_easy_perform(CURL * handle );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;End a libcurl easy session &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;curl_easy_cleanup(curl);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;set an url&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;curl_easy_setopt(curl, CURLOPT_URL, url);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;set file handle, where the data get writed&lt;br /&gt; &lt;span style="font-weight:bold;"&gt; curl_easy_setopt(curl, CURLOPT_WRITEDATA,  tmp);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;download the page &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;curl_res = curl_easy_perform(curl);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;get http status code&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &amp;http_code);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;get size of downloaded page&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &amp;c_length);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;sample: &lt;span style="font-weight:bold;"&gt;libcurl1.c&lt;/span&gt;&lt;br /&gt;##########################################&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include &amp;lt;string.h&amp;gt;&lt;br /&gt;#include &amp;lt;sys/types.h&amp;gt;&lt;br /&gt;#include &amp;lt;fcntl.h&amp;gt;&lt;br /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;#include &amp;lt;curl/curl.h&amp;gt;&lt;br /&gt;&lt;br /&gt;int main() {&lt;br /&gt;  CURL *curl;&lt;br /&gt;  CURLcode curl_res;&lt;br /&gt;  CURLINFO info;&lt;br /&gt;  long http_code;&lt;br /&gt;  double c_length;  &lt;br /&gt;  FILE *tmp;&lt;br /&gt;&lt;br /&gt;  tmp=fopen("/tmp/google_index.html", "w");&lt;br /&gt;  if(tmp==NULL) {&lt;br /&gt;    printf("ERROR to open file /tmp/google_index.html\n");&lt;br /&gt;    exit(2);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  printf("init curl session\n");&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;curl = curl_easy_init();&lt;/span&gt;&lt;br /&gt;  printf("set url to download\n");&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;curl_easy_setopt(curl, CURLOPT_URL, "http://www.google.de/index.html");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  printf("set file handler to write\n");&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;curl_easy_setopt(curl, CURLOPT_WRITEDATA,  tmp);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  printf("download the file\n");&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;curl_res = curl_easy_perform(curl);&lt;/span&gt;&lt;br /&gt;  if(curl_res==0) {&lt;br /&gt;    printf("file downloaded\n");&lt;br /&gt;  } else {&lt;br /&gt;    printf("ERROR in dowloading file\n");&lt;br /&gt;    fclose(tmp);&lt;br /&gt;    &lt;span style="font-weight:bold;"&gt;curl_easy_cleanup(curl);&lt;/span&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  printf("get http return code\n");&lt;br /&gt; &lt;span style="font-weight:bold;"&gt; curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &amp;http_code);&lt;/span&gt;&lt;br /&gt;  printf("http code: %lu\n", http_code);&lt;br /&gt;&lt;br /&gt;  printf("get size of download page\n");&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &amp;c_length);&lt;/span&gt;&lt;br /&gt;  printf("length: %g\n", c_length);&lt;br /&gt;&lt;br /&gt;  printf("END: close all files and sessions\n");&lt;br /&gt;  fclose(tmp);&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;curl_easy_cleanup(curl);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  return 0;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;##########################################&lt;br /&gt;&lt;br /&gt;./libcurl1 &lt;br /&gt;init curl session&lt;br /&gt;set url to download&lt;br /&gt;set file handler to write&lt;br /&gt;download the file&lt;br /&gt;file downloaded&lt;br /&gt;get http return code&lt;br /&gt;http code: 200&lt;br /&gt;get size of download page&lt;br /&gt;length: 6969&lt;br /&gt;END: close all files and sessions&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-6886483803691152061?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/6886483803691152061/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/c-curl-simple-tutorial-libcurl-with-c.html#comment-form' title='2 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6886483803691152061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6886483803691152061'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/07/c-curl-simple-tutorial-libcurl-with-c.html' title='C, CURL: simple tutorial: libcurl with C'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-1445588269594959528</id><published>2009-06-29T01:10:00.000-07:00</published><updated>2009-06-29T01:12:14.836-07:00</updated><title type='text'>LINUX: create cdrom iso</title><content type='html'>to copy a cd to an iso image:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;dd if=/dev/sr0 of=image.iso bs=2048&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;or use brasero application&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-1445588269594959528?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/1445588269594959528/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/06/linux-create-cdrom-iso.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/1445588269594959528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/1445588269594959528'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/06/linux-create-cdrom-iso.html' title='LINUX: create cdrom iso'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-2874977546993513701</id><published>2009-06-12T06:58:00.000-07:00</published><updated>2009-06-29T01:13:12.306-07:00</updated><title type='text'>PERL: get page with perl</title><content type='html'>a example&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;sub getpage($$) {&lt;br /&gt;    my $link = shift;&lt;br /&gt;    my $base = shift;&lt;br /&gt;&lt;br /&gt;    my @site_content;&lt;br /&gt;   &lt;br /&gt;    my $ua = LWP::UserAgent-&gt;new();&lt;br /&gt;    $ua-&gt;agent('Mozilla/5.0');&lt;br /&gt;&lt;br /&gt;    my $request = HTTP::Request-&gt;new('GET', $link);&lt;br /&gt;    my $response = $ua-&gt;request($request);&lt;br /&gt;    print "Retrieving http-page...\n";&lt;br /&gt;    if ( $response-&gt;is_error() ) {&lt;br /&gt;        $urls{$base}{'error'} =  "Error code    : ". $response-&gt;code() . "\n" .&lt;br /&gt;            "Error message:  " .  $response-&gt;message() . "\n";&lt;br /&gt;        return ();&lt;br /&gt;    }&lt;br /&gt;    else {&lt;br /&gt;        #print Dumper($response);&lt;br /&gt;        @site_content = split /\n/,  $response-&gt;content();&lt;br /&gt;        $urls{$base}{'lasturl'} = $response-&gt;request-&gt;uri;&lt;br /&gt;        return @site_content;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-2874977546993513701?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/2874977546993513701/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/06/get-page-with-perl.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2874977546993513701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2874977546993513701'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/06/get-page-with-perl.html' title='PERL: get page with perl'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-8555232972200869151</id><published>2009-06-05T06:04:00.000-07:00</published><updated>2009-06-26T07:10:30.595-07:00</updated><title type='text'>encrypt with gpg</title><content type='html'>encrpyt:&lt;br /&gt;&lt;br /&gt;gpg -c --cipher-algo blowfish filename.txt&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;decrypt:&lt;br /&gt;&lt;br /&gt;gpg -d filename.txt.gpg &gt; output.txt&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-8555232972200869151?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/8555232972200869151/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/06/encrypt-with-gpg.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8555232972200869151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8555232972200869151'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/06/encrypt-with-gpg.html' title='encrypt with gpg'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-7786729469267319142</id><published>2009-04-02T10:06:00.000-07:00</published><updated>2009-06-26T07:10:30.595-07:00</updated><title type='text'>format output in ruby</title><content type='html'>&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;with #{ }&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;puts "Text is #{["Test 1", "Test 2"][1]}"&lt;/span&gt;&lt;br /&gt;=&gt;Text is Test 2&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family: courier new;"&gt;["Test 1", "Test 2"]&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;create array with "Test 1" and "Test 2"&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family: courier new;"&gt;["Test 1", "Test 2"][1]&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt; choose second item [1]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;print out as variable with #{}&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;simple outputs through strings objects&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;see info:  ri String#%&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;format&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;%&lt;/span&gt;&lt;span style="font-style: italic;"&gt;argument&lt;/span&gt;  =&gt; string&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: courier new;"&gt;"%05d" % 123       fill with zero on numbers&lt;br /&gt;=&gt; "00123"&lt;br /&gt;&lt;br /&gt;"%05s" % 123      do space&lt;br /&gt;=&gt; "  123"&lt;br /&gt;&lt;br /&gt;"%-05s" % 123&lt;br /&gt;=&gt; "123  "&lt;br /&gt;&lt;br /&gt;"%-5s: %08x" % [ "ID", self.object_id ]&lt;br /&gt;=&gt; "ID   : fdbe224ac"&lt;/pre&gt;&lt;span style="font-family:courier new;"&gt;"%10.3f" % 123&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;=&gt; "   123.000"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;"%-10.3f" % 123&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;=&gt; "123.000   "&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;output with sprintf&lt;/span&gt;   analog to sprintf in c&lt;br /&gt;&lt;br /&gt;see info: ri sprintf&lt;br /&gt;&lt;br /&gt; format(format_string [, arguments...] )   =&gt; string&lt;br /&gt; sprintf(format_string [, arguments...] )  =&gt; string&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sprintf("%d %04x", 123, 123)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;=&gt; "123 007b"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sprintf("%08b '%4s'", 123, 123)            &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;=&gt; "01111011 ' 123'"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sprintf("%1$*2$s %2$d %1$s", "hello", 8)  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;=&gt; "   hello 8 hello"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sprintf("%1$*2$s %2$d", "hello", -8)       &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;=&gt; "hello    -8"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sprintf("%+g:% g:%-g", 1.23, 1.23, 1.23)   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;=&gt; "+1.23: 1.23:1.23"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sprintf("%u", -123)                        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;=&gt; "..4294967173"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;i,d integer&lt;br /&gt;x hex&lt;br /&gt;s string&lt;br /&gt;b bit&lt;br /&gt;e,f,g floating&lt;br /&gt;%x$y  x which argument, y what (i,d,s,..)&lt;br /&gt;%1$*2$s  argument 1 with length of argument 2 (string)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-7786729469267319142?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/7786729469267319142/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/04/format-output-in-ruby.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7786729469267319142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7786729469267319142'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/04/format-output-in-ruby.html' title='format output in ruby'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-4264490661048468457</id><published>2009-02-23T03:52:00.000-08:00</published><updated>2011-03-24T01:59:20.902-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><title type='text'>ruby infos</title><content type='html'>&lt;a href="http://www.rubyinside.com/passenger-stack-quickly-install-a-full-ruby-and-passenger-stack-1533.html"&gt;http://www.rubyinside.com/passenger-stack-quickly-install-a-full-ruby-and-passenger-stack-1533.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://benschwarz.github.com/passenger-stack/"&gt;Passenger-Stack&lt;/a&gt; is a set of scripts for the provisioning tool Sprinkle that make installing a full Ruby, Apache and Passenger-based stack almost a one-line task. It'll take almost any UNIX-y (correction: Ubuntu / Debian) server of your choice from a generic install through to deploying Rack-based apps (including those built with Rails, Merb, Sinatra, and Ramaze).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.rubyinside.com/sprockets-a-ruby-powered-javascript-dependency-library-from-37signals-1520.html"&gt;=&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://getsprockets.org/"&gt;Sprockets&lt;/a&gt;: A Ruby-powered JavaScript dependency library from 37signals&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.rubyinside.com/building-a-ruby-gem-from-scratch-using-behavior-driven-development-1513.html"&gt;Building a Ruby Gem (From Scratch) Using Behavior Driven Development&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-4264490661048468457?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/4264490661048468457/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/02/ruby-infos.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4264490661048468457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4264490661048468457'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/02/ruby-infos.html' title='ruby infos'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-8801623399522159818</id><published>2009-01-26T13:50:00.000-08:00</published><updated>2009-06-26T07:10:30.596-07:00</updated><title type='text'>SECURITY macchanger</title><content type='html'>http://www.fedorawiki.de/index.php/MACChanger&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-8801623399522159818?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/8801623399522159818/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/01/security-macchanger.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8801623399522159818'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/8801623399522159818'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/01/security-macchanger.html' title='SECURITY macchanger'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-4420780669064972173</id><published>2009-01-19T04:04:00.000-08:00</published><updated>2009-06-26T07:10:30.596-07:00</updated><title type='text'>COMP  cdrecord</title><content type='html'>cdrecord -scannbusscsibus1:&lt;br /&gt;    1,0,0    100) 'HL-DT-ST' 'DVD+-RW GSA-H31L' 'W616' Removable CD-ROM&lt;br /&gt;    1,1,0    101) *&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;cdrecord -v -pad dev=1,0,0 speed=8 blub.iso&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-4420780669064972173?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/4420780669064972173/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/01/comp-cdrecord.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4420780669064972173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4420780669064972173'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/01/comp-cdrecord.html' title='COMP  cdrecord'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-1933211116210652155</id><published>2009-01-08T13:02:00.000-08:00</published><updated>2009-06-26T07:10:30.596-07:00</updated><title type='text'>anonym in p2p</title><content type='html'>RShare, &lt;a href="http://www.stealthnet.de"&gt;www.stealthnet.de&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;RShare node, RShareID&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-1933211116210652155?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/1933211116210652155/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/01/anonym-in-p2p.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/1933211116210652155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/1933211116210652155'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/01/anonym-in-p2p.html' title='anonym in p2p'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-6480176616238313729</id><published>2009-01-08T08:49:00.000-08:00</published><updated>2009-06-26T07:10:30.596-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='derby'/><title type='text'>Java SQL derby</title><content type='html'>derby -&gt; apache&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;System.setProperty("derby.system.home"&lt;/span&gt;, "dbname.db");&lt;br /&gt;&lt;br /&gt;Connection conn = DriverManager.getConnection("jdbc:derby:test_db;create=true");&lt;br /&gt;&lt;br /&gt;try {&lt;br /&gt;  Statement s = conn.createStatement();&lt;br /&gt;  s.execute("CREATE TABLE data (id INT, text VARCHAR(100), PRIMARY KEY (id))");&lt;br /&gt;  s.execute("INSERT INTO data VALUES (1, 'Hallo')");&lt;br /&gt;  s.execute("INSERT INTO data VALUES (2, 'Blub')");&lt;br /&gt;&lt;br /&gt;  ResultSet rs = s.exeucteQuery("SELECT text FROM data WHERE id=1");&lt;br /&gt;&lt;br /&gt;  while (rs.next()) {&lt;br /&gt;    String text = rs.getString("text");&lt;br /&gt;    System.out.println(text);&lt;br /&gt;  }&lt;br /&gt;} finally {&lt;br /&gt;  conn.close();&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-6480176616238313729?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/6480176616238313729/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/01/java-sql-derby.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6480176616238313729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6480176616238313729'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/01/java-sql-derby.html' title='Java SQL derby'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-5122652032350113011</id><published>2009-01-08T04:57:00.000-08:00</published><updated>2009-06-26T07:10:30.596-07:00</updated><title type='text'>Java SQL</title><content type='html'>&lt;span style="font-family: arial;"&gt;java.sql.*&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;connecting to Driver Interface&lt;/span&gt;&lt;br /&gt;try {&lt;br /&gt;  class.forName("com.mysql.jdbc.Driver").newInstance();&lt;br /&gt;} catch ( Exception e) { ... }&lt;br /&gt;&lt;br /&gt;Connection cn = DriverManager.getConnection("jdbc:mysql://localhost/test?user=bla&amp;amp;password=bla");&lt;br /&gt;&lt;br /&gt;SQLException ex;&lt;br /&gt;ex.getMessage().ex_getSQLState()&lt;br /&gt;ex.getErrorCode()&lt;br /&gt;&lt;br /&gt;Statement st = cn.&lt;span style="font-weight: bold;"&gt;createStatement&lt;/span&gt;();&lt;br /&gt;ResultSet rs = st.&lt;span style="font-weight: bold;"&gt;executeQuery(&lt;/span&gt;"SELECT ...");&lt;br /&gt;&lt;br /&gt;if( st.execute("SELECT ..."))&lt;br /&gt;   rs = st.&lt;span style="font-weight: bold;"&gt;getResultSet&lt;/span&gt;();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rs.close(); st.close();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-5122652032350113011?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/5122652032350113011/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/01/java-sql.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5122652032350113011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/5122652032350113011'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/01/java-sql.html' title='Java SQL'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-4940210620514799184</id><published>2009-01-08T03:48:00.000-08:00</published><updated>2009-06-26T07:10:30.597-07:00</updated><title type='text'>STUFF</title><content type='html'>&lt;span style="font-family: arial;"&gt;objdump -D -b -m i386 egg_1 &gt; egg_1.asm&lt;br /&gt;&lt;br /&gt;((void(*)())buf)();   execute buf, cast to function&lt;br /&gt;&lt;br /&gt;p $ebp+4        # show the address&lt;br /&gt;x $ebp+4        # show the content&lt;br /&gt;&lt;br /&gt;disas 0x00c42d00&lt;br /&gt;&lt;br /&gt;unlimit -c unlimited             -&gt; on segmentation fault will get a coredump&lt;br /&gt;-&gt; gdb -c core*&lt;br /&gt;&lt;br /&gt;ald:  assembly language debugger&lt;br /&gt;&lt;br /&gt;ald: attach pid&lt;br /&gt;load prog&lt;br /&gt;d, b 0xbf...&lt;br /&gt;n e -n 280 0xBF&lt;br /&gt;d -n 22 0x...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-4940210620514799184?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/4940210620514799184/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/01/stuff.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4940210620514799184'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4940210620514799184'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/01/stuff.html' title='STUFF'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-6789538132623933113</id><published>2009-01-06T11:51:00.000-08:00</published><updated>2009-06-26T07:07:29.613-07:00</updated><title type='text'>JAVA networking</title><content type='html'>&lt;span style="font-weight: bold;"&gt;TCP-Socket&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;java.net.Socket&lt;br /&gt;java.net.ServerSocket&lt;br /&gt;&lt;br /&gt;Socket.getInputStream()   Socket.getOutputStream()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;UDP-Socket&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;java.net.DatagramSocket&lt;br /&gt;java.net.DatagramPacket&lt;br /&gt;&lt;br /&gt;send(),   receive()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;RMI&lt;/span&gt;  Remote Method Invocation&lt;br /&gt;&lt;br /&gt;java.rmi.Remote&lt;br /&gt;java.rmi.server.UnicastRemoteObject&lt;br /&gt;&lt;br /&gt;rmic rmi-compiler -&gt; Stub and Skeletonclass&lt;br /&gt;&lt;br /&gt;class S as server, implement interface SI, SI has the bussineslogic,&lt;br /&gt;rmi build from it the correct in/output for data&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;JMS&lt;/span&gt;  Java Messaging Service&lt;br /&gt;&lt;br /&gt;(middleware) asynchrone communication&lt;br /&gt;Queue (point2point), Topic(publish/subscriber)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;SOAP&lt;/span&gt;  simple object access protocol&lt;br /&gt;&lt;br /&gt;inter-object-communication  (most http as protocol)&lt;br /&gt;XML, textoriented&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-6789538132623933113?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/6789538132623933113/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/01/java-networking.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6789538132623933113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/6789538132623933113'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/01/java-networking.html' title='JAVA networking'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-3633866778671907505</id><published>2009-01-06T11:38:00.000-08:00</published><updated>2009-06-26T07:10:30.597-07:00</updated><title type='text'>all: why</title><content type='html'>here are all information that i gather for me.&lt;br /&gt;&lt;br /&gt;that is something about java, hacking,  biotechnology and so.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-3633866778671907505?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/3633866778671907505/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2009/01/all-why.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/3633866778671907505'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/3633866778671907505'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2009/01/all-why.html' title='all: why'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-3950829930350746960</id><published>2008-12-29T15:12:00.000-08:00</published><updated>2009-06-26T07:10:30.597-07:00</updated><title type='text'>get options with getoptlong</title><content type='html'>install:&lt;br /&gt;&lt;br /&gt;~# &lt;span style="font-weight: bold;"&gt;gem install getopt&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Successfully installed getopt-1.3.7&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;1 gem installed&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Installing ri documentation for getopt-1.3.7...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Installing RDoc documentation for getopt-1.3.7...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;need: &lt;span style="font-weight: bold;"&gt;require 'getoptlong'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="color:#444444;"&gt;#!/usr/bin/ruby&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;require&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;'getoptlong'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;opts &lt;span style="color:#4444ff;"&gt;=&lt;/span&gt; GetoptLong.new&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#4444ff;"&gt;&lt;strong&gt;[&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;"--test"&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt;             &lt;span style="color:#008000;"&gt;"-t"&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt;   GetoptLong&lt;span style="color:#4444ff;"&gt;::&lt;/span&gt;REQUIRED_ARGUMENT &lt;span style="color:#4444ff;"&gt;&lt;strong&gt;]&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#4444ff;"&gt;&lt;strong&gt;[&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;"--blub"&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt;             &lt;span style="color:#008000;"&gt;"-b"&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt;   GetoptLong&lt;span style="color:#4444ff;"&gt;::&lt;/span&gt;OPTIONAL_ARGUMENT &lt;span style="color:#4444ff;"&gt;&lt;strong&gt;]&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#4444ff;"&gt;&lt;strong&gt;[&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;"--help"&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt;             &lt;span style="color:#008000;"&gt;"-h"&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt;   GetoptLong&lt;span style="color:#4444ff;"&gt;::&lt;/span&gt;NO_ARGUMENT &lt;span style="color:#4444ff;"&gt;&lt;strong&gt;]&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#4444ff;"&gt;&lt;strong&gt;[&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;"--usage"&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt;            &lt;span style="color:#008000;"&gt;"-u"&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt;   GetoptLong&lt;span style="color:#4444ff;"&gt;::&lt;/span&gt;NO_ARGUMENT &lt;span style="color:#4444ff;"&gt;&lt;strong&gt;]&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#4444ff;"&gt;&lt;strong&gt;[&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;"--version"&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt;          &lt;span style="color:#008000;"&gt;"-v"&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt;   GetoptLong&lt;span style="color:#4444ff;"&gt;::&lt;/span&gt;NO_ARGUMENT &lt;span style="color:#4444ff;"&gt;&lt;strong&gt;]&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;opts.each &lt;strong&gt;do&lt;/strong&gt; |opt&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt; arg|&lt;br /&gt; &lt;strong&gt;case&lt;/strong&gt; opt&lt;br /&gt;   &lt;strong&gt;when&lt;/strong&gt; &lt;span style="color:#008000;"&gt;"--test"&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;puts&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;"we must extract :&lt;span style="color:#2040a0;"&gt;#{arg}&lt;/span&gt;:"&lt;/span&gt;&lt;br /&gt;   &lt;strong&gt;when&lt;/strong&gt; &lt;span style="color:#008000;"&gt;"--blub"&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;puts&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;"blub blub : &lt;span style="color:#2040a0;"&gt;#{arg}&lt;/span&gt; :"&lt;/span&gt;&lt;br /&gt;   &lt;strong&gt;when&lt;/strong&gt; &lt;span style="color:#008000;"&gt;"--help"&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;puts&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;"help yourself"&lt;/span&gt;&lt;br /&gt;   &lt;strong&gt;when&lt;/strong&gt; &lt;span style="color:#008000;"&gt;"--usage"&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;puts&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;"getoiptlong.rb"&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;puts&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;" -t, -b, -h, -u , -v"&lt;/span&gt;&lt;br /&gt;   &lt;strong&gt;when&lt;/strong&gt; &lt;span style="color:#008000;"&gt;"--version"&lt;/span&gt;&lt;br /&gt;     &lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;puts&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;"version 0.01"&lt;/span&gt;&lt;br /&gt;   &lt;strong&gt;else&lt;/strong&gt;&lt;br /&gt;     &lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;puts&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;"upsala"&lt;/span&gt;&lt;br /&gt; &lt;strong&gt;end&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;end&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-3950829930350746960?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/3950829930350746960/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2008/12/get-options-with-getoptlong.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/3950829930350746960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/3950829930350746960'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2008/12/get-options-with-getoptlong.html' title='get options with getoptlong'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-3576652385209048065</id><published>2008-12-28T03:29:00.000-08:00</published><updated>2009-06-26T07:10:30.597-07:00</updated><title type='text'>print out file wiht numbers of line</title><content type='html'>&lt;pre&gt;&lt;br /&gt;&lt;font color="#444444"&gt;#!/usr/bin/ruby&lt;br /&gt;# put out file wiht numbers out&lt;br /&gt;#&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;file&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#2040a0"&gt;&lt;strong&gt;ARGV&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;[&lt;/strong&gt;&lt;/font&gt;&lt;font color="#FF0000"&gt;0&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;]&lt;/strong&gt;&lt;/font&gt; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;begin&lt;/strong&gt;&lt;br /&gt;  lines&lt;font color="4444FF"&gt;=&lt;/font&gt;File.&lt;font color="a52a2a"&gt;&lt;strong&gt;open&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/font&gt;file&lt;font color="4444FF"&gt;,&lt;/font&gt; &lt;font color="#008000"&gt;&amp;quot;r&amp;quot;&lt;/font&gt;&lt;font color="4444FF"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/font&gt;.&lt;font color="a52a2a"&gt;&lt;strong&gt;readlines&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;  &lt;font color="a52a2a"&gt;&lt;strong&gt;format&lt;/strong&gt;&lt;/font&gt;&lt;font color="4444FF"&gt;=&lt;/font&gt;&lt;font color="#008000"&gt;&amp;quot;%0&lt;font color="#2040a0"&gt;#{lines.size.to_s.size}&lt;/font&gt;d&amp;quot;&lt;/font&gt;&lt;br /&gt;  lines.each_with_index &lt;font color="4444FF"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/font&gt; |l&lt;font color="4444FF"&gt;,&lt;/font&gt; i|&lt;br /&gt;    &lt;font color="a52a2a"&gt;&lt;strong&gt;puts&lt;/strong&gt;&lt;/font&gt; &lt;font color="#008000"&gt;&amp;quot;&lt;font color="#2040a0"&gt;#{sprintf(format, i+1)}&lt;/font&gt;: &lt;font color="#2040a0"&gt;#{l}&lt;/font&gt;&amp;quot;&lt;/font&gt;&lt;br /&gt;  &lt;font color="4444FF"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/font&gt;&lt;br /&gt;&lt;strong&gt;rescue&lt;/strong&gt;&lt;br /&gt;  &lt;font color="a52a2a"&gt;&lt;strong&gt;puts&lt;/strong&gt;&lt;/font&gt; &lt;font color="#008000"&gt;&amp;quot;no file???   or errors&amp;quot;&lt;/font&gt;&lt;br /&gt;&lt;strong&gt;end&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-3576652385209048065?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/3576652385209048065/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2008/12/print-out-file-wiht-numbers-of-line.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/3576652385209048065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/3576652385209048065'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2008/12/print-out-file-wiht-numbers-of-line.html' title='print out file wiht numbers of line'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-4782914355670707449</id><published>2008-12-25T03:12:00.000-08:00</published><updated>2009-06-26T07:10:30.597-07:00</updated><title type='text'>print out environment variables</title><content type='html'>&lt;span style="font-weight: bold;"&gt;ENV.each do |e| &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;   p e &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;ENV: array of arrays&lt;br /&gt;&lt;br /&gt;p:  something like print or puts but better, doesn't interpolate!&lt;br /&gt;&lt;br /&gt;ENV.each:  iterate in a block each item of array ENV&lt;br /&gt;&lt;br /&gt;do .. end: blocks&lt;br /&gt;&lt;br /&gt;|e|: pipe, there is the block parameters&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;example:&lt;br /&gt;["SHELL", "/bin/bash"]&lt;br /&gt;["TERM", "xterm"]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-4782914355670707449?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/4782914355670707449/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2008/12/print-out-environment-variables.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4782914355670707449'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4782914355670707449'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2008/12/print-out-environment-variables.html' title='print out environment variables'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-7858297677304633679</id><published>2008-12-24T03:55:00.000-08:00</published><updated>2009-06-26T07:10:30.598-07:00</updated><title type='text'>create executable file, which extract a directory</title><content type='html'>umwandeln  Inhalt eines Verzeichnisses in eine ausführbare Datei. die sich selbst in&lt;br /&gt;ein Verzeichniss extrahiert&lt;br /&gt;&lt;br /&gt;Lösung&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-7858297677304633679?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/7858297677304633679/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2008/12/create-executable-file-which-extract.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7858297677304633679'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/7858297677304633679'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2008/12/create-executable-file-which-extract.html' title='create executable file, which extract a directory'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-4969290274361541657</id><published>2008-12-23T14:30:00.000-08:00</published><updated>2009-06-26T07:10:30.598-07:00</updated><title type='text'>download a page and print out links</title><content type='html'>webseite runterladen und links ausgeben&lt;br /&gt;&lt;br /&gt;Hilfslinks:&lt;br /&gt;http://snippets.dzone.com/posts/show/788&lt;br /&gt;http://www.example-code.com/ruby/rubyhttp.asp&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Lösung:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;a name="line1" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line1"&gt; 1&lt;/a&gt; &lt;span style="color:#444444;"&gt;#!/usr/bin/ruby&lt;br /&gt;&lt;a name="line2" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line2"&gt; 2&lt;/a&gt;&lt;br /&gt;&lt;a name="line3" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line3"&gt; 3&lt;/a&gt; &lt;/span&gt;&lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;require&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;'net/http'&lt;/span&gt;&lt;br /&gt;&lt;a name="line4" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line4"&gt; 4&lt;/a&gt;&lt;br /&gt;&lt;a name="line5" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line5"&gt; 5&lt;/a&gt; &lt;strong&gt;if&lt;/strong&gt; &lt;span style="color:#2040a0;"&gt;&lt;strong&gt;ARGV&lt;/strong&gt;&lt;/span&gt;.length &lt;span style="color:#4444ff;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;0&lt;/span&gt;&lt;br /&gt;&lt;a name="line6" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line6"&gt; 6&lt;/a&gt;   url&lt;span style="color:#4444ff;"&gt;=&lt;/span&gt;&lt;span style="color:#2040a0;"&gt;&lt;strong&gt;ARGV&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;[&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;0&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;]&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name="line7" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line7"&gt; 7&lt;/a&gt; &lt;strong&gt;else&lt;/strong&gt;&lt;br /&gt;&lt;a name="line8" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line8"&gt; 8&lt;/a&gt;   &lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;p&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;" url file"&lt;/span&gt;&lt;br /&gt;&lt;a name="line9" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line9"&gt; 9&lt;/a&gt;   Process.&lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;exit&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name="line10" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line10"&gt;10&lt;/a&gt; &lt;strong&gt;end&lt;/strong&gt;&lt;br /&gt;&lt;a name="line11" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line11"&gt;11&lt;/a&gt;&lt;br /&gt;&lt;a name="line12" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line12"&gt;12&lt;/a&gt; req &lt;span style="color:#4444ff;"&gt;=&lt;/span&gt; Net&lt;span style="color:#4444ff;"&gt;::&lt;/span&gt;HTTP.get_response&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/span&gt;URI.parse&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/span&gt;url&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name="line13" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line13"&gt;13&lt;/a&gt; line&lt;span style="color:#4444ff;"&gt;=&lt;/span&gt;req.body&lt;br /&gt;&lt;a name="line14" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line14"&gt;14&lt;/a&gt;&lt;br /&gt;&lt;a name="line15" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line15"&gt;15&lt;/a&gt; lines&lt;span style="color:#4444ff;"&gt;=&lt;/span&gt;line.&lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;split&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#008000;"&gt;" "&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name="line16" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line16"&gt;16&lt;/a&gt;&lt;br /&gt;&lt;a name="line17" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line17"&gt;17&lt;/a&gt; lines.each &lt;strong&gt;do&lt;/strong&gt; |l|&lt;br /&gt;&lt;a name="line18" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line18"&gt;18&lt;/a&gt;   &lt;strong&gt;if&lt;/strong&gt; l.include?&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#008000;"&gt;"href=http"&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/span&gt; &lt;strong&gt;or&lt;/strong&gt; l.include?&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#008000;"&gt;"href=&lt;span style="color:#77dd77;"&gt;\"&lt;/span&gt;http"&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name="line19" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line19"&gt;19&lt;/a&gt;     v&lt;span style="color:#ff0000;"&gt;1&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;=&lt;/span&gt;l.&lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;split&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#008000;"&gt;"&lt;span style="color:#77dd77;"&gt;\"&lt;/span&gt;"&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name="line20" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line20"&gt;20&lt;/a&gt;     &lt;strong&gt;if&lt;/strong&gt; v&lt;span style="color:#ff0000;"&gt;1.&lt;/span&gt;length&lt;span style="color:#4444ff;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;a name="line21" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line21"&gt;21&lt;/a&gt;       &lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;puts&lt;/strong&gt;&lt;/span&gt; v&lt;span style="color:#ff0000;"&gt;1&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;[&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;1&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;]&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name="line22" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line22"&gt;22&lt;/a&gt;     &lt;strong&gt;else&lt;/strong&gt;&lt;br /&gt;&lt;a name="line23" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line23"&gt;23&lt;/a&gt;       &lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;puts&lt;/strong&gt;&lt;/span&gt; v&lt;span style="color:#ff0000;"&gt;1&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;[&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;0&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;]&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name="line24" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line24"&gt;24&lt;/a&gt;     &lt;strong&gt;end&lt;/strong&gt;&lt;br /&gt;&lt;a name="line25" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line25"&gt;25&lt;/a&gt;   &lt;strong&gt;end&lt;/strong&gt;&lt;br /&gt;&lt;a name="line26" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line26"&gt;26&lt;/a&gt;  &lt;br /&gt;&lt;a name="line27" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6519677895487569153#line27"&gt;27&lt;/a&gt; &lt;strong&gt;end&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-4969290274361541657?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/4969290274361541657/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2008/12/download-page-and-print-out-links.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4969290274361541657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/4969290274361541657'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2008/12/download-page-and-print-out-links.html' title='download a page and print out links'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8137501636033288931.post-2322487267715104764</id><published>2008-12-23T13:12:00.000-08:00</published><updated>2009-06-26T07:10:30.598-07:00</updated><title type='text'>replace word in a file</title><content type='html'>ein Replace-programm für Datei erstellen.&lt;br /&gt;ein Wort durch ein anderen ersetzen&lt;br /&gt;&lt;br /&gt;Lösung:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;a name="line1" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line1"&gt; 1&lt;/a&gt; &lt;span style="color:#444444;"&gt;#!/usr/bin/ruby&lt;br /&gt;&lt;a name="line2" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line2"&gt; 2&lt;/a&gt;&lt;br /&gt;&lt;a name="line3" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line3"&gt; 3&lt;/a&gt; &lt;/span&gt;&lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;puts&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;"start"&lt;/span&gt;&lt;br /&gt;&lt;a name="line4" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line4"&gt; 4&lt;/a&gt;&lt;br /&gt;&lt;a name="line5" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line5"&gt; 5&lt;/a&gt; &lt;strong&gt;if&lt;/strong&gt; &lt;span style="color:#2040a0;"&gt;&lt;strong&gt;ARGV&lt;/strong&gt;&lt;/span&gt;.length &lt;span style="color:#4444ff;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;2&lt;/span&gt;&lt;br /&gt;&lt;a name="line6" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line6"&gt; 6&lt;/a&gt;   datei&lt;span style="color:#4444ff;"&gt;=&lt;/span&gt;&lt;span style="color:#2040a0;"&gt;&lt;strong&gt;ARGV&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;[&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;0&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;]&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name="line7" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line7"&gt; 7&lt;/a&gt;   muster&lt;span style="color:#4444ff;"&gt;=&lt;/span&gt;&lt;span style="color:#2040a0;"&gt;&lt;strong&gt;ARGV&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;[&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;1&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;]&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name="line8" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line8"&gt; 8&lt;/a&gt;   ersetzen&lt;span style="color:#4444ff;"&gt;=&lt;/span&gt;&lt;span style="color:#2040a0;"&gt;&lt;strong&gt;ARGV&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;[&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;2&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;]&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name="line9" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line9"&gt; 9&lt;/a&gt; &lt;strong&gt;else&lt;/strong&gt;&lt;br /&gt;&lt;a name="line10" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line10"&gt;10&lt;/a&gt;   &lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;print&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;"&lt;span style="color:#77dd77;"&gt;\n&lt;/span&gt;&lt;span style="color:#77dd77;"&gt;\t&lt;/span&gt;file02.rb  file muster replacetext&lt;span style="color:#77dd77;"&gt;\n&lt;/span&gt;&lt;span style="color:#77dd77;"&gt;\n&lt;/span&gt;"&lt;/span&gt;&lt;br /&gt;&lt;a name="line11" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line11"&gt;11&lt;/a&gt;   Process.&lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;exit&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name="line12" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line12"&gt;12&lt;/a&gt; &lt;strong&gt;end&lt;/strong&gt;&lt;br /&gt;&lt;a name="line13" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line13"&gt;13&lt;/a&gt;&lt;br /&gt;&lt;a name="line14" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line14"&gt;14&lt;/a&gt; &lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;puts&lt;/strong&gt;&lt;/span&gt; &lt;span style="color:#008000;"&gt;"mustering file &lt;span style="color:#2040a0;"&gt;#{datei}&lt;/span&gt;"&lt;/span&gt;&lt;br /&gt;&lt;a name="line15" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line15"&gt;15&lt;/a&gt;&lt;br /&gt;&lt;a name="line16" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line16"&gt;16&lt;/a&gt; f&lt;span style="color:#4444ff;"&gt;=&lt;/span&gt;File.&lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;open&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/span&gt;datei&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt; &lt;span style="color:#008000;"&gt;"r+"&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name="line17" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line17"&gt;17&lt;/a&gt;     lines &lt;span style="color:#4444ff;"&gt;=&lt;/span&gt; f.&lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;readlines&lt;/strong&gt;&lt;/span&gt;           &lt;span style="color:#444444;"&gt;# read into array of lines&lt;br /&gt;&lt;a name="line18" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line18"&gt;18&lt;/a&gt;     &lt;/span&gt;lines.each &lt;strong&gt;do&lt;/strong&gt; |it|            &lt;span style="color:#444444;"&gt;# modify lines&lt;br /&gt;&lt;a name="line19" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line19"&gt;19&lt;/a&gt;         &lt;/span&gt;it.&lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;gsub&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;!&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#b000d0;"&gt;/&lt;span style="color:#2040a0;"&gt;#{muster}&lt;/span&gt;/&lt;/span&gt;&lt;span style="color:#4444ff;"&gt;,&lt;/span&gt; ersetzen&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name="line20" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line20"&gt;20&lt;/a&gt;     &lt;strong&gt;end&lt;/strong&gt;&lt;br /&gt;&lt;a name="line21" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line21"&gt;21&lt;/a&gt;     f.pos &lt;span style="color:#4444ff;"&gt;=&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;0&lt;/span&gt;                     &lt;span style="color:#444444;"&gt;# back to start&lt;br /&gt;&lt;a name="line22" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line22"&gt;22&lt;/a&gt;     &lt;/span&gt;f.&lt;span style="color:#a52a2a;"&gt;&lt;strong&gt;print&lt;/strong&gt;&lt;/span&gt; lines                 &lt;span style="color:#444444;"&gt;# write out modified lines&lt;br /&gt;&lt;a name="line23" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line23"&gt;23&lt;/a&gt;&lt;br /&gt;&lt;a name="line24" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line24"&gt;24&lt;/a&gt;     &lt;/span&gt;f.truncate&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/span&gt;f.pos&lt;span style="color:#4444ff;"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/span&gt;  &lt;br /&gt;&lt;a name="line25" href="http://www.blogger.com/post-edit.g?blogID=919834291889325326&amp;amp;postID=6732034576265598482#line25"&gt;25&lt;/a&gt; f.close&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;syntax highlighted by &lt;a href="http://www.palfrader.org/code2html"&gt;Code2HTML&lt;/a&gt;, v. 0.9.1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8137501636033288931-2322487267715104764?l=raycompstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://raycompstuff.blogspot.com/feeds/2322487267715104764/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://raycompstuff.blogspot.com/2008/12/replace-word-in-file.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2322487267715104764'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8137501636033288931/posts/default/2322487267715104764'/><link rel='alternate' type='text/html' href='http://raycompstuff.blogspot.com/2008/12/replace-word-in-file.html' title='replace word in a file'/><author><name>Iknofkosremnadteiker</name><uri>http://www.blogger.com/profile/00405427990402269049</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='18' src='http://2.bp.blogspot.com/_gxUmJckCXY8/SkP-W6iBJ8I/AAAAAAAAAAM/R8xQusFxfd0/S220/CIMG0612b.JPG'/></author><thr:total>0</thr:total></entry></feed>
