Thursday, May 1, 2008

google optimize

http://www.google.com/support/webmasters/bin/answer.py?answer=35769

1 meta description
meta name="Description" content="Author: A.N. Author, Illustrator: P. Picture, Category: Books, Price: £9.24, Length: 784 pages"
2 title
3 site map
4 title tag and ALT
5 If-Modified-Since HTTP header
a) If the request would normally result in anything other than a
200 (OK) status, or if the passed If-Modified-Since date is
invalid, the response is exactly the same as for a normal GET.
A date which is later than the server's current time is
invalid.
b) If the variant has been modified since the If-Modified-Since
date, the response is exactly the same as for a normal GET.
c) If the variant has not been modified since a valid If-
Modified-Since date, the server SHOULD return a 304 (Not
Modified) response.

Wednesday, January 9, 2008

LimeWire Message Processing

class MessageRouter
{

/**
* Links the MessageRouter up with the other back end pieces
*/
public void initialize() {
_manager = RouterService.getConnectionManager();
_callback = RouterService.getCallback();
_fileManager = RouterService.getFileManager();

_bypassedResultsCache = new BypassedResultsCache(_callback, RouterService.getDownloadManager());

QRP_PROPAGATOR.start();

// schedule a runner to clear unused out-of-band replies
RouterService.schedule(new Expirer(), CLEAR_TIME, CLEAR_TIME);
// schedule a runner to clear guys we've connected back to
RouterService.schedule(new ConnectBackExpirer(), 10 * CLEAR_TIME,
10 * CLEAR_TIME);
// schedule a runner to send hops-flow messages
RouterService.schedule(new HopsFlowManager(), HOPS_FLOW_INTERVAL*10,
HOPS_FLOW_INTERVAL);
RouterService.schedule(new UDPReplyCleaner(), UDP_REPLY_CACHE_TIME, UDP_REPLY_CACHE_TIME);

// runner to clean up OOB sessions
OOBHandler oobHandler = new OOBHandler(this);
RouterService.schedule(oobHandler, CLEAR_TIME, CLEAR_TIME);

// handler for inspection requests
InspectionRequestHandler inspectionHandler = new InspectionRequestHandler(this);

setMessageHandler(PingRequest.class, new PingRequestHandler());
setMessageHandler(PingReply.class, new PingReplyHandler());
setMessageHandler(QueryRequest.class, new QueryRequestHandler());
setMessageHandler(QueryReply.class, new QueryReplyHandler());
setMessageHandler(PushRequest.class, new PushRequestHandler());
setMessageHandler(ResetTableMessage.class, new ResetTableHandler());
setMessageHandler(PatchTableMessage.class, new PatchTableHandler());
setMessageHandler(TCPConnectBackVendorMessage.class, new TCPConnectBackHandler());
setMessageHandler(UDPConnectBackVendorMessage.class, new UDPConnectBackHandler());
setMessageHandler(TCPConnectBackRedirect.class, new TCPConnectBackRedirectHandler());
setMessageHandler(UDPConnectBackRedirect.class, new UDPConnectBackRedirectHandler());
setMessageHandler(PushProxyRequest.class, new PushProxyRequestHandler());
setMessageHandler(QueryStatusResponse.class, new QueryStatusResponseHandler());
setMessageHandler(HeadPing.class, new HeadPingHandler());
setMessageHandler(SimppRequestVM.class, new SimppRequestVMHandler());
setMessageHandler(SimppVM.class, new SimppVMHandler());
setMessageHandler(UpdateRequest.class, new UpdateRequestHandler());
setMessageHandler(UpdateResponse.class, new UpdateResponseHandler());
setMessageHandler(HeadPong.class, new HeadPongHandler());
setMessageHandler(DHTContactsMessage.class, new DHTContactsMessageHandler());
setMessageHandler(VendorMessage.class, new VendorMessageHandler());
setMessageHandler(InspectionRequest.class, inspectionHandler);

setUDPMessageHandler(QueryRequest.class, new UDPQueryRequestHandler());
setUDPMessageHandler(QueryReply.class, new UDPQueryReplyHandler(oobHandler));
setUDPMessageHandler(PingRequest.class, new UDPPingRequestHandler());
setUDPMessageHandler(PingReply.class, new UDPPingReplyHandler());
setUDPMessageHandler(PushRequest.class, new UDPPushRequestHandler());
setUDPMessageHandler(LimeACKVendorMessage.class, new UDPLimeACKVendorMessageHandler());
setUDPMessageHandler(ReplyNumberVendorMessage.class, oobHandler);
setUDPMessageHandler(UDPCrawlerPing.class, new UDPCrawlerPingHandler());
setUDPMessageHandler(HeadPing.class, new UDPHeadPingHandler());
setUDPMessageHandler(UpdateRequest.class, new UDPUpdateRequestHandler());
setUDPMessageHandler(ContentResponse.class, new UDPContentResponseHandler());
setUDPMessageHandler(InspectionRequest.class, inspectionHandler);
setUDPMessageHandler(AdvancedStatsToggle.class, new AdvancedToggleHandler());

setMulticastMessageHandler(QueryRequest.class, new MulticastQueryRequestHandler());
//setMulticastMessageHandler(QueryReply.class, new MulticastQueryReplyHandler());
setMulticastMessageHandler(PingRequest.class, new MulticastPingRequestHandler());
//setMulticastMessageHandler(PingReply.class, new MulticastPingReplyHandler());
setMulticastMessageHandler(PushRequest.class, new MulticastPushRequestHandler());
}
}

Friday, September 14, 2007

Fractal Terrain Generation (Fault Formation)

Basically, all we do is add a random line to a blank height field, and then we add a random height to one of the sides.


The first step in the fault-formation algorithm.




Examples of heightmaps created after several “fault formation” passes.



Erosion Filter

all we are really doing here is “mixing” a bit of the previous pixel with the current pixel.


ucpBand[j]= fFilter * ucpBand[j-1] + ( 1-fFilter ) * ucpBand[j];


ucpBand[j] : Current pixel height
ucpBand[j-1] : Previous pixel height
fFilter : Filter factor (0.3~0.6)



Heightmaps that were generated using the fault-formation algorithm and the erosion filter.

The top image has a filter value of 0.0f, the middle image has a filter value of 0.2f, and the bottom image has a filter value of 0.4f.



Feature

1 it does not place a restriction on what dimensions must be used for the generated heightmap, whereas midpoint displacement requires that the dimensions be a power of two. (The dimensions must also be equal, so although you can generate a heightmap of 1024 × 1024, you cannot generate a heightmap of 512 × 1024.)

2 works great for a nice little scene composed of some small hills, but what if you want something more chaotic than that, such as a mountain range? Midpoint displacement is the answer

Brute Force

Basically,if you have a heightmap of 64 × 64 pixels, then the terrain, when rendered using brute force, consists of 64 × 64 vertices, in a regular repeating pattern

A 5 × 5 patch of brute force terrain vertices.

we will be rendering each row of vertices as a triangle strip. The color for the vertex will be based on its height, so all vertices will be shades of gray.