Debit Cards are perfect plastic. Debit card fraud can be sophisticated or old types. Thieves use techniques including:
Hacking: When you bank or shop on public Wi-Fi networks, hackers can use keylogging software to capture everything
you type, including your name, debit card account number and PIN.
Phishing: Emails can look like they’re from legitimate sources but actually be from scammers. If you click on an
embedded link and enter your personal information, that data can go straight to criminals.
Skimming: Identity thieves can retrieve account data from your card’s magnetic strip using a device called a skimmer,
which they can stash in ATMs and store card readers. They can then use that data to produce counterfeit cards.
EMV chip cards, which are replacing magnetic strip cards, can reduce this risk.
Spying: Plain old spying is still going strong. Criminals can plant cameras near ATMs or simply look over your shoulder
as you take out your card and enter your PIN. They can also pretend to be good Samaritans, offering to help you remove
a stuck card from an ATM slot.
Fraudsters either steal your physical card by pick-pocketing, distraction thefts or Clone your card by Skimming.
Social media has all details full names, birthdays, addressess, parent's name and even pets name. Fraudsters befriend you
and get answer of bank's security question. So keep your privacy settings checked. Using stolen, discarded, fake documents
open an account in someone's name. Then request changes to the account or ask for a new card to be issued.
Card stolen in transit between card issuer and card holder.
Getting card details from contact less cards.
Thursday, December 27, 2018
Card Frauds
Payment Processing via Payment Gateway
A Payment Gateway is a service that authenticate & process the payment between customer and merchant.
The payment process is as below:
1) Buyer selects the product, clicks on BUY Button in Desktop/Mobile initiating the payment from the merchant's
website where user info is collected.
2) This info is sent to the Payment Gateway / Payment Aggregator.
3) Payment Aggregator collects card info in a secure server and passes this through its Acquiring Bank
(Payment aggregator's bank) to the Card networks like VISA, MasterCard, American Express etc.
4) The Card Network checks with the Issuing bank (Customer Bank) whether the transaction can be authenticated or not.
If Yes, the 3DS URL is sent to the customer where he fills all the details for Authentication.
5) If Authenticated successfully, Consumer a/c or card is debited by the Issuing bank.
6) Issuer bank sends confirmation to the card network.
7) This is further notified to the Acquiring bank and then to the payment aggregator.
8) Payment aggregator now send a confirmation to the Merchant, who further informs the consumer.
9) The consumer also gets notified by his bank (Issuing bank) about the transaction.
Payment Gateway Examples in India are: PAYU, RAZORPAY, CCAVENUE, TRAK N PAY, Citrus Pay, HDFC BANK PAYMENT GATEWAY, PayPal, AmazonPayments, BillDesk etc.
Authentication vs Authorization
Authentication:
Authentication is about validating your credentials like User Name/User ID and password to verify your identity.
The system determines whether you are what you say you are using your credentials. In public and private networks,
the system authenticates the user identity via login passwords. Authentication is usually done by a username and
password, and sometimes in conjunction with factors of authentication, which refers to the various ways to be
authenticated. Authentication factors determine the various elements the system use to verify one’s identity prior
to granting him access to anything from accessing a file to requesting a bank transaction.
Sending Users to 3DS page is Authentication.
Types of Authentication:
Single-Factor Authentication – Simplest authentication method which relies on a simple password to grant user access
to a website or a network. UserName and Password.
Two-Factor Authentication – It is a two-step verification process which not only requires a username and password, but
also something only the user knows, to ensure an additional level of security, such as an ATM pin, which only the user
knows. OTP too is an added level of security. This also comes under multi-factor authentication. ATM Card and PIN.
Static Question and Answers after successful login/password.
Multi-Factor Authentication – Most advanced method of authentication which uses two or more levels of security from
independent categories of authentication to grant user access to the system. All the factors should be independent of
each other to eliminate any vulnerability in the system. Financial organizations, banks, and law enforcement agencies use
multiple-factor authentication to safeguard their data and applications from potential threats. UserName and Password and
OTP. UserName, Password, Biometrics (fingerprint or thumbprint, palm, handprint, retina, iris, voice and face), RSA SecurID/Token.
Sometimes it sends some basic question with answers in registered mobile and once user clicks the answer then only login is allowed.
Also Personal Identity Verification (PIV) Card is like smart card given to employees, citizens. A smart card is a physical card that
has an embedded integrated chip that acts as a security token. Captcha/Basic maths questions/Picture puzzle along with UserName/Password.
Authorization:
Authorization occurs after your identity is successfully authenticated by the system, which ultimately gives you full permission to
access the resources such as information, files, databases, funds, locations, almost anything. Authorization determines what user can
and cannot access. Once your identity is verified by the system after successful authentication, you are then authorized to access the
resources of the system like Debiting Card. Authorization comes only after successful authentication.
Other examples of Authentication:
One of the most common methods of detecting a user’s location is via Internet Protocol (IP) addresses. For instance, suppose that
you use a service which has Geolocation security checks. When you configure your account, you might say that you live in the
United States. If someone tries to log in to your account from an IP address located in Germany, the service will probably notify
you saying that a login attempt was made from a location different than yours. That is extremely useful to protect your account
against hackers. IP addresses, however, are not the only information that can be used for the somewhere you are factor. It is
also possible to use Media Access Control (MAC) addresses. An organization might set up its network so only specific computers
can be used to log in (based on MAC addresses). If an employee is trying to access the network from a different computer, the
access will be denied. An example, Monzo Bank Ltd., a mobile-only bank based in the United Kingdom, uses Geolocation to detect
possible payment frauds. If your last known location was, say, in France and then four minutes later your card is used in Japan,
that could be an indication that you are not in the same location as your card.
Windows 8 users might know about a feature called Picture Password. This feature allows the user to set up gestures and touches on
a picture as a way to authenticate themselves. Even HDFC netbanking login asks you to touch picture password apart from login/password.
Wednesday, November 21, 2018
Memory Leak in Java
Memory Leak Creation in Java
Memory leak happens when memory can't be claimed by GC as some areas are unreachable from JVM's garbage collector,
such as memory allocated through native methods. It gets worse over time. Below are samples of memory leak creation.
1) Create Static field holding object reference esp final fields.
class MemorableClass {
static final ArrayList list = new ArrayList(100);
}
2) Calling String.intern() on lengthy String.
String str=readString(); //Read lengthy string any source db,textbox/jsp etc..
str.intern(); //This will place the string in memory pool from which you can't remove.
Ex:
public class StringLeaker {
private final String smallString;
public StringLeaker() {
String veryLongString = "We hold these truths to be self-evident...";
this.smallString = veryLongString.substring(0, 1); //The substring maintains a reference to internal char[] representation of the original string.
}
}
Because the substring refers to the internal representation of the original, very long string, the original stays in memory.
Thus, as long as you have a StringLeaker in play, you have the whole original string in memory.
Worse:
this.smallString = veryLongString.substring(0, 1).intern(); //Both will be in memory even after Class is discarded.
Want to avoid this, use this:
this.smallString = new String(veryLongString.substring(0, 1));
3) Unclosed open streams (file, network etc...)
try {
BufferedReader br = new BufferedReader(new FileReader(inputFile));
...
...
} catch (Exception e) {
e.printStacktrace();
}
AND
public class Main {
public static void main(String args[]) {
Socket s = new Socket(InetAddress.getByName("google.com"),80);
s=null; //at this point, because you didn't close the socket properly, you have a leak of a native descriptor, which uses memory.
}
}
4) Unclosed connections. However Closeable is introduced recently.
try {
Connection conn = ConnectionFactory.getConnection();
...
...
} catch (Exception e) {
e.printStacktrace();
}
5) Incorrect or inappropriate JVM options, such as the "noclassgc" option prevents unused class garbage collection.
6) Creating, but not starting, a Thread. Creating a thread inherits the ContextClassLoader and AccessControlContext,
plus the ThreadGroup and any InheritedThreadLocal, all those references are potential leaks, along with the entire class
loaded by the classloader and all static references. Such threads get added to ThreadGroup. It increases the unstarted
thread count, also ThreadGroup can't destroy unstarted threads.
7) Calling ThreadGroup.destroy() when the ThreadGroup has no threads itself, but it still keeps child ThreadGroups.
A bad leak that will prevent the ThreadGroup to remove from its parent.
8) Keep growing a Queue, without clearing...
Thursday, August 30, 2018
Ubuntu System Hardware Details
Know Ubuntu System Hardware details:
OS Details:
uname -a
Linux stg-wib-app32 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
RAM Memory Details:
free -m
total used free shared buffers cached
Mem: 32175 18520 13655 0 248 4840
-/+ buffers/cache: 13430 18745
Swap: 32765 64 32701
Core and CPU:
lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 2
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 79
Stepping: 1
CPU MHz: 2097.570
BogoMIPS: 4195.14
Hypervisor vendor: VMware
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 40960K
NUMA node0 CPU(s): 0-7
Processor Details:
cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel(R) Xeon(R) CPU E5-2683 v4 @ 2.10GHz
stepping : 1
microcode : 0xb00002a
cpu MHz : 2097.570
cache size : 40960 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 20
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ida arat epb pln pts dtherm fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt
bugs :
bogomips : 4195.14
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel(R) Xeon(R) CPU E5-2683 v4 @ 2.10GHz
stepping : 1
microcode : 0xb00002a
cpu MHz : 2097.570
cache size : 40960 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 4
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 20
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ida arat epb pln pts dtherm fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt
bugs :
bogomips : 4195.14
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
power management:
processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel(R) Xeon(R) CPU E5-2683 v4 @ 2.10GHz
stepping : 1
microcode : 0xb00002a
cpu MHz : 2097.570
cache size : 40960 KB
physical id : 0
siblings : 4
core id : 2
cpu cores : 4
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 20
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ida arat epb pln pts dtherm fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt
bugs :
bogomips : 4195.14
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
power management:
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel(R) Xeon(R) CPU E5-2683 v4 @ 2.10GHz
stepping : 1
microcode : 0xb00002a
cpu MHz : 2097.570
cache size : 40960 KB
physical id : 0
siblings : 4
core id : 3
cpu cores : 4
apicid : 3
initial apicid : 3
fpu : yes
fpu_exception : yes
cpuid level : 20
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ida arat epb pln pts dtherm fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt
bugs :
bogomips : 4195.14
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
power management:
processor : 4
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel(R) Xeon(R) CPU E5-2683 v4 @ 2.10GHz
stepping : 1
microcode : 0xb00002a
cpu MHz : 2097.570
cache size : 40960 KB
physical id : 1
siblings : 4
core id : 0
cpu cores : 4
apicid : 4
initial apicid : 4
fpu : yes
fpu_exception : yes
cpuid level : 20
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ida arat epb pln pts dtherm fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt
bugs :
bogomips : 4195.14
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
power management:
processor : 5
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel(R) Xeon(R) CPU E5-2683 v4 @ 2.10GHz
stepping : 1
microcode : 0xb00002a
cpu MHz : 2097.570
cache size : 40960 KB
physical id : 1
siblings : 4
core id : 1
cpu cores : 4
apicid : 5
initial apicid : 5
fpu : yes
fpu_exception : yes
cpuid level : 20
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ida arat epb pln pts dtherm fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt
bugs :
bogomips : 4195.14
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
power management:
processor : 6
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel(R) Xeon(R) CPU E5-2683 v4 @ 2.10GHz
stepping : 1
microcode : 0xb00002a
cpu MHz : 2097.570
cache size : 40960 KB
physical id : 1
siblings : 4
core id : 2
cpu cores : 4
apicid : 6
initial apicid : 6
fpu : yes
fpu_exception : yes
cpuid level : 20
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ida arat epb pln pts dtherm fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt
bugs :
bogomips : 4195.14
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
power management:
processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel(R) Xeon(R) CPU E5-2683 v4 @ 2.10GHz
stepping : 1
microcode : 0xb00002a
cpu MHz : 2097.570
cache size : 40960 KB
physical id : 1
siblings : 4
core id : 3
cpu cores : 4
apicid : 7
initial apicid : 7
fpu : yes
fpu_exception : yes
cpuid level : 20
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ida arat epb pln pts dtherm fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx smap xsaveopt
bugs :
bogomips : 4195.14
clflush size : 64
cache_alignment : 64
address sizes : 42 bits physical, 48 bits virtual
power management:
Thursday, July 26, 2018
Add 1 to Big Number
//This given code will add value "1" to a number represented as String to accomodate the huge number (can be 100/1000 digits).
package ssl;
public class AddOneToNumber {
public static void main(String[] args) {
System.out.println(getMeAddedValue("9"));
System.out.println(getMeAddedValue("23"));
System.out.println(getMeAddedValue("49"));
System.out.println(getMeAddedValue("99"));
System.out.println(getMeAddedValue("9999"));
System.out.println(getMeAddedValue("789"));
System.out.println(getMeAddedValue("78999999999999999999999999999999"));
}
public static String getMeAddedValue(String str){
boolean flag=true;
int zeroCount = 0;
int i=str.length();
while(flag){
int num = Integer.parseInt(str.substring(i-1, i));
if(num+1 < 10) {
str = str.substring(0, i-1) + (num+1);
break;
}
else{
i--;
zeroCount++;
if(zeroCount==str.length()){
str = "1";
break;
}
}
}
if(zeroCount>0){
for(int k=0; k < zeroCount; k++)
str=str+"0";
}
return str;
}
}
//Output:
10
24
50
100
10000
790
79000000000000000000000000000000
Wednesday, July 4, 2018
Choose JVM / Java Version in Ubuntu
Choose JVM Version while running an application in Ubuntu.
Assumption: There are multiple JVM versions installed in system and for few processes we want JDK1.7, for few we want JDK1.8.
Ubunut$ update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 auto mode
1 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
2 /usr/lib/jvm/jdk1.8.0_161/bin/java 1 manual mode
3 /usr/lib/jvm/jdk1.7.0_160/bin/java 1 manual mode
Press <enter> to keep the current choice[*], or type selection number: 3 Press Enter (For using JDK1.7)
Wednesday, June 20, 2018
ISO 8583 Message Fields
ISO 8583 Message Fields:
<IsoDataField No="0" length="4" name="MESSAGE TYPE INDICATOR" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="1" length="16" name="BIT MAP" class="org.jpos.iso.IFA_BITMAP"/>
<IsoDataField No="2" length="19" name="SECRET_ID/PAN" class="org.jpos.iso.IFA_LLNUM"/>
<IsoDataField No="3" length="6" name="PROCESSING CODE" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="4" length="12" name="AMOUNT, TRANSACTION" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="5" length="12" name="AMOUNT, SETTLEMENT" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="6" length="12" name="AMOUNT, CARDHOLDER BILLING" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="7" length="10" name="TRANSMISSION DATE AND TIME" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="8" length="8" name="AMOUNT, CARDHOLDER BILLING FEE" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="9" length="8" name="CONVERSION RATE, SETTLEMENT" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="10" length="8" name="CONVERSION RATE, CARDHOLDER BILLING" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="11" length="6" name="SYSTEM TRACE AUDIT NUMBER" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="12" length="6" name="TIME, LOCAL TRANSACTION" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="13" length="4" name="DATE, LOCAL TRANSACTION" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="14" length="4" name="DATE, EXPIRATION" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="15" length="4" name="DATE, SETTLEMENT" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="16" length="4" name="DATE, CONVERSION" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="17" length="4" name="DATE, CAPTURE" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="18" length="4" name="MERCHANTS TYPE" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="19" length="3" name="ACQUIRING INSTITUTION COUNTRY CODE" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="20" length="3" name="PAN EXTENDED COUNTRY CODE" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="21" length="3" name="FORWARDING INSTITUTION COUNTRY CODE" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="22" length="3" name="POINT OF SERVICE ENTRY MODE" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="23" length="3" name="CARD SEQUENCE NUMBER" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="24" length="3" name="NETWORK INTERNATIONAL IDENTIFIEER" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="25" length="2" name="POINT OF SERVICE CONDITION CODE" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="26" length="2" name="POINT OF SERVICE PIN CAPTURE CODE" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="27" length="1" name="AUTHORIZATION IDENTIFICATION RESP LEN" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="28" length="9" name="AMOUNT, TRANSACTION FEE" class="org.jpos.iso.IFA_AMOUNT"/>
<IsoDataField No="29" length="9" name="AMOUNT, SETTLEMENT FEE" class="org.jpos.iso.IFA_AMOUNT"/>
<IsoDataField No="30" length="9" name="AMOUNT, TRANSACTION PROCESSING FEE" class="org.jpos.iso.IFA_AMOUNT"/>
<IsoDataField No="31" length="9" name="AMOUNT, SETTLEMENT PROCESSING FEE" class="org.jpos.iso.IFA_AMOUNT"/>
<IsoDataField No="32" length="11" name="ACQUIRING INSTITUTION IDENT CODE" class="org.jpos.iso.IFA_LLNUM"/>
<IsoDataField No="33" length="11" name="FORWARDING INSTITUTION IDENT CODE" class="org.jpos.iso.IFA_LLNUM"/>
<IsoDataField No="34" length="28" name="PAN EXTENDED" class="org.jpos.iso.IFA_LLCHAR"/>
<IsoDataField No="35" length="37" name="TRACK 2 DATA" class="org.jpos.iso.IFA_LLNUM"/>
<IsoDataField No="36" length="104" name="TRACK 3 DATA" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="37" length="12" name="RETRIEVAL REFERENCE NUMBER" class="org.jpos.iso.IF_CHAR"/>
<IsoDataField No="38" length="6" name="AUTHORIZATION IDENTIFICATION RESPONSE" class="org.jpos.iso.IF_CHAR"/>
<IsoDataField No="39" length="2" name="RESPONSE CODE" class="org.jpos.iso.IF_CHAR"/>
<IsoDataField No="40" length="3" name="SERVICE RESTRICTION CODE" class="org.jpos.iso.IF_CHAR"/>
<IsoDataField No="41" length="8" name="CARD ACCEPTOR TERMINAL IDENTIFICACION" class="org.jpos.iso.IF_CHAR"/>
<IsoDataField No="42" length="15" name="CARD ACCEPTOR IDENTIFICATION CODE" class="org.jpos.iso.IF_CHAR"/>
<IsoDataField No="43" length="40" name="CARD ACCEPTOR NAME/LOCATION" class="org.jpos.iso.IF_CHAR"/>
<IsoDataField No="44" length="25" name="ADITIONAL RESPONSE DATA" class="org.jpos.iso.IFA_LLCHAR"/>
<IsoDataField No="45" length="76" name="TRACK 1 DATA" class="org.jpos.iso.IFA_LLCHAR"/>
<IsoDataField No="46" length="999" name="ADITIONAL DATA - ISO" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="47" length="999" name="ADITIONAL DATA - NATIONAL" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="48" length="999" name="ADITIONAL DATA - PRIVATE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="49" length="3" name="CURRENCY CODE, TRANSACTION" class="org.jpos.iso.IF_CHAR"/>
<IsoDataField No="50" length="3" name="CURRENCY CODE, SETTLEMENT" class="org.jpos.iso.IF_CHAR"/>
<IsoDataField No="51" length="3" name="CURRENCY CODE, CARDHOLDER BILLING" class="org.jpos.iso.IF_CHAR"/>
<IsoDataField No="52" length="16" name="PIN DATA" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="53" length="16" name="SECURITY RELATED CONTROL INFORMATION" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="54" length="120" name="ADDITIONAL AMOUNTS" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="55" length="999" name="RESERVED ISO" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="56" length="999" name="RESERVED ISO" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="57" length="999" name="RESERVED NATIONAL" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="58" length="999" name="RESERVED NATIONAL" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="59" length="999" name="RESERVED NATIONAL" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="60" length="999" name="RESERVED PRIVATE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="61" length="999" name="RESERVED PRIVATE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="62" length="999" name="RESERVED PRIVATE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="63" length="999" name="RESERVED PRIVATE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="64" length="8" name="MESSAGE AUTHENTICATION CODE FIELD" class="org.jpos.iso.IFA_BINARY"/>
<IsoDataField No="65" length="1" name="BITMAP, EXTENDED" class="org.jpos.iso.IFA_BINARY"/>
<IsoDataField No="66" length="1" name="SETTLEMENT CODE" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="67" length="2" name="EXTENDED PAYMENT CODE" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="68" length="3" name="RECEIVING INSTITUTION COUNTRY CODE" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="69" length="3" name="SETTLEMENT INSTITUTION COUNTRY CODE" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="70" length="3" name="NETWORK MANAGEMENT INFORMATION CODE" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="71" length="4" name="MESSAGE NUMBER" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="72" length="4" name="MESSAGE NUMBER LAST" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="73" length="6" name="DATE ACTION" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="74" length="10" name="CREDITS NUMBER" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="75" length="10" name="CREDITS REVERSAL NUMBER" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="76" length="10" name="DEBITS NUMBER" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="77" length="10" name="DEBITS REVERSAL NUMBER" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="78" length="10" name="TRANSFER NUMBER" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="79" length="10" name="TRANSFER REVERSAL NUMBER" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="80" length="10" name="INQUIRIES NUMBER" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="81" length="10" name="AUTHORIZATION NUMBER" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="82" length="12" name="CREDITS, PROCESSING FEE AMOUNT" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="83" length="12" name="CREDITS, TRANSACTION FEE AMOUNT" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="84" length="12" name="DEBITS, PROCESSING FEE AMOUNT" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="85" length="12" name="DEBITS, TRANSACTION FEE AMOUNT" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="86" length="16" name="CREDITS, AMOUNT" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="87" length="16" name="CREDITS, REVERSAL AMOUNT" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="88" length="16" name="DEBITS, AMOUNT" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="89" length="16" name="DEBITS, REVERSAL AMOUNT" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="90" length="42" name="ORIGINAL DATA ELEMENTS" class="org.jpos.iso.IFA_NUMERIC"/>
<IsoDataField No="91" length="1" name="FILE UPDATE CODE" class="org.jpos.iso.IF_CHAR"/>
<IsoDataField No="92" length="2" name="FILE SECURITY CODE" class="org.jpos.iso.IF_CHAR"/>
<IsoDataField No="93" length="6" name="RESPONSE INDICATOR" class="org.jpos.iso.IF_CHAR"/>
<IsoDataField No="94" length="7" name="SERVICE INDICATOR" class="org.jpos.iso.IF_CHAR"/>
<IsoDataField No="95" length="42" name="REPLACEMENT AMOUNTS" class="org.jpos.iso.IF_CHAR"/>
<IsoDataField No="96" length="16" name="MESSAGE SECURITY CODE" class="org.jpos.iso.IFA_BINARY"/>
<IsoDataField No="97" length="17" name="AMOUNT, NET SETTLEMENT" class="org.jpos.iso.IFA_AMOUNT"/>
<IsoDataField No="98" length="25" name="PAYEE" class="org.jpos.iso.IF_CHAR"/>
<IsoDataField No="99" length="11" name="SETTLEMENT INSTITUTION IDENT CODE" class="org.jpos.iso.IFA_LLNUM"/>
<IsoDataField No="100" length="11" name="RECEIVING INSTITUTION IDENT CODE" class="org.jpos.iso.IFA_LLNUM"/>
<IsoDataField No="101" length="17" name="FILE NAME" class="org.jpos.iso.IFA_LLCHAR"/>
<IsoDataField No="102" length="28" name="FROM ACCOUNT" class="org.jpos.iso.IFA_LLCHAR"/>
<IsoDataField No="103" length="10" name="ACCOUNT IDENTIFICATION 2" class="org.jpos.iso.IFA_LLCHAR"/>
<IsoDataField No="104" length="100" name="TRANSACTION DESCRIPTION" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="105" length="999" name="RESERVED ISO USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="106" length="999" name="RESERVED ISO USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="107" length="999" name="RESERVED ISO USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="108" length="999" name="RESERVED ISO USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="109" length="999" name="RESERVED ISO USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="110" length="999" name="RESERVED ISO USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="111" length="999" name="RESERVED ISO USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="112" length="999" name="RESERVED NATIONAL USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="113" length="999" name="RESERVED NATIONAL USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="114" length="999" name="RESERVED NATIONAL USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="115" length="999" name="RESERVED NATIONAL USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="116" length="999" name="RESERVED NATIONAL USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="117" length="999" name="RESERVED NATIONAL USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="118" length="999" name="RESERVED NATIONAL USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="119" length="999" name="RESERVED NATIONAL USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="120" length="999" name="RESERVED PRIVATE USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="121" length="999" name="RESERVED PRIVATE USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="122" length="999" name="RESERVED PRIVATE USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="123" length="999" name="RESERVED PRIVATE USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="124" length="999" name="RESERVED PRIVATE USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="125" length="999" name="RESERVED PRIVATE USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="126" length="999" name="RESERVED PRIVATE USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="127" length="999" name="RESERVED PRIVATE USE" class="org.jpos.iso.IFA_LLLCHAR"/>
<IsoDataField No="128" length="8" name="MAC 2" class="org.jpos.iso.IFA_BINARY"/>
Wednesday, April 18, 2018
Socket Programming in Java
Socket Programming in Java:
Steps:
1) Run the Server program.
2) Run the Client program.
3) Type anything on Client to Send. Type type Over to exit.
//Socket for Server
package socket;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
public class SocketServer {
public static void main(String[] args) throws IOException {
ServerSocket server = new ServerSocket(1101); //Server makes a new Socket to communicate with the client and starts Listening.
System.out.println("Server started.");
Socket sk = server.accept(); //accept() method blocks(just sits) until a client connects to the server.
System.out.println("Client connected to Server Socket.");
//Takes input from the client socket
InputStream is = sk.getInputStream();
DataInputStream dis = new DataInputStream(new BufferedInputStream(is));
//DataInputStream dis = new DataInputStream(is); //This will also work. BufferedInputStream is not required here.
//String line = dis.readLine(); //readLine() displays some junk too
String line = dis.readUTF(); //No junk
System.out.println("Server received: "+line);
//Reads message from client until "Over" is sent.
while (!line.equals("Over")) {
try {
line = dis.readUTF();
System.out.println("Server Received: "+line);
}
catch(IOException ioe) {
ioe.printStackTrace();
}
}
//Close connection
sk.close();
dis.close();
}
}
//Socket for Client
package socket;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
public class SocketClient {
public static void main(String[] args) throws IOException {
Socket sk = new Socket("127.0.0.1", 1101); //If wrong config: java.net.ConnectException: Connection refused
System.out.println("Client got connected to Server.");
String msg = "Hello Socket";
DataOutputStream out = new DataOutputStream(sk.getOutputStream());
out.writeUTF(msg); //Sends out to the socket
out.flush(); //This says, I have no more data.
System.out.println("Client Sent: "+msg);
String line="";
DataInputStream dis = new DataInputStream(System.in);
while (!line.equals("Over")) {
try {
line = dis.readLine();
out.writeUTF(line);
System.out.println("Client Sent: "+line);
}
catch(IOException i) {
i.printStackTrace();
}
}
try {
out.close();
sk.close();
} catch(IOException i) {
System.out.println(i);
i.printStackTrace();
}
}
}
NOTE:
Run Server, Run Client--> Works fine.
Run Server, Run Multiple Clients..... --> type messages in all clients, Server will receive msges from first Connected Client Only.
Server will ignore other clients than the first connected clients. This shows Socket is one-to-one connectivity only.
Thursday, April 5, 2018
BlockingQueue Example Producer Consumer Basic
import java.util.LinkedList;
import java.util.Queue;
public class ProducerConsumer {
static Queue queue = new LinkedList();
static int capacity=3;
public static void main(String[] args) {
final Worker work = new Worker();
Thread t1 = new Thread(new Runnable(){
public void run(){
try {
work.produce();
} catch (Exception e) {
e.printStackTrace();
}
}
});
Thread t2 = new Thread(new Runnable(){
public void run(){
try {
work.consume();
} catch (Exception e) {
e.printStackTrace();
}
}
});
t1.start();
t2.start();
}
static class Worker {
int number=0;
public void produce() throws Exception {
while(true){
synchronized(this){
while(queue.size()==capacity){
System.out.println("Waiting to get Removed...");
wait();
}
number++;
queue.add(number);
System.out.println("Added: "+number);
notifyAll();
Thread.sleep(500);
}
}
}
public void consume() throws Exception {
while(true){
synchronized(this){
while(queue.isEmpty()){
System.out.println("Waiting to get Added...");
wait();
}
Object t = queue.remove();
System.out.println("Removed: "+t);
notifyAll();
Thread.sleep(500);
}
}
}
}
}
//Output
Added: 1
Added: 2
Added: 3
Removed: 1
Added: 4
Waiting to get Removed...
Removed: 2
Removed: 3
Removed: 4
Waiting to get Added...
Added: 5
Added: 6
Removed: 5
Removed: 6
Waiting to get Added...
Added: 7
Tuesday, March 6, 2018
String replace issue in JDK 1.7 and 1.8
Dear Reader,
Recently we have noticed when we do String.replace API call in Java, the replacement doesn't behave the same way
strings having multiple zeroes. Example if we want to replace "aa" with "Z" and String is "aa bb aaa", replaced
String will be "Z bb Za". However if we want replacement to happen only when exact word is met: use \\baa\\b.
This \\b works as Word boundary, however the same logic does not work in below program.
Plz refer screenshot.
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class ReplaceString {
public static void main(String[] args) {
Map <String, String> map = new HashMap<String, String>();
map.put("#{TxnAmount} == 200000","1.0");
map.put("#{TxnAmount} == 2000000","0.0");
Iterator it = map.keySet().iterator();
String expression ="#{TxnAmount} == 200000 || #{TxnAmount} == 2000000";
while (it.hasNext()) {
String key = (String) it.next();
String value = (String) map.get(key);
System.out.println("Key: "+key);
expression = expression.replace(key, value);
}
System.out.println("1. Final expression: "+expression);
map.clear();
map.put("#{TxnAmount} == 300000","1.0");
map.put("#{TxnAmount} == 3000000","0.0");
it = map.keySet().iterator();
expression ="#{TxnAmount} == 300000 || #{TxnAmount} == 3000000";
while (it.hasNext()) {
String key = (String) it.next();
String value = (String) map.get(key);
System.out.println("Key: "+key);
expression = expression.replace(key, value);
}
System.out.println("2. Final expression: "+expression);
}
}
Saturday, February 3, 2018
Java setup in Windows as ZIP not exe
Want to download ZIP version of JDK ??????
Sorry Oracle has stopped creating this. But we can manage without that.
Here are the steps:
1) Create a directory where you want to keep JDK1.8 (assume we need JDK 1.8).
2) Download "JDK 1.8" from Oracle site. You will get an exe file like mine "jdk-8u72-windows-x64.exe".
3) Copy the downloaded exe in newly created directory.
4) Unzip the exe using 7-zip software. This will create a "toolz.zip: directory in the same new directory "E:\JDK1.8".
5) Run the below big command:
E:\Java1.8> for /r %x in (*.pack) do .\bin\unpack200 -r "%x" "%~dx%~px%~nx.jar"
6) Done now. Need to Verify the setup.
7) Go inside the new JDK directory in windows "JDK1.8/bin".
8) Run below 2 commands:
javac -version
java -version
If these shows 1.8. Our zip set up is done. Now setup JAVA_HOME, path and enjoy....
Wednesday, January 31, 2018
Oracle Concurrent connections limit
The number of sessions/concurrent connections the database (oracle) was configured to allow:
SELECT name, value FROM v$parameter WHERE name = 'sessions';
The number of sessions currently active:
SELECT COUNT(*) FROM v$session;
Complete Query:
SELECT
'Currently, '
|| (SELECT COUNT(*) FROM V$SESSION)
|| ' out of '
|| VP.VALUE
|| ' connections are used.' AS DATA
FROM
V$PARAMETER VP
WHERE VP.NAME = 'sessions';
OUTPUT:
DATA
Currently, 93 out of 172 connections are used.
Resource Name and Connections:
select resource_name, current_utilization, max_utilization, limit_value from v$resource_limit where resource_name in ('sessions', 'processes');
Want to increase the concurrent connections/sessions, open init.ora file inside oracle setup and increase "processes, cursor_limit and sessions".
However this change require Oracle Restart.
Friday, January 12, 2018
GIT commands
GIT commands help:
List of Branches:
git branch -a
* master //* means current branch in your local system
remotes/origin/HEAD -> origin/master
remotes/origin/master
Create a branch:
git branch NEW_BRANCH_LOCALLY
List of branches again:
git branch -a
NEW_BRANCH_LOCALLY
* master //* means current branch in your local system
remotes/origin/HEAD -> origin/master
remotes/origin/master
Rename a GIT branch (Locally and Remotely):
git branch -m old_branch new_branch # Rename branch locally.
git push origin :old_branch # Delete the old branch from remote.
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote.
Delete a Branch in GIT:
git branch -d THE_LOCAL_BRANCH (Delete local branch).
git push origin :THE_REMOTE_BRANCH (Delete Remote branch).
or
git push origin --delete THE_REMOTE_BRANCH
Sync your Local branches with Remote (Update):
git fetch -p
git fetch THE_REMOTE_BRANCH
Switch branch in local system:
git checkout THE_LOCAL_BRANCH
Switched to branch 'THE_LOCAL_BRANCH'
Commit to a branch in GIT remote:
git push -u origin 2B_BLOB
git push origin 2B_BLOB
Commit changes to master branch in GIT remote:
git push -u origin master
Create new branch in GIT remote:
git remote add 2B_BLOB
Merge Request:
git merge THE_REMOTE_BRANCH/master
Add changes:
git add * or FILE_NAME
Commit:
git commit -m "Message"
Status:
git status
Subscribe to:
Posts (Atom)