text:
Matt may be number one but it's the songwriters who'll cash in. . .
One hit song could generate enough royalties to last a lifetime, says John Meagher
Three months ago, Matt Cardle was just another pop wannabe. Now, he's enjoying a Christmas number one in the UK, having outsold Rihanna four-to-one, and the X Factor winner is expected to hit top spot when the Irish chart is revealed tomorrow.
With sales of his single, 'When We Collide', close to 500,000 on both sides of the Irish Sea, one would be forgiven for assuming that he will be rolling in the cash. But it's likely to be some time before the former painter and decorator sees serious money.
Instead, Scottish rock outfit, Biffy Clyro, will enjoy a Christmas to remember. As songwriters of 'Many of Horror' -- as the song was originally called -- it is they (and not Cardle) who will pocket royalties from sales, airplay and live performance. Estimates suggest they will make a six-figure sum in the short term, with substantial royalty cheques likely to appear in their letter boxes for years to come.
Royalties safeguard the interests of the songwriter, rather than the performer, and it's a system that dates back to the 19th century, when sheet music first came to be seen as a source of revenue.
Today, 'royalties' is a far-reaching term that covers everything from the portion of album sales an act can take, to payments accrued from radio play, from live performances, to a ringtone.
Not only will Biffy Clyro make money on Cardle's single sales, they will also take a cut whenever he performs the song live, or whenever it's played in a public place.
Agencies worldwide -- including our own Irish Music Rights Organisation (IMRO) -- are charged with ensuring that royalties are paid out.
According to Keith Johnson of IMRO, 7,500 Irish "members" -- aka songwriters / composers -- receive royalties. The payments vary from the U2s of this world to a fledgling band who might have had a song played a handful of times on radio.
At the upper end of the scale, royalties are worth millions when one factors in album sales and A-listed radio play.
Consider Brendan Graham, a songwriter from Nenagh, Co Tipperary. His name may mean nothing to even the most avid music fan, but he commands enormous royalty cheques with one uplifting song in particular, 'You Raise Me Up', ensuring that he will have no financial worries for the rest of his life. That ballad -- co-written with Norwegian songwriter Rolf Lovland in 2002 -- has been recorded by more than 400 artists, with versions from Westlife and Josh Groban selling enormously.
"Brendan has made millions from that song," says Westlife manager Louis Walsh. "The money is in the songwriting and that's where all the clever people are to be found: they get the wealth but they don't have to deal with the pressures of fame."
And royalties continue to be paid to a singer's estate when they die. The protagonist of Nick Hornby's novel, About A Boy, lives a gilded life thanks to royalties from a Christmas song written by his late father. Such a scenario is highly plausible when one considers the monies involved for songs with a long shelf-life.
In June, the estate of the late-Bing Crosby were paid $2m in royalty fees for the previous 10 years -- on top of the revenue already received during that time. The estate had been in conflict with the world's largest record label, Universal, over unpaid royalties and had successfully sued.
Unsurprisingly, when one considers the money involved, royalty payments have led to numerous disputes. In 1997, after years toiling in the margins, The Verve enjoyed a breakthrough hit with 'Bitter Sweet Symphony'. But the experience would be bittersweet -- the song, and accompanying album, Urban Hymns, sold by the truckload, but it was the Rolling Stones who pocketed all the royalties from the track because it featured an orchestral sample of the Stones' 1965 composition, 'The Last Time'.
Some years later, Keith Richards was asked if he thought the Stones' had deserved to receive all the royalties and he was unrepentant. "I'm out of whack here, this is serious lawyer shit. If The Verve can write a better song, they can keep the money."
At the other end of the scale, royalty payments can be low. A Dublin act who signed to EMI last year, received a cheque for just €45 based on the previous six months' radio play. Yet, a coveted support slot at The O2 saw them receive €5,000 in live royalties.
Their album, which retailed for €15, saw them receive a 20% cut -- €3 per unit sold. "It's not exactly big bucks," their manager says.
"We've been lucky on the live front -- you wouldn't want to be relying on Irish radio. They're too conservative to play local bands, no matter how critically acclaimed they are."
Meanwhile, Matt Cardle's earnings will be bolstered by live performances, merchandise and product endorsement. But if he wants to capitalise on royalties, he will need to hone his songwriting skills -- and quickly.
Irish Independent


text:
UDALL CONTINUES FIGHT FOR LINE-ITEM VETO SLICE bill aims to rein in wasteful federal spending
Congressman Mark Udall (D-Eldorado Springs) today reintroduced legislation that would give the president the line-item veto authority to cut wasteful spending in the federal budget.
The bill, H.R. 595, the Stimulating Leadership in Cutting Expenditures (SLICE) Act of 2007, is similar to legislation Udall has championed for two years. It authorizes the president to identify specific items of federal spending that he thinks should be cut and requires Congress to vote on each of those items. Unlike the version of the line item veto that was struck down by the U.S. Supreme Court in 1998, SLICE is constitutional because it maintains Congress' power of the purse by requiring congressional approval of all the president's proposed cuts.
"The federal budget is awash in a sea of red ink and towering piles of debt. Since 2001, the budget surplus has been erased and our country in further in debt. I think it is immoral to pass this load of debt onto our children and grandchildren. My bill gives the president the power to cut wasteful spending from the federal budget and it would force Congress to debate those items on their merits," said Udall. "People in Colorado and across the country expect greater transparency and accountability from their elected officials and our decisions on spending. That is the purpose of this bill. It will promote both transparency and accountability, and Congress should pass it soon."
Last June, the U.S. House passed H.R. 4890, The Legislative Line-Item Veto Act of 2006, by a vote of 247-172. Udall was the chief Democratic cosponsor of the bill and worked with the White House to garner bipartisan support for it. In the end, 35 Democratic Members of Congress voted for the bill. Udall is cosponsoring similar legislation in the 110th Congress.
Also, earlier this year the U.S. House restored PAYGO rules which require that all tax cuts and programs to be paid for in order to stop any new deficit spending and it enacted earmark reform. Udall supported both measures and said that line-item veto legislation is still necessary to erase wasteful spending.

subset: commoncrawl


text:
Welcome to the Builder & Engineer Awards 2016
Who we are
Celebrating its 13th anniversary, The Builder & Engineer Awards is one of the largest and most established awards programmes in the sector – providing the ideal platform to recognise the best products, projects, companies and individuals.
The awards are judged by an independent panel of industry leaders and are organised by Builder & Engineer Magazine – the leading national magazine title which circulates to 30,000 construction professionals.
Thank you for everyone for making this years event a huge success.
Held at The New Main Stand, Anfield – 30th November 2016
This years guest speaker
Sir Geoff Hurst MBE
Former England international footballer. He remains the only man to score a hat-trick in a World Cup final as England recorded a 4–2 victory over West Germany at the old Wembley in 1966.
and your host
Neil Fitzmaurice
Liverpool born actor, comedian and writer. Best known for his acting role as Mark's love rival, Jeff, in the Channel 4 sitcom, Peep Show. Who has written for a number of other shows, including Peter Kay's Phoenix Nights (in which he also starred) and Benidorm.
This year's charity
The Lighthouse Construction Industry Charity gives financial help to thousands of families, plunged into financial crisis when they lose their breadwinner's income through illness, injury or death. Our team works to assess how best we can help the families of these construction workers, providing them with financial assistance until they can get back on their feet.
Who is attending
500 of the industry's key movers & shakers comprised from:
• Architects
• Main contractors
• Civil & structural engineers
• Surveyors
• Specialist sub contractors
• Commercial/ retail/ transport developers
• Local gov/ health/ education authorities
• House builders
• Housing associations
The Builder & Engineer Awards are some of the most revered and established in UK Construction. Having launched in 2004, the Builder & Engineer Awards is now in its 13th year and will continue to reward the hard work and creativity of those working in the industry. Of course, the industry has changed since those early days and the awards have evolved alongside to reflect those changes with categories like Apprentice/ New Starter, Rising Star and Corporate Social Responsibility Award.
We look forward to seeing you next year.


text:
My Nonprofit Reviews
Rose M.
Review for Bridge Communities, Glen Ellyn, IL, USA
As a recipient of Bridge Communities, I can truly say that this is a phenomenal organization. When my children and I were at our lowest point in life, Bridge was there to pick us up again. It is so amazing what a group of caring people can do to help others in need. They changed our lives. The mentors that chose my family were the best anyone could ever wish for. I have learned so many valuable life skills, like managing personal finances and living on a budget. Nowadays, I advocate the importance of education, volunteering and financial training for college students. My life was totally transformed by Bridge and today I volunteer for the organization by helping others in the program. In order to repay all the good Bridge has done for my family, I try to help out in any way possible. Bridge Communities truly bridged the gap to make my broken home whole again. I really believe in this organization, it is God sent.
More Feedback
I've personally experienced the results of this organization in...
Bridge Communities offered so many opportunities for me to further my education, seek better job opportunities and to better my finance situation. All this afforded me the opportunity to be able to take care of my family emotionally, physically and financially.
If I had to make changes to this organization, I would...
Compel others to volunteer and encourage more organizations to sponsor families.


text:
While stocks last.
Excellent news. General Pants Co. is having a sale.
From this very second you can score up to 60% off GP's brands, including OneTeaspoon, Ksubi, P.E Nation, Neon Heart, Stussy, Zanerobe, RVCA, Insight and more.
Discounts are running in-store and online, so you're officially out of excuses.
General Pants Co. 'It's a Miracle' Sale
In-store and online
While stocks last


text:
My Simple Cast Iron Care Routineby Ann Timm
Written by Shannon, Contributing Writer For so long I avoided cast iron because I was intimidated by the seasoning and care process that I had read about. Then my husband came home and surprised me one day with a cast... Read More
Explore the Keeper of the Home CollectionHomemade/DIY Real Food Healthy Living For Women Keeping the Home Family Life Do It Yourself Natural Remedies Recipes
Have a Question? Ask Ann!


text:
Judith Maxwell is the former chairman of the Economic Council of Canada and former president of Canadian Policy Research Networks
Michael Porter has done it again. Over the past 30 years he has built a strategic model for superior business performance, inventing concepts like the value chain, economic clusters, and competitive advantage.
Now, he's reinventing capitalism in the lead article to the January-February issue of the Harvard Business Review. The Big Idea is 'shared value', which stresses the synergies between economic and social development. The new ingredient to drive the next wave of innovation and productivity growth is collaboration.
"While some shared value opportunities are possible for a company to seize on its own," he says on page 17, "others will benefit from insights, skills, and resources that cut across profit/nonprofit and private/public boundaries."
All these sectors will need to overcome the deeply entrenched assumption that there are tradeoffs between economic efficiency and social progress or between economic efficiency and sustainable environmental practices.
Businesses must reconnect company success with social progress. Shared value is not about redistributing existing value but about expanding the total pool of economic and social value. Fair trade for cocoa farmers in Ivory Coast can increase farmers' incomes by 10 to 20 per cent, while investments in the supporting cluster of services and infrastructure can raise their incomes by 300 per cent, the report suggests.
Another term used for this kind of investment is 'impact investing'. Dr. Judith Rodin, President of the Rockefeller Foundation, says: "When I talk about impact investing, I'm talking about [a] double bottom line. You want a financial return but you also are looking for a social or environmental return as well."
The Foundation has nurtured a network of organizations to develop the metrics needed to support this kind of investing. IRIS -- Impact Reporting and Investment Standards -- will soon release benchmarks for social impact measures. Meanwhile, the Global Impact Investment Rating System (GIIRS) could become the Moody's rating service for these cross-sector investments with the double bottom line.
So markets are preparing for shared value initiatives. But government regulations can still get in the way.
The current ethos of regulators at the Department of Finance and the Canada Revenue Agency is to protect the tax base by preventing charities and nonprofits from generating earned revenues (which are not taxed) to achieve their social mission. This puts a lid on nonprofits' capacity to generate much greater economic and social value that will be taxable in one way or another – if not through the corporate income tax, then through personal income tax or the GST.
Take the drastic shortage of affordable housing, for example. Governments today are up against the fiscal wall and private markets see no profit in building affordable housing. Yet, there are nonprofits able and willing to fill the vacuum, if only governments would break down the regulatory barriers. The menu for policy change in Canada has been set by the recent report of the Social Finance Task Force.
The catch-22 here is that markets move fast when they spot a new opportunity while governments move slowly. Michael Porter's Big Idea should help to generate new thinking in both federal and provincial regulation.


text:
sell coal crushing machine russia
mobile crusher for sale philippines coal russian
mobile crusher russian . mobile crusher for sale philippines coal russian. How About mobile crusher for sale philippines coal russian ? lead ore mobile crusher for sale philippines coal ...Read More
coal crushing machine laboratoy coal russian
coal crushing machine laboratoy coal russian. ... From Lab Pulverizer and roll crusher to jaw crusher and coal jaw crusher, we manufacture a wide range of quality material testing equipment. Get More Details; ... stone crushing equipment, ...Read More
russia earth crushing machine
Fullers Earth Crushing Machine, process crusher, mining ... Rock Crusher and Coal Mining Equipment to Russia. ... Construction Equipment,Soil Crushing Machine,Earth Rammer Machine ... Maps/Google Earth NASA World Wind Gold Macros Aqua Regina Newsletter Buy me a Cold One ...Read More
Crushing Machine For Anthracite
anthracite coal russia Promotion,Alibaba. ... Anthracite coal ASSH-UHG 0-13 Russia Anthracite Coal Crusher Machine. Get Price Online; Buy Bosch MUM46A1GB Food Mixer Anthracite, Black from our . Buy Bosch MUM46A1GB Food Mixer Anthracite, ...Read More
Crushing machines Dealer in Russia-Stone Crushing ...
Crushing machines Dealer in Russia; crusher for sale used in mining industry with plant, ... Related Articles to coal mines dealer in quetta . coal crusher machine price. Contact . For product . mega mining equipment sales botswana ...Read More
sell coal crushing machine russia
Sell Coal Crushing Machine Russia; small powder grinding machine coal russian. small powder grinding machine coal russian. ... Magnetic Separator For Sale Supplieraggregate crusher sales in russia(1); highway construction crushing plant for ...Read More
russian manufacturer of crusher
coal crusher equipment in russia. Coal Crusher,Coal crusher manufacturer,Coal Crushing Plant Coal crusher is the flagship product of , and coal crusher is widely used ... >>GET MORE. Russian Stone Crushers,China large mining machinery ...Read More
hazard of crushing machine coal russian
hazard of crushing machine coal russian. ball crushing, quartz crushing plant... 0 40mm crushed stone loose and comapcted factor table, paleontology of the greenhorn cyclothem; 1 CGM 100 120 mobile crushing and screening plant 418000, hp cone ...Read More
where to get price of crushers coal russian
used crusher machines from italy coal russian,used crusher plant in italy, stone ... get price. simply complete the form below, click submit, ... ... buy crusher russia. concrete crusher. coal mill. belt conveyor. artificial sand making machine. ...Read More
Used Coal Crusher For Sale,Crusher USA
grinding machine, coal crusher, wet grinder, ... Used Heavy Equipment from Japan, Coal Trade from Russia. TOSEI. We believe, ... Small Jaw Crusher For Sale, You Can Buy Various High Quality Small Jaw Crusher For Sale Products from Global Small Jaw Crusher For Sale Suppliers and Small Jaw ...Read More
sbm crushing machine dealer in russia
metallic silver crushing machines coal russian. ... SCM impact crushing plant machine used in India is very high crushing speed and it can be used as the dealer sell cone crusher in >> Get Price; cone crusher manufacturer russia.Read More
russia nickel ore crushing plant
Antimony Ore Crushing Machine, Russia and South Africa are the worlds major producers of antimony. ... the copper ore for sell in the russia Coal Surface Mining. ... newsprint mills in russia Coal Crushing plant.Read More
private coal mining crusher companies in Russia,Mobile ...
Jaw Crusher; Cone Crusher; Impact Crusher; B Series VSI Crusher; ... List of Coal Mining companies in Russia Add your free listing . Russia Related industries Any ...Read More
crushing machine manufacturers usa russia for sale price
Home>>Case Line>crushing machine manufacturers usa russia for sale price. ... stone crusher machine for sale, stone crushing plant ... Buy glass drills, grinding belts, grinding discs and other consumables online. ...Read More
russian supplier stone crusher
Crushing Plant In Russia Jaw Stone Crushing Machine,Sand ... ... Crusher Manufacturers In Russia. coal mill manufacturers in russia coal processing plant . ... Stone Crusher Dealer,Stone Crusher Dealers In India, Buy Stone Crusher... mining equipment in russia federation .Read More
american spec crushing machine coal russian
russia coal and the environment,YouTube. Apr 9, 2015 ... russia suppliers miners steam coal exports , hammer crusher coal russia -china , sell coal crushing machine russia , Coal Mining In Russia , russia ... the United Kingdom and the United States of America,July 2012 to reflect ...Read More
sand crushing machine in india « coal russian
sand crushing machine in india Description : Sand Making Machines, ... Sand Making Machine Buyers & Suppliers, Buy and Sell Offers. ... Manufacturers of mining machinery, sand making machinery, coal briquetting machinery, crusher. sand making machines, ...Read More
Ballast Crushing Machine In Kenya Coal Russian,Mining ...
Ballast Crushing Machine In Kenya Coal Russian Picture And Text Informations. Reject Iron Sheets For Sale In KenyaYouTube. ... Equipment For Railway Ballast Production Coal Crusherrail Track Ballast Crushing . Ballast Crusher Buy Various High .Read More
Stone Crusher Manufacturers in Jaipur India,Coal Crushing ...
There are many stone crusher manufacturers in Jaipur India. ... Efficient Coal Crushing Machine in Pakistan; ... Crushing plant for coal mining in Russia,Mobile coal crusher machine;Read More
quarry equipment from russia-Stone Crushing Machine Suppliers
quarry equipment from russia; ... USA, Australia, Russia. Quarry Equipment,Buy Quality Quarry Equipment from . stone crusher and quarry plant in Shakhty, Rostov, ... process crusher, mining . Equipment Used In Quarry Malaysia . for example Russia, Canada, UK, ...Read More
crushing plant manufacturers in south Russia,Mobile ...
Russia Silica Sand Washing Machine Manufacturers, Used crushing... Russia Silica Sand Washing Machine Manufacturers. ... You can see a lot of silica sand washing ...Read More
Next Post: cement production in india


text: If anyone is interested in doing this. Here is some info on Optronics, the company I went with. They can be found here. Here is what you will need MCL-65AB Amber Clearance lights (2x) $5.04 (6 diodes) MCL-65RB Red Clearance lights (7x) $5.04 (6 diodes) MCL-65ARB Amber/Red Fender Clearance Light (2x) $6.39 (6 diodes) STL-70RB Stop/Turn/Taillight (2x) $20.35 (48 diodes) LPL-41CB License Plate lights (1x) $8.97 What you don't need You don't need the the mounting bracket/Grommet or plug if your trailer already has it. If it doesn't then you will need those items and the price will change a little. If you would like to compare or see there LEDS look here Here is a pic of my trailer. Be sure to count your lights b4 making a purchase PS I will post pics later in the week when the weather permits


text:
Suicide bombers are some of the worst human beings. They willingly lay down their lives just to kill innocent people. I really can't help but feel bad every time these terrorists make it to the news. It usually means they've done something horrific again.
This news, however, is different because hearing it actually made me say "job well done" – and I said that out loud!
Taken in a war zone in the City of Raqqa in Syria, the footage below shows us that moment when a suicide bomber tries to attack a group of Syrian rebel soldiers but fails along the process as he accidentally detonated his suicide vest.
In the video, a group of Syrian rebel soldiers can be seen engaging in a firefight with ISIS.
A suicide bomber cautiously approaches them from the corner of a building.
Things didn't go as planned, however, after he accidentally detonated his suicide vest a little earlier.
Fortunately, the failed attack only had a casualty of one – him!
You can watch the video here (WARNING: Graphic Content):
ANF News, a Kurdish news organization, uploaded the video on their website and it has since gone viral. In their report, ANF News also mentioned that eight suicide attacks by the ISIS militants have successfully been thwarted recently.


text:
iPhone X review
computer starting problem
my friends computer wont start. screen shows a number of options like safemode, bootup, configuration(last good starting),etc.
when i they these option, they dont work, so i return to the same screen.
Could someone please help
Thank you VoG for the interesting XP repair thing. I did insert XP disk and this came:'The BIOS in this system is not fully ACPI compliant visit wwwhardware-update.com for an updated BIOS.If you are unable to obtain an updated BIOS or the latest BIOS supplied by your vendor is not ACPI compliant you can turn off ACPI mode during text mode setup. To this simply...F7 key when you are prompted to install storage drivers.The sys will not notify you that the F7 key was pressed and it wll silently disable ACPI and you to continue installation.'.Computer stalled.Meanwhile friend took computer to repair shop and computer startup worked. Brought home it didn't. HD okay 9gig remaining from 40, floppy though not working.You think she inserted a problem disk. New floppy drive reqd.But I dont know why computer starts at shop.They're however putting hd up for a complete test.Liza
That sounds as if the PC is not capable of booting from a CD. You can do a repair if you start with a set of floppy disks click here follow the on-screen instructions and insert the Windows CD when prompted.
If this did start at the shop, it may lead to where the root problem lies,
The first question is did you see it working ?
did you just take the base unit or full system.
If you only took the base unit and it worked the problem could lie with what you Have connected,
Moniter,modem,mouse,keyboard, speakers etc,
If you have spares connect them and try again, you could also try useing safe mode command prompt.this will allow you to see just whats causeing the problem
Or going into setup reset everything to default and save before closeing
You indicate that this is useing Xp If its useing another operating system an XP disc wont work By the specs this sounds an older system
The floppy could be the cause its either faulty or not pluged in if anyones had the case open so untill this is fixed VoG suggestion of useing floopies wont work
Thank you once again VoG. My friend was very desperate because the computer still didnt work (her daughter wants to do exam on it) so they finally got somebodyliving close by and all he did was press F8 several times and the thing came on. He also noticed that the back of computer was heating up there was also dust clogging up the back.He advised to turn off computer after use (which daughter never turns off). Meanwhile she can use computer.He will come thursday to repair. What is this heating up thing. I check the heating on sys, cpu, fan and remember they were 43, 34, etc nothing in comparison with mine which is 60 70. The computer is intel 4, 256 mem, 40 gig hd, shop said 9gig left. Liza
This thread is now locked and can not be replied to.


text:
Publix Italian Days are going on still this week, and so many of have been asking how I've been getting so much for so little, I thought I'd share a quick video explaining the phenomenon 🙂 Keep in mind, this is just one deal scenario. Make sure you grab the special Publix Italian Days coupons in the front of the …Read More »
Home » Tag Archives: hunts
Grocery Deals
To be honest, I'm not finding a lot of great grocery deals out there this week, and after the Triples at Kroger and Harris Teeter last week, I think I can take a few days off! (at least until I find out what the Penny Item is at Publix this weekend!) If there's something you're looking for specifically, visit The …Read More »


text:
- Please select a date to see the proper prices!
Description of the Accommodation
Rooms, services 21 comfortably furnished rooms are offered by Lord Nelson Motel Kingston to guests looking for accommodation in Kingston. You can find the exact list of services provided by Lord Nelson Motel Kingston (including those for extra fees) and the exact equipment of the rooms on the information sheet below.
Payment Depending on the selected date, room and price, you may need to provide credit card guarantee or advance bank card payment to finalize your reservation.
Arrival, opening hours The personnel can communicate with you in English.
Lord Nelson Motel Kingston rooms Rooms
- Please select a date to see the proper prices!
Accommodation services
Pet friendly, Garden
Hairdryer, Fridge, Microwave oven, Tea/coffee-maker


text:
cash handling
cash handling Categories
Cash Handling
Explore SupplyWorks' inventory of cash handling products in the office supplies department. Keep your valuables, cash, and personal items safe and secure with cash drawers, boxes, & trays from manufacturers like MMF Industries. Shop the cash & coin wrappers and cash & coin counters categories for products like bill counters, coin counters, and coin sorters from PM Company and Royal Sovereign International. Quickly prevent paper currency fraud by using counterfeit detectors. We also carry other great products like deposit bags and check writers.


text:
Image 1 of 1
KIEV, UKRAINE - FEBRUARY 19: A Berkut riot police officer throws a stone at anti-government protesters, who were throwing rocks in return, on Independence Square on February 19, 2014 in Kiev, Ukraine. After several weeks of calm, violence has again flared between anti-government protesters and police as the Ukrainian parliament is meant to take up the question of whether to revert to the country's 2004 constitution. (Photo by Brendan Hoffman/Getty Images) *** Local Caption ***
- Copyright
- 2014 Getty Images
- Image Size
- 5320x3547 / 6.4MB
- Contained in galleries
- Maidan Protests


text:
Wednesday, December 23, 2009
Google App Engine Datastore "IN" operator
In http://desert-island.appspot.com, I created a class DesertIslandList, which represents a user's list of his/her 8 desert island albums. It, amongst other properties, contains user_id and id_source. For a user who's logged in via Facebook Connect, the user_id of his/her created list would simply be his Facebook profile id and id_source would be "f" (for Facebook).
In order to display lists created by his/her friends, I, first of all, get his/her friend's id list using friends.get method in the Facebook RESTful API with a version of minifb hacked up for Google App Engine. I then created a GQL query for all DesertIslandList WHERE user_id IN :1 AND id_source = :2 with :1 being the Python list containing all the friend ids as strings, and :2 being "f". Straightforward enough? Well it all seemed so until I stumbled across of a couple of gotchas.
Only 30 items allowed
First of all, I soon got a "too many subqueries (max: 30..." exception. As it turns out, only 30 items are allowed in the list:
(from http://code.google.com/appengine/docs/python/datastore/gqlreference.html) Note: The IN and != operators use multiple queries behind the scenes. For example, the IN operator executes a separate underlying datastore query for every item in the list. The entities returned are a result of the cross-product of all the underlying datastore queries and are de-duplicated. A maximum of 30 datastore queries are allowed for any single GQL query.
So, my bad, not reading the documentation properly. To get around this, you could either somehow limit the list to 30 items or chop your list up into 30-item chunks and union the results (sorting offline if necessary).
What if the "IN" list is empty?
What if he or she has no friends?
Convention SQL wisdom would suggest that the query should return no DesertIslandList objects. However, in the world of Google App Engine datastore, "IN" means cross-product of all the separate individual queries, so in my GQL query above, an empty "IN" list effectively means get all DesertIslandList WHERE id_source = "f" i.e. not filtering on the user_id field at all!
Not only is this slight counter-intuitive, this can also throw a surprise "no matching index found" exception. The fact that an empty "IN" list does not filter on the user_id field means my GQL instance with an empty "friend ids" list has to access an additional DesertIslandList index with only the id_source field, and not the usual index with both the user_id and the id_source fields. Imagine this, if you have not run a GQL instance with an empty "IN" list in your local dev environment for this particular query, no index (with only the id_source field) will be added to your index.yaml. Up in the cloud, if a person happens to have no Facebook friends, he or she is going to see an ugly stacktrace complaining the the index does not exist!
Of course, the simple solution to this problem is to always check the list to see if it is empty before running the query.
Just another thing to bear in mind!
First time film processing...
Using a changing bag, I tranferred the two rolls of film from the canisters onto the plastic reel, which was then placed into the developing tank. After 30 mins or so of pouring various fluids (developer, fixer, warm water) in and out of the tank, the images finally appeared on the negative films. With the films being hung up by the door to dry overnight, I was extremely eager to scan them into Photoshop to get a proper look at them.
The following day, I gingerly placed the negs onto the glass of my Canon flatbed scanner (using the film adapters that came with the scanner), started up Photoshop and got my first thumbnail previews of the shots. They looked OK, so I went ahead and scanned a few of them at maximum (3200 dpi) resolution. Much to my surprise, they came out extremely grainy, bordering on being rubbish. I love film grains, but what I was seeing was definitely not the level of grains that you would expect from an ISO 400 film. Worse still, one of the rolls had a vertical streak running down every single frame, and I am still not sure whether it was due to a mistake during processing or from the camera itself (I used different cameras for the two different rolls). Since the other roll does not exhibit this defect, I suspect it is more likely to be the latter.
Anyway three of the "better shots" (which I actually quite like) that came out - the first two I took using the my Canonet 19QL (£15 from eBay!) and the last one using my Cosina 35E (£2 from eBay...) - notice the vertical streak in this last one:
Notice the vertical streak in the following photo:
Friday, December 11, 2009
Druid Street Cycles - best LBS in London?
Phone: 07551016380
Having recently bought an old Sun Solo racer from Gumtree (80s Raleigh "gaspipe" steel frame, 27" x 1 1/4 rims, Weinmann single-pivot brakes, Sturmey Archer stem, Sturmey Archer hub, 5-speed), I took it to the little known Druid Street Cycles near London Bridge for a quick service.
Not a lot has been mentioned on the web about this social business project, apart from a couple of youtube videos, a user comment in a Timeout article and an LCC article (they themselves don't have a website):
Thor, who used to repair tanks in his native Germany, started this project to provide affordable (and yes, really affordable) bike repair service for the local community in Southwark. To say that he, along with the rest of Druid Street Cycles, is passionate about building/fixing bikes is an understatement.
I have been there twice now, and on both occasions, the jobs they did on the bike far exceeded my expectation. The first time round, they did a full checkup of the bike, fixed the rear brake, and replaced the dodgy tyres. He ended up only charging me 30 pounds (the tyres along cost 20 quid!) - he even crimped the cable ends for me, such is his attention to details! Second time round, I went in to see if they have any mudguard that would fit over my 27" wheel, which I knew was very hard to come by. In typical Thor's fashion, he said he would find something, and surely he did, somehow he managed to fit a full-length mudguard beautifully on the 27" wheel frame, which has minimal clearance. Initially he refused to take any money from me, but in the end I managed to convince him to take the money, which no doubt would be put to good use to benefit the local biking community.
I really cannot recommend them enough, and I hope more people will get to know about this secret little place hidden underneath one of London Bridge's dark arches.
Ah how can I forget the mention the fact that they provide free courtesy bikes to customers, so you can continue your commute to work or your cycle home while Thor and co. are busying fixing yours! Beat that!
Looking for a commute route, or wanting to share your route with other cyclists? Visit my cycle route database: http://zoomaroundtown.appspot.com!
Tuesday, December 08, 2009
Desert Island Discs for the non-celebs
This is just a little fun project to test out the powerful Facebook Connect API, and to further explore Google App Engine (to find yet another Datastore oddity/feature, which I will blog about soon).
Try it out and add you list!
Tuesday, November 24, 2009
Django template urlencode unicode characters (Google App Engine)
So I created a custom Django template filter to circumvent this issue:
Note: I have only tested it in Google App Engine (GAE) using its Django 0.96 template support. Also, the registration mechanism described below is specific to Google App Engine's own templating engine. However, there is no reason why this custom filter would not work in non-GAE Python apps using Django 0.96 or 1.0 templates. Please follow instructions here to configure your app if you are not using GAE.
The custom tag (which handles both unicode and "non-unicode" characters) itself is very straightforward to create.
I created a module customtags.xss (you can name it something else) as follows:
1) under the root folder of my GAE application, I created a folder "customtags"
2) inside customtags, I created two empty files xss.py and __init__.py (__init__.py will remain empty)
3) inside xss.py, I put
import typesSo, the filter utf-8 encodes the string first if it is of type UnicodeType. (You may want to handle exceptions more gracefully though - at the moment, I am not catching exceptions...)
import urllib
from django import template
register = template.Library()
def unicode_urlencode(value):
if type(value) is types.UnicodeType:
return urllib.quote(value.encode("utf-8"))
return urllib.quote(value)
Let's look at how to register this template library so that you can use the filter inside your Django templates.
In your application script, for example, YOUR_APP_NAME.py, simply insert the line:
webapp.template.register_template_library("customtags.xss")after the import statements at the top of the script. Obviously, if you are calling your module something else, you have to change the line above accordingly.
Now you can write .. in your template!
Friday, November 13, 2009
GPolyline decoding in Python
You can donwload the Python file here.
def decode_line(encoded):
"""Decodes a polyline that was encoded using the Google Maps method.
See http://code.google.com/apis/maps/documentation/polylinealgorithm.html
This is a straightforward Python port of Mark McClure's JavaScript polyline decoder
and Peter Chng's PHP polyline decode
encoded_len = len(encoded)
index = 0
array = []
lat = 0
lng = 0
while index < encoded_len:
b = 0
shift = 0
result = 0
while True:
b = ord(encoded[index]) - 63
index = index + 1
result |= (b & 0x1f) << shift
shift += 5
if b < 0x20:
dlat = ~(result >> 1) if result & 1 else result >> 1
lat += dlat
shift = 0
result = 0
while True:
b = ord(encoded[index]) - 63
index = index + 1
result |= (b & 0x1f) << shift
shift += 5
if b < 0x20:
dlng = ~(result >> 1) if result & 1 else result >> 1
lng += dlng
array.append((lat * 1e-5, lng * 1e-5))
return array
if __name__ == "__main__":
latlngs = decode_line("grkyHhpc@B[[_IYiLiEgj@a@q@yEoAGi@bEyH_@aHj@m@^qAB{@IkHi@cHcAkPSiMJqEj@s@CkFp@sDfB}Ex@iBj@S_AyIkCcUWgAaA_JUyAFk@{D_]~KiLwAeCsHqJmBlAmFuXe@{DcByIZIYiBxBwAc@eCcAl@y@aEdCcBVJpHsEyAeE")
for latlng in latlngs:
print str(latlng[0]) + "," + str(latlng[1])
Hope you Python GMap coders out there will find this useful!
Wednesday, November 04, 2009
Javascript Tester iGoogle gadget
Tip: Handy for testing (parsing) JSON objects!
Being an iGoogle gadget, you can add it to you iGoogle homepage, but you can always just use the embedded gadget right here!
Monday, November 02, 2009
Twitter Search API and Google App Engine
The reason why making Twitter Search API requests on Google App Engine often fails is simple. Twitter rate-limits requests per IP, and on Google App Engine, you share IPs with loads of other apps, a lot of which are probably trying to do the same thing as you i.e. making Twitter Search requests. Unfortunately Twitter Search API is still not incorporated into the Twitter REST API, which means there is no way of identifying requests via your username, so Twitter can only really rate-limit according to IPs.
To circumvent this, I created a simple PHP proxy on my other website (hosted on a "real" machine") :
$url = $_GET['url'];
$session = curl_init($url);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($session);
header("Content-Type: application/json");
echo $json;
and in my GAE Python app, instead of sending the requests straight to Twitter using URL Fetch, I send the requests to this proxy, which does a simple straightforward relay job for me.
Of course, this is less than ideal, as this goes in the face of the philosophy of deploying in a scalable cloud environment such as Google App Engine. But until Twitter allows username-based identification in Twitter Search requests, or Google sorts something out with Twitter (and other service API providers, for that matter), this seems to be the best way to get round this problem!
(I have heard that you are get your own IP on Amazon AWS, but I don't know enough about Amazon AWS to comment on it. Anyway no doubt more and more cloud infrastructures relying on shared IPs will be developed, and I can only see it heading that way...)
Using Twitter as a commenting engine for Zoom around Town
For each route, I programmatically create a bit.ly link for its unique page url e.g. (http://bit.ly/39oF3z for http://zoomaroundtown.appspot.com/findRoutes?id=24001). On the page, I then display a message telling people to comment on the route by sending a tweet starting with @zoomaroundtown http://bit.ly/39oF3z (I'm even including a link that automatically populates the starting text for the user: http://twitter.com/home?status=%40zoomaroundtown%20http%3A%2F%2Fbit.ly%2F39oF3z%20).
To display comments, I use the Search API (http://apiwiki.twitter.com/Twitter-API-Documentation) to search for all tweets sent to zoomaroundtown containing the string http://bit.ly/39oF3z i.e. using the search string to:zoomaroundtown http://bit.ly/39oF3z.
Whether this is a viable way of enabling commenting Zoom around Town, only time can tell. However there are obvious pros and cons:
Extremely easy to implement (especially when I don't have a user login system yet)
Increased site exposure on Twitter
Twitter Search only seems to return tweets no more than 2 weeks old
I have no control over content (but since these are public tweets, do I really care?)
Last but not least, something unfortunately I only managed to discover after deployment to the live cloud environment - Twitter Search's rate limiter does not seem to like Google App Engine, and it is this point that will lead us to my next post, but for now it suffices to say that Twitter Search rate-limits requests per IP, so it is not surprising that in a cloud environment where one is sharing IPs with loads of other apps, some requests are bound to get rejected!
Wednesday, October 07, 2009
Circle overlay on Google Map
To represent the current search areas in Zoom around Town, I decided to overlay two radar-style circles, on the start point map and on the end point map. These circles have to increase and decrease in diameter depending on the user's range selections. See this page in Zoom around Town for a demonstration. When you change the values of the +/- distance dropdowns, and update the maps, you should see the two circles change in size. The radius of the circle corresponds to the selected +/- value.
While the Google Map API (v2) provides GPolyline and GPolygon for drawing lines and polygons on Google Map, it does not provide an overlay class for drawing circles.
One solution is to create a multi-point GPolygon to approximate a circle. Check out this article for an explanation on how this can be done.
A better (in my opinion) solution is to instead use a GGroundOverlay. GGroundOverlay provides a means to overlay an image on top of the map. The image will be scaled automatically as the user zooms the map, so that the image will always cover the same geography area on the map. So, to create a radar-style circle, one only has to find a transparent circle png file, locate the point on the map where the circle should be centred upon, and specify the southwest corner coordinate and the northeast corner coordinate of the imaginery square that bounds this circle (i.e. the GLatLngBounds). Sounds simple, does'nt it? Well almost, to work out the GLatLngBounds coordinates, we need a bit of good old trigonometry.
Pythagoras told us that, for a 2km-radius circle, the four corners of this bounding square will be sqrt(2*2^2) km from the centre of the circle. So, to draw a 2km-radius circle centred upon a specific point, we need the southwest corner coordinate, which is sqrt(2*2^2) at 225 degrees from the original point and the northeast corner coordinate, which is the same distance at 45 degrees from the original point.
Coordinate of a destination point given distance and bearing from a start point
Unfortunately, as the globe is a sphere, working out a destination point coordinate given the distance and the bearing from a start point is no straightforward maths. Fortunately, the good people at Movable Type Ltd. (not to be confused with http://www.movabletype.org) published this informative page. So based on the formula and the Javascript given on the page, I created the Javascript function:
function getDestLatLng(latLng, bearing, distance) {
var lat1 = latLng.latRadians();
var lng1 = latLng.lngRadians();
var brng = bearing*Math.PI/180;
var dDivR = distance/EARTH_RADIUS;
var lat2 = Math.asin( Math.sin(lat1)*Math.cos(dDivR) + Math.cos(lat1)*Math.sin(dDivR)*Math.cos(brng) );
var lng2 = lng1 + Math.atan2(Math.sin(brng)*Math.sin(dDivR)*Math.cos(lat1), Math.cos(dDivR)-Math.sin(lat1)*Math.sin(lat2));
return new GLatLng(lat2/ Math.PI * 180, lng2/ Math.PI * 180);
Now, the rest is easy:
var EARTH_RADIUS = 6378.137; //in kilometres
function drawCircle(map, centrePt, rangeValue) {
var boundaries = getBoundaries(centrePt, rangeValue);
var circle = new GGroundOverlay("/images/map_overlays/circle.png", boundaries);
function getBoundaries(centrePt, radius) {
var hypotenuse = Math.sqrt(2 * radius * radius);
var sw = getDestLatLng(centrePt, 225, hypotenuse);
var ne = getDestLatLng(centrePt, 45, hypotenuse);
return new GLatLngBounds(sw, ne);
Sunday, October 04, 2009
Zoom around Town is live!
Zoom around Town is a global cycle route database, based on user contribution, to help city cyclists get around town.
Please help by adding your commuting routes and by spreading the word!
This project makes heavy use of the Google Map API and has been developed in Python on the excellent and "free" Google App Engine platform. I will no doubt be blogging about some of the interesting technical encounters during the project in the near future.
Wednesday, August 05, 2009
Datastore Bulk Upload + ReferenceProperty in Google App Engine
Did someone shout, "Normalization + Bigtable = Bad"? Well, I have yet to make up my mind on this, and for now, I have decided to go with a more traditional relational database model. This may change in the future, but I decided I should still share my experience with uploading relational data as I feel that many people are probably trying to do the same thing.
Before I carry on, these are the two (simplified) classes:
class Manufacturer(db.Model):
name = db.StringProperty(required=True)
class Camera(db.Model):
name = db.StringProperty(required=True)
weight = db.IntegerProperty()
introduction_year = db.IntegerProperty()
max_aperture_value = db.FloatProperty()
e_mode_p = db.BooleanProperty(default=False)
e_mode_sp = db.BooleanProperty(default=False)
e_mode_ap = db.BooleanProperty(default=False)
e_mode_m = db.BooleanProperty(default=False)
note = db.TextProperty()
manufacturer = db.ReferenceProperty(Manufacturer)
and the CSV:
"Canonet G-III QL17",Canon,620,1972,1.7,FALSE,TRUE,FALSE,TRUE,
"Canonet G-III QL19",Canon,620,1972,1.9,FALSE,TRUE,FALSE,TRUE,
Demi,Canon,380,1963,2.8,FALSE,TRUE,FALSE,TRUE,"Demi is a half-frame camera"
"TRIP 35",Olympus,390,1967,2.8,TRUE,FALSE,FALSE,FALSE,
Effectively, I want four instances of camera and two instances of manufacturer created, with the cameras correctly referencing the manufacturers.
Google App Engine comes with the google.appengine.tools.bulkloader.Loader class which facilitates the process of bulk uploading data to both the development server (local) datastore and the real (cloud) datastore. It supports basic mapping of CSV fields to object attributes. However, dealing with ReferenceProperty turns out to be not so straightforward. A quick Google search led to a few articles suggesting overridding the HandleEntity (or handle_entity?) function when subclassing google.appengine.tools.bulkloader.Loader. Unfortunately, for some reason, I did not manage to get that to work. After some experimentation, I stumbled across my own solution, which actually is quite simple :-)
Instead of injecting the reference in the HandleEntity function, I create a function called get_manufacturer which looks in the datastore for an existing manufacturer based on the manufacturer's name, and returns its key (or the instance itself) if found, or creates a new instance in the datastore before returning the newly assigned key otherwise. I then make that the transformation function for the manufacturer ReferenceProperty.
The following is my loader class with the magic function:
from google.appengine.ext import db
from google.appengine.tools import bulkloader
import model
def get_manufacturer(name):
manufacturers = db.GqlQuery("select * from Manufacturer where name = :1", name)
if manufacturers.count() == 0:
newManufacturer = model.Manufacturer(name=name)
return newManufacturer
return manufacturers[0]
class CameraLoader(bulkloader.Loader):
def __init__(self):
bulkloader.Loader.__init__(self, "Camera",
[("name", str),
("manufacturer", get_manufacturer),
("weight", int),
("introduction_year", int),
("max_aperture_value", float),
("e_mode_p", bool),
("e_mode_sp", bool),
("e_mode_ap", bool),
("e_mode_m", bool),
("note", str)])
loaders = [CameraLoader]
if __name__ == '__main__':
Please refer to http://code.google.com/appengine/docs/python/tools/uploadingdata.html for details on how to do the actual bulk upload.
Saturday, June 06, 2009
GWT Tips 3 - Popups and IE8
Many thanks to Dan!
Friday, June 05, 2009
GWT and Spring Security - sample demo download
You can download the demo project here: http://www.fotowuj.com/gwt_spring_security_demo.zip
Essentially this app demonstrates how a GWT client can access a Spring-managed authentication service (via AuthenticationServiceServlet) to authenticate against Spring Security, and subsequently access a secured operation (getNumOfPrivatePublications) in another Spring-managed service (via DocumentServiceServlet). Please refer to the aforementioned blog articles for detailed discussion on how to integrate GWT and Spring Security.
You may also want to download a version of GWT.
The zip contains a complete eclipse project consisting of:
1) source (both client and server)
2) all dependent jars
3) WebContent/WEB-INF/web.xml, which gets added to the final WAR
4) tomcat/webapps/ROOT/WEB-INF/web.xml, which is required to run in hosted mode
5) build.xml for running app in hosted mode (gwt-shell) and creating war (war)
6) .launch file for running app in hosted mode inside eclipse
You can run the demo in a number of ways:
1) WITH ECLIPSE - having imported the project into eclipse, right-click the .launch file inside eclipse and select "run as...", which will start the app in hosted mode. Note that you will probably have to change the gwt-dev-windows.jar location specified in the .launch file first.
2) RUNNING "gwt-shell" USING ANT - simply run "ant gwt-shell", which will start the app in hosted mode. Note that you will probably will have change the gwt-dev-windows.jar location specified in the build.xml file first.
3) RUNNING "war" USING ANT AND DEPLOYING IN TOMCAT - simply run "ant war", and deploy in Tomcat. Note that you will probably will have change the gwt-dev-windows.jar location specified in the build.xml file first.
PS, a reader recently asked the question, "How come that you declare the services (DocumentService for example) both in the client and in the server package? Why not having the DocumentServiceImpl in the server package implement the DocumentService in the client package?"
And this is my anwser:
1) my design is based on the premises that the Spring layer and the GWT layer are very loosely-coupled e.g. in your company, you may already have all the Spring service beans already developed and you are just bolting a GWT frontend on top of this service layer. There are other reasons why you may want your GWT service interface to be slightly different from your Spring service interface as well.
2) The two interfaces ARE DIFFERENT! The GWT service interface getNumberOfPrivatePublications() method throws a checked ServiceSecurityException while the corresponding method in the Spring service interface does not. There may be alternatives that can potentially circumvent this, but to be honest, I have not really thought hard about this :-)
Anyway as I mentioned before, this is by no means the definitive way to integrate Spring Security in GWT. This method works great for me, but depending on your particular circumstances, this may not work so well. I am just hoping to give you guys some ideas :-)
Wednesday, May 13, 2009
OSGi - the next big thing? (a beginner's view)
Eclipse has been using it for years, and a number of open-source and non open-source Java application servers, such as SpringSource dm server and JBoss, are now providing server-side OSGi support.
I have been hearing the term OSGi for quite some time now. I have always known it to be some kind of modularization framework in Java. It is often mentioned alongside with the other wonderful buzzword that is SOA (Service Oriented Architecture). But what is it really? I decided that I should get a full understanding straight from the horse's mouth. So I went to http://www.osgi.org/About/HowOSGi, read the articles and tried out some examples. After a couple of hours, I learnt (and saw for myself) how using OSGi:
- you can divide up your ugly monolithic application into self-contained, loosely-coupled deployment units / modules known as bundles.
- a single bundle exists as a single JAR file.
- a bundle can access functionality provided by other bundles, but each bundle inherent provides a strict level of encapsulation. The creator of a bundle decides what functionality to expose. Everything else inside the bundle is private otherwise.
- bundles can be installed, updated, uninstalled without restarting the application.
- different versions of a single bundle can be deployed concurrently.
- the current OSGi model assumes that all bundles run in the same JVM, so no distributed SOA ("Don't distribute your objects." - Martin Fowler's "First Rule of Distributed Object Design" :-) )
The idea of modularization of course has existed since the dawn of software engineering, and OSGi is not the first framework to provide modularization in Java. Yes, this idea of being able to hotswap/upgrade bundles during runtime sounds cool. But does an average IT manager REALLY want to be able to swap in a FTSE-lookup service for a DOW JONES-lookup service during runtime? (Oops I think I have just sparked controvery) My point is while OSGi provides an excellent framework for dynamically linking bundles, developers still has to write extra code to handle when a bundle goes offline, for example. For most projects, this kind of flexibility probably spells more trouble than it is worth. And if non-runtime-configurable dependency injection is what you are after, then just stick with simple Spring!
So I was beginning to think whether OSGi is just yet another "grand" idea.
It then suddenly dawned on me that, forgetting about all this hotswappable bundle magic, the basic idea of self-contained deployment units is the answer to the single biggest cause of Java developers' stress - jar hell. I am sure a lot of you have used or are using Maven, Ivy to manage your hundreds of jars. While they do a decent job of managing dependencies and jar versioning, the simple fact remains - without writing custom classloading code, in Java, you cannot have two versions of a same jar in the same classpath and expect one bit of your application to use the 1st version and another bit of your application (maybe you are using some third-party classes) to use the 2nd version. Now, implemented as OSGi bundles, your different "bits" of the application can be packaged with the required versions of the jars (inside their respective OSGi bundle jar) without interfering with each other. Essentially each bundle has its own classpath/classloader. Is that not great?
OK nothing in this world is free. There is obviously the overhead in having to create these bundles, which is something I have yet to try in a real project. Nonetheless, knowing that there is a chance of forever emancipation from jar hell, there is more of a reason now why I should at least consider trying out OSGi for real! Umm it may be a long road, but perhaps a road worth travelling. Well, at least I know it is possible to embed Equinox in Tomcat. That is a start...
Don't get me wrong. I am not knocking OSGi's ability to dynamically manage and link bundles. I am just saying that the more immediate benefit of adopting OSGi may lie in the fact that you can have many versions of the same jar in your project! Yes, a simple problem, but a real problem.
Any comments welcome!
Thursday, March 05, 2009
Bombay Dreams
"13.7 million people call Mumbai home, but not everyone in Mumbai is lucky enough to have a home."
Recently I made a 36-hour stopover in Mumbai on my way from London to Hong Kong.
28th February 2009
Following advice in the guide book, I ordered a "pre-paid" taxi inside the Chhatrapati Shivaji International Airport. In just under 40 minutes, I was dropped off at the YMCA near Mumbai Central train station. The YMCA is an excellent hotel if you don't mind the fact that it is not located in the touristy South Mumbai. In fact, it turned out that the location was pretty convenient for visiting a number of interesting sites in the city. And how can I not mention the tasty buffet dinner, which is included in the very reasonable room price.
Having filled up my water bottle, I was ready to brave the 37C heat. Initially, it did not feel as scorching as I had expected. However, the combination of heat and constant car-horning was quickly doing my head in. Instead of wandering in the general direction which I had expected to take me through the Kalbadevi neighbourhood, past Crawford Market and onto Chhatrapati Shivaji Terminus, formerly known as Victoria Terminus (CST), I decided that I should take out my map and follow a more precise route. Having previously been to Delhi and several Rajasthan cities, I had an idea of how tough life can be in cities for the less privileged. Walking down the side streets, I soon realised that life in Mumbai for the marginalized was no better than what I had witnessed before, if not worse. The clusters of corrugated iron-roof huts (for the more lucky ones) hiding timidly behind the main thoroughfares were a constant reminder of the millions of slum dwellers in Mumbai, who ironically serve as the unsung powerhouse of the city's economy.
I soon arrived at the first stop, Mumbaidevi Temple in Kalbadevi. Mumbaidevi is the patron goddess after which the city took its name. The entrance to the temple is notoriously hard to find, but the guidebook clearly said there would be a long queue of faithfuls, which I could join to enter the temple. People were busy running around in all directions, but no queue of any description was to be found. I referred to the guidebook again, it also clearly said it is closed between noon and 4pm. Of course I had just managed to overlook this minor detail and had arrived during their siesta. Doh.
Finding Crawford Market was easy enough as it stood right by an unsightly flyover. A lot of the stores were closed when I arrived, but the cover market provided a much needed shelter from the increasingly tormenting sun. After bidding farewell to puppies housed in tiny cages (which presumably would one day be sold to someone with a stronger belief in animal wellfare), I carried on walking along the flyover to reach Chhatrapati Shivaji Terminus. I had once read that the train station was home to hundreds of street kids. I did not see any when I was there. Part of the exterior of the station was undergoing renovation, but the grandeur of the place still made it a magnificent sight to behold. From the grandeur of Chhatrapati Shivaji Terminus, I crossed a busy road Indian-style to reach the convenience that is universally known as McDonald's. In an attempt to not feel completely shameful visiting McD in India, I ordered a McAloo Tikki. Sadly, it tasted not much different from any of the other McInventions. It did the job nonetheless.
With a full stomach and a pair of less tired legs, I ventured further south to visit the Horniman Circle and the Ballard Estate / Dockyard districts. The broad tarmac roads provided perfect venues for many impromptu cricket games. Luckily for all those aging colonial buildings, tennis balls were used. And of course passing cars have to give way to the cricketers. I was disappointed to find that the whole of the waterfront was a restricted area due to national security, so no glorious view of the Gateway of India from across the water.
It was time to make my way back to the YMCA. I passed Mohammed Ali Road on the way. The religious divide (or harmony, depending on how you look at it) in India cannot be better illustrated than by the two surrounding neighbourhoods: the Islamic neighbourhood to the east and the Hindu neighbourhood to the west.
1st March 2009
After a hearty breakfast at the YMCA, I decided to walk to Malabar Hill and to the Hanging Garden. The garden was not all that, but any excuse to sit around in the shade was a good one. Visiting the excellent Jain Temple on the way, I descended the hill taking Walkeshwar Road to reach Chowpatty Beach. Looking out onto the Manhattan of Mumbai across the bay, the beach does not only provide a weekend escape for millions of Mumbai residents but also another plot of land for the marginalized to sleep under the stars.
I finally gave up walking and took the train from Charni Road to Churchgate. The guidebook did not paint a very appealing picture of this mode of transport, which is an integral part of the daily lives of the millions of Mumbai commuters. The journey was painless enough and in no time I arrived at Churchgate. With students playing crickets in a quintessential English setting, Churchgate would most certainly get Michael Palin's approval.
Not far from Churchgate was the Gateway of India, which had been built to commemorate the visit and King George V and Queen Mary to Mumbai, and the Taj Mahal Palace and Tower Hotel. A sombre mood surrounded the imposing hotel, which was still undergoing renovation following the terrorist attack on the 26th of November, 2008. There was a sense of defiance as local and visiting Indians gathered along the waterfront to reflect upon what had happened.
My stay in Mumbai was quickly coming to an end, but not just yet. It was 4:45pm and seeing that I had to be back at the YMCA by 7pm to catch a taxi for the airport, I had to decide whether to take a taxi from Churchgate back to the hotel or to take the train. Taxi would be the more comfortable option but there might be a chance of being stuck in the horrendous traffic. Somehow, the train seemed to make more sense at that time. I thought, if I ran to the train station quickly, I would just manage to beat the rush hours.
It turned out I was very wrong. I got onto the train without any problem as Churchgate was the right at the end of the train line, but when more and more people poured inside the carriage as the train made its way north, I came to realise that taking the train was essentially a very bad idea. I had to get off at the next stop, Mumbai Central, but I was stuck in the middle of the carriage, naively hoping that people would somehow make way for me to exit the train. The fact that I was not sure which side to leave the carriage did not help. It became obvious that I was going nowhere as the train ground to a halt. People were already literally fighting their way onto the train. Next thing I knew, the train was in motion again. While my predicament provided entertainment for some fellow passengers, others took sympathy and urged me to push my way towards the door (incidentally there were no actual doors) in preparation to do battle at the following station. I was in pole position, but the whole world collapsed on me when a tsunami of bodies came crushing in before the train even came to a stop. I did finally make it off the train, but not without getting an elbow in the face. It was simply the most traumatic experience. I had to take the train in the opposite direction to get back to Mumbai Central. Luckily, the train going south was quite a lot less packed. Standing by the door as the train zoomed past industrial estates and residential high-rises, I was still struggling to get over the previous shock.
The taxi journey to the airport was blissful by comparison. I tried to absorb the smell of this truly overwhelming city. I tried to understand the contrast between the rich and the poor that I was seeing outside the taxi window. Under a bridge, I saw a family sitting around a dimly-lit fire. 13.7 million people call Mumbai home, but not everyone in Mumbai is lucky enough to have a home.
Wednesday, March 04, 2009
Shek O 石澳 bouldering
Weather forecast was predicting at least five days of rain, which meant any hope of bolt-clipping in Tung Long during my short stay in HK was effectively gone, so before it started getting properly wet, I decided to give Shek O a go.
Taking my rock shoes and the excellent guide provide free by the kind people at http://www.hongkongclimbing.com/ (and no, I did not have a crash mat!), I took bus no.9 from the bus terminal just outside the Shau Kei Wan (筲箕灣) MTR station. The journey took about 15 minutes, the normally scenic route was sadly not very scenic in the light drizzle and the heavy mist.
Arriving at the village, I followed the aforementioned guide and found my way to the boulder spots easy enough. The laid-back setting of the village itself provided the perfect antidote to my last few days of being constantly bombarded by car-horns in Mumbai and by people talking about the latest news on the fund-raising plan by HSBC on their mobiles in Hong Kong. Even though, I suspect if it had been a weekend and if it had not been raining, the place would have been heaving like the rest of Hong Kong!
I warmed up on a couple of V1 problems on "Block 3" in the Village Boulders area just before the footbridge. The holds were positive enough and the friction was certainly good on the granite, but I was constantly being reminded by the scattered blocks underneath my feet of the certain possibility of my ankles breaking if I was going to fall. I did not have the nerve to try the harder problems which consisted mostly of slopers for hands and flat-smearing on the slightly overhanging boulder.
I then crossed the footbridge to look for "The Corridor" but did not hang around long as, again, technical climbing was the order of the day and I was not getting over the fear of potentially breaking my ankles. Some problems certainly looked interesting and I wished I had a crash mat.
Following the path, I made my way to the "Headlands Boulders" area. "Lone Block" was definitely fun. The V0 problem was a well-deserved 3-star, albeit being a bit short. I also managed the 360 traverse but could not do it in one go. Unfortunately the area stank of piss (or maybe it was something coming from the concrete hut next to it), which was a shame as the atmosphere was perfect otherwise (despite the constant drizzling, which I had kind of forgotten about by that point). I then moved on and tried out the three aretes on the "Cliff Top" boulders. The V0 was easy enough and it was kind of fun, but the V1's did not have much in terms of hand holds on them and, again, technical climbing on hard landing was not quite what I was prepared to put myself through. I backed down both climbs.
The drizzle was getting more and more annoying, and being disheartened by my failure to climb the two v1's, I decided to call it a day.
Pretty crap climbing (not a reflection on the quality of the area, but rather a reflection on my own incompetence and the fact that a crash mat is pretty essential), but 30 mins from my doorsteps to a bit of rockclimbing above crashing waves, I could not really complain!
Tuesday, February 24, 2009
GWT Tips 2 - nocache.js getting cached in browser
A bit of investigation revealed that this is because their browsers are caching the all-important YOUR_MODULE_NAME.nocache.js file. This file is GWT's bootstrapping file and its content (not its name) is likely to change as you introduce changes and then gwt-compile your Java code. If a user has an older version of this js file cached in the browser, the application will not be able to properly communicate with your server code. One should make sure that this file does not get cached by the browser nor any proxy servers along the way.
You may wonder what is the significance the of the "nocache" bit in the name. What does it actually do? Well, it does not do anything! But having this identifiable string in the filename does allow you to configure your server to send HTTP header information to the client browser to stop it from caching the file.
If you are using Apache to serve your static files. You can simply edit your .htaccess file to send the correct HTTP header information to the client for this nocache.js file.
However, if you are using a Java application server such as Tomcat to server your static files, you have to create a servlet Filter to dispatch the necessary HTTP header information. Below is a filter I have written to do exactly this:
import java.io.IOException;
import java.util.Date;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
* {@link Filter} to add cache control headers for GWT generated files to ensure
* that the correct files get cached.
* @author See Wah Cheng
* @created 24 Feb 2009
public class GWTCacheControlFilter implements Filter {
public void destroy() {
public void init(FilterConfig config) throws ServletException {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException,
ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
String requestURI = httpRequest.getRequestURI();
if (requestURI.contains(".nocache.")) {
Date now = new Date();
HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.setDateHeader("Date", now.getTime());
// one day old
httpResponse.setDateHeader("Expires", now.getTime() - 86400000L);
httpResponse.setHeader("Pragma", "no-cache");
httpResponse.setHeader("Cache-control", "no-cache, no-store, must-revalidate");
filterChain.doFilter(request, response);
Essentially, this filter checks whether the requested file name contains the string ".nocache.", and if it does, it sets the header to tell the browser and any proxy servers along the way to not cache the file. For an excellent explanation of the different header options, check out http://code.google.com/p/doctype/wiki/ArticleHttpCaching.
Of course, you would have to add this filter to your web.xml (host-mode as well as standalone mode):
Monday, February 23, 2009
Spring Tips 1 - reading encrypted passwords in properties file
Here is the answer - http://forum.springframework.org/showpost.php?s=6d689f6afe0143a9ab3a77bfbb8e017c&p=7965&postcount=6 (thanks to none other than Juergen Hoeller)
Pretty slick!
Friday, February 20, 2009
GWT Tips 1 - Chain of Responsibility
foo.bar(param, new AsycnCallback<object>) {
public void onFailure(Throwable throwable) {
// handle exception
public void onSuccess(Object result) {
// successful execution of asynchronous RPC
What if you have to make a series of RPC calls such that an RPC call only gets invoked after the previous call has succeeded. Of course we can simply wrap this series of RPC calls inside one single RPC on the server side so that the client does not have to worry about synchronising the calls, but you maybe you want to update the user interface between calls, or you may want to execute some client-side logic before making the second call.
You may start off writing code like this:
foo.bar(param, new AsycnCallback<object>) {
public void onFailure(Throwable throwable) {
public void onSuccess(Object result) {
// some client-side logic before invoking the second RPC
foo2.bar2(param, new AsycnCallback<object>) {
public void onFailure(Throwable throwable) {
public void onSuccess(Object object) {
This is hard to follow and error-prone. A way to avoid nested RPC calls is to leverage the Chain of Responsibility design pattern. The main class in the design pattern is the AbstractHandler. The following is a basic implementation of this class:
* An abstract handler in the Chain or Responsibility design pattern.
* @author See Wah Cheng
* @param <T>
* type of request object to handle
public abstract class AbstractHandler<T> {
private Handler<T> successor;
public void setSuccessor(Handler<T> successor) {
this.successor = successor;
public Handler<T> getSuccessor() {
return successor;
public void handOverToSuccessor(T request) {
if (successor != null) {
public abstract void handleRequest(T request);
Given this class, to execute a series of RPC calls, one simply has to create a concrete implementation of this AbstractHandler for each RPC call and chain them together as follows: (where InvocationContext is some kind of class encapsulating the details needed for the various RPC invocation)
public class FooInvoker extends AbstractHandler<Invocationcontext> {
public void handleRequest(InvocationContext request) {
Object param = request.getFooParam();
foo.bar(param, new AsycnCallback<object>) {
public void onFailure(Throwable throwable) { // handle exception }
public void onSuccess(Object result) {
// some client-side logic before invoking the next RPC
// updating request object if necessary
public class Foo2Invoker extends AbstractHandler<InvocationContext> {
public void handleRequest(InvocationContext request) {
Object param = request.getFoo2Param();
foo2.bar2(param, new AsycnCallback<object>) {
public void onFailure(Throwable throwable) { // handle exception }
public void onSuccess(Object result) {
// some client-side logic before invoking the next RPC
// updating request object if necessary
InvocationContext request;
FooInvoker fooInvoker = new FooInvoker();
Foo2Invoker foo2Invoker = new Foo2Invoker();
OK you may be shouting, "Isn't this a lot of code for something pretty simple? Er, agile? Hello?" Yes, it is more verbose, and whether this approach offers any benefit depends on the situation. If you are making three or more RPC calls in series, I definitely think this will lead to better quality code. If, inside each callback's onSuccess method, you are doing more than just invoking the next RPC, this will certainly lead to better code. If the individual stages are needed elsewhere, this again will lead to more reusable code.
Finally, an added benefit of this is that the order of execution can be altered quite easy just by shuffling the handler order in the chain (assuming that the order of execution does not matter!)
Wednesday, February 18, 2009
GWT and Spring Security
As promised, I am posting this article to share my experience with using Spring Security (formerly ACEGI) with GWT. Apologies for the delay. I guess I have just been busy + lazy!
First of all, for those of you who haven't, please read my previous blogs GWT Spring Integration and GWT Spring Integration - using ContextLoaderListener to see how to use Spring-managed service beans in GWT.
Again it is not my intention to provide a complete solution for GWT / Spring Security integration as there are so many ways of doing it, and which method to choose depend hugely on how you want to actually use Spring Security inside GWT. By sharing my limited experience here, I hope to give some ideas to those of you who are trying to come up with a solution that fits your needs.
So how do I want to use Spring Security in my GWT application?
I want to:
1) leverage Spring Security's SecurityContext mechanism to store authenticated token, which I can then access anywhere in my code
2) be able to annotate my service classes, so that Spring can apply method security using AOP to my service beans
I DO NOT want to:
1) let Spring Security automatically handle form authentication for me
2) rely on Spring Security to automatically redirect user to login page
In other words, using Spring Security, I want to develop some form of RPC service which my GWT client can call to authenticate the username and password supplied by the user at the login screen. Once authentication has succeeded, a token which identifies the current user as being authenticated will be available to all subsequent RPC requests, so that I can either manually inspect the token inside the RPC request to enforce some form of authorization, or I can rely on Spring Security's off-the-shelf method security mechanism to allow or disallow user call certain methods in my Spring managed service beans.
I am going to break up the rest of the article into three different sections: An authentication service, HTTP Session Integration and Method Security
An Authentication service
The following is a simple implementation of such a service:
import org.springframework.security.Authentication;
import org.springframework.security.context.SecurityContext;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.context.SecurityContextImpl;
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
import org.springframework.security.userdetails.User;
public class AuthenticationServiceImpl implements AuthenticationService {
* Authenticates against the supplied credentials,
* populating the Spring SecurityContext if
* credentials are OK.
* @param username
* @param password
* @return
* whether authentication is successful
public boolean authenticate(String username, String password) {
// check credentials, e.g., by querying a database...
boolean authenticated = checkCredentials();
// look up authorities by, e.g., querying the database...
GrantedAuthority[] authorities = getGrantedAuthorities(username);
if (authenticated) {
User user = new User(username, password, true, true, true, true, authorities);
Authentication auth = new UsernamePasswordAuthenticationToken(user, password, authorities);
SecurityContext sc = new SecurityContextImpl();
return authenticated;
public void logout() {
This of course is a very simple implementation, but the point to note is within the authenticate method, an Spring Authentication object is created and inserted into the SecurityContext programmatically.
We can simply turn this into a RPC service by creating a com.google.gwt.user.server.rpc.RemoteServiceServlet implementation in which we either access AuthenticationServiceImpl directly or via a Spring ApplicationContext as described in my previous blogs GWT Spring Integration and GWT Spring Integration - using ContextLoaderListener.
Now we have a service that effectively let us "log into" the system. However, this on its own is rather useless, as the token is not available to subsequent request threads. If we have a RPC service for retrieving documents, and we would like to protect the documents, we really would want to be able to, inside the service, inspect the SecurityContext to see whether an authenticated token exists. We want be able to do the following, which we cannot do... yet:
if (SecurityContextHolder.getContext() == null
SecurityContextHolder.getContext().getAuthentication() == null
!SecurityContextHolder.getContext().getAuthentication().isAuthenticated) {
// no authenticated token found, stop user from retrieving documents
HTTP Session Integration
Luckily, Spring Security provides a filter, org.springframework.security.context.HttpSessionContextIntegrationFilter, which automatically synchronises the current SecurityContext with a http session object, thus, making the token available to all subsequent request threads.
We can enable this filter in a number of ways. We can create the filter directly in web.xml (host-mode or standalone mode). Or we can create a org.springframework.security.util.FilterToBeanProxy in web.xml and define a FilterChainProxy in the Spring ApplicationContext. Or we can, as most people do nowadays, create a org.springframework.web.filter.DelegatingFilterProxy called springSecurityFilterChain (note: the naming is crucial) in web.xml and use Spring Security Namespace Configuration in the ApplicationContext to create the necessary beans. We will have a look at this last approach.
In web.xml
In Application Context:
<beans xmlns="http://www.springframework.org/schema/beans"
<security:http entry-point-ref="dummyEntryPoint" create-session="always" />
<bean id="dummyEntryPoint" class="com.seewah.blog.DummyEntryPoint" />
This is pretty neat, except for the fact that we have to create a "dummy" org.springframework.security.ui.AuthenticationEntryPoint, even though we are not replying on Spring Security to redirect user to login page. Unfortunately, by design, the security:http tag requires an AuthenticationEntryPoint, so I created this class:
public class DummyEntryPoint implements AuthenticationEntryPoint {
public void commence(ServletRequest request, ServletResponse response, AuthenticationException e) throws IOException, ServletException {
throw new IllegalStateException("This implementation is a dummy class, created purely so that spring security namespace tags can be used in application context, and this method should never be called");
OK, so now we have a way to "log into" the system, and we can inspect the SecurityContext in subsequent RPC requests to grant or deny users access to certain services. However, we would like to go one step further. We would like to leverage the excellent method security feature provided by Spring Security because we like our security layer to be non-invasive, and we like AOP.
Method Security
We configure method security as follows:
In Application Context:
<security:global-method-security secured-annotations="enabled" jsr250-annotations="disabled" />
<bean id="dummyAuthenticationProvider" class="com.seewah.blog.DummyAuthenticationProvider">
<security:custom-authentication-provider />
Unfortunately, again, because of the way Spring Security Namespace Configuration works, we have to introduce another dummy class, even though it will never be used. Remember our AuthenticationServiceImpl creates authenticated token programmatically and method security will simply grant / deny access based on the presence of this token. Hence the authencationProvider here becomes redundant. We implement the dummy class as follows:
public class DummyAuthenticationProvider implements AuthenticationProvider {
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
throw new IllegalStateException("This implementation is a dummy class, created purely so that spring security namespace tags can be used in application context, and this method should never be called");
public boolean supports(Class clazz) {
throw new IllegalStateException("This implementation is a dummy class, created purely so that spring security namespace tags can be used in application context, and this method should never be called");
Of course, as method security is implemented using AOP in Spring, only Spring-managed beans are protected, which means in order to use this mechanism to protect our service layer, we MUST access these services via the Spring ApplicationContext (GWT Spring Integration and GWT Spring Integration - using ContextLoaderListener) and NOT directly.
When a protected method is accessed without an authenticated token being present in the SecurityContext, Spring throws a SpringSecurityException. If we let this exception propagate all the way to the GWT client code, we are most certainly going to be greeted with the dreaded SerializableException error. Instead we should catch this exception and rethrow an exception that GWT can safely serialize and pass to the client side. We define such an exception, ServiceSecurityException, in our GWT client package, and now we have a mechanism that translates a Spring Security method security exception into a GWT client exception:
On the server
public class DocumentServiceImpl implements DocumentService {
public void delete(Long id) {
public class DocumentServiceServlet extends DependencyInjectionRemoteServiceServlet implements ... {
private DocumentService documentService;
public void delete(Long id) throws ServiceSecurityException {
try {
} catch (SpringSecurityException e) {
throw new ServiceSecurityException(e.getMessage());
Inside the client
documentServiceAsync.delete(id, new AsyncCallback<Object>() {
public void onFailure(Throwable throwable) {
if (throwable instanceof ServiceSecurityException) {
// client side logic to redirect user to login page, for example
} else {
Of course, seeing that we need client-side exception handling whenever we invoke an "secured" RPC call, we may as well create an AutoErrorHandlingAsyncCallback and invoke all our RPC calls passing through an instance of this callback instead of the normal AsyncCallback object:
public abstract class AutoErrorHandlingAsyncCallback<T> implements AsyncCallback<T> {
final public void onFailure(Throwable throwable) {
if (throwable instanceof ServiceSecurityException) {
// client side logic to redirect user to login page, for example
} else {
OK this way of using Spring Security method security is not as non-invasive as we have perhaps hoped, but IMHO this is far better than writing code to check for authenticated token in SecurityContext in the services themselves.
GWT Spring Integration - using ContextLoaderListener
Just a quick followup post to my last post http://seewah.blogspot.com/2008/07/gwt-and-spring.html.
In the last post I demostrated how to use the SpringApplicationContextLoader to manually load an application context from an xml file and subsequently to access Spring-managed beans via this class inside DependencyInjectionRemoteServiceServlet.
For one reason or another, I have moved away from this approach and gone back to the traditional means of using the org.springframework.web.context.ContextLoaderListener in web.xml to load application contexts. So this is what to do if you prefer this approach.
First of all, create the listener as you would with a normal Spring web application
in web.xml. If you are running in host mode, this is found under the tomcat/webapps/ROOT/WEB-INF folder inside your project. Otherwise, just edit the usual web.xml inside your webapps folder in your tomcat installation.
Now, inside DependencyInjectionRemoteServiceServlet, simply use the static org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(ServletContext sc) method to access the loaded application context. This following is the revised class:
import java.lang.reflect.Field;
import java.util.HashSet;
import java.util.Set;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
* {@link RemoteServiceServlet} that automatically injects IoC dependency.
* "org.springframework.beans.factory.annotation.Autowired" annotation is used
* for marking which fields to inject into. Uses
* {@link SpringApplicationContextLoader} to retrieve beans by name.
*

* Note that the current implementation will only inject "declared" fields, and
* not inherited fields. Fields can be private, protected, package or public.
* @author See Wah Cheng
* @created 27 Jun 2008
public class DependencyInjectionRemoteServiceServlet extends RemoteServiceServlet {
protected static Logger logger = Logger.getLogger(DependencyInjectionRemoteServiceServlet.class);
public void init() throws ServletException {
* Carries out dependency injection. This implementation uses Spring IoC
* container.
* @exception NoSuchBeanDefinitionException
* if a suitable bean cannot be found in the Spring application
* context. The current implementation looks up beans by name
protected void doDependencyInjection() {
for (Field field : getFieldsToDependencyInject()) {
try {
boolean isFieldAccessible = field.isAccessible();
if (!isFieldAccessible) {
field.set(this, WebApplicationContextUtils.getWebApplicationContext(getServletContext()).getBean(field.getName()));
if (!isFieldAccessible) {
logger.debug("Dependency injection successful: " + this.getClass().getName() + "." + field.getName());
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
* Find annotated fields to inject.
* @return a list of all the annotated fields
private Set<Field> getFieldsToDependencyInject() {
Set<Field> fieldsToInject = new HashSet<Field>();
Field[] fields = this.getClass().getDeclaredFields();
for (Field field : fields) {
if (field.getAnnotation(Autowired.class) != null) {
return fieldsToInject;
Note that there are two changes to this class. First of all, doDependencyInjection() now accesses the application context using the org.springframework.web.context.support.WebApplicationContextUtils class as described above. Secondly, doDependencyInjection() is now invoked from inside the servlet's init() method and not its constructor. This is because, when org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(ServletContext sc) is invoked inside doDependencyInjection(), a reference to the servlet's ServletContext must be obtained, and this is only available after the servlet object has been constructed.


text:
Earn 5 Together Rewards points on this item
Silly Moo Moo
Format: Paperback Author: Karen King
Free Click & Collect
Check availability in your local store
Free Delivery Available
- Free Standard over £20
- Standard delivery £2.99
- Next working day £4.99
Product Information
Details:
An apple has fallen on Cows head and she can't remember where she lives! Children will love to join Silly Cow and her animal friends as they try to find her home.

Ideal for:
A wonderful picture book for little ones to share and enjoy with their parents.

This paperback book measures: 25.4 x 25.4 x 0.3cm.
Stress-Free Returns
Subject to exceptions, we are happy to exchange or refund your purchase within 28 days of delivery. You can return items by post or to one of our stores.Go to full returns information
Together Rewards
5 points for every pound you spend
Rewards Points PLUS Great Prices - YES! We're proud to give even more back to you and reward all Together Rewards Card members with 5 points for every £1 spent, along with exclusive offers, bonus points promotions, member exclusive gifts and more! Interested? Order a card with your purchase and once you've registered and linked your Card, you'll receive 50 FREE points (worth 50p) and you'll receive Reward Vouchers every 3 months to spend on anything you like in-store and online! Click here to find out how to get your Together Card.


text:
Korean Immigration Forum
LAPD Olympic Area partners with Korean American Coalition and Council District 10
Korean Immigration Forum
MAGA Methodist Church of Los Angeles
433 South Normandie Ave.
Los Angeles, CA 90020
Thursday, April 13, 2017 at 6:30 pm - 9:00 pm
Olympic Area and Korean American Coalition along with community partners would like to connect the Korean Community with resources, service tips, and answers to questions that can help protect from immigration fraud, as well as guidance regarding immigration needs.
Guest Speakers
For more info, contact:
Sgt. Puente (213) 382-9114
email@example.com or
Officer Ahn (213) 382-9117
Comments are closed.


text:
Sorry, this property is no longer available. But no worries. We're forwarding you to some other rental properties you may like.
(If you're not forwarded automatically in 5 seconds, click here to go there yourself.)
Hi there! Thanks for inquiring about this 3 bedroom rental listed for $1,195.00 a month.
This rental is represented by Dodson Property Management and is shown by the leasing professional. I'll need some basic information and then I can submit a showing request.
We text you about your viewing. We will not call you.
- Be the first to move in to this well maintained townhome!- Large Living Room With Plenty Of Natural Light- Open Kitchen With Breakfast Counter (Range, Fridge, And Dishwasher Convey)- Large Dining Area- Washer And Dryer Included!- Central Heat And Air (Air Filters Delivered To Your Door Quarterly For a $10 Monthly Filter Fee)- Big Master Bedroom- Lawncare (not including raking) And Trash Included!- Fenced In Back Yard- Attached Shed For Storage**All Information Deemed Reliable But Not Guaranteed**- $125 Leasing Fee (Due At Lease Signing)- $10 Filter Fee (Monthly)
All information deemed reliable but not guaranteed.
We'll take you through Tenant Turner to point out features and how to use them.


text:
You are in Accommodation > Central > Hatton > Villas > Romantic Honeymoon in Tea estate with a Lake view
Rate: Rs. 6,000 to Rs.10,000 Per Day
Rooms: 2
Sleeps: 4
Bills included? Yes
Castlereigh Family Cottages, a perfect Honeymoon spot bordering the Castlereigh Reservoir in the Bogowanthalawa Valley, known as the Golden Valley of tea.
The sitting rooms and the balconies face the serene waters giving a panoramic view of the water and the hills surrounding it.
Day trips to other beautiful places of interest, such as Adams Peak – the most important mountain in Sri Lanka and the most popular hill climb, Emerald coast.
Don't forget the Tea Castle dedicated for James Taylor, Dutch churh on hiltop, Wanaraja Tea factory, Devon water falls. Sip the varieties of tea from Melsna Tea center overlooking the waterfall.
Hatton, 3 kms, is well developed with supermarkets , Railway Station , Hospital , Bars and Restaurants and Streets which are having proper control of city traffic Instead of wasting time and money in over populated Kandy, try this hill station. Privacy, Cool climate, Tasty meals, panaromic view of the Castlereigh lake, Tea estates - Its a WOW experience.
Its only 3 hours from Colombo, Enjoy the Kithulgala river banks on your way to Castlereigh, taste the strawberry tea at "the tea cup" at Wattawalla, then settle for peace close to the lake, surrounded by tea plantations. Full package from Airport to Cottage and back can be arranged.
For accommodation in Colombo, click on www.brama.lk or contact email@example.com or 0094759315001
Rental rates:ROOM ONLY (ACCOMODATION ONLY) USD 70.00 for Couple
BED & BREAKFAST USD 90 for Couple
BED, BREAKFAST, Lunch OR Dinner USD 100 for Couple BED, BREAKFAST, Lunch AND Dinner USD 110 for Couple
Transport - Pick up & Drop back - Request for quote stating the Pickup point and Drop back point.
Colombo Stay - USD 90* - Airconditioned rooms with Self catering Kitchen (Electricity bills extra)
To book/reserve please contact:
back to results
All ads are completely free!


text:
Discussion in 'Introductions' started by beerface99, Sep 9, 2010.
Just waiting for the Fedex guy to show up. New X should be here anytime now! Can't wait!
Howdy beerface - Welcome to the Android Forums - I love my X & you'll love yours - Cheers
Welcome to Android Forums!


text:
Senate Panel Votes to Include Military Tuition in 90/10 Rule
August 6, 2013
A U.S. Senate panel last weekend passed a rider to the defense appropriations bill that would count federal spending on tuition assistance for members of the military and their spouses toward a threshold that requires for-profit colleges to receive less than 90 percent of their revenue from federal sources. Military tuition spending, as well as funds from the Post 9/11 GI Bill, currently do not count as federal money under the so-call "90/10" rule. Sen. Dick Durbin, an Illinois Democrat and critic of the for-profit sector, introduced the legislation, which also prohibits for-profits from spending money from military tuition assistance on marketing or advertising.
Opinions on Inside Higher Ed
Inside Higher Ed's Blog U
What Others Are Reading
- Viewed
- Past:
- Day
- Week
- Month
- Year


text:
It's the same old City, says Sir Alex Ferguson
Manchester United manager still sees Chelsea and Liverpool as main threats despite newfound wealth of neighbours
Manchester City may have succeeded in getting under Sir Alex Ferguson's skin with some of their grand statements since becoming flush with Arab wealth this season, but, to judge from his comments yesterday, the Manchester United manager views them as an irritation rather than a threat.
Holding court at United's training ground yesterday afternoon, Ferguson said that City's newfound riches had brought a "different focus" on Sunday's derby match at the City of Manchester Stadium, but he was for once looking through the eyes of the media rather than his preferred red-tinted glasses. From United's perspective, City may have won the past two derby meetings, may have been bought out by the the fabulously wealthy Abu Dhabi United Group and may, in Robinho, have a…