Skip to content

Instantly share code, notes, and snippets.

View heslei's full-sized avatar

Heslei Silva heslei

View GitHub Profile
How a HTTP GET request works in my mind.
1.Web Browser > 2.DNS > 3.Firewall > 4.Load Balancer > 5.HTTP Server > 6.Application Server > 7.Welcome File List > 8.Send redirect
1. The navigator will send a request to the address throught the port 80
2. The address name will be resolved in a IP
The request will be forward to the destiny among the routers
3. For security reasons a firewall must be control the requests in case of attacks
4. A Load Balancer will distribute the requests among the HTTP Servers
5. The HTTP Server could answer the request with a static file or forward it to an application in the Application Server.
@heslei
heslei / file.java
Created July 24, 2013 17:29
Using Scanner in order to read a file.
FileInputStream fis = new FileInputStream(this.getClass().getResource("/test.html").getFile());
String inputStreamString = new Scanner(fis,"UTF-8").useDelimiter("\\A").next();
@heslei
heslei / lampadasNoCorredor.html
Created May 5, 2012 00:34
Coding Dojo - 20120503 - Lâmpadas no corredor
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script>
<script>
@heslei
heslei / Fibonacci.java
Created March 6, 2012 03:11
Fibonacci recursive, cache and iterable
public class Fibonacci {
public int fibonacciDe(int n){
if(n <= 0){
return 0;
}
if (n == 1){
return 1;
}