Alex Ardoin

Ranch Hand
+ Follow
since Apr 26, 2015
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alex Ardoin


I have a smart card which I am trying to read its card number. At the side of the chip, the card has the following:

   1. Control body
   2. Surname
   3. Given names
   4a. Date of issue
   4b. Date of expiry
   4c. Issuing authority
   4d. Civil registeration number
   5b Card number
   8. Postal address od the control body

At the other side I have the following:

   1  Control Institute XY
   4a 10.02.2015      4b 10.02.2018   //here both infos are in one line.
   4c example Inc
   5b 14644945165164916564  // I want to read this info also `5b`
   8  adress 80 postnumber 230

At the momant I am getting the following with my APDUCommand --> `6d00`

How can I get the card number?


6 years ago

I have app <--> Connector1 <--> Connector2 <---> Client application as in the image below. In the Connector1Test I am sending the packet to the connector2 after reading it from `receiveBuffer` in the connector1.
In connector2 I am getting the whole  InputStream  of the `appBufferedInputStream` --> `[1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0]` and not just `[2, 0, 0, 0, 0, 0, 0, 0]` as what I am sending in the `Connector1`.
How can I manage it to get the second packet as  the following `[2, 0, 0, 0, 0, 0, 0, 0]` in the connector2?
Notice: In the connector2 I am reading from the 0 index `, 0, data.length))`, otherwise I the second packet in the

Connector1Test logs:

   2017-06-20 15:29:37 INFO  Connector1Test:36 - Connector1Test of Construction of  socket
   2017-06-20 15:29:44 INFO  Connector1Test:49 - readBytes: 9
   2017-06-20 15:29:44 INFO  Connector1Test:79 - receiveBuffer.compact(): [1, 0, 0, 0, 1, 0, 0, 0, 1]
   2017-06-20 15:29:44 INFO  Connector1Test:49 - readBytes: 8
   2017-06-20 15:29:44 INFO  Connector1Test:79 - receiveBuffer.compact(): [2, 0, 0, 0, 0, 0, 0, 0]

Connector2Test logs:

   2017-06-20 15:50:22 INFO  Connector2Server:35 - Connector2Server has been started !
   2017-06-20 15:52:30 INFO  Connector2Server:48 - [1, 0, 0, 0, 1, 0, 0, 0, 1]
   2017-06-20 15:52:31 INFO  Connector2Server:48 - [1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0]



Code sinpet
when I add the following line `data = null;` inside the connector2Test

while ((nRead =, 0, data.length)) != -1) {
buffer.write(data, 0, nRead);
byte[] byteArray = buffer.toByteArray();;
data = null;



   Exception in thread "main" Connection reset by peer: socket write error
    at Method)

7 years ago

As Dave Tolls has mentioned it is part of the smartcardio API. I had CardException for example if the card reader is not connected to the laptop but for example if the smart card is defekt I need to detect this case and handle it by sending message of type 07 to the Android app.
7 years ago
I have implemented Andoid app - server side application. The connection between the both works with TCP socket. When the user touches the button
in the Android app, a connenction is being built to the server to get the user authenticated.  Thereafter, the server communicates with the smart card reader. The exchanged messages between the app
and server have the following format:

<type> 0x00 0x00 0x00 <length> 0x00 0x00 0x00 [<data>]

if the message has the type value `06` that means error in the smart card reader.
if the message has the type value `07` that means error in the smart card.

I am using code like below for the communication with the smart card reader:

The smartcardio has the `CardException` class for exception. My problem I do not know when to send the message of type `06` or `07` because I can not
differentiate where the error happens when the CardException is thrown. how can I manage that?

I appreciate any help
7 years ago
I am using GlassFish server in Eclipse and  trying to intergerate the `hibernate-release-5.1.0.Final` into the JSF project. I have tried several steps but without seccuss.

- I have Placed the Hibernate Jars inside the GlassFisch directrory `glassfish4\bin` and restarted the server.
-   I placed them inside the following foloder `glassfish4\glassfish\bin` and restarted the GlassFisch server.
- I placed the Hibernate jars inside the WEB-INF/lib
- I added this part `.addResource("/resources/person.hbm.xml")` to the `CreatePersonDemo` class.
- I replaced the `jboss-logging.jar` inside the `glassfish4\glassfish\modules` directory with `jboss-logging-3.3.0.Final.jar`








Project structure

7 years ago

I was asked in an interview about the core api of the Java EE? Also  the most important api in thr Java EE?
I said servlet, (maybe woth  JSP and EJB).
Which apis is the core of the Java ee? What would you say?


in my welcome.xhtml page I have two forms `age-form and error-form`. The `error-form` is without navigation rules which works fine (I created it to find the error in the  age-form) and the other `age-form` is with 3 nagivation cases and it does not work. So when I enter age of zero, the `MyExceptionHandler-->Handler()` is being called but the iterator is empty and does not have a next item as in the screen shoot underneath. I want to invoke my error.xhtml page when I enter a value of `0` in `age-form` in the `welcome.xhtml` but I do not really know what else do I have to do to get it to work as in the error-form?

I appreciate any help.








screen shoot when calling the MyExceptionHandler by the error-form

Iterator is empty

screen shoot when calling the MyExceptionHandler by the age-form
Iterator is not empty
7 years ago
I had an interview yesterday and I was given an exercise to solve.

The exercise was to implement a programm to find all anagram words in some file.txt document and output them in the console.




xyz zyx
aaab aaba abaa

b) another question in the interview was, how would your programm deal with a sample.txt file with 20 Million or 100 Billion of words? And how would you scale your programm if you want to cover this case?
I think if I had a file with a lot of data (billion of lines) I can not  hold all of them in RAM and that is a very difficult task in itself.

If I I want to cover this case I have to use some database to store the sorted words  and then query the database with MySQL.

I just want to hear your opinion to the b part?

I appreciate any help.


7 years ago

I have TrackingService component to track the location of the buses in my city based on Crowdsourcing. In the TrackingService class I have variable `pLong, pLat` to stored the latitude and longitude when they are calaculated in the `onLocatiochChanged()`. The TrackingService is operating in the background, then the data is transmitted to the server. I have an Map Activity to display the location of the buses, the user selected in the MainActivity( as Filter).

The background TrackingService is started in the MainActivity when the app launches.

I am trying to pass the `pLat, pLong` from the `onLocationChanged()` to the `Map` activity when the `onLocationChanged()`is being invoked to display the user's current location beside the bus's locations with the aid of BroadcastReceiver.

I have debugged my code and facing problem that I am getting `0.0` for the values `lat, lng` in the BroadcastReiceiver in the `map` activity also the `bReceiver` is being invoked.

How can I get it to work to retrieve the lat and lng vlaues in the BroadcastReceiver `bReceiver`?

I appreciate any help.

TrackingService class

Map activity


8 years ago

I have a checkboxlist where the user can select some routes then a reponse is being getting from the server. I have method gotoLocation to upadte the location of the markers as well to add a new marker in the map when a new one is being inserted into the table on the serverside with the same route.

I am using HashMap with the table id as a key and the marker as value also in my case the key is unique.

The Updating part works fine but I am facing problem with the adding part. So after the user selectes the desired routes, they are being added to the map as marker and to the HashMap as elements but the problem occures when I insert a new one with the same route and different key (id is being incremented by one in the table) into the table then the adding part is being entered and the id of the new added one is being recognized but the new marker is not being added on the map but to the HashMap markerMap.

Additionally when the new Response reaches the method again I noticed that the last added marker with the new id is not in the HashMap and it just contains the elements of the first request also when the request is over and the new added element stays in the HashMap for the request Life! is there any explanation for this behaviour and how can I fix it?

I appreciate any help.

8 years ago
I mean how should the app knows what the user have selected after sending the first request to the server if I extends the GetLLRD class wih Service class?
8 years ago
I have Checkboxlist where the user can select some bus routes which I am envloping in JSON format and sending it from the inner class MyAsynTask in GetLLRD class to the server afterwardsI am getting response from the Server.

Finallay, I am sending the response to the Map activity to display the londitude, latitude, route and direcction of the routes in Google map but I need an approach to send the values of first request (of the selected item in the checkboxlist) to the Server every 30 seconds to update the location of the buses in the Map actvity repeatedly. How can I do it?

I tried to invoke new MyAsyncTask().execute(); from the handler which works for the first request since the parms[0] has a value but after that the app crashes and I am getting this error:

Caused by: java.lang.ArrayIndexOutOfBoundsException: length=0; index=0

I appreciate any help.


GetLLRD class:

8 years ago
I am trying to deserialize JSONArray which contains the following objects as:

Json array:

With Gson library I have trying the following


How can I deserilaize the JSON array with gson library?

I appreciate any help.
The 3 values are being calculate after comparing of the data of the multiple requests in the table. Therefore I have created the behaviour table.

I have achieved what I wanted by storing the result of the 3 quieries in custom ArrayList and then after delelting the records I have inserted the optimal 3 one.
I have a table "behaviour" as below and I want to achieve the following when the next stop name is differance of the last one in the table. I want to maintaine the records of the prvious stop name before inserting the new one in the case the stop's name are different.
I want to pick the records with the min distance, min speed and max speed of the previous stop name and inserting them (these 3 records) to my table after that I want to delete all records 3 id above the 3 new insetred one with some stop nam and mac . The name and mac might be anyone.

I just need some help in the mysql query how to maintain the records of the previous one after inserting the 3 records(min distance, min speed and max speed)?

I appreciate any help.