<?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-5031268596585673045</id><updated>2011-07-31T03:03:20.709-07:00</updated><title type='text'>ifindstuff</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://isearchstuff.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5031268596585673045/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://isearchstuff.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>ifindstuff</name><uri>http://www.blogger.com/profile/18349066748061923823</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5031268596585673045.post-2957187213442587359</id><published>2010-02-21T13:35:00.000-08:00</published><updated>2010-02-21T13:58:55.074-08:00</updated><title type='text'>Read a CSV file in Clojure and save it in DB</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_qPudJFXgMkE/S4GsRkW5K0I/AAAAAAAAAA0/597qWdpIhr4/s1600-h/firstClojurePrj.JPG"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 193px;" src="http://3.bp.blogspot.com/_qPudJFXgMkE/S4GsRkW5K0I/AAAAAAAAAA0/597qWdpIhr4/s320/firstClojurePrj.JPG" alt="" id="BLOGGER_PHOTO_ID_5440819242657721154" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I discovered that a simple program that reads a csv file and save it in a database is shorter in Clojure than in Java. I searched on google and on clojure apis to find out how can be done and this is my first Clojure useful project. This is how I've done it:&lt;br /&gt;&lt;br /&gt;1. I used Oracle XE database, I created a user called clojuretest/clojurtest@XE and created a simple table country like this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE TABLE country (&lt;br /&gt;country NVARCHAR2(20) NULL,&lt;br /&gt;isocode NVARCHAR2(10) NULL&lt;br /&gt;)&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;2.  I installed Netbeans 6.8 with Enclojure plugin. I created a Clojure project and opened the REPL.&lt;br /&gt;&lt;br /&gt;3. First I wanted to parse the csv file containing pairs of country and isocode without all the Java hassle.&lt;br /&gt;I discovered that in Clojure is a special package for parsing stuff so I had to load in my REPL:&lt;br /&gt;&lt;br /&gt;(use '(clojure.contrib duck-streams str-utils))&lt;br /&gt;So after some googling around this is what I got:&lt;br /&gt;&lt;br /&gt;   (doseq [line (read-lines "D:\\clojure_test\\country.csv")]&lt;br /&gt;      (let [[x y ] (re-split #"," line)]&lt;br /&gt;      ;(println line)&lt;br /&gt;      ;(println x)&lt;br /&gt;      ;(println y)&lt;br /&gt;      (println [x y ])&lt;br /&gt;   &lt;br /&gt;      )&lt;br /&gt;    )&lt;br /&gt;This means that each line of the country.csv is read by read-lines function and the vector [x y] will be populated with each value from csv columns.&lt;br /&gt;So x will have a Afghanistan and y will have AFG.&lt;br /&gt;And after each assignment I am printing the vector to see what we got.&lt;br /&gt;&lt;br /&gt;4. Then I did some research of how to save it in the db.&lt;br /&gt;For database stuff we need this package:&lt;br /&gt;&lt;br /&gt;  (use 'clojure.contrib.sql)&lt;br /&gt;&lt;br /&gt;Then we need to declare our db connection:&lt;br /&gt;&lt;br /&gt;(def db {:classname "oracle.jdbc.driver.OracleDriver" ; must be in classpath&lt;br /&gt;         :subprotocol "oracle:thin"&lt;br /&gt;         :subname "@localhost:1521"&lt;br /&gt;         ; Any additional keys are passed to the driver&lt;br /&gt;         ; as driver-specific properties.&lt;br /&gt;         :user "clojuretest"&lt;br /&gt;         :password "clojuretest" })     &lt;br /&gt;      &lt;br /&gt;We need to define a insert function knowing the table name and column names of course:&lt;br /&gt;&lt;br /&gt;(defn insert-db-entry&lt;br /&gt;"Insert data into the table"&lt;br /&gt;[country,isocode]&lt;br /&gt;(clojure.contrib.sql/insert-values&lt;br /&gt; :country&lt;br /&gt; [:country :isocode]&lt;br /&gt; [country isocode]))&lt;br /&gt;&lt;br /&gt;5. We define a test function to see if It works:&lt;br /&gt;&lt;br /&gt;(clojure.contrib.sql/with-connection&lt;br /&gt; db&lt;br /&gt; (clojure.contrib.sql/transaction&lt;br /&gt;  (insert-db-entry "Albania" "ALB") ))&lt;br /&gt;&lt;br /&gt;  If was ok will get a (-2) response in the REPL other wise an exception will occurr.&lt;br /&gt;  Actually this was all the hard work because for a strange reason clojure did not see my jdbc jars (ojdbc14.jar) even if they were in classpath.&lt;br /&gt;  So I added as libs in Netbeans project and restarted the IDE and it worked.&lt;br /&gt;&lt;br /&gt;6. We actually write the code to do the inserts from the csv file in the db.&lt;br /&gt;Note that I do a dummy insert , no ckecking, just to see that works.&lt;br /&gt;&lt;br /&gt;(clojure.contrib.sql/with-connection&lt;br /&gt; db&lt;br /&gt; (clojure.contrib.sql/transaction&lt;br /&gt;    (doseq [line (read-lines "E:\\clojure_test\\country.csv")]&lt;br /&gt;        (let [[x y ] (re-split #"," line)]&lt;br /&gt;           (insert-db-entry x y)&lt;br /&gt;        )&lt;br /&gt;  )))&lt;br /&gt;  &lt;br /&gt; So instead of printlin the vector I could actually insert in db the x and y values!&lt;br /&gt; It worked! Maybe now it's time to search how to do filters on the data...but next time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5031268596585673045-2957187213442587359?l=isearchstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://isearchstuff.blogspot.com/feeds/2957187213442587359/comments/default' title='Postare comentarii'/><link rel='replies' type='text/html' href='http://isearchstuff.blogspot.com/2010/02/i-discovered-that-simple-program-that.html#comment-form' title='0 comentarii'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5031268596585673045/posts/default/2957187213442587359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5031268596585673045/posts/default/2957187213442587359'/><link rel='alternate' type='text/html' href='http://isearchstuff.blogspot.com/2010/02/i-discovered-that-simple-program-that.html' title='Read a CSV file in Clojure and save it in DB'/><author><name>ifindstuff</name><uri>http://www.blogger.com/profile/18349066748061923823</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_qPudJFXgMkE/S4GsRkW5K0I/AAAAAAAAAA0/597qWdpIhr4/s72-c/firstClojurePrj.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5031268596585673045.post-5855335523598672091</id><published>2010-02-19T15:01:00.000-08:00</published><updated>2010-02-19T15:07:34.894-08:00</updated><title type='text'>A useful networking tool GNS3</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_qPudJFXgMkE/S38ZI7JRmAI/AAAAAAAAAAU/xKl9Wobt3QQ/s1600-h/gns3_idle_time.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 192px;" src="http://2.bp.blogspot.com/_qPudJFXgMkE/S38ZI7JRmAI/AAAAAAAAAAU/xKl9Wobt3QQ/s320/gns3_idle_time.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5440094515993090050" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;In my searches I discovered a useful tool for networking guys.&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;a href="http://www.gns3.net/"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;http://www.gns3.net/&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;From their website I find what it is:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; line-height: 17px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;"GNS3 is a graphical network simulator that allows simulation of complex networks"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; line-height: 17px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; line-height: 17px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;So I tried to see what it does. See my screenshot.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5031268596585673045-5855335523598672091?l=isearchstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://isearchstuff.blogspot.com/feeds/5855335523598672091/comments/default' title='Postare comentarii'/><link rel='replies' type='text/html' href='http://isearchstuff.blogspot.com/2010/02/useful-networking-tool-gns3.html#comment-form' title='0 comentarii'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5031268596585673045/posts/default/5855335523598672091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5031268596585673045/posts/default/5855335523598672091'/><link rel='alternate' type='text/html' href='http://isearchstuff.blogspot.com/2010/02/useful-networking-tool-gns3.html' title='A useful networking tool GNS3'/><author><name>ifindstuff</name><uri>http://www.blogger.com/profile/18349066748061923823</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_qPudJFXgMkE/S38ZI7JRmAI/AAAAAAAAAAU/xKl9Wobt3QQ/s72-c/gns3_idle_time.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5031268596585673045.post-3168720530815706628</id><published>2010-02-19T14:53:00.000-08:00</published><updated>2010-02-19T14:57:06.352-08:00</updated><title type='text'>Teamviewer works with MacOSX</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_qPudJFXgMkE/S38W2w6ecUI/AAAAAAAAAAM/IznheVv1JA0/s1600-h/teamviewerMAC2.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 192px;" src="http://3.bp.blogspot.com/_qPudJFXgMkE/S38W2w6ecUI/AAAAAAAAAAM/IznheVv1JA0/s320/teamviewerMAC2.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5440092004985762114" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt;&lt;div    style="background-attachment: scroll; background-clip: border-box; background-color: rgba(0, 0, 0, 0); background-image: none; background-origin: padding-box; bottom: auto; caption-side: top; clear: none; clip: auto; cursor: auto; direction: ltr; empty-cells: show; float: none; font-style: normal; font-variant: normal; font-weight: normal; height: 42px; left: auto; letter-spacing: normal; list-style-image: none; list-style-position: outside; list-style-type: none; max-height: none; max-width: none; min-height: 0px; min-width: 0px; opacity: 1; orphans: 2; outline-color: rgb(136, 136, 136); outline-style: none; outline-width: 0px; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; page-break-after: auto; page-break-before: auto; page-break-inside: auto; pointer-events: auto; position: relative; resize: none; right: auto; table-layout: auto; text-align: left; text-decoration: none; text-indent: 0px; text-rendering: auto; text-shadow: none; text-overflow: clip; text-transform: none; top: auto; unicode-bidi: normal; vertical-align: baseline; visibility: visible; white-space: normal; widows: 2; width: 684px; word-break: normal; word-spacing: 0px; word-wrap: normal; z-index: auto; zoom: 1; clip-path: none; clip-rule: nonzero; mask: none; filter: none; flood-color: #000000; flood-opacity: 1; lighting-color: #FFFFFF; color-interpolation: srgb; color-interpolation-filters: linearrgb; color-rendering: auto; fill: #000000; fill-opacity: 1; fill-rule: nonzero; image-rendering: auto; marker-end: none; marker-mid: none; marker-start: none; shape-rendering: auto; stroke: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-opacity: 1; alignment-baseline: auto; baseline-shift: baseline; dominant-baseline: auto; text-anchor: start; writing-mode: lr-tb; glyph-orientation-horizontal: 0deg; glyph-orientation-vertical: auto; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5; background-position: 0% 0%; background-repeat: repeat repeat; font-family:'trebuchet ms', verdana, arial, tahoma;font-size:14px;color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;Teamviewer works out of the box with MacOSX 10.5.7.&lt;br /&gt;Boot in safe mode with -x is not required. See my screenshot, &lt;/span&gt;&lt;/div&gt;&lt;div    style="background-attachment: scroll; background-clip: border-box; background-color: rgba(0, 0, 0, 0); background-image: none; background-origin: padding-box; bottom: auto; caption-side: top; clear: none; clip: auto; cursor: auto; direction: ltr; empty-cells: show; float: none; font-style: normal; font-variant: normal; font-weight: normal; height: 42px; left: auto; letter-spacing: normal; list-style-image: none; list-style-position: outside; list-style-type: none; max-height: none; max-width: none; min-height: 0px; min-width: 0px; opacity: 1; orphans: 2; outline-color: rgb(136, 136, 136); outline-style: none; outline-width: 0px; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; page-break-after: auto; page-break-before: auto; page-break-inside: auto; pointer-events: auto; position: relative; resize: none; right: auto; table-layout: auto; text-align: left; text-decoration: none; text-indent: 0px; text-rendering: auto; text-shadow: none; text-overflow: clip; text-transform: none; top: auto; unicode-bidi: normal; vertical-align: baseline; visibility: visible; white-space: normal; widows: 2; width: 684px; word-break: normal; word-spacing: 0px; word-wrap: normal; z-index: auto; zoom: 1; clip-path: none; clip-rule: nonzero; mask: none; filter: none; flood-color: #000000; flood-opacity: 1; lighting-color: #FFFFFF; color-interpolation: srgb; color-interpolation-filters: linearrgb; color-rendering: auto; fill: #000000; fill-opacity: 1; fill-rule: nonzero; image-rendering: auto; marker-end: none; marker-mid: none; marker-start: none; shape-rendering: auto; stroke: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-opacity: 1; alignment-baseline: auto; baseline-shift: baseline; dominant-baseline: auto; text-anchor: start; writing-mode: lr-tb; glyph-orientation-horizontal: 0deg; glyph-orientation-vertical: auto; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5; background-position: 0% 0%; background-repeat: repeat repeat; font-family:'trebuchet ms', verdana, arial, tahoma;font-size:14px;color:#000000;"&gt;&lt;span style="line-height: normal; font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;is &lt;/span&gt;&lt;em style="font-style: normal; "&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;worth&lt;/span&gt;&lt;/em&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt; a thousand &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;words&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;...&lt;/span&gt;&lt;/div&gt;&lt;div style="background-attachment: scroll; background-clip: border-box; background-color: rgba(0, 0, 0, 0); background-image: none; background-origin: padding-box; background-size:  ; bottom: auto; caption-side: top; clear: none; clip: auto; color: rgb(136, 136, 136); cursor: auto; direction: ltr; empty-cells: show; float: none; font-family: 'trebuchet ms', verdana, arial, tahoma; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; height: 42px; left: auto; letter-spacing: normal; list-style-image: none; list-style-position: outside; list-style-type: none; max-height: none; max-width: none; min-height: 0px; min-width: 0px; opacity: 1; orphans: 2; outline-color: rgb(136, 136, 136); outline-style: none; outline-width: 0px; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; page-break-after: auto; page-break-before: auto; page-break-inside: auto; pointer-events: auto; position: relative; resize: none; right: auto; table-layout: auto; text-align: left; text-decoration: none; text-indent: 0px; text-rendering: auto; text-shadow: none; text-overflow: clip; text-transform: none; top: auto; unicode-bidi: normal; vertical-align: baseline; visibility: visible; white-space: normal; widows: 2; width: 684px; word-break: normal; word-spacing: 0px; word-wrap: normal; z-index: auto; zoom: 1; clip-path: none; clip-rule: nonzero; mask: none; filter: none; flood-color: #000000; flood-opacity: 1; lighting-color: #FFFFFF; stop-color: #000000; stop-opacity: 1; color-interpolation: srgb; color-interpolation-filters: linearrgb; color-rendering: auto; fill: #000000; fill-opacity: 1; fill-rule: nonzero; image-rendering: auto; marker-end: none; marker-mid: none; marker-start: none; shape-rendering: auto; stroke: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-opacity: 1; alignment-baseline: auto; baseline-shift: baseline; dominant-baseline: auto; text-anchor: start; writing-mode: lr-tb; glyph-orientation-horizontal: 0deg; glyph-orientation-vertical: auto; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1.5; background-position: 0% 0%; background-repeat: repeat repeat; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5031268596585673045-3168720530815706628?l=isearchstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://isearchstuff.blogspot.com/feeds/3168720530815706628/comments/default' title='Postare comentarii'/><link rel='replies' type='text/html' href='http://isearchstuff.blogspot.com/2010/02/teamviewer-works-with-macosx.html#comment-form' title='0 comentarii'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5031268596585673045/posts/default/3168720530815706628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5031268596585673045/posts/default/3168720530815706628'/><link rel='alternate' type='text/html' href='http://isearchstuff.blogspot.com/2010/02/teamviewer-works-with-macosx.html' title='Teamviewer works with MacOSX'/><author><name>ifindstuff</name><uri>http://www.blogger.com/profile/18349066748061923823</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_qPudJFXgMkE/S38W2w6ecUI/AAAAAAAAAAM/IznheVv1JA0/s72-c/teamviewerMAC2.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5031268596585673045.post-3660888748953975460</id><published>2010-02-19T13:49:00.000-08:00</published><updated>2010-02-21T14:22:32.128-08:00</updated><title type='text'>How to remove vowels from a string</title><content type='html'>&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"&gt;It seems that's easy in Java 5 using regex. Have a look on this code:&lt;br /&gt;Pretty straightforward.&lt;br /&gt;&lt;br /&gt;public class NoVowels&lt;br /&gt;{&lt;br /&gt;public String replaceVowels(String source)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;String result="";&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;String regex="[AEIOU]";&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;String replacement="";&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;result=source.toUpperCase().replaceAll(regex,replacement);&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;return result;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;br /&gt;&lt;br /&gt;public static void main(String[] args)&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;String test = "Abracadabra";&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;String result = "";&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;NoVowels nw = new NoVowels();&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;result = nw.replaceVowels(test);&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;System.out.println("test string="+test);&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;System.out.println("result string="+result); &lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"&gt;And we obtain:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"&gt;test string=Abracadabra&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"&gt;result string=BRCDBR&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"&gt;Now I'll try same thing in Clojure.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"&gt;I have found and installed clojure box.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"&gt;I go on my windows xp in start-&gt;programs-&gt;clojure box-&gt;clojure box link.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"&gt;In the repl I type:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;(require '(clojure.contrib [str-utils2 :as s]))&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;I did this to select the namespace for this replace function which in this example is s. Then I write the replace code.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;(s/replace (s/upper-case "Abracadabra") #"[AEIOU]" "")&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;And I get:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;"BRCDBR"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 21px;font-size:85%;" &gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;Two lines of code !&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5031268596585673045-3660888748953975460?l=isearchstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://isearchstuff.blogspot.com/feeds/3660888748953975460/comments/default' title='Postare comentarii'/><link rel='replies' type='text/html' href='http://isearchstuff.blogspot.com/2010/02/how-to-remove-vowels-from-string.html#comment-form' title='0 comentarii'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5031268596585673045/posts/default/3660888748953975460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5031268596585673045/posts/default/3660888748953975460'/><link rel='alternate' type='text/html' href='http://isearchstuff.blogspot.com/2010/02/how-to-remove-vowels-from-string.html' title='How to remove vowels from a string'/><author><name>ifindstuff</name><uri>http://www.blogger.com/profile/18349066748061923823</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5031268596585673045.post-6981023211324724010</id><published>2010-02-19T13:45:00.000-08:00</published><updated>2010-02-19T13:46:27.260-08:00</updated><title type='text'>Hello WWWorld</title><content type='html'>Hello World!&lt;div&gt;I found you first!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5031268596585673045-6981023211324724010?l=isearchstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://isearchstuff.blogspot.com/feeds/6981023211324724010/comments/default' title='Postare comentarii'/><link rel='replies' type='text/html' href='http://isearchstuff.blogspot.com/2010/02/hello-wwworld.html#comment-form' title='0 comentarii'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5031268596585673045/posts/default/6981023211324724010'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5031268596585673045/posts/default/6981023211324724010'/><link rel='alternate' type='text/html' href='http://isearchstuff.blogspot.com/2010/02/hello-wwworld.html' title='Hello WWWorld'/><author><name>ifindstuff</name><uri>http://www.blogger.com/profile/18349066748061923823</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
