Importing Sample Maven projects in Eclipse for the book OReilly's Enterprise JavaBeans 3.1

So while reading this book, I though I might as well get the source code and look and run it in an IDE instead of just glance at it in the book. So turned my attention to section V, examples and proceeded to the anonymous git cloning instruction and building as below :

Oracle SQL : Matching Prefix and Suffix string but only accepting whats in between

regex replace

A while ago I wrote an article about regex lookahead and lookbehind here. I needed the same thing now in SQL, specifically Oracle flavor. Turns out that Oracle supports the POSIX BRE syntax and POSIX ERE syntax plus PERL influenced extensions, but no look ahead look behind equivalent regex syntax.

So the problem we have to solve is the same. I have a String that is ";" seperated key value pairs that might look like below:

Database Time Interval Based View Criterias in ADF View Objects

So this is more of a cookbook recipe article to show you how you can create time based View Criterias using sql fragments for your ADF ViewObjects.

Important point to note up front. Your database and application server might be running in different time zones. So you need to place attention to this fact when designing your View Objects and View Criterias. For the purpose of this article, I am going to assume that the user is building queries that orient themselves around the database time.

Regex Lookahead and Lookbehind : Match Prefix and Suffix string but only accepting anything in between

Reg ex, lookahead, lookbehind

So there is a little known construct in regex of lookahead and lookbehind, that java regex also supports atleast upwards from java 5. This is exactly what you need if the desired match lives between a known prefix and suffix String. Or depending on if you have a prefix you can use the lookbehind construct and if you have a suffix only, you can use the lookahead construct.

So the lookbehind is represented by (?<=X) and lookahead is represented by (?=X).

Simulating an SQL IN clause with ADF ViewCriteria API

So again and again I find myself doing the use case of finding a bunch of rows given only a list of Ids. A possible SQL construct that fulfills this need is something like the IN clause which goes like "Where columnX IN  (id1, id2, id3, ... idn )". If you have been doing ADF you know there is no "IN" operator. Googling around might get you to a solution where people are manually just putting the "where IN clause" simply as a string. Of course if you do this, the onus of avoiding an sql injection attack but this method is on you.

Generating random days in past or future for demo data generation via plsql / sql

So while generating demo data for one of my projects, I had to generate some days in the future and in the past. Thought I might blog about that for my future benefit as well was any one else who visits my blog. So here it goes.

Generating a date in the past (in days granularity in the range of a year)

The below statement will get you a day in the past year. Basically you generate a random number in the range of 0-365 and subtract that from the sysdate. Convert it to a timestamp and save to your timestamp field or use without the cast as a date field.

Programmtically Creating a Shared AM Instance


This one is a simple tip. If you don't want to add or declaratively deal with creating a shared AM instance and it's usuages in the different declarative file, you can quite simply programmatically create your shared AM. This few liners does the job of finding or creating a shared AM instance and than getting a VO for you. You can also adapt the code to get a session scoped shared AM.


Debugging Change Query Notification/Database Change Notification feature in ADF for Shared AM VO's (AutoRefresh Property)

Database change notification image

If you haven't worked on this area than the following information might be a little less known to you. I had to debug an issue in this area and I am summarizing the learnings about this feature here.

Family Tree Application - A multi-node tree

Here is another interesting application. I don't have Visual Studio installed to run and take a screenshot. The exe file I probably deleted back than. Should have kept it.

File transfer via Parrallel Port using C++

All my retro college work, or atleast the mentionable ones, I plan to put online. This here is something probably quite useless but nevertheless a nice programming exercise. This is probably from my 4th or 5th semester of bachelors. If you have 2 computers lying around with parrallel ports and of course, more importantly a parrallel port cable, you could probably give it a go. Also I am not sure about C++ code portability i.e. it working fine on linux, this use to work fine on windows 98 machines back than on my pentium 3 or something.


Subscribe to Ahsan's Corner RSS