03 March 2024

Good Reads

 Since I started using goodreads for my book reviews, the blog will be even more silent.

Here is my goodreads profile: https://www.goodreads.com/user/show/76262523-ulas-ergin

26 November 2023

Book Review: Een kleine geschiedenis van Rusland


The author paid great attention to the early Rus and following Russian Empire but fails to reflect the Soviet Era which contributed greatly to modern Russia and the formation of modern Russian society and norms.

Post Soviet period is even worse. The 2008 and 2014 Russian wars were mentioned in 1 line.

The author fails to give background info and reasoning about that is going on (RU-UA) war.

If you are already informed in Russian history then this book is not for you, it is a bit light reading. 

I read this books with 2 things in mind, I know a bit  Russian history (see my previous posts under book review label ) and I am trying to learn Dutch so a Dutch language book on Russian history was an relatively easy read.

12 November 2023

Nice TV Series on NPO (in Dutch)

 


After I watched several Dutch-Language series on Netflix, I wanted to switch to something else, since the series on Netflix were mainly Drama or Comedy while I like action/adventure the most so I became a NPO Plus member and started watching crime series on NPO




Here is a list of some series that i liked:

28 July 2022

Dutch Language Movies on Neflix

 

Here are some on the Dutch Language movies that I watched during my Dutch journey.






Dutch TV Series on Netflix

 After a very long time, I decided to make one more post about the Dutch TV Series on Netflix.


I have been trying to learn Dutch for the last 2 years and I try to watch series/films in Dutch to practice.

 Unfortunately most of the Dutch series on Netflix are in drama/comedy genre while I like thrillers/action/detective. Luckily Belgian content on Netflix has more of thriller/ action kind. 

Yes, they are in Flemish with a heavy accent but still...better than nothing, toch?

Some Flemish movies have the option of Dutch subtitles.

I hope you enjoy (and benefit) my list.


03 January 2014

Java WebSocket Sample

I have not been updating this blog for some time but I was unsatisfied with my search on Java Websockets topic on the client implementation in Java and configuration so I decided to post one.

There is valuable info on several blogs and presentation slides on Java WebSockets, but generally the samples are about the implementation of server side and websocket client is implemented on html/JavaScript, I wanted a client implementation in Java.

I decided to provide a complete  sample, with  both a Java websocket server and java client together with the html/javascript one.

The sample application is a virtual USD Exchange rate publishing server and the websocket client consumes the new USD rate as it becomes available.

How to Configure:

1. For the server implementation: WebSockets standard is included in JEE7 so you app.server must be supporting JEE7.
WebSphere Liberty 8.5.5 did not run this so I went with GlasssFish 4.0 (build 89)

Just deploy the application as a war or ear file. Since annotation based approach is used no need to configure a web.xml/deployment descriptor.

2. For the Java client implementation: JSE7 does not include WebSockets so you should add necesessary jar files yourself. I used Tyrus as the websocket api implementation.

Use javax.websocket-api.jar and tyrus-standalone-client-1.3.3.jar from https://tyrus.java.net/

3. Java client should have a file named javax.websocket.ContainerProvider in MEFA-INF/services folder with the content org.glassfish.tyrus.client.ClientManager to introduce Tyrus to JSE7 environment as WebSocketContainer provider . (see ServiceLoader API for details)

4. For the html/javascript implementation: IE9 does not support websockets,IE version must be at least 10.
For Firefox and Chrome...they have been supporting websockets for a very long time so it won't be a problem.
see caniuse.com for more info on browser support.

Here is the server application


package websocket.server;

import java.text.DecimalFormat;
import java.util.*;
import java.util.concurrent.*;
import javax.websocket.*;
import javax.websocket.server.*;

@ServerEndpoint("/ratesrv")
public class CustomEndPoint {
private static Queue<Session> queue = new ConcurrentLinkedQueue<Session>();
private static Thread rateThread ;

static
{//rate publisher thread, generates a new value for USD rate every 2 seconds.
rateThread=new Thread(){
public void run() {
DecimalFormat df = new DecimalFormat("#.####");
while(true)
{
double d=2+Math.random();
if(queue!=null)
sendAll("USD Rate: "+df.format(d));
try {
sleep(2000);
} catch (InterruptedException e) {
}
}
};
} ;
rateThread.start();
}

@OnMessage
public void onMessage(Session session, String msg) {
try {
System.out.println("received msg "+msg+" from "+session.getId());
} catch (Exception e) {
e.printStackTrace();
}
}

@OnOpen
public void open(Session session) {
queue.add(session);
System.out.println("New session opened: "+session.getId());
}

@OnError
public void error(Session session, Throwable t) {
queue.remove(session);
System.err.println("Error on session "+session.getId());
}

@OnClose
public void closedConnection(Session session) {
queue.remove(session);
System.out.println("session closed: "+session.getId());
}

private static void sendAll(String msg) {
try {
/* Send updates to all open WebSocket sessions */
ArrayList<Session > closedSessions= new ArrayList<>();
for (Session session : queue) {
if(!session.isOpen())
{
System.err.println("Closed session: "+session.getId());
closedSessions.add(session);
}
else
{
session.getBasicRemote().sendText(msg);
}
}
queue.removeAll(closedSessions);
System.out.println("Sending "+msg+" to "+queue.size()+" clients");
} catch (Throwable e) {
e.printStackTrace();
}
}
}

and here is the Java WebSocket Client:

@ClientEndpoint
public class WSClient  {

  private static Object waitLock = new Object();

    @OnMessage
    public void onMessage(String message) {
       System.out.println("Received msg: "+message);        
    }

  @OnOpen
    public void onOpen(Session p) {
        try {
            p.getBasicRemote().sendText("Session established");           
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

private static void  wait4TerminateSignal()
{
synchronized(waitLock)
{
try {
waitLock.wait();
} catch (InterruptedException e) {
}
}
}

    public static void main(String[] args) {
    WebSocketContainer container=null;
    Session session=null;
try{
container = ContainerProvider.getWebSocketContainer();
//WS1 is the context-root of my web.app 
//ratesrv is the path given in the ServerEndPoint annotation on server implementation
session=container.connectToServer(WSClient.class, URI.create("ws://localhost:8080/WS1/ratesrv"));
wait4TerminateSignal();
} catch (Exception e) {
e.printStackTrace();
}
finally{
if(session!=null){
try {
session.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}

The html/javascript client is:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>WebSocket Client</title>
 <script type="text/javascript">

      var wsocket;
      
      function connect() {        
          wsocket = new WebSocket("ws://localhost:8080/WS1/ratesrv");        
          wsocket.onmessage = onMessage;          
      }
           
      function onMessage(evt) {             
         document.getElementById("rate").innerHTML=evt.data;          
      }
      
      window.addEventListener("load", connect, false);
  </script>
</head>
<body>

<table>
<tr>
<td> <label id="rateLbl">Current Rate:</label></td>
<td> <label id="rate">0</label></td>
</tr>
</table>
</body>
</html>

I hope this helps

24 October 2010

Vor- Thief (1997)

This movie was nominated as the Best Foreign Language Movie in Oscar, European Film Awards, Golden Globe and many others, see the IMDB page for all list. It has a total o 7 awards in several organizations.

It is a nice and warm movie, Sanya's father is dead, they meet a soldier on a train with her mother, romance starts between the soldier and mother and they start to live together but it appears that he is not a real soldier but a thief!

I liked this one and highly recommend.IMDB

Voditel dlya Very -A Driver for Vera (2004)


This nice movie reminded me the Turkish movies of 60s, a young soldier is assigned as a driver for a Soviet Army General in 1962 in Sevastopol, Crimea, General's daughter is physically disabled and has a hard-spoilt personality but later a romance starts between these two...

Doesn't it remind you Ayhan Isik and Belgin Doruk concept:)

it was a nice movie, I can recommend this one to everybody.

4 (2005)

I did not understand much from this movie, this might be another sample representing that i am not an arts guy:) because it has several awards
see IMDB link

06 October 2010

Sorok Pervy -The Forty-First (1956)

During Russian Civil war, a Red Army unit captures an important white officer who is believed to carry important information from Kolcak to Denikin [both are white commanders].

The only female member of the team is a sniper who has shot 40 whites already but misses this 41th but takes him prisoner...after many events a romance occurs between this two..

DVD of this movie is also sold on amazon.com and more movie info is available on IMDB and wikipedia. I personally liked this idea.