Posts

Logical order of SQL Query execution

First of all we should know that logical and physical order of query execution are different but result must be the same. Every RDBMS can optimize the order in which parts of query are executed for performance reason. However that rearrangement must not influence the final result. The query must return the same records as if it is executed in this logical order:     FROM     WHERE     GROUP BY     HAVING     SELECT     DISTINCT     ORDER BY     TOP X / LIMIT X/ select * from ( subquery ) ROWNUM <= X The programmers should always be aware of this sequence in order not to fall into a trap. A common mistake is to try using column alias in GROUP BY, WHERE and HAVING clause but actually it is possible to use it only after SELECT clause is executed (ORDER BY and TOP/LIMIT/that long stupid oracle boilerplate). Another mistake is to try sorting by column  that is not listed in SELECT clause. The less common but hard to debug problem could be made if OUTER JOIN is used

SQL Fiddle

If you need fast try and error check against some of the most popular relational database management system  SQL Fiddle is the wright address. It is also free as in beer :) It is an online application in which you can select to work some of supported RDBMS. There are 2 text area fields: first is used to set your schema and data, the second is used to write some query that will run against your schema and data. Using SQL Fiddle you can share your script similar to Gist for source code sharing. It is also useful as online SQL code beautifier and formatter. Here is an example of SQL Code for Oracle DB: http://sqlfiddle.com/#!4/1897b/1

XMLUnit

XMLUnit for Java provides a set of supporting classes (e.g. Diff,  DetailedDiff, Transform, SimpleXpathEngine, Validator,NodeTest) that allow assertions to be made about: The differences between two pieces of XML The outcome of transforming a piece of XML using XSLT The evaluation of an XPath expression on a piece of XML The validity of a piece of XML Individual nodes in a piece of XML that are exposed by DOM Traversal XMLUnit for Java can also treat HTML content (even badly-formed HTML) as valid XML to allow these assertions to be made about the content of web pages too.   Experience I've used XMLUnit in 2 situations: assert that 2 xml files are semantically the same regardless of structural differences (eg. different formatting, different namespace prefixes, usage of opening and closing tag vs. empty tag...) and finding real differences between two xml files regardless of prior mentioned differences in structure. The equality of two

How to download multiple files using cURL

A few months ago I've bought Kobo Aura HD eBook reader. That is my best investment this year :) I am using every chance to read books, but also I am reading magazines that do have ePub format (PragProg, Libre!, FullCircle, BSDMag and Linux Magazine. But I've had a problem to download all issues of some magazine. If download URL for particular issue can be guessed than cURL will do the job perfectly. As example here is a command to download all 78 issues of FullCircle: curl http://dl.fullcirclemagazine.org/issue[1-78]_en.epub --create-dirs -o "/home/zlatan/Downloads/fullcircle/fullcirclemagazine#1.epub" Particular url is http://dl.fullcirclemagazine.org/issueXX_en.epub where XX is issue number. The option o controls output, and because there are 78 files filename will be constructed from fullcircleXX.epub name where XX is corresponding issue number taken from URL cUrl is free software that exists as package for almost all platforms. So Linux user can use th

How to install Lotus Notes 8.3 on Kubuntu 12.04

Installing Lotus Notes became easier than in previous versions and  fortunately  there is no need to edit .deb files anymore. Follow these steps to install Lotus Notes (Kubuntu 12.04.1 32b): untar the installation:  tar xvf lotus_notes853_linuxUb_en.tar run installer: sudo dpkg -i ibm-lotus-notess-8.5.3.i586.deb dpkg will throw missing dependencies, you should search and install all that dependencies using apt-get, aptitude or Muon package manager run: sudo dpkg -i ibm-lotus-notess-8.5.3.i586.deb again install other lotus notes parts: sametime, activities and so on using the same approach similarly untar and install fixpack install the wrapper: mkdir -p / tmp / notesfix cd / tmp / notesfix   wget –no-check-certificate https: // github.com / sgh / lotus-notes_gtk2.23.3 / raw / d3492c997bc7a92b895fa1369d4743a8e20b56b5 / Makefile   wget –no-check-certificate https: // github.com / sgh / lotus-notes_gtk2.23.3 / raw / d3492c997bc7a92b895fa1369d4743a8e20b56b5 / libnotesgtk

Pro Spring 3

Right now I am reading Pro Spring 3 written by Clarence Ho and Rob Harrop (a SpringSource co-founder). Very up to date book about Spring covering version 3.1. This book doesn't lack information, almost every part of Spring is covered including some useful addons like Spring Data JPA, Spring Batch, Spring Integration and Roo, The book is not just about Spring it is about how to be productive with Spring. Author explains how to use SpringTool Suite (STS), how to decide which approach to follow, examples are very profound. And through the book author is developing a real application! I wish that authors have paid attention on Spring security (not covered at all) and Beans Validation chapter is too thin with only 2 field validation annotations mentioned (@NotNull and @Size). Still this is the best book that will make you a good and capable Spring programmer even if you don't have any precognition about Spring.

YU18n

Raspad SFRJ doneo je mnogo problema lokalizatorima za naše pordučje. Autori Java jezika se nisu baš najbolje snašli u tome pa i u javi 6-te verzije postoje problemi. Rešenje za te probleme kao i kratak istorijat problema pogledajte na sledećem linku: http://klaus.e175.net/java-yu Hvala Draženu na ovom linku :)