It turned out I have to teach more than Java to the new guy

I wasn’t expecting this

Although we hired this new guy – A senior programmer – to help with my workload, I didn’t expect I have to look after him. We have more senior employees such as my supervisor in the company and I thought they would be more suitable to look after the new guy. However, all of them are too busy recently and I have to look after the new guy.

It is not easy for me because I am not the chatty kind of person

I don’t want to have a guy sitting there doing nothing, just because he is not familiar with our tech stack. I gave him some Java project example and asked him to write some code. Of course those are not real work. In the mean while, I am obligated to tell him about our company background, what do we do, our industry. It’s not exciting stuff because we the legacy code have more than 10 years history. I hope the new guy won’t be scared off and quit.

Am I working system analyst stuff?

As mentioned in last post, one of the senior guy left company and I picked up all of his work. Many of his work are manual report from sql and I wish all of them could be machine generated. Human labour is expensive and I want to serve everything cold, pre-made like a sandwich from convenient store. I checked those reports and some could be written as a program and be arranged in schedule, it is just that they have to be correct – exactly as human executed sql result. We have to particularly careful about decimal number because most of the reports is about bill, aka money. In the end, I am going to solve problem in our company by making suitable software with understanding of our internal systems.

Unit testing is needed

I have confidence in my work but I don’t have that in the work of the new guy because he shown ignorance and lacks passion. I would require him to perform unit testing.

I have to teach a senior programmer Java?

We’ve gotten a new hire today

We hired a senior programmer to replace a employee who resigned last month, it turned out he does not have the tech profile we need. We focus heavily on Java but this guy is a Web Developer according to himself. My boss request me to take care of him and I wonder how? I introduced him to our colleagues and have lunch with them together, in the mean while I tried to understand his profile because my boss didn’t invite me to the interview of this senior programmer.

He is a web developer and has a question mark on his face

I asked him for a brief summary of his technology profile and he replied: html/css/javascript/”Experienced with Java” ( whatever that means.. ) . I sat next to him and want to have a rough idea of his level. I asked him about Eclipse and Java, he keep saying he only has experience with Java in the university and he graduated like 3 years ago, since then he develop website and I don’t know how much he could do.

It’s beyond my imagination

I have never expected my boss to hire a guy who does not have working experience with Java and I wonder whether I have to teach him, because we use Java here and not javascript, Verdammt! Do I have to teach him what is MVC and data modeling? I am thinking whether I should give him an assignment which require him to write some looping in order to check that he really knows programming.

I have stomach ache in the afternoon because of my increased responsibility. I am not in a role with require management of staff, I am not saying I can interact with human, actually I chat with my colleague regularly about daily stuff, but I am not teaching them about programming.

 

If I have a choice

I would fire him because it is obviously a mistake in recruitment. It’s better to deal with it earlier than later. But I am not in the position to suggest such thing. I have reflected this issue with my boss and he would decide.

I hate the guys who created Python 3, now I want Java again

There has been several months of difficult time and I haven’t blogged. I did some development but there is no point talking about it because I want to start from scratch with Java.

I hate Python 3 and everything that come with it

I am the average Joe developer and certainly I am not those who lead technology advance. I hate the guys who created Python 3 and decided it should be incompatible with everything of Python 2 because it leads to so many buys and difficulties in development. They said we should ditch Python 2 but most Linux distribution come preinstalled with Python 2 as “the Python”. Also python has a Pip which also comes with Pip 2 and Pip 3, with Pip 2 being the default one.

Now I just want to write program, do development instead of messing with system setting issue. Today I wasted at least one hour configuring PyCharm Professional with virtualenv. I don’t know what is the problem and I don’t want to waste time on it.

It could be the package “mecab-python3” used some default setting of Python 2 and crashed? I don’t know. I have already configured the system with default Python 3 and Pip 3 but it still happens.

I installed PyCharm Professional ( Trial ) because I don’t want to fiddle with command line anymore

During all the time with this “project”, I code with command line “Flask” and notepad++. But I fed up with it because every time I make a code change, I have to kill the running Flask server with Ctrl+Z and run “Python app.py” again. Ideally, I wish there is an IDE environment which behave like Eclipse of Java. Eclipse support Tomcat and I could bundle Spring project with it and the configuration is so simple. I just press the green arrow button “Run”. Coding, Testing in the same windows.

Now this command line won’t even work

Because I haven’t touch the code for a while, somehow it didn’t work as before. Did I make a fresh install of my PC? I don’t remember it. It should have work as expected but it does not work.

There should be a way to do development so that you close the IDE today, so it still works 100 days later after you click the funny icon which launch the IDE.

I made a simple program and at least 15 actual person said thank you

It’s been a while since the last post because of life and my project has been on a pause. But this post is not about the project but a simple program I made for my own good.

I am learning German language and one of the greatest difficulties is that German verb has conjugation ( verbs changes its’ form under different tenses ) and I think it would be very helpful to have a full list of all six conjugations of some common verbs. I have a list of 100 most important verbs which I got from internet ( there are plenty of those list ) and an online conjugator service ( http://conjugator.reverso.net/ ). You could enter the infinitive form of a verb in the website and it returns all forms of it.

Screenshot of Reverso Conjugation

However, I don’t want to lookup every words because that require 100 and more lookups. I asked about alternative to it online at Reddit subreddit /r/German but people suggest Duolingo and Memrise, which I don’t like. I much prefer a full list in an excel format so I could browse at it whenever I need. But obviously the website would not provide this kind of list, because otherwise no one would need their service anymore once we get the list.

In short, I made the program and ran it with 100 most important German verbs and use Selenium to look up the conjugations for me on Reverso Conjugation. I post the result excel on reddit, and I received 233 upvotes ( Greatest amount of upvote I have received in Reddit ) and received 15 actual “Thank you” in comment section.

Screenshot of my post at Reddit

To be honest, I know I am not the brilliant kind of developer, and probably are mediocre but at least I know how to program and those program are much more than simple Hello World. I usually refuse to work on project unless I am motivated ( either by money, aka in Office, or I need that program ). I am keen on automation, scripting, web scraping. Full stack programming is not my strength and I don’t familiar with the latest technology, but I produce VALUE.

The excel I made with a Java program. It is beautiful and very useful.

More on the Java program it self. It is a normal java program with the help of Selenium and JSoup. I have to use Selenium because the website Reverso Conjugation is not a static website and it generate its content dynamically with javascript. So I have to use Selenium to pretend that an actual person use a real browser to lookup thing, and copy the source code of generated webpage. After I get the source code, I break it apart with JSoup and look for what I need. I know for each tense, the content are being stored under an html tag with class “.blue-box-wrap”, so I take everything from there.

“Chrome is being controlled by automated test software.”That’s it for today!

Project progress – something I don’t like to do

 

I have been holding off development of my web application because I have to tinker with security between frontend and backend.

When I add certificate, it gives me difficulties even in testing environment and I don’t like to mess with openssl certification and stuff. In a production environment you would have to buy a real certification which costs a yearly fee. I could make a self-signed certificate in my testing environment but it would make big scary warning even in chrome.

I am working on it, the first thing I have to make the warning in Postman disappear and let me conduct testing on my REST api again.

I have to maintain the software I wrote 8 years ago

There is no keywords or meaning in this post, I only write it for reflection.

I am working with the same company which I worked for 8 years ago, despite I left it 2 years in between. Recently, I was told the GM want to abandon using WebSphere as a j2EE container and want to estimate the effort to move the application to a freeware.

8 years ago I wrote that simple Java Servlet application and they decided to use a fully fledged WebSphere server as a container. I thought it was overpowering for such a simple task but who was I to say no when management had decided to dump money to IBM just for security in mind? It was a simple application which display a pdf mobile phone bill upon any request.

Well, it replaced HP’s solution

The web application was intended as a contingency/backup for HP’s solution, it turned out that HP’s software had performance problem and they couldn’t fix it. My web application became the regular player on the field. It work as intended for 8 years.

Being an experienced programmer

Although it is a simple application that TomCat could easily power, but we still have to go through everything formally. That mean drafting a fallback plan and a deployment plan and probably parallel run.

This is the burden of being an experienced programmer. If I have been younger, sure I would want to boot it up with tomcat right away, but it’s now, not 8 years ago. Management loves it when you say you have a plan, and a fallback plan.

Project process – Things got into shape, and I finally know to appreciate REST APIs

Language Translator from IBM Cloud

Language Translator

The project has finally gotten into shape! Last time I wrote that I wanted to include a translation by google translate in my web application, it turned out Google charge quite a bit for the Google Translate API, so I turned for other free service and found Language Translator from IBM Cloud. It allows free translator of 1,000,000 characters per month and is enough for development purpose.

latest screenshot of the web application

Product Layout

Now this web application is divided into four sections ( excluding the button ):

Left-Top section: Source text provided by user

Middle Top section: A tokenized version of the source text by part-of-speech. Access by a REST API written with Flask.

Rightmost section: A list of words translated by a free Japanese-English dictionary JMdict.

Lower section: A large textarea which hold the translation result by IBM Cloud Language Translator.

Product Functions

  • Tokenize Japanese text according to its part-of-speech, which are estimate by MeCab
  • If mouse over a tokenized word, the tooltip would show part-of-speech
  • Provide dictionary result of the words
  • Provide real translation by translation service

 

Now I am not going to make it prettier just for the sake of it. I have to ready the production environment and how to ship it. Also I have to wrap my REST API with HTTPs and make sure no one could access it except my server.

To be honest, the Language Translator API sucks

IBM Cloud provided four ways to access its Language Translator, they are: curl, Node, Java and Python. Ideally I would have chosen the Python way to access it. However, it requires Visual C++ Framework 14.0 and I would have to download Gigabytes of data just to install the Visual Studio Community 2017 which contains Visual C++ compiler. To be honest, I hate Microsoft stuff with passion because of the horrible experience with coding Visual Basic.

Since it is a Python project, I don’t want to mix it with Java or NodeJS. The last option is an ugly Curl API like this:

curl --user apikey:{apikey_value} --request POST --header "Content-Type: application/json" --data "{\"text\": [\"Hello, world!\", \"How are you?\"], \"model_id\":\"en-es\"}" https://gateway.watsonplatform.net/language-translator/api/v3/translate?version=2018-05-01

It has to use slashes ( ‘\’ ) to escape the double quotes ( ” ) in order to send a JSON over curl data. And in order to use this in a Python Program, not only do I have to Use Python Subprocess to call external program “curl”, I have to escape the slashes one more time with a double slash ( \\\ )

“curl –user apikey:XXXXXXXXXXXXXXXXXXXXXXXXXXXX –request POST –header \”Content-Type: application/json; charset=UTF-8\” –data \”{\\\”text\\\”:[\\\”” + text +”\\\”],\\\”model_id\\\”:\\\”ja-en\\\”}\” \”https://gateway-syd.watsonplatform.net/language-translator/api/v3/translate?version=2018-05-01\””

 

Man this is ugly, but it comes with free service. Now I finally understand why REST API is a thing. You don’t need to install anything, you just send a request over HTTP and it magically return something to you!

Project progress – Added access to dictionary and new problem

Screenshot at the prototype

What were done:

  • I have added usage of JMdict in my website. JMDict is an opensource Japanese-English dictionary.
  • Functionality to tokenize Japanese text, copy the text and paste the result to the original “right” box.
  • Added an extra column to the far-right which shows some words definitions, with help of JMdict.

What I want to do:

  •  Make the dictionary translation more accurate
  • Add an extra area down there which provide a translation result using Google Translate API.

Problem:

Since I am not familiar with frontend/html/css stuff, I don’t know how to fit an extra box in that area because that area was occupied already although it looks empty. The column in the far right is in the same flex group with the other two box, since it need extra height to display stuff, the whole flex box stretched and occupied the empty space below.

 

 

Project progress – How to synchronize two development machines

Sample screenshot, the result has a space inserted between words

 

Screenshot of the Backend API when it was called.

I have some progress on the project but I have delayed because of 1) busy work, 2) The incessant rain in July and August, 3) I don’t want to manually synchronize two copies on my notebook and my home machine, which are on different OS.

I figured out how to use React and put some UI on the web page. Now there is a button which would call a HTTP REST API , take the input from left textarea, that put the result to the right textarea.

Problem: Perform development on two separate machine ( Windows and Linux ), without the need to manually copy and compile program

Thoughts:
– [Done] First, put Frontend code on dropbox, because it’s just html/js with library of React, semantic UI
– [Problem solved] There might be problem with backend because it’s development used Windows python/virtualenv, Pip, and Flask

– [Done] I am going to put it on github and sync it with git push and git pull
– Also I want to set a Git Hook which trigger a git pull from my other machine. Since it involve embedding a username password, I would do it later.

A small step for a man – overcoming Java Generics

Source Code of ArrayList.java

I did it finally. There was one part of Java in which I had never get over and that was Generics, the major feature of Java 5. The syntax was complicated and hard to understand the bunch of mysterious keyword E K N T V S ?. There is total 23 pages in the original Java tutorial of Generics and it proves that it is complicated.

I hate the long and mind boggling tutorial with a lot of jargons ( type parameter, parameterized type, upper bound lower bound, wildcard, type erasure, etc ), but I love ArrayList, which is a generic class. I used it almost everyday in place of the simple Array. I like the many convenient methods provided by ArrayList, such as add(int index,
E element)
,addAll(Collection<? extends E> c)contains(Object o)get(int index),indexOf(Object o),isEmpty(), remove(int index),removeAll(Collection<?> c)sort(Comparator<? super E> c)

I ran across a blog article titled ” Destroying the most common fear – “Generics?! It’s too hard for me!”” on Linkedin. The author tried to simplified the tutorial although it didn’t help much because of the nature of Generics. I read on anyway and write his example in Eclipse and see which works.

Actually I always know the rough idea of Generics, because I know I could put anything in an ArrayList, when I declare them with the correct type like ArrayList<String>, ArrayList<Integer>. It’s the same class and it achieves different purpose because of polymorphism.

Made up class called Bobby

Off my head there are few things I could do with Generics maybe container. There is a box and I don’t know what would be put inside, but I only want to know how many are in there, how do I take one item out, actually I don’t even need to know what would be put inside. That’s basically Java Collection! But Java has already done that.

Java 8 API documentation

Let’s call it a day.