Skip to main content

Posts

Showing posts with the label tutorials

Beginning with Android.

Got a new Android? This is the first place you should be looking at these tutorials . Online Search for Market Apps: If you are looking to search for market apps, and thinking that there no such online search tool? There may not be an official Google hosted online market replica, but appbrain.com gives one. Installing Apps: Most websites you browse on the laptop/computer, have what are QR codes (eg. shown below). These are like images that link to urls on other sites or market apps. So first you have to manually go to market place and search for " Barcode Scanner " and install an app by ZXing. From then, you can use the scanner to install various apps that can be looked up by QA Codes. This app can also get you product lookups (however there are specialised apps for that) Appbrains.com app: Appbrains has an app manager that can manage your apps, installing them and their updates. You create a profile online and all your installations are synced to your device. This...

java turorials: Learn everything Java basic to enterprise

Java Programming basics Introduction to Java programming   ServerSide Java Download Tomcat Demo - Servlets and JSP JSP Tutorial IBM JSP tutorial   Enterprise Java JEE 5 tutorial Develop Web services with RAD Part1 Part2 Crash course in Enterprise JavaBeans 3   Struts IBM Tutorial Apache Wiki (List of Tutorials)   Spring Viral Patel’s turotial Reference Documentation   Ibatis JavaLobby Introduction Apache Tutorial   Hibernate JBoss Tutorial    

Decorator for Memcache Get/Set in python

I have suggested some time back that you could modularize and stitch together fragments of js and css to spit out in one HTTP connection. That makes the page load faster. I also indicated that there ways to tune them by adding cache-control headers. On the server-side however, you could have a memcache layer on the stitching operation. This saves a lot of Resources (CPU) on your server. I will demonstrate this using a python script I use currently on my site to generate the combined js and css fragments. So My stitching method is like this @memize(region="jscss") def joinAndPut(files, ext): res = files.split("/") o = StringIO.StringIO() for f in res: writeFileTo(o, ext + "/" + f + "." + ext) #writes file out ret = o.getvalue() o.close() return ret; The method joinAndPut is * decorated * by memize. What this means is, all calls to joinAndPut are now wrapped (at runtime) with the logic in memize. All you wa...

OSGi: Starters Guide for Install, Update and Refresh Bundles

In OSGi, with a Bundle you could Install, Update or Refresh. There is a subtle difference in all these three. Just enough for a beginner to entangle the mind. To help, This post gives an a practical insight. I recorded the commands and thier out puts. To Begin with, Install puts a bundle in the framework runtime. It also records the file location (on FileSystem or URL). It doesnot start or resolve dependents on it. sarath@sar-akshaya:~/zbin/equinox$ ls bundles equinox.jar org.eclipse.osgi_3.4.0.v20080605-1900.jar sarath@sar-akshaya:~/zbin/equinox$ ls bundles/ FirstBundle-1.0.0.jar SecondBundle-1.0.0.jar sarath@sar-akshaya:~/zbin/equinox$ java -jar equinox.jar -console osgi> ss Framework is launched. id State Bundle 0 ACTIVE org.eclipse.osgi_3.4.0.v20080605-1900 osgi> install file:bundles/FirstBundle-1.0.0.jar Bundle id is 1 //Try starting osgi> start 1 org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Missing Constraint: ...

(NOT) yet Another Getting Started with OSGi

Last week I have been learning OSGi. I got my first application running in OSGi. I am not going to write another getting started post with code that will show a hello world. But rather give you an idea how to start getting in the mud. And then may be show you more than a direction :) I used Equinox 3.4 ( OSGi R4 ) implementation. I prefered it over Felix. Why - Eqinox is simple, and a single jar download. But I guess that aint a thing to notice. You can get Equinox jar from here . If the link is broken, go here , download the equinox framework, it should be ~0.95MB. Start equinox framework as java -jar equinox.jar -console You would have seen this on a lot of sites. but I did fall on two things flat on my face; missing -console and doing it wrong --console :P As per the spec, (and by now, you know ) a bundle is a jar with some special informtion in MANIFIEST.MF. A Bundle jar need not DO anything. It could just sit installed or be active (by exporting packages and services). So ...

classpath*: making your Modular Spring Resources

Spring gives multiple options to load XML resources for building contexts. the reference documentation does explain this feature quite well. However, I am taking my shot at explaining the different practical scenarios ( by order of growing modularisation) For Example, A simplest Spring based web Context Loader can be configured with resources like this <context-param> <param-name>contextConfigLocation</param-name> <param-value>applicationContext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> You just need to put applicationContext.xml in WEB-INF/ folder of your webapp. However, Typically an application is n-tiered. You can also have multiple files setup and in relative paths. like <param-value> context-files/applicationContext.xml context-files/dao.xml context-files/service.xml </param-value> ...

Java Object - wait - notify - a practical example

Object is the super class of anything in Java. But, Most people fear the wait and notify methods in Object. The common java practitioner might not need to use these for all practical purposes. However, the fear is not because they are hard to understand, but because of the assumption and false notion (generally pushed from the *experts* to the newbies) that these are for *super users*. The easiest way to understand this is by example. Most examples include Produce Consumer, But in practice where is this applied? Some time back I wrote about Commons Pooling . Ever wonder how an Object pool Implemention, like this one , would time out on a blocking call without creating a new thread on its own? It uses a wait - notify[All] paradigm. To understand that Look at the source code of the said GenericObjectPool . The borrowObject method (line 911 - so apt??) which optionally waits for a maxWait long secs, is used like for (;;) { synchronized (this) { // Some Logic try { if (_maxWa...

Using Java 1.4? Can't Use Webtools in Eclipse Ganymede?

At our new client, we still use Java 1.4 and I found that there is a problem installing Web tools in Eclipse 3.4 (Ganymede). The P2 Installer shows WST is installed, but I cannot see Server profiles, J2EE perspective, anything related to it. Here is what I installed, as shown in P2 But I cannot see J2EE related stuff in Perspectives, Preferences or New windows To resolve this, I installed a private 1.6 JRE. Started Eclipse with eclipse -vm c:\java\jre1.6\bin\javaw And it works!

OpenSessionInView Filter, Sessions, Transactions and Connections

By now, I have worked enough on OpenSessionInViewFilter , Hibernate and Spring in some projects. Hibernate 3 uses Lazy Loading by default . So, We use for maintaining lazy loaded collections to display in view. But, lately, as I mentioned in earlier posts, we were having some issues with connections that were not returned to pool. To understand where connections were held up we need to see how OSIVfilter, Session, HibernateTransactionManager and Spring work together - Where and when connections are picked and released. OSIVFilter guarentees that each request will have one and only one Hibernate Session. A Session is a lightweight abstraction of data in the database pulled into vm converted as objects. So for a session to fetch data from db, it needs connections. This connection is available from the datasource through a TransactionManager. In general, if you have one database, You would use Springs HibernateTransactionManager. A Session generally contains one Transaction. However, ...

Resource Contention in JEE for a layman

In terms of scalability, a frequent term used is "Resource Contention". Most commonly this means, there is a shared object, file handle, db connection, or similar for which Threads are trying to get ownership. Until they obtain this ownership they either wait or exit on a timeout mechanism. In normal flow, they simply wait - This state is called blocked state. In an asynchronous mode (generally meaning a spawned child thread), there can be a Time-Out flow that can be defined to control the maximum length of time the thread can take to complete a task. In a blocked state, There may be "Resource Contention" in one thread that is avoiding other threads to proceed. In a JEE environment, This Resource Contention is caused commonly by Transactions(, Synchronized blocks, Locks). Since User Threads are discouraged in JEE, Synchronized blocks and Locks are less often encountered as issues. That's theory. If you dint understand much, Dont feel despair. I come from the ver...

Cisco AnyConnect Client on Ubuntu fails on server certificate

I have vpnaccess to my work. I have been on Ubuntu after my upgrade to Hardy. But I have to go back to vista only for vpn. If I am able to connect to vpn in Ubuntu, There is hardly any reason to switch to windoze. First of all, I was able to install AnyConnect client using the webinstaller the same way I would in vista. But only to find an error after I run the client. then when you click ok.. it would go to.. and quit on me. I realised the client needs a vpn agent deamon. I checked the folder where it installed and started it manually (I guess the install script failed to put in init.rd or something.) /opt/cisco/vpn/bin/vpnagentd But it doesnot solve the problem. I still get a certificate error. And no.. This is not related to the host, as I can very well connect to the same host in Vista. I am looking up to my IT guys. Lets see what they come up with.

GIT Tutorial (s) - Move to Git today!

Last week I wrote about Git, Today, I installed git on my ubuntu. its fairly simple sudo apt-get install git git-core And then, since I am from SVN, I could directly use this svn to git tutorial. CVS users should also be able to comprehend this as it is not much different from SVN. Git is, for now, a CLI user's paradise. There is an eclipse plugin (in its snail pace development), which ironically needs a hell lot of process to get to install. But if you are like me, like more cli, get gitting © !! ;)

Equinox P2

Eclipse is moving more towards OSGi platform and very soon (in its next big Ganymede release), we will see how big a difference it is. Provisioning is the new Equinox platform for Eclipse installation, distribution and maintainance. Code named P2 this will replace the Update manager with more (desired) features . For starters, It will have shared plugin base, greater install and uninstall support for plugins, easier upgrade and managability. Keep it coming Eclipse.. Lots of Lov..

How to create a Professtional Free Website with Google Apps

GAE hosting is available for Everyone . (Is this the end of hosting providers?) This is very welcome for all those people who have an ambition to put a free website with no adgood features, reliabilty and scalabity. For Starters, - you have to know or learn python (it is the only language supported on GAE right now) or just get started - If you want your own domain name, You have to have one or you have to understand DNS , subdomains , CNAMEs , ANAMEs, MX records. Next, - Create an app in GAE (I will skip the whole tutorial on how to do it ) - Create a domain (buy it from a domain hosting service like godaddy - always keep hosting and domains in seperate places for better control) - Create a Google Apps Account (Again I will skip the whole tutorial ). - Verify your ownership of the domain and connect it to google App - Modify DNS MX Entries, set up your email. - Create Custom urls for services (calendar, docs, etc) with custom sub domains urls. - Add your GAE app in Google App Admin...

PNG on IE6 and back

I developed my new blog/site template on my vista box. I tested the site on IE7 and FF2. I was so happy the glossy looks, and shadow on the background and eye candy I was able to produce with minimal images. Little did I know that this was going to break (baadly) on IE 6 and versions before. Ok.. what happens is this . IE versions before 7 donot have capability of rendering alpha channel of png well. Microsoft did well in IE7 but the market still has those dirty 6s still (I said the same thing about 5.5 when 6 had earl releases - Microsoft is getting the optimist out of me..). A quick google resulted in The problem and possible solution(s) . Its too late for me to test that out now.. But You can see this is a very basic design element and I face so much heat because of MS. Clearly almost EVERY other browser on the planet has support for PNG. Damn you!! IE. Soon there will be Firefox every where. Good for us. Good for Designers and developers.

Dr.dobbs's June issue

I dint dissappear

Another off time for me on this blog. I have some good news and bad news. The good news is I got an invite to Google App Engine. Kewl ha.. But The bad news is I am SWAMPED with work. My project is due release this month end, we are running drill migration on the 10th, So I am unable to write often. For you to research on it, Here is what I am working on now. Hibernate Optimisation and Profiling applications with TPTP (requires registration) in eclipse. I will post some of my findings soon. Try to catch up.. byee..

JSP error-page and Internet Explorer

I hate Microsoft. You might have heard that a zillion times in the developer world, especially in the non-microsoft-technologies world. But yesterday, I felt like killing myself because of Microsoft's IE. Here is what is happened. I was writing an error page for handling a custom Exception in filter. <error-page> <exception-type>com.so.testapp.exception.CustomException</exception-type> <location>/error.jsp</location> </error-page> and the JSP has it simple too.. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <c:set var="cException" value="${requestScope['javax.servlet.error.exception']}"/> Got Exception : <c:out value="${cException}" /> This must be pretty darn simple but IE comes with this *Friendly* error page. I have had a nightmare trying to figure out why I dont get my message, Only to realise that there is 512k size threshold before which IE hi...

Good morning.. and Welcome! Ubuntu Hardy Heron!!

The most awaited release of Ubuntu Hardy Heron (8.04) is just around the corner . I have a Lenovo with Vista Home premium and Ubuntu Gutsy Gibbon. I have had problems with my ubuntu install, however, I still cherish having a linux distro on my system. With Heron, things are going to take bigger tangential. I shall spend my weekend putting my Laptop to Heron. But if you are eager to check out some reviews they are here , here and here . People have had been speculating how this version is taking linux to masses . It may be still discussed if it is, yet, but I am sure days are numbered. ps: fosswire has a ubuntu cheatsheet for the budding and the enthusiasts

Keep your eyes open for XSL-FO

What happened yesterday was funny, I forgot to switch the electric on my name after the move and LIPA disconnected my power. Having realised that only in the evening, I call them up. I spoke to the manager only to get a negative response. So they need at least 24 hrs for reconnection. I hope I will it today by the time I reached home. Coming back to technology, After some research on multi-cores and java language features, I took a shift to work on some XSLT and XSL-FO. While I have extensive work on XSLT, I am just getting my feet warm on XSL-FO. In my research I found a Nice tutorial here . While I get a feeling FO is not yet a big time standard, but the paradigm, itself should take it to become one. Having one XML to generate different file formats is very effective. Keep your eyes open for XSL-FO. Leave comments in Guestbook