Pages

Technology News

Saturday, June 24, 2017

Networking jargon's

So what is networking all about? It involves connecting of different systems for the purpose of sharing information and resources. You may come across different terms in networking which is mentioned below:


SNEAKERNET

A type of networking where data is transferred physically using storage media like magnetic tapes, floppy disks, CD/DVD, USB flash drives or external hard drives from one computer to another.


ETHERNET

A type of networking that could support around 30 users on a single network with a total span of 607 feet.


LOCAL AREA NETWORK (LAN)

A small network limited to a single collection of machines using one or more cables and other peripheral devices.


INTERNETWORK

A network of networks which consists of two or more physical networks.


METROPOLITAN AREA NETWORK (MAN)

This type of network usually connects LAN's in the same city or town.


WIDE AREA NETWORK (WAN)

A network that links two or more LAN's or MAN's and spans huge geographical locations.


SERVER

A system whose job is to respond to requests for services or resources from different clients.


CLIENT

A system that requests resources or services from other systems.


PEER TO PEER NETWORK (P2P)

Here each computer can be a client as well server to other computers. A single computer can request resources from other computers and can act as a server to other computers for transferring this data to some other computer.

Tuesday, February 10, 2015

Smart Card Communication-APDU Format

Java Smart Cards are different in sense that there is an on card virtual machine which resides in the card chip that is actually responsible for processing the instructions. The instructions to the card are sent by a host application. The host application may be a server side application or a desktop application or another smart card applet. 
Applets are applications that reside on the smart card. The host application and the smart cards communicate in a specific sequence. The host application sends commands to the applets and the applets sends back a response. 
This communication takes place with the help of Application Protocol Data Unit or APDU. The APDU is basically divided into two parts namely: 
  • Command APDU: Sent by the host application to the Java Card. The structure of the same is displayed below: 
    Mandatory HeaderOptional Body
    CLAINSP1P2LcData FieldLe
  • Response APDU: Response sent by the Java Card applet to the host application. The structure of the same is displayed below: 
    Optional BodyMandatory Trailer
    Data FieldSW1SW2

Monday, February 9, 2015

Using oracle.sql.ARRAY with Spring JdbcTemplate


Many a times, you may be required to do bulk insert of data into Oracle tables. For this purpose, you might use oracle.sql.ARRAY to pass the bulk data. Many of us know how to do this using native JDBC, but here's my example for those using Spring framework's JdbcTemplate.

We have two master tables namely:
EMP (employee master) and PROJECTS (employee's projects). The structure of the same is as follows:

EMP_ID EMP_NAME
1 Jack
2 Jim

PRJ_ID PRJ_NAME
I001 Inventory
B0021 BFSI

As you can see the relation between EMP and Projects is many to many. So we have one more table namely EMP_PROJECTS. The structure of the same is as follows:

EMP_ID PRJ_ID
1 I001
1 B0021

To insert multiple bulk values in the EMP_PROJECTS table, we might consider using oracle.sql.ARRAY. So we declare a test array object as follows:

CREATE OR REPLACE TYPE TEST_ARR AS TABLE OF VARCHAR2(1000);

Now we have a stored procedure that uses the above mentioned type to insert data into the EMP_PROJECTS table as follows:

CREATE OR REPLACE PROCEDURE PRC_INS_EMP_PRJ(EMP_ID IN VARCHAR2, PRJ_ARR IN TEST_ARR)
AS
BEGIN
INSERT INTO EMP_PROJECTS (EMP_ID, PRJ_ID) VALUES (SELECT EMP_ID, COLUMN_VALUE FROM FROM TABLE (PRJ_ARR));
END;

In the above procedure, we can insert multiple project id's against a single employee id. To call the above procedure using Spring JdbcTemplate, we first need to set the SQL parameters as follows:

SqlParameter inEmpId = new SqlParameter(Types.VARCHAR);
SqlParameter inPProjectIdArray = new SqlParameter(Types.ARRAY);

List<SqlParameter> sqlParameterList = new ArrayList<SqlParameter>();
sqlParameterList.add(inEmpId);
sqlParameterList.add(inPProjectIdArray);

List<String> projectIdList = new ArrayList<String>();
projectIdList.add("1001");
projectIdList.add("B0021");

The code for calling the above procedure is as follows:

Map<String, Object> resultMap = jdbcTemplate.call(new CallableStatementCreator() {
                   
                    @Override
                    public CallableStatement createCallableStatement(Connection connection)
                            throws SQLException {
                       
                        ArrayDescriptor arrayDescriptor = ArrayDescriptor.createDescriptor(TEST_ARR, connection);
                        ARRAY inputArray = new ARRAY(arrayDescriptor, connection, projectIdList.toArray());
                       
                        CallableStatement cs = connection.prepareCall(sqlQuery);
                        cs.setString(1, empId);
                        cs.setString(2, inputArray);                       
                        return cs;
                    }
                }, sqlParameterList);


The above post is one of the ways to use oracle.sql.ARRAY in your JdbcTemplate code.

Saturday, February 13, 2010

Basics of Smart Cards

A Smart Card also known as an Integrated Circuit Card (ICC) consists of an embedded microprocessor. Smart cards are generally made of plastic with a small gold plate which is visible on one side. The microprocessor is embedded under this gold plate. A smart card differs from normal Magnetic Stripe cards where in it processes the inputs received and then produces the output respectively. The other advantage is that smart cards are more secure as compared to Magnetic Stripe cards where in the data stored on the magnetic card can be read easily whereas smart cards provide extra security features.

Typical smart card specifications available in the market today are as follows:

  • RAM: 4Kb to 8Kb
  • EEPROM: 32Kb to 64Kb
  • Microprocessor: 8-bit

Smart Cards are mainly used in applications that need high confidentiality of information. Smart cards are more reliable than Magnetic Stripe Cards and can store plenty of information.

The communication with smart cards takes place with a hardware device known as Smart Card Reader. There are basically two modes in which a smart card can communicate with the reader namely:

  • Contact-based:
    In this method, the smart card is inserted into the reader and the gold plate makes contact with the interpreter device inside the reader. The card is removed from the reader once the user has finished his/her operations.
  • Contact-less:
    In this method, the reader and the card communicate with the help of an antenna. You need to get the card closer to the reader and the card will start communicating with the reader.

Cards with dual mode of operations are available wherein you can use the same card with contact-based readers as well as contact less readers.

Saturday, December 15, 2007

My First Blog

Hello This is my first blog.

Google Search