3 reasons why Hillary lost
Caucus states, Small-donor money, Bill Clinton
An over-simplification but probably the gist of it.
You may be right but I am not wrong.
Caucus states, Small-donor money, Bill Clinton
An over-simplification but probably the gist of it.
Posted by
Keyur Shah
1 comments
Link:
Lately, however, it seems that I spend more time answering people’s questions about REST than I should [...]. I need to start organizing my own correspondence.
Posted by
Keyur Shah
2
comments
I've had Windows Vista on my laptop for a few months now. For the last couple of days it had been dying on me, one application at a time. No audio in media players, Network List Service failing to start, Network Icon showing a big fat red X, et al.
Googling the issues didn't get me far. So finally I decided to do it - System Restore. It's been behaving well since.
Now if only life had that option :)
Posted by
Keyur Shah
0
comments
Labels: windows
REST and JavaScript APIs for the ArcGIS Server were announced at the ESRI UC Plenary Session today.
At 9.3 you can REST-enable your ArcGIS Server services. You can then either consume them from the ArcGIS JavaScript library as well as from other clients such as Google Maps, Virtual Earth and the like.
While at the UC, you can learn more about these APIs at the Server Road Ahead sessions, the EDN sessions, Advanced ArcGIS Online Sessions and also at the Java SIG.
Posted by
Keyur Shah
5
comments
Labels: arcgisserver, rest
You have your business engine all setup. Your processing algorithms have been optimized to the hilt. Your data model is as scalable as any. Any now you are publishing your data to the WWW. Well, the good news is you can still do more - all with plain old HTTP.
Herein I list 3 simple ways you can leverage HTTP to help you better serve your content:
Cache-Control headersETag + If-None-MatchgzipCache-Control headersCache-Control is byfar is the most widely used of all http headers and for good reason. You generate your response and you set a Cache-Control response header with a validity period. The clients, the intermediaries and the web infrastructure at large all work overtime for you caching your content until the time that you have tagged it valid.ETag + If-None-MatchETags.ETag (entity tag). The ETag represents the state of your resource. Even if one bit of the resource content changes, so does its ETag. You can think of ETag as a simple hash of your content. Ok so you have set the ETag and sent the response. Now the next time the client tries to access the same URL, it will send an If-None-Match request header and it will be set to the same value as that of your ETag. Now you can either regenerate the content or you may have it cached on your server, if the ETag of your content matches the If-None-Match it implies that the content has not changed. The client has indicated to you thru the If-None-Match that it already has this content. So what do you do - send nothing! Yes - simply set the response status to HTTP 304 (Not Modified) and the size of the content that you send this time is exactly 0. At a minimum, you gain in saved bandwidth (read performance) but if you have cached the content on your server, you also gain from saved computation.gzipAccept-Encoding request header with the string gzip in it. If you (the server) read this header and find the string gzip, you gzip your content and set a response header Content-Encoding to gzip. This tells the client that the content is gzipped and it must decompress it before providing it to the user.
Posted by
Keyur Shah
3
comments
Labels: bestpractices, http
ETag + If-None-Match give you the benefit of not having to send unmodified content repeatedly (HTTP 304). IE6 handles this well.Content-Encoding with gzip gives you the benefit of compressing the content that you send. IE6 handles this well as well.
So gzip + ETag / If-None-Match should give you the combined benefit of sending compressed content when you must and not sending content at all if it's not modified. Well, as you might have already guessed, IE6 does not handle this well. If your content is gzipped and you send an ETag header as well, IE6 does not send an If-None-Match on subsequent requests. Which of course means that you can't leverage HTTP 304.
So if you are servicing IE6 clients beware that it supports either compression or ETags but not both.
Thankfully, this has been fixed in IE7. Firefox of course just works.
Posted by
Keyur Shah
2
comments
Labels: http
Link: Sam Ruby on Google Maps
Of course, the rest of the iceberg was that Google had simply tiled the Earth. In so doing, they converted a single web service (call me with a bunch of information, and I will provide you with a custom result) into a large number of individually addressable, cacheable, and scalable web resources.That's it. More the resources more is the opportunity to use Cache-Control headers, to use ETags, to distribute and load-balance the system.
Posted by
Keyur Shah
0
comments
Labels: bestpractices, http
If you are surprised that I am talking about mashups and garbage collection in the same post, well, so was I. But if one can talk about implementing servers in JavaScript, I most definitely can talk about mashups and garbage collection in the same breath.
Day 1 was primarily scripting, day 2 hardcore java. Days 3 and 4 saw sessions on the entire gamut of Java technologies - from garbage collection to mashups. I discuss some of them here.
Blueprints for Mashups
This was arguably the most informative session for me by far at this year's JavaOne. Kudos to Greg, Mark and Sean for putting together a to-the-point, practical and readily-usable session together. Personally, this session validated the REST and JSON concepts I had gathered over the past few months. I'll recommend this session to anybody interested in building mashups, REST services, AJAX and a whole lot more. (No, they haven't paid me to say this.)
Anybody building REST services should design their system with JavaScript in mind. In today's mashup world the browser (and hence JavaScript) is your first class client. XML and JSON are the typical content types returned by REST services. To get over the browser's cross-domain restrictions, there are 2 possible solutions:
innerHTML property is easier / better than DOM manipulationSystem.gc() - except between well-defined application phases and when the load on your system is low.
Posted by
Keyur Shah
0
comments
Labels: bestpractices, java, javaone, rest, scripting
While Day 1 saw an overdose of scripting, sanity made a return on Day 2. Although JavaScript technology (whoever came up with that) sessions continued, there was a good supply of deep-dive Java and Java EE sessions to keep me busy. And there was also some WADLing.
Generics and Collections
Generics have been around for a while and most Java programmers have some understanding of it. There have been many criticisms against the erasure based implementation of generics - since parameter types are not reified, constructs that require type information at runtime don't work well. However erasures allow 2 most important benefits - migration compatibility and piecewise generification of existing code. Just these benefits make erasures a necessary bane.
Huge additions have been made to the Collections framework in Java 5 and 6. So much so that many recommend programmers to never use arrays - Collections all the way!
Concurrency Practices
The concurrency classes introduced in Java 5 are a great new toolset for the Java programmer. New concurrency related annotations such as @ThreadSafe, @GuardedBy, etc. are being considered. One important aspect to keep in mind - imposing locking requirements on external code is asking for trouble. Ensure that you make your code threadsafe yourself. Performance penalties incurred by synchronized constructs are overblown.
Immutable objects are your friends - final is the new private! They are automatically threadsafe. Object creation is cheap. Aim for less and less mutable state.
Performance is now a function of parallelization - write code such that it can use more cores to get the job done faster. So to improve scalability find serialization in your code and break it up:
AtomicInteger for countersConcurrentMapThreadLocal for heavyweight mutable objects that don't need to be sharedMyObject myobj = new MyObject.Builder(requiredParam1,requiredParam2).optionalParam1(opt1).optionalParam2(opt2).build();
@SuppressWarnings rather than the entire method / class. Use bounded wildcards to increase applicability of APIs. 3 take home points for paramterized methods:<? extends T> for reading from a Collection<? super T> for writing to a Collection<T> for methods that both read and writeFilter.doFilter() may run in a different thread than the Servlet.service() method. The Servlet API does not use NIO, however it is possible to implement it yourself. New annotations may make web.xml optional.# is now reserved in JSP 2.1. The javax.faces.ViewState hidden field (for client side state) will be standardized. Include this field in your AJAX postback. Application-wide configuration of JSF resource bundles will be possible in faces-config.xml. The <f:verbatim> tag is no longer needed to interleave HTML and JSF content. @PostConstruct and @PreDestroy annotations will be supported for JSF managed beans.
Posted by
Keyur Shah
0
comments
Labels: bestpractices, designpatterns, java, javaone, servlets