Poonam Pandey hot wallpaper3 - Top 7 reasons why Pandeys are evil little monsters

Top 7 reasons why Pandeys are evil little monsters

We all have that one Pandey friend. We are unsuspecting of them. We are naive and we don’t understand they get manufactured by factories funded by the devil himself or herself .. in case devil is a female. And to all the feminists, apologies in advance, my male privilege made me write him before her. I’m ashamed. I deserve harsh social justice punishment. BDSM style. 

K… enough chit chat. Here’s your list..

1. Chulbul Pandey

Chulbul Pandey Salman Khan police inspector Dabangg - Top 7 reasons why Pandeys are evil little monsters

Well, this guy almost got his own brother and father killed despite his “I’m homosexual so I need to act extra manly” body language. He probably killed his wife’s father too to be able to marry her. Think about it. He wouldn’t let her marry someone because there would be no one to feed him and her father conveniently dies like some kind of divine intervention. And our Pandey conveniently marries her like nothing happened?

He is corrupt. It is obvious. He talks funny but don’t you fall his absolutely charming personality. “Hum tumpe itne ched kardenge” is not a comedic dialogue. It’s him trying to establish dominance and giving us a glimpse of how evil he is. I say he is eviler than Kyser Soze on Kevin Spacey movie “The Usual Suspects”.

2. They don’t have a first name

What’s their first name anyway? No one knows. It’s a fucking 8th wonder of this swine infested world. They can hide something as basic as their own names. Think about it? What else they must be hiding from you. What deep-seated evil plans they must be hatching? They’re preying on your vulnerability. Be warned. 

3. They’re cunning

Well, this one must be obvious. On the surface these Pandeys look cute and fuzzy but if you look deeper you realize how cunning they are. And all of them. It’s like they were manufactured from some “Pandey manufactuing” factory. 

4. Poonam Pandey

Indian Express’ “I created controversies to get noticed in Bollywood”. News18’s “I used to controversies to gain limelight.” There are tons of articles and her own interviews that shows that the level of her shallowness. You might make fun of her semi-nude social media posts but it’s keeping her in limelight. Think about it? That’s pretty darn evil to me. Not as evil as one of my Pandey frenemy making his sole mission to date every Parajuli woman ever to exist but still. 

5. They are Brahmins?

Brahimins are sexist, racist, bigoted. Case closed. 

6. They’re like cats

They come to you when they need you. They purr and make you want to feed you and voila they disappear from the face of the earth. 

7. They feed on your soul

The Exorcist is every Pandey’s favorite movie. But.. the thing is they’re hinting you that they’re feeding on your soul. And they’re letting you know that they can get away with it like Mark Zukerberg can get away from being one of the lizard people. It might also be a test to see how dumb some non Pandeys can get. But those who non Pandeys who are smart enough are also not safe from thier wrath. 

What the fuck is a process?

Well, what the fuck is a program and how the fuck is it related to a process?

Before we go into what the fuck a process is, let’s try to understand what the fuck a program is first. 

A set of instructions. 

Well now, that wasn’t very clear, was it? Let’s try to kinda redefine it.. I say “A program is a set of instructions that a computer can follow to achieve a goal.” But it’s still a little jargony, isn’t it? Think of it as a recipe, a handbook, or a manual.. a set of instructions… now it clicks, doesn’t it? It’s basically a programmer’s written note to the computer that says.. do this.. do this.. and do that after that… and finally do that and that’s how you get the citizenship of Saudi Arabia.

But here’s the catch. A program is merely a set of instructions. You do have to run it, to reach the goal. And that’s where process comes in but more on that later. Think of a program as like a book named “How to get inside a girl’s pants in 10 steps” and process as the action you take based on the book to get inside her pants. 

A process is a program in execution.

For example, when you write a program in Java and compile it, the JVM creates a bytecode thingy. The original code and the bytecode thingy, both are programs. When you actually run the binary code, it becomes a process.

A process is an ‘active’ entity as opposed to a program which is considered to be a ‘passive’ entity. A single program can create many processes when it’s run multiple times, for example when we open a .exe or binary file multiple times, many instances begin (many processes are created).

Process models (Uniprogramming, Multiprogramming, Multiprocessing)

Uniprogramming => Only one process at a time.

Screen Shot 2018 03 31 at 7.46.32 AM - What the fuck is a process?

Multiprogramming => Multiple processes at a time i.e A computer running more than one program at a time (like running MS Word and Google Chrome simultaneously to be able to copy Wikipedia for the group project report).

Screen Shot 2018 03 31 at 7.51.11 AM - What the fuck is a process?

Multiprocessing => System with multiple processors i.e A computer using more than one CPU at a time.

Screen Shot 2018 03 31 at 7.53.19 AM - What the fuck is a process?

 Multitasking – Tasks sharing a common resource (like a single CPU).

As the name itself suggests, multitasking refers to the execution of multiple tasks (say processes, programs, threads etc.) at a time. But.. But.. hold on a minute…

Isn’t it same as multiprogramming? How does it differ from multiprogramming?

Multitasking is a logical extension of multiprogramming. The major way in which multitasking differs from multiprogramming is that multiprogramming works on the concept of context switching whereas multitasking is solely based on time-sharing systems. So, basically, a multitasking system basically divides CPU’s time to be able to do what it does.

K.. I’m bored now. In the next article… we’ll probably look at the states of process and process control block which means how the process looks inside a memory. But for now… hosta la vista,  amigos. 

 

What the fuck is Peterson’s algorithm? 

What the fuck is Peterson’s algorithm? 

As we all know when two or more processes need to share a single resource, conflict occurs. Remember fighting with your mom for that TV remote back in the days when you watched TV. You still do? ..hah.. what a loser. So, moving on, to solve this conflict we kinda need to use a thing called mutual exclusion which basically means TV serials are your mom’s time and you are not allowed near that TV when she’s watching.

Peterson’s algorithm is a mutual exclusion algorithm that allows two or more processes to share a single-use resource without conflict. 

The algorithm is named after Gary L. Peterson who literally made the algorithm. His original work only focused on two processes (i.e you and your mom because I needed an opportunity to say your mom). But, it can be generalized for more than two processes. So, the algorithm kinda works for two or more than two processes. So, that means you dad and your mom’s boyfriend can join in too if they wish to. 

Note: Dekker also tried to solve the issue between you and your mom but Peterson’s solution is simpler because he knows that you’re a dumbfuck. 

So, how does this algorithm thingy work? 

Here’s a little rote memorization trick for you because you’re too dumb to understand anything. The algorithm used two variables flag and turn. A flag[0]=true indicates that Po wants to enter the critical section. Entrance to critical section is given to P0 if P1 does not want to enter its critical section or P1 has given priority to Po by setting turn to 0

P0:      flag[0] = true;
P0_gate: turn = 1;
         while (flag[1] == true && turn == 1)
         {
             // busy wait
         }
         // critical section
         ...
         // end of critical section
         flag[0] = false;
P1:      flag[1] = true;
P1_gate: turn = 0;
         while (flag[0] == true && turn == 0)
         {
             // busy wait
         }
         // critical section
         ...
         // end of critical section
         flag[1] = false;

P1 and P0 can never be in the critical section at the same time. If P0 is in its critical section, then flag[0] is true. In addition, either flag[1] is false ( meaning P1 has left its critical section), or turn is 0 (meaning P1 is just now trying to enter the critical section but is waiting, or P1 is at label P1_gate (trying to enter its critical section, after setting flag[1] to true  but before setting turn to 0 and busy waiting). So if both processes are in their critical sections then we conclude that the state must satisfy flag[0] and flag[1]  and turn = 0 and turn = 1. No state can satisfy both turn = 0 and turn = 1, so there can be no state where both processes are in their critical sections. 

 

 

Java Servlet Example 3

3. Develop a servlet that displays the number of visits on the servlet. Also display the client’s hostname and IP address, as shown in Figure. Use an instance variable to store count. When the servlet is created for the first time, the count is 0. count is incremented every time the servlet’s doGet method is invoked. When the Web server stops, the count is lost.

getRemoteHost()

getRemoteAddr()

Screen Shot 2018 03 09 at 3.56.54 PM - Java Servlet Example 3

  • VisitorServlet.java (put it in the “src” folder)
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/VisitorServlet") public class GreetingServlet extends HttpServlet {
static int count = 0;     
protected void doGet(HttpServletRequest request, HttpServletResponse response)
 throws ServletException, IOException {
response.setContentType("text/html");         
PrintWriter out = response.getWriter();         
// client's IP address         
String remoteAddr = request.getRemoteAddr();         
// client's hostname         
String remoteHost = request.getRemoteHost();         
if (count == 0){             
out.print("<h3>");             
out.print("Welcome to the fist Time </h3>");             
count++;         
} else {            
 out.print("<h3>You have visited " + count + " times");         
    count++;             
out.print("</h3>");      
   }         
out.println("Host name: ");         
out.print(remoteAddr);       
  out.println("<br>");         
out.println("IP address:");         
out.print(remoteHost);        
 out.close();    
 } }
  • index.jsp(put it in the “web” folder) 
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
 <html>
   <head>
     <title></title>
   </head>
   <body> </body>
 </html>
  • web.xml(put it in the “WEB-INF” folder which resides inside the “web”.) 

      Note: This step is not mandatory. You may choose not to do it. And the program will still run. 

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, 
Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> 
<web-app> 
    <display-name>myweb</display-name> 
    <!-- Servlet Definitions  --> 
   <servlet> 
      <servlet-name>VisitorServlet</servlet-name> 
      <servlet-class>VisitorServlet</servlet-class>  
  </servlet> 
<!--   Servlet Mappings   --> 
   <servlet-mapping> 
      <servlet-name>VisitorServlet</servlet-name> 
       <url-pattern>/VisitorServlet</url-pattern>  
  </servlet-mapping> 
</web-app>  

Note: To run this program, type inlocalhost:8080/VisitorServlet the browser URL. Click here if you don’t know how to set up a servlet project in NetBeans.

 

 

Java Servlet Example 2

HTML Form

Screen Shot 2018 03 09 at 4.00.55 PM - Java Servlet Example 2 Screen Shot 2018 03 09 at 4.01.09 PM - Java Servlet Example 2

  • index.jsp (put it in the “web” folder) 

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Calculator</title>
</head>
<body bgcolor="aqua">

<form method="post" action="GreetingServlet">


  <h3 style="text_align:center;">Choose an operation:
    <input type="radio" name="r1" value="add" />addition
    <input type="radio" name="r2" value="sub" />subtraction
    <input type="radio" name="r3" value="mul" />multiplication
    <input type="radio" name="r4" value="div" />division
  </h3>

  </label>
  <label>Choose 1<sup>st</sup> number:</label>
  <input type="text" name="n1" />
  <br>
  <label>Choose 2<sup>nd</sup> number:</label>
  <input type="text" name="n2" />
  <br>
  <label>
      <input type="submit" value="Submit" style="background-color: hotpink">
  </label>

</form>
</body>
</html>

  • FormServlet.java (put it in the “src” folder) 

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


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

   public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try
        {
            response.setContentType("text/html");
            PrintWriter out= response.getWriter();
            out.println("<body style='background-color:black;color:yellow;'>");
            out.println("<h3 style='color:red;'>Output of your inputs </h3>");
            int a1= Integer.parseInt(request.getParameter("n1"));
            int a2= Integer.parseInt(request.getParameter("n2"));
            if(request.getParameter("r1")!=null)
            {
                out.println("<p>Addition</p>"+(a1+a2));
            }
            if(request.getParameter("r2")!=null)
            {
                out.println("<p>Subtraction</p>"+(a1-a2));
            }
            if(request.getParameter("r3")!=null)
            {
                out.println("<p>Multiplication</p>"+(a1*a2));
            }if(request.getParameter("r1")!=null)
        {
            out.println("<p>Division</p>"+(a1/a2));
        }
        }
        catch(Exception e)
        {
            System.out.println("error" + e.getMessage());

        }
    }
}

Note: To run this program type: localhost:8080 in the browser URL. 

Click here if you don’t don’t how to set up a NetBeans servlet project. 

Java Servlet Example 1

Write a servlet to display a table that shows ODD numbers and EVEN numbers from number 1 to 10, as shown in the figure below. 

Screen Shot 2018 03 09 at 4.02.12 PM - Java Servlet Example 1

 

  • EvenOddServlet.java (put it in the “src” folder) 

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class EvenOddServlet extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws 
ServletException, IOException {
        res.setContentType("text/html");
        PrintWriter pw = res.getWriter();
        // Send the message
        pw.println("<table border='1'>");
        pw.println("<tr>");
        pw.println("<th style='background-color:red;'> Even </th>");
        for (int i = 1; i <= 10; ++i) {
            if (i % 2 == 0) {
                pw.println("<td>" + i + "</td>");
            }
        }
        pw.println("</tr>");
        pw.println("<tr>");
        pw.println("<th style='background-color:red;'> Odd </th>");
        for (int i = 1; i <= 10; ++i) {
            if (i % 2 != 0) {
                pw.println("<td>" + i + "</td>");
            }
        }
        pw.println("</tr>");
        pw.println("<table>");
    }
}

  • index.jsp (put it in the “web” folder) 

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title></title>
  </head>
  <body>

  </body>
</html>

  • web.xml (put it in the “WEB-INF” folder which resides inside the “web”) 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
    <display-name>myweb</display-name>

    <!-- Servlet Definitions  -->
   <servlet>
      <servlet-name>EvenOddServlet</servlet-name>
      <servlet-class>EvenOddServlet</servlet-class>
   </servlet>
<!--   Servlet Mappings   -->
   <servlet-mapping>
      <servlet-name>EvenOddServlet</servlet-name>
       <url-pattern>/EvenOddServlet</url-pattern>
   </servlet-mapping>
 </web-app>

 Note: To run this go to your browser and type: localhost:8080/EvenOddServlet

If you don’t know how to set up a servlet project in NetBeans, you may use this video as a reference:

 

java servlet

What the fuck is a java servlet?

 

Remember Java’s write once, run anywhere bullshit? Run anywhere…  Yeah, well Java programs can run on anything that has JVM. A toaster with JVM can run Java. An iPhone without it cannot. TAKE THAT JAVA! Well, it hasn’t stopped java developers to develop apps on iPhone using Java though. You see, this magical JVM thingy works and is fast enough because it is written in C/C++ for that specific OS. But the fucking pointers suck the life out of you so let’s stick to Java for now. 

 

WHAT THE FUCK IS A JAVA SERVLET THEN? 

As you’ve noticed I’ve just beat around the bush and haven’t still answered what the fuck Java Servlet is till now. Well, what if you wanted to leave the comfort of your desktop and mobile phone and wanted to develop apps for the good OL‘ web. Could you still do that? Now, what fun is it … if a language claims to run everywhere and can’t even run on the web. That would suck, right? 

Well for all the Java evangelists, the good news is that Java comes with full-fledged Servlet API which lets you build web apps without much hassle, unlike non-standard CGI thingy that Java used to have which we are not going to talk about because fuck it. 

 

WHAT? HOW THE HELL, DOES IT DO THAT? 

Think of a Servlet as a Java program or a Java class that is executed within the scope of Servlet containers (or web containers). You must be thinking, hold on their chief? What the fuck is a Web container now? Shit like Tomcat, Jetty etc. allow handling client requests and server responses and they are Web containers. 

Servlets use GET and POST request thingies to be able to snatch data from users. They can handle session and cookies thingies. They can process the motherfucking data and output the data in both text and binary formats such as XML, HTML, pdf, gif etc. They may use a thingy called JSP in many cases which we’ll talk about some other time.