Thursday, November 26, 2015

Telnet is not recognized as windows command

There are 2 things that you can do.
1) Install Telnet from the Windows feature
Go to Start -> Control Panel -> Programs -> Turn Windows feature on or off
Under feature section, find Telnet client ensure that it's ticked (if it's not).
Once (1) is installed, if you still encounter telnet is not recognized error, you can proceed with (2)

2) Go to Environment variables
Right click on my computer, select Properties, on the left side select Advanced System Settings.
Under Advanced tab, click Environment Variables, under System variables section, find the Variable = Path, ensure that C:\Windows\System32 is there. If it's not there, just append it.
Then click OK.

You should be able to run telnet commands now.

Monday, June 8, 2015

Wednesday, June 3, 2015

jquery to obtain the ID or to use the data.

To access data/id from html

in html form let say it's a button, we can put any fields as the data (by putting the tag data-<something>)

<input class="myclass" data-myvalue="myValue123" id="myID" type="button" />

To access the element using ID from the javascript:
$('#myID').click(function(e){
   var myvalue = $(this).data('myvalue');
});

To access the element using the class from javascript:
$('.myclass').click(function(e){
   var myvalue = $(this).data('myvalue');
   var myID = $(this).attr('id');
});


Monday, February 2, 2015

Entity framework 5 can't connect to Oracle DB in Windows 2012 server

Recently I did a project using Entity Framework 5 with Oracle DB.
Only Entity framework 5 is able to connect to Oracle, I'm using Oracle 12c so must use the ODAC 12.10.1.2 for coding.
When running in local, it's working fine.
However when deploying to the server, I encountered this error:

ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA

Reinstalling ODAC doesn't work.
All TNS was updated in tnsnames.ora.
However it seems EF can't locate the TNS in tnsnames.ora.

Changing the connection string to be same like the one in tnsnames.ora doesn't work.

metadata=res://*/Entities.csdl|res://*/Entities.ssdl|res://*/Entities.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string='Data Source=MYDB.WORLD;USER ID=XXX;PASSWORD=YYY;'

After enough searching here and there.. I found a temporary solution, that is to embed the TNS names in the connection string itself.

So my entity framework connection string is now like below:

metadata=res://*/Entities.csdl|res://*/Entities.ssdl|res://*/Entities.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string='Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = MYDBSERVER)(PORT = 1111))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = MYDB)));USER ID=XXX;PASSWORD=YYY;'

Reference : http://nullablecode.com/2013/10/ef-oracle-db-connection-problem-ora-12504/