Sunday, July 31, 2016

ESP8266, Send and Receive HTTP Request, PART-1

The Beginning
I bought two of ESP8266 from my local store. And try to play with them using Arduino UNO.
The ESP8266 needs the 3.3 powersupply. And tried to use the 3.3 of the UNO but no avail.
So i setup the LM317T in a breadboard like this.

And after wiring all the stuffs. is become

1x LM317T
1x 10uF Polar Capacitor
1x 220ohm
1x 470ohm (i replace it with 1k resistor) (5V powersupply)
1x 470ohm with 9V powersupply
2x 47ohm ( to perform as dummy load, no need for later usage)

**Fritzing, will be updated soon**

I replaced the 470 with 1k simply because if the dummy load is attached the voltage drop badly.
After several trial&error the best fit is 1k. It is showing 3.6 with no load with 4.8V from the USB
wallplug powersupply. Then i arrange my UNO and ESP8266 as in the picture.

**Fritzing, will be updated soon**

    1 => Connect to Station or as a client
    2 => As Router
    3 => Both, you will notice that it has router ip and static client IP by AT+CIFSR
    Set static IP
3. AT+CWJAP="TP-LINK_BOSSD","**yourpassword**"
    To connect to your wifi
    Whether to use Multiple connection or Single, later in my code i use single
5. AT+CIPSTART=1,"TCP","",80
    Open a Connection
6. AT+CIPSEND=1,+2
    Where the 1 for the Multiple ID but to simplify later i use Mux=0 (Single) so you only need to
    create the AT command with AT+CIPSEND=NByte
    Where NByet is the length of your string,
    Example: GET /minimal.php/this HTTP/1.0  <-- 30="" br="" chars="" in="" is="" length="">    Total of NLength is 30 plus 2 pairs of NL/CR \r\n.
    Note if your trying these steps using the arduino serial monitor dialog,
    then set the ending to "Both NL/CR", paste the "GET ..." string
    and hit an Enter key and one more Enter key.

1. While the 2 Arduino UNO hooks to my Laptop,
    The esp8266 serial line keeps jumping and sending data.
    By powering one of the UNO to external power removed the `jumpy`
2. Arduino 5V must also connected to external power supply that source the LM317T
   Which i use an USB 5V wallplug.

   ** Which result not enough current **
   The specs say 5V 1A but unable to power these 2x Atmega328, 1x ESP8266, 1x RC522 Module, 
   LCD 16x2,  I2C Lcd, though. Using 9V 0.6A powersupply works great. 

   This one also fails.
3.AT+IPR=9600 to change the baudrate. DO NOT USE THIS!!!
   but to use AT+UART=9600,8,1,0,0 (The flow control has to be disabled!)
4. I set my HardwareSerial or Serial.begin(19200) twice of the SoftwareSerial
    after several trial&error it is better to configured like such to remove gibberish output.
    Using 9V also gives more stability. All gibberish are almost removed completely.
5. Zener 3.3V and a resistor of 68ohm before the zener to GND fails to provide
    stable 3.3V, it always shows 4.5V
6. All GND must be connected! I forgot to connect my Arduino GDN to common GND
    and the result is gibberish output at the serial monitor

1. The full AT commands
2. I found the doc about AT+UART to change baudrate here but it says that is deprecated??
    as my AT+GMR output is this
    AT version:
    SDK version:0.9.5

Friday, July 29, 2016

Vim + Arduino-Makefile, enough with the Java IDE

After for sometimes, probably 2 to 3 years, of playing with Arduino. I am more and more getting
serious with it. Using the Arduino IDE to hurting me, personally. I want to use my Vim and maybe
just use "make" Makefile. The result very exciting that Arduino-Makefile is the answer.

All i had to do is download and copy the example or maybe you could use this

### This is an example Makefile and it MUST be configured to suit your needs.
### For detailed explanations about all of the available options, please refer
### to
### Original project where this Makefile comes from:

### This is the path to where you have created/cloned your project

### Path to the Arduino-Makefile directory.
ARDMK_DIR         = /opt/arduinoprj/Arduino-Makefile

### Path to the Arduino application and resources directory.
### On OS X:
#ARDUINO_DIR       = /home/adesanto/download/
### or on Linux: (remove the one you don't want)
ARDUINO_DIR       = /home/adesanto/Downloads/arduino-nightly

### Path to where the your project's libraries are stored.

### It must be set to the board you are currently using. (i.e uno, mega2560, etc.)
BOARD_TAG         = uno

### It must be set to Serial baudrate value you are using.

### Path to the AVR tools directory such as avr-gcc, avr-g++, etc.
### On OS X with `homebrew`:
AVR_TOOLS_DIR     = /usr/local
### or on Linux: (remove the one you don't want)
AVR_TOOLS_DIR     = /usr

### Path to avrdude directory.
### On OS X with `homebrew`:
AVRDUDE          = /usr/local/bin/avrdude
### or on Linux: (remove the one you don't want)
AVRDUDE          = /usr/bin/avrdude
AVRDUDE_CONF     = /etc/avrdude/avrdude.conf

### Set the C standard to be used during compilation. Documentation (
CFLAGS_STD        = -std=gnu11

### Set the C++ standard to be used during compilation. Documentation (
CXXFLAGS_STD      = -std=gnu++11

### Flags you might want to set for debugging purpose. Comment to stop.
CXXFLAGS         += -pedantic -Wall -Wextra

### The port your board is connected to. Using an '*' tries all the ports and finds the right one.
MONITOR_PORT      = /dev/ttyACM*

### Do not touch - used for binaries path
CURRENT_DIR       = $(shell basename $(CURDIR))

### This is where you put the binaries you just compile using 'make'

### Do not touch - the path to, inside the ARDMK_DIR
include $(ARDMK_DIR)/

save it and named it as Makefile and then

$ make help
to see all the options

$ make
will compile the program default

$ make upload
compile and then upload the sketch to board

Now i can use my Vim to editing and does the
:!make upload
That does the business. Hope this help ^^

Tuesday, July 26, 2016

iOS, Lock Screen to Portrait only

After googling for sometime looking the way to override the function of
UIViewController to prevent the autoRotation yet with no good answer.
Then the Apple developer documentation does states that one can edit from info.plist.

Opening the info.plist in XCode editor looks pretty but i was not be able to look at
the supported orientation list. And using Vim the list is presented in plain XML.
Looking at this line, UISupportedInterfaceOrientations
and leaving only


The application is no longer autorotate. Hurray ^^

Sunday, July 10, 2016

POSTFIX to use Admin

Scratching my head badly... The maillog of POSTFIX saying error delivering error.
And the error always persist if email to `admin` user. After googling and found this.
Telling to check the /etc/aliases. Yes it has
admin: root
security:   root
hostmaster: root
marketing:  postmaster
sales:      postmaster
support:    postmaster

So i only removed the admin line. Restart the postfix and it works.
The email sent to admin@mydomain is well received.

Hope that helps ^^

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
(select * from csg_rlz_sub_dtl
where job_id in
    select job_id from CSG_RLZ_HDR where reference in ('CSP/012016/0019',
  AND model_id='12V-7AH SMF') d,
    select job_id, reference from CSG_RLZ_HDR where reference in ('CSP/012016/0019',
  ) 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.


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

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

Alias                     LISTENER
Version                   TNSLSNR for Linux: Version - 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...
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
  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.

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(;
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;

    protected void onCreate(Bundle svdInstance){
        // Noticed that is pointing to a LinearLayout tag/element
        // inside MyActivity layout xml file
        targetHashMapView = (LinearLayout) findViewById(;

Thus adding the new element, append the LinearLayout element. ^,^