Friday, January 29, 2016

ECS, CSG Mutation getting weird

Last log of

Validate with this query

select h.reference, d.model_id, d.qty_rlz, d.qty_return
from
(select * from csg_rlz_sub_dtl
where job_id in
  (
    select job_id from CSG_RLZ_HDR where reference in ('CSP/012016/0019',
    'CSP/012016/0020',
    'CSP/012016/0021',
    'CSP/012016/0022',
    'CSP/012016/0023',
    'CSP/012016/0024',
    'CSP/012016/0027',
    'CSP/012016/0031')
  )
  AND model_id='12V-7AH SMF') d,
  (
    select job_id, reference from CSG_RLZ_HDR where reference in ('CSP/012016/0019',
    'CSP/012016/0020',
    'CSP/012016/0021',
    'CSP/012016/0022',
    'CSP/012016/0023',
    'CSP/012016/0024',
    'CSP/012016/0027',
    'CSP/012016/0031')
  ) h
  where h.job_id = d.job_id
  order by h.reference
;

And there is field that maintain the remain at the CSG_RLZ_SUB_DTL.QTY_RETURN_TO_CONS
but i think it is not reliable.

Tuesday, January 19, 2016

Android 4.4.2 MediaPlayer API failed to play mp3 OMXCodec error

Having some bunches of E/OMXCodec error? That saying unable to playback your audio files?
Well i had been struggle with the same error. My situation is to play an MP3 file with
Android MediaPlayer API. The API works fine in my android 4.0 and 4.2 that plays
the alarm sound.

But it fails in my newer phones, which runs android 4.4.2. So i googled and found out that the MP3
also could be played with Ringtone and RingtoneManager.

Snippet:

Uri u = Uri.parse("android.resource://" + getApplicationContext().getPackageName() + "/" + R.raw.kring);
Ringtone ringtone = RingtoneManager.getRingtone(getApplicationContext(), u);
ringtone.play();

Thursday, January 7, 2016

Oracle, lsnrctl No Service

Oracle listener acting weird? It starts saying `No Service` right after i stop the service and start the service
  
  
$ lsnrctl stop
$ lsnrctl start
$ lsnrctl status

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                07-JAN-2016 16:23:30
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/centos65/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
The listener supports no services
The command completed successfully
  
  
After googling, got this: Login as system or sysdba and then re-register the system to current running listener service
  
sql> alter system register; 
  
Hope it helps. ^^

Tuesday, January 5, 2016

Android, Add New Element on the Fly with LayoutInflater

Adding new element in Android view not as easy as using jquery.js and add an element
into html document. After googling for a while i found out that LayoutInflater is the tool.

I found good answer in StackOverflow pointing this out:

  1. First declare your inflater.
    LayoutInflater inflater = (LayoutInflater)getApplicationContext().getSystemService
      (Context.LAYOUT_INFLATER_SERVICE);
  2. Identify and inflate the new view you seek to project on the current view.
    View view = inflater.inflate(R.layout.new_layout,null);
  3. You would want to add your new inflated view to your layout.
    main.addView(view);

Plug that code into my app becomes:

#
# ...
 
LayoutInflater li = (LayoutInflater) LayoutInflater.from(getApplicationContext() );
View cv = li.inflate(R.layout.list_targetitem, null);
TextView item1 = (TextView) cv.findViewById(R.id.targetlist_tview);
 
item1.setText( "TARGET " + MyActivity.indexTarget + "\n" + locationName );
 
#

And that code works just the same as jquery.js/HTML. But one question was arised,
how i got the id of the element? Well no luck of finding how to set new element' ID attribute.
One of the StackOverflow shares or somewhere i don`t remember at all did mention that
to hold the new element into HashMap that we could easily retreived later.

This is the way i done it

public class MyActivity extends AppCompatActity implements ... {

    LinearLayout targetHashMapView;

    @Override
    protected void onCreate(Bundle svdInstance){
        ...
        // Noticed that R.id.init_target_location is pointing to a LinearLayout tag/element
        // inside MyActivity layout xml file
        targetHashMapView = (LinearLayout) findViewById(R.id.init_target_location);
        ...
    }
}


Thus adding the new element, append the R.id.init_target_location LinearLayout element. ^,^