Side note: JP Morgan about Bitcoin

All

Although J.P. Morgan had criticized a lot on the past, I think they changed their minds, indeed.

In fact they created their own digital token: JPM Coin –  and it seems it has some real life utilization. Some of the digital coins projects I see lack exactly that, the real life utilization, although have good intentions.

An important fact the common user of crypto cannot use their currency, but only large investors.

CNBC new article here

The press release from JPM Morgan here.

Update: looks like now the coin is called Onyx and they now have other digital coin solutions.

Creating a Chrome Extension

All

Intro

Finally, I think I had an idea for an interesting chrome extension indeed.

Creating a Chrome extension

Following the tutorial it is simple to follow.

Hint: DO NOT download everything already built. Instead, build yourself, it’s quite useful and please, do some mods also.  It’s not difficult.

My extension

So my extension will help to get selected sentences and find them on google.  Pretty nice, I’ll integrate it with some python scripts I have.

That would be cool. For now, it’s pretty basic.

REFs

[1] https://developer.chrome.com/extensions/getstarted

 

JSP custom tag

All

Intro

Similar to ASP, which uses C#, JSP is the one with uses Java behind. To deploy those applications we need a servlet container, like Apache Tomcat or JBoss EAP – Undertow. JSP dynamic web content, as XML. Together.

Deploy

We need a servlet container so in this case, we can use Jetty for the demonstration. Eclipse Jetty is a Java HTTP (Web) server and Java Servlet container, I will talk more about it on another post.

JSP Custom TAG

One of the most interesting features in my opinion about JSP, which is a nice feature btw, is the possibility to create custom tags HTML based on the HTML rules – ofc. Just follow the template below with the attributes you need.

    TEMPLATE FOR HTML 4

<?xml version=”1.0″ encoding=”UTF-8″ ?>

<!DOCTYPE taglib
PUBLIC “-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN”
http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd”&gt;

<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>name</short-name>
<uri>/put_your_uri</uri>
<display-name>x</display-name>
<description>JSP Tag library for CPS application </description>
<tag>
<name>your_tag_name</name>
<tag-class>your_tag</tag-class>
<body-content>JSP</body-content>
<display-name> Any content</display-name>
<description>Example</description>
<attribute>

</attribute>

JSP Html 4 vs Html 5

Jsp will validate the HTML version on the begin of the page. Please use plain simple JavaScript in case you need validation.

 

JSP Specification

We can see the specification here

REFs

[1] https://download.oracle.com/otn-pub/jcp/jsp-2.2-mrel-oth-JSpec/jsp-2_2-mrel-spec.pdf?AuthParam=1549126534_f78333269b1bd20bab4bfcb8700cd010

Timber

All

Intro

Non-SQL is very useful and I’m a huge fan of MongoDB but relational database is not that bad!

While searching here and there, I came up with this very interesting thing called Timber, it merges tree structure properties with relational databases.

Summary: Timber is a native it is based on the TAX tree algebra supports updates.

XML Database?

Timber is this XML management database, where the data is storage directly and as such, the tree structure is preserved.

 

XQuery

fds fds

conf.Xml

More details on implementation can be found here

REFs

[1] http://dbgroup.eecs.umich.edu/timber/

log4j

All

Intro

One log framework to rule them all.

log4j

log4j is a reliable, fast and flexible logging framework (APIs) written in Java.

pom.xml

<dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency>

Main components [1]

  • loggers: Responsible for capturing logging information.
  • appenders: Responsible for publishing logging information to various preferred destinations.
  • layouts: Responsible for formatting logging information in different styles.

 

Example

//logs an error message with parameter
	logger.error("This is error : " + parameter);
	
	//logs an exception thrown from somewhere
	logger.error("This is error", exception);

REFs

[1] https://www.tutorialspoint.com/log4j/log4j_overview.htm

 

 

Desktop Automation – Autokey

All

If you need to write several emails a day/messages irc’s, Autokey is certainly a nice tool to have. I got addicted to using it even on fb messages now!

One just needs to add a new phrase, add the content, and add the abbreviation and it is done.

In my case, I also need to reset the autokey for each new entry.

After that, I just write the abbreviation + space, that the value is replaced by the content. As described in the video below:

Gatling

All

Intro

During API development it’s very interesting/required to test the application in terms of response time for different loads. I’m using gatling for some tests here and it’s quite neat.

Apache JMeter

JMeter I’ll do a post about it later – which is not a browser, btw. I don’t know why they highlight this on the web site.

Loadrunner

Loadrunner, which Thread-based architecture, is actually from a company called Micro Focus – not opensource in fact!.

Gatling

It’s a tool to test loads since it’s based on messages, tests based on Scala – yup, not java or javascript. It overwrites the JVM limitations, therefore, so we can make much more accesses.

It uses to test http basically and the records the GUI.

Executing a performance test straight from the console.

It does not monitor back-end monitoring, as resources monitoring, like htop on the server.

 

 Class HttpSimulation1 extends Simulation {

  /* Place for arbitrary Scala code that is to be executed before the simulation begins. */

  before {

      println(“***** My simulation is about to begin! *****”)

  }

  /* Place for arbitrary Scala code that is to be executed after the simulation has ended. */

  after {

      println(“***** My simulation has ended! ******”)

  } 

  /*

   * A HTTP protocol builder is used to specify common properties of request(s) to be sent,

   * for instance the base URL, HTTP headers that are to be enclosed with all requests etc.

   */

  val theHttpProtocolBuilder = http

      .baseURL(http://computer-database.gatling.io&#8221;)

   /*

   * A scenario consists of one or more requests. For instance logging into a e-commerce

   * website, placing an order and then logging out.

   * One simulation can contain many scenarios.

   */

  /* Scenario1 is a name that describes the scenario. */

  val theScenarioBuilder = scenario(“Scenario1”)

      .exec(

          /* myRequest1 is a name that describes the request. */

          http(“myRequest1”)

              .get(“/”)

       )

  /*

   * Define the load simulation.

   * Here we can specify how many users we want to simulate, if the number of users is to increase

   * gradually or if all the simulated users are to start sending requests at once etc.

   * We also specify the HTTP protocol builder to be used by the load simulation

   */

  setUp(

      theScenarioBuilder.inject(atOnceUsers(1))

  ).protocols(theHttpProtocolBuilder)

}

Code from Krizsan, found here

REFs

 

Undertow [pt2]

All

Intro

Ok, quick stuff, just reading about Undertow, I didn’t know it was so flexible actually.

Undertow two way to do it:

Way 1

There is basically two way to use undertow, and in fact,  I already made a post about the first way here, the idea is simple: use the Builder API after we create the handler we want as in here. The listener on the example is created for the port 8080, i.e. bind to localhost.

The builder will default values for performance-related stuff, as a number of threads and buffers.

public class HelloWorldServer {

    public static void main(final String[] args) {
        Undertow server = Undertow.builder()                                                    //Undertow builder
                .addHttpListener(8080, "localhost")                                             //Listener binding
                .setHandler(new HttpHandler() {                                                 //Default Handler
                    @Override
                    public void handleRequest(final HttpServerExchange exchange) throws Exception {
                        exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");  //Response Headers
                        exchange.getResponseSender().send("Hello World");                       //Response Sender
                    }
                }).build();
        server.start();
    }

}

Way 2

Otherwise, the second way to do stuff is by manually assembling stuff to create a server.

The main steps are described here:

  1. Create an XNIO Worker. This worker manages both the IO and Worker threads for the server.
  2. Create an XNIO SSL instance (optional, only required if HTTPS is in use)
  3. Create an instance of the relevant Undertow listener class
  4. Open a server socket using XNIO and set its accept listener

 

 

REFs

http://undertow.io/