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
want

// 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();
            System.out.println(size);
            if (size != 1) {
                System.out.println("not single iterator ok");
  //  practically, should through an exception  
              }
          
       else
 {
//  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();
            System.out.println(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;
                 }
           } 
         else 
          {
            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

1
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 =
        (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");

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() {
        super();
    }
    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)itr.next();
            String val = attrBinding.getInputValue().toString();
            System.out.println(val);

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, 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 looked 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 

https://www.quora.com/What-is-your-take-on-Julia-language

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. 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 it is.

https://www.quora.com/Is-Julia-programming-language-growing-fast

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.

EDIT Sept 18, 2024:  So far it seems that Julia's programming language is not picking up as I thought. People still prefer to use Python. Julia could still be needed in certain situations like distributed and parallel processing.

https://www.reddit.com/r/Julia/comments/18s0ubz/is_julia_programming_language_destined_to_fade/

rgds

Ammar  Sajdi -  REALSOFT

ليش اسمه عيد

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 anymore a civil war, but a war fought by many countries on Syrian soil).

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


Almotanabi summed it up by saying


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



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


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

Ammar

Thursday, May 11, 2017

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

Richard Feynman, the most amusing, most captivating brilliant man  (In my opinion) would be 99 years.

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

https://www.youtube.com/watch?v=LyqleIxXTpw

Ammar Sajdi
Amman, jordan 2017, May 11

Wednesday, May 10, 2017

Fuchsia

wondering what Fuchsia is?
mmm,
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.

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

I am reciting from that earlier block as it seems that some commonalities still exist.  The following tells you how the earlier blog began (http://oraclejo.blogspot.com/2007/08/untitled.html)


  • maybe it is LIS (Lack of Interest Syndrome) or my every-once-in-a-while mood swing cycle. Not being in the mood. As a remedial, I am taking a break, Yeah, 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 a 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. A nautical mile is equal to 1850 Meters and hence it is longer than 1 Mile.  To add a piece of information, sailors, Pilots, and navigators in general use nautical miles, because a nautical mile is a measure that is based on the circumference of the earth and is equal to one minute of latitude. Note on 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 a half hours 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 bedrooms. Each bedroom is very small, equipped 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 scary 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 tired and even though the guys wanted to go to a restaurant (pub to be honest) 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 a shower area. it was spacious and clean, and 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 its miniature shower area

Ammar Sajdi



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  
C:\Middleware\instances\instance1\diagnostics\logs\OracleBIServerComponent\coreapplication_obis1

and swlog1 located at
C:\Middleware\instances\instance1\diagnostics\logs\OracleBIPresentationServicesComponent\coreapplication_obips1

in the swlog1 i got errors similar to 

[2017-03-19T19:18:10.000+03:00] [OBIPS] [ERROR:1] [] [saw.security.odbcuserpopulationimpl.getbisystemconnection] [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)[[
File:odbcuserpoploaderimpl.cpp
Line:995
Location:
    saw.security.odbcuserpopulationimpl.getbisystemconnection


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 .. 


 http://www.amazon.com/gp/product/B00L42TNI8/ref=s9_simh_gw_g469_i1_r?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=desktop-1&pf_rd_r=1NQ4JZKQ09HY2FAH0FPR&pf_rd_t=36701&pf_rd_p=2079475242&pf_rd_i=desktop



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

Size
Pulse per Lit
Formula  frequency = K * Q(Lit/min)
Case Study, pulse/min
Flow lit / min
1
G2 inch
12
Pulse per min/60 =  0.2 * Q
1200
Q=1200/60/0.2=100 L/min
2
G 1 1/2 inch
30
Pulse per min/60=0.5 * Q
2700
Q=2700/60/0.5=90 L/min
3
 G 1.0 inch
288
Pulse per min/60=4.8*Q
1800
Q=1800/60/4.8=6.25 lit/m
4
G ¾ Inch
330
Pulse per min/60=5.5*Q
2000
Q=2000/60/5.5=6 lit/min
5
G ½
450
Pulse per min/60=7.5Q
1600
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


Fundamentals of Software Testing

Originally posted on jan , 23 2009, Published again on Sept,18,2024 extracted completely from    http://testingsoftware.blogspot.com/2005/1...