Html5 is a nice platform for game development. Though the standardization is not stable, it is mostly supported by all major browsers.
Most advantage of html5 game development is, you will have a single code-base for all your platforms : windows, android, ios etc. The disadvantage is : it runs through a browser engine, which is not as fast as native implementation (read opengl) . So, if your aim is to build a NFS type game, definitely it is not the right choice.
One more reason html5 is my favourite is, you can construct basic interfaces, buttons, forms, dialogs, scrolling pages using css and the same platform you can use for your game animation. If you are using webgl, you have to take care for everything.
I wrote a small puzzle game in html5 and tested it across many devices. Android Jelly Bean has the exceptional rendering performance. Same device (samsung galaxy s2), when runs on JB, shows significant performance improvement, in comparison when it is running on android Ice Cream Sandwich. But anyhow, it was managed to run on ICS.
Nightmare started after Google released the KitKat. Prior to this release, everyone was so delighted. The new WebView will be powered by chrome and we can see even more performance boost for html5 games. But it looks like, google is going backward with this new release of android. The html5 canvas for webview is not hardware accelerated anymore and shows extremely poor performance. This phenomenon is so widespread that it affects almost everyone who relies on html5 canvas rendering. Games stopped working, apps slowed down to their death.
There are several bugs raised. And there is no hope that they will be fixed in near future.
https://code.google.com/p/chromium/issues/detail?id=315111
https://code.google.com/p/chromium/issues/detail?id=239864
https://code.google.com/p/chromium/issues/detail?id=329108
Friday, December 13, 2013
Saturday, September 24, 2011
Document Translation using Google
Amongst many of google's incredible services, one is "document translation". Google provides a web interface to translate a document. But the constraint is, the translated document will be shown as a web-page and you can not get the translated document in your original binary format. This backlog prompts me to develop a desktop application which will exploit Google's translation power to translate a document, right from your desktop. Currently this software supports the below file formats:
Google Document translator is written in java and requires jre to run. This project uses
The software has a unique feature "HTTP Translator". Google provides api for language translation.The service is free but it has been deprecated. Google will stop the service completely after December 1st 2011. This deprecated api is replaced by a newer version, google translate api v2, equally powerful as its older counterpart. But, due to economic burden caused by extensive abuse ( as goolge says ) , they have made it as a paid service. So, I have come out with this tricky solution, "HTTP Translator". The translator uses simple http get post request and parse the response to translate a input text. As long as google continues their translation website, hope this http translator will work smoothly.
- doc
- xls
- ppt
- docx
- xlsx
- pptx
- txt
Google Document translator is written in java and requires jre to run. This project uses
- apache poi to handle microsoft office documents
- google-api-translate-java to call google language api from a java client
- dom4j for xml parsing
- jaxen for xpath
- itext for pdf support ( in Progress )
The software has a unique feature "HTTP Translator". Google provides api for language translation.The service is free but it has been deprecated. Google will stop the service completely after December 1st 2011. This deprecated api is replaced by a newer version, google translate api v2, equally powerful as its older counterpart. But, due to economic burden caused by extensive abuse ( as goolge says ) , they have made it as a paid service. So, I have come out with this tricky solution, "HTTP Translator". The translator uses simple http get post request and parse the response to translate a input text. As long as google continues their translation website, hope this http translator will work smoothly.
Saturday, March 26, 2011
Registering Jboss Cache with MBeanServer
Jboss Cache is an generic cache implemented in java and licensed under lgpl 2.1. Similar kind of implementations are also available from apache ( JCS - Java caching System ) and Oracle ( oracle coherence ). All caches are almost having similar features and provide enterprise-grade clustering solutions to Java-based frameworks.
JBoss cache is already being used in different enterprise solution and fully tested for robustness and performance. Though, a more powerful data grid platform "Infinispan" is already available from the same JBoss Community.
Here I will not go much details inside JBoss cache, as numerous tutorials/example codes are already available in net and JBoss also provides a very informative documentation for their cache. This blog will only cover a typical topic on how we can register Jboss cache with an Mbean server.
Before proceeding further, I will assume my reader has basic knowledge on JBoss Cache, Spring and JMX. Also, he should be able to setup the cache and run it successfully.
There are two ways to register JBoss cache with a MBeanServer
- Programmatic Registration
- Register as a spring bean
- Programmatic Registration
The following code is self explanatory. It will create a cache with default configuration and start the cache. Then it will register the cache with platform MBeanServer. The for loop will add an object to the cache in every 2 sec.
package com.ne; import java.lang.management.ManagementFactory; import javax.management.MBeanServer; import javax.management.ObjectName; import org.jboss.cache.Cache; import org.jboss.cache.CacheFactory; import org.jboss.cache.DefaultCacheFactory; import org.jboss.cache.jmx.JmxRegistrationManager; public class TestCache { public static void main(String[] args) throws Exception { CacheFactory factory = new DefaultCacheFactory(); // Cache cache = factory.createCache(); Cache cache = factory.createCache(); cache.start(); MBeanServer mbserver = ManagementFactory.getPlatformMBeanServer(); ObjectName oname = new ObjectName("jboss.cache:service=Cache"); JmxRegistrationManager jmxManager = new JmxRegistrationManager(mbserver, cache, oname); jmxManager.registerAllMBeans(); for(int i = 0 ; ; i++) { String fqn = Integer.toString(i); cache.put(fqn, i, i); Thread.sleep(2000); System.out.println("one node added : "+i); } } } |
There are several other ways to use createCache() api. Such as
Cache cache = factory.createCache("cache-configuration.xml");
cache-configuration.xml will contain the cache settings, such as cache modes ( local, replicated etc ), cache loaders, eviction policies. All details are available in JBoss Cache documentation and discussion about these cache properties are out of scope of this blog.
- Register as a spring bean
At first, lets see the Cache-Context.xml file.
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean name="ExampleCacheConfig" class="org.jboss.cache.config.Configuration"> </bean> <!-- Factory to build the Cache. --> <bean name="DefaultCacheFactory" class="org.jboss.cache.DefaultCacheFactory" factory-method="getInstance" > </bean> <!-- The cache itself --> <bean name="ExampleCache" factory-bean="DefaultCacheFactory" factory-method="createCache"> <constructor-arg ref="ExampleCacheConfig"/> <constructor-arg value="true"/> </bean> <!-- JMX Management --> <bean name="ExampleCacheJmxWrapper" class="org.jboss.cache.jmx.CacheJmxWrapper"> <constructor-arg ref="ExampleCache"/> </bean> </beans> |
Instead of drectly calling the new DefaultCacheFactory(); one bean is initialized DefaultCacheFactory. A factory-method createCache is called on this bean which in turn initializes our ExampleCache. Now CacheJmxWrapper constructor takes an Cache type object, which is being pushed by the tag constructor-arg. Custom cache definition can be configured inside the ExampleCacheConfig bean definition. Now your cache is ready and can be accessed using spring APIs acontext.getBean("ExampleCache");
package com.ne; import org.jboss.cache.Cache; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class TestCache { public static void main(String[] args) throws Exception { ApplicationContext acontext = new ClassPathXmlApplicationContext("Cache-Context.xml"); Cache cache = (Cache)acontext.getBean("ExampleCache"); for(int i = 0 ; ; i++) { String fqn = Integer.toString(i); cache.put(fqn, i, i); Thread.sleep(2000); System.out.println("one node added : "+i); } } } |
- JBoss Cache Statistics
JBoss Exposes various runtime statistics which can be viewed graphically through jconsole. The set of all available statistics are documented in cache userguide. A sample jconsole screenshot is attached below.
Some lifecycle operations (create/start/stop/destroy) on the cache can also be invoked through jconsole interface. Various details about the cache's current state (number of nodes, lock information, etc.) can be retrieved accordingly.
Subscribe to:
Posts (Atom)


