Skip to main content

Posts

Showing posts with the label developer

Add jquery in Chrome console

Many a time, a page you are debugging doesnot have jquery. This simple js will add(or prompt you to overwrite) jquery to any page from chrome console. javascript:if(!window.jQuery||confirm('Overwrite\x20current\x20version?\x20v'+jQuery.fn.jquery))(function(d,s){s=d.createElement('script');s.src='https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.js';(d.head||d.documentElement).appendChild(s)})(document);

Enable alwaysUseFullPath with mvc:annotation-driven

mvc:annotation-driven doesnot have alwaysUseFullPath attribute. However, in instances this is needed, adding the following bean BEFORE mvc:annnotation-driven tag will set up the alwaysUseFullPath correctly <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" id="handlerMapping">         <property name="alwaysUseFullPath" value="true"> </property></bean> So the fuller xml should like this <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" id="handlerMapping">         <property name="alwaysUseFullPath" value="true">     </property></bean>  <mvc:annotation-driven>   <mvc:message-converters>    <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">     <property name="objectMapper" ref="jacks...

Groovy Camel Processors

Fuse ESB 7.0 comes with Camel 2.9 components. Camel has groovy support from 2. 8 9 to create predicates and expressions. There is a GroovyRouteBuilder in 2.9 that lets you build dsl in groovy, albeit with java api. This is especially un-groovy when you have to write a .process .

Appcache manifest file issues/caveats

Application cache (appcache) is a powerful feature in HTML5. However, it does come with baggage. Many (see links below) advocated ferociously against it due to tricky issues it comes with. For someone who is just testing waters, these issues may throw them off grid. Knowing them before hand helps reduce some unpredictable effects.

3 reasons to migrate to Disqus commenting platform

Over the last weekend, I evaluated DisQus commenting platform. I saw compelling reasons why Blogger's default commenting is primitive in comparison. Today I am launching DisQus on this blog. Here are 3 most important reasons that made this decision easy.

MySql Copying Table Structures.

Some times you need to copy only table structures across databases. This article describes two ways of doing it. If the whole database schema need to be exported, mysqldump is very effective. A --nodata flag will dump all tables' schema. Like this. mysqldump --nodata -p -u username databaseName But if you want to copy a specific table, individually, you could use "create table like" feature. You could create it even from a different database. However it must be on the same mysqld instance. Like this. create table newtable like oldtable; --Or from a table in other database create table mytable like otherdatabase.tablename;

Developing Userscripts for Chrome (caveats)

To develop Chrome extensions, crx is the best way. But the user scripts that are developed in general for Greasemonkey can also be delivered for Chrome, if a few easy rules are followed. 1. @required and @resource don't work. By default, atleast for now, These two Userscript metatags donot work on Chrome. If you need to load a js file, instead of using @required - try to use document.createElement. Similarly with @resource. 2. Some GreaseMonkey helper methods don't work or are restricted. Methods with GM_ prefix from userscript api may not work. Particularly, unsafeWindow, GM_registerMenuCommand, GM_setValue, or GM_getValue are not supported. GM_xmlhttpRequest will work but not only on the same domain. 3. @include s are not shown while installing. This may not be a deal breaker for developers, but sure is for users. The patterns used in @include is not shown while installing. Instead a generic message is shown as below. This message may scare the users away. ...

Reduce Yahoo mail neo header space for more room

Update: Yahoo mail with new layout renders this obsolete. The newer Yahoo mail beta (neo) really is a faster UI. However, The large header with room that is unused is a let down.  This one time, it appears that, Yahoo did not take into account the importance of real estate on top of the page, hitting User Experience. Reduce Yahoo mail neo header space for more room by installing SarathOnline's " Spacier Yahoo Neo " userscript below Install YNeo UserScript by SarathOnline Before: After: The user script is fairly simple. You could install it in Firefox as a Greasemonkey script. Or install it on chrome directly. If you are new to UserScripts, follow these instructions to install them on your browser. Be assured, it has no malicious code. All it does is install a correcting css to the document. The css file is located here .  And the script itself. (function(){ var d=document,sid='__sar__yneo', fn='http://www.sarathonline.com/dyn/sfs/userscripts/y...

Installing Userscripts in Firefox, Opera, Chrome

Want to install a userscript on your browser. Go no further. Here are simple instructions and caveats for installing Userscripts in Firefox, Opera, Chrome. If you want to author your own scripts, here is a beginner's tutorial .

Writing your first UserScript, Template as a beginner's tutorial

UserScripts are fun, useful and often productive . A lot of sites have small improvements you think could add a lot of value. And just because you are not the author of the site, you need not give up. With some basic javascript skills, you could write a userscript, install it on your browser, and make the site behave.

Custom SarathOnline Web Search Engines

For a long time this was due. Here it is, finally. If you think this site has ever been helpful, please consider installing and using the Search engine from SarathOnline on your browser. This will help us offset the maintenance cost. Thank you. Updated! May 29, faster search, with more options..

Looking for alternative to Google App Engine? Wait!

The recent news about Google App Engine has taken the developer community by a surprise. There is a lot of hue and cry. Some have claimed that they have been betrayed, lost trust. Some even thought the rug got pulled out from under them. Some have even warned this as Google's biggest mistake that could cost them dearly. But is it really that big of a deal? How much of this is a concern?

Tips for Chrome developer tools

They say if you don't have Firebug you are not a developer. But Chrome developer tools, is just as sweet developers in chrome. Firebug is a very powerful tool in itself. Chrome dev tools adds a few more features that make it a pleasure to develop on chrome. Here is a quick video that may have your head turn to Chrome.

cssh, PuTTYCS - keyboard replicators for clustered administration

If you administer a bunch of identical Linux boxes, and have to run same commands on all of them, say like manual deployments, restarts etc. – you probably log in to each of them manually and run commands. Or at best you would have a script looping through them and executing an ssh on each. However there are times when you need to be interactive on each box, yet run the same and/or series of commands. In those cases, cssh on Unix (with X) and PuTTYCS on windows are a godsend for any administrator.

Coming soon: Blogger 2011

Big news for AppEngine - AlwaysOn Instances

Finally, AppEngine team got us the best gift of all for this holidays. AppEngine 1.4.0 , Always-On Instances and more. And Just $9 a month buys you 3 instances that can stay alive – even on low or no traffic. Those sites you want to host on spring, or even grails – which left you worried about darn bad startup times – You can host now with AppEngine worry free. Also, Channel API is a new introduction. Gives an asynchronous real-time two way communication mechanism with JavaScript enabled clients - aka Browser Push (Comet) communication. It would be interesting to see the ideas people will come up with. Google lifted/increased a few limits on different APIs  to somewhat gracious levels. These may not be significant for most apps, but will definitely free your mind of concern

Import Mysql data (or a CSV file) into MongoDB

You have MySQL database. And want to move either all, or some of the data into MongoDB. There is no direct way to do it, as such, It can be done in two steps. (If you are here because you have a csv file instead (or directly) move on to Step 2.) Step 1. Export all of your MySQL data as a CSV file. select columns INTO OUTFILE ' /path/to/csv ' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' from table [ where clause ] Step 2. Import the CSV into MongoDB. Assuming you have MongoDB running (on local, defaults) run the following command mongoimport -d dbname -c collname -type csv -f fields-sep-by-coma --drop /path/to/csv if your csv file has a header row add --headerline . p.s.: for more options on mongoimport look here More tips on mongodb, coming

Use E-Tags and Cache-Control: Caching your Dynamic web Content Better

This site rendered js and css (now even images) dynamically. Contents of files are stored in Google BigTable Datastore and are served by a DynServlet. The DynServlet maps the name of the file to content of the file in DB. This was slowly using up a lot of resources. Adding a layer of memcache, saved some Datastore API calls. But the memcache calls were still significant. So an ETag mechanism is introduced. A Global ETag is generated on any file posted or updated, and (G-ETag is) stored in Datastore. To save App Engine resources (which are counted to cost), the ETag header is obtained from each request checked with GDTS from backend. If it is the same a "304 – Not Modified" response is sent back, asking the client to use the local cache copy. If it is not exactly same, a the request is passed through and rendered dynamically. This guarantees all content will be served fresh after every deployment. Requests in between deployments may be served from client-side cache, because ...

MySQL > java.sql.SQLException: Error writing file '/tmp/MY1kynpA' (Errcode: 28)

Recently, a heavy burst of traffic into our production webservice caused this error. As with all Mysql errors, this shows little information. Like any sane person would think, we checked if the filesystem was full. We found the /tmp has 98% free space. Permissions are all fine. No locks on table. Increasing /tmp partition - NoGo. Just crazy error message. However, the issue was beating us time and again. It took us a couple of days and we realized the cause was a select query. The query was fetching from a table of about 2 million records. Although it was fetching a limited subset, the column in the order by had no index. This was causing mysql to load records into pagefile in tmp for sorting, apparently. Created the index on the sort column seemed to have solved the problem. We also augmented it with the following options in my.cfg sort_buffer_size=2M table_cache=1800 thread_cache_size=384 tmp_table_size=64M

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