Friday, June 30, 2017

Getting Ref of the View Object referenced by the current Iterator binding for One iterator page without knowing the name of the iterator

Getting Ref of the View Object referenced by the current Iterator binding for One iterator page without knowing the name of the iterator

In a previous blog (Playing around with ADFdatacontrol),  it was shown that you can get the ApplicationModule object without having to know the name of the Data Control. i mean Instead of this line of code
AppModuleImpl appmodule = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");

you could write the following
        DCBindingContainer binding =   (DCBindingContainer)ADFUtils.getBindingContainer();
        DCDataControl cDataControl = binding.getDataControl();
        ApplicationModule AM =cDataControl.getApplicationModule();

Now, and in order to be more generic in code writing, here is a code that will get you the View Object to which the iterator binding of a page is bound to.
This code will work for simple pages that contain one iterator binding because if there are two iterator bindings within the same page definition, you will need to specify which one you

// this piece of code will get all iterator bindings for the page and will check that there is only ONE iterator binding, this implementation is much faster than iterator through the iterator and count it
   ArrayList arr = binding.getAllIterBindingList();
        if (arr instanceof Collection) {
            int size = (arr).size();
            if (size != 1) {
                System.out.println("not single iterator ok");
  //  practically, should through an exception  
//  once you are sure there is only one iterator, then you fetch the first iteratorbinding in the list

                DCIteratorBinding ItrBind = (DCIteratorBinding)arr.get(0);

// here you get the viewobject that the iterator references without its name

                ViewObject voData = ItrBind.getViewObject();
 //  just playing around with some method of the view object to test               
                Long range = voData.getEstimatedRowCount();
                System.out.println("Range :" + range.toString());
                System.out.println("VO name " + voData.getDefFullName());
      else {
            System.out.println("not a collection ");

You can now create a method that shall return the ViewObject 

    public ViewObject  getCurrentIteratorVO () {
        DCBindingContainer binding = (DCBindingContainer)ADFUtils.getBindingContainer();
        ArrayList arr = binding.getAllIterBindingList();
        if (arr instanceof Collection) {
            int size = (arr).size();
            if (size != 1) {
                System.out.println("not single iterator ");
            // practically, should through an exception
            else {
               DCIteratorBinding ItrBind = (DCIteratorBinding)arr.get(0);
               ViewObject voData = ItrBind.getViewObject();
              return voData;
            System.out.println("not a collection ");
                return null;

Call the method
    public String cb6_action() {
        // Add event code here...
        ViewObject vv = getCurrentIteratorVO();
        return null;

The output is

Range :14

VO name model.EmpView

Tuesday, June 27, 2017

Playing around with ADF dataControl

While trying to figure out what one of our ex-colleagues at REALSOFT is programming a business rule engine admin screen for the Health Insurance Administration card issuance and administration software solution, i noticed the following piece of code

    AppModuleImpl appmodule =

this piece of code is specific for the Oracle Application Development Framework that we use to build JEE web scalable , mission critical applications.

Being a principal in the company, i try to find ways not only to optimize the coding endeavor , but also to minimize costs. 

One way of doing that is obviously  by building reusable libraries, encapsulate the nitty-gritty issues and minimizing the things that the developer needs to understand about the framework in order to getting his applications up and running.

What i do not like about the above is that fact that the developer needs to know the Data Control  Name in order to access the ApplicationModule object 

 What i have in mind is to create a method that will get does not need the developer to know more that the method name in order to get the application module.  I fiddled around with helper classes found the following

public class Ammar {
    public Ammar() {
    public void PlayWithDataControl(){
        DCBindingContainer binding =   (DCBindingContainer)ADFUtils.getBindingContainer();
        DCDataControl cDataControl = binding.getDataControl();
        ApplicationModule AM =cDataControl.getApplicationModule();
//        System.out.println(cDataControl.getName());  to make sure i am within the same data control
// another legitimate question is what if i have more that one page in the application, am i getting the application module pertaining to the page definition i am on?  well , the test below indicates that the answer is yes,, i created two pages, and called the following code from both, and each printed its own page definition name

System.out.println(    binding.getDef().getContainerName());

So ,  i would just modify the above and add it to company Library

    public ApplicationModule getRSMyAppMod(){
        DCBindingContainer binding =  (DCBindingContainer)ADFUtils.getBindingContainer();
        return binding.getDataControl().getApplicationModule();

you can then call it from your view controller ,, something like this, i am using strongly typed implementation here

    public String cb6_action() {
        // Add event code here...
        AppModuleImpl appMod = (AppModuleImpl)getRSMyAppMod();
        ViewObject vo = appMod.getEmpView1();
        ViewObjectImpl empView1 = appMod.getEmpView1();

Another corollary of the Binding container which i liked is the fact that i can fetch all the binding attributes

        List attrBindings = binding.getAttributeBindings();
        Iterator itr = attrBindings.iterator();
        while (itr.hasNext()){
            AttributeBinding attrBinding = (AttributeBinding);
            String val = attrBinding.getInputValue().toString();

Yes another corollary is that one can find the  value of an attribute from the binding container directly by using the method    attrBinding.getName();

also i found in the ADFUtils helper method the following which return the value of any bound attribute..  This is very nice, and will make the life of people coming from forms background easier.
Just call the method ScreenValue instead of the getBoundAttribute, and it will be all fun

    public static Object getBoundAttributeValue(String attributeName) {
        return findControlBinding(attributeName).getInputValue();

Ammar  Sajdi  Third day of Eid at office enjoying the heat wave 35C

Sunday, June 25, 2017

Say Hi to Julia

By Ammar Sajdi

Well, Do not get too excited, Julia is a programming language. It saw the light on Valentine’s day, 2012.
While it can be an effective general purpose programming language, but the real strength of Julia is the fact that provides for high performance, parallel and distributed computing.  

Well parallel and distributed caught my attention, i never wrote a program that can unleash the power of parallel computing. I locked at the language, and it is really easy to do parallel computing. This makes it suitable for applications that involve intense numerical analysis

if you want to know what people think of Julia refer to

someone said

There was never a doubt in my mind that Julia is good, probably the best language for the future, will succeed/already has for the scientific audience (as clearly better than all alternatives, for performance work where you also want to be "dynamic"). It's estimated to have exponential growth of users, doubling every 9 months now, estimated at 100,000 users, with I forget how many downloads per day. Can look it up (it's in a video on youtube, from one of the key Julia people).

I'm sure the rest of (non-HPC) programmers will eventually clue up, and use it as the general language that is is.

finally, i met a young relative of mine who is studying Engineering at Stanford, and part of the industrial engineering curriculum is to take a course in Julia programming


ليش اسمه عيد

Ammar Sajdi   ,  2017

well i wrote about it before

3id in Arabic comes from E3adah (return , repetition). Saying Happy Eid implicitly means that one wishes the happy return of this occasion

Do i wish the return of events that occurred this year, well in the regional front, it has been bad and getting worse

civil war in Syria (not any more a civil war, but a war fought by many countries on the Syrian soil).

Saudi war against Yemen,, Cholera breakout in Yemen, Gulf-Qatar Crises, Political unrest in Libya, Palestinian Hunger strike in Israeli prisons and the lists goes one.

Almotanabi summed it up by saying

عيد الي حال عدت يا عيد                                       بما مضى ام بامر فيك تجديد                         

ولا ماني شايف تجديد    شايف بما مضى بس اسوأ حالا

ولكن وعلى كل حال   كل عام ونتم بخير

Thursday, May 11, 2017

The most captivating communicator in the history of Science Richard Feynman birthday is today

Richard Feynman, most amusing, most captivating brilliant man would be 99 day.

Learn more about him and watch this video, watch his presentation skills, his influential lecturing capabilities, he was always the center of attention.  watch and learn how to become a charming person

Ammar Sajdi
Amman, jordan 2017, May 11

Wednesday, May 10, 2017


wondering what Fuchsia is?
well it is a new product from Google!!  
You would guess most probably it is a piece of software, well you have got it right!
Rumor has it that it  Googles mysterious new OS. It is probably intended to power future google based devices like smartphones and tablets, and it will replace Android;
It has a new user interface called Armadillo, it is a new UI vastly different from anything you ve seen.  No icons, no gadgets, there are sneak previews floating around over the internet, go and find out

Ammar Sajdi

Sunday, May 07, 2017

<أَفَلَا يَتَدَبَّرُونَ الْقُرْآَنَ أَمْ عَلَى قُلُوبٍ أَقْفَالُهَا>

أَفَلَا يَتَدَبَّرُونَ الْقُرْآَنَ أَمْ عَلَى قُلُوبٍ أَقْفَالُهَا 

لا تقفل على قلبك

"كلما ازددت علما ازداد علمي بجهلي"

Monday, May 01, 2017

Crazy vacation - part I

P A R T (I)

I have not been blogging for quite a while about my activities for several reasons, however, i have decided to blog in order to document a vacation i took in turkey.

I reminded me of earlier blogs that i have written ten years back, when i visited Turkey with family. It was nice to go back and read what i wrote then

I am reciting from that earlier block as it seems that some commonalities still exists.  The following tells you how the earlier blog begin (

  • maybe it is LIS (Lack of Interest Syndrome) or my every-once-in-a-while mood swing cycle. Not been in the mood.As a remedial, i am taking a break, Yeh, i am traveling ! What is unique this time is the fact that I shall be traveling on vacation with family and relatives.
well, this time i already traveled and i am back, i traveled on a sailing trip to the southern coast of turkey with five guys namely 
  • Zaher Bushnaq
  • Rajai Bushnaq
  • AlaEddin Busnaq
  • Husam Katkhoda (Bushnaq)
The name Bushnaq comes from Bosnia, because this family came from Bosnia early days of the last century.

The target (without plan )set forth by Captain Rajai Bushanq was to sail from Marmaris to Bodrum and back in 5 days and 4 nights. Well, to cut your suspense short, i will tell you right away that it did not happen. Nothing happens without a good plan.  It is more than 400 Km round trip. In navigation, nautical miles unit of measure is used. I Nautical mile is equal to 1850 Meter and hence it is longer than 1 Mile.  To add a piece of information,  Sailor, Pilots and navigators in general use nautical miles, because a nautical mile is a measure which is  based on the circumference of the earth and is equal to one minute of latitude. Note of the map that one sails very close to the Greek waters and you do not want to slip into their territories by mistake; it is too close

First Day:  Saturday 22/4/2017,  we left Amman at around 11, we arrived in Istanbul, then immediately (well not exactly immediately, but after 3 hours) took a connecting flight to Marmaris, where the rented boat was waiting for us. 
Upon arrival, it started raining, and when it rains , it pours. We took a minibus to Marmaris , and it took around 1 and half hour to reach our destination, it was dark and we could not see anything on the way.,  When we arrived at the Marina, it was still pouring rain and there was nobody there. We knew the name of our boat (PEARL) and we luckily found it.  We were soaking wet, and to my pleasant surprise, the boat was equipped with 4 small bed rooms. Each bedroom is very small, quipped with a bathroom (so called bathroom, to give you an idea, it is smaller than the bathroom of commercial aircraft, except it has a shower as well).  The boat tips badly with wind and gets really scarey at times

Forgot to mention that it was also cold, really cold. i had to wear my CASHMERE blouse to get warm in addition to the woolen blanket that you can see in the picture. Notice that the window is located on the ceiling. As for your belongings, there is a small area on the right, that you need to manage.  I was tiered and even though the guys wanted to go to restaurant (pub to be honest) but i declined as it was too wet to venture into such things, and i slept like a baby.

The morning after:

Husam keeps shouting. This is a habit of his, so we had to wake up early, it was not raining anymore, but was still cold.  Well, i am pleased to learn that there is a public WC with shower area. it was spacious and clean, without any reluctance, i decided to use the public WC rather than the in-boat alternative.  The in-boat alternative is built for people who are not tall, i am 191 cm tall and hence not the perfect fit to use the bathroom with it miniature shower area

Sunday, March 19, 2017

Fail to login to Oracle BIEE analytics page even though you know for sure that your analytics username and password are correct

This is a purely technical post , that i am writing primarily to remind myself about many issues that would face anyone trying to login to the oracle BI analytics page  (http://server:7001/analytics )

Two log files that you need to inspect

nqServer.log  located at  

and swlog1 located at

in the swlog1 i got errors similar to 

[2017-03-19T19:18:10.000+03:00] [OBIPS] [ERROR:1] [] [] [ecid: 00ieQim1zLuFw0zlbq0CBz3aJzi3jwIx600010^000000,0:2487] [tid: 3188] Authentication Failure.
Odbc driver returned an error (SQLDriverConnectW).
State: 08004.  Code: 10018.  [NQODBC] [SQL_STATE: 08004] [nQSError: 10018] Access for the requested connection is refused.
[nQSError: 43113] Message returned from OBIS.
[nQSError: 43126] Authentication failed: invalid user/password. (08004)[[

and in the nqServer  i got errors similar to 

[2017-03-19T19:18:09.000+00:00] [OracleBIServerComponent] [ERROR:1] [] [] [ecid: 00ieQim1zLuFw0zlbq0CBz3aJzi3jwIx600010^000000] [tid: b48] Error Message From BI Security Service: SecurityService::authenticateUserWithLanguageUnexpected error authenticating user {0}
[2017-03-19T19:18:09.000+00:00] [OracleBIServerComponent] [ERROR:1] [] [] [ecid: 00ieQim1zLuFw0zlbq0CBz3aJzi3jwIx600010^000000] [tid: b48]  [nQSError: 43126] Authentication failed: invalid user/password.

there are many reason why you get authentication failed   with [nQSError 43126]

in my case the problem was related to the fact that not all JDBC data sources where deployed on both the BI cluster, and the AdminServer Cluster, they were all deployed on the BI Cluster, and some on the AdminServer. Once , i deployed the jdbc data sources on the AdminServer in addition to the BI Cluster, and then rebounced the services, the problems disappeared.

However, other caused are present, i found a very helpful  document on metalink that summarizes all possible problems that are manifested by

nQSError: 43126] Authentication failed: invalid user/password.

please check the document below

Note: Such error is caused by OBIEE trying to access the database, because if you look above , there is ODBC and SQL involved  (repeated here)
  "Odbc driver returned an error (SQLDriverConnectW).
State: 08004.  Code: 10018.  [NQODBC] [SQL_STATE: 08004] [nQSError: 10018] Access for the requested connection is refused".  

That is why i was thinking Data Source immediately

OBIEE 11g: Error:" [nQSError: 43126] Authentication failed: invalid user/password." (Doc ID 1472848.1)

Wednesday, January 18, 2017

أخترت لكم

عمان  كانون ثاني ٢٠١٧ 

اجد نفسي، وبعد ان خال لي اني هجرت الكتابة في هذا البلوج بضع من الزمان ، اعاود طرق بابة لجمال ما قرأت وذلك بعد ان فشلت مقامة عدم نشره هنا

"البعض نحبهم لكن لا نقترب منهم ، فهم في البعد أحلى وهم في البعدأرقى وهم في البعد أغلى

والبعض نحبهم ونسعى كي نقترب منهم ونتقاسم تفاصيل الحياة معهم ويؤلمنا الابتعاد عنهم ويصعب علينا تصور الحياة حين تخلو منهم.

 والبعض نحبهم ونتمنى أن نعيش حكاية جميله معهم ونفتعل الصدف لكي نلتقي بهم ونختلق الأسباب كي نراهم ونعيش في الخيال أكثر من الواقع معهم

 والبعض نحبهم لكن بيننا وبين أنفسنا فقط فنصمت برغم الم الصمت فلا نجاهر بحبهم حتى لهم لان العوائق كثيرة  والعواقب مخيفه ومن الأفضل لنا ولهم أن تبقى الأبواب بيننا وبينهم مغلقه

والبعض نحبهم فنملأ الأرض بحبهم ونحدث الدنيا عنهم ونثرثر بهم
 في كل الأوقات ونحتاج إلى وجودهم كالماء ..والهواء ونختنق في غيابهم لابتعاد عنهم

 والبعض نحبهم لأننا لا نجد سواهم وحاجتنا إلى الحب تدفعنا
 نحوهم فالأيام تمضي والعمر ينقضي والزمن لا يقف ويرعبنا بأن نبقى بلا

والبعض نحبهم لان مثلهم لا يستحق سوى الحب ولا نملك أمامهم سوى أن نحب فنتعلم منهم أشياء جميله ونرمم معهم أشياء كثيرة ونعيد طلاء الحياة من جديد ونسعى صادقين كي نمنحهم بعض السعادة

 والبعض نحبهم لكننا لا نجد صدى لهذا الحب في قلوبهــم فننهار و ننكسر و نتخبط في حكايات فاشلة فلا نكرههم ولا ننساهم ولا نحب سواهم ونعود نبكيهم بعد كل محاوله فاشلة

 والبعض نحبهم ويبقى فقط أن يحبوننا مثلما نحبهم"

من اقوال جبران خليل جبران

عمار السجدي

Thursday, December 03, 2015

Measuring water flow using TmallTech Hall Effect Sesnors

I have installed a Geothermal system and wanted to make sure that i am using it in an efficient manner.

The system engineer did not install the necessary monitoring tools, therefore, i wanted to find cheap and easy to use Flow meters. I search on Amazon and found about a suite of devices provided by TmallTech.

It was not a plug and play setup because in order to do the calculation correctly, you need some manufacturer information.  I was disappointed that the manufacturer did not send any data sheet about the product.  I googled such data sheet to no avail.  The piece of information that you would need is called the K factor.  the K factor lets you convert the pulse that the hall effect sensor to flow.  The K factor depends on the device and its diameter!

After lots of research and calibration, i arrived to a suitable solution

First  You need to read the Hall Effect sensor reading.  for that you can do one of the following

1) Buy a Digital Tachometer Gauge RPM.  A bought a good one from amazon called

DROK® 0.56" Digital Tachometer Gauge RPM Speed Measure Gauge Meter DC7~30V Tester Velocimeter 60-9999 RPM with Red Display for 14 USD ..

2) Use Arduino kit to connect the hall effect sensor to it and do a little bit of programming or googling

3) Use a reading device that is designed to work with hall effect flow meter. I bought one, but also it comes with no user guide and therefore , was not able to change the K factor to be suitable for the device i am using.  So I do not recommend this options

Actually, the first option proved to be the most accurate and viable option.  

By the way, you need a power source to supply both the flow meter and the Tachometer.

The entire success of the story depends on Knowing the K factor.

Below you can find the K factor for devices suppled by TmallTech

The following table will help you find flow meter reading from hall effect pulse rates

Pulse per Lit
Formula  frequency = K * Q(Lit/min)
Case Study, pulse/min
Flow lit / min
G2 inch
Pulse per min/60 =  0.2 * Q
Q=1200/60/0.2=100 L/min
G 1 1/2 inch
Pulse per min/60=0.5 * Q
Q=2700/60/0.5=90 L/min
 G 1.0 inch
Pulse per min/60=4.8*Q
Q=1800/60/4.8=6.25 lit/m
G ¾ Inch
Pulse per min/60=5.5*Q
Q=2000/60/5.5=6 lit/min
G ½
Pulse per min/60=7.5Q
Q=1600/60/7.5=3.5 lit/min

For example let us take the 2 inch case
Measuring the pulse rate using a device from amazon called
DROK® 0.56" Digital Tachometer Gauge RPM Speed Measure Gauge Meter DC7~30V Tester Velocimetry 60-9999 RPM with Red Display
The device measured 1200 pulse/min
The manufacturer specification is that the flow meter generates 12 pulse per lit
Therefore, the Frequency HZ (pulse/second) is 1200/60=  20 Hz
Therefore, the flow per second is  20hz/12 = 1.66  lit/second
Applying the formula above gives the same result
Q = pulse per min/60 / 0.2 è  pulse/second  /0.2 è pulse/second /12/60 è 20/0.2=100 lit/second
ð    100/60 è  1.6 lit/min

Getting Ref of the View Object referenced by the current Iterator binding for One iterator page without knowing the name of the iterator

Getting Ref of the View Object referenced by the current Iterator binding for One iterator page without knowing the name of the iterator ...