Posts

Showing posts from September, 2014

Tuning ActiveMQ for Performance

Recently I needed to optimize our ActiveMQ configuration for performance. Let me explain our deployment, we had a Jetty based Java app with GWT for the UI. We use gwt-ActiveMq with long polling to send messages to the UI. We were using activemq for everything, for out SM design, or async event listener architecture. We have no plans to scale from more then one box and for us the performance is critical. So things done were: Non-persisten messaging. Its atleast 20x faster. This can be achieved by: Set the NON_PERSISTENT message delivery flag on your MessageProducer. Set the  persistent=false  flag in the   element of the  Xml Configuration  or on the property  BrokerService . Remove the network. We used vm:// as transport so that the entire queue is in memory. No need to go over the network as our broker is embedded in the same context as the producer. You would have to change the broker address in the web.xml of the server as you won't get messages on the UI. Seria

How to configure google app engine when your site is deployed on Heroku and uses CNAME for naked domain?

When we configure Heroku App to our domain we configure it using CNAME records. This means two entry in our DNS records, one for naked domain or xyz.com and other for www.xyz.com. Now, if you want to receive mails over email ids configured with same domain with google apps, gmail then you need to configure MX records for xyz.com. Please see the previous post on this topic  . But there is a problem here, as CNAME record has higher priority, your domain wont return MX rule and always return CNAME rule and MX record validation would fail on the Google Domains page. So, how to solve it: Have A records entry if possible, with heroku this is  not possible. Remove CNAME record from DNS entry for xyz.com and configure google domain, naked redirect to www.xyz.com. Remove CNAME record from DNS entry for xyz.com and use Alias from Domian Control Panel. Remove CNAME record from DNS entry for xyz.com and use Domain Forwarding service for xyz.com to www.xyz.com on the Domain Control Pa

JS Event Bubbling Vs Event Capturing.

In Javascript or HTML DOM to be precise, there are two methods of event propagation, those are: Event Capturing. Event Bubbling. This defines the way event flow in case of multiple event listeners. Suppose you have a img  element inside a div element then and both have an event listener defined, then whose event listener should be called first? In case of event bubbling , the inner most elements event listener will be called first and it would be propagated out. So first the event listener of img will be called followed by the event listener of div element. In case of event capturing , the outer most elements event listener is called first followed by inner elements. So, in above example, div's event listener would be called first followed by inner most element that is img's event listener. The event propagation method can be selected by passing third optional boolean argument to addEventListener method of JS. The syntax is: addEventListner(event,event_h

Twitter typehead.js basic example with token field.

Image
A simple example for twitter typehead.js. The server should return an array of type: [ { name: "asas", value: "1234" }, { name: "asas", value: "121212" } ] Include following CSS and js: < link href = "http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel = "stylesheet" > < link href = "tokenfield-typeahead.css" rel = "stylesheet" > < link href = "bootstrap-tokenfield.css" rel = "stylesheet" >      < script src = "http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js" ></ script >      < script src = "http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js" ></ script >      < script src = "http://cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.10.4/typeahead.bundle.min.js" ></ script >       < script src = "bootstrap

Cafes around Indranagar and Koramangala for Work or Chill

Image
I found a nice discussion on PMIT with the requirements of Cafe suggestion in around Koramangala or Indranagar with following: 1. You spot less/same crowd lazing around the whole day.  2. You spot people hanging out with their books. 3. Bean bags around. 4. Lite music, bright light, decent Wi-Fi. 5. Nobody bothers to wake you up (even if you doze off   )  So I decided to put my own list: COSTA COFFEE, Koramangala Address: 80 feet, Road Koramangala. No bean bags. Has WIFI but unreliable. Less Crowded during Weekdays, very crowded during weekends. You can spots likes of Bansals of Flipkart fame at times here. Lite music bright light. One of my Fav to Work COFFEE ON CANVAS, Koramangala Address: 1st Cross, 80 Feet Main Rd, Koramangala 4 Block Bean Bags. Has WIFI but unreliable, Seems to get noisy on weekends and evenings. Light music, bright light. Good food. One of my Fav to Chill Atta Gallata, Koramangala Address: 134, 1st A Main Road KHB Co

Download playlist or songs from 8tracks.

Image
Many times I come across songs on 8tracks which I am not able to find from other sources. Little bit of googling and searching around, I didn't find a reliable way of doing the same. So, I decided to write a script for me to do that. For the benefit of larger audience, I have hosted it on one of my servers. You can access it from: http://beedio.com/8tracks.html Just go there an paste the 8tracks playlist url in the input field and press Fetch. Its a simple Js script which utilises the 8tracks apis to simulate the play of the song and allow a download or play link where the permissions are available. The urls to download or play individual songs would get listed. As it simulates play of song, so this script would take some time to go and fetch all the urls for download. Ideally, one should press fetch and then come back after few hours to the tab to see all the urls in the list. I have tried to follow the norms of 8tracks as much as possible, if any infringement of

Z-Index computed as auto even though it is set with a value on Chrome

This is a little known fact about z-index and usually missed.  If you read the article on w3schools then also you might miss this. It says: Note:  z-index only works on positioned elements (position:absolute, position:relative, or position:fixed). What this essentially mean that the element on which you are applying z-index, you need to have position attribute specified on it. Ideally use one of the above position values. If position attribute in the css style is not set z-index would be computed as auto. Google Chrome is quiet strict about this. Use a syntax like below. img  {      position:  relative;      z-index:  100; } Thats the reason, why many times we don't see z-index working on out elements.  Sources: http://www.w3schools.com/cssref/pr_pos_z-index.asp https://code.google.com/p/chromium/issues/detail?id=39426