33 Cool Things for Your Room

How nice would it be if you could come home from a long day of work to a beautiful and comfortable bedroom? Make your room pretty without being an expert interior designer! It only takes a few cool bedroom accessories to make your room pretty! I compiled this list of cool things you might want...

The post 33 Cool Things for Your Room appeared first on .

The Challenge of Economic Prioritization

The challenge of economic prioritization with WSJF.

On the surface, the foundations of job sequencing in considering the Weighted Shortest Job First (WSJF) prioritization schema seem logical. Do the smallest job with the greatest cost of delay first to deliver the greatest economic benefit. Though, in practice, it can be much more challenging. To survive and thrive in the post-digital economy, organizations need to change how they produce products, interact with customers, and define and prioritize work. To succeed in each of these areas requires a significant shift in organizational behavior, including how leaders interact with their peers.

But, how did we get here? 

Hazelcast + Kibana: Best Buddies for Exploring and Visualizing Data

A lot, if not all, of data science projects, require some data visualization front-end to display the results for humans to analyze. Python seems to boast the most potent libraries, but do not lose hope if you're a Java developer (or if you're proficient in another language as well). In this post, I will describe how you can benefit from such a data visualization front-end without writing a single line of code.

The Use Case: Changes From Wikipedia

I infer that you are already familiar with Wikipedia. If you are not, Wikipedia is an online encyclopedia curated by the community. In their own words:

SRE vs. SWE: Similarities and Differences

SRE and SWE: These acronyms are only a letter apart, and they refer to similar roles within the realm of software development and management. However, SREs and SWEs are distinct types of jobs, even if the tools and skill sets associated with them overlap to a certain degree.

What is an SRE, what is an SWE, and how are SRE and SWE roles similar and different? Keep reading to find out.

Analyzing Scans in PostgreSQL

Analysizing Scans in PostgreSQL

Introduction and Data Setup

Before we dive in, it is vital to understand the basic elementary blocks of PostgreSQL query plans. This has been covered in a separate blog post, and I highly encourage readers to go through it first.

There are several node types in PostgreSQL query plans,

Is Monolith Dead?

Monolith architecture has been very successful in shaping the software world the way we see it today. However, the last few years have seen a sharp decline in its adoption, especially with the advent of Microservices. The popularity of microservices was caused by the need for scalability and changeability which in turn is caused by the penetration of IT in almost every entity, animate or inanimate. Modern applications see no boundary when it comes to scaling and these applications are fond of change and this is where Monolith doesn’t fit at all.

Microservices, at least in theory, is “The Silver Bullet” that will solve all the problems and will serve humankind till eternity, but it doesn’t happen. Microservices bring lots of challenges that were nonexistent earlier. Still, what it does, it does it beautifully and efficiently and most importantly serves the purpose.

Dynamic Styling in Vue.js

When I started using Vue.js as a front-end framework I immediately enjoyed the easy way I can set up and manage my components. Using single file components let me focus on all aspects regarding the way I build them: I simply need to put 3 tags inside a .vue file and I can start shaping both the visual aspect and all the logic behind the component itself. Talking about styling, the first thing that the official doc tells you is how to style a component: simply insert a style tag (usually at the end of the file) and you're done. 

But when you move on and start to build complex interfaces, you immediately need to perform styling that goes beyond the simple composition of CSS classes. So, during my journey, I discovered several ways to perform dynamic styling, and this article aims to be a short reference for people that come up at first with this need.
In order to show you the different techniques, I'll use a super-simple button component that must use a specific background color value if a boolean prop is true (ok maybe is too simple, but so you'll grasp the concepts quickly).
Let's start with the component code:

You only need ONE design pattern

Let me tell you a secret; Design patterns are the natural consequences of programming idioms and paradigms that are so inferior that it's impossible to create working code without them. Design patterns are like wheel chairs, they're trying to fix that which is already broken. A piece of advice, if you can of course, try to rather avoid getting into a wheel chair in the first place (read; Use OOP that is) - Than to run to the wheel chair arguably the same way junior software developers are running to OOP these days ...

A really great programming language doesn't need design patterns in fact. This is true to the extent of that I once saw a super senior developer going through all the original 23 design patterns from the Gang of Four, and proved how 19 of them made absolutely no sense what so ever for Lisp, which we all know is a far superior programming language than any "modern" programming languages of course (duh!)

How can I pass an options value parameter to doPost?

I have a program that displays a list of vaccines and for each vaccine listed in the table, you can edit them. When I click on edit for the specified vaccine, one of the values allowed to be modified is the number of doses required, which can be changed from a drop down list. I'm having trouble being able to pass that value selected to the doPost method, as when I try changing, it goes back to the main page and shows the value for doses required as null. How can I fix this?

Here's the main vaccine list servlet:

package vaccineList.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import NewVaccine.servlet.NewVaccine;
import NewDose.servlet.NewDose;

//import cs3220.model.GuestBookEntry;
//import cs3220.utilities.*;

@WebServlet(urlPatterns = "/ListVaccine", loadOnStartup = 1)
public class ListVaccine extends HttpServlet {

    private static final long serialVersionUID = 1L;

    public ListVaccine()
    {
        super();
    }

    public void init( ServletConfig config ) throws ServletException
    {
        super.init( config );

        List<VaccineEntry> entries = new ArrayList<VaccineEntry>();
        entries.add( new VaccineEntry( "Pfizer/BioNTech", "2", "21", "10000", "10000" ) );
        entries.add( new VaccineEntry( "Johnson&Johnson", "1", "0", "5000", "5000"  ) );

        getServletContext().setAttribute( ServletFunctions.VaccineEntries, entries );
    }

    @SuppressWarnings("unchecked")
    protected void doGet( HttpServletRequest request,
        HttpServletResponse response ) throws ServletException, IOException
    {
        StringBuilder html = new StringBuilder();
        List<VaccineEntry> entries = ServletFunctions.getVaccineEntriesFromServletContext(getServletContext());

        response.setContentType( "text/html" );
        PrintWriter out = response.getWriter();

        html.append( "<p>List Vaccine</p>" );

        html.append( "<p><a href='NewVaccine'>New Vaccine</a> |" );
        html.append( "<a href='NewDose'> New Dose</a></p>" );

        html.append("<table border='1'>");

        html.append("<tr>");
        html.append( "<td>   " + " <b>Vaccine</b>   </td>" );
        html.append( "<td>" + " <b>Doses Required</b></td>" );
        html.append( "<td>" + " <b>Days Between Doses</b></td>" );
        html.append( "<td>" + " <b>Total Doses Recieved</b></td>" );
        html.append( "<td>" + " <b>Total Doses Left</b></td>" );
        html.append("<td></td>" );
        html.append( "</tr>" );

        for( VaccineEntry entry : entries )
        {

            html.append("<tr>");
            html.append( "<td>" + entry.getName() + "</td>" );
            html.append( "<td>" + entry.getDosesReq() + "</td>" );
            if(entry.getDaysBtwnDoses() == "0") {
                html.append( "<td></td>" );
            }
            else
                html.append( "<td>" + entry.getDaysBtwnDoses() + "</td>" );


            html.append( "<td>" + entry.getTotalDosesRecieved() + "</td>" );
            html.append( "<td>" + entry.getTotalDosesLeft() + "</td>" );


            html.append( "<td><a href='editVaccine?id=" + entry.getId() + "&dosesReq=" + entry.getDosesReq() + "'>Edit</a></td>"  );


            html.append( "</td>" );
            html.append( "</tr>" );
        }
        html.append( "</table>" );



        out.println( ServletFunctions.titleWithBody("ListVaccine", html.toString()) );
    }

}

and here's the edit vaccine page:

package EditVaccine.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import vaccineList.servlet.*;


@WebServlet("/editVaccine")
public class editVaccine extends HttpServlet {
    private static final long serialVersionUID = 1L;


    public editVaccine() {
        super();

    }

    @SuppressWarnings("unchecked")
    private VaccineEntry getEntry( int id )
    {
        List<VaccineEntry> entries = (List<VaccineEntry>) getServletContext()
            .getAttribute( "entries" );
        System.out.println("entry taken is " + id);


        for( VaccineEntry entry : entries )
            if( entry.getId() == id ) return entry;
        return null;
    }


    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        StringBuilder html = new StringBuilder();

        String id = request.getParameter( "id" );
        String dosesReq = request.getParameter("dosesReq");
        VaccineEntry entry = getEntry(Integer.parseInt(id));
        System.out.println("The value of id is " + id);
        System.out.println("The value of dosesReq is " + dosesReq);


        System.out.println("The value of getEntry is " + entry.getId());

        response.setContentType( "text/html" );
        PrintWriter out = response.getWriter();

        html.append("<form action='editVaccine' method='post'>" );
        html.append("<table border='1' cellpadding='2'>");
        html.append("<tr>" + "<th colspan='2'>Name</th>");
        html.append("<input type='hidden' value='" + id + "' name='id' id='id' />");
        html.append("<input type='hidden' value='" + dosesReq + "' name='dosesReq' id='dosesReq' />");
        html.append("<td><input type='text' name='name' value=" + entry.getName() + "></input></td>" + "</tr>");
        html.append("<tr><th colspan='2'>Doses Required</th>" + "<td><select id='dosesReq' name='dosesReq' " + "'>"); 
        html.append("<option value='1'" + "'>1</option>");
        html.append("<option value='2'" + "'>2</option>");
        html.append("<option value='3'" + "'>3</option>");
        html.append("</select></td>");
        html.append("<tr><th colspan='2'>Days Between Doses</th><td><input type='text' name= 'DaysBtwnDoses' value='" + entry.getDaysBtwnDoses() + "'> </input></td></tr>");
        html.append("<td colspan = '2'><button>Save</button></td>");
        html.append("</form>");
        html.append("</table>");


        out.println( ServletFunctions.titleWithBody("ListVaccine", html.toString()) );

       String[] dropDown = request.getParameterValues("dosesReq");
       System.out.println("dropdown:" + dropDown);

    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


        VaccineEntry entry = getEntry(Integer.parseInt(request.getParameter("id")));

        entry.setName(request.getParameter("name"));
        entry.setDosesReq(request.getParameter("dosesReq"));
        String name = entry.getName();
        System.out.println("name is " + name);
        entry.setDosesReq(request.getParameter("dosage"));
        String dosage = entry.getDosesReq();
        System.out.println("dosage is " + dosage);
        entry.setDaysBtwnDoses(request.getParameter("DaysBtwnDoses"));
        String DaysBtwnDoses = entry.getDaysBtwnDoses();
        System.out.println("DaysBtwnDoses is " + DaysBtwnDoses);

        response.sendRedirect("ListVaccine");
        return;

    }

}

MDC Logging With MuleSoft Runtime 4.4

MDC stands for Mapped Diagnostic Context. Mapped Diagnostic Context enriched the logs by providing more information about the event in the logs. By default, Mule logs two entries: processor which shows the location of current events, events which shows the correlation Id of the event.

Mule Runtime 4.4 introduced Tracing module and enables you to add more information to the logs by by adding, removing, and clearing variables from the logging context for a given Mule event.