Simple CRUD using Servlet 3.0, Redis/Jedis and CDI – Part 2

In this post we will focus on CDI and Servlet 3.0. You can see part 1 here. Let’s start with CDI. When I started writing the post that originated this serie, I was not thinking in writing about CDI. To be sincere I’ve never used that before. The idea of the post was to create a crud using jedis and servlets. But when I was writing the application I simply hated the idea to instantiate the beans. Read On →

Simple CRUD using Servlet 3.0, Redis/Jedis and CDI - Part 1

In this post we will build a simple user crud. The data will be stored in Redis. To interact with Redis we will use Jedis library. CDI for Depedency Injection and Servlet 3.0 for the view. Let’s start with the Redis/Jedis part. You can find some overview on Redis and Jedis in these posts. Let’s start with the User class, we can see that below: public class User { private String firstName; private String lastName; private String email; private String gender; private long id; } Now let’s define the keys we will use to store the user information on Redis. Read On →

Using Redis Hash with Jedis

Redis Hashes are maps between string fields and string values, so they are the perfect data type to represent objects (eg: A User with a number of fields like name, surname, age, and so forth) That is the definition we have on redis documentation. So, lets start with a simple user class that could be seen below: public class User { private String username; private String email; private String password; private String firstName; private String lastName; } Using Jedis we are able to store an object of this class in Redis, let’s see an example: Read On →

Using Sorted Sets with Jedis API

Sorted Sets and Jedis In the previous post we started looking into Jedis API a Java Redis Client. In this post we will look into the Sorted Set(zsets). Sorted Set works like a Set in the way it doesn’t allow duplicated values. The big difference is that in Sorted Set each element has a score in order to keep the elements sorted. We can see some commands below: import java.util.HashMap; import java. Read On →

Getting Started With Jedis

Hi, These days I started looking into Redis. I’ve heard a lot about it so I decided to have a try. Redis is defined in its websites as “an open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets”. We can find very good examples on where Redis is a good fit on the Shades of Gray blog. Read On →

Objetos e classes em javascript

Olá Pessoal, Este é o meu primeiro screencast e estarei falando um pouco a respeito de criação de classes e objetos com javascript. Por se tratar do primeiro, então temos muitos pontos a melhorar :), por isso sugestões são muito bem vindas para que possamos melhorar os próximos screencasts. Segue o vídeo abaixo: [vimeo w=400&h=300] Objetos e classes com javascript from Francisco Junior on Vimeo.

Batch Insert with JDBC

Hi, In the current project I’m working on, we had a requirement to import some data from an Excel Spreadsheet and import them into the database. So, bascially we need to read from the spreadsheet and insert into the database. Initally we started using single insert statements, but we realized that wouldn’t be a good choice, for performance reasons. If we have a spreadsheet with too much data, we could decrease the database performance with so many single statements executed. Read On →

Private variables in javascript

In OOP we learned the importance of the encapsulation. In java we could encapsulate a variable through the keyword private, that says that variable is visible only in that object. In javascript we don’t have a specific keyword like that, but there are different ways to accomplish this behavior. In this post I’ll talk about two ways of doing that: 1- Declaring function scoped variables using var: Let’s say we have an contructor function called User, and this function defines that an user object will have the following properties: Read On →

Playing with classes and objects in Javascript

So, let’s play a little bit with classes and objects in Javascript. If you come from the class based languages like Java and C++, the way we handle classes in javascript looks a little bit strange. First, javascript is not class based, so, it doesn’t have the entity class. A class in javascript is a function. So we can see a simple class in the example below: MyClass = function(){ }; var instance = new MyClass(); So, to create a new class in javascript we only need to define a new function. Read On →

Dicas para conseguir o primeiro emprego em desenvolvimento de software

Eu não sou um super especialista nesse assunto, mas aqui vão dicas que no meu ponto de vista me ajudaram a conseguir meu primeiro estágio, além de outras dicas que teriam me ajudado se soubesse na época ;) Basicamente a lista se resume a um ponto: Ganhe experiência com trabalho voluntário Muitas das vagas de estágio pedem candidatos com experiência. Mas aí você se pergunta,_ “se é um estágio por que pedem experiência? Read On →