<?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-206224988104064940</id><updated>2012-02-17T04:10:26.306+01:00</updated><category term='ruby'/><category term='plsql'/><category term='linux'/><category term='oracle ruby'/><category term='java'/><category term='sftp'/><category term='gtk2'/><category term='custom domain'/><category term='ssh'/><category term='mplayer'/><category term='networking'/><category term='oracle'/><category term='oracle plsql'/><category term='databases'/><category term='niusia'/><category term='excel'/><category term='sql'/><category term='rails'/><category term='poetry'/><category term='debian'/><category term='ooo'/><category term='rman'/><category term='vim'/><category term='heroku'/><category term='ada'/><category term='csv'/><category term='IM'/><category term='backup'/><title type='text'>chris goes xp</title><subtitle type='html'>eXtreme Programming, soft, life, etc.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>31</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-6475807661478894447</id><published>2011-02-24T12:29:00.019+01:00</published><updated>2011-02-24T17:41:47.288+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='csv'/><category scheme='http://www.blogger.com/atom/ns#' term='excel'/><category scheme='http://www.blogger.com/atom/ns#' term='ooo'/><title type='text'>CSV files in MS Excel and Oracle Open Office</title><content type='html'>My input file is created in MS Excel, it is 1 row of data with 3 columns (in the second column there is a newline character):&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://dl.dropbox.com/u/16264948/YUBLrvYKxexcel_input.png"&gt;&lt;img style="margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 331px; height: 131px;" src="http://dl.dropbox.com/u/16264948/YUBLrvYKxexcel_input.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When I save this file as .csv in excel I get following structure:&lt;br /&gt;&lt;pre class="code"&gt;COL1,COL2,COL3&lt;br /&gt;³ó ?????,"2 äöü ??? lines&lt;br /&gt;In 1 field ???",+123456&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;File is corrupted&lt;br /&gt;&lt;br /&gt;When you open this file in Excel no multibytes and even lost "+" in phone number but the new line character properly inserted.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://dl.dropbox.com/u/16264948/dPjQpiLGEexcel_csv_file_corrupted.png"&gt;&lt;img style="margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 318px; height: 124px;" src="http://dl.dropbox.com/u/16264948/dPjQpiLGEexcel_csv_file_corrupted.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When I save the input Excel file as Unicode Text .txt the Unicode (MS Unicode ucs-2le) all the issues with .csv will be resolved (while saving).&lt;br /&gt;&lt;pre class="code"&gt;COL1 COL2 COL3&lt;br /&gt;&lt;br /&gt;łóś ещьул "2 äöü ыва lines&lt;br /&gt;In 1 field ещь" +123456&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Unfortunately while opening such file with Text Import Wizard:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://dl.dropbox.com/u/16264948/RCwx21XP7wizard1of3.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 574px; height: 413px;" src="http://dl.dropbox.com/u/16264948/RCwx21XP7wizard1of3.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://dl.dropbox.com/u/16264948/CUKsjj1g8wizard2of3.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 574px; height: 412px;" src="http://dl.dropbox.com/u/16264948/CUKsjj1g8wizard2of3.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In third step you can change type to Text (to rescue phone number):&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://dl.dropbox.com/u/16264948/RCwx21XP7wizard3of3.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 574px; height: 415px;" src="http://dl.dropbox.com/u/16264948/RCwx21XP7wizard3of3.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;After clicking "Finish" the result is dissapointing:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://dl.dropbox.com/u/16264948/cYijKeHTpexcel_txt.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 293px; height: 121px;" src="http://dl.dropbox.com/u/16264948/cYijKeHTpexcel_txt.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;Multibytes and phone number is properly shown, but the newline is broken.&lt;br /&gt;&lt;br /&gt;When you change the extension of the previous Unicode File from .txt to .csv and double click on it to open it with Excel you will have new line and multibytes but the phone will be corrupted:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://dl.dropbox.com/u/16264948/ch3ukcAMiunicode_as_csv.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 323px; height: 121px;" src="http://dl.dropbox.com/u/16264948/ch3ukcAMiunicode_as_csv.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When you try to open the same Unicode .csv file with Oracle Open Office:&lt;br /&gt;File -&gt; Open -&gt; .csv file&lt;br /&gt;In Import Wizard you set character set to Unicode (it's MS Unicode), delimiter to Tab and column types to Text (to rescue phone number):&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://dl.dropbox.com/u/16264948/n0PDMPPJ7ooo_import_UNICODE_csv.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 798px; height: 598px;" src="http://dl.dropbox.com/u/16264948/n0PDMPPJ7ooo_import_UNICODE_csv.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Success story:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://dl.dropbox.com/u/16264948/n0PDMPPJ7ooo_success.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 453px; height: 139px;" src="http://dl.dropbox.com/u/16264948/n0PDMPPJ7ooo_success.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The question is:&lt;br /&gt;"Why excel cannot properly open a CSV file created by itself?"&lt;br /&gt;&lt;br /&gt;Or maybe there is a workaround (without modyfing the CSV file) to do so?&lt;br /&gt;&lt;br /&gt;Oracle Open Office FTW!!!&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/206224988104064940-6475807661478894447?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/6475807661478894447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=6475807661478894447' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/6475807661478894447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/6475807661478894447'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2011/02/csv-files-in-ms-excel-and-oracle-open.html' title='CSV files in MS Excel and Oracle Open Office'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-8098732422947924227</id><published>2010-10-22T15:01:00.013+02:00</published><updated>2010-10-22T15:42:10.491+02:00</updated><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='oracle plsql'/><title type='text'>validating emails in oracle db using java stored function =&gt; and testing from ruby</title><content type='html'>1. email validation function is written in java (flexibility) and compiled as stored procedure in oracle db (performance)&lt;br /&gt;&lt;br /&gt;1a) write EmailValidations.java:&lt;br /&gt;&lt;pre class="code"&gt;import java.lang.String;&lt;br /&gt;import java.util.regex.Pattern;&lt;br /&gt;import java.util.regex.Matcher;&lt;br /&gt;&lt;br /&gt;class EmailValidations {&lt;br /&gt;  public static int is_valid(String email) {&lt;br /&gt;    if (email == null || email == "") return 0;&lt;br /&gt;&lt;br /&gt;    String upper_email = email.toUpperCase();&lt;br /&gt;&lt;br /&gt;    Pattern p = Pattern.compile("^[\\w\\.-]*[^\\.]@([\\w\\-]+\\.)+[A-Z]{2,4}$");&lt;br /&gt;    Matcher m = p.matcher(upper_email);&lt;br /&gt;    return m.matches() ? 1: 0;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;1b) load and compile java class into your oracle db:&lt;br /&gt;&lt;pre class="code"&gt;$ loadjava -u scott/tiger@emeadb11 -v -resolve EmailValidations.java&lt;br /&gt;--&gt; replace scott/tiger@emeadb11 with your valid username/password@tnsname_entry&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2a). create package that will contain your function&lt;br /&gt;&lt;pre class="code"&gt;create or replace PACKAGE             "MISC_PKG"&lt;br /&gt;IS&lt;br /&gt;FUNCTION is_email_valid (email_address in varchar) RETURN number;&lt;br /&gt;END MISC_PKG;&lt;br /&gt;/&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2b). create package body:&lt;br /&gt;&lt;pre class="code"&gt;create or replace&lt;br /&gt;PACKAGE BODY             "MISC_PKG" AS&lt;br /&gt;&lt;br /&gt;FUNCTION is_email_valid (email_address in varchar) RETURN number&lt;br /&gt;AS LANGUAGE JAVA&lt;br /&gt;NAME 'EmailValidations.is_valid(java.lang.String) return int';&lt;br /&gt;&lt;br /&gt;END MISC_PKG;&lt;br /&gt;/&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;3) test with ruby-plsql&lt;br /&gt;&lt;br /&gt;3a) spec_helper.rb that will contain your credentials and include rspecs and ruby-plsql gems&lt;br /&gt;&lt;pre class="code"&gt;require 'rubygems'&lt;br /&gt;require 'rspec'&lt;br /&gt;require 'ruby-plsql'&lt;br /&gt;&lt;br /&gt;DB_USER = "scott"&lt;br /&gt;DB_PWD  = "tiger"&lt;br /&gt;DB_SRVR = "emeadb11"&lt;br /&gt;&lt;br /&gt;plsql.connection = OCI8.new DB_USER, DB_PWD, DB_SRVR&lt;br /&gt;p "connected"&lt;br /&gt;&lt;br /&gt;plsql.connection.autocommit = false&lt;br /&gt;&lt;br /&gt;RSpec.configure do |config|&lt;br /&gt;  # config.filter_run :focus =&gt; true&lt;br /&gt;  config.after(:each) do&lt;br /&gt;    plsql.rollback&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;3b) write ruby specs spec_is_email_valid.rb&lt;br /&gt;&lt;pre class="code"&gt;require File.dirname(__FILE__) + '/spec_helper'&lt;br /&gt;&lt;br /&gt;describe "check is_email_valid function" do&lt;br /&gt;  &lt;br /&gt;  it "should return 1 for valid emails" do&lt;br /&gt;    plsql.misc_pkg.is_email_valid("c123@o2.pl").should == 1 &lt;br /&gt;    plsql.misc_pkg.is_email_valid("c@o2.pl").should == 1 &lt;br /&gt;  end&lt;br /&gt;  &lt;br /&gt;  it "should return 0 for invalid emails" do&lt;br /&gt;    plsql.misc_pkg.is_email_valid("c123@o2,pl").should == 0 &lt;br /&gt;    plsql.misc_pkg.is_email_valid("c@o2pl").should == 0 &lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;  it "should return 0 as in email_err_reason" do&lt;br /&gt;    plsql.misc_pkg.is_email_valid("S.J@GMAIL").should == 0&lt;br /&gt;    plsql.misc_pkg.is_email_valid("SY.STORT").should == 0&lt;br /&gt;    plsql.misc_pkg.is_email_valid("01516081607").should == 0&lt;br /&gt;  end&lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;  it "should return 0 when invalid characters in it" do&lt;br /&gt;    plsql.misc_pkg.is_email_valid("J.AMS.@CATS.ORG").should == 0&lt;br /&gt;    plsql.misc_pkg.is_email_valid("STNJ@ISON.CO.ZA/JACO@VTR.CO.ZA").should == 0&lt;br /&gt;  end&lt;br /&gt;  &lt;br /&gt;  it "should return 0 when null email" do&lt;br /&gt;    plsql.misc_pkg.is_email_valid("").should == 0&lt;br /&gt;    plsql.misc_pkg.is_email_valid(nil).should == 0&lt;br /&gt;  end&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;4) you can test it with:&lt;br /&gt;&lt;pre class="code"&gt;$ rspec spec_is_email_valid.rb &lt;br /&gt;"connected"&lt;br /&gt;.....&lt;br /&gt;&lt;br /&gt;Finished in 5.64 seconds&lt;br /&gt;5 examples, 0 failures&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can easily extend your tests once the change was done to your is_valid() java function.&lt;br /&gt;&lt;br /&gt;For more information on testing pl/sql functions from ruby see excelent blog (author of ruby-plsl):&lt;br /&gt;&lt;a href="http://blog.rayapps.com/2009/11/27/oracle-plsql-unit-testing-with-ruby/"&gt;http://blog.rayapps.com/2009/11/27/oracle-plsql-unit-testing-with-ruby/&lt;/a&gt;&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/206224988104064940-8098732422947924227?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/8098732422947924227/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=8098732422947924227' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/8098732422947924227'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/8098732422947924227'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2010/10/validating-emails-in-oracle-db-using.html' title='validating emails in oracle db using java stored function =&gt; and testing from ruby'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-156955386870019692</id><published>2010-08-29T23:30:00.006+02:00</published><updated>2010-08-29T23:40:59.757+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='custom domain'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='heroku'/><title type='text'>1und1.de domain with heroku rails app</title><content type='html'>1. assuming you have an app on heroku appname.heroku.com&lt;br /&gt;2. change CNAME entry for DNS on 1und1.de&lt;br /&gt;    - Domains&lt;br /&gt;    - mark your domainat1und1.de and select DNS -&gt; Einstellungen Bearbeiten&lt;br /&gt;    - for CNAME entry put: appname.heroku.com&lt;br /&gt;    - apply and wait couple of hours until it’s populated&lt;br /&gt;3. in your heroku app you need to add an add-on “Custom Domains” (Basic is free)&lt;br /&gt;&lt;pre class="code"&gt;$ heroku addons:add custom_domains&lt;br /&gt;Adding custom_domains to &lt;appname&gt;... FAILED&lt;br /&gt;!   Please verify your account before installing this addon&lt;br /&gt;!   For more information, see http://docs.heroku.com/billing&lt;br /&gt;!   Verify now at http://heroku.com/verify&lt;/pre&gt;&lt;br /&gt;as you can see you need to verify your account before (credit card needed -&gt; no charge applies)&lt;br /&gt;&lt;br /&gt;when it’s done:&lt;br /&gt;&lt;pre class="code"&gt;$ heroku addons:add custom_domains:basic&lt;br /&gt;Adding custom_domains:basic to &lt;appname&gt;... done&lt;/pre&gt;&lt;br /&gt;&lt;pre class="code"&gt;$ heroku domains:add www.domainat1und1.de&lt;br /&gt;Added www.domainat1und1.de as a custom domain name to appname.heroku.com&lt;br /&gt;$ heroku domains:add domainat1und1.de&lt;br /&gt;Added domainat1und1.de as a custom domain name to appname.heroku.com&lt;/pre&gt;&lt;br /&gt;FULL instructions under: http://docs.heroku.com/custom-domains&lt;br /&gt;&amp;nbsp;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-156955386870019692?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/156955386870019692/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=156955386870019692' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/156955386870019692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/156955386870019692'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2010/08/1und1de-domain-with-heroku-rails-app.html' title='1und1.de domain with heroku rails app'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-908129372629184572</id><published>2009-10-20T12:59:00.006+02:00</published><updated>2009-10-20T13:03:15.252+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='plsql'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>oracle db - how to identify compilation errors</title><content type='html'>1.&lt;pre class="code"&gt;select * from user_errors;&lt;/pre&gt;&lt;br /&gt;2.&lt;pre class="code"&gt;SELECT RTRIM(INITCAP(e.type))||' '||e.name||': Line '||&lt;br /&gt;      TO_CHAR(e.line)||' Column '||TO_CHAR(e.position) linecol,&lt;br /&gt;      s.text sourceline,RPAD(' ',(e.position - 1))||'^' errpos,&lt;br /&gt;      e.text error&lt;br /&gt;FROM   user_source s,user_errors e&lt;br /&gt;WHERE  e.type = s.type&lt;br /&gt;AND    e.name = s.name&lt;br /&gt;AND    e.line = s.line&lt;br /&gt;ORDER BY e.name,e.sequence&lt;/pre&gt;&lt;br /&gt;The latter one will give you the exact line where the error occcurs&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/206224988104064940-908129372629184572?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/908129372629184572/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=908129372629184572' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/908129372629184572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/908129372629184572'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2009/10/how-to-identify-compilation-errors.html' title='oracle db - how to identify compilation errors'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-901984571563678195</id><published>2009-09-23T16:08:00.004+02:00</published><updated>2009-09-23T16:21:27.762+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>encrypting partitions with LUKS in Linux</title><content type='html'>with these commands we encrypt a full partition located under /dev/sde1&lt;br /&gt;(UUID=7a89446f-c43f-41b1-bc2b-99c74c64cdeb)&lt;br /&gt;&lt;br /&gt;In the below steps I use dcfldd (which is much more user friendly than dd and gives you progress status) and cryptsetup.&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;sudo apt-get install dcfldd cryptsetup&lt;br /&gt;&lt;br /&gt;sudo dcfldd if=/dev/urandom of=/dev/sde1 statusinterval=10 bs=10M conv=notrunc&lt;br /&gt;sudo cryptsetup luksFormat /dev/sde1&lt;br /&gt;sudo cryptsetup luksOpen /dev/sde1 maxtor_encrypted&lt;br /&gt;sudo mkfs.ext3 /dev/mapper/maxtor_encrypted&lt;br /&gt;sudo mkdir /mnt/maxtor_enc&lt;br /&gt;sudo mount /dev/mapper/maxtor_encrypted /mnt/maxtor_enc -t ext3 -o noatime,nodiratime&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;it is safer to use UUIDs instead of /dev/sde1 because even if order of the drives changes (USB drives, or because of your BIOS) you always can uniquely identify the one with the unique UUID.&lt;br /&gt;You can get the UUIDs of all of your disks' partitions by running&lt;br /&gt;&lt;pre class="code"&gt;$ blkid&lt;/pre&gt;&lt;br /&gt;Now let's write to scripts for mounting and umounting our encrypted drive:&lt;br /&gt;&lt;pre class="code"&gt;chris@emeadb:~/bin$ cat mycryptmount&lt;br /&gt;#!/bin/bash&lt;br /&gt;export PATH=/usr/local/bin/:/bin/:/usr/bin/&lt;br /&gt;echo "mounting encrypted drive"&lt;br /&gt;&lt;br /&gt;df | grep maxtor_enc &amp;amp;&amp;amp; sudo /home/chris/bin/mycryptumount&lt;br /&gt;echo "maxtor_enc umounted"&lt;br /&gt;&lt;br /&gt;sudo cryptsetup luksOpen /dev/disk/by-uuid/7a89446f-c43f-41b1-bc2b-99c74c64cdeb maxtor_encrypted&lt;br /&gt;sudo mount /dev/mapper/maxtor_encrypted /mnt/maxtor_enc -t ext3 -o noatime,nodiratime&lt;/pre&gt;&lt;br /&gt;&lt;pre class="code"&gt;chris@emeadb:~/bin$ cat mycryptumount&lt;br /&gt;#!/bin/bash&lt;br /&gt;export PATH=/usr/local/bin/:/bin/:/usr/bin/&lt;br /&gt;&lt;br /&gt;sudo umount /dev/mapper/maxtor_encrypted&lt;br /&gt;sudo cryptsetup luksClose maxtor_encrypted&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;chmod +x both of them&lt;br /&gt;&lt;br /&gt;now you are able to mount with&lt;br /&gt;&lt;pre class="code"&gt;$ mycryptmount&lt;/pre&gt;&lt;br /&gt;and umount with&lt;br /&gt;&lt;pre class="code"&gt;$ mycrypumount&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-901984571563678195?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/901984571563678195/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=901984571563678195' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/901984571563678195'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/901984571563678195'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2009/09/encrypting-partitions-with-luks-in.html' title='encrypting partitions with LUKS in Linux'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-6105108605245976711</id><published>2009-09-13T15:01:00.000+02:00</published><updated>2009-09-13T15:02:27.031+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ada'/><title type='text'>Ada - jedne z pierwszych prob efektywnego poruszania sie</title><content type='html'>&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/Ga8VTtRg9uU&amp;hl=en&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/Ga8VTtRg9uU&amp;hl=en&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-6105108605245976711?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/6105108605245976711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=6105108605245976711' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/6105108605245976711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/6105108605245976711'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2009/09/ada-jedne-z-pierwszych-prob-efektywnego.html' title='Ada - jedne z pierwszych prob efektywnego poruszania sie'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-4349896018758066938</id><published>2009-05-28T21:06:00.003+02:00</published><updated>2009-05-28T21:14:35.006+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oracle ruby'/><title type='text'>ruby oracle oci8 UTF8 corruption</title><content type='html'>I have a small script oci1.rb: &lt;br /&gt;&lt;pre class="code"&gt;require 'oci8' &lt;br /&gt;conn = OCI8.new("test","test","test_db") &lt;br /&gt;File.open("out.txt","wb") do |out| &lt;br /&gt;  tabs = conn.exec('SELECT * from test_utf8') do |r| &lt;br /&gt;     out.write(r.join(',')) &lt;br /&gt;     out.write("\n") &lt;br /&gt;  end &lt;br /&gt;end &lt;br /&gt;conn.logoff&lt;/pre&gt;&lt;br /&gt;that runs perfectly on windows producing from my test_db: &lt;br /&gt;&lt;pre class="code"&gt;polish,łóśżć &lt;br /&gt;russsian,фывафыва &lt;br /&gt;german,äöü &lt;/pre&gt;&lt;br /&gt;when I run exactly the same on my linux box: &lt;br /&gt;&lt;pre class="code"&gt;polish,loszc &lt;br /&gt;russsian,???????? &lt;br /&gt;german,aou &lt;/pre&gt;&lt;br /&gt;I tested then a small script that reads and writes UTF8 on linux to be sure my linux terminal can display UTF8&lt;br /&gt;(read_write_utf8.rb): &lt;br /&gt;&lt;pre class="code"&gt;File.open("utf8_out.txt","wb") do |out| &lt;br /&gt;  File.open("utf8.txt","r").each do |line| &lt;br /&gt;    out.write(line) &lt;br /&gt;  end &lt;br /&gt;end &lt;/pre&gt;&lt;br /&gt;and that works good! &lt;br /&gt;&lt;pre class="code"&gt;chris@emeadb:~/work/ruby/oci$ ruby read_write_utf8.rb &lt;br /&gt;chris@emeadb:~/work/ruby/oci$ cat utf8.txt &lt;br /&gt;polish,łóśżć &lt;br /&gt;russsian,фывафыва &lt;br /&gt;german,äöü &lt;br /&gt;chris@emeadb:~/work/ruby/oci$ cat utf8_out.txt &lt;br /&gt;polish,łóśżć &lt;br /&gt;russsian,фывафыва &lt;br /&gt;german,äöü &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Finally the issue was with my NLS_LANG variable that was not set in the Linux box on the account I used for running the script.&lt;br /&gt;&lt;br /&gt;I tried first to set it up in the ruby script itself:&lt;br /&gt;&lt;pre class="code"&gt;ENV['NLS_LANG']='AMERICAN_AMERICA.UTF8'&lt;/pre&gt;&lt;br /&gt;that did not work.&lt;br /&gt;&lt;br /&gt;the solution was to set it in the shell.&lt;br /&gt;&lt;pre class="code"&gt;export NLS_LANG=AMERICAN_AMERICA.UTF8&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;you can set it in your .bashrc (depending on the shell you use) to make it default for the account.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-4349896018758066938?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/4349896018758066938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=4349896018758066938' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/4349896018758066938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/4349896018758066938'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2009/05/ruby-oracle-oci8-utf8-corruption.html' title='ruby oracle oci8 UTF8 corruption'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-3741971856326473685</id><published>2009-04-22T16:20:00.005+02:00</published><updated>2009-04-22T16:45:12.784+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='debian'/><category scheme='http://www.blogger.com/atom/ns#' term='networking'/><title type='text'>debian change from dhcp to static IP</title><content type='html'>One would think to achieve the update from the DHCP assigned IP to the static one, the only thing to do is to update your /etc/network/interfaces&lt;br /&gt;&lt;br /&gt;from:&lt;pre class="code"&gt;iface eth0 inet dhcp&lt;/pre&gt;&lt;br /&gt;to:&lt;pre class="code"&gt;iface eth0 inet static&lt;br /&gt;        address 10.165.248.252&lt;br /&gt;        netmask 255.255.248.0&lt;br /&gt;        gateway 10.165.248.1&lt;br /&gt;        broadcast 10.165.248.255&lt;br /&gt;        network 10.165.248.0&lt;/pre&gt;&lt;br /&gt;and restart:&lt;pre class="code"&gt;/etc/init.d/networking restart&lt;/pre&gt;&lt;br /&gt;(optionally you can adjust your /etc/resolv.conf (to update DNS servers, and search paths)&lt;br /&gt;&lt;br /&gt;The changed IP is immediately visible.&lt;br /&gt;&lt;br /&gt;How surprised I was when after couple of hours the IP was changed back to the one from the DHCP pool. (resolv.conf was then automatically updated from the DHCP server)&lt;br /&gt;&lt;br /&gt;Solution was to kill the dhcp3-client. (and change again the resolv.conf and restart networking)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-3741971856326473685?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/3741971856326473685/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=3741971856326473685' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/3741971856326473685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/3741971856326473685'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2009/04/debian-change-from-dhcp-to-static-ip.html' title='debian change from dhcp to static IP'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-6418494427020066524</id><published>2009-03-30T17:42:00.007+02:00</published><updated>2009-03-30T19:02:31.814+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='plsql'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>ddl over database link in oracle 10gR2</title><content type='html'>recently I encountered a requirement to create a table on remote database DB_TARGET (working in DB_SOURCE)&lt;br /&gt;&lt;br /&gt;for example:&lt;br /&gt;&lt;pre class="code"&gt;create table table_a@dblink_to_db_target; --&gt; does not work&lt;br /&gt;-- ORA-02021: DDL operations are not allowed on a remote database&lt;/pre&gt;&lt;br /&gt;whereas&lt;br /&gt;&lt;pre class="code"&gt;select 'hello' from dual@dblink_to_db_target; --&gt; works&lt;/pre&gt;&lt;br /&gt;This is a workaround I used:&lt;br /&gt;on TARGET_DB:&lt;br /&gt;&lt;pre class="code"&gt;CREATE OR REPLACE &lt;br /&gt;FUNCTION prepare_table &lt;br /&gt;   ( table_name in varchar2) return varchar2 &lt;br /&gt;   IS &lt;br /&gt;    err_num NUMBER; &lt;br /&gt;    err_msg VARCHAR2(100); &lt;br /&gt;    sqlstmt varchar2(4000) := ''; &lt;br /&gt;    tbl varchar2(30) := ''; &lt;br /&gt;BEGIN &lt;br /&gt;    if instr(table_name,'.') &gt; 0 then &lt;br /&gt;        tbl := substr(table_name,instr(table_name,'.')+1); &lt;br /&gt;        sqlstmt := 'CREATE TABLE ' || tbl || ' as select * from ' || &lt;br /&gt;table_name; &lt;br /&gt;        execute immediate sqlstmt; &lt;br /&gt;        return 'table ' || tbl || ' successfully created'; &lt;br /&gt;    else &lt;br /&gt;        return 'table in owners'' schema'; &lt;br /&gt;    end if; &lt;br /&gt;EXCEPTION &lt;br /&gt;    WHEN others THEN &lt;br /&gt;        err_msg := SUBSTR(SQLERRM, 1, 100); &lt;br /&gt;        return 'error when creating ' || tbl || '-' || err_msg || '-' &lt;br /&gt;|| sqlstmt; &lt;br /&gt;END; &lt;br /&gt;/ &lt;/pre&gt;&lt;br /&gt;this function creates a table specified as a table_name parameter only &lt;br /&gt;if the "." is in the name =&gt; goal is to create a table in my_schema &lt;br /&gt;from other user's schema. &lt;br /&gt;this function works fine when calling this on DB_TARGET: &lt;br /&gt;&lt;pre class="code"&gt;SQL&gt; set serveroutput on; &lt;br /&gt;SQL&gt; declare &lt;br /&gt;  2  result varchar2(300) := ''; &lt;br /&gt;  3  begin &lt;br /&gt;  4  result := prepare_table('other_user.table_a'); &lt;br /&gt;  5  dbms_output.put_line(result); &lt;br /&gt;  6  end; &lt;br /&gt;  7  / &lt;br /&gt;table table_a successfully created &lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed. &lt;/pre&gt;&lt;br /&gt;but then surprisingly to me:&lt;br /&gt;when I try to call this function from DB_SOURCE: &lt;br /&gt;&lt;pre class="code"&gt;SQL&gt; set serveroutput on; &lt;br /&gt;SQL&gt; declare &lt;br /&gt;  2  result varchar2(300) := ''; &lt;br /&gt;  3  begin &lt;br /&gt;  4  result := prepare_table@dblink_to_db_target('other_user.table_a'); &lt;br /&gt;  5  dbms_output.put_line(result); &lt;br /&gt;  6  end; &lt;br /&gt;  7  / &lt;br /&gt;error when creating gcd_countries-ORA-02064: distributed operation not &lt;br /&gt;supported-CREATE TABLE table_a as select * from other_user.table_a &lt;br /&gt;&lt;br /&gt;PL/SQL procedure successfully completed. &lt;/pre&gt;&lt;br /&gt;I found a workaround with a wrapper procedure on DB_TARGET: &lt;br /&gt;&lt;pre class="code"&gt;CREATE OR REPLACE &lt;br /&gt;PROCEDURE prepare_table_proc(table_name in varchar2) &lt;br /&gt;   IS &lt;br /&gt;   result varchar2(300) := ''; &lt;br /&gt;BEGIN &lt;br /&gt;    result := prepare_table(table_name); &lt;br /&gt;    dbms_output.put_line('success'); &lt;br /&gt;EXCEPTION &lt;br /&gt;    WHEN others THEN &lt;br /&gt;        dbms_output.put_line('err'); &lt;br /&gt;END; &lt;br /&gt;/ &lt;/pre&gt;&lt;br /&gt;when I call it from DB_SOURCE like this: &lt;br /&gt;&lt;pre class="code"&gt;SQL&gt; call prepare_table_proc@dblink_to_db_target('other_user.table_a'); &lt;br /&gt;Call completed. &lt;/pre&gt;&lt;br /&gt;And the table_a is created on DB_TARGET. &lt;br /&gt;&lt;br /&gt;when we look closer why the function itself did not work we see in the description of the error message:&lt;br /&gt;ORA-02064: distributed operation not supported &lt;br /&gt;    Cause: One of the following unsupported operations was attempted: &lt;br /&gt;    1. array execute of a remote update with a subquery that &lt;br /&gt;references a dblink, or &lt;br /&gt;    2. an update of a long column with bind variable and an update of &lt;br /&gt;a second column with a subquery that both references a dblink and a &lt;br /&gt;bind variable, or &lt;br /&gt;    3. a commit is issued in a coordinated session from an RPC &lt;br /&gt;procedure call with OUT parameters or function call. &lt;br /&gt;&lt;br /&gt;in my case point 3. yields and hence the error message.&lt;br /&gt;&lt;br /&gt;Oracle documentation comes with help in:&lt;br /&gt;&lt;a href="http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sql.htm#sthref6148"&gt;http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sql.htm#sthref6148&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;it works only as a procedure and we cannot return a value to the invoking DB_SOURCE anyway.&lt;br /&gt;&lt;br /&gt;maybe there's a better way...&lt;br /&gt;right now I am happy with the workaround&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-6418494427020066524?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/6418494427020066524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=6418494427020066524' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/6418494427020066524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/6418494427020066524'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2009/03/ddl-over-database-link-in-oracle-10gr2.html' title='ddl over database link in oracle 10gR2'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-2964314762415591254</id><published>2009-02-18T09:14:00.004+01:00</published><updated>2009-02-18T09:24:32.169+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><category scheme='http://www.blogger.com/atom/ns#' term='plsql'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>why you should always use aliases in SQL (oracle)</title><content type='html'>let's create for this example following 2 tables (a and b):&lt;br /&gt;&lt;pre class="code"&gt;create table a (org_id number, org_name varchar2(1)); &lt;br /&gt;insert into a values(1,'a'); &lt;br /&gt;insert into a values(2,'b'); &lt;br /&gt;insert into a values(3,'c');&lt;br /&gt;commit;&lt;/pre&gt;&lt;br /&gt;&lt;pre class="code"&gt;create table b (name varchar2(1)); &lt;br /&gt;insert into b values('a'); &lt;br /&gt;insert into b values('b');&lt;br /&gt;commit;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now let's run this:&lt;br /&gt;&lt;pre class="code"&gt;select * from a &lt;br /&gt;where a.org_id in (select org_id from b); &lt;br /&gt;-- returns all 3 rows from a &lt;br /&gt;&lt;br /&gt;select * from a &lt;br /&gt;where a.org_id not in (select org_id from b); &lt;br /&gt;-- returns 0 rows&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The tricky part is, you might want the org_id in the subquery to be taken from b (which does not exist) and hence expect an INVALID IDENTIFIER error message as running only subquery:&lt;br /&gt;&lt;pre class="code"&gt;select org_id from b &lt;br /&gt;        * &lt;br /&gt;ORA-00904: "ORG_ID": invalid identifier&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;But the initial query is correlated and actually the org_id in the subquery comes from outer table a and not from b.&lt;br /&gt;&lt;br /&gt;That's why a good practice would be always to use aliases as prefixes to the columns.&lt;br /&gt;&lt;br /&gt;In that way we can rewrite the query that will now raise an exception as expected:&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;select * from a &lt;br /&gt;where a.org_id not in (select &lt;span style="font-weight:bold;"&gt;b.&lt;/span&gt;org_id from b); &lt;br /&gt;-- ORA-00904: "B"."ORG_ID": invalid identifier&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-2964314762415591254?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/2964314762415591254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=2964314762415591254' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/2964314762415591254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/2964314762415591254'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2009/02/why-you-should-always-use-aliases-in.html' title='why you should always use aliases in SQL (oracle)'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-2991095988714039140</id><published>2009-01-22T09:25:00.006+01:00</published><updated>2009-01-22T09:38:26.303+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><title type='text'>vim converting between MS Unicode UCS-2LE and UTF-8</title><content type='html'>Many times at work I need to convert between 2 different encodings from Unicode:&lt;br /&gt;1. MS Unicode -&gt; generated e.g. by Excel when Saving data as Unicode text&lt;br /&gt;2. UTF8 encoding (standard)&lt;br /&gt;&lt;br /&gt;Requirement VIM is compiled with multi_byte support.&lt;br /&gt;check if in VIM normal mode&lt;br /&gt;&lt;pre class="code"&gt;:echo has('multi_byte')&lt;/pre&gt;&lt;br /&gt;returns 1&lt;br /&gt;&lt;br /&gt;In VIM normal mode to open a file with certain encoding:&lt;br /&gt;&lt;pre class="code"&gt;:e ++enc=&amp;lt;encoding&amp;gt; &amp;lt;filename&amp;gt;&lt;/pre&gt;&lt;br /&gt;To save in different encoding:&lt;br /&gt;&lt;pre class="code"&gt;:w ++enc=&amp;lt;encoding&amp;gt; &amp;lt;filename&amp;gt;&lt;/pre&gt;&lt;br /&gt;e.g.&lt;br /&gt;open in ucs-2le -&gt; save in utf-8&lt;br /&gt;&lt;pre class="code"&gt;:e ++enc=ucs-2le /tmp/file_ucs2le.csv&lt;br /&gt;:w ++enc=utf-8 /tmp/file_utf8.csv&lt;/pre&gt;&lt;br /&gt;It works even if your fileencoding in your .vimrc (_vimrc on Windows) is different and VIM normally would recognize as different encoding from the one you want.&lt;br /&gt;&lt;br /&gt;++enc sets fileencoding and not encoding (filencoding is needed when opening or saving the file)&lt;br /&gt;&lt;br /&gt;More on Unicode in VIM under&lt;br /&gt;&lt;a href="http://vim.wikia.com/wiki/Working_with_Unicode"&gt;http://vim.wikia.com/wiki/Working_with_Unicode&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-2991095988714039140?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/2991095988714039140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=2991095988714039140' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/2991095988714039140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/2991095988714039140'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2009/01/vim-converting-between-ms-unicode-ucs.html' title='vim converting between MS Unicode UCS-2LE and UTF-8'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-2305381547017847856</id><published>2009-01-20T10:12:00.004+01:00</published><updated>2009-01-20T10:19:41.335+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='gtk2'/><category scheme='http://www.blogger.com/atom/ns#' term='debian'/><title type='text'>compiling VIM 7.2 with GTK2 under debian etch</title><content type='html'>To install GTK2 is not an issue since we can use the apt-get install libgtk2.0 libgtk2.0-dev to install gtk2 with dev libraries.&lt;br /&gt;&lt;br /&gt;The issue I encountered was when I tried to compile VIm 7.2 with GTK2, which could not be found:&lt;br /&gt;&lt;pre class="code"&gt;checking for GTK - version &gt;= 2.2.0... no&lt;br /&gt;checking for GTK - version &gt;= 1.1.16... yes; found version 1.2.10&lt;/pre&gt;&lt;br /&gt;Then I decided to compile GTK2 on my own.&lt;br /&gt;&lt;br /&gt;I failed when trying to install GTK2.14 with GLIB2.18.4 because some function definitions changed.&lt;br /&gt;&lt;br /&gt;Finally the versions I successfully installed were:&lt;br /&gt;&lt;pre class="code"&gt;- gtk2.8.20&lt;br /&gt;- glib2.9.6&lt;br /&gt;- pangoo1.11&lt;br /&gt;- atk1.25.2&lt;br /&gt;- cairo1.8.6&lt;br /&gt;- pixman0.13.2&lt;/pre&gt;&lt;br /&gt;then to compile VIM i used (/opt/gtk2 is the prefix where I installed just compiled gtk2):&lt;br /&gt;&lt;pre class="code"&gt;export PKG_CONFIG_PATH="/opt/gtk2/lib/pkgconfig"&lt;br /&gt;export LD_LIBRARY_PATH=/opt/gtk2/lib&lt;br /&gt;export CPPFLAGS="-I/opt/gtk2/include"&lt;br /&gt;export LDFLAGS="-L/opt/gtk2/lib"&lt;br /&gt; ./configure --prefix=/opt/vim/ --enable-perlinterp --enable-rubyinterp --enable-multibyte --enable-gui --with-features=big&lt;/pre&gt;&lt;br /&gt;Finally GTK2 found:&lt;br /&gt;&lt;pre class="code"&gt;checking for GTK - version &gt;= 2.2.0... yes; found version 2.8.20&lt;/pre&gt;&lt;br /&gt;happy VImming :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-2305381547017847856?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/2305381547017847856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=2305381547017847856' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/2305381547017847856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/2305381547017847856'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2009/01/compiling-vim-72-with-gtk2-under-debian.html' title='compiling VIM 7.2 with GTK2 under debian etch'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-5755056851167318632</id><published>2008-12-16T11:24:00.005+01:00</published><updated>2008-12-16T11:37:11.046+01:00</updated><title type='text'>accessing Github from behind HTTP proxy</title><content type='html'>When you need to pull or push from &lt;a href="http://github.com"&gt;Github &lt;/a&gt;(git://) and you're behind corporate HTTP firewall, you might find below instructions helpful:&lt;br /&gt;&lt;br /&gt;1. set environmental variables (in .bashrc or .bash_profile)&lt;br /&gt;&lt;pre class="code"&gt;export GIT_SSH="${HOME}/bin/http-ssh"&lt;br /&gt;export GIT_PROXY_COMMAND="${HOME}/bin/http-cmd"&lt;/pre&gt;&lt;br /&gt;2. prepare http-ssh and http-cmd in your ${HOME}/bin/ directory (or any other of your choice -&gt; just adjuct the environmental variables accordingly)&lt;br /&gt;&lt;pre class="code"&gt;#!/bin/sh&lt;br /&gt;# Filename: http-ssh&lt;br /&gt;ssh -o ProxyCommand="${HOME}/bin/http-cmd %h %p" $@&lt;/pre&gt;&lt;br /&gt;&lt;pre class="code"&gt;#!/bin/sh&lt;br /&gt;# Filename: http-cmd&lt;br /&gt;/usr/bin/connect -H http://&amp;lt;your_http_proxy&amp;gt;:&amp;lt;port&amp;gt; $@&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;now you can freely use git command.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-5755056851167318632?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/5755056851167318632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=5755056851167318632' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/5755056851167318632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/5755056851167318632'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2008/12/accessing-github-behin-http-proxy.html' title='accessing Github from behind HTTP proxy'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-6679090068785897870</id><published>2008-12-09T16:39:00.004+01:00</published><updated>2008-12-09T16:45:29.977+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='ssh'/><category scheme='http://www.blogger.com/atom/ns#' term='sftp'/><title type='text'>sftp from behind firewall via HTTP proxy in Ruby</title><content type='html'>Same as the previous Post using ruby:&lt;br /&gt;&lt;pre class="code"&gt;require 'rubygems'&lt;br /&gt;require 'net/ssh'&lt;br /&gt;require 'net/sftp'&lt;br /&gt;require 'net/ssh/proxy/http'&lt;br /&gt;&lt;br /&gt;base_dir = "/some_base_directory"&lt;br /&gt;&lt;br /&gt;proxy_host = 'IP_or_FQDN_of_your_proxy'&lt;br /&gt;proxy_port = port_of_your_proxy&lt;br /&gt;&lt;br /&gt;proxy = Net::SSH::Proxy::HTTP.new(proxy_host,proxy_port)&lt;br /&gt;&lt;br /&gt;Net::SSH.start('destination_IP_or_FQDN','username',&lt;br /&gt;                {:proxy         =&gt; proxy,&lt;br /&gt;                 :password      =&gt; 'password'}) do |ssh|&lt;br /&gt;&lt;br /&gt;        ssh.sftp.connect do |sftp|&lt;br /&gt;                # do something&lt;br /&gt;        end&lt;br /&gt;end&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-6679090068785897870?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/6679090068785897870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=6679090068785897870' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/6679090068785897870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/6679090068785897870'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2008/12/connect-to-sftp-from-ruby-when-behind.html' title='sftp from behind firewall via HTTP proxy in Ruby'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-2906120580388297818</id><published>2008-12-09T16:18:00.006+01:00</published><updated>2008-12-09T16:39:27.851+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='ssh'/><category scheme='http://www.blogger.com/atom/ns#' term='sftp'/><title type='text'>ssh sftp from behind firewall via HTTP proxy</title><content type='html'>If you work in corporate network that is behind firewall.&lt;br /&gt;&lt;br /&gt;if you try this:&lt;br /&gt;&lt;pre class="code"&gt;chris@emeadb:~$ sftp username@xx.xx.xx.xx&lt;br /&gt;Connecting to xx.xx.xx.xx...&lt;br /&gt;ssh: connect to host xx.xx.xx.xx port 22: No route to host&lt;br /&gt;Couldn't read packet: Connection reset by peer&lt;/pre&gt;&lt;br /&gt;With help comes connect-proxy&lt;br /&gt;Install it with (in debian like systems):&lt;br /&gt;&lt;pre class="code"&gt;sudo apt-get install connect-proxy&lt;/pre&gt;&lt;br /&gt;then configure it:&lt;br /&gt;&lt;pre class="code"&gt;vi ~/.ssh/config&lt;/pre&gt;&lt;br /&gt;adjust to your needs the content:&lt;br /&gt;&lt;pre class="code"&gt;Host *&lt;br /&gt;        ProxyCommand connect-proxy -H &amp;lt;IP or FQDN of your proxy&amp;gt;:&amp;lt;port&amp;gt; %h %p&lt;/pre&gt;&lt;br /&gt;enjoy:&lt;br /&gt;&lt;pre class="code"&gt;chris@emeadb:~$ sftp username@xx.xx.xx.xx&lt;br /&gt;Connecting to xx.xx.xx.xx...&lt;br /&gt;Secure SFTP Serverusername@xx.xx.xx.xx's password:&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-2906120580388297818?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/2906120580388297818/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=2906120580388297818' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/2906120580388297818'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/2906120580388297818'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2008/12/ssh-sftp-from-behind-firewall-via-http.html' title='ssh sftp from behind firewall via HTTP proxy'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-5537836477605502177</id><published>2008-11-27T09:29:00.008+01:00</published><updated>2008-11-27T09:41:11.105+01:00</updated><title type='text'>enabling/disabling ARCHIVELOG in Oracle 10g</title><content type='html'>to check your current mode:&lt;br /&gt;&lt;pre class="code"&gt;SELECT log_mode FROM v$database;&lt;br /&gt;&lt;br /&gt;LOG_MODE&lt;br /&gt;------------&lt;br /&gt;ARCHIVELOG&lt;/pre&gt;&lt;br /&gt;to enable:&lt;br /&gt;&lt;pre class="code"&gt;SHUTDOWN;&lt;br /&gt;STARTUP MOUNT EXCLUSIVE;&lt;br /&gt;ALTER DATABASE ARCHIVELOG;&lt;br /&gt;ALTER DATABASE OPEN;&lt;/pre&gt;&lt;br /&gt;to disable:&lt;br /&gt;&lt;pre class="code"&gt;SHUTDOWN;&lt;br /&gt;STARTUP MOUNT EXCLUSIVE;&lt;br /&gt;ALTER DATABASE NOARCHIVELOG;&lt;br /&gt;ALTER DATABASE OPEN;&lt;/pre&gt;&lt;br /&gt;If you receive this error message:&lt;br /&gt;&lt;pre class="code"&gt;SQL&gt; alter database noarchivelog;&lt;br /&gt;alter database noarchivelog&lt;br /&gt;*&lt;br /&gt;ERROR at line 1:&lt;br /&gt;ORA-38774: cannot disable media recovery - flashback database is enabled&lt;/pre&gt;&lt;br /&gt;It means flashback database is set, we need to disable flashback first&lt;br /&gt;&lt;pre class="code"&gt;SQL&gt; alter database flashback off;&lt;br /&gt;&lt;br /&gt;Database altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter database noarchivelog;&lt;br /&gt;&lt;br /&gt;Database altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; alter database open;&lt;br /&gt;&lt;br /&gt;Database altered.&lt;br /&gt;&lt;br /&gt;SQL&gt; SELECT log_mode FROM v$database;&lt;br /&gt;&lt;br /&gt;LOG_MODE&lt;br /&gt;------------&lt;br /&gt;NOARCHIVELOG&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-5537836477605502177?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/5537836477605502177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=5537836477605502177' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/5537836477605502177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/5537836477605502177'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2008/11/enablingdisabling-archivelog-in-oracle.html' title='enabling/disabling ARCHIVELOG in Oracle 10g'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-1388464397525473914</id><published>2008-10-30T14:46:00.005+01:00</published><updated>2008-11-27T09:25:45.512+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rman'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>oracle archiver hangs because space_used = space_limit</title><content type='html'>Here is how to solve the issue without extending DB_RECOVERY_FILE_DEST_SIZE:&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;rman target /&lt;br /&gt;RMAN&gt; delete archivelog until time 'SYSDATE - 1';&lt;br /&gt;or&lt;br /&gt;RMAN&gt; delete archive all;&lt;br /&gt;&lt;br /&gt;RMAN&gt; delete expired archivelog all;&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/206224988104064940-1388464397525473914?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/1388464397525473914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=1388464397525473914' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/1388464397525473914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/1388464397525473914'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2008/10/oracle-archiver-hangs-because-spaceused.html' title='oracle archiver hangs because space_used = space_limit'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-8001968630780940223</id><published>2008-09-04T10:59:00.004+02:00</published><updated>2008-09-04T11:06:40.453+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='databases'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>sql loader and tab separated multibyte fields</title><content type='html'>when you use following part in your control file:&lt;br /&gt;&lt;pre class="code"&gt;fields terminated by X'0009' optionally enclosed by X'0022'&lt;/pre&gt;&lt;br /&gt;you probably notice that the multi tab characters got swelled to one tab character, which causes that null value fields are gone, and the next non-null fields got shifted in that way, that there are no null values between 2 non-null value fields in db.&lt;br /&gt;&lt;br /&gt;The solution to this issue is removing the "optionally enclosed ..." statement.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-8001968630780940223?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/8001968630780940223/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=8001968630780940223' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/8001968630780940223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/8001968630780940223'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2008/09/sql-loader-and-tab-separated-multibyte.html' title='sql loader and tab separated multibyte fields'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-4409151173302087026</id><published>2008-07-24T10:09:00.006+02:00</published><updated>2008-07-24T10:21:49.099+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='databases'/><title type='text'>10g hangs because of Archiver is unable to archive a redo log because the output device</title><content type='html'>the most probable option is that there is no place for your archive logs.&lt;br /&gt;If you use flash_recovery_area, increase the size there:&lt;br /&gt;&lt;pre class="code"&gt;$ sqlplus /nolog&lt;br /&gt;&lt;br /&gt;SQL&gt; connect sys as sysdba;&lt;br /&gt;Enter password: &lt;br /&gt;Connected.&lt;br /&gt;SQL&gt; select * from v$recovery_file_dest;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;if &lt;span style="font-weight:bold;"&gt;SPACE_USED&lt;/span&gt; is the same or close to &lt;span style="font-weight:bold;"&gt;SPACE_LIMIT&lt;/span&gt; it's definitely this reason (no place to store archive logs)&lt;br /&gt;&lt;br /&gt;increase the size of flash_recovery area:&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;SQL&gt; alter system set db_recovery_file_dest_size = 50g scope=BOTH;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;this will set the size of the flash_recovery_area to 50g immediately, and after restart as well (setting the parameter to SPFILE)&lt;br /&gt;&lt;br /&gt;If your database is not opened, try to shut it down first.&lt;br /&gt;&lt;pre class="code"&gt;SQL&gt; shutdown immediate&lt;/pre&gt;&lt;br /&gt;if that takes long time then&lt;br /&gt;&lt;pre class="code"&gt;SQL&gt; shutdown abort&lt;br /&gt;SQL&gt; startup nomount&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;do the stuff written above&lt;br /&gt;&lt;pre class="code"&gt;SQL&gt; alter database open;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-4409151173302087026?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/4409151173302087026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=4409151173302087026' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/4409151173302087026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/4409151173302087026'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2008/07/10g-hangs-because-of-archiver-is-unable.html' title='10g hangs because of Archiver is unable to archive a redo log because the output device'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-2198430738738577140</id><published>2008-07-16T13:13:00.005+02:00</published><updated>2008-07-24T10:09:16.807+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='databases'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>sqlplus enabling arrow keys for command history</title><content type='html'>It is very annoying when you in sqlplus under Linux cannot use ARROW keys to choose between executed commands.&lt;br /&gt;there is a workaround for that, it's name is &lt;span style="font-style: italic;"&gt;rlwrap&lt;/span&gt;:&lt;br /&gt;&lt;pre class="code"&gt;sudo apt-get install rlwrap&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;then you can execute:&lt;br /&gt;&lt;pre class="code"&gt;rlwrap sqlplus /nolog&lt;br /&gt;&lt;/pre&gt; or create an alias on sqlplus to be executed as &lt;span style="font-style: italic;"&gt;rlwrap sqlplus&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;thanks,&lt;br /&gt;chris&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-2198430738738577140?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/2198430738738577140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=2198430738738577140' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/2198430738738577140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/2198430738738577140'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2008/07/sqlplus-enabling-arrow-keys-for-command.html' title='sqlplus enabling arrow keys for command history'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-1876723893669787587</id><published>2008-06-12T17:46:00.004+02:00</published><updated>2008-06-12T17:52:57.882+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='backup'/><title type='text'>burn big files &gt;4GB under Linux</title><content type='html'>1. prepare a DVD size file:&lt;br /&gt;&lt;pre class="code"&gt;dd if=/dev/zero of=dvd_file.iso bs=1024 count=4589800&lt;br /&gt;mkudffs dvd_file.iso&lt;br /&gt;mkdir iso &lt;br /&gt;mount -o loop -t udf dvd_file.iso iso&lt;br /&gt;cp your_big_file_to_burn iso&lt;br /&gt;umount iso&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2. burn it&lt;br /&gt;&lt;pre class="code"&gt;cdrecord -verbose -dao -driveropts=burnfree dvd_file.iso&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-1876723893669787587?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/1876723893669787587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=1876723893669787587' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/1876723893669787587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/1876723893669787587'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2008/06/burn-big-files-4gb-under-linux.html' title='burn big files &gt;4GB under Linux'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-2752525933773795617</id><published>2008-06-11T12:46:00.008+02:00</published><updated>2009-02-09T10:22:29.699+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='backup'/><title type='text'>creating image of NTFS drive under Linux - ntfsclone</title><content type='html'>use rescucd (www.sysresccd.org with ntfsclone in ver.2.0) for this task.&lt;br /&gt;&lt;br /&gt;0. mount backup medium on /mnt&lt;br /&gt;&lt;br /&gt;1. save NTFS image:&lt;br /&gt;&lt;pre class="code"&gt;ntfsclone --save-image --output /mnt/winxp.img /dev/sda2&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2. restore NTFS image from image file:&lt;br /&gt;&lt;pre class="code"&gt;ntfsclone --restore-image --overwrite /dev/sda2 /mnt/winxp.img&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;UPDATE:&lt;/span&gt;&lt;br /&gt;if your target backup drive is limited to some smaller file size (like 4GB) you might want to compress and split the image into multiple files:&lt;br /&gt;e.g. (all one line)&lt;br /&gt;&lt;pre class="code"&gt;ntfsclone -s -o - /dev/sda2 |gzip|split -b 2000m -  /mnt/winxp.img.gz_&lt;/pre&gt;&lt;br /&gt;this will create 2GB big multiple files for that image&lt;br /&gt;&lt;br /&gt;To restore: (assuming 3 files were created aa, ab, ac)&lt;br /&gt;&lt;pre class="code"&gt;cat /mnt/winxp.img.gz_aa /mnt/winxp.img.gz_ab /mnt/winxp.img.gz_ac  |gunzip -c|ntfsclone --restore-image --overwrite /dev/sda2 -&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-2752525933773795617?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/2752525933773795617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=2752525933773795617' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/2752525933773795617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/2752525933773795617'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2008/06/creating-image-of-ntfs-drive-under.html' title='creating image of NTFS drive under Linux - ntfsclone'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-4621374171030051864</id><published>2008-06-11T09:52:00.007+02:00</published><updated>2008-06-11T10:43:00.951+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='backup'/><title type='text'>partimage to backup restore drive images</title><content type='html'>prerequisites:&lt;br /&gt;1. partimage (www.partimage.org here 0.6.7)&lt;br /&gt;2. rescuecd (www.sysresccd.org here 1.0.3) and burn it on CD&lt;br /&gt;3. sfdisk&lt;br /&gt;4. 2 drives with same size (or the one that you will be restoring to bigger size) + the backup HDD with some file system on it (in my case ext3 to hold big data files)&lt;br /&gt;&lt;br /&gt;HowTo Backup:&lt;br /&gt;1. attach the backup drive (can be USB HDD, stick, whatever that will save your images - in my case I use 300GB USB drive)&lt;br /&gt;2. Boot the rescuecd&lt;br /&gt;3. to find out the location of the drive in my case /dev/sdb1, use command&lt;br /&gt;&lt;pre class="code"&gt;fdisk -l&lt;/pre&gt;&lt;br /&gt;   - if this is linux fs drive with ext3 , use following command:&lt;br /&gt;&lt;pre class="code"&gt;mount -t ext3 /dev/sdb1 /mnt&lt;/pre&gt;&lt;br /&gt;4. save original MBR with dd&lt;br /&gt;&lt;pre class="code"&gt;dd if=/dev/sda of=backup-sda.mbr count=1 bs=512&lt;/pre&gt;&lt;br /&gt;5. save all the extended partition entries  &lt;br /&gt;&lt;pre class="code"&gt;sfdisk -d /dev/sda &gt; backup-sda.sf&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;IMPORTANT: save both files from 4. and 5. in safe places (they will be needed to restore the structure of the original to the new disk)&lt;br /&gt;&lt;br /&gt;6. run partimage command&lt;br /&gt;&lt;br /&gt;7. mark the partition that you want to back up (e.g. /dev/sda3)&lt;br /&gt;8. in the Image file to create/use enter the path to the backup disk&lt;br /&gt;   e.g. &lt;pre class="code"&gt;/mnt/sda3_partimage&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;9. in Action to be done:&lt;br /&gt;   mark - Save partition into a new image file&lt;br /&gt;10. press F5 to go to Next Page&lt;br /&gt;11. Choose required Compression level (e.g. gz)&lt;br /&gt;12. Image split mode if the partitions you save are big, it is wise to split them into the file that fit on CD or DVD (I enter here 4500MB)&lt;br /&gt;After continuing with F5 you give a description and the process starts, generating files:&lt;br /&gt;   sda3_partimage.000, sda3_partimage.001, etc&lt;br /&gt;be careful these file are gzip'ed file, please rename them to sda3_partimage.00X.gz for X in 0,1,2..&lt;br /&gt;&lt;br /&gt;How To Restore:&lt;br /&gt;1. attach the backup drive containing your partimage files and mbr and extended partition entries&lt;br /&gt;2. attach empty drive (in my case /dev/sda)&lt;br /&gt;3. Boot the rescuecd&lt;br /&gt;4. to find out the location of the backup drive in my case /dev/sdb1, use command&lt;br /&gt;&lt;pre class="code"&gt;fdisk -l&lt;/pre&gt;&lt;br /&gt;   - if this is linux fs drive with ext3 , use following command:&lt;br /&gt;&lt;pre class="code"&gt;mount -t ext3 /dev/sdb1 /mnt&lt;/pre&gt;&lt;br /&gt;5. restore MBR and extended partition entries:&lt;br /&gt;&lt;pre class="code"&gt;- dd if=/mnt/backup-sda.mbr of=/dev/sda&lt;br /&gt;- sfdisk /dev/sda &lt;&gt; check with fdisk -l if all partitions made on /dev/sda&lt;/pre&gt;&lt;br /&gt;6. make sure backup file names on backup drive (/mnt) are renamed to gz, then gunzip them:     &lt;br /&gt;&lt;pre class="code"&gt;gunzip sda3_patimage.000.gz (will create much bigger sda3_partimage.000 file),     &lt;br /&gt;... or     &lt;br /&gt;gunzip sda3_partimage.*.gz &lt;/pre&gt;&lt;br /&gt;7. run partimage command &lt;br /&gt;8. Partition to save/resotre (in my case sda3) &lt;br /&gt;9. Image file: enter the path to your gunziped image files     /mnt/sda3_partimage.000     &lt;br /&gt;even if you have more than 1 file, always put the location of the 000 file &lt;br /&gt;10. Action to be done: pick Restore partition from an image file After continuing with F5 you should get restored partition on /dev/sda3 &lt;br /&gt;11. format SWAP partition (in my case /dev/sda5 -&gt; check your fdisk -l)      &lt;br /&gt;&lt;pre class="code"&gt;mkswap -c /dev/sda5&lt;/pre&gt;&lt;br /&gt;12. Install GRUB boot-loader  &lt;br /&gt;&lt;pre class="code"&gt;mkdir /new_disk&lt;span style="font-family:monospace;"&gt;&lt;br /&gt;&lt;/span&gt;mount /dev/sda3 /new_disk&lt;span style="font-family:monospace;"&gt;&lt;br /&gt;&lt;/span&gt;grub-install --root-directory=/new_disk /dev/sda&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-4621374171030051864?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/4621374171030051864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=4621374171030051864' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/4621374171030051864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/4621374171030051864'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2008/06/partimage-to-backup-restore-drive.html' title='partimage to backup restore drive images'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-1435117145483092990</id><published>2008-04-06T20:19:00.005+02:00</published><updated>2008-04-06T20:28:20.809+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>re-installing GRUB</title><content type='html'>Situation:&lt;br /&gt;You have linux and windows on your hdd,&lt;br /&gt;As it happened you needed to reinstall M$ Windows, after that operation your GRUB is not visible after reboot.&lt;br /&gt;&lt;br /&gt;Resolution:&lt;br /&gt;1. run any of the Linux LiveCD distros (I used Ubuntu)&lt;br /&gt;2. in Console type (as root or sudo):&lt;br /&gt;  &lt;pre class="code"&gt;-&gt;  grub&lt;/pre&gt;&lt;br /&gt;3. in Grub app (I had my linux partition on /dev/sda7 which is mapped to hd0,6 in GRUB):&lt;br /&gt; &lt;pre class="code"&gt;-&gt;  root (hd0,6)&lt;br /&gt;-&gt;  setup (hd0,6)&lt;/pre&gt;&lt;br /&gt;4. reboot&lt;br /&gt;5. you're done if everything went fine -&gt; I hope so :)&lt;br /&gt;&lt;br /&gt;thanks,&lt;br /&gt;chris&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-1435117145483092990?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/1435117145483092990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=1435117145483092990' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/1435117145483092990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/1435117145483092990'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2008/04/re-installing-grub.html' title='re-installing GRUB'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-7856398178041039935</id><published>2007-11-24T23:22:00.001+01:00</published><updated>2007-11-24T23:23:37.952+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='niusia'/><title type='text'>pierwsze proby przemieszczania sie :)</title><content type='html'>&lt;object height="355" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/IhLw0mZhk-8&amp;amp;rel=1"&gt;&lt;param name="wmode" value="transparent"&gt;&lt;embed src="http://www.youtube.com/v/IhLw0mZhk-8&amp;amp;rel=1" type="application/x-shockwave-flash" wmode="transparent" height="355" width="425"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-7856398178041039935?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/7856398178041039935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=7856398178041039935' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/7856398178041039935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/7856398178041039935'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2007/11/pierwsze-proby-przemieszczania-sie.html' title='pierwsze proby przemieszczania sie :)'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-874043232070963106</id><published>2007-09-17T15:32:00.000+02:00</published><updated>2007-09-17T17:56:51.412+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><category scheme='http://www.blogger.com/atom/ns#' term='databases'/><title type='text'>Oracle to_date function dates from 20th century</title><content type='html'>there is a very useful function in Oracle DB &lt;span style="font-style: italic;"&gt;to_date&lt;/span&gt;. But when you run:&lt;br /&gt;&lt;pre class="code"&gt;select to_date('78/06/01','&lt;span style="font-weight: bold;"&gt;YY&lt;/span&gt;/MM/DD') from dual;&lt;/pre&gt;&lt;br /&gt;you might be expecting a date '1-Jun-1978' (might differ depending on your local nls settings), but you get surprisingly: '1-Jun-2078'.&lt;br /&gt;Helpful is parameter &lt;span style="font-style: italic;"&gt;RR&lt;/span&gt; instead of &lt;span style="font-style: italic;"&gt;YY&lt;/span&gt;.&lt;br /&gt;&lt;span style="font-style: italic;"&gt;RR&lt;/span&gt; returns years from 21st century when given value is in range 0-49&lt;br /&gt;and returns years from 20th century when given value is in range 50-99&lt;br /&gt;&lt;br /&gt;For most cases you probably want:&lt;br /&gt;&lt;pre class="code"&gt;select to_date('78/06/01','&lt;span style="font-weight: bold;"&gt;RR&lt;/span&gt;/MM/DD') from dual;&lt;/pre&gt;&lt;br /&gt;thanks&lt;br /&gt;chris&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-874043232070963106?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/874043232070963106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=874043232070963106' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/874043232070963106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/874043232070963106'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2007/09/oracle-todate-function-dates-from-20th.html' title='Oracle to_date function dates from 20th century'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-5125042804833984524</id><published>2007-09-01T01:50:00.000+02:00</published><updated>2007-09-01T01:57:43.204+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mplayer'/><title type='text'>Mencoder converting files</title><content type='html'>Ever wanted to play a file that your favourite mplayer does not want to play?&lt;br /&gt;Or it shows other difficulties?&lt;br /&gt;&lt;br /&gt;Recently I got some tech movies in .flv (flash) format.&lt;br /&gt;Mplayer1.0.1rc1 plays them, but you cannot seek in those files.&lt;br /&gt;Problematic could be as well .mov files.&lt;br /&gt;For the .flv files you can checkout the latest version of mplayer from the subversion.&lt;br /&gt;You can though convert to a format that mplayer accepts without problems (like .avi)&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;mencoder input.flv -oac pcm -ovc lavc -o output.avi&lt;br /&gt;mencoder input.mov -oac pcm -ovc lavc -o output.avi&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Happy watching....&lt;br /&gt;chris&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-5125042804833984524?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/5125042804833984524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=5125042804833984524' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/5125042804833984524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/5125042804833984524'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2007/09/mencoder-converting-files.html' title='Mencoder converting files'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-5332254800531874605</id><published>2007-08-29T15:34:00.000+02:00</published><updated>2007-08-29T15:43:27.412+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IM'/><title type='text'>Pidgin more instances</title><content type='html'>Why would you have a need to use more instances of &lt;a href="http://www.pidgin.im/"&gt;IM pidgin&lt;/a&gt;, when you can use in one instance more protocols, etc?&lt;br /&gt;&lt;br /&gt;For me the reason was:&lt;br /&gt;- to log only Buddies messages and not IRC chats (they grow fast)&lt;br /&gt;- to flash the Pidgin window only when I receive the messages from Buddies and not from IRC chats&lt;br /&gt;&lt;br /&gt;To achieve it create a small bat file that will run second, third, ... instance of the Pidgin&lt;br /&gt;&lt;pre class="code"&gt;set PIDGIN_MULTI_INST=1&lt;br /&gt;c:\programms\pidgin2.1\pidgin -c c:\.pidgin-alt&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;where you need to apply paths where you installed your pidgin (in my case in programms\pidgin2.1\) after -c parameter is the path to the directory that will hold all settings for the second, third, etc... instance if this directory does not exist, it will be created)&lt;br /&gt;&lt;br /&gt;running that bat file will run in a seperate instance and there you can make independent  settings.&lt;br /&gt;&lt;br /&gt;happy instant messaging.&lt;br /&gt;chris&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-5332254800531874605?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/5332254800531874605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=5332254800531874605' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/5332254800531874605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/5332254800531874605'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2007/08/pidgin-more-instances.html' title='Pidgin more instances'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-317269669391150365</id><published>2007-08-28T18:30:00.000+02:00</published><updated>2007-08-28T22:34:45.529+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='poetry'/><title type='text'>for my honey</title><content type='html'>&lt;span style="font-style: italic;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;To make it clear&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;there is only one&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;and it is not beer,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;She smiles and cries&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;but never lies&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;as I hold that line&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;I'm glad that she's mine.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;I code some stuff,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;I drink, have fun&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;but she's the one working so hard.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;She waits for me,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wiping her neck,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Wait honey I'll be right back!!!&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-317269669391150365?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/317269669391150365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=317269669391150365' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/317269669391150365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/317269669391150365'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2007/08/for-my-honey.html' title='for my honey'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-1145567875494411070</id><published>2007-08-28T13:23:00.000+02:00</published><updated>2007-08-28T21:30:00.735+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><title type='text'>RMagick install from source in Debian Etch</title><content type='html'>Installing RMagick from sources (6.3.5)&lt;br /&gt;&lt;br /&gt;1. Download the latest imagemagick from &lt;a href="http://www.imagemagick.org/script/install-source.php#unix"&gt;http://www.imagemagick.org/script/install-source.php#unix&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;- compile with follwoing options (assuming you don't need it for perl nor C++)&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;./configure --prefix=/opt/imagemagick --enable-shared --disable-static --without-perl --without-magick-plus-plus&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;of course you can change prefix or remove it when you want it to be isntalled by default&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;./make&lt;br /&gt;sudo make install&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Make sure /opt/imagemagick/includes/lib is in your LD_LIBRARY_PATH&lt;br /&gt;and /opt/imagemagick/bin in your PATH&lt;br /&gt;&lt;br /&gt;2. Download the latest RMagick from &lt;a href="http://rubyforge.org/projects/rmagick/"&gt;http://rubyforge.org/projects/rmagick/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;./configure&lt;br /&gt;./make&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If at this stage you get errors like "&lt;span style="font-size:100%;"&gt;unable to read font '(null)'":&lt;br /&gt;- check first if your ImageMagick installation was successful running &lt;span style="font-family:courier new;"&gt;display&lt;/span&gt; command&lt;br /&gt;- if running display you get "unable to find font .... helvetica ..." then you need to install fonts on your system&lt;br /&gt;- if display runs fine but you still get the above error from one of ruby test scripts setting fonts options in ./configure of imagemagick might help&lt;br /&gt;- try to configure again ImageMagick with following options:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre class="code"&gt;./configure --prefix=/opt/imagemagick --enable-shared --disable-static --without-perl --without-magick-plus-plus  --with-gs_font-dir=/usr/share/fonts/type1/gsfonts --with-windows-font-dir=/home/chris/win_fonts&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;(applying appropriate paths)&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="font-family:courier new;"&gt;./make&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sudo make install&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;- compile again RMagick&lt;br /&gt;- still not running? ...&lt;br /&gt;&lt;br /&gt;I hope that helps&lt;br /&gt;chris&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/206224988104064940-1145567875494411070?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/1145567875494411070/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=1145567875494411070' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/1145567875494411070'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/1145567875494411070'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2007/08/rmagick-install-from-source-in-debian.html' title='RMagick install from source in Debian Etch'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-206224988104064940.post-1453429447781815830</id><published>2007-08-28T11:43:00.000+02:00</published><updated>2007-08-29T15:52:28.223+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='plsql'/><category scheme='http://www.blogger.com/atom/ns#' term='databases'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Oracle - table changes how to notice</title><content type='html'>Couple of days ago I had a real problem how to provide always the most recent report with the products hierarchy. The first thought was to write a kind of a hash function to get just a hash stamp of the whole table and compare against the new one. The problem arose when it came to implementing the idea.&lt;br /&gt;There is no built way to get a hash value of a whole table.&lt;br /&gt;&lt;br /&gt;Suddenly I thought: "OK, let's check if the number of rows is different, then it would mean the content of the table changed".&lt;br /&gt;&lt;br /&gt;I walked that way.&lt;br /&gt;Replacing the table I always create first the new one with some different name and if everything goes fine, I replace the name to the right one at the end.&lt;br /&gt;&lt;br /&gt;I have a production table called prods_hier and the new one in the background called prods_hier_bak&lt;br /&gt;&lt;br /&gt;the following lines of code do the comparing:&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;changed:=&lt;font color="#6a5acd"&gt;false&lt;/font&gt;&lt;br /&gt;&lt;font color="#804040"&gt;&lt;b&gt;select&lt;/b&gt;&lt;/font&gt; count(*) &lt;font color="#6a5acd"&gt;into&lt;/font&gt; no_of_rows_new &lt;font color="#6a5acd"&gt;from&lt;/font&gt; prods_hier;&lt;br /&gt;&lt;font color="#804040"&gt;&lt;b&gt;select&lt;/b&gt;&lt;/font&gt; count(*) &lt;font color="#6a5acd"&gt;into&lt;/font&gt; no_of_rows_bak &lt;font color="#6a5acd"&gt;from&lt;/font&gt; prods_hier_bak;&lt;br /&gt;&lt;font color="#6a5acd"&gt;if&lt;/font&gt; no_of_rows_new &amp;lt;&amp;gt; no_of_rows_bak &lt;font color="#6a5acd"&gt;then&lt;/font&gt;&lt;br /&gt;    changed := &lt;font color="#6a5acd"&gt;true&lt;/font&gt;;&lt;br /&gt;&lt;font color="#6a5acd"&gt;else&lt;/font&gt; &lt;font color="#0000ff"&gt;-- the same no_of_rows&lt;/font&gt;&lt;br /&gt;    &lt;font color="#804040"&gt;&lt;b&gt;select&lt;/b&gt;&lt;/font&gt; count(*) &lt;font color="#6a5acd"&gt;into&lt;/font&gt; no_of_changed_rows &lt;font color="#6a5acd"&gt;from&lt;/font&gt;&lt;br /&gt;    ( &lt;font color="#804040"&gt;&lt;b&gt;select&lt;/b&gt;&lt;/font&gt; * &lt;font color="#6a5acd"&gt;from&lt;/font&gt; prods_hier&lt;br /&gt;      &lt;font color="#804040"&gt;&lt;b&gt;minus&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;      &lt;font color="#804040"&gt;&lt;b&gt;select&lt;/b&gt;&lt;/font&gt; * &lt;font color="#6a5acd"&gt;from&lt;/font&gt; prods_hier_bak&lt;br /&gt;    );&lt;br /&gt;    &lt;font color="#6a5acd"&gt;if&lt;/font&gt; no_of_changed_rows &amp;lt;&amp;gt; &lt;font color="#ff00ff"&gt;0&lt;/font&gt; &lt;font color="#6a5acd"&gt;then&lt;/font&gt;&lt;br /&gt;        changed := &lt;font color="#6a5acd"&gt;true&lt;/font&gt;;&lt;br /&gt;    &lt;font color="#6a5acd"&gt;end&lt;/font&gt; &lt;font color="#6a5acd"&gt;if&lt;/font&gt;;&lt;br /&gt;&lt;font color="#6a5acd"&gt;end&lt;/font&gt; &lt;font color="#6a5acd"&gt;if&lt;/font&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/206224988104064940-1453429447781815830?l=krzysztofcierpisz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://krzysztofcierpisz.blogspot.com/feeds/1453429447781815830/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=206224988104064940&amp;postID=1453429447781815830' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/1453429447781815830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/206224988104064940/posts/default/1453429447781815830'/><link rel='alternate' type='text/html' href='http://krzysztofcierpisz.blogspot.com/2007/08/oracle-table-changes-how-to-notice.html' title='Oracle - table changes how to notice'/><author><name>Krzysztof Cierpisz (chris)</name><uri>http://www.blogger.com/profile/07838445516755908113</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_Bk-6hpUuoZw/SbkbXxHu8sI/AAAAAAAAD3s/RmqxZlfbtQg/S220/chrisSmall2.jpg'/></author><thr:total>0</thr:total></entry></feed>
