404 – a legend

You’ve felt it. You know the power of 404. You’re surfing one night, you’ve got your new modem, your fast Mac, your ergonomic mouse, your precise mousing surface. Bring it on. You’ve got 7 windows open at a time, and you flip through them like dealing cards. You could tile them on the screen, like a little website mosaic, but you choose to keep them stacked on each other, so that each flip is a new adventure. Then suddenly, it screeches to a halt: 404. You don’t want to believe it; that site was there last week! You reload, hoping it was a fluke. How could your painstakingly-compiled bookmarks betray you? 404 glares back at you, challenging you to contact the referring page’s administrator. Questioning your spelling skills. What does 404 want from you?

Relax! 404 is your friend. It just wants to help you get where you want to go. It might intimidate you at first, with its stark white background and unadorned black text. But just think about it for a minute: 404 is baring its soul for you. It gives you its message and asks nothing in return. No login and password, no banner ads, no mailing list to keep you informed of future updates. All 404 has, it offers to you, knowing the likelihood that you will scorn it nonetheless, and leave as quickly as you came in. And 404 will continue to do so for every visitor, regardless of color, religion, or gender. 404 is nothing if not fair.

But why leave 404 so quickly? Why not stay a while and have a drink? 404 is an oasis on the web. It’s like a rest stop with clean bathrooms on the interstate. 404 doesn’t ask you to ‘Click Here’ or ‘Visit our Sponsor’. It’s perfectly satisfied if you just sit there and do nothing. 404 doesn’t care how many visitors it’s had since 8/1/96, and it’s not tracking your click-through rate. So consider just hanging out for a while and relaxing. 404 is easy to get along with.

404 is full of intrigue. What did it used to be? What internet delight has escaped you? Will it return? 404 will never tell. Its mystery drives you to return again and again. Where there is 404, there is always the potential for something new. 404 is the eternal ebb and flow of life. One day you will return and 404 will be gone, replaced by a new page about South Park or the webmaster’s cats. And it will be filled with the bittersweet memory of 404. You will be driven to seek out 404 in other places. Your desire for 404 will start to overshadow your career, your loved ones, even your passion for role-playing video games. 404 draws you deeper and deeper into its vortex. You must admit that you are powerless before it. 404 is not evil, it is a natural force that defies control. 404 is wild and free.

404 believes in your abilities. It doesn’t try to lose you in a crazy series of redirects, it challenges your problem-solving skills. It asks, “Now that you’re here, what are you going to do?” 404 willingly hands you the reins. Have you ever just closed a window on 404? No! You’ve considered your options, exercised your reasoning skills, and firmly chosen a course of action to deal with your situation. When you successfully navigate 404, you feel the blood coursing in your veins, the wind in your hair, and it’s good to be alive. 404 is life-affirming. When you find 404, you know that even though the thing you were looking for no longer exists, there is still 404, stepping in to fill the void.

Where there was darkness, there is now 404. And all is right with the world.

Your Dominant Intelligence is Logical-Mathematical Intelligence

You are great at finding patterns and relationships between things.
Always curious about how things work, you love to set up experiments.
You need for the world to make sense – and are good at making sense of it.
You have a head for numbers and math … and you can solve almost any logic puzzle.

You would make a great scientist, engineer, computer programmer, researcher, accountant, or mathematician.

Petrol engine versus diesel engine

An engine is a lump of metal which makes the vehicles go zoom. Major types of engines are petrol and diesel. The engines required to run petrol and diesel are different because petrol and diesel are different types of fuel. Petrol is a highly volatile fuel and gets ignited very easily whereas diesel is comparatively heavy and dirtier fuel. We would be talking about 4 stroke engines only, the ones used in cars.

People who know me must be wondering why am I writing this article, i being a computer engineer. Hmmm, because, i am supposed to buy a car now and have been doing some research on them. The first question I came upon was whether a petrol or a diesel car. And, all i want to do is to share all that i have learned with you people. I am still unable to decide whether i should go for ford fiesta diesel or ford fiesta petrol, the petrol verson being a lot cheaper than the diesel version.

Lets start with what does a 4 stroke engine mean. It means that the engine has 4 strokes – inlet, compression, expansion and exhaust. Lets see stroke by stroke how both engines work

Petrol Engine

Diesel Engine

Inlet stroke
> In petrol engines the mixture of air and petrol is drawn in by the falling piston
> In diesel engines only air is drawn in by the falling piston

Compression stroke
> In petrol engine, the mixture is compressed upto about 1/8th to 1/12th of its original size.
> In diesel engine, only air is compressed upto about 1/14th to 1/25th of its original size.

Expansion stroke
> In petrol engine, the air and fuel mixture is ignited using a spark plug and burns expanding and forcing the piston down.
> In diesel engine, fuel is injected at a high pressure into the hot, compressed air in the cylinder, causing it to burn and force the piston down. No spark is required.

Exhause stroke
> In both petrol and diesel engines, the burned mixture of air and fuel is pushed out of the cylinder by the rising piston.

A diesel engine is also known as a “compression ignition” engine. Since the air is compressed to very high pressure raising its temperature and then diesel is injected in a very fine spray which causes the diesel to ignite and explode. Whereas a petrol engine is known as a “spark ignition” engine. Since a spark plug is required to ignite the mixture of petrol and air in the combustion chamber.

Diesel engine

Petrol engine

Lets also note down more differences of the same

  • A diesel engine is more easily turbocharged than a petrol engine. A petrol engine cannot be easily turbocharged due to the fact that if the compression ratio and the pressure in the cylinder is to high during the inlet stroke, the mixture starts to burn to soon, while the piston is on its way up. The diesel engine has no fuel in the cylinder, thus letting the turbocharger suck as much air as it can without creating any problems. (A turbo charger is a simple air compressor which compresses air in the combustion chamber for burning). Some diesel engines also have an intercooler which helps in blowing cold and oxygen rich air in the combustion chamber.
  • Electronic engine management not necessary in diesel engines. Some modern diesel engines are gaining electronically controlled injection pumps, but the vast majority of them out there have purely mechanical pumps. In fact no electricity is required to make a diesel engine run, except for a simple fuel cut off solenoid so that you can switch the thing off! If your alternator stops working, then you’re gonna get home in a diesel. This also means that a diesel engine does not have any ignition breakers, ignition coils, distributors and ignition wires to go bad. So a diesel engine should start no matter if it is dry or rainy or wet.
  • Petrol destroys lubrication and burns the engine whereas diesel doesnt. So a diesel engine would last longer than a petrol engine.
  • Petrol engines are lighter than diesel engines.
  • Diesel engines have higher torque than petrol engines. What does this mean? Well, this means that a diesel engine would pull heavy loads easily than a petrol engine. Though the pickup of a petrol engine would be much more than that of a diesel engine, the diesel engine would be steady and carry heavier loads to longer distances.
  • Diesel engines have better fuel efficiency as compared to petrol due to the fact that they have higher compression ratio.
  • Diesel engines dont need an ignition system, which reduces their complexity. But they are more noisy and may require frequent maintenance as compared to petrol engines. Also they are more durable.
  • Diesel engines may also need glow plugs in extreme cold conditions which heat up the cylinder so that a cold engine can start easily.
  • And now the most important part, fuel economy. Diesel wins in both ways. Diesel engines give better mileage than petrol engines and In india diesel is much cheaper than petrol. So running on diesel would make you go farther at a lower cost than running on petrol.

Even after writing all this, i am still undecided where to go. Should i risk taking a diesel engine hoping that the maintenance costs would be bearable. Well, lets c what happens…

Reverse Proxy using squid

what is proxy server caching? hmm… lets start with what apache or any other web server does. Whenever you send a request to apache, the request (whether static or dynamic) is processed. The appropriate file is located in the file system and, the content type is identified and data is then streamed from the file to the web and hence to the browser. This is what the apache does. So where does proxy server come in picture? Proxy servers like squid are set up at the gateway level in cyber cafes or large companies. The proxy server caches web content in its internal cache and whenever a request comes to the proxy server, the server matches the modified time of the web content with that at the server, and if the time is same, the content is served from the proxy cache, else the content is fetched from the remote server and served and cached for future purposes.

So, now, what is reverse proxy caching? Reverse proxy is something which is installed in the neighbourhood of a web server. All incoming traffic to the web server is passed through the reverse proxy server. This reduces the load on a busy server by using a web cache between the server and the internet.

Following benefits are derived by deploying reverse proxy servers alongside web servers:

1. increase capacity of existing servers and prevent purchase of new servers.
2. static content is easily cached at the proxy server level, leaving the web server to handle dynamic content.
3. Increase response time of any web request.
4. proxy server acts like an additional layer of defence against hacking.
5. Load balancing: reverse proxy can be used to distribute load on several web servers.
6. Compression: web content can be optimized and compressed to speed up download times.

A reverse proxy server intercepts requests to the Web server and responds to the request out of a store of cached pages. Dynamic web content cannot be cached. Reverse proxy caches static pages / images based on HTTP header tags that are returned from the web page. Important HTTP header tags are:

Last-Modified -> when was the page last modified
Expires -> when would the page expire so that it can be removed from proxy server cache
Cache-control -> should the page be cached
Pragma -> similar to Cache-control, deciding factor whether the page should be cached or not

Here is what i did to install squid:

>> download the squid source gz file.
>> tar -xvzf squid-2.6.STABLE4.tar.gz – creates a directory squid-2.6.STABLE4
>> cd squid-2.6.STABLE4
>> ./configure –disable-internal-dns – makes squid use the /etc/hosts file for dns lookup.
>> make – compile the files
>> make install (as root) – copies the compiled files to /usr/local/squid
>> vi /usr/local/squid/etc/squid.conf
>> make the following changes. The configuration file format has been changed in squid 2.6. I am putting the new configuration settings here. Older directives of httpd_accel_* have been depricated.

http_port 80 vhost
socket address where squid listens to httpd client requests. Default is 3128 (for proxy server). Various options can be put after the port number. Like
transparent : support for transparent proxies
vhost : accelerator using vhost directive
vport : accelerator with IP virtual host support
defaultsite= : main website name for accelerators
protocol= : protocol to reconstruct accelerated requests with. Default is httpd.
no-connection-auth : prevent forwarding of microsoft connection oriented authentication
tproxy : support for linux TPROXY for spoofing outgoing connections using the client IP address

cache_peer [options]

for apache running on localhost on port 81, the configuration for reverse proxy – cache_peer directive would be

cache_peer localhost parent 81 0 originserver
hostname : cache peer to which connection has to be established type : how cache peer is treaded (as parent, sibiling or multicast)
parent -> the child cache will forward requests to its parent cache. If the parent does not hold the requested object, it will forward the request on behalf of the child.
sibling -> a peer may only request objects already held in the cache. a sibling cannot forward cache misses on behalf of the peer.
multicast -> multicast packet is from one machine to one or more.
proxy port : port no where cache listens to the peer requests
icp port : used for querying neighbour caches about objects
options : lots of options available like
proxy-only -> objects fetched from this cache should not be saved locally
weight=n -> specify weight of parent
round-robin -> define a set of parents to be used in a round robin way.
weighted-round-robin -> define a set of parents to be used in a round robin way, frequency of each parent being based on the round trip time.
originserver -> contact this parent as a origin server. used for accelerator setups

Thats it, just start your apache and squid and everything should run fine.
Hope this helps…

Source : http://www.visolve.com/squid/whitepapers/reverseproxy.php with some customizations to upgrade it for the new version.